language-javascript-0.5.1: Parser for JavaScript

Safe HaskellSafe-Infered

Language.JavaScript.Parser.AST

Synopsis

Documentation

data Node Source

Constructors

JSIdentifier String

Terminals

JSDecimal String 
JSLiteral String 
JSHexInteger String 
JSStringLiteral Char [Char] 
JSRegEx String 
JSArguments JSNode [JSNode] JSNode

lb, args, rb

JSArrayLiteral JSNode [JSNode] JSNode

lb, contents, rb

JSBlock [JSNode] [JSNode] [JSNode]

optional lb,optional block statements,optional rb

JSBreak JSNode [JSNode] JSNode

break, optional identifier, autosemi

JSCallExpression String [JSNode] [JSNode] [JSNode]

type : ., (), []; opening [ or ., contents, closing

JSCase JSNode JSNode JSNode [JSNode]

case,expr,colon,stmtlist

JSCatch JSNode JSNode JSNode [JSNode] JSNode JSNode

catch,lb,ident,[if,expr],rb,block

JSContinue JSNode [JSNode] JSNode

continue,optional identifier,autosemi

JSDefault JSNode JSNode [JSNode]

default,colon,stmtlist

JSDoWhile JSNode JSNode JSNode JSNode JSNode JSNode JSNode

do,stmt,while,lb,expr,rb,autosemi

JSElision JSNode

comma

JSExpression [JSNode]

expression components

JSExpressionBinary String [JSNode] JSNode [JSNode]

what, lhs, op, rhs

JSExpressionParen JSNode JSNode JSNode

lb,expression,rb

JSExpressionPostfix String [JSNode] JSNode

type, expression, operator

JSExpressionTernary [JSNode] JSNode [JSNode] JSNode [JSNode]

cond, ?, trueval, :, falseval

JSFinally JSNode JSNode

finally,block

JSFor JSNode JSNode [JSNode] JSNode [JSNode] JSNode [JSNode] JSNode JSNode

for,lb,expr,semi,expr,semi,expr,rb.stmt

JSForIn JSNode JSNode [JSNode] JSNode JSNode JSNode JSNode

for,lb,expr,in,expr,rb,stmt

JSForVar JSNode JSNode JSNode [JSNode] JSNode [JSNode] JSNode [JSNode] JSNode JSNode

for,lb,var,vardecl,semi,expr,semi,expr,rb,stmt

JSForVarIn JSNode JSNode JSNode JSNode JSNode JSNode JSNode JSNode

for,lb,var,vardecl,in,expr,rb,stmt

JSFunction JSNode JSNode JSNode [JSNode] JSNode JSNode

fn,name, lb,parameter list,rb,block | JSFunctionBody [JSNode] -- ^body

JSFunctionExpression JSNode [JSNode] JSNode [JSNode] JSNode JSNode

fn,[name],lb, parameter list,rb,block`

JSIf JSNode JSNode JSNode JSNode [JSNode] [JSNode]

if,(,expr,),stmt,optional rest

JSLabelled JSNode JSNode JSNode

identifier,colon,stmt

JSMemberDot [JSNode] JSNode JSNode

firstpart, dot, name

JSMemberSquare [JSNode] JSNode JSNode JSNode

firstpart, lb, expr, rb

JSObjectLiteral JSNode [JSNode] JSNode

lbrace contents rbrace

JSOperator JSNode

opnode

JSPropertyAccessor JSNode JSNode JSNode [JSNode] JSNode JSNode

(get|set), name, lb, params, rb, block

JSPropertyNameandValue JSNode JSNode [JSNode]

name, colon, value

JSReturn JSNode [JSNode] JSNode

return,optional expression,autosemi | JSSourceElements [JSNode] -- ^source elements

JSSourceElementsTop [JSNode]

source elements | JSStatementBlock JSNode JSNode JSNode -- ^lb,block,rb | JSStatementList [JSNode] -- ^statements

JSSwitch JSNode JSNode JSNode JSNode JSNode

switch,lb,expr,rb,caseblock

JSThrow JSNode JSNode

throw val

JSTry JSNode JSNode [JSNode]

try,block,rest

JSUnary String JSNode

type, operator

JSVarDecl JSNode [JSNode]

identifier, optional initializer

JSVariables JSNode [JSNode] JSNode

var|const, decl, autosemi

JSWhile JSNode JSNode JSNode JSNode JSNode

while,lb,expr,rb,stmt

JSWith JSNode JSNode JSNode JSNode [JSNode]

with,lb,expr,rb,stmt list

data JSNode Source

The JSNode is the building block of the AST. Each has a syntactic part Node. In addition, the leaf elements (terminals) have a position TokenPosn, as well as an array of comments and/or whitespace that was collected while parsing.

Constructors

NN Node

Non Terminal node, does not have any position or comment information

NT Node TokenPosn [CommentAnnotation]

Terminal node, including position and comment/whitespace information