diff --git a/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/AST/AST.h b/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/AST/AST.h index 4790b8f55af..1c8fa49a0eb 100644 --- a/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/AST/AST.h +++ b/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/AST/AST.h @@ -135,6 +135,7 @@ class WellKnownNode : public Expression { public: enum Type { False, + NewTarget, Null, This, True, diff --git a/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/AST/ASTPrinting.cpp b/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/AST/ASTPrinting.cpp index ffad41a2898..6bdd67f467e 100644 --- a/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/AST/ASTPrinting.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/AST/ASTPrinting.cpp @@ -39,6 +39,7 @@ void WellKnownNode::dump_tree(StringBuilder& builder) { static constexpr StringView type_to_name[] = { "False"sv, + "NewTarget"sv, "Null"sv, "This"sv, "True"sv, diff --git a/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/Parser/Lexer.cpp b/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/Parser/Lexer.cpp index 0a14990f25e..96cef0055fa 100644 --- a/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/Parser/Lexer.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/Parser/Lexer.cpp @@ -76,6 +76,7 @@ void tokenize_string(SpecificationParsingContext& ctx, XML::Node const* node, St { "?"sv, TokenType::QuestionMark }, { "]"sv, TokenType::SquareBracketClose }, { "["sv, TokenType::SquareBracketOpen }, + { "NewTarget"sv, TokenType::WellKnownValue }, }; LineTrackingLexer lexer(view, node->offset); @@ -95,7 +96,7 @@ void tokenize_string(SpecificationParsingContext& ctx, XML::Node const* node, St bool matched = false; for (auto const& [text_to_match, token_type] : choices) { if (lexer.consume_specific(text_to_match)) { - tokens.append({ token_type, ""sv, move(token_location) }); + tokens.append({ token_type, text_to_match, move(token_location) }); matched = true; break; } diff --git a/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/Parser/TextParser.cpp b/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/Parser/TextParser.cpp index b336b925434..5bf7604406d 100644 --- a/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/Parser/TextParser.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/Parser/TextParser.cpp @@ -220,6 +220,7 @@ TextParseErrorOr TextParser::parse_value() WellKnownNode::Type type; } translations[] = { { "false"sv, WellKnownNode::Type::False }, + { "NewTarget"sv, WellKnownNode::Type::NewTarget }, { "null"sv, WellKnownNode::Type::Null }, { "this"sv, WellKnownNode::Type::This }, { "true"sv, WellKnownNode::Type::True },