diff --git a/src/parser/lex.rs b/src/parser/lex.rs index 620bbd7cd2..caa07fc87a 100644 --- a/src/parser/lex.rs +++ b/src/parser/lex.rs @@ -41,6 +41,9 @@ pub enum Error { #[error("invalid escape character: \\{}", .ch.unwrap_or_default())] EscapeChar { start: usize, ch: Option }, + #[error("invalid unicode escape sequence")] + UnicodeEscape { start: usize, end: usize }, + #[error("unexpected parse error")] UnexpectedParseError(String), } @@ -49,7 +52,7 @@ impl DiagnosticMessage for Error { fn code(&self) -> usize { use Error::{ EscapeChar, Literal, NumericLiteral, ParseError, ReservedKeyword, StringLiteral, - UnexpectedParseError, + UnexpectedParseError, UnicodeEscape, }; match self { @@ -66,13 +69,14 @@ impl DiagnosticMessage for Error { Literal { .. } => 208, EscapeChar { .. } => 209, UnexpectedParseError(..) => 210, + UnicodeEscape { .. } => 211, } } fn labels(&self) -> Vec