Indent one level of 2 spaces
ModuleBNFC-2.9.6.3Haskell2010
BNFC.Backend.TreeSitter.CFtoTreeSitter
- 27 values
- PackageBNFC-2.9.6.3
- Exports27
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceCFtoTreeSitter.hs
Create content of grammar.js file
Print rules for comments
Print word section, this section is needed for tree-sitter to do keyword extraction before any parsing/lexing, see https://tree-sitter.github.io/tree-sitter/creating-parsers#keyword-extraction TODO: currently, we just add every user defined token as well as the predefined Ident token to this list to be safe. Ideally, we should enumerate all defined tokens against all occurrences of keywords. Any tokens patterns that could accept a keyword will go into this list. This will require integration of a regex engine.
Print builtin token rules according to their usage
Predefined builtin token rules
Predefined builtin token rules
Predefined builtin token rules
Predefined builtin token rules
Predefined builtin token rules
First print the entrypoint rule, tree-sitter always use the first rule as entrypoint and does not support multi-entrypoint. Then print rest of the rules
Print all other rules except the entrypoint
Check if a set of rules contains internal rules
Generates one or two tree-sitter rule(s) for one non-terminal from CF. Uses choice function from tree-sitter to combine rules for the non-terminal If the non-terminal has internal rules, an internal version of the non-terminal will be created (prefixed with "_" in tree-sitter), and all internal rules will be sectioned as such.
Generate one tree-sitter rule for one defined token
Start a defined symbol block in tree-sitter grammar
Wrap list using tree-sitter fun if the list contains multiple items Returns the only item without wrapping otherwise
Helper for referring to non-terminal names in tree-sitter
Format right hand side into list of strings
Format string for cat name, prefix "_" if the name is for internal rules