aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src
diff options
context:
space:
mode:
authorJosh Robson Chase <[email protected]>2019-01-23 18:55:31 +0000
committerJosh Robson Chase <[email protected]>2019-01-23 18:57:17 +0000
commit2ffea72f7481eafb564a0910c4b3a8ccae4a5c27 (patch)
tree6167216e6ac713186437e2bc7e32a674069bfda8 /crates/ra_syntax/src
parent302508d5bbcc261f8fe403714a7a7e1f5382879b (diff)
More correct raw ident handling
Diffstat (limited to 'crates/ra_syntax/src')
-rw-r--r--crates/ra_syntax/src/lexer.rs13
1 files changed, 8 insertions, 5 deletions
diff --git a/crates/ra_syntax/src/lexer.rs b/crates/ra_syntax/src/lexer.rs
index 0c3847120..f9362120e 100644
--- a/crates/ra_syntax/src/lexer.rs
+++ b/crates/ra_syntax/src/lexer.rs
@@ -190,16 +190,19 @@ fn next_token_inner(c: char, ptr: &mut Ptr) -> SyntaxKind {
190} 190}
191 191
192fn scan_ident(c: char, ptr: &mut Ptr) -> SyntaxKind { 192fn scan_ident(c: char, ptr: &mut Ptr) -> SyntaxKind {
193 match (c, ptr.current()) { 193 let is_raw = match (c, ptr.current()) {
194 ('r', Some('#')) => { 194 ('r', Some('#')) => {
195 ptr.bump(); 195 ptr.bump();
196 true
196 } 197 }
197 ('_', Some(c)) if !is_ident_continue(c) => return UNDERSCORE, 198 ('_', Some(c)) if !is_ident_continue(c) => return UNDERSCORE,
198 _ => {} 199 _ => false,
199 } 200 };
200 ptr.bump_while(is_ident_continue); 201 ptr.bump_while(is_ident_continue);
201 if let Some(kind) = SyntaxKind::from_keyword(ptr.current_token_text()) { 202 if !is_raw {
202 return kind; 203 if let Some(kind) = SyntaxKind::from_keyword(ptr.current_token_text()) {
204 return kind;
205 }
203 } 206 }
204 IDENT 207 IDENT
205} 208}