Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error recovery #39

Closed
KFlash opened this issue Aug 26, 2019 · 2 comments
Closed

Error recovery #39

KFlash opened this issue Aug 26, 2019 · 2 comments

Comments

@KFlash
Copy link
Contributor

KFlash commented Aug 26, 2019

It's on my TODO to add error recovery to Meriyah from v. 2.0. The code is still experimental, and not usable yet. And it can only recover from lexer.

This is somehow similar to what Babel does in this PR babel/babel#10363 , but with Meriyah I plan to add both recovery and incremental parsing, so it can recover from all errors.

The bad news with this is that I may refactor the entire Meriyah code base to archive this goals, so the code is kept private until it's completed and ready to be pushed.

The good news is that the locale code performs 10 - 15% faster than current Meriyah.

For now I have a lot to fix in my RL, but it will be implemented one day.

cc / @aladdin-add @nchanged

@KFlash
Copy link
Contributor Author

KFlash commented Aug 26, 2019

RL take all my time now, but latest recovery code I was working on can be found in the recovery branch. The lexer is almost done, and the parser doesn't die on invalid syntax, but require a lot of work :)

Example:

parseScript(`function( {}`, {
        onError: function(err: string) {
          console.log(err)  // 'Expected ) '
        }
      });

Outputs:

{ type: 'Program', sourceType: 'script', body: [ undefined ] }

cc / @aladdin-add Thoughts?

@KFlash
Copy link
Contributor Author

KFlash commented Sep 1, 2019

Closing as this will land in 2.0.

@KFlash KFlash closed this as completed Sep 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant