diff options
Diffstat (limited to 'src/lexer')
-rw-r--r-- | src/lexer/mod.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/lexer/mod.rs b/src/lexer/mod.rs index ecea664da..83a411cdd 100644 --- a/src/lexer/mod.rs +++ b/src/lexer/mod.rs | |||
@@ -22,6 +22,14 @@ fn next_token_inner(c: char, ptr: &mut Ptr) -> SyntaxKind { | |||
22 | // They are not identifiers, and are handled further down. | 22 | // They are not identifiers, and are handled further down. |
23 | let ident_start = is_ident_start(c) && !string_literal_start(c, ptr.next(), ptr.nnext()); | 23 | let ident_start = is_ident_start(c) && !string_literal_start(c, ptr.next(), ptr.nnext()); |
24 | if ident_start { | 24 | if ident_start { |
25 | let is_single_letter = match ptr.next() { | ||
26 | None => true, | ||
27 | Some(c) if !is_ident_continue(c) => true, | ||
28 | _ => false, | ||
29 | }; | ||
30 | if is_single_letter { | ||
31 | return if c == '_' { UNDERSCORE } else { IDENT }; | ||
32 | } | ||
25 | ptr.bump_while(is_ident_continue); | 33 | ptr.bump_while(is_ident_continue); |
26 | return IDENT; | 34 | return IDENT; |
27 | } | 35 | } |