diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-11-10 14:36:45 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-11-10 14:36:45 +0000 |
commit | 477de790b0211196256a772befe4f577d1a8ba14 (patch) | |
tree | 42c40e9201adf64d1c06bc1c69524f5688ee6e9f /crates/ra_syntax/src/yellow/syntax_error.rs | |
parent | 5a9150df9bcdaf5faed5b500c22333f1f7c99f32 (diff) | |
parent | 3b4c02c19e4af645fd37e8bff774b05d546dc0b6 (diff) |
Merge #222
222: Validate string literals r=aochagavia a=aochagavia
Related: #6 (some validators are still missing), fixes #27
Co-authored-by: Adolfo OchagavĂa <[email protected]>
Diffstat (limited to 'crates/ra_syntax/src/yellow/syntax_error.rs')
-rw-r--r-- | crates/ra_syntax/src/yellow/syntax_error.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/crates/ra_syntax/src/yellow/syntax_error.rs b/crates/ra_syntax/src/yellow/syntax_error.rs index c524adf39..cf7b1d495 100644 --- a/crates/ra_syntax/src/yellow/syntax_error.rs +++ b/crates/ra_syntax/src/yellow/syntax_error.rs | |||
@@ -71,7 +71,7 @@ pub enum SyntaxErrorKind { | |||
71 | UnescapedCodepoint, | 71 | UnescapedCodepoint, |
72 | EmptyChar, | 72 | EmptyChar, |
73 | UnclosedChar, | 73 | UnclosedChar, |
74 | LongChar, | 74 | OverlongChar, |
75 | EmptyAsciiEscape, | 75 | EmptyAsciiEscape, |
76 | InvalidAsciiEscape, | 76 | InvalidAsciiEscape, |
77 | TooShortAsciiCodeEscape, | 77 | TooShortAsciiCodeEscape, |
@@ -82,6 +82,7 @@ pub enum SyntaxErrorKind { | |||
82 | EmptyUnicodeEcape, | 82 | EmptyUnicodeEcape, |
83 | OverlongUnicodeEscape, | 83 | OverlongUnicodeEscape, |
84 | UnicodeEscapeOutOfRange, | 84 | UnicodeEscapeOutOfRange, |
85 | UnclosedString, | ||
85 | } | 86 | } |
86 | 87 | ||
87 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 88 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -96,7 +97,7 @@ impl fmt::Display for SyntaxErrorKind { | |||
96 | InvalidAsciiEscape => write!(f, "Invalid escape sequence"), | 97 | InvalidAsciiEscape => write!(f, "Invalid escape sequence"), |
97 | EmptyChar => write!(f, "Empty char literal"), | 98 | EmptyChar => write!(f, "Empty char literal"), |
98 | UnclosedChar => write!(f, "Unclosed char literal"), | 99 | UnclosedChar => write!(f, "Unclosed char literal"), |
99 | LongChar => write!(f, "Char literal should be one character long"), | 100 | OverlongChar => write!(f, "Char literal should be one character long"), |
100 | TooShortAsciiCodeEscape => write!(f, "Escape sequence should have two digits"), | 101 | TooShortAsciiCodeEscape => write!(f, "Escape sequence should have two digits"), |
101 | AsciiCodeEscapeOutOfRange => { | 102 | AsciiCodeEscapeOutOfRange => { |
102 | write!(f, "Escape sequence should be between \\x00 and \\x7F") | 103 | write!(f, "Escape sequence should be between \\x00 and \\x7F") |
@@ -109,6 +110,7 @@ impl fmt::Display for SyntaxErrorKind { | |||
109 | write!(f, "Unicode escape sequence should have at most 6 digits") | 110 | write!(f, "Unicode escape sequence should have at most 6 digits") |
110 | } | 111 | } |
111 | UnicodeEscapeOutOfRange => write!(f, "Unicode escape code should be at most 0x10FFFF"), | 112 | UnicodeEscapeOutOfRange => write!(f, "Unicode escape code should be at most 0x10FFFF"), |
113 | UnclosedString => write!(f, "Unclosed string literal"), | ||
112 | ParseError(msg) => write!(f, "{}", msg.0), | 114 | ParseError(msg) => write!(f, "{}", msg.0), |
113 | } | 115 | } |
114 | } | 116 | } |