HORIZON HASKELLDocslts/ghc-9.14.x45dd5372026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · 45dd537 · 2026-10-11

ModuleBNFC-2.9.6.3Haskell2010

BNFC.Backend.TreeSitter.CFtoTreeSitter

  • 27 values
  • PackageBNFC-2.9.6.3
  • Exports27
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceCFtoTreeSitter.hs
valueprWord :: CF -> Doc
#

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.

valueprRules :: CF -> Doc
#

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

valueprOneCat :: [Rule] -> NonTerminal -> Doc
#

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.

valuewrapOptListFun :: String -> Bool -> [Doc] -> Doc
#

Wrap list using tree-sitter fun if the list contains multiple items Returns the only item without wrapping otherwise