mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:17:34 +00:00
LibJS: Rename Parser::m_parser_state => m_state
Also remove the "m_" prefix from all the public data members.
This commit is contained in:
parent
5b16b5d7c1
commit
4c8df58e08
2 changed files with 265 additions and 264 deletions
File diff suppressed because it is too large
Load diff
|
@ -124,12 +124,12 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
bool has_errors() const { return m_parser_state.m_errors.size(); }
|
bool has_errors() const { return m_state.errors.size(); }
|
||||||
const Vector<Error>& errors() const { return m_parser_state.m_errors; }
|
const Vector<Error>& errors() const { return m_state.errors; }
|
||||||
void print_errors() const
|
void print_errors() const
|
||||||
{
|
{
|
||||||
for (auto& error : m_parser_state.m_errors) {
|
for (auto& error : m_state.errors) {
|
||||||
auto hint = error.source_location_hint(m_parser_state.m_lexer.source());
|
auto hint = error.source_location_hint(m_state.lexer.source());
|
||||||
if (!hint.is_empty())
|
if (!hint.is_empty())
|
||||||
warnln("{}", hint);
|
warnln("{}", hint);
|
||||||
warnln("SyntaxError: {}", error.to_string());
|
warnln("SyntaxError: {}", error.to_string());
|
||||||
|
@ -197,25 +197,25 @@ private:
|
||||||
[[nodiscard]] RulePosition push_start() { return { *this, position() }; }
|
[[nodiscard]] RulePosition push_start() { return { *this, position() }; }
|
||||||
|
|
||||||
struct ParserState {
|
struct ParserState {
|
||||||
Lexer m_lexer;
|
Lexer lexer;
|
||||||
Token m_current_token;
|
Token current_token;
|
||||||
Vector<Error> m_errors;
|
Vector<Error> errors;
|
||||||
Vector<NonnullRefPtrVector<VariableDeclaration>> m_var_scopes;
|
Vector<NonnullRefPtrVector<VariableDeclaration>> var_scopes;
|
||||||
Vector<NonnullRefPtrVector<VariableDeclaration>> m_let_scopes;
|
Vector<NonnullRefPtrVector<VariableDeclaration>> let_scopes;
|
||||||
Vector<NonnullRefPtrVector<FunctionDeclaration>> m_function_scopes;
|
Vector<NonnullRefPtrVector<FunctionDeclaration>> function_scopes;
|
||||||
|
|
||||||
Vector<Vector<FunctionNode::Parameter>&> function_parameters;
|
Vector<Vector<FunctionNode::Parameter>&> function_parameters;
|
||||||
|
|
||||||
HashTable<StringView> m_labels_in_scope;
|
HashTable<StringView> labels_in_scope;
|
||||||
bool m_strict_mode { false };
|
bool strict_mode { false };
|
||||||
bool m_allow_super_property_lookup { false };
|
bool allow_super_property_lookup { false };
|
||||||
bool m_allow_super_constructor_call { false };
|
bool allow_super_constructor_call { false };
|
||||||
bool m_in_function_context { false };
|
bool in_function_context { false };
|
||||||
bool m_in_generator_function_context { false };
|
bool in_generator_function_context { false };
|
||||||
bool m_in_arrow_function_context { false };
|
bool in_arrow_function_context { false };
|
||||||
bool m_in_break_context { false };
|
bool in_break_context { false };
|
||||||
bool m_in_continue_context { false };
|
bool in_continue_context { false };
|
||||||
bool m_string_legacy_octal_escape_sequence_in_scope { false };
|
bool string_legacy_octal_escape_sequence_in_scope { false };
|
||||||
|
|
||||||
explicit ParserState(Lexer);
|
explicit ParserState(Lexer);
|
||||||
};
|
};
|
||||||
|
@ -234,7 +234,7 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
Vector<Position> m_rule_starts;
|
Vector<Position> m_rule_starts;
|
||||||
ParserState m_parser_state;
|
ParserState m_state;
|
||||||
FlyString m_filename;
|
FlyString m_filename;
|
||||||
Vector<ParserState> m_saved_state;
|
Vector<ParserState> m_saved_state;
|
||||||
HashMap<Position, TokenMemoization, PositionKeyTraits> m_token_memoizations;
|
HashMap<Position, TokenMemoization, PositionKeyTraits> m_token_memoizations;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue