Safe Haskell | None |
---|---|
Language | Haskell98 |
Language.JavaScript.Parser
Contents
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
- showStripped :: JSAST -> String
- showStrippedMaybe :: Show a => Either a JSAST -> String
- data JSExpression
- = JSIdentifier !JSAnnot !String
- | JSDecimal !JSAnnot !String
- | JSLiteral !JSAnnot !String
- | JSHexInteger !JSAnnot !String
- | JSOctal !JSAnnot !String
- | JSStringLiteral !JSAnnot !String
- | JSRegEx !JSAnnot !String
- | JSArrayLiteral !JSAnnot ![JSArrayElement] !JSAnnot
- | JSAssignExpression !JSExpression !JSAssignOp !JSExpression
- | JSCallExpression !JSExpression !JSAnnot !(JSCommaList JSExpression) !JSAnnot
- | JSCallExpressionDot !JSExpression !JSAnnot !JSExpression
- | JSCallExpressionSquare !JSExpression !JSAnnot !JSExpression !JSAnnot
- | JSCommaExpression !JSExpression !JSAnnot !JSExpression
- | JSExpressionBinary !JSExpression !JSBinOp !JSExpression
- | JSExpressionParen !JSAnnot !JSExpression !JSAnnot
- | JSExpressionPostfix !JSExpression !JSUnaryOp
- | JSExpressionTernary !JSExpression !JSAnnot !JSExpression !JSAnnot !JSExpression
- | JSArrowExpression !JSArrowParameterList !JSAnnot !JSStatement
- | JSFunctionExpression !JSAnnot !JSIdent !JSAnnot !(JSCommaList JSIdent) !JSAnnot !JSBlock
- | JSMemberDot !JSExpression !JSAnnot !JSExpression
- | JSMemberExpression !JSExpression !JSAnnot !(JSCommaList JSExpression) !JSAnnot
- | JSMemberNew !JSAnnot !JSExpression !JSAnnot !(JSCommaList JSExpression) !JSAnnot
- | JSMemberSquare !JSExpression !JSAnnot !JSExpression !JSAnnot
- | JSNewExpression !JSAnnot !JSExpression
- | JSObjectLiteral !JSAnnot !JSObjectPropertyList !JSAnnot
- | JSSpreadExpression !JSAnnot !JSExpression
- | JSUnaryExpression !JSUnaryOp !JSExpression
- | JSVarInitExpression !JSExpression !JSVarInitializer
- data JSAnnot
- data JSBinOp
- = JSBinOpAnd !JSAnnot
- | JSBinOpBitAnd !JSAnnot
- | JSBinOpBitOr !JSAnnot
- | JSBinOpBitXor !JSAnnot
- | JSBinOpDivide !JSAnnot
- | JSBinOpEq !JSAnnot
- | JSBinOpGe !JSAnnot
- | JSBinOpGt !JSAnnot
- | JSBinOpIn !JSAnnot
- | JSBinOpInstanceOf !JSAnnot
- | JSBinOpLe !JSAnnot
- | JSBinOpLsh !JSAnnot
- | JSBinOpLt !JSAnnot
- | JSBinOpMinus !JSAnnot
- | JSBinOpMod !JSAnnot
- | JSBinOpNeq !JSAnnot
- | JSBinOpOf !JSAnnot
- | JSBinOpOr !JSAnnot
- | JSBinOpPlus !JSAnnot
- | JSBinOpRsh !JSAnnot
- | JSBinOpStrictEq !JSAnnot
- | JSBinOpStrictNeq !JSAnnot
- | JSBinOpTimes !JSAnnot
- | JSBinOpUrsh !JSAnnot
- data JSBlock = JSBlock !JSAnnot ![JSStatement] !JSAnnot
- data JSUnaryOp
- data JSSemi
- = JSSemi !JSAnnot
- | JSSemiAuto
- data JSAssignOp
- data JSTryCatch
- data JSTryFinally
- data JSStatement
- = JSStatementBlock !JSAnnot ![JSStatement] !JSAnnot !JSSemi
- | JSBreak !JSAnnot !JSIdent !JSSemi
- | JSLet !JSAnnot !(JSCommaList JSExpression) !JSSemi
- | JSConstant !JSAnnot !(JSCommaList JSExpression) !JSSemi
- | JSContinue !JSAnnot !JSIdent !JSSemi
- | JSDoWhile !JSAnnot !JSStatement !JSAnnot !JSAnnot !JSExpression !JSAnnot !JSSemi
- | JSFor !JSAnnot !JSAnnot !(JSCommaList JSExpression) !JSAnnot !(JSCommaList JSExpression) !JSAnnot !(JSCommaList JSExpression) !JSAnnot !JSStatement
- | JSForIn !JSAnnot !JSAnnot !JSExpression !JSBinOp !JSExpression !JSAnnot !JSStatement
- | JSForVar !JSAnnot !JSAnnot !JSAnnot !(JSCommaList JSExpression) !JSAnnot !(JSCommaList JSExpression) !JSAnnot !(JSCommaList JSExpression) !JSAnnot !JSStatement
- | JSForVarIn !JSAnnot !JSAnnot !JSAnnot !JSExpression !JSBinOp !JSExpression !JSAnnot !JSStatement
- | JSForLet !JSAnnot !JSAnnot !JSAnnot !(JSCommaList JSExpression) !JSAnnot !(JSCommaList JSExpression) !JSAnnot !(JSCommaList JSExpression) !JSAnnot !JSStatement
- | JSForLetIn !JSAnnot !JSAnnot !JSAnnot !JSExpression !JSBinOp !JSExpression !JSAnnot !JSStatement
- | JSForLetOf !JSAnnot !JSAnnot !JSAnnot !JSExpression !JSBinOp !JSExpression !JSAnnot !JSStatement
- | JSForOf !JSAnnot !JSAnnot !JSExpression !JSBinOp !JSExpression !JSAnnot !JSStatement
- | JSForVarOf !JSAnnot !JSAnnot !JSAnnot !JSExpression !JSBinOp !JSExpression !JSAnnot !JSStatement
- | JSFunction !JSAnnot !JSIdent !JSAnnot !(JSCommaList JSIdent) !JSAnnot !JSBlock !JSSemi
- | JSIf !JSAnnot !JSAnnot !JSExpression !JSAnnot !JSStatement
- | JSIfElse !JSAnnot !JSAnnot !JSExpression !JSAnnot !JSStatement !JSAnnot !JSStatement
- | JSLabelled !JSIdent !JSAnnot !JSStatement
- | JSEmptyStatement !JSAnnot
- | JSExpressionStatement !JSExpression !JSSemi
- | JSAssignStatement !JSExpression !JSAssignOp !JSExpression !JSSemi
- | JSMethodCall !JSExpression !JSAnnot !(JSCommaList JSExpression) !JSAnnot !JSSemi
- | JSReturn !JSAnnot !(Maybe JSExpression) !JSSemi
- | JSSwitch !JSAnnot !JSAnnot !JSExpression !JSAnnot !JSAnnot ![JSSwitchParts] !JSAnnot !JSSemi
- | JSThrow !JSAnnot !JSExpression !JSSemi
- | JSTry !JSAnnot !JSBlock ![JSTryCatch] !JSTryFinally
- | JSVariable !JSAnnot !(JSCommaList JSExpression) !JSSemi
- | JSWhile !JSAnnot !JSAnnot !JSExpression !JSAnnot !JSStatement
- | JSWith !JSAnnot !JSAnnot !JSExpression !JSAnnot !JSStatement !JSSemi
- data JSSwitchParts
- = JSCase !JSAnnot !JSExpression !JSAnnot ![JSStatement]
- | JSDefault !JSAnnot !JSAnnot ![JSStatement]
- data JSAST
- data CommentAnnotation
- data TokenPosn = TokenPn !Int !Int !Int
- tokenPosnEmpty :: TokenPosn
- renderJS :: JSAST -> Builder
- renderToString :: JSAST -> String
- renderToText :: JSAST -> Text
Documentation
Arguments
:: 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.
Arguments
:: 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
showStripped :: JSAST -> String Source #
AST elements
data JSExpression Source #
Constructors
Instances
Constructors
JSAnnot !TokenPosn ![CommentAnnotation] | Annotation: position and comment/whitespace information |
JSAnnotSpace | A single space character |
JSNoAnnot | No annotation |
Instances
Eq JSAnnot Source # | |
Data JSAnnot Source # | |
Defined in Language.JavaScript.Parser.AST Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> JSAnnot -> c JSAnnot Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c JSAnnot Source # toConstr :: JSAnnot -> Constr Source # dataTypeOf :: JSAnnot -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c JSAnnot) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c JSAnnot) Source # gmapT :: (forall b. Data b => b -> b) -> JSAnnot -> JSAnnot Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> JSAnnot -> r Source # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> JSAnnot -> r Source # gmapQ :: (forall d. Data d => d -> u) -> JSAnnot -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> JSAnnot -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> JSAnnot -> m JSAnnot Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> JSAnnot -> m JSAnnot Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> JSAnnot -> m JSAnnot Source # | |
Show JSAnnot Source # | |
Constructors
Instances
Eq JSBinOp Source # | |
Data JSBinOp Source # | |
Defined in Language.JavaScript.Parser.AST Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> JSBinOp -> c JSBinOp Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c JSBinOp Source # toConstr :: JSBinOp -> Constr Source # dataTypeOf :: JSBinOp -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c JSBinOp) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c JSBinOp) Source # gmapT :: (forall b. Data b => b -> b) -> JSBinOp -> JSBinOp Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> JSBinOp -> r Source # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> JSBinOp -> r Source # gmapQ :: (forall d. Data d => d -> u) -> JSBinOp -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> JSBinOp -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> JSBinOp -> m JSBinOp Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> JSBinOp -> m JSBinOp Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> JSBinOp -> m JSBinOp Source # | |
Show JSBinOp Source # | |
Constructors
JSBlock !JSAnnot ![JSStatement] !JSAnnot | lbrace, stmts, rbrace |
Instances
Eq JSBlock Source # | |
Data JSBlock Source # | |
Defined in Language.JavaScript.Parser.AST Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> JSBlock -> c JSBlock Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c JSBlock Source # toConstr :: JSBlock -> Constr Source # dataTypeOf :: JSBlock -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c JSBlock) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c JSBlock) Source # gmapT :: (forall b. Data b => b -> b) -> JSBlock -> JSBlock Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> JSBlock -> r Source # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> JSBlock -> r Source # gmapQ :: (forall d. Data d => d -> u) -> JSBlock -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> JSBlock -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> JSBlock -> m JSBlock Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> JSBlock -> m JSBlock Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> JSBlock -> m JSBlock Source # | |
Show JSBlock Source # | |
Constructors
Instances
Eq JSUnaryOp Source # | |
Data JSUnaryOp Source # | |
Defined in Language.JavaScript.Parser.AST Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> JSUnaryOp -> c JSUnaryOp Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c JSUnaryOp Source # toConstr :: JSUnaryOp -> Constr Source # dataTypeOf :: JSUnaryOp -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c JSUnaryOp) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c JSUnaryOp) Source # gmapT :: (forall b. Data b => b -> b) -> JSUnaryOp -> JSUnaryOp Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> JSUnaryOp -> r Source # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> JSUnaryOp -> r Source # gmapQ :: (forall d. Data d => d -> u) -> JSUnaryOp -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> JSUnaryOp -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> JSUnaryOp -> m JSUnaryOp Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> JSUnaryOp -> m JSUnaryOp Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> JSUnaryOp -> m JSUnaryOp Source # | |
Show JSUnaryOp Source # | |
Constructors
JSSemi !JSAnnot | |
JSSemiAuto |
Instances
Eq JSSemi Source # | |
Data JSSemi Source # | |
Defined in Language.JavaScript.Parser.AST Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> JSSemi -> c JSSemi Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c JSSemi Source # toConstr :: JSSemi -> Constr Source # dataTypeOf :: JSSemi -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c JSSemi) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c JSSemi) Source # gmapT :: (forall b. Data b => b -> b) -> JSSemi -> JSSemi Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> JSSemi -> r Source # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> JSSemi -> r Source # gmapQ :: (forall d. Data d => d -> u) -> JSSemi -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> JSSemi -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> JSSemi -> m JSSemi Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> JSSemi -> m JSSemi Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> JSSemi -> m JSSemi Source # | |
Show JSSemi Source # | |
data JSAssignOp Source #
Constructors
Instances
Eq JSAssignOp Source # | |
Defined in Language.JavaScript.Parser.AST Methods (==) :: JSAssignOp -> JSAssignOp -> Bool Source # (/=) :: JSAssignOp -> JSAssignOp -> Bool Source # | |
Data JSAssignOp Source # | |
Defined in Language.JavaScript.Parser.AST Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> JSAssignOp -> c JSAssignOp Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c JSAssignOp Source # toConstr :: JSAssignOp -> Constr Source # dataTypeOf :: JSAssignOp -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c JSAssignOp) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c JSAssignOp) Source # gmapT :: (forall b. Data b => b -> b) -> JSAssignOp -> JSAssignOp Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> JSAssignOp -> r Source # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> JSAssignOp -> r Source # gmapQ :: (forall d. Data d => d -> u) -> JSAssignOp -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> JSAssignOp -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> JSAssignOp -> m JSAssignOp Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> JSAssignOp -> m JSAssignOp Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> JSAssignOp -> m JSAssignOp Source # | |
Show JSAssignOp Source # | |
Defined in Language.JavaScript.Parser.AST |
data JSTryCatch Source #
Constructors
JSCatch !JSAnnot !JSAnnot !JSExpression !JSAnnot !JSBlock | catch,lb,ident,rb,block |
JSCatchIf !JSAnnot !JSAnnot !JSExpression !JSAnnot !JSExpression !JSAnnot !JSBlock | catch,lb,ident,if,expr,rb,block |
Instances
Eq JSTryCatch Source # | |
Defined in Language.JavaScript.Parser.AST Methods (==) :: JSTryCatch -> JSTryCatch -> Bool Source # (/=) :: JSTryCatch -> JSTryCatch -> Bool Source # | |
Data JSTryCatch Source # | |
Defined in Language.JavaScript.Parser.AST Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> JSTryCatch -> c JSTryCatch Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c JSTryCatch Source # toConstr :: JSTryCatch -> Constr Source # dataTypeOf :: JSTryCatch -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c JSTryCatch) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c JSTryCatch) Source # gmapT :: (forall b. Data b => b -> b) -> JSTryCatch -> JSTryCatch Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> JSTryCatch -> r Source # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> JSTryCatch -> r Source # gmapQ :: (forall d. Data d => d -> u) -> JSTryCatch -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> JSTryCatch -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> JSTryCatch -> m JSTryCatch Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> JSTryCatch -> m JSTryCatch Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> JSTryCatch -> m JSTryCatch Source # | |
Show JSTryCatch Source # | |
Defined in Language.JavaScript.Parser.AST |
data JSTryFinally Source #
Constructors
JSFinally !JSAnnot !JSBlock | finally,block |
JSNoFinally |
Instances
data JSStatement Source #
Constructors
Instances
Eq JSStatement Source # | |
Defined in Language.JavaScript.Parser.AST Methods (==) :: JSStatement -> JSStatement -> Bool Source # (/=) :: JSStatement -> JSStatement -> Bool Source # | |
Data JSStatement Source # | |
Defined in Language.JavaScript.Parser.AST Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> JSStatement -> c JSStatement Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c JSStatement Source # toConstr :: JSStatement -> Constr Source # dataTypeOf :: JSStatement -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c JSStatement) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c JSStatement) Source # gmapT :: (forall b. Data b => b -> b) -> JSStatement -> JSStatement Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> JSStatement -> r Source # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> JSStatement -> r Source # gmapQ :: (forall d. Data d => d -> u) -> JSStatement -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> JSStatement -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> JSStatement -> m JSStatement Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> JSStatement -> m JSStatement Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> JSStatement -> m JSStatement Source # | |
Show JSStatement Source # | |
Defined in Language.JavaScript.Parser.AST |
data JSSwitchParts Source #
Constructors
JSCase !JSAnnot !JSExpression !JSAnnot ![JSStatement] | expr,colon,stmtlist |
JSDefault !JSAnnot !JSAnnot ![JSStatement] | colon,stmtlist |
Instances
Constructors
JSAstProgram ![JSStatement] !JSAnnot | source elements, trailing whitespace |
JSAstModule ![JSModuleItem] !JSAnnot | |
JSAstStatement !JSStatement !JSAnnot | |
JSAstExpression !JSExpression !JSAnnot | |
JSAstLiteral !JSExpression !JSAnnot |
Instances
Eq JSAST Source # | |
Data JSAST Source # | |
Defined in Language.JavaScript.Parser.AST Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> JSAST -> c JSAST Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c JSAST Source # toConstr :: JSAST -> Constr Source # dataTypeOf :: JSAST -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c JSAST) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c JSAST) Source # gmapT :: (forall b. Data b => b -> b) -> JSAST -> JSAST Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> JSAST -> r Source # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> JSAST -> r Source # gmapQ :: (forall d. Data d => d -> u) -> JSAST -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> JSAST -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> JSAST -> m JSAST Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> JSAST -> m JSAST Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> JSAST -> m JSAST Source # | |
Show JSAST Source # | |
data CommentAnnotation Source #
Instances
TokenPosn
records the location of a token in the input text. It has three
fields: the address (number of characters preceding the token), line number
and column of a token within the file.
Note: The lexer assumes the usual eight character tab stops.
Instances
Eq TokenPosn Source # | |
Data TokenPosn Source # | |
Defined in Language.JavaScript.Parser.SrcLocation Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> TokenPosn -> c TokenPosn Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c TokenPosn Source # toConstr :: TokenPosn -> Constr Source # dataTypeOf :: TokenPosn -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c TokenPosn) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TokenPosn) Source # gmapT :: (forall b. Data b => b -> b) -> TokenPosn -> TokenPosn Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TokenPosn -> r Source # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TokenPosn -> r Source # gmapQ :: (forall d. Data d => d -> u) -> TokenPosn -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> TokenPosn -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> TokenPosn -> m TokenPosn Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> TokenPosn -> m TokenPosn Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> TokenPosn -> m TokenPosn Source # | |
Read TokenPosn Source # | |
Show TokenPosn Source # | |
Pretty Printing
renderToString :: JSAST -> String Source #
renderToText :: JSAST -> Text Source #