Fine tune table-driven tokenizing.

This commit is contained in:
Stephen Chung
2023-03-15 17:22:11 +08:00
parent 2aa7b99d1e
commit 41636eac55
11 changed files with 351 additions and 159 deletions

View File

@@ -232,7 +232,7 @@ impl Engine {
}
let token = Token::lookup_symbol_from_syntax(s).or_else(|| {
if is_reserved_keyword_or_symbol(s) {
if is_reserved_keyword_or_symbol(s).0 {
Some(Token::Reserved(Box::new(s.into())))
} else {
None
@@ -296,7 +296,7 @@ impl Engine {
// Identifier or symbol in first position
_ if segments.is_empty()
&& (is_valid_identifier(s) || is_reserved_keyword_or_symbol(s)) =>
&& (is_valid_identifier(s) || is_reserved_keyword_or_symbol(s).0) =>
{
// Make it a custom keyword/symbol if it is disabled or reserved
if self