-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow exprs in the source_file grammar rule
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
- Loading branch information
1 parent
01c58ce
commit 8033c49
Showing
3 changed files
with
36 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters