diff options
author | Adolfo OchagavĂa <[email protected]> | 2018-11-06 16:05:06 +0000 |
---|---|---|
committer | Adolfo OchagavĂa <[email protected]> | 2018-11-06 16:07:27 +0000 |
commit | c56db92d1f9b1a24de24cefd996c43c7b988b4c3 (patch) | |
tree | 3085626b9ff574af24fd02b4b99ddf910d1abdbd /crates/ra_syntax/src/yellow | |
parent | d1b242262a6617b22140bddd0bed23115c260e74 (diff) |
Finish implementing char validation
Diffstat (limited to 'crates/ra_syntax/src/yellow')
-rw-r--r-- | crates/ra_syntax/src/yellow/syntax_error.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/crates/ra_syntax/src/yellow/syntax_error.rs b/crates/ra_syntax/src/yellow/syntax_error.rs index f3df6bc15..9aed9e81e 100644 --- a/crates/ra_syntax/src/yellow/syntax_error.rs +++ b/crates/ra_syntax/src/yellow/syntax_error.rs | |||
@@ -69,6 +69,14 @@ pub enum SyntaxErrorKind { | |||
69 | LongChar, | 69 | LongChar, |
70 | EmptyAsciiEscape, | 70 | EmptyAsciiEscape, |
71 | InvalidAsciiEscape, | 71 | InvalidAsciiEscape, |
72 | TooShortAsciiCodeEscape, | ||
73 | AsciiCodeEscapeOutOfRange, | ||
74 | MalformedAsciiCodeEscape, | ||
75 | UnclosedUnicodeEscape, | ||
76 | MalformedUnicodeEscape, | ||
77 | EmptyUnicodeEcape, | ||
78 | OverlongUnicodeEscape, | ||
79 | UnicodeEscapeOutOfRange, | ||
72 | } | 80 | } |
73 | 81 | ||
74 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 82 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -83,6 +91,14 @@ impl fmt::Display for SyntaxErrorKind { | |||
83 | EmptyChar => write!(f, "Empty char literal"), | 91 | EmptyChar => write!(f, "Empty char literal"), |
84 | UnclosedChar => write!(f, "Unclosed char literal"), | 92 | UnclosedChar => write!(f, "Unclosed char literal"), |
85 | LongChar => write!(f, "Char literal should be one character long"), | 93 | LongChar => write!(f, "Char literal should be one character long"), |
94 | TooShortAsciiCodeEscape => write!(f, "Escape sequence should have two digits"), | ||
95 | AsciiCodeEscapeOutOfRange => write!(f, "Escape sequence should be between \\x00 and \\x7F"), | ||
96 | MalformedAsciiCodeEscape => write!(f, "Escape sequence should be a hexadecimal number"), | ||
97 | UnclosedUnicodeEscape => write!(f, "Missing `}}`"), | ||
98 | MalformedUnicodeEscape => write!(f, "Malformed unicode escape sequence"), | ||
99 | EmptyUnicodeEcape => write!(f, "Empty unicode escape sequence"), | ||
100 | OverlongUnicodeEscape => write!(f, "Unicode escape sequence should have at most 6 digits"), | ||
101 | UnicodeEscapeOutOfRange => write!(f, "Unicode escape code should be at most 0x10FFFF"), | ||
86 | ParseError(msg) => write!(f, "{}", msg.0), | 102 | ParseError(msg) => write!(f, "{}", msg.0), |
87 | } | 103 | } |
88 | } | 104 | } |