Fix typo in error name

This commit is contained in:
Wilson Lin 2020-01-09 00:49:17 +11:00
parent 204bd950a4
commit ba4b3f09f3
2 changed files with 4 additions and 4 deletions

View File

@ -7,7 +7,7 @@ pub enum ErrorType {
CharNotFound { need: u8, got: u8 },
MatchNotFound(&'static [u8]),
NotFound(&'static str),
UnexpectedChar(u8),
ExpectedChar(u8),
UnexpectedEnd,
}
@ -38,8 +38,8 @@ impl ErrorType {
ErrorType::NotFound(exp) => {
format!("Expected {}.", exp)
}
ErrorType::UnexpectedChar(unexp) => {
format!("Unexpected {} (U+{:X}).", unexp as char, unexp)
ErrorType::ExpectedChar(unexp) => {
format!("Expected {} (U+{:X}).", unexp as char, unexp)
}
ErrorType::UnexpectedEnd => {
format!("Unexpected end of source code.")

View File

@ -157,7 +157,7 @@ impl<'d> Processor<'d> {
match self.match_reason {
RequireReason::Custom => Err(ErrorType::NotFound(custom_reason.unwrap())),
RequireReason::ExpectedNotChar(c) => Err(ErrorType::CharNotFound { need: c, got: self.match_char.unwrap() }),
RequireReason::ExpectedChar(c) => Err(ErrorType::UnexpectedChar(c)),
RequireReason::ExpectedChar(c) => Err(ErrorType::ExpectedChar(c)),
RequireReason::ExpectedMatch(m) => Err(ErrorType::MatchNotFound(m)),
}
}