1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 06:37:35 +00:00

LibJS: Rework Identifier parsing to match the spec more closely

This commit is contained in:
Ali Mohammad Pur 2021-07-11 15:34:55 +04:30 committed by Linus Groh
parent 77a5144264
commit 049e210cfa
3 changed files with 142 additions and 31 deletions

View file

@ -150,6 +150,7 @@ private:
bool match_statement() const;
bool match_declaration() const;
bool match_variable_declaration() const;
bool match_identifier() const;
bool match_identifier_name() const;
bool match_property_key() const;
bool match(TokenType type) const;
@ -157,6 +158,8 @@ private:
void expected(const char* what);
void syntax_error(const String& message, Optional<Position> = {});
Token consume();
Token consume_identifier();
Token consume_identifier_reference();
Token consume(TokenType type);
Token consume_and_validate_numeric_literal();
void consume_or_insert_semicolon();
@ -165,6 +168,8 @@ private:
void discard_saved_state();
Position position() const;
void check_identifier_name_for_assignment_validity(StringView);
bool try_parse_arrow_function_expression_failed_at_position(const Position&) const;
void set_try_parse_arrow_function_expression_failed_at_position(const Position&, bool);