| Safe Haskell | Safe-Inferred |
|---|
Language.ECMAScript3.Syntax
Description
ECMAScript 3 syntax. Spec refers to the ECMA-262 specification, 3rd edition.
- data JavaScript a = Script a [Statement a]
- unJavaScript :: JavaScript a -> [Statement a]
- data Statement a
- = BlockStmt a [Statement a]
- | EmptyStmt a
- | ExprStmt a (Expression a)
- | IfStmt a (Expression a) (Statement a) (Statement a)
- | IfSingleStmt a (Expression a) (Statement a)
- | SwitchStmt a (Expression a) [CaseClause a]
- | WhileStmt a (Expression a) (Statement a)
- | DoWhileStmt a (Statement a) (Expression a)
- | BreakStmt a (Maybe (Id a))
- | ContinueStmt a (Maybe (Id a))
- | LabelledStmt a (Id a) (Statement a)
- | ForInStmt a (ForInInit a) (Expression a) (Statement a)
- | ForStmt a (ForInit a) (Maybe (Expression a)) (Maybe (Expression a)) (Statement a)
- | TryStmt a (Statement a) (Maybe (CatchClause a)) (Maybe (Statement a))
- | ThrowStmt a (Expression a)
- | ReturnStmt a (Maybe (Expression a))
- | WithStmt a (Expression a) (Statement a)
- | VarDeclStmt a [VarDecl a]
- | FunctionStmt a (Id a) [Id a] [Statement a]
- isIterationStmt :: Statement a -> Bool
- data CaseClause a
- = CaseClause a (Expression a) [Statement a]
- | CaseDefault a [Statement a]
- data CatchClause a = CatchClause a (Id a) (Statement a)
- data ForInit a
- = NoInit
- | VarInit [VarDecl a]
- | ExprInit (Expression a)
- data ForInInit a
- data VarDecl a = VarDecl a (Id a) (Maybe (Expression a))
- data Expression a
- = StringLit a String
- | RegexpLit a String Bool Bool
- | NumLit a Double
- | IntLit a Int
- | BoolLit a Bool
- | NullLit a
- | ArrayLit a [Expression a]
- | ObjectLit a [(Prop a, Expression a)]
- | ThisRef a
- | VarRef a (Id a)
- | DotRef a (Expression a) (Id a)
- | BracketRef a (Expression a) (Expression a)
- | NewExpr a (Expression a) [Expression a]
- | PrefixExpr a PrefixOp (Expression a)
- | UnaryAssignExpr a UnaryAssignOp (LValue a)
- | InfixExpr a InfixOp (Expression a) (Expression a)
- | CondExpr a (Expression a) (Expression a) (Expression a)
- | AssignExpr a AssignOp (LValue a) (Expression a)
- | ListExpr a [Expression a]
- | CallExpr a (Expression a) [Expression a]
- | FuncExpr a (Maybe (Id a)) [Id a] [Statement a]
- data InfixOp
- = OpLT
- | OpLEq
- | OpGT
- | OpGEq
- | OpIn
- | OpInstanceof
- | OpEq
- | OpNEq
- | OpStrictEq
- | OpStrictNEq
- | OpLAnd
- | OpLOr
- | OpMul
- | OpDiv
- | OpMod
- | OpSub
- | OpLShift
- | OpSpRShift
- | OpZfRShift
- | OpBAnd
- | OpBXor
- | OpBOr
- | OpAdd
- data AssignOp
- data Id a = Id a String
- unId :: Id a -> String
- data PrefixOp
- = PrefixLNot
- | PrefixBNot
- | PrefixPlus
- | PrefixMinus
- | PrefixTypeof
- | PrefixVoid
- | PrefixDelete
- data Prop a
- data UnaryAssignOp
- = PrefixInc
- | PrefixDec
- | PostfixInc
- | PostfixDec
- data LValue a
- = LVar a String
- | LDot a (Expression a) String
- | LBracket a (Expression a) (Expression a)
- data SourcePos
Documentation
data JavaScript a Source
Instances
| Functor JavaScript | |
| Typeable1 JavaScript | |
| Foldable JavaScript | |
| Traversable JavaScript | |
| Eq a => Eq (JavaScript a) | |
| Data a => Data (JavaScript a) | |
| Ord a => Ord (JavaScript a) | |
| Show a => Show (JavaScript a) | |
| (Data a, Arbitrary a) => Arbitrary (JavaScript a) | |
| Default a => Default (JavaScript a) | |
| Pretty (JavaScript a) |
unJavaScript :: JavaScript a -> [Statement a]Source
extracts statements from a JavaScript type
Statements, spec 12.
Constructors
| BlockStmt a [Statement a] |
|
| EmptyStmt a |
|
| ExprStmt a (Expression a) |
|
| IfStmt a (Expression a) (Statement a) (Statement a) |
|
| IfSingleStmt a (Expression a) (Statement a) |
|
| SwitchStmt a (Expression a) [CaseClause a] |
|
| WhileStmt a (Expression a) (Statement a) |
|
| DoWhileStmt a (Statement a) (Expression a) |
|
| BreakStmt a (Maybe (Id a)) |
|
| ContinueStmt a (Maybe (Id a)) |
|
| LabelledStmt a (Id a) (Statement a) |
|
| ForInStmt a (ForInInit a) (Expression a) (Statement a) |
|
| ForStmt a (ForInit a) (Maybe (Expression a)) (Maybe (Expression a)) (Statement a) |
|
| TryStmt a (Statement a) (Maybe (CatchClause a)) (Maybe (Statement a)) |
|
| ThrowStmt a (Expression a) |
|
| ReturnStmt a (Maybe (Expression a)) |
|
| WithStmt a (Expression a) (Statement a) |
|
| VarDeclStmt a [VarDecl a] |
|
| FunctionStmt a (Id a) [Id a] [Statement a] |
|
Instances
isIterationStmt :: Statement a -> BoolSource
Returns True if the statement is an IterationStatement
according to spec 12.6.
data CaseClause a Source
Case clauses, spec 12.11
Constructors
| CaseClause a (Expression a) [Statement a] | case e: stmts; |
| CaseDefault a [Statement a] | default: stmts; |
Instances
| Functor CaseClause | |
| Typeable1 CaseClause | |
| Foldable CaseClause | |
| Traversable CaseClause | |
| HasAnnotation CaseClause | |
| Eq a => Eq (CaseClause a) | |
| Data a => Data (CaseClause a) | |
| Ord a => Ord (CaseClause a) | |
| Show a => Show (CaseClause a) | |
| Arbitrary a => Arbitrary (CaseClause a) | |
| Pretty (CaseClause a) |
data CatchClause a Source
Catch clause, spec 12.14
Constructors
| CatchClause a (Id a) (Statement a) | catch (x) {...} |
Instances
| Functor CatchClause | |
| Typeable1 CatchClause | |
| Foldable CatchClause | |
| Traversable CatchClause | |
| HasAnnotation CatchClause | |
| Eq a => Eq (CatchClause a) | |
| Data a => Data (CatchClause a) | |
| Ord a => Ord (CatchClause a) | |
| Show a => Show (CatchClause a) | |
| Arbitrary a => Arbitrary (CatchClause a) |
for initializer, spec 12.6
Constructors
| NoInit | empty |
| VarInit [VarDecl a] | var x, y=42 |
| ExprInit (Expression a) | expr |
for..in initializer, spec 12.6
A variable declaration, spec 12.2
Constructors
| VarDecl a (Id a) (Maybe (Expression a)) | var x = e; |
data Expression a Source
Expressions, see spec 11
Constructors
| StringLit a String |
|
| RegexpLit a String Bool Bool |
|
| NumLit a Double |
|
| IntLit a Int |
|
| BoolLit a Bool |
|
| NullLit a |
|
| ArrayLit a [Expression a] |
|
| ObjectLit a [(Prop a, Expression a)] |
|
| ThisRef a |
|
| VarRef a (Id a) |
|
| DotRef a (Expression a) (Id a) |
|
| BracketRef a (Expression a) (Expression a) |
|
| NewExpr a (Expression a) [Expression a] |
|
| PrefixExpr a PrefixOp (Expression a) |
|
| UnaryAssignExpr a UnaryAssignOp (LValue a) |
|
| InfixExpr a InfixOp (Expression a) (Expression a) |
|
| CondExpr a (Expression a) (Expression a) (Expression a) |
|
| AssignExpr a AssignOp (LValue a) (Expression a) |
|
| ListExpr a [Expression a] |
|
| CallExpr a (Expression a) [Expression a] |
|
| FuncExpr a (Maybe (Id a)) [Id a] [Statement a] |
|
Instances
| Functor Expression | |
| Typeable1 Expression | |
| Foldable Expression | |
| Traversable Expression | |
| HasAnnotation Expression | |
| Eq a => Eq (Expression a) | |
| Data a => Data (Expression a) | |
| Ord a => Ord (Expression a) | |
| Show a => Show (Expression a) | |
| Arbitrary a => Arbitrary (Expression a) | |
| Pretty (Expression a) |
Infix operators: see spec 11.5-11.11
Constructors
| OpLT | < |
| OpLEq | <= |
| OpGT | > |
| OpGEq | >= |
| OpIn | in |
| OpInstanceof | instanceof |
| OpEq | == |
| OpNEq | != |
| OpStrictEq | === |
| OpStrictNEq | !=== |
| OpLAnd | && |
| OpLOr | || |
| OpMul | * |
| OpDiv | / |
| OpMod | % |
| OpSub | - |
| OpLShift | << |
| OpSpRShift | >> |
| OpZfRShift | >>> |
| OpBAnd | & |
| OpBXor | ^ |
| OpBOr | | |
| OpAdd | + |
Assignment operators: see spec 11.13
Constructors
| OpAssign | simple assignment, |
| OpAssignAdd | += |
| OpAssignSub | -= |
| OpAssignMul | *= |
| OpAssignDiv | /= |
| OpAssignMod | %= |
| OpAssignLShift | <<= |
| OpAssignSpRShift | >>= |
| OpAssignZfRShift | >>>= |
| OpAssignBAnd | &= |
| OpAssignBXor | ^= |
| OpAssignBOr | |= |
Prefix operators: see spec 11.4 (excluding 11.4.4, 11.4.5)
Constructors
| PrefixLNot | ! |
| PrefixBNot | ~ |
| PrefixPlus | + |
| PrefixMinus | - |
| PrefixTypeof | typeof |
| PrefixVoid | void |
| PrefixDelete | delete |
Property names in an object initializer: see spec 11.1.5
data UnaryAssignOp Source
Unary assignment operators: see spec 11.3, 11.4.4, 11.4.5
Constructors
| PrefixInc | ++x |
| PrefixDec | --x |
| PostfixInc | x++ |
| PostfixDec | x-- |
Left-hand side expressions: see spec 11.2
Constructors
| LVar a String | variable reference, |
| LDot a (Expression a) String | foo.bar |
| LBracket a (Expression a) (Expression a) | foo[bar] |