package ast
Import Path
github.com/dop251/goja/ast (on go.dev)
Dependency Relation
imports 3 packages, and imported by 2 packages
Involved Source Files
Package ast declares types representing a JavaScript AST.
# Warning
The parser and AST interfaces are still works-in-progress (particularly where
node types are concerned) and may change in the future.
Package-Level Type Names (total 86)
LeftBracket file.Idx
RightBracket file.Idx
Value []Expression
(*ArrayLiteral) Idx0() file.Idx
(*ArrayLiteral) Idx1() file.Idx
*ArrayLiteral : Expression
*ArrayLiteral : Node
Elements []Expression
LeftBracket file.Idx
Rest Expression
RightBracket file.Idx
(*ArrayPattern) Idx0() file.Idx
(*ArrayPattern) Idx1() file.Idx
*ArrayPattern : BindingTarget
*ArrayPattern : Expression
*ArrayPattern : Node
*ArrayPattern : Pattern
Async bool
Body ConciseBody
DeclarationList []*VariableDeclaration
ParameterList *ParameterList
Source string
Start file.Idx
(*ArrowFunctionLiteral) Idx0() file.Idx
(*ArrowFunctionLiteral) Idx1() file.Idx
*ArrowFunctionLiteral : Expression
*ArrowFunctionLiteral : Node
Left Expression
Operator token.Token
Right Expression
(*AssignExpression) Idx0() file.Idx
(*AssignExpression) Idx1() file.Idx
*AssignExpression : Expression
*AssignExpression : Node
Argument Expression
Await file.Idx
(*AwaitExpression) Idx0() file.Idx
(*AwaitExpression) Idx1() file.Idx
*AwaitExpression : Expression
*AwaitExpression : Node
From file.Idx
To file.Idx
(*BadExpression) Idx0() file.Idx
(*BadExpression) Idx1() file.Idx
*BadExpression : BindingTarget
*BadExpression : Expression
*BadExpression : Node
From file.Idx
To file.Idx
(*BadStatement) Idx0() file.Idx
(*BadStatement) Idx1() file.Idx
*BadStatement : Node
*BadStatement : Statement
Comparison bool
Left Expression
Operator token.Token
Right Expression
(*BinaryExpression) Idx0() file.Idx
(*BinaryExpression) Idx1() file.Idx
*BinaryExpression : Expression
*BinaryExpression : Node
Initializer Expression
Target BindingTarget
(*Binding) Idx0() file.Idx
(*Binding) Idx1() file.Idx
*Binding : Expression
*Binding : Node
// The index of the first character belonging to the node
// The index of the first character immediately after the node
*ArrayPattern
*BadExpression
*Identifier
*ObjectPattern
Pattern (interface)
*PrivateIdentifier
BindingTarget : Expression
BindingTarget : Node
LeftBrace file.Idx
List []Statement
RightBrace file.Idx
(*BlockStatement) Idx0() file.Idx
(*BlockStatement) Idx1() file.Idx
*BlockStatement : ConciseBody
*BlockStatement : Node
*BlockStatement : Statement
Idx file.Idx
Literal string
Value bool
(*BooleanLiteral) Idx0() file.Idx
(*BooleanLiteral) Idx1() file.Idx
*BooleanLiteral : Expression
*BooleanLiteral : Node
Left Expression
LeftBracket file.Idx
Member Expression
RightBracket file.Idx
(*BracketExpression) Idx0() file.Idx
(*BracketExpression) Idx1() file.Idx
*BracketExpression : Expression
*BracketExpression : Node
Idx file.Idx
Label *Identifier
Token token.Token
(*BranchStatement) Idx0() file.Idx
(*BranchStatement) Idx1() file.Idx
*BranchStatement : Node
*BranchStatement : Statement
ArgumentList []Expression
Callee Expression
LeftParenthesis file.Idx
RightParenthesis file.Idx
(*CallExpression) Idx0() file.Idx
(*CallExpression) Idx1() file.Idx
*CallExpression : Expression
*CallExpression : Node
Case file.Idx
Consequent []Statement
Test Expression
(*CaseStatement) Idx0() file.Idx
(*CaseStatement) Idx1() file.Idx
*CaseStatement : Node
*CaseStatement : Statement
Body *BlockStatement
Catch file.Idx
Parameter BindingTarget
(*CatchStatement) Idx0() file.Idx
(*CatchStatement) Idx1() file.Idx
*CatchStatement : Node
*CatchStatement : Statement
Class *ClassLiteral
(*ClassDeclaration) Idx0() file.Idx
(*ClassDeclaration) Idx1() file.Idx
*ClassDeclaration : Node
*ClassDeclaration : Statement
// The index of the first character belonging to the node
// The index of the first character immediately after the node
*ClassStaticBlock
*FieldDefinition
*MethodDefinition
ClassElement : Node
Body []ClassElement
Class file.Idx
Name *Identifier
RightBrace file.Idx
Source string
SuperClass Expression
(*ClassLiteral) Idx0() file.Idx
(*ClassLiteral) Idx1() file.Idx
*ClassLiteral : Expression
*ClassLiteral : Node
Block *BlockStatement
DeclarationList []*VariableDeclaration
Source string
Static file.Idx
(*ClassStaticBlock) Idx0() file.Idx
(*ClassStaticBlock) Idx1() file.Idx
*ClassStaticBlock : ClassElement
*ClassStaticBlock : Node
// The index of the first character belonging to the node
// The index of the first character immediately after the node
*BlockStatement
*ExpressionBody
ConciseBody : Node
Alternate Expression
Consequent Expression
Test Expression
(*ConditionalExpression) Idx0() file.Idx
(*ConditionalExpression) Idx1() file.Idx
*ConditionalExpression : Expression
*ConditionalExpression : Node
Debugger file.Idx
(*DebuggerStatement) Idx0() file.Idx
(*DebuggerStatement) Idx1() file.Idx
*DebuggerStatement : Node
*DebuggerStatement : Statement
Identifier Identifier
Left Expression
(*DotExpression) Idx0() file.Idx
(*DotExpression) Idx1() file.Idx
*DotExpression : Expression
*DotExpression : Node
Body Statement
Do file.Idx
RightParenthesis file.Idx
Test Expression
(*DoWhileStatement) Idx0() file.Idx
(*DoWhileStatement) Idx1() file.Idx
*DoWhileStatement : Node
*DoWhileStatement : Statement
Semicolon file.Idx
(*EmptyStatement) Idx0() file.Idx
(*EmptyStatement) Idx1() file.Idx
*EmptyStatement : Node
*EmptyStatement : Statement
All expression nodes implement the Expression interface.
// The index of the first character belonging to the node
// The index of the first character immediately after the node
*ArrayLiteral
*ArrayPattern
*ArrowFunctionLiteral
*AssignExpression
*AwaitExpression
*BadExpression
*BinaryExpression
*Binding
BindingTarget (interface)
*BooleanLiteral
*BracketExpression
*CallExpression
*ClassLiteral
*ConditionalExpression
*DotExpression
*FunctionLiteral
*Identifier
*MetaProperty
*NewExpression
*NullLiteral
*NumberLiteral
*ObjectLiteral
*ObjectPattern
Optional
OptionalChain
Pattern (interface)
*PrivateDotExpression
*PrivateIdentifier
Property (interface)
*PropertyKeyed
*PropertyShort
*RegExpLiteral
*SequenceExpression
SpreadElement
*StringLiteral
*SuperExpression
*TemplateLiteral
*ThisExpression
*UnaryExpression
*YieldExpression
Expression : Node
Expression Expression
(*ExpressionBody) Idx0() file.Idx
(*ExpressionBody) Idx1() file.Idx
*ExpressionBody : ConciseBody
*ExpressionBody : Node
Expression Expression
(*ExpressionStatement) Idx0() file.Idx
(*ExpressionStatement) Idx1() file.Idx
*ExpressionStatement : Node
*ExpressionStatement : Statement
Computed bool
Idx file.Idx
Initializer Expression
Key Expression
Static bool
(*FieldDefinition) Idx0() file.Idx
(*FieldDefinition) Idx1() file.Idx
*FieldDefinition : ClassElement
*FieldDefinition : Node
Idx file.Idx
IsConst bool
Target BindingTarget
(*ForDeclaration) Idx0() file.Idx
(*ForDeclaration) Idx1() file.Idx
*ForDeclaration : ForInto
*ForDeclaration : Node
Body Statement
For file.Idx
Into ForInto
Source Expression
(*ForInStatement) Idx0() file.Idx
(*ForInStatement) Idx1() file.Idx
*ForInStatement : Node
*ForInStatement : Statement
// The index of the first character belonging to the node
// The index of the first character immediately after the node
*ForDeclaration
*ForIntoExpression
*ForIntoVar
ForInto : Node
Expression Expression
(*ForIntoExpression) Idx0() file.Idx
(*ForIntoExpression) Idx1() file.Idx
*ForIntoExpression : ForInto
*ForIntoExpression : Node
Binding *Binding
(*ForIntoVar) Idx0() file.Idx
(*ForIntoVar) Idx1() file.Idx
*ForIntoVar : ForInto
*ForIntoVar : Node
// The index of the first character belonging to the node
// The index of the first character immediately after the node
*ForLoopInitializerExpression
*ForLoopInitializerLexicalDecl
*ForLoopInitializerVarDeclList
ForLoopInitializer : Node
Expression Expression
(*ForLoopInitializerExpression) Idx0() file.Idx
(*ForLoopInitializerExpression) Idx1() file.Idx
*ForLoopInitializerExpression : ForLoopInitializer
*ForLoopInitializerExpression : Node
LexicalDeclaration LexicalDeclaration
(*ForLoopInitializerLexicalDecl) Idx0() file.Idx
(*ForLoopInitializerLexicalDecl) Idx1() file.Idx
*ForLoopInitializerLexicalDecl : ForLoopInitializer
*ForLoopInitializerLexicalDecl : Node
List []*Binding
Var file.Idx
(*ForLoopInitializerVarDeclList) Idx0() file.Idx
(*ForLoopInitializerVarDeclList) Idx1() file.Idx
*ForLoopInitializerVarDeclList : ForLoopInitializer
*ForLoopInitializerVarDeclList : Node
Body Statement
For file.Idx
Into ForInto
Source Expression
(*ForOfStatement) Idx0() file.Idx
(*ForOfStatement) Idx1() file.Idx
*ForOfStatement : Node
*ForOfStatement : Statement
Body Statement
For file.Idx
Initializer ForLoopInitializer
Test Expression
Update Expression
(*ForStatement) Idx0() file.Idx
(*ForStatement) Idx1() file.Idx
*ForStatement : Node
*ForStatement : Statement
Function *FunctionLiteral
(*FunctionDeclaration) Idx0() file.Idx
(*FunctionDeclaration) Idx1() file.Idx
*FunctionDeclaration : Node
*FunctionDeclaration : Statement
Async bool
Body *BlockStatement
DeclarationList []*VariableDeclaration
Function file.Idx
Generator bool
Name *Identifier
ParameterList *ParameterList
Source string
(*FunctionLiteral) Idx0() file.Idx
(*FunctionLiteral) Idx1() file.Idx
*FunctionLiteral : Expression
*FunctionLiteral : Node
func github.com/dop251/goja/parser.ParseFunction(parameterList, body string, options ...parser.Option) (*FunctionLiteral, error)
Idx file.Idx
Name unistring.String
(*Identifier) Idx0() file.Idx
(*Identifier) Idx1() file.Idx
*Identifier : BindingTarget
*Identifier : Expression
*Identifier : Node
Alternate Statement
Consequent Statement
If file.Idx
Test Expression
(*IfStatement) Idx0() file.Idx
(*IfStatement) Idx1() file.Idx
*IfStatement : Node
*IfStatement : Statement
Colon file.Idx
Label *Identifier
Statement Statement
(*LabelledStatement) Idx0() file.Idx
(*LabelledStatement) Idx1() file.Idx
*LabelledStatement : Node
*LabelledStatement : Statement
Idx file.Idx
List []*Binding
Token token.Token
(*LexicalDeclaration) Idx0() file.Idx
(*LexicalDeclaration) Idx1() file.Idx
*LexicalDeclaration : Node
*LexicalDeclaration : Statement
Idx file.Idx
Meta *Identifier
Property *Identifier
(*MetaProperty) Idx0() file.Idx
(*MetaProperty) Idx1() file.Idx
*MetaProperty : Expression
*MetaProperty : Node
Body *FunctionLiteral
Computed bool
Idx file.Idx
Key Expression
// "method", "get" or "set"
Static bool
(*MethodDefinition) Idx0() file.Idx
(*MethodDefinition) Idx1() file.Idx
*MethodDefinition : ClassElement
*MethodDefinition : Node
ArgumentList []Expression
Callee Expression
LeftParenthesis file.Idx
New file.Idx
RightParenthesis file.Idx
(*NewExpression) Idx0() file.Idx
(*NewExpression) Idx1() file.Idx
*NewExpression : Expression
*NewExpression : Node
All nodes implement the Node interface.
// The index of the first character belonging to the node
// The index of the first character immediately after the node
*ArrayLiteral
*ArrayPattern
*ArrowFunctionLiteral
*AssignExpression
*AwaitExpression
*BadExpression
*BadStatement
*BinaryExpression
*Binding
BindingTarget (interface)
*BlockStatement
*BooleanLiteral
*BracketExpression
*BranchStatement
*CallExpression
*CaseStatement
*CatchStatement
*ClassDeclaration
ClassElement (interface)
*ClassLiteral
*ClassStaticBlock
ConciseBody (interface)
*ConditionalExpression
*DebuggerStatement
*DotExpression
*DoWhileStatement
*EmptyStatement
Expression (interface)
*ExpressionBody
*ExpressionStatement
*FieldDefinition
*ForDeclaration
*ForInStatement
ForInto (interface)
*ForIntoExpression
*ForIntoVar
ForLoopInitializer (interface)
*ForLoopInitializerExpression
*ForLoopInitializerLexicalDecl
*ForLoopInitializerVarDeclList
*ForOfStatement
*ForStatement
*FunctionDeclaration
*FunctionLiteral
*Identifier
*IfStatement
*LabelledStatement
*LexicalDeclaration
*MetaProperty
*MethodDefinition
*NewExpression
*NullLiteral
*NumberLiteral
*ObjectLiteral
*ObjectPattern
Optional
OptionalChain
*ParameterList
Pattern (interface)
*PrivateDotExpression
*PrivateIdentifier
*Program
Property (interface)
*PropertyKeyed
*PropertyShort
*RegExpLiteral
*ReturnStatement
*SequenceExpression
SpreadElement
Statement (interface)
*StringLiteral
*SuperExpression
*SwitchStatement
*TemplateElement
*TemplateLiteral
*ThisExpression
*ThrowStatement
*TryStatement
*UnaryExpression
*VariableDeclaration
*VariableStatement
*WhileStatement
*WithStatement
*YieldExpression
Idx file.Idx
Literal string
(*NullLiteral) Idx0() file.Idx
(*NullLiteral) Idx1() file.Idx
*NullLiteral : Expression
*NullLiteral : Node
Idx file.Idx
Literal string
Value interface{}
(*NumberLiteral) Idx0() file.Idx
(*NumberLiteral) Idx1() file.Idx
*NumberLiteral : Expression
*NumberLiteral : Node
LeftBrace file.Idx
RightBrace file.Idx
Value []Property
(*ObjectLiteral) Idx0() file.Idx
(*ObjectLiteral) Idx1() file.Idx
*ObjectLiteral : Expression
*ObjectLiteral : Node
LeftBrace file.Idx
Properties []Property
Rest Expression
RightBrace file.Idx
(*ObjectPattern) Idx0() file.Idx
(*ObjectPattern) Idx1() file.Idx
*ObjectPattern : BindingTarget
*ObjectPattern : Expression
*ObjectPattern : Node
*ObjectPattern : Pattern
Expression Expression
// The index of the first character belonging to the node
// The index of the first character immediately after the node
Optional : Expression
Optional : Node
Expression Expression
// The index of the first character belonging to the node
// The index of the first character immediately after the node
OptionalChain : Expression
OptionalChain : Node
Closing file.Idx
List []*Binding
Opening file.Idx
Rest Expression
(*ParameterList) Idx0() file.Idx
(*ParameterList) Idx1() file.Idx
*ParameterList : Node
// The index of the first character belonging to the node
// The index of the first character immediately after the node
*ArrayPattern
*ObjectPattern
Pattern : BindingTarget
Pattern : Expression
Pattern : Node
Identifier PrivateIdentifier
Left Expression
(*PrivateDotExpression) Idx0() file.Idx
(*PrivateDotExpression) Idx1() file.Idx
*PrivateDotExpression : Expression
*PrivateDotExpression : Node
Identifier Identifier
Identifier.Idx file.Idx
Identifier.Name unistring.String
(*PrivateIdentifier) Idx0() file.Idx
(*PrivateIdentifier) Idx1() file.Idx
*PrivateIdentifier : BindingTarget
*PrivateIdentifier : Expression
*PrivateIdentifier : Node
Body []Statement
DeclarationList []*VariableDeclaration
File *file.File
(*Program) Idx0() file.Idx
(*Program) Idx1() file.Idx
*Program : Node
func github.com/dop251/goja.Parse(name, src string, options ...parser.Option) (prg *Program, err error)
func github.com/dop251/goja/parser.ParseFile(fileSet *file.FileSet, filename string, src interface{}, mode parser.Mode, options ...parser.Option) (*Program, error)
func github.com/dop251/goja.CompileAST(prg *Program, strict bool) (*goja.Program, error)
// The index of the first character belonging to the node
// The index of the first character immediately after the node
*PropertyKeyed
*PropertyShort
*SpreadElement
Property : Expression
Property : Node
Computed bool
Key Expression
Kind PropertyKind
Value Expression
(*PropertyKeyed) Idx0() file.Idx
(*PropertyKeyed) Idx1() file.Idx
*PropertyKeyed : Expression
*PropertyKeyed : Node
*PropertyKeyed : Property
const PropertyKindGet
const PropertyKindMethod
const PropertyKindSet
const PropertyKindValue
Initializer Expression
Name Identifier
(*PropertyShort) Idx0() file.Idx
(*PropertyShort) Idx1() file.Idx
*PropertyShort : Expression
*PropertyShort : Node
*PropertyShort : Property
Flags string
Idx file.Idx
Literal string
Pattern string
(*RegExpLiteral) Idx0() file.Idx
(*RegExpLiteral) Idx1() file.Idx
*RegExpLiteral : Expression
*RegExpLiteral : Node
Argument Expression
Return file.Idx
(*ReturnStatement) Idx0() file.Idx
(*ReturnStatement) Idx1() file.Idx
*ReturnStatement : Node
*ReturnStatement : Statement
Sequence []Expression
(*SequenceExpression) Idx0() file.Idx
(*SequenceExpression) Idx1() file.Idx
*SequenceExpression : Expression
*SequenceExpression : Node
Expression Expression
// The index of the first character belonging to the node
// The index of the first character immediately after the node
SpreadElement : Expression
SpreadElement : Node
*SpreadElement : Property
All statement nodes implement the Statement interface.
// The index of the first character belonging to the node
// The index of the first character immediately after the node
*BadStatement
*BlockStatement
*BranchStatement
*CaseStatement
*CatchStatement
*ClassDeclaration
*DebuggerStatement
*DoWhileStatement
*EmptyStatement
*ExpressionStatement
*ForInStatement
*ForOfStatement
*ForStatement
*FunctionDeclaration
*IfStatement
*LabelledStatement
*LexicalDeclaration
*ReturnStatement
*SwitchStatement
*ThrowStatement
*TryStatement
*VariableStatement
*WhileStatement
*WithStatement
Statement : Node
Idx file.Idx
Literal string
Value unistring.String
(*StringLiteral) Idx0() file.Idx
(*StringLiteral) Idx1() file.Idx
*StringLiteral : Expression
*StringLiteral : Node
Idx file.Idx
(*SuperExpression) Idx0() file.Idx
(*SuperExpression) Idx1() file.Idx
*SuperExpression : Expression
*SuperExpression : Node
Body []*CaseStatement
Default int
Discriminant Expression
RightBrace file.Idx
Switch file.Idx
(*SwitchStatement) Idx0() file.Idx
(*SwitchStatement) Idx1() file.Idx
*SwitchStatement : Node
*SwitchStatement : Statement
Idx file.Idx
Literal string
Parsed unistring.String
Valid bool
(*TemplateElement) Idx0() file.Idx
(*TemplateElement) Idx1() file.Idx
*TemplateElement : Node
CloseQuote file.Idx
Elements []*TemplateElement
Expressions []Expression
OpenQuote file.Idx
Tag Expression
(*TemplateLiteral) Idx0() file.Idx
(*TemplateLiteral) Idx1() file.Idx
*TemplateLiteral : Expression
*TemplateLiteral : Node
Idx file.Idx
(*ThisExpression) Idx0() file.Idx
(*ThisExpression) Idx1() file.Idx
*ThisExpression : Expression
*ThisExpression : Node
Argument Expression
Throw file.Idx
(*ThrowStatement) Idx0() file.Idx
(*ThrowStatement) Idx1() file.Idx
*ThrowStatement : Node
*ThrowStatement : Statement
Body *BlockStatement
Catch *CatchStatement
Finally *BlockStatement
Try file.Idx
(*TryStatement) Idx0() file.Idx
(*TryStatement) Idx1() file.Idx
*TryStatement : Node
*TryStatement : Statement
// If a prefix operation
Operand Expression
Operator token.Token
Postfix bool
(*UnaryExpression) Idx0() file.Idx
(*UnaryExpression) Idx1() file.Idx
*UnaryExpression : Expression
*UnaryExpression : Node
List []*Binding
Var file.Idx
(*VariableDeclaration) Idx0() file.Idx
(*VariableDeclaration) Idx1() file.Idx
*VariableDeclaration : Node
List []*Binding
Var file.Idx
(*VariableStatement) Idx0() file.Idx
(*VariableStatement) Idx1() file.Idx
*VariableStatement : Node
*VariableStatement : Statement
Body Statement
Test Expression
While file.Idx
(*WhileStatement) Idx0() file.Idx
(*WhileStatement) Idx1() file.Idx
*WhileStatement : Node
*WhileStatement : Statement
Package-Level Constants (total 4)
const PropertyKindGet PropertyKind = "get" const PropertyKindMethod PropertyKind = "method" const PropertyKindSet PropertyKind = "set" const PropertyKindValue PropertyKind = "value"![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |