diff options
author | Josh Robson Chase <[email protected]> | 2019-01-23 18:14:34 +0000 |
---|---|---|
committer | Josh Robson Chase <[email protected]> | 2019-01-23 18:19:49 +0000 |
commit | 3b70acad0106e4ffe5ee68d565c9130b5b271e22 (patch) | |
tree | 72b32afb919c5317219c0891ced8c9725d622bbc /crates/ra_syntax/src/lexer.rs | |
parent | 1cd6d6539a9d85bc44db364bb9165e6d9253790d (diff) |
Use IDENT for both raw and normal idents
Diffstat (limited to 'crates/ra_syntax/src/lexer.rs')
-rw-r--r-- | crates/ra_syntax/src/lexer.rs | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/crates/ra_syntax/src/lexer.rs b/crates/ra_syntax/src/lexer.rs index fab184a2d..0c3847120 100644 --- a/crates/ra_syntax/src/lexer.rs +++ b/crates/ra_syntax/src/lexer.rs | |||
@@ -190,24 +190,18 @@ fn next_token_inner(c: char, ptr: &mut Ptr) -> SyntaxKind { | |||
190 | } | 190 | } |
191 | 191 | ||
192 | fn scan_ident(c: char, ptr: &mut Ptr) -> SyntaxKind { | 192 | fn scan_ident(c: char, ptr: &mut Ptr) -> SyntaxKind { |
193 | let is_raw = match (c, ptr.current()) { | 193 | match (c, ptr.current()) { |
194 | ('r', Some('#')) => { | 194 | ('r', Some('#')) => { |
195 | ptr.bump(); | 195 | ptr.bump(); |
196 | true | ||
197 | } | 196 | } |
198 | ('_', Some(c)) if !is_ident_continue(c) => return UNDERSCORE, | 197 | ('_', Some(c)) if !is_ident_continue(c) => return UNDERSCORE, |
199 | _ => false, | 198 | _ => {} |
200 | }; | 199 | } |
201 | |||
202 | ptr.bump_while(is_ident_continue); | 200 | ptr.bump_while(is_ident_continue); |
203 | 201 | if let Some(kind) = SyntaxKind::from_keyword(ptr.current_token_text()) { | |
204 | if is_raw { | ||
205 | RAW_IDENT | ||
206 | } else if let Some(kind) = SyntaxKind::from_keyword(ptr.current_token_text()) { | ||
207 | return kind; | 202 | return kind; |
208 | } else { | ||
209 | IDENT | ||
210 | } | 203 | } |
204 | IDENT | ||
211 | } | 205 | } |
212 | 206 | ||
213 | fn scan_literal_suffix(ptr: &mut Ptr) { | 207 | fn scan_literal_suffix(ptr: &mut Ptr) { |