Safe Haskell | None |
---|---|
Language | Haskell2010 |
ECMAScript 3 syntax. Spec refers to the ECMA-262 specification, 3rd edition.
Synopsis
- 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
- data Prop a
- data UnaryAssignOp
- data LValue a
- = LVar a String
- | LDot a (Expression a) String
- | LBracket a (Expression a) (Expression a)
- data SourcePos
- isValid :: forall a. (Data a, Typeable a) => JavaScript a -> Bool
- isValidIdentifier :: Id a -> Bool
- isValidIdentifierName :: String -> Bool
- isReservedWord :: String -> Bool
- isValidIdStart :: Char -> Bool
- isValidIdPart :: Char -> Bool
- data EnclosingStatement
- = EnclosingIter [Label]
- | EnclosingSwitch [Label]
- | EnclosingOther [Label]
- pushLabel :: Monad m => Id b -> StateT ([Label], [EnclosingStatement]) m a -> StateT ([Label], [EnclosingStatement]) m a
- pushEnclosing :: Monad m => ([Label] -> EnclosingStatement) -> StateT ([Label], [EnclosingStatement]) m a -> StateT ([Label], [EnclosingStatement]) m a
- class HasLabelSet a where
- getLabelSet :: a -> [Label]
- setLabelSet :: [Label] -> a -> a
- isIter :: EnclosingStatement -> Bool
- isIterSwitch :: EnclosingStatement -> Bool
Documentation
data JavaScript a Source #
Instances
unJavaScript :: JavaScript a -> [Statement a] Source #
extracts statements from a JavaScript type
Statements, spec 12.
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
Functor Statement Source # | |
Foldable Statement Source # | |
Defined in Language.ECMAScript3.Syntax fold :: Monoid m => Statement m -> m # foldMap :: Monoid m => (a -> m) -> Statement a -> m # foldr :: (a -> b -> b) -> b -> Statement a -> b # foldr' :: (a -> b -> b) -> b -> Statement a -> b # foldl :: (b -> a -> b) -> b -> Statement a -> b # foldl' :: (b -> a -> b) -> b -> Statement a -> b # foldr1 :: (a -> a -> a) -> Statement a -> a # foldl1 :: (a -> a -> a) -> Statement a -> a # toList :: Statement a -> [a] # length :: Statement a -> Int # elem :: Eq a => a -> Statement a -> Bool # maximum :: Ord a => Statement a -> a # minimum :: Ord a => Statement a -> a # | |
Traversable Statement Source # | |
Defined in Language.ECMAScript3.Syntax | |
HasAnnotation Statement Source # | |
Defined in Language.ECMAScript3.Syntax.Annotations getAnnotation :: Statement b -> b Source # setAnnotation :: b -> Statement b -> Statement b Source # | |
Eq a => Eq (Statement a) Source # | |
Data a => Data (Statement a) Source # | |
Defined in Language.ECMAScript3.Syntax gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Statement a -> c (Statement a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Statement a) # toConstr :: Statement a -> Constr # dataTypeOf :: Statement a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Statement a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Statement a)) # gmapT :: (forall b. Data b => b -> b) -> Statement a -> Statement a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Statement a -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Statement a -> r # gmapQ :: (forall d. Data d => d -> u) -> Statement a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Statement a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Statement a -> m (Statement a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Statement a -> m (Statement a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Statement a -> m (Statement a) # | |
Ord a => Ord (Statement a) Source # | |
Defined in Language.ECMAScript3.Syntax | |
Show a => Show (Statement a) Source # | |
Pretty [Statement a] Source # | |
Defined in Language.ECMAScript3.PrettyPrint prettyPrint :: [Statement a] -> Doc Source # | |
Pretty (Statement a) Source # | |
Defined in Language.ECMAScript3.PrettyPrint prettyPrint :: Statement a -> Doc Source # |
isIterationStmt :: Statement a -> Bool Source #
Returns True
if the statement is an IterationStatement
according to spec 12.6.
data CaseClause a Source #
Case clauses, spec 12.11
CaseClause a (Expression a) [Statement a] | case e: stmts; |
CaseDefault a [Statement a] | default: stmts; |
Instances
data CatchClause a Source #
Catch clause, spec 12.14
CatchClause a (Id a) (Statement a) | catch (x) {...} |
Instances
for initializer, spec 12.6
NoInit | empty |
VarInit [VarDecl a] | var x, y=42 |
ExprInit (Expression a) | expr |
Instances
Functor ForInit Source # | |
Foldable ForInit Source # | |
Defined in Language.ECMAScript3.Syntax fold :: Monoid m => ForInit m -> m # foldMap :: Monoid m => (a -> m) -> ForInit a -> m # foldr :: (a -> b -> b) -> b -> ForInit a -> b # foldr' :: (a -> b -> b) -> b -> ForInit a -> b # foldl :: (b -> a -> b) -> b -> ForInit a -> b # foldl' :: (b -> a -> b) -> b -> ForInit a -> b # foldr1 :: (a -> a -> a) -> ForInit a -> a # foldl1 :: (a -> a -> a) -> ForInit a -> a # elem :: Eq a => a -> ForInit a -> Bool # maximum :: Ord a => ForInit a -> a # minimum :: Ord a => ForInit a -> a # | |
Traversable ForInit Source # | |
Eq a => Eq (ForInit a) Source # | |
Data a => Data (ForInit a) Source # | |
Defined in Language.ECMAScript3.Syntax gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ForInit a -> c (ForInit a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (ForInit a) # toConstr :: ForInit a -> Constr # dataTypeOf :: ForInit a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (ForInit a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (ForInit a)) # gmapT :: (forall b. Data b => b -> b) -> ForInit a -> ForInit a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ForInit a -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ForInit a -> r # gmapQ :: (forall d. Data d => d -> u) -> ForInit a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> ForInit a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> ForInit a -> m (ForInit a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ForInit a -> m (ForInit a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ForInit a -> m (ForInit a) # | |
Ord a => Ord (ForInit a) Source # | |
Defined in Language.ECMAScript3.Syntax | |
Show a => Show (ForInit a) Source # | |
Pretty (ForInit a) Source # | |
Defined in Language.ECMAScript3.PrettyPrint prettyPrint :: ForInit a -> Doc Source # |
for..in initializer, spec 12.6
Instances
Functor ForInInit Source # | |
Foldable ForInInit Source # | |
Defined in Language.ECMAScript3.Syntax fold :: Monoid m => ForInInit m -> m # foldMap :: Monoid m => (a -> m) -> ForInInit a -> m # foldr :: (a -> b -> b) -> b -> ForInInit a -> b # foldr' :: (a -> b -> b) -> b -> ForInInit a -> b # foldl :: (b -> a -> b) -> b -> ForInInit a -> b # foldl' :: (b -> a -> b) -> b -> ForInInit a -> b # foldr1 :: (a -> a -> a) -> ForInInit a -> a # foldl1 :: (a -> a -> a) -> ForInInit a -> a # toList :: ForInInit a -> [a] # length :: ForInInit a -> Int # elem :: Eq a => a -> ForInInit a -> Bool # maximum :: Ord a => ForInInit a -> a # minimum :: Ord a => ForInInit a -> a # | |
Traversable ForInInit Source # | |
Defined in Language.ECMAScript3.Syntax | |
Eq a => Eq (ForInInit a) Source # | |
Data a => Data (ForInInit a) Source # | |
Defined in Language.ECMAScript3.Syntax gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ForInInit a -> c (ForInInit a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (ForInInit a) # toConstr :: ForInInit a -> Constr # dataTypeOf :: ForInInit a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (ForInInit a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (ForInInit a)) # gmapT :: (forall b. Data b => b -> b) -> ForInInit a -> ForInInit a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ForInInit a -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ForInInit a -> r # gmapQ :: (forall d. Data d => d -> u) -> ForInInit a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> ForInInit a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> ForInInit a -> m (ForInInit a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ForInInit a -> m (ForInInit a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ForInInit a -> m (ForInInit a) # | |
Ord a => Ord (ForInInit a) Source # | |
Defined in Language.ECMAScript3.Syntax | |
Show a => Show (ForInInit a) Source # | |
Pretty (ForInInit a) Source # | |
Defined in Language.ECMAScript3.PrettyPrint prettyPrint :: ForInInit a -> Doc Source # |
A variable declaration, spec 12.2
VarDecl a (Id a) (Maybe (Expression a)) | var x = e; |
Instances
Functor VarDecl Source # | |
Foldable VarDecl Source # | |
Defined in Language.ECMAScript3.Syntax fold :: Monoid m => VarDecl m -> m # foldMap :: Monoid m => (a -> m) -> VarDecl a -> m # foldr :: (a -> b -> b) -> b -> VarDecl a -> b # foldr' :: (a -> b -> b) -> b -> VarDecl a -> b # foldl :: (b -> a -> b) -> b -> VarDecl a -> b # foldl' :: (b -> a -> b) -> b -> VarDecl a -> b # foldr1 :: (a -> a -> a) -> VarDecl a -> a # foldl1 :: (a -> a -> a) -> VarDecl a -> a # elem :: Eq a => a -> VarDecl a -> Bool # maximum :: Ord a => VarDecl a -> a # minimum :: Ord a => VarDecl a -> a # | |
Traversable VarDecl Source # | |
HasAnnotation VarDecl Source # | |
Defined in Language.ECMAScript3.Syntax.Annotations getAnnotation :: VarDecl b -> b Source # setAnnotation :: b -> VarDecl b -> VarDecl b Source # | |
Eq a => Eq (VarDecl a) Source # | |
Data a => Data (VarDecl a) Source # | |
Defined in Language.ECMAScript3.Syntax gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> VarDecl a -> c (VarDecl a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (VarDecl a) # toConstr :: VarDecl a -> Constr # dataTypeOf :: VarDecl a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (VarDecl a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (VarDecl a)) # gmapT :: (forall b. Data b => b -> b) -> VarDecl a -> VarDecl a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> VarDecl a -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> VarDecl a -> r # gmapQ :: (forall d. Data d => d -> u) -> VarDecl a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> VarDecl a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> VarDecl a -> m (VarDecl a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> VarDecl a -> m (VarDecl a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> VarDecl a -> m (VarDecl a) # | |
Ord a => Ord (VarDecl a) Source # | |
Defined in Language.ECMAScript3.Syntax | |
Show a => Show (VarDecl a) Source # | |
Pretty (VarDecl a) Source # | |
Defined in Language.ECMAScript3.PrettyPrint prettyPrint :: VarDecl a -> Doc Source # |
data Expression a Source #
Expressions, see spec 11
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
Infix operators: see spec 11.5-11.11
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 | + |
Instances
Enum InfixOp Source # | |
Eq InfixOp Source # | |
Data InfixOp Source # | |
Defined in Language.ECMAScript3.Syntax gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> InfixOp -> c InfixOp # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c InfixOp # toConstr :: InfixOp -> Constr # dataTypeOf :: InfixOp -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c InfixOp) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c InfixOp) # gmapT :: (forall b. Data b => b -> b) -> InfixOp -> InfixOp # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> InfixOp -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> InfixOp -> r # gmapQ :: (forall d. Data d => d -> u) -> InfixOp -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> InfixOp -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> InfixOp -> m InfixOp # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> InfixOp -> m InfixOp # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> InfixOp -> m InfixOp # | |
Ord InfixOp Source # | |
Defined in Language.ECMAScript3.Syntax | |
Show InfixOp Source # | |
Pretty InfixOp Source # | |
Defined in Language.ECMAScript3.PrettyPrint prettyPrint :: InfixOp -> Doc Source # |
Assignment operators: see spec 11.13
OpAssign | simple assignment, |
OpAssignAdd | += |
OpAssignSub | -= |
OpAssignMul | *= |
OpAssignDiv | /= |
OpAssignMod | %= |
OpAssignLShift | <<= |
OpAssignSpRShift | >>= |
OpAssignZfRShift | >>>= |
OpAssignBAnd | &= |
OpAssignBXor | ^= |
OpAssignBOr | |= |
Instances
Eq AssignOp Source # | |
Data AssignOp Source # | |
Defined in Language.ECMAScript3.Syntax gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> AssignOp -> c AssignOp # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c AssignOp # toConstr :: AssignOp -> Constr # dataTypeOf :: AssignOp -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c AssignOp) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c AssignOp) # gmapT :: (forall b. Data b => b -> b) -> AssignOp -> AssignOp # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> AssignOp -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> AssignOp -> r # gmapQ :: (forall d. Data d => d -> u) -> AssignOp -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> AssignOp -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> AssignOp -> m AssignOp # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> AssignOp -> m AssignOp # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> AssignOp -> m AssignOp # | |
Ord AssignOp Source # | |
Defined in Language.ECMAScript3.Syntax | |
Show AssignOp Source # | |
Pretty AssignOp Source # | |
Defined in Language.ECMAScript3.PrettyPrint prettyPrint :: AssignOp -> Doc Source # |
Instances
Functor Id Source # | |
Foldable Id Source # | |
Defined in Language.ECMAScript3.Syntax fold :: Monoid m => Id m -> m # foldMap :: Monoid m => (a -> m) -> Id a -> m # foldr :: (a -> b -> b) -> b -> Id a -> b # foldr' :: (a -> b -> b) -> b -> Id a -> b # foldl :: (b -> a -> b) -> b -> Id a -> b # foldl' :: (b -> a -> b) -> b -> Id a -> b # foldr1 :: (a -> a -> a) -> Id a -> a # foldl1 :: (a -> a -> a) -> Id a -> a # elem :: Eq a => a -> Id a -> Bool # maximum :: Ord a => Id a -> a # | |
Traversable Id Source # | |
HasAnnotation Id Source # | |
Defined in Language.ECMAScript3.Syntax.Annotations getAnnotation :: Id b -> b Source # setAnnotation :: b -> Id b -> Id b Source # | |
Eq a => Eq (Id a) Source # | |
Data a => Data (Id a) Source # | |
Defined in Language.ECMAScript3.Syntax gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Id a -> c (Id a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Id a) # dataTypeOf :: Id a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Id a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Id a)) # gmapT :: (forall b. Data b => b -> b) -> Id a -> Id a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Id a -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Id a -> r # gmapQ :: (forall d. Data d => d -> u) -> Id a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Id a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Id a -> m (Id a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Id a -> m (Id a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Id a -> m (Id a) # | |
Ord a => Ord (Id a) Source # | |
Show a => Show (Id a) Source # | |
Default a => IsString (Id a) Source # | |
Defined in Language.ECMAScript3.Syntax.CodeGen fromString :: String -> Id a # | |
Pretty (Id a) Source # | |
Defined in Language.ECMAScript3.PrettyPrint prettyPrint :: Id a -> Doc Source # |
Prefix operators: see spec 11.4 (excluding 11.4.4, 11.4.5)
PrefixLNot | ! |
PrefixBNot | ~ |
PrefixPlus | + |
PrefixMinus | - |
PrefixTypeof | typeof |
PrefixVoid | void |
PrefixDelete | delete |
Instances
Eq PrefixOp Source # | |
Data PrefixOp Source # | |
Defined in Language.ECMAScript3.Syntax gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> PrefixOp -> c PrefixOp # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c PrefixOp # toConstr :: PrefixOp -> Constr # dataTypeOf :: PrefixOp -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c PrefixOp) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c PrefixOp) # gmapT :: (forall b. Data b => b -> b) -> PrefixOp -> PrefixOp # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> PrefixOp -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> PrefixOp -> r # gmapQ :: (forall d. Data d => d -> u) -> PrefixOp -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> PrefixOp -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> PrefixOp -> m PrefixOp # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> PrefixOp -> m PrefixOp # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> PrefixOp -> m PrefixOp # | |
Ord PrefixOp Source # | |
Defined in Language.ECMAScript3.Syntax | |
Show PrefixOp Source # | |
Pretty PrefixOp Source # | |
Defined in Language.ECMAScript3.PrettyPrint prettyPrint :: PrefixOp -> Doc Source # |
Property names in an object initializer: see spec 11.1.5
PropId a (Id a) | property name is an identifier, |
PropString a String | property name is a string, |
PropNum a Integer | property name is an integer, |
Instances
Functor Prop Source # | |
Foldable Prop Source # | |
Defined in Language.ECMAScript3.Syntax fold :: Monoid m => Prop m -> m # foldMap :: Monoid m => (a -> m) -> Prop a -> m # foldr :: (a -> b -> b) -> b -> Prop a -> b # foldr' :: (a -> b -> b) -> b -> Prop a -> b # foldl :: (b -> a -> b) -> b -> Prop a -> b # foldl' :: (b -> a -> b) -> b -> Prop a -> b # foldr1 :: (a -> a -> a) -> Prop a -> a # foldl1 :: (a -> a -> a) -> Prop a -> a # elem :: Eq a => a -> Prop a -> Bool # maximum :: Ord a => Prop a -> a # | |
Traversable Prop Source # | |
HasAnnotation Prop Source # | |
Defined in Language.ECMAScript3.Syntax.Annotations getAnnotation :: Prop b -> b Source # setAnnotation :: b -> Prop b -> Prop b Source # | |
Eq a => Eq (Prop a) Source # | |
Data a => Data (Prop a) Source # | |
Defined in Language.ECMAScript3.Syntax gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Prop a -> c (Prop a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Prop a) # toConstr :: Prop a -> Constr # dataTypeOf :: Prop a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Prop a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Prop a)) # gmapT :: (forall b. Data b => b -> b) -> Prop a -> Prop a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Prop a -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Prop a -> r # gmapQ :: (forall d. Data d => d -> u) -> Prop a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Prop a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Prop a -> m (Prop a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Prop a -> m (Prop a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Prop a -> m (Prop a) # | |
Ord a => Ord (Prop a) Source # | |
Show a => Show (Prop a) Source # | |
Default a => IsString (Prop a) Source # | |
Defined in Language.ECMAScript3.Syntax.CodeGen fromString :: String -> Prop a # | |
Pretty (Prop a) Source # | |
Defined in Language.ECMAScript3.PrettyPrint prettyPrint :: Prop a -> Doc Source # |
data UnaryAssignOp Source #
Unary assignment operators: see spec 11.3, 11.4.4, 11.4.5
PrefixInc | ++x |
PrefixDec | --x |
PostfixInc | x++ |
PostfixDec | x-- |
Instances
Left-hand side expressions: see spec 11.2
LVar a String | variable reference, |
LDot a (Expression a) String | foo.bar |
LBracket a (Expression a) (Expression a) | foo[bar] |
Instances
Functor LValue Source # | |
Foldable LValue Source # | |
Defined in Language.ECMAScript3.Syntax fold :: Monoid m => LValue m -> m # foldMap :: Monoid m => (a -> m) -> LValue a -> m # foldr :: (a -> b -> b) -> b -> LValue a -> b # foldr' :: (a -> b -> b) -> b -> LValue a -> b # foldl :: (b -> a -> b) -> b -> LValue a -> b # foldl' :: (b -> a -> b) -> b -> LValue a -> b # foldr1 :: (a -> a -> a) -> LValue a -> a # foldl1 :: (a -> a -> a) -> LValue a -> a # elem :: Eq a => a -> LValue a -> Bool # maximum :: Ord a => LValue a -> a # minimum :: Ord a => LValue a -> a # | |
Traversable LValue Source # | |
HasAnnotation LValue Source # | |
Defined in Language.ECMAScript3.Syntax.Annotations getAnnotation :: LValue b -> b Source # setAnnotation :: b -> LValue b -> LValue b Source # | |
Eq a => Eq (LValue a) Source # | |
Data a => Data (LValue a) Source # | |
Defined in Language.ECMAScript3.Syntax gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> LValue a -> c (LValue a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (LValue a) # toConstr :: LValue a -> Constr # dataTypeOf :: LValue a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (LValue a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (LValue a)) # gmapT :: (forall b. Data b => b -> b) -> LValue a -> LValue a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> LValue a -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> LValue a -> r # gmapQ :: (forall d. Data d => d -> u) -> LValue a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> LValue a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> LValue a -> m (LValue a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> LValue a -> m (LValue a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> LValue a -> m (LValue a) # | |
Ord a => Ord (LValue a) Source # | |
Defined in Language.ECMAScript3.Syntax | |
Show a => Show (LValue a) Source # | |
Default a => IsString (LValue a) Source # | |
Defined in Language.ECMAScript3.Syntax.CodeGen fromString :: String -> LValue a # | |
Pretty (LValue a) Source # | |
Defined in Language.ECMAScript3.PrettyPrint prettyPrint :: LValue a -> Doc Source # |
The abstract data type SourcePos
represents source positions. It
contains the name of the source (i.e. file name), a line number and
a column number. SourcePos
is an instance of the Show
, Eq
and
Ord
class.
Instances
Eq SourcePos | |
Data SourcePos | |
Defined in Text.Parsec.Pos gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> SourcePos -> c SourcePos # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c SourcePos # toConstr :: SourcePos -> Constr # dataTypeOf :: SourcePos -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c SourcePos) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SourcePos) # gmapT :: (forall b. Data b => b -> b) -> SourcePos -> SourcePos # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SourcePos -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SourcePos -> r # gmapQ :: (forall d. Data d => d -> u) -> SourcePos -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> SourcePos -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> SourcePos -> m SourcePos # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> SourcePos -> m SourcePos # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> SourcePos -> m SourcePos # | |
Ord SourcePos | |
Defined in Text.Parsec.Pos | |
Show SourcePos | |
Default SourcePos Source # | |
Defined in Language.ECMAScript3.Syntax |
isValid :: forall a. (Data a, Typeable a) => JavaScript a -> Bool Source #
The ECMAScript standard defines certain syntactic restrictions on
programs (or, more precisely, statements) that aren't easily
enforced in the AST datatype. These restrictions have to do with
labeled statements and break/continue statement, as well as
identifier names. Thus, it is possible to manually generate AST's
that correspond to syntactically incorrect programs. Use this
predicate to check if an JavaScript
AST corresponds to a
syntactically correct ECMAScript program.
isValidIdentifier :: Id a -> Bool Source #
Checks if an identifier name is valid according to the spec
isValidIdentifierName :: String -> Bool Source #
Checks if the String
represents a valid identifier name
isReservedWord :: String -> Bool Source #
Checks if a string is in the list of reserved ECMAScript words
isValidIdStart :: Char -> Bool Source #
Checks if a character is valid at the start of an identifier
isValidIdPart :: Char -> Bool Source #
Checks if a character is valid in an identifier part
data EnclosingStatement Source #
EnclosingIter [Label] | The enclosing statement is an iteration statement |
EnclosingSwitch [Label] | The enclosing statement is a switch statement |
EnclosingOther [Label] | The enclosing statement is some other
statement. Note, |
Instances
Show EnclosingStatement Source # | |
Defined in Language.ECMAScript3.Syntax showsPrec :: Int -> EnclosingStatement -> ShowS # show :: EnclosingStatement -> String # showList :: [EnclosingStatement] -> ShowS # | |
HasLabelSet EnclosingStatement Source # | |
Defined in Language.ECMAScript3.Syntax getLabelSet :: EnclosingStatement -> [Label] Source # setLabelSet :: [Label] -> EnclosingStatement -> EnclosingStatement Source # |
pushLabel :: Monad m => Id b -> StateT ([Label], [EnclosingStatement]) m a -> StateT ([Label], [EnclosingStatement]) m a Source #
pushEnclosing :: Monad m => ([Label] -> EnclosingStatement) -> StateT ([Label], [EnclosingStatement]) m a -> StateT ([Label], [EnclosingStatement]) m a Source #
class HasLabelSet a where Source #
getLabelSet :: a -> [Label] Source #
setLabelSet :: [Label] -> a -> a Source #
Instances
HasLabelSet EnclosingStatement Source # | |
Defined in Language.ECMAScript3.Syntax getLabelSet :: EnclosingStatement -> [Label] Source # setLabelSet :: [Label] -> EnclosingStatement -> EnclosingStatement Source # |
isIter :: EnclosingStatement -> Bool Source #