You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Lexing and Parsing errors should throw a SyntaxError #539
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Any invalid syntax like {.
Expected behavior
The expected behavior would be a SyntaxError with the parser error.
Actual behavior
we get a panic with the message.
Additional context
I think the best way to implement this would be to have the lexer and parser, generate the error as we do now but not panic, and in forward we check if lexing or parsing failed and then throw a SyntaxError, this would eliminate the need to introduce the Interpreter to the lexer/parser which would keep the code cleaner.
Activity
Razican commentedon Jul 2, 2020
Hmmm this is interesting, where do we panic? I thought we just returned a parsing/lexing error.
HalidOdat commentedon Jul 2, 2020
Sorry about that, we don't panic but we print the parsing error and exit https://github.com/boa-dev/boa/blob/master/boa/src/lib.rs#L83-L85
Razican commentedon Jul 3, 2020
True, that should throw a Syntax Error :)