ast

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 24, 2023 License: MIT Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArrayType

type ArrayType struct {
	Len    Expr
	Elt    Expr
	Lbrack token.Pos
}

Type nodes

func (*ArrayType) Pos added in v0.1.0

func (x *ArrayType) Pos() token.Pos

type AssignStmt

type AssignStmt struct {
	Lhs     []Expr
	TokPos  token.Pos
	Tok     token.Token
	Rhs     []Expr
	IsRange bool
}

func (*AssignStmt) Pos added in v0.1.0

func (s *AssignStmt) Pos() token.Pos

type BasicLit

type BasicLit struct {
	Kind     token.Token // token.INT, token.CHAR, or token.STRING
	Value    string
	ValuePos token.Pos
}

func (*BasicLit) Pos added in v0.1.0

func (x *BasicLit) Pos() token.Pos

type BinaryExpr

type BinaryExpr struct {
	X  Expr
	Y  Expr
	Op token.Token
}

func (*BinaryExpr) Pos added in v0.1.0

func (x *BinaryExpr) Pos() token.Pos

type BlockStmt

type BlockStmt struct {
	Lbrace token.Pos
	List   []Stmt
}

func (*BlockStmt) Pos added in v0.1.0

func (s *BlockStmt) Pos() token.Pos

type BranchStmt

type BranchStmt struct {
	TokPos token.Pos
	Tok    token.Token
	Label  string
}

func (*BranchStmt) Pos added in v0.1.0

func (s *BranchStmt) Pos() token.Pos

type CallExpr

type CallExpr struct {
	Fun      Expr   // function expression
	Args     []Expr // function arguments; or nil
	Ellipsis token.Pos
}

func (*CallExpr) Pos added in v0.1.0

func (x *CallExpr) Pos() token.Pos

type CaseClause

type CaseClause struct {
	Case token.Pos
	List []Expr
	Body []Stmt
}

func (*CaseClause) Pos added in v0.1.0

func (s *CaseClause) Pos() token.Pos

type CompositeLit

type CompositeLit struct {
	Type   Expr
	Elts   []Expr
	Lbrace token.Pos
}

func (*CompositeLit) Pos added in v0.1.0

func (x *CompositeLit) Pos() token.Pos

type Decl

type Decl interface {
}

Pseudo interface for *ast.Decl *GenDecl | *FuncDecl

type DeclStmt

type DeclStmt struct {
	Decl Decl
}

func (*DeclStmt) Pos added in v0.1.0

func (s *DeclStmt) Pos() token.Pos

type Ellipsis

type Ellipsis struct {
	Elt      Expr
	Ellipsis token.Pos
}

func (*Ellipsis) Pos added in v0.1.0

func (x *Ellipsis) Pos() token.Pos

type Expr

type Expr interface {
}

type ExprStmt

type ExprStmt struct {
	X Expr
}

func (*ExprStmt) Pos added in v0.1.0

func (s *ExprStmt) Pos() token.Pos

type Field

type Field struct {
	Names  []*Ident
	Type   Expr
	Offset int
}

func (*Field) Pos added in v0.1.0

func (x *Field) Pos() token.Pos

type FieldList

type FieldList struct {
	Opening token.Pos
	List    []*Field
}

type File

type File struct {
	Name       *Ident // package name that is in the package clause
	Package    token.Pos
	FileStart  token.Pos
	FileEnd    token.Pos
	Imports    []*ImportSpec
	Decls      []Decl
	Unresolved []*Ident
	Scope      *Scope
}

type ForStmt

type ForStmt struct {
	For  token.Pos
	Init Stmt
	Cond Expr
	Post Stmt
	Body *BlockStmt
}

func (*ForStmt) Pos added in v0.1.0

func (s *ForStmt) Pos() token.Pos

type FuncDecl

type FuncDecl struct {
	Recv *FieldList
	Name *Ident
	Type *FuncType
	Body *BlockStmt
}

func (*FuncDecl) Pos added in v0.1.0

func (x *FuncDecl) Pos() token.Pos

type FuncType

type FuncType struct {
	Func    token.Pos
	Params  *FieldList
	Results *FieldList // this can be nil: e.g. func f() {}
}

func (*FuncType) Pos added in v0.1.0

func (x *FuncType) Pos() token.Pos

type GenDecl

type GenDecl struct {
	TokPos token.Pos
	Specs  []Spec
}

func (*GenDecl) Pos added in v0.1.0

func (x *GenDecl) Pos() token.Pos

type GoStmt added in v0.0.4

type GoStmt struct {
	Go   token.Pos
	Call *CallExpr
}

func (*GoStmt) Pos added in v0.1.0

func (s *GoStmt) Pos() token.Pos

type Ident

type Ident struct {
	NamePos token.Pos // identifier position
	Name    string
	Obj     *Object
}

func (*Ident) Pos added in v0.1.0

func (x *Ident) Pos() token.Pos

type IfStmt

type IfStmt struct {
	If   token.Pos
	Init Stmt
	Cond Expr
	Body *BlockStmt
	Else Stmt
}

func (*IfStmt) Pos added in v0.1.0

func (s *IfStmt) Pos() token.Pos

type ImportSpec

type ImportSpec struct {
	Path *BasicLit
}

func (*ImportSpec) Pos added in v0.1.0

func (s *ImportSpec) Pos() token.Pos

type IncDecStmt

type IncDecStmt struct {
	X      Expr
	TokPos token.Pos
	Tok    token.Token
}

func (*IncDecStmt) Pos added in v0.1.0

func (s *IncDecStmt) Pos() token.Pos

type IndexExpr

type IndexExpr struct {
	X     Expr
	Index Expr
}

func (*IndexExpr) Pos added in v0.1.0

func (x *IndexExpr) Pos() token.Pos

type InterfaceType

type InterfaceType struct {
	Methods   []string
	Interface token.Pos
}

func (*InterfaceType) Pos added in v0.1.0

func (x *InterfaceType) Pos() token.Pos

type KeyValueExpr

type KeyValueExpr struct {
	Key   Expr
	Value Expr
}

func (*KeyValueExpr) Pos added in v0.1.0

func (x *KeyValueExpr) Pos() token.Pos

type MapType

type MapType struct {
	Key   Expr
	Value Expr
	Map   token.Pos
}

func (*MapType) Pos added in v0.1.0

func (x *MapType) Pos() token.Pos

type ObjKind

type ObjKind string
var Con ObjKind = "Con"
var Fun ObjKind = "Fun"
var Pkg ObjKind = "Pkg"
var Typ ObjKind = "Typ"
var Var ObjKind = "Var"

func (ObjKind) String

func (ok ObjKind) String() string

type Object

type Object struct {
	Kind ObjKind
	Name string
	Decl interface{} // *ValueSpec|*FuncDecl|*TypeSpec|*Field|*AssignStmt
	Data interface{}
}

type ParenExpr

type ParenExpr struct {
	X      Expr
	Lparen token.Pos
}

func (*ParenExpr) Pos added in v0.1.0

func (x *ParenExpr) Pos() token.Pos

type RangeStmt

type RangeStmt struct {
	For   token.Pos
	Key   Expr
	Value Expr
	X     Expr
	Body  *BlockStmt
	Tok   token.Token
}

func (*RangeStmt) Pos added in v0.1.0

func (s *RangeStmt) Pos() token.Pos

type ReturnStmt

type ReturnStmt struct {
	Return  token.Pos
	Results []Expr
}

func (*ReturnStmt) Pos added in v0.1.0

func (s *ReturnStmt) Pos() token.Pos

type Scope

type Scope struct {
	Outer   *Scope
	Objects map[string]*Object
}

func NewScope

func NewScope(outer *Scope) *Scope

func (*Scope) Insert

func (s *Scope) Insert(obj *Object)

func (*Scope) Lookup

func (s *Scope) Lookup(name string) *Object

type SelectorExpr

type SelectorExpr struct {
	X   Expr
	Sel *Ident
}

func (*SelectorExpr) Pos added in v0.1.0

func (x *SelectorExpr) Pos() token.Pos

type Signature

type Signature struct {
	Params   *FieldList
	Results  *FieldList
	StartPos token.Pos
}

type SliceExpr

type SliceExpr struct {
	X      Expr
	Low    Expr
	High   Expr
	Max    Expr
	Slice3 bool
}

func (*SliceExpr) Pos added in v0.1.0

func (x *SliceExpr) Pos() token.Pos

type Spec

type Spec interface{}

type StarExpr

type StarExpr struct {
	X    Expr
	Star token.Pos
}

func (*StarExpr) Pos added in v0.1.0

func (x *StarExpr) Pos() token.Pos

type Stmt

type Stmt interface{}

type StructType

type StructType struct {
	Fields *FieldList
	Struct token.Pos
}

func (*StructType) Pos added in v0.1.0

func (x *StructType) Pos() token.Pos

type SwitchStmt

type SwitchStmt struct {
	Switch token.Pos
	Init   Expr
	Tag    Expr
	Body   *BlockStmt
}

func (*SwitchStmt) Pos added in v0.1.0

func (s *SwitchStmt) Pos() token.Pos

type TypeAssertExpr

type TypeAssertExpr struct {
	X    Expr
	Type Expr // asserted type; nil means type switch X.(type)
}

func (*TypeAssertExpr) Pos added in v0.1.0

func (x *TypeAssertExpr) Pos() token.Pos

type TypeSpec

type TypeSpec struct {
	Name     *Ident
	IsAssign bool // isAlias
	Type     Expr
}

func (*TypeSpec) Pos added in v0.1.0

func (s *TypeSpec) Pos() token.Pos

type TypeSwitchStmt

type TypeSwitchStmt struct {
	Switch token.Pos
	Assign Stmt
	Body   *BlockStmt
}

func (*TypeSwitchStmt) Pos added in v0.1.0

func (s *TypeSwitchStmt) Pos() token.Pos

type UnaryExpr

type UnaryExpr struct {
	X     Expr
	Op    token.Token
	OpPos token.Pos
}

func (*UnaryExpr) Pos added in v0.1.0

func (x *UnaryExpr) Pos() token.Pos

type ValueSpec

type ValueSpec struct {
	Names  []*Ident
	Type   Expr
	Values []Expr
}

func (*ValueSpec) Pos added in v0.1.0

func (s *ValueSpec) Pos() token.Pos

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL