mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:17:44 +00:00
JSSpecCompiler: Parse true, false, this, undefined, and null
This commit is contained in:
parent
86d54a8684
commit
b800276347
7 changed files with 70 additions and 3 deletions
|
@ -158,8 +158,8 @@ void tokenize_tree(SpecificationParsingContext& ctx, TokenizerState& state, XML:
|
|||
|
||||
if (contents.length() >= 2 && contents.starts_with('"') && contents.ends_with('"'))
|
||||
tokens.append({ TokenType::String, contents.substring_view(1, contents.length() - 2), move(child_location) });
|
||||
else if (contents == "undefined")
|
||||
tokens.append({ TokenType::Undefined, contents, move(child_location) });
|
||||
else if (contents.is_one_of("undefined", "null", "this", "true", "false"))
|
||||
tokens.append({ TokenType::WellKnownValue, contents, move(child_location) });
|
||||
else
|
||||
tokens.append({ TokenType::Identifier, contents, move(child_location) });
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue