mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 15:28:11 +00:00
LibJS: Add Parser::syntax_error() helper
Instead of having fprintf()s all over the place we can now use syntax_error("message") or syntax_error("message", line, column). This takes care of a consistent format, appending a newline and getting the line number and column of the current token if the last two params are omitted.
This commit is contained in:
parent
85fd0d2187
commit
624eaa32af
2 changed files with 14 additions and 18 deletions
|
@ -89,6 +89,7 @@ private:
|
|||
bool match(TokenType type) const;
|
||||
bool done() const;
|
||||
void expected(const char* what);
|
||||
void syntax_error(const String& message, size_t line = 0, size_t column = 0);
|
||||
Token consume();
|
||||
Token consume(TokenType type);
|
||||
void consume_or_insert_semicolon();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue