Documentation ¶
Overview ¶
Package ast contains abstract syntax tree node types.
Index ¶
- Constants
- func IsComment(node Node) bool
- func VisitAssignListChild(x AssignListChild, visitAssigner func(AssignerDereference), ...)
- func VisitBlockChild(x BlockChild, visitAssign func(Assign), visitBlock func(Block), ...)
- func VisitExpr(x ExprChild, visitAddress func(Address), visitBinary func(Binary), ...)
- func VisitExprListChild(x ExprListChild, visitAssigner func(AssignerDereference), ...)
- func VisitFieldListChild(x FieldListChild, visitComment func(Comment), visitField func(Field), ...)
- func VisitFileChild(x FileChild, visitComment func(Comment), visitConstant func(ConstantDef), ...)
- func VisitIdentListChild(x IdentListChild, visitComment func(Comment), visitIdentifier func(Identifier))
- func VisitImportListChild(x ImportListChild, visitComment func(Comment), visitImport func(Import))
- func VisitParamListChild(x ParamListChild, visitComment func(Comment), visitParameter func(Parameter))
- func VisitTypeListChild(x TypeListChild, visitComment func(Comment), visitType func(TypeSpec))
- type Address
- type Assign
- type AssignListChild
- type AssignerDereference
- type Binary
- type BinaryOp
- type Block
- type BlockChild
- type Boolean
- type Break
- type Call
- type Character
- type Clone
- type Comment
- type ConstantDef
- type Continue
- type ExprChild
- type ExprListChild
- type Expression
- type Field
- type FieldListChild
- type FileChild
- type For
- type FunctionDef
- type IdentListChild
- type Identifier
- type If
- type Import
- type ImportListChild
- type Imports
- type Index
- type Integer
- type Nil
- type Node
- type ParamListChild
- type Parameter
- type PointerDereference
- type QualifiedName
- type Return
- type Selector
- type String
- type Type
- type TypeDef
- type TypeListChild
- type TypeSpec
- type Unary
- type UnaryOp
- type VariableDecl
- type VariableDef
- type Zero
Constants ¶
View Source
const ( MinBinaryPrecedence = 1 MaxBinaryPrecedence = 5 UltimatePrecedence = 6 )
Special precedence levels.
View Source
const ( OpAdd = BinaryOp(token.Plus) OpSubtract = BinaryOp(token.Minus) OpMultiply = BinaryOp(token.Asterisk) OpDivide = BinaryOp(token.Slash) OpRemainder = BinaryOp(token.Percent) OpLogicalAnd = BinaryOp(token.LogicalAnd) OpLogicalOr = BinaryOp(token.LogicalOr) OpAndNot = BinaryOp(token.AndNot) OpAnd = BinaryOp(token.Ampersand) OpOr = BinaryOp(token.Pipe) OpExclusiveOr = BinaryOp(token.Caret) OpShiftLeft = BinaryOp(token.ShiftLeft) OpShiftRight = BinaryOp(token.ShiftRight) OpEqual = BinaryOp(token.Equal) OpNotEqual = BinaryOp(token.NotEqual) OpLessOrEqual = BinaryOp(token.LessOrEqual) OpGreaterOrEqual = BinaryOp(token.GreaterOrEqual) OpLess = BinaryOp(token.Less) OpGreater = BinaryOp(token.Greater) )
Variables ¶
This section is empty.
Functions ¶
func VisitAssignListChild ¶
func VisitAssignListChild(x AssignListChild, visitAssigner func(AssignerDereference), visitCall func(Call), visitIndex func(Index), visitSelector func(Selector), )
func VisitBlockChild ¶
func VisitBlockChild(x BlockChild, visitAssign func(Assign), visitBlock func(Block), visitBreak func(Break), visitComment func(Comment), visitContinue func(Continue), visitExpression func(Expression), visitFor func(For), visitIf func(If), visitImport func(Import), visitReturn func(Return), visitVariableDecl func(VariableDecl), visitVariableDef func(VariableDef), )
func VisitExpr ¶
func VisitExpr(x ExprChild, visitAddress func(Address), visitBinary func(Binary), visitBoolean func(Boolean), visitCall func(Call), visitCharacter func(Character), visitClone func(Clone), visitIndex func(Index), visitInteger func(Integer), visitNil func(Nil), visitPointer func(PointerDereference), visitSelector func(Selector), visitString func(String), visitUnary func(Unary), visitZero func(Zero), )
func VisitExprListChild ¶
func VisitExprListChild(x ExprListChild, visitAssigner func(AssignerDereference), visitComment func(Comment), visitExpression func(Expression), )
func VisitFieldListChild ¶
func VisitFieldListChild(x FieldListChild, visitComment func(Comment), visitField func(Field), visitImport func(Import), )
func VisitFileChild ¶
func VisitFileChild(x FileChild, visitComment func(Comment), visitConstant func(ConstantDef), visitFunction func(FunctionDef), visitImport func(Import), visitImports func(Imports), visitType func(TypeDef), )
func VisitIdentListChild ¶
func VisitIdentListChild(x IdentListChild, visitComment func(Comment), visitIdentifier func(Identifier), )
func VisitImportListChild ¶
func VisitImportListChild(x ImportListChild, visitComment func(Comment), visitImport func(Import), )
func VisitParamListChild ¶
func VisitParamListChild(x ParamListChild, visitComment func(Comment), visitParameter func(Parameter), )
func VisitTypeListChild ¶
func VisitTypeListChild(x TypeListChild, visitComment func(Comment), visitType func(TypeSpec), )
Types ¶
type Assign ¶
type Assign struct { source.Position Objects []AssignListChild Subjects []ExprListChild End source.Position }
type AssignListChild ¶
type AssignListChild interface { Node // contains filtered or unexported methods }
type AssignerDereference ¶
func (AssignerDereference) EndPos ¶
func (x AssignerDereference) EndPos() source.Position
func (AssignerDereference) Node ¶
func (AssignerDereference) Node() string
func (AssignerDereference) Pos ¶
func (x AssignerDereference) Pos() source.Position
func (AssignerDereference) String ¶
func (x AssignerDereference) String() string
type BinaryOp ¶
func (BinaryOp) Precedence ¶
Precedence level of the binary operator.
type BlockChild ¶
type BlockChild interface { Node // contains filtered or unexported methods }
type ConstantDef ¶
type ConstantDef struct { source.Position Public bool ConstName string Value ExprChild End source.Position }
func (ConstantDef) EndPos ¶
func (x ConstantDef) EndPos() source.Position
func (ConstantDef) Name ¶
func (x ConstantDef) Name() string
func (ConstantDef) Node ¶
func (ConstantDef) Node() string
func (ConstantDef) Pos ¶
func (x ConstantDef) Pos() source.Position
func (ConstantDef) String ¶
func (x ConstantDef) String() string
type ExprListChild ¶
type ExprListChild interface { Node // contains filtered or unexported methods }
type Expression ¶
type Expression struct {
Expr ExprChild
}
func (Expression) EndPos ¶
func (x Expression) EndPos() source.Position
func (Expression) Node ¶
func (Expression) Node() string
func (Expression) Pos ¶
func (x Expression) Pos() source.Position
func (Expression) String ¶
func (x Expression) String() string
type Field ¶
type FieldListChild ¶
type FieldListChild interface { Node // contains filtered or unexported methods }
type For ¶
type FunctionDef ¶
type FunctionDef struct { source.Position Public bool ReceiverName string ReceiverType *TypeSpec FuncName string Params []ParamListChild ParamsEnd source.Position Results []TypeListChild BodyPos source.Position Body []BlockChild End source.Position }
func (FunctionDef) EndPos ¶
func (x FunctionDef) EndPos() source.Position
func (FunctionDef) Name ¶
func (x FunctionDef) Name() string
func (FunctionDef) Node ¶
func (FunctionDef) Node() string
func (FunctionDef) Pos ¶
func (x FunctionDef) Pos() source.Position
func (FunctionDef) String ¶
func (x FunctionDef) String() string
type IdentListChild ¶
type IdentListChild interface { Node // contains filtered or unexported methods }
type Identifier ¶
type Identifier struct { source.Position Name QualifiedName End source.Position }
func (Identifier) EndPos ¶
func (x Identifier) EndPos() source.Position
func (Identifier) Node ¶
func (Identifier) Node() string
func (Identifier) Pos ¶
func (x Identifier) Pos() source.Position
func (Identifier) String ¶
func (x Identifier) String() string
type If ¶
type ImportListChild ¶
type ImportListChild interface { Node // contains filtered or unexported methods }
type Imports ¶
type Imports struct { source.Position Imports []ImportListChild End source.Position }
type ParamListChild ¶
type ParamListChild interface { Node // contains filtered or unexported methods }
type PointerDereference ¶
func (PointerDereference) EndPos ¶
func (x PointerDereference) EndPos() source.Position
func (PointerDereference) Node ¶
func (PointerDereference) Node() string
func (PointerDereference) Pos ¶
func (x PointerDereference) Pos() source.Position
func (PointerDereference) String ¶
func (x PointerDereference) String() string
type QualifiedName ¶
type QualifiedName []string
func (QualifiedName) Namespace ¶
func (name QualifiedName) Namespace() string
func (QualifiedName) Short ¶
func (name QualifiedName) Short() string
func (QualifiedName) String ¶
func (name QualifiedName) String() string
type Type ¶
type Type struct { Assigner bool Pointer bool Reference bool Item *Type // Non-nil if array. Name QualifiedName // Empty if array. }
type TypeDef ¶
type TypeListChild ¶
type TypeListChild interface { Node // contains filtered or unexported methods }
type VariableDecl ¶
type VariableDecl struct { source.Position Names []string Type *TypeSpec // Nil if auto. End source.Position }
func (VariableDecl) EndPos ¶
func (x VariableDecl) EndPos() source.Position
func (VariableDecl) Node ¶
func (VariableDecl) Node() string
func (VariableDecl) Pos ¶
func (x VariableDecl) Pos() source.Position
func (VariableDecl) String ¶
func (x VariableDecl) String() string
type VariableDef ¶
type VariableDef struct { source.Position Names []string Values []ExprListChild End source.Position }
func (VariableDef) EndPos ¶
func (x VariableDef) EndPos() source.Position
func (VariableDef) Node ¶
func (VariableDef) Node() string
func (VariableDef) Pos ¶
func (x VariableDef) Pos() source.Position
func (VariableDef) String ¶
func (x VariableDef) String() string
Click to show internal directories.
Click to hide internal directories.