Safe Haskell | None |
---|---|
Language | Haskell98 |
Synopsis
- parse :: String -> String -> Either String JSAST
- parseModule :: String -> String -> Either String JSAST
- readJs :: String -> JSAST
- readJsModule :: String -> JSAST
- parseFile :: FilePath -> IO JSAST
- parseFileUtf8 :: FilePath -> IO JSAST
- parseUsing :: Alex JSAST -> String -> String -> Either String JSAST
- showStripped :: JSAST -> String
- showStrippedMaybe :: Show a => Either a JSAST -> String
Parsing
:: String | The input stream (Javascript source code). |
-> String | The name of the Javascript source (filename or input device). |
-> Either String JSAST | An error or maybe the abstract syntax tree (AST) of zero or more Javascript statements, plus comments. |
Parse JavaScript Program (Script) Parse one compound statement, or a sequence of simple statements. Generally used for interactive input, such as from the command line of an interpreter. Return comments in addition to the parsed statements.
:: String | The input stream (JavaScript source code). |
-> String | The name of the JavaScript source (filename or input device). |
-> Either String JSAST | An error or maybe the abstract syntax tree (AST) of zero or more JavaScript statements, plus comments. |
Parse JavaScript module
readJsModule :: String -> JSAST Source #
parseFile :: FilePath -> IO JSAST Source #
Parse the given file. For UTF-8 support, make sure your locale is set such that "System.IO.localeEncoding" returns "utf8"
parseFileUtf8 :: FilePath -> IO JSAST Source #
Parse the given file, explicitly setting the encoding to UTF8 when reading it
Parsing expressions
:: Alex JSAST | The parser to be used |
-> String | The input stream (Javascript source code). |
-> String | The name of the Javascript source (filename or input device). |
-> Either String JSAST | An error or maybe the abstract syntax tree (AST) of zero or more Javascript statements, plus comments. |
Parse one compound statement, or a sequence of simple statements. Generally used for interactive input, such as from the command line of an interpreter. Return comments in addition to the parsed statements.
showStripped :: JSAST -> String Source #