diff options
author | Adolfo OchagavĂa <[email protected]> | 2018-11-08 14:42:00 +0000 |
---|---|---|
committer | Adolfo OchagavĂa <[email protected]> | 2018-11-09 13:52:17 +0000 |
commit | 3b4c02c19e4af645fd37e8bff774b05d546dc0b6 (patch) | |
tree | 42c40e9201adf64d1c06bc1c69524f5688ee6e9f /crates/ra_syntax/src/yellow | |
parent | 5a9150df9bcdaf5faed5b500c22333f1f7c99f32 (diff) |
Validate string literals
Diffstat (limited to 'crates/ra_syntax/src/yellow')
-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 | } |