Safe Haskell | None |
---|---|
Language | Haskell2010 |
Parser for ECMAScript 3.
Synopsis
- parse :: Stream s Identity Char => Parser s a -> SourceName -> s -> Either ParseError a
- type Parser s a = ParsecT s ParserState Identity a
- expression :: Stream s Identity Char => Parser s (Expression SourcePos)
- statement :: Stream s Identity Char => Parser s (Statement SourcePos)
- program :: Stream s Identity Char => Parser s (JavaScript SourcePos)
- parseFromString :: String -> Either ParseError (JavaScript SourcePos)
- parseFromFile :: (Error e, MonadIO m, MonadError e m) => String -> m (JavaScript SourcePos)
- parseScriptFromString :: String -> String -> Either ParseError (JavaScript SourcePos)
- parseJavaScriptFromFile :: MonadIO m => String -> m [Statement SourcePos]
- parseScript :: Stream s Identity Char => Parser s (JavaScript SourcePos)
- parseExpression :: Stream s Identity Char => ExpressionParser s
- parseString :: String -> [Statement SourcePos]
- type ParsedStatement = Statement SourcePos
- type ParsedExpression = Expression SourcePos
- parseSimpleExpr' :: Stream s Identity Char => ExpressionParser s
- parseBlockStmt :: Stream s Identity Char => StatementParser s
- parseStatement :: Stream s Identity Char => StatementParser s
- type StatementParser s = Parser s ParsedStatement
- type ExpressionParser s = Parser s ParsedExpression
- assignExpr :: Stream s Identity Char => ExpressionParser s
- parseObjectLit :: Stream s Identity Char => ExpressionParser s
Documentation
:: Stream s Identity Char | |
=> Parser s a | The parser to use |
-> SourceName | Name of the source file |
-> s | the stream to parse, usually a |
-> Either ParseError a |
Parse from a stream given a parser, same as parse
in Parsec. We can use this to parse expressions or statements alone,
not just whole programs.
type Parser s a = ParsecT s ParserState Identity a Source #
The parser type, parametrised by the stream type s
and the
return value a
expression :: Stream s Identity Char => Parser s (Expression SourcePos) Source #
A parser that parses ECMAScript expressions
statement :: Stream s Identity Char => Parser s (Statement SourcePos) Source #
The parser that parses a single ECMAScript statement
program :: Stream s Identity Char => Parser s (JavaScript SourcePos) Source #
A parser that parses an ECMAScript program.
:: String | JavaScript source to parse |
-> Either ParseError (JavaScript SourcePos) |
A convenience function that takes a String
and tries to parse
it as an ECMAScript program:
parseFromString = parse program ""
:: (Error e, MonadIO m, MonadError e m) | |
=> String | file name |
-> m (JavaScript SourcePos) |
A convenience function that takes a filename and tries to parse the file contents an ECMAScript program, it fails with an error message if it can't.
parseScriptFromString Source #
:: String | source file name |
-> String | JavaScript source to parse |
-> Either ParseError (JavaScript SourcePos) |
Deprecated: Use parseFromString
instead
Parse a JavaScript program from a string
parseJavaScriptFromFile Source #
Deprecated: Use parseFromFile
instead
Read a JavaScript program from file an parse it into a list of statements
parseScript :: Stream s Identity Char => Parser s (JavaScript SourcePos) Source #
Deprecated: Use program
instead
parseExpression :: Stream s Identity Char => ExpressionParser s Source #
Deprecated: Use expression
instead
Deprecated: Use parseFromString
instead
Parse a JavaScript source string into a list of statements
type ParsedStatement = Statement SourcePos Source #
Deprecated: These type aliases will be hidden in the next version
type ParsedExpression = Expression SourcePos Source #
Deprecated: These type aliases will be hidden in the next version
parseSimpleExpr' :: Stream s Identity Char => ExpressionParser s Source #
Deprecated: These parsers will be hidden in the next version
parseBlockStmt :: Stream s Identity Char => StatementParser s Source #
Deprecated: These parsers will be hidden in the next version
parseStatement :: Stream s Identity Char => StatementParser s Source #
Deprecated: Use statement
instead
type StatementParser s = Parser s ParsedStatement Source #
Deprecated: These type aliases will be hidden in the next version
type ExpressionParser s = Parser s ParsedExpression Source #
Deprecated: These type aliases will be hidden in the next version
assignExpr :: Stream s Identity Char => ExpressionParser s Source #
Deprecated: Use expression
instead
parseObjectLit :: Stream s Identity Char => ExpressionParser s Source #
Deprecated: These parsers will be hidden in the next version