Documentation ¶
Index ¶
- func Format(node fmt.Formatter) []byte
- type ArrayType
- type AssignStmt
- type BadDecl
- type BadExpr
- type BadStmt
- type BasicLit
- type BinaryExpr
- type BlockStmt
- type BranchStmt
- type CallExpr
- type CaseClause
- type ChanType
- type CommClause
- type Comment
- type CommentGroup
- type CompositeLit
- type Decl
- type DeclStmt
- type DeferStmt
- type Ellipsis
- type EmptyStmt
- type Expr
- type ExprStmt
- type Field
- type FieldList
- type File
- type ForStmt
- type FuncDecl
- type FuncLit
- type FuncType
- type GenDecl
- type GoStmt
- type Ident
- type IfStmt
- type ImportSpec
- type IncDecStmt
- type IndexExpr
- type InterfaceType
- type KeyValueExpr
- type LabeledStmt
- type MapType
- type NoCommaSepFieldList
- type ParenExpr
- type RangeStmt
- type ReturnStmt
- type SelectStmt
- type SelectorExpr
- type SendStmt
- type SliceExpr
- type Spec
- type StarExpr
- type Stmt
- type StructType
- type SwitchStmt
- type Token
- type TypeAssertExpr
- type TypeSpec
- type TypeSwitchStmt
- type UnaryExpr
- type ValueSpec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ArrayType ¶
type ArrayType struct { Lbrack Token // "[" Len Expr // Ellipsis node for [...]T array types, nil for slice types Elt Expr // element type }
ArrayType ...
func ArrayEllipsis ¶
ArrayEllipsis creates a `[...]elt` ArrayType.
type AssignStmt ¶
AssignStmt ...
type BadDecl ¶
type BadDecl struct {
Token Token
}
BadDecl ...
type BadExpr ¶
type BadExpr struct {
Token Token
}
BadExpr ...
type BadStmt ¶
type BadStmt struct {
Token Token
}
BadStmt ...
type BasicLit ¶
type BasicLit struct {
Token Token
}
BasicLit ...
type BinaryExpr ¶
BinaryExpr ...
type BlockStmt ¶
BlockStmt ...
type BranchStmt ¶
type BranchStmt struct { Tok Token // keyword token (BREAK, CONTINUE, GOTO, FALLTHROUGH) Label *Ident // label name; or nil }
BranchStmt ...
func ContinueTo ¶
func ContinueTo(label string) *BranchStmt
ContinueTo creates a `continue label` BranchStmt.
type CallExpr ¶
type CallExpr struct { Fun Expr // function expression Lparen Token // "(" Args []Expr // function arguments; or nil Ellipsis Token // "..." (token.NoPos if there is no "...") Rparen Token // ")" }
CallExpr ...
func CallVararg ¶
CallVararg creates an `arg...` CallStmt.
type CaseClause ¶
type CaseClause struct { Case Token // "case" or "default" keyword List []Expr // list of expressions or types; nil means default case Colon Token Body []Stmt // statement list; or nil }
CaseClause ...
func Case ¶
func Case(list []Expr, stmts ...Stmt) *CaseClause
Case creates a `case x, y, z:` CaseClause.
func DefaultCase ¶
func DefaultCase(stmts ...Stmt) *CaseClause
DefaultCase creates a `default:` CaseClause.
type ChanType ¶
type ChanType struct { Begin Token // "chan" keyword or "<-" (whichever comes first) Arrow Token // "<-" (token.NoPos if there is no "<-"); added in Go 1.1 // Dir {|"SEND", "RECV"|} powerset without {||} Dir string Value Expr // value type }
ChanType ...
type CommClause ¶
type CommClause struct { Case Token // "case" or "default" keyword Comm Stmt // send or receive statement; nil means default case Colon Token // ":" Body []Stmt // statement list; or nil }
CommClause ...
func DefaultComm ¶
func DefaultComm(stmts ...Stmt) *CommClause
DefaultComm creates a `default:` CommClause.
func RecvAssignComm ¶
func RecvAssignComm(lhs []Expr, ch Expr, stmts ...Stmt) *CommClause
RecvAssignComm creates a `case x, y = <-ch:` CommClause.
func RecvInitComm ¶
func RecvInitComm(lhs []string, ch Expr, stmts ...Stmt) *CommClause
RecvInitComm creates a `case x, y := <-ch:` CommClause.
func SendComm ¶
func SendComm(ch, value Expr, stmts ...Stmt) *CommClause
SendComm creates a `case ch <- value:` CommClause.
type CompositeLit ¶
type CompositeLit struct { Type Expr // literal type; or nil Lbrace Token // "{" Elts []Expr // list of composite elements; or nil Rbrace Token // "}" Incomplete bool // true if (source) expressions are missing in the Elts list; added in Go 1.11 }
CompositeLit ...
func Composite ¶
func Composite(t Expr, elts ...Expr) *CompositeLit
Composite creates a CompositeLit.
type DeclStmt ¶
type DeclStmt struct {
Decl Decl // GenDecl with CONST, TYPE, or VAR token
}
DeclStmt ...
type DeferStmt ¶
DeferStmt ...
func DeferVararg ¶
DeferVararg creates an `arg...` DeferStmt.
type Ellipsis ¶
type Ellipsis struct { Ellipsis Token // "..." Elt Expr // ellipsis element type (parameter lists only); or nil }
Ellipsis ...
type EmptyStmt ¶
type EmptyStmt struct { Semicolon Token // following ";" Implicit bool // if set, ";" was omitted in the source; added in Go 1.5 }
EmptyStmt ...
type ExprStmt ¶
type ExprStmt struct {
X Expr // expression
}
ExprStmt ...
type Field ¶
type Field struct { Doc *CommentGroup // associated documentation; or nil Names []Ident // field/method/parameter names; or nil Type Expr // field/method/parameter type Tag *BasicLit // field tag; or nil Comment *CommentGroup // line comments; or nil }
Field ...
type FieldList ¶
type FieldList struct { Opening Token // opening parenthesis/brace, if any List []Field // field list; or nil Closing Token // closing parenthesis/brace, if any }
FieldList ...
func ParenFields ¶
ParenFields creates a ()-delimited FieldList.
type File ¶
type File struct { Doc *CommentGroup // associated documentation; or nil Package Token // "package" keyword Name Ident // package name Decls []Decl // top-level declarations; or nil Imports []ImportSpec // imports in this file Unresolved []Ident // unresolved identifiers in this file Comments []CommentGroup // list of all comments in the source file }
File ...
type ForStmt ¶
type ForStmt struct { For Token // "for" keyword Init Stmt // initialization statement; or nil Cond Expr // condition; or nil Post Stmt // post iteration statement; or nil Body BlockStmt }
ForStmt ...
type FuncDecl ¶
type FuncDecl struct { Doc *CommentGroup // associated documentation; or nil Recv *FieldList // receiver (methods); or nil (functions) Name Ident // function/method name Type FuncType // function signature: parameters, results, and "func" keyword Body *BlockStmt // function body; or nil for external (non-Go) function }
FuncDecl ...
type FuncLit ¶
FuncLit ...
type FuncType ¶
type FuncType struct { Func Token // "func" keyword (token.NoPos if there is no "func") Params FieldList // (incoming) parameters; non-nil Results *FieldList // (outgoing) results; or nil }
FuncType ...
type GenDecl ¶
type GenDecl struct { Doc *CommentGroup // associated documentation; or nil Tok Token // IMPORT, CONST, TYPE, VAR Lparen Token // '(', if any Specs []Spec Rparen Token // ')', if any }
GenDecl ...
type GoStmt ¶
GoStmt ...
type Ident ¶
type Ident struct {
Name Token // identifier name
}
Ident ...
type IfStmt ¶
type IfStmt struct { If Token // "if" keyword Init Stmt // initialization statement; or nil Cond Expr // condition Body BlockStmt Else Stmt // else branch; or nil }
IfStmt ...
func (*IfStmt) CopyChain ¶
CopyChain copies an IfStmt and, recursively, n.Else if it is an IfStmt. Returns the copy and the last node in the chain.
type ImportSpec ¶
type ImportSpec struct { Doc *CommentGroup // associated documentation; or nil Name *Ident // local package name (including "."); or nil Path BasicLit // import path Comment *CommentGroup // line comments; or nil EndPos Token // end of spec (overrides Path.Pos if nonzero) }
ImportSpec ...
type IncDecStmt ¶
IncDecStmt ...
type IndexExpr ¶
IndexExpr ...
type InterfaceType ¶
type InterfaceType struct { Interface Token // "interface" keyword Methods FieldList // list of methods Incomplete bool // true if (source) methods are missing in the Methods list }
InterfaceType ...
type KeyValueExpr ¶
KeyValueExpr ...
type LabeledStmt ¶
LabeledStmt ...
type MapType ¶
MapType ...
type ParenExpr ¶
type ParenExpr struct { Lparen Token // "(" X Expr // parenthesized expression Rparen Token // ")" }
ParenExpr ...
type RangeStmt ¶
type RangeStmt struct { For Token // "for" keyword Key Expr // Key may be nil Value Expr // Value may be nil Tok Token // invalid if Key == nil X Expr // value to range over Body BlockStmt }
RangeStmt ...
type ReturnStmt ¶
type ReturnStmt struct { Return Token // "return" keyword Results []Expr // result expressions; or nil }
ReturnStmt ...
type SelectStmt ¶
SelectStmt ...
type SelectorExpr ¶
SelectorExpr ...
type SendStmt ¶
SendStmt ...
type SliceExpr ¶
type SliceExpr struct { X Expr // expression Lbrack Token // "[" Low Expr // begin of slice range; or nil High Expr // end of slice range; or nil Max Expr // maximum capacity of slice; or nil; added in Go 1.2 Slice3 bool // true if 3-index slice (2 colons present); added in Go 1.2 Rbrack Token // "]" }
SliceExpr ...
type StarExpr ¶
StarExpr ...
type StructType ¶
type StructType struct { Struct Token // "struct" keyword Fields FieldList // list of field declarations Incomplete bool // true if (source) fields are missing in the Fields list }
StructType ...
type SwitchStmt ¶
type SwitchStmt struct { Switch Token // "switch" keyword Init Stmt // initialization statement; or nil Tag Expr // tag expression; or nil Body BlockStmt // CaseClauses only }
SwitchStmt ...
type TypeAssertExpr ¶
type TypeAssertExpr struct { X Expr // expression Lparen Token // "("; added in Go 1.2 Type Expr // asserted type; nil means type switch X.(type) Rparen Token // ")"; added in Go 1.2 }
TypeAssertExpr ...
type TypeSpec ¶
type TypeSpec struct { Doc *CommentGroup // associated documentation; or nil Name Ident // type name Assign Token // '=', if any; added in Go 1.9 Type Expr // Ident, ParenExpr, SelectorExpr, StarExpr, or any of the XxxTypes Comment *CommentGroup // line comments; or nil }
TypeSpec ...
type TypeSwitchStmt ¶
type TypeSwitchStmt struct { Switch Token // "switch" keyword Init Stmt // initialization statement; or nil Assign Stmt // x := y.(type) or y.(type) Body BlockStmt // CaseClauses only }
TypeSwitchStmt ...
func TypeSwitch ¶
func TypeSwitch(init Stmt, x string, y Expr, body ...Stmt) *TypeSwitchStmt
TypeSwitch creates a TypeSwitchStmt.
type UnaryExpr ¶
UnaryExpr ...
type ValueSpec ¶
type ValueSpec struct { Doc *CommentGroup // associated documentation; or nil Names []Ident // value names (len(Names) > 0) Type Expr // value type; or nil Values []Expr // initial values; or nil Comment *CommentGroup // line comments; or nil }
ValueSpec ...