Text.ParserCombinators.PArrow.ToJavaScript
- data JSCompiler
- data JSFun
- newJSCompiler :: String -> IO (JSCompiler, JSFun -> String)
- compileJS :: JSCompiler -> MD i o -> IO JSFun
- dumpBodies :: JSCompiler -> IO [(JSFun, String)]
Documentation
data JSCompiler Source
JSCompiler encapsulates the state of the JavaScript compiler.
newJSCompiler :: String -> IO (JSCompiler, JSFun -> String)Source
Create a new JavaScript compiler using the suplied string as prefix. Returns the compiler and a function for showing function references.
compileJS :: JSCompiler -> MD i o -> IO JSFunSource
Compile a parser into JavaScript. Returns a reference to the top-level Parsing function. The generated javascript function expects a String and a starting index for parsing. The result will be either the index of the rightmost character matched or -1 if the parser failed.
dumpBodies :: JSCompiler -> IO [(JSFun, String)]Source
Dump all bodies of generated JavaScript functions.