diff options
Diffstat (limited to 'src/lexer')
-rw-r--r-- | src/lexer/mod.rs | 3 | ||||
-rw-r--r-- | src/lexer/ptr.rs | 5 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/lexer/mod.rs b/src/lexer/mod.rs index 7c4259763..bc5344b5f 100644 --- a/src/lexer/mod.rs +++ b/src/lexer/mod.rs | |||
@@ -187,6 +187,9 @@ fn scan_ident(c: char, ptr: &mut Ptr) -> SyntaxKind { | |||
187 | return if c == '_' { UNDERSCORE } else { IDENT }; | 187 | return if c == '_' { UNDERSCORE } else { IDENT }; |
188 | } | 188 | } |
189 | ptr.bump_while(is_ident_continue); | 189 | ptr.bump_while(is_ident_continue); |
190 | if let Some(kind) = ident_to_keyword(ptr.current_token_text()) { | ||
191 | return kind; | ||
192 | } | ||
190 | IDENT | 193 | IDENT |
191 | } | 194 | } |
192 | 195 | ||
diff --git a/src/lexer/ptr.rs b/src/lexer/ptr.rs index 2f759119a..ff6ef11fc 100644 --- a/src/lexer/ptr.rs +++ b/src/lexer/ptr.rs | |||
@@ -59,6 +59,11 @@ impl<'s> Ptr<'s> { | |||
59 | } | 59 | } |
60 | } | 60 | } |
61 | 61 | ||
62 | pub fn current_token_text(&self) -> &str { | ||
63 | let len: u32 = self.len.into(); | ||
64 | &self.text[..len as usize] | ||
65 | } | ||
66 | |||
62 | fn chars(&self) -> Chars { | 67 | fn chars(&self) -> Chars { |
63 | let len: u32 = self.len.into(); | 68 | let len: u32 = self.len.into(); |
64 | self.text[len as usize ..].chars() | 69 | self.text[len as usize ..].chars() |