language-ecmascript-0.19.1.0: JavaScript parser and pretty-printer library

Safe HaskellNone
LanguageHaskell2010

Language.ECMAScript3.Syntax.Annotations

Description

A few helpers to work with the AST annotations

Synopsis

Documentation

removeAnnotations :: Traversable t => t a -> t () Source #

Removes annotations from a tree

reannotate :: Traversable t => (a -> b) -> t a -> t b Source #

Changes all the labels in the tree to another one, given by a function.

addExtraAnnotationField :: Traversable t => b -> t a -> t (a, b) Source #

add an extra field to the AST labels (the label would look like (a, b) )

removeExtraAnnotationField :: Traversable t => t (a, b) -> t a Source #

remove an extra field

assignUniqueIds Source #

Arguments

:: Traversable t 
=> Int

starting id

-> t a

tree root

-> (t (a, Int), Int) 

Assigns unique numeric (Int) ids to each node in the AST. Returns a pair: the tree annotated with UID's and the last ID that was assigned.

class HasAnnotation a where Source #

Things that have annotations -- for example, nodes in a syntax tree

Methods

getAnnotation :: a b -> b Source #

Returns the annotation of the root of the tree

setAnnotation :: b -> a b -> a b Source #

Sets the annotation of the root of the tree

Instances
HasAnnotation Statement Source # 
Instance details

Defined in Language.ECMAScript3.Syntax.Annotations

HasAnnotation VarDecl Source # 
Instance details

Defined in Language.ECMAScript3.Syntax.Annotations

HasAnnotation CatchClause Source # 
Instance details

Defined in Language.ECMAScript3.Syntax.Annotations

HasAnnotation CaseClause Source # 
Instance details

Defined in Language.ECMAScript3.Syntax.Annotations

HasAnnotation Expression Source # 
Instance details

Defined in Language.ECMAScript3.Syntax.Annotations

HasAnnotation LValue Source # 
Instance details

Defined in Language.ECMAScript3.Syntax.Annotations

Methods

getAnnotation :: LValue b -> b Source #

setAnnotation :: b -> LValue b -> LValue b Source #

HasAnnotation Prop Source # 
Instance details

Defined in Language.ECMAScript3.Syntax.Annotations

Methods

getAnnotation :: Prop b -> b Source #

setAnnotation :: b -> Prop b -> Prop b Source #

HasAnnotation Id Source # 
Instance details

Defined in Language.ECMAScript3.Syntax.Annotations

Methods

getAnnotation :: Id b -> b Source #

setAnnotation :: b -> Id b -> Id b Source #

withAnnotation :: HasAnnotation a => (b -> b) -> a b -> a b Source #

Modify the annotation of the root node of the syntax tree