-
Notifications
You must be signed in to change notification settings - Fork 17
Allow exprs in the source_file grammar rule #9
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
Allow exprs in the source_file grammar rule #9
Conversation
Hi @williamthome! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
40e22c7
to
080a5cd
Compare
080a5cd
to
3086281
Compare
@alanz has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Thanks for this. It causes a few problems in ELP if we try to use it, for parsing escripts And the fundamental problem is the shebang causes it to go into error mode, and the prior version recovered gracefully. I think the solution may be to add an additional form time that parses the shebang. I am happy to give that a go. |
FYI, to check it, in the ELP repo change the then |
Summary: Closes WhatsApp/tree-sitter-erlang#3. Currently, only "top level" forms of a module are allowed at the beginning of the source_file rule, but this makes this tree-sitter not usable, for example, in Markdown code blocks. Allowing any fragment of an expression makes this tree-sitter usable for other languages to inject Erlang code, for example, a new language in the Phoenix (Elixir) style, that embeeds Erlang code in HTML. --- Notes: 1. The tree generated for fragmented code is `(source_file (...exprs))`. Maybe the tree as is today as `(source_file (...forms))` should be for a file/module structure and `(fragment (...exprs))` should be for fragmented parts of code 2. The term "fragment" is what comes to my mind, but could be any other 3. I'm not sure about the conflicts order introduced by this PR --- ## Before this PR  ## After this PR  X-link: WhatsApp/tree-sitter-erlang#9 Reviewed By: michalmuskala Differential Revision: D69120163 Pulled By: alanz fbshipit-source-id: 73f02ac6b61dbd0bec100d2dcfaa52b7694304cb
Closes #3.
Currently, only "top level" forms of a module are allowed at the beginning of the source_file rule, but this makes this tree-sitter not usable, for example, in Markdown code blocks.
Allowing any fragment of an expression makes this tree-sitter usable for other languages to inject Erlang code, for example, a new language in the Phoenix (Elixir) style, that embeeds Erlang code in HTML.
Notes:
(source_file (...exprs))
. Maybe the tree as is today as(source_file (...forms))
should be for a file/module structure and(fragment (...exprs))
should be for fragmented parts of codeBefore this PR
After this PR