diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-11-05 21:32:25 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-11-05 21:32:25 +0000 |
commit | f605f6e70a3a15b77900942933253d16dd3ce1f6 (patch) | |
tree | a7e8c5097124f8dae7ef15af4b85b1c208d3358c /crates/ra_syntax/src/string_lexing | |
parent | 43665eb166e1bd0319a1e13a97b753a536e4b4d2 (diff) | |
parent | 59405bfe4ad0afa0b7ff533c7bfbc3ad4170604c (diff) |
Merge #188
188: Introduce `SyntaxErrorKind` and `TextRange` to `SyntaxError` r=matklad a=aochagavia
Co-authored-by: Adolfo OchagavĂa <[email protected]>
Co-authored-by: Adolfo OchagavĂa <[email protected]>
Diffstat (limited to 'crates/ra_syntax/src/string_lexing')
-rw-r--r-- | crates/ra_syntax/src/string_lexing/mod.rs | 10 |
1 files changed, 0 insertions, 10 deletions
diff --git a/crates/ra_syntax/src/string_lexing/mod.rs b/crates/ra_syntax/src/string_lexing/mod.rs index 6b52c62c3..f0812ff28 100644 --- a/crates/ra_syntax/src/string_lexing/mod.rs +++ b/crates/ra_syntax/src/string_lexing/mod.rs | |||
@@ -100,10 +100,6 @@ impl<'a> Parser<'a> { | |||
100 | // Char parsing methods | 100 | // Char parsing methods |
101 | 101 | ||
102 | fn parse_unicode_escape(&mut self, start: TextUnit) -> CharComponent { | 102 | fn parse_unicode_escape(&mut self, start: TextUnit) -> CharComponent { |
103 | // Note: validation of UnicodeEscape will be done elsewhere: | ||
104 | // * Only hex digits or underscores allowed | ||
105 | // * Max 6 chars | ||
106 | // * Within allowed range (must be at most 10FFFF) | ||
107 | match self.peek() { | 103 | match self.peek() { |
108 | Some('{') => { | 104 | Some('{') => { |
109 | self.advance(); | 105 | self.advance(); |
@@ -127,9 +123,6 @@ impl<'a> Parser<'a> { | |||
127 | } | 123 | } |
128 | 124 | ||
129 | fn parse_ascii_code_escape(&mut self, start: TextUnit) -> CharComponent { | 125 | fn parse_ascii_code_escape(&mut self, start: TextUnit) -> CharComponent { |
130 | // Note: validation of AsciiCodeEscape will be done elsewhere: | ||
131 | // * First digit is octal | ||
132 | // * Second digit is hex | ||
133 | let code_start = self.get_pos(); | 126 | let code_start = self.get_pos(); |
134 | while let Some(next) = self.peek() { | 127 | while let Some(next) = self.peek() { |
135 | if next == '\'' || (self.get_pos() - code_start == 2.into()) { | 128 | if next == '\'' || (self.get_pos() - code_start == 2.into()) { |
@@ -144,9 +137,6 @@ impl<'a> Parser<'a> { | |||
144 | } | 137 | } |
145 | 138 | ||
146 | fn parse_escape(&mut self, start: TextUnit) -> CharComponent { | 139 | fn parse_escape(&mut self, start: TextUnit) -> CharComponent { |
147 | // Note: validation of AsciiEscape will be done elsewhere: | ||
148 | // * The escape sequence is non-empty | ||
149 | // * The escape sequence is valid | ||
150 | if self.peek().is_none() { | 140 | if self.peek().is_none() { |
151 | return CharComponent::new(TextRange::from_to(start, start), AsciiEscape); | 141 | return CharComponent::new(TextRange::from_to(start, start), AsciiEscape); |
152 | } | 142 | } |