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

Feature request: parse using a specific syntatic goal #739

Open
devsnek opened this issue Sep 30, 2018 · 3 comments
Open

Feature request: parse using a specific syntatic goal #739

devsnek opened this issue Sep 30, 2018 · 3 comments

Comments

@devsnek
Copy link

devsnek commented Sep 30, 2018

It would be nice to be able to specify which specific goal to use when parsing something:

  • a, b, c with FormalParameters[~Yield, ~Await] -> [Identifier, Identifier, Identifier]

  • const a = 5; return a; with FunctionBody[~Yield, ~Await] -> [VariableDeclaration, ReturnStatement]

@adrianheine
Copy link
Member

Since acorn doesn't use these goals internally that would be quite a lot of work. It could be possible to implement this on top of acorn.

@devsnek
Copy link
Author

devsnek commented Oct 6, 2018

Yeah we managed to implement something. the only annoyance is the bitwise flags for what kind of function body is being parsed. Would it be acceptable to expose those in the public API?

@marijnh
Copy link
Member

marijnh commented Oct 6, 2018

Yes, exporting those would make sense. Do you want to create a pull request? I'd prefer for them to be put into an object in the exported interface, to avoid adding a huge amount of exported identifiers.

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

3 participants