module BNFC.Backend.TreeSitter where
import BNFC.Backend.Base
import BNFC.Backend.TreeSitter.CFtoTreeSitter (cfToTreeSitter)
import BNFC.CF
import BNFC.Options hiding (Backend)
import BNFC.PrettyPrint
makeTreeSitter :: SharedOptions -> CF -> Backend
makeTreeSitter :: SharedOptions -> CF -> Backend
makeTreeSitter SharedOptions
opts CF
cf = do
String -> MakeComment -> String -> Backend
forall c. FileContent c => String -> MakeComment -> c -> Backend
mkfile String
"grammar.js" MakeComment
comment (Doc -> String
render (Doc -> String) -> Doc -> String
forall a b. (a -> b) -> a -> b
$ String -> CF -> Doc
cfToTreeSitter String
name CF
cf)
where
name :: String
name = SharedOptions -> String
lang SharedOptions
opts
comment :: String -> String
= (String
"// " String -> MakeComment
forall a. [a] -> [a] -> [a]
++)