Skip to content

Lexing and Parsing errors should throw a SyntaxError #539

Closed

Description

@HalidOdat

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.

This is blocked until #536 lands

Activity

  1. added
    A-Bug
    Blocked
    A-Execution
    on Jul 2, 2020
  2. added this to the v0.10.0 milestone on Jul 2, 2020
  3. Razican commented on Jul 2, 2020

    @Razican
    Member

    Hmmm this is interesting, where do we panic? I thought we just returned a parsing/lexing error.

  4. HalidOdat commented on Jul 2, 2020

    @HalidOdat
    MemberAuthor

    Hmmm this is interesting, where do we panic? I thought we just returned a parsing/lexing error.

    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

  5. removed
    Blocked
    on Jul 2, 2020
  6. Razican commented on Jul 3, 2020

    @Razican
    Member

    Hmmm this is interesting, where do we panic? I thought we just returned a parsing/lexing error.

    Sorry about that, we don't panic but we print the parsing error and exit /boa/src/lib.rs@master#L83-L85

    True, that should throw a Syntax Error :)

  7. self-assigned this
    on Jul 15, 2020
  8. linked a pull request that will close this issueAdd ECMAScript test suite (test262) #567on Jul 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-BugA-Execution

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions