Versions in this module Expand all Collapse all v0 v0.4.7 Apr 3, 2023 v0.4.6 Oct 18, 2022 v0.4.5 Oct 17, 2022 v0.4.4 Sep 23, 2022 v0.4.3 Jan 12, 2022 v0.4.2 Nov 29, 2021 v0.4.1 Nov 29, 2021 Changes in this version + var ErrIsExpression = errors.New("not a concrete label") + func AddComment(n Node, cg *CommentGroup) + func Embed(x Expr) *embedding + func IsValidIdent(ident string) bool + func LabelName(l Label) (name string, isIdent bool, err error) + func Name(n Node) string + func ParseIdent(n *Ident) (string, error) + func QuoteIdent(ident string) (string, error) + func SetComments(n Node, cgs []*CommentGroup) + func SetPos(n Node, p token.Pos) + func SetRelPos(n Node, p token.RelPos) + func Walk(node Node, before func(Node) bool, after func(Node)) + type Alias struct + Equal token.Pos + Expr Expr + Ident *Ident + func (a *Alias) End() token.Pos + func (a *Alias) Pos() token.Pos + func (c *Alias) AddComment(cg *CommentGroup) + func (c *Alias) Comments() []*CommentGroup + func (c *Alias) SetComments(cgs []*CommentGroup) + type Attribute struct + At token.Pos + Text string + func (a *Attribute) End() token.Pos + func (a *Attribute) Pos() token.Pos + func (a *Attribute) Split() (key, body string) + func (c *Attribute) AddComment(cg *CommentGroup) + func (c *Attribute) Comments() []*CommentGroup + func (c *Attribute) SetComments(cgs []*CommentGroup) + type BadDecl struct + From token.Pos + To token.Pos + func (c *BadDecl) AddComment(cg *CommentGroup) + func (c *BadDecl) Comments() []*CommentGroup + func (c *BadDecl) SetComments(cgs []*CommentGroup) + func (d *BadDecl) End() token.Pos + func (d *BadDecl) Pos() token.Pos + type BadExpr struct + From token.Pos + To token.Pos + func (c *BadExpr) AddComment(cg *CommentGroup) + func (c *BadExpr) Comments() []*CommentGroup + func (c *BadExpr) SetComments(cgs []*CommentGroup) + func (x *BadExpr) End() token.Pos + func (x *BadExpr) Pos() token.Pos + type BasicLit struct + Kind token.Token + Value string + ValuePos token.Pos + func NewBool(b bool) *BasicLit + func NewLit(tok token.Token, s string) *BasicLit + func NewNull() *BasicLit + func NewString(str string) *BasicLit + func (c *BasicLit) AddComment(cg *CommentGroup) + func (c *BasicLit) Comments() []*CommentGroup + func (c *BasicLit) SetComments(cgs []*CommentGroup) + func (x *BasicLit) End() token.Pos + func (x *BasicLit) Pos() token.Pos + type BinaryExpr struct + Op token.Token + OpPos token.Pos + X Expr + Y Expr + func (c *BinaryExpr) AddComment(cg *CommentGroup) + func (c *BinaryExpr) Comments() []*CommentGroup + func (c *BinaryExpr) SetComments(cgs []*CommentGroup) + func (x *BinaryExpr) End() token.Pos + func (x *BinaryExpr) Pos() token.Pos + type BottomLit struct + Bottom token.Pos + func (c *BottomLit) AddComment(cg *CommentGroup) + func (c *BottomLit) Comments() []*CommentGroup + func (c *BottomLit) SetComments(cgs []*CommentGroup) + func (x *BottomLit) End() token.Pos + func (x *BottomLit) Pos() token.Pos + type CallExpr struct + Args []Expr + Fun Expr + Lparen token.Pos + Rparen token.Pos + func NewCall(fun Expr, args ...Expr) *CallExpr + func (c *CallExpr) AddComment(cg *CommentGroup) + func (c *CallExpr) Comments() []*CommentGroup + func (c *CallExpr) SetComments(cgs []*CommentGroup) + func (x *CallExpr) End() token.Pos + func (x *CallExpr) Pos() token.Pos + type Clause interface + type Comment struct + Slash token.Pos + Text string + func (c *Comment) AddComment(*CommentGroup) + func (c *Comment) Comments() []*CommentGroup + func (c *Comment) End() token.Pos + func (c *Comment) Pos() token.Pos + type CommentGroup struct + Doc bool + Line bool + List []*Comment + Position int8 + func Comments(n Node) []*CommentGroup + func (g *CommentGroup) AddComment(*CommentGroup) + func (g *CommentGroup) Comments() []*CommentGroup + func (g *CommentGroup) End() token.Pos + func (g *CommentGroup) Pos() token.Pos + func (g *CommentGroup) Text() string + type Comprehension struct + Clauses []Clause + Value Expr + func (c *Comprehension) AddComment(cg *CommentGroup) + func (c *Comprehension) Comments() []*CommentGroup + func (c *Comprehension) SetComments(cgs []*CommentGroup) + func (x *Comprehension) End() token.Pos + func (x *Comprehension) Pos() token.Pos + type Decl interface + type Ellipsis struct + Ellipsis token.Pos + Type Expr + func (c *Ellipsis) AddComment(cg *CommentGroup) + func (c *Ellipsis) Comments() []*CommentGroup + func (c *Ellipsis) SetComments(cgs []*CommentGroup) + func (x *Ellipsis) End() token.Pos + func (x *Ellipsis) Pos() token.Pos + type EmbedDecl struct + Expr Expr + func (c *EmbedDecl) AddComment(cg *CommentGroup) + func (c *EmbedDecl) Comments() []*CommentGroup + func (c *EmbedDecl) SetComments(cgs []*CommentGroup) + func (d *EmbedDecl) End() token.Pos + func (d *EmbedDecl) Pos() token.Pos + type Expr interface + func NewBinExpr(op token.Token, operands ...Expr) Expr + func NewSel(x Expr, sel ...string) Expr + type Field struct + Attrs []*Attribute + Label Label + Optional token.Pos + Token token.Token + TokenPos token.Pos + Value Expr + func (c *Field) AddComment(cg *CommentGroup) + func (c *Field) Comments() []*CommentGroup + func (c *Field) SetComments(cgs []*CommentGroup) + func (d *Field) End() token.Pos + func (d *Field) Pos() token.Pos + type File struct + Decls []Decl + Filename string + Imports []*ImportSpec + Unresolved []*Ident + func (c *File) AddComment(cg *CommentGroup) + func (c *File) Comments() []*CommentGroup + func (c *File) SetComments(cgs []*CommentGroup) + func (f *File) End() token.Pos + func (f *File) PackageName() string + func (f *File) Pos() token.Pos + func (f *File) Preamble() []Decl + func (f *File) VisitImports(fn func(d *ImportDecl)) + type ForClause struct + Colon token.Pos + For token.Pos + In token.Pos + Key *Ident + Source Expr + Value *Ident + func (c *ForClause) AddComment(cg *CommentGroup) + func (c *ForClause) Comments() []*CommentGroup + func (c *ForClause) SetComments(cgs []*CommentGroup) + func (x *ForClause) End() token.Pos + func (x *ForClause) Pos() token.Pos + type Ident struct + Name string + NamePos token.Pos + Node Node + Scope Node + func NewIdent(name string) *Ident + func (c *Ident) AddComment(cg *CommentGroup) + func (c *Ident) Comments() []*CommentGroup + func (c *Ident) SetComments(cgs []*CommentGroup) + func (id *Ident) String() string + func (x *Ident) End() token.Pos + func (x *Ident) Pos() token.Pos + type IfClause struct + Condition Expr + If token.Pos + func (c *IfClause) AddComment(cg *CommentGroup) + func (c *IfClause) Comments() []*CommentGroup + func (c *IfClause) SetComments(cgs []*CommentGroup) + func (x *IfClause) End() token.Pos + func (x *IfClause) Pos() token.Pos + type ImportDecl struct + Import token.Pos + Lparen token.Pos + Rparen token.Pos + Specs []*ImportSpec + func (c *ImportDecl) AddComment(cg *CommentGroup) + func (c *ImportDecl) Comments() []*CommentGroup + func (c *ImportDecl) SetComments(cgs []*CommentGroup) + func (d *ImportDecl) End() token.Pos + func (d *ImportDecl) Pos() token.Pos + type ImportSpec struct + EndPos token.Pos + Name *Ident + Path *BasicLit + func NewImport(name *Ident, importPath string) *ImportSpec + func (c *ImportSpec) AddComment(cg *CommentGroup) + func (c *ImportSpec) Comments() []*CommentGroup + func (c *ImportSpec) SetComments(cgs []*CommentGroup) + func (s *ImportSpec) End() token.Pos + func (s *ImportSpec) Pos() token.Pos + type IndexExpr struct + Index Expr + Lbrack token.Pos + Rbrack token.Pos + X Expr + func (c *IndexExpr) AddComment(cg *CommentGroup) + func (c *IndexExpr) Comments() []*CommentGroup + func (c *IndexExpr) SetComments(cgs []*CommentGroup) + func (x *IndexExpr) End() token.Pos + func (x *IndexExpr) Pos() token.Pos + type Interpolation struct + Elts []Expr + func (c *Interpolation) AddComment(cg *CommentGroup) + func (c *Interpolation) Comments() []*CommentGroup + func (c *Interpolation) SetComments(cgs []*CommentGroup) + func (x *Interpolation) End() token.Pos + func (x *Interpolation) Pos() token.Pos + type Label interface + type LetClause struct + Equal token.Pos + Expr Expr + Ident *Ident + Let token.Pos + func (c *LetClause) AddComment(cg *CommentGroup) + func (c *LetClause) Comments() []*CommentGroup + func (c *LetClause) SetComments(cgs []*CommentGroup) + func (x *LetClause) End() token.Pos + func (x *LetClause) Pos() token.Pos + type ListLit struct + Elts []Expr + Lbrack token.Pos + Rbrack token.Pos + func NewList(exprs ...Expr) *ListLit + func (c *ListLit) AddComment(cg *CommentGroup) + func (c *ListLit) Comments() []*CommentGroup + func (c *ListLit) SetComments(cgs []*CommentGroup) + func (x *ListLit) End() token.Pos + func (x *ListLit) Pos() token.Pos + type Node interface + AddComment func(*CommentGroup) + Comments func() []*CommentGroup + End func() token.Pos + Pos func() token.Pos + type Package struct + Name *Ident + PackagePos token.Pos + func (c *Package) AddComment(cg *CommentGroup) + func (c *Package) Comments() []*CommentGroup + func (c *Package) SetComments(cgs []*CommentGroup) + func (p *Package) End() token.Pos + func (p *Package) Pos() token.Pos + type ParenExpr struct + Lparen token.Pos + Rparen token.Pos + X Expr + func (c *ParenExpr) AddComment(cg *CommentGroup) + func (c *ParenExpr) Comments() []*CommentGroup + func (c *ParenExpr) SetComments(cgs []*CommentGroup) + func (x *ParenExpr) End() token.Pos + func (x *ParenExpr) Pos() token.Pos + type SelectorExpr struct + Sel Label + X Expr + func (c *SelectorExpr) AddComment(cg *CommentGroup) + func (c *SelectorExpr) Comments() []*CommentGroup + func (c *SelectorExpr) SetComments(cgs []*CommentGroup) + func (x *SelectorExpr) End() token.Pos + func (x *SelectorExpr) Pos() token.Pos + type SliceExpr struct + High Expr + Lbrack token.Pos + Low Expr + Rbrack token.Pos + X Expr + func (c *SliceExpr) AddComment(cg *CommentGroup) + func (c *SliceExpr) Comments() []*CommentGroup + func (c *SliceExpr) SetComments(cgs []*CommentGroup) + func (x *SliceExpr) End() token.Pos + func (x *SliceExpr) Pos() token.Pos + type Spec interface + type StructLit struct + Elts []Decl + Lbrace token.Pos + Rbrace token.Pos + func NewStruct(fields ...interface{}) *StructLit + func (c *StructLit) AddComment(cg *CommentGroup) + func (c *StructLit) Comments() []*CommentGroup + func (c *StructLit) SetComments(cgs []*CommentGroup) + func (x *StructLit) End() token.Pos + func (x *StructLit) Pos() token.Pos + type UnaryExpr struct + Op token.Token + OpPos token.Pos + X Expr + func (c *UnaryExpr) AddComment(cg *CommentGroup) + func (c *UnaryExpr) Comments() []*CommentGroup + func (c *UnaryExpr) SetComments(cgs []*CommentGroup) + func (x *UnaryExpr) End() token.Pos + func (x *UnaryExpr) Pos() token.Pos