nw::script::NssParser
-
struct NssParser
Public Functions
-
bool check(std::initializer_list<NssTokenType> types) const
Checks if next token matches a particular type.
Note
Does not advance the token stream
- Parameters:
types – An initializer list of token types
- Returns:
True if there is a match
-
bool check_is_type() const
Checks if next token matches a particular type.
Note
Does not advance the token stream
- Returns:
True if there is a match
-
NssToken consume(NssTokenType type, StringView error)
Consumes a token.
- Parameters:
type – Type of token to consume
error – Error message if token type is not matched
- Returns:
Matched token
-
void diagnostic(StringView msg, NssToken token, bool is_warning = false)
Report diagnostic
- Parameters:
msg – Message to report
-
bool is_end() const
Checks if at end of token stream.
-
bool match(std::initializer_list<NssTokenType> types)
Checks if next token matches a particular type.
Note
Advances the token stream
- Parameters:
types – An initializer list of token types
- Returns:
True if there is a match
-
void lex()
Lexes the file.
-
NssToken lookahead(size_t index) const
Looks ahead in the token stream
- Parameters:
index – Index to look ahead to, from current token
-
void synchronize(bool allow_rbrace = false)
Advances token stream after an error.
-
Expression *parse_expr()
-
Expression *parse_expr_assign()
-
Expression *parse_expr_conditional()
-
Expression *parse_expr_or()
-
Expression *parse_expr_and()
-
Expression *parse_expr_bitwise()
-
Expression *parse_expr_equality()
-
Expression *parse_expr_relational()
-
Expression *parse_expr_shift()
-
Expression *parse_expr_additive()
-
Expression *parse_expr_multiplicative()
-
Expression *parse_expr_unary()
-
Expression *parse_expr_postfix()
-
Expression *parse_expr_primary()
-
Expression *parse_expr_group()
-
BlockStatement *parse_stmt_block()
-
DoStatement *parse_stmt_do()
-
ExprStatement *parse_stmt_expr()
-
IfStatement *parse_stmt_if()
-
ForStatement *parse_stmt_for()
-
LabelStatement *parse_stmt_label()
-
JumpStatement *parse_stmt_jump()
-
SwitchStatement *parse_stmt_switch()
-
WhileStatement *parse_stmt_while()
-
StructDecl *parse_decl_struct()
-
Declaration *parse_decl_function_def()
-
FunctionDecl *parse_decl_function()
-
bool check(std::initializer_list<NssTokenType> types) const