1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-19 20:25:07 +00:00

LibJS: Remove syntax errors from lexer

Giving the lexer the ability to generate errors adds unnecessary
complexity - also it only calls its syntax_error() function in one place
anyway ("unterminated string literal"). But since the lexer *also* emits
tokens like Eof or UnterminatedStringLiteral, it should be up to the
consumer of these tokens to decide what to do.

Also remove the option to not print errors to stderr as that's not
relevant anymore.
This commit is contained in:
Linus Groh 2020-05-14 16:08:40 +01:00 committed by Andreas Kling
parent 3485613f4a
commit 00b61a212f
4 changed files with 2 additions and 20 deletions

View file

@ -524,7 +524,7 @@ int main(int argc, char** argv)
size_t open_indents = s_repl_line_level;
JS::Lexer lexer(str, false);
JS::Lexer lexer(str);
bool indenters_starting_line = true;
for (JS::Token token = lexer.next(); token.type() != JS::TokenType::Eof; token = lexer.next()) {
auto length = token.value().length();