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

Modularize try statement parsing #390

Merged
merged 5 commits into from
May 11, 2020
Merged

Modularize try statement parsing #390

merged 5 commits into from
May 11, 2020

Conversation

abhijeetbhagat
Copy link
Contributor

@abhijeetbhagat abhijeetbhagat commented May 10, 2020

This Pull Request fixes/closes #375.

  • Modularized the try statement parsing into separate modules as mentioned in the reply to the issue.
  • Haven't implemented the entire catch parameter grammar parsing. Just kept the existing identifier parsing as it is for now.
  • Added some tests for the try statement parsing.

@Razican
Copy link
Member

Razican commented May 10, 2020

Thanks for this contribution!
It seems that you need to re-base, since in #389 we added BindingIdentifier parsing. The change for this case was to parse the binding identifier like this:

// TODO: CatchParameter - BindingPattern
let catch_param = BindingIdentifier::new(self.allow_yield, self.allow_await)
    .parse(cursor)
    .map(Node::local)?;

This should just be used in the CatchParameter parser

@Razican Razican added bug Something isn't working enhancement New feature or request parser Issues surrounding the parser labels May 10, 2020
@Razican Razican added this to the v0.8.0 milestone May 10, 2020
Copy link
Member

@Razican Razican left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks very good!
I think that CatchParameter should be in catch.rs, since it's directly related.

Check my other comments too, and see if they make sense.

boa/src/syntax/parser/statement/try_stm/mod.rs Outdated Show resolved Hide resolved
boa/src/syntax/parser/statement/try_stm/mod.rs Outdated Show resolved Hide resolved
boa/src/syntax/parser/statement/try_stm/mod.rs Outdated Show resolved Hide resolved
@Razican Razican merged commit 2851eb0 into boa-dev:master May 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request parser Issues surrounding the parser
Projects
None yet
Development

Successfully merging this pull request may close these issues.

catch statement causes syntax error
2 participants