aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2017-12-29 22:01:57 +0000
committerAleksey Kladov <[email protected]>2017-12-29 22:01:57 +0000
commit8103772a10f00378c4dcdd09f9af310c23146933 (patch)
tree7ff8a8937f495b71cd049c85e71faa7487cafbb9 /src
parentff5a6549b48ab526ebca830afbaec10360fcf42d (diff)
Lexer: underscore
Diffstat (limited to 'src')
-rw-r--r--src/lexer/mod.rs8
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 }