From aa0290bbfc8b7dbd1753b8a6113df17fc836a532 Mon Sep 17 00:00:00 2001 From: Dimitris Fasarakis Hilliard Date: Sun, 29 Jan 2023 19:53:00 +0200 Subject: [PATCH] Match on ascii start/continuation characters before calling functions. --- parser/src/lexer.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/parser/src/lexer.rs b/parser/src/lexer.rs index 1c124f6..981115d 100644 --- a/parser/src/lexer.rs +++ b/parser/src/lexer.rs @@ -534,12 +534,15 @@ where } fn is_identifier_start(&self, c: char) -> bool { - c == '_' || is_xid_start(c) + match c { + 'a'..='z' | 'A'..='Z' | '_' => true, + _ => is_xid_start(c), + } } fn is_identifier_continuation(&self) -> bool { match self.window[0] { - Some('_' | '0'..='9') => true, + Some('a'..='z' | 'A'..='Z' | '_' | '0'..='9') => true, Some(c) => is_xid_continue(c), _ => false, }