gc

package module
v3.0.0-...-f0dba7c Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: BSD-3-Clause Imports: 25 Imported by: 3

Documentation

Index

Constants

View Source
const (
	// Special tokens
	ILLEGAL = token.ILLEGAL
	EOF     = token.EOF
	COMMENT = token.COMMENT

	// Identifiers and basic type literals
	// (these tokens stand for classes of literals)
	IDENT  = token.IDENT  // main
	INT    = token.INT    // 12345
	FLOAT  = token.FLOAT  // 123.45
	IMAG   = token.IMAG   // 123.45i
	CHAR   = token.CHAR   // 'a'
	STRING = token.STRING // "abc"

	// Operators and delimiters
	ADD = token.ADD // +
	SUB = token.SUB // -
	MUL = token.MUL // *
	QUO = token.QUO // /
	REM = token.REM // %

	AND     = token.AND     // &
	OR      = token.OR      // |
	XOR     = token.XOR     // ^
	SHL     = token.SHL     // <<
	SHR     = token.SHR     // >>
	AND_NOT = token.AND_NOT // &^

	ADD_ASSIGN = token.ADD_ASSIGN // +=
	SUB_ASSIGN = token.SUB_ASSIGN // -=
	MUL_ASSIGN = token.MUL_ASSIGN // *=
	QUO_ASSIGN = token.QUO_ASSIGN // /=
	REM_ASSIGN = token.REM_ASSIGN // %=

	AND_ASSIGN     = token.AND_ASSIGN     // &=
	OR_ASSIGN      = token.OR_ASSIGN      // |=
	XOR_ASSIGN     = token.XOR_ASSIGN     // ^=
	SHL_ASSIGN     = token.SHL_ASSIGN     // <<=
	SHR_ASSIGN     = token.SHR_ASSIGN     // >>=
	AND_NOT_ASSIGN = token.AND_NOT_ASSIGN // &^=

	LAND  = token.LAND  // &&
	LOR   = token.LOR   // ||
	ARROW = token.ARROW // <-
	INC   = token.INC   // ++
	DEC   = token.DEC   // --

	EQL    = token.EQL    // ==
	LSS    = token.LSS    // <
	GTR    = token.GTR    // >
	ASSIGN = token.ASSIGN // =
	NOT    = token.NOT    // !

	NEQ      = token.NEQ      // !=
	LEQ      = token.LEQ      // <=
	GEQ      = token.GEQ      // >=
	DEFINE   = token.DEFINE   // :=
	ELLIPSIS = token.ELLIPSIS // ...

	LPAREN = token.LPAREN // (
	LBRACK = token.LBRACK // [
	LBRACE = token.LBRACE // {
	COMMA  = token.COMMA  // ,
	PERIOD = token.PERIOD // .

	RPAREN    = token.RPAREN    // )
	RBRACK    = token.RBRACK    // ]
	RBRACE    = token.RBRACE    // }
	SEMICOLON = token.SEMICOLON // ;
	COLON     = token.COLON     // :

	// Keywords
	BREAK    = token.BREAK
	CASE     = token.CASE
	CHAN     = token.CHAN
	CONST    = token.CONST
	CONTINUE = token.CONTINUE

	DEFAULT     = token.DEFAULT
	DEFER       = token.DEFER
	ELSE        = token.ELSE
	FALLTHROUGH = token.FALLTHROUGH
	FOR         = token.FOR

	FUNC   = token.FUNC
	GO     = token.GO
	GOTO   = token.GOTO
	IF     = token.IF
	IMPORT = token.IMPORT

	INTERFACE = token.INTERFACE
	MAP       = token.MAP
	PACKAGE   = token.PACKAGE
	RANGE     = token.RANGE
	RETURN    = token.RETURN

	SELECT = token.SELECT
	STRUCT = token.STRUCT
	SWITCH = token.SWITCH
	TYPE   = token.TYPE
	VAR    = token.VAR

	// additional tokens, handled in an ad-hoc manner
	TILDE = token.TILDE
)

The list of tokens.

Variables

View Source
var (
	Invalid = &InvalidType{}
)

Functions

func DefaultFileFilter

func DefaultFileFilter(cfg *Config, importPath string, matchedFSPaths []string, withTestFiles bool) (pkgFiles []string, err error)

func NodeSource

func NodeSource(n Node, full bool, kill map[Node]struct{}) string

NodeSource returns the source text of 'n'. If 'full' is false, every non empty separator is replaced by a single space. Nodes found in 'kill' are skipped, transitively.

Types

type ABI

type ABI struct {
	ByteOrder binary.ByteOrder

	Types map[Kind]ABIType
	// contains filtered or unexported fields
}

ABI describes selected parts of the Application Binary Interface.

func NewABI

func NewABI(os, arch string) (*ABI, error)

NewABI creates an ABI based on the os+arch pair.

type ABIType

type ABIType struct {
	Size       int64
	Align      int64
	FieldAlign int64
}

type AST

type AST struct {
	EOF        Token
	FileScope  *Scope
	SourceFile *SourceFileNode
	// contains filtered or unexported fields
}

func ParseFile

func ParseFile(path string, b []byte) (*AST, error)

ParseFile parses 'b', assuming it comes from 'path' and returns an AST or error, if any.

func (*AST) Position

func (n *AST) Position() (r token.Position)

func (*AST) Source

func (n *AST) Source(full bool) string

type AliasDeclNode

type AliasDeclNode struct {
	IDENT    Token
	ASSIGN   Token
	TypeNode Type
	// contains filtered or unexported fields
}

AliasDeclNode represents the production

AliasDecl = identifier "=" Type .

func (*AliasDeclNode) Position

func (n *AliasDeclNode) Position() (r token.Position)

Position implements Node.

func (*AliasDeclNode) Source

func (n *AliasDeclNode) Source(full bool) string

Source implements Node.

func (*AliasDeclNode) Visible

func (n *AliasDeclNode) Visible() int

Visible reports the first token index where n is visible (in scope). Applies to local scopes only.

type Arguments1Node

type Arguments1Node struct {
	LPAREN     Token
	Expression Expression
	TypeNode   Type
	COMMA      Token
	ELLIPSIS   Token
	COMMA2     Token
	RPAREN     Token
}

Arguments1Node represents the production

Arguments = "(" [ ( Expression | Type [ "," Expression ] ) [ "..." ] [ "," ] ] ")" .

func (*Arguments1Node) Position

func (n *Arguments1Node) Position() (r token.Position)

Position implements Node.

func (*Arguments1Node) Source

func (n *Arguments1Node) Source(full bool) string

Source implements Node.

type Arguments2Node

type Arguments2Node struct {
	LPAREN         Token
	ExpressionList *ExpressionListNode
	RPAREN         Token
}

Arguments2Node represents the production

Arguments = "(" ExpressionList ")" .

func (*Arguments2Node) Position

func (n *Arguments2Node) Position() (r token.Position)

Position implements Node.

func (*Arguments2Node) Source

func (n *Arguments2Node) Source(full bool) string

Source implements Node.

type Arguments3Node

type Arguments3Node struct {
	LPAREN         Token
	ExpressionList *ExpressionListNode
	TypeNode       Type
	COMMA          Token
	ELLIPSIS       Token
	COMMA2         Token
	RPAREN         Token
}

Arguments3Node represents the production

Arguments = "(" [ ( ExpressionList | Type [ "," ExpressionList ] ) [ "..." ] [ "," ] ] ")" .

func (*Arguments3Node) Position

func (n *Arguments3Node) Position() (r token.Position)

Position implements Node.

func (*Arguments3Node) Source

func (n *Arguments3Node) Source(full bool) string

Source implements Node.

type ArgumentsNode

type ArgumentsNode struct {
	LPAREN     Token
	Expression Expression
	RPAREN     Token
}

ArgumentsNode represents the production

Arguments = "(" [ Expression ] ")" .

func (*ArgumentsNode) Position

func (n *ArgumentsNode) Position() (r token.Position)

Position implements Node.

func (*ArgumentsNode) Source

func (n *ArgumentsNode) Source(full bool) string

Source implements Node.

type ArrayLiteralTypeNode

type ArrayLiteralTypeNode struct {
	LBRACK      Token
	ELLIPSIS    Token
	RBRACK      Token
	ElementType Node
}

ArrayLiteralTypeNode represents the production

ArrayLiteralType = StructType | ArrayType | "[" "..." "]" ElementType | SliceType | MapType .

func (*ArrayLiteralTypeNode) Position

func (n *ArrayLiteralTypeNode) Position() (r token.Position)

Position implements Node.

func (*ArrayLiteralTypeNode) Source

func (n *ArrayLiteralTypeNode) Source(full bool) string

Source implements Node.

type ArrayTypeNode

type ArrayTypeNode struct {
	LBRACK      Token
	ArrayLength Expression
	RBRACK      Token
	ElementType Type
}

ArrayTypeNode represents the production

ArrayType = "[" ArrayLength "]" ElementType .

func (*ArrayTypeNode) Align

func (n *ArrayTypeNode) Align() int

func (*ArrayTypeNode) FieldAlign

func (n *ArrayTypeNode) FieldAlign() int

func (*ArrayTypeNode) Kind

func (n *ArrayTypeNode) Kind() Kind

func (*ArrayTypeNode) Position

func (n *ArrayTypeNode) Position() (r token.Position)

Position implements Node.

func (*ArrayTypeNode) Size

func (n *ArrayTypeNode) Size() int64

func (*ArrayTypeNode) Source

func (n *ArrayTypeNode) Source(full bool) string

Source implements Node.

func (*ArrayTypeNode) String

func (n *ArrayTypeNode) String() string

type AssignmentNode

type AssignmentNode struct {
	ExpressionList  *ExpressionListNode
	Op              Token
	ExpressionList2 *ExpressionListNode
}

AssignmentNode represents the production

Assignment = ExpressionList ( "=" | "+=" | "-=" | "|=" | "^=" | "*=" | "/=" | "%=" | "<<=" | ">>=" | "&=" | "&^=" ) ExpressionList .

func (*AssignmentNode) Position

func (n *AssignmentNode) Position() (r token.Position)

Position implements Node.

func (*AssignmentNode) Source

func (n *AssignmentNode) Source(full bool) string

Source implements Node.

type BasicLitNode

type BasicLitNode struct {
	Token
	// contains filtered or unexported fields
}

BasicLitNode represents the production

BasicLit = int_lit | float_lit | imaginary_lit | rune_lit | string_lit .

func (*BasicLitNode) Type

func (n *BasicLitNode) Type() Type

func (*BasicLitNode) Value

func (n *BasicLitNode) Value() constant.Value

type BinaryExpressionNode

type BinaryExpressionNode struct {
	LHS Expression
	Op  Token
	RHS Expression
	// contains filtered or unexported fields
}

func (*BinaryExpressionNode) Position

func (n *BinaryExpressionNode) Position() (r token.Position)

Position implements Node.

func (*BinaryExpressionNode) Source

func (n *BinaryExpressionNode) Source(full bool) string

Source implements Node.

func (*BinaryExpressionNode) Type

func (n *BinaryExpressionNode) Type() Type

func (*BinaryExpressionNode) Value

func (n *BinaryExpressionNode) Value() constant.Value

type BlockNode

type BlockNode struct {
	LBRACE        Token
	StatementList *StatementListNode
	RBRACE        Token
}

BlockNode represents the production

Block = "{" StatementList "}" .

func (*BlockNode) Position

func (n *BlockNode) Position() (r token.Position)

Position implements Node.

func (*BlockNode) Source

func (n *BlockNode) Source(full bool) string

Source implements Node.

type BreakStmtNode

type BreakStmtNode struct {
	BREAK Token
	Label *LabelNode
}

BreakStmtNode represents the production

BreakStmt = "break" [ Label ] .

func (*BreakStmtNode) Position

func (n *BreakStmtNode) Position() (r token.Position)

Position implements Node.

func (*BreakStmtNode) Source

func (n *BreakStmtNode) Source(full bool) string

Source implements Node.

type Cache

type Cache struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func MustNewCache

func MustNewCache(size int) *Cache

func NewCache

func NewCache(size int) (*Cache, error)

type ChanDir

type ChanDir int

ChanDir represents a channel direction.

const (
	SendRecv ChanDir = iota
	SendOnly
	RecvOnly
)

Values of type ChanDir.

func (ChanDir) String

func (i ChanDir) String() string

type ChannelTypeNode

type ChannelTypeNode struct {
	CHAN        Token
	ARROW       Token
	ElementType Type
}

ChannelTypeNode represents the production

ChannelType = ( "chan" "<-" | "chan" | "<-" "chan" ) ElementType .

func (*ChannelTypeNode) Align

func (n *ChannelTypeNode) Align() int

func (*ChannelTypeNode) FieldAlign

func (n *ChannelTypeNode) FieldAlign() int

func (*ChannelTypeNode) Kind

func (n *ChannelTypeNode) Kind() Kind

func (*ChannelTypeNode) Position

func (n *ChannelTypeNode) Position() (r token.Position)

Position implements Node.

func (*ChannelTypeNode) Size

func (n *ChannelTypeNode) Size() int64

func (*ChannelTypeNode) Source

func (n *ChannelTypeNode) Source(full bool) string

Source implements Node.

func (*ChannelTypeNode) String

func (n *ChannelTypeNode) String() string

type CommCaseNode

type CommCaseNode struct {
	CASE     Token
	SendStmt *SendStmtNode
	RecvStmt *RecvStmtNode
	DEFAULT  Token
}

CommCaseNode represents the production

CommCase = "case" ( SendStmt | RecvStmt ) | "default" .

func (*CommCaseNode) Position

func (n *CommCaseNode) Position() (r token.Position)

Position implements Node.

func (*CommCaseNode) Source

func (n *CommCaseNode) Source(full bool) string

Source implements Node.

type CommClauseListNode

type CommClauseListNode struct {
	CommClause *CommClauseNode
	List       *CommClauseListNode
}

CommClauseListNode represents the production

CommClauseListNode = { CommClause } .

func (*CommClauseListNode) Position

func (n *CommClauseListNode) Position() (r token.Position)

Position implements Node.

func (*CommClauseListNode) Source

func (n *CommClauseListNode) Source(full bool) string

Source implements Node.

type CommClauseNode

type CommClauseNode struct {
	CommCase      *CommCaseNode
	COLON         Token
	StatementList *StatementListNode
}

CommClauseNode represents the production

CommClause = CommCase ":" StatementList .

func (*CommClauseNode) Position

func (n *CommClauseNode) Position() (r token.Position)

Position implements Node.

func (*CommClauseNode) Source

func (n *CommClauseNode) Source(full bool) string

Source implements Node.

type CompositeLitNode

type CompositeLitNode struct {
	LiteralType  Node
	LiteralValue *LiteralValueNode
	// contains filtered or unexported fields
}

CompositeLitNode represents the production

CompositeLit = LiteralType LiteralValue .

func (*CompositeLitNode) Position

func (n *CompositeLitNode) Position() (r token.Position)

Position implements Node.

func (*CompositeLitNode) Source

func (n *CompositeLitNode) Source(full bool) string

Source implements Node.

func (*CompositeLitNode) Type

func (n *CompositeLitNode) Type() Type

func (*CompositeLitNode) Value

func (n *CompositeLitNode) Value() constant.Value

type Config

type Config struct {
	// contains filtered or unexported fields
}

Config configures NewPackage

Config instances can be shared, they are not mutated once created and configured.

func NewConfig

func NewConfig(opts ...ConfigOption) (r *Config, err error)

NewConfig returns a newly created config or an error, if any.

func (*Config) DefaultLookup

func (c *Config) DefaultLookup(rel, importPath, version string) (fsPath string, err error)

Default lookup translates import paths, possibly relative to rel, to file system paths.

func (*Config) NewPackage

func (c *Config) NewPackage(dir, importPath, version string, fileFilter FileFilter, withTestFiles bool, typeCheck TypeCheck) (pkg *Package, err error)

NewPackage returns a Package, possibly cached, for importPath@version or an error, if any. The fileFilter argument can be nil, in such case DefaultFileFilter is used, which ignores Files with suffix _test.go unless withTestFiles is true.

NewPackage is safe for concurrent use by multiple goroutines.

type ConfigOption

type ConfigOption func(*Config) error

func ConfigBuildTags

func ConfigBuildTags(tags []string) ConfigOption

ConfigBuildTags configures build tags.

func ConfigCache

func ConfigCache(c *Cache) ConfigOption

ConfigCache configures a cache.

func ConfigEnviron

func ConfigEnviron(env []string) ConfigOption

ConfigEnviron configures environment variables.

func ConfigFS

func ConfigFS(fs fs.FS) ConfigOption

ConfigFS configures a file system used for opening Go source files. If not explicitly configured, a default os.DirFS("/") is used on Unix-like operating systems. On Windows it will be rooted on the volume where runtime.GOROOT() is.

func ConfigLookup

func ConfigLookup(f func(dir, importPath, version string) (fsPath string, err error)) ConfigOption

ConfigLookup configures a lookup function.

type ConstDeclNode

type ConstDeclNode struct {
	CONST     Token
	LPAREN    Token
	ConstSpec Node
	RPAREN    Token
}

ConstDeclNode represents the production

ConstDecl = "const" ( ConstSpec | "(" { ConstSpec ";" } ")" ) .

func (*ConstDeclNode) Position

func (n *ConstDeclNode) Position() (r token.Position)

Position implements Node.

func (*ConstDeclNode) Source

func (n *ConstDeclNode) Source(full bool) string

Source implements Node.

type ConstSpec2Node

type ConstSpec2Node struct {
	IdentifierList *IdentifierListNode
	TypeNode       Type
	ASSIGN         Token
	ExpressionList *ExpressionListNode
	// contains filtered or unexported fields
}

ConstSpec2Node represents the production

ConstSpec = IdentifierList [ [ Type ] "=" ExpressionList ] .

func (*ConstSpec2Node) Position

func (n *ConstSpec2Node) Position() (r token.Position)

Position implements Node.

func (*ConstSpec2Node) Source

func (n *ConstSpec2Node) Source(full bool) string

Source implements Node.

func (*ConstSpec2Node) Visible

func (n *ConstSpec2Node) Visible() int

Visible reports the first token index where n is visible (in scope). Applies to local scopes only.

type ConstSpecListNode

type ConstSpecListNode struct {
	ConstSpec Node
	SEMICOLON Token
	List      *ConstSpecListNode
}

ConstSpecListNode represents the production

ConstSpecListNode = { ConstSpec ";" } .

func (*ConstSpecListNode) Position

func (n *ConstSpecListNode) Position() (r token.Position)

Position implements Node.

func (*ConstSpecListNode) Source

func (n *ConstSpecListNode) Source(full bool) string

Source implements Node.

type ConstSpecNode

type ConstSpecNode struct {
	IDENT      Token
	TypeNode   Type
	ASSIGN     Token
	Expression Expression
	// contains filtered or unexported fields
}

ConstSpecNode represents the production

ConstSpec = Identifier [ [ Type ] "=" Expression ] .

func (*ConstSpecNode) Position

func (n *ConstSpecNode) Position() (r token.Position)

Position implements Node.

func (*ConstSpecNode) Source

func (n *ConstSpecNode) Source(full bool) string

Source implements Node.

func (*ConstSpecNode) Visible

func (n *ConstSpecNode) Visible() int

Visible reports the first token index where n is visible (in scope). Applies to local scopes only.

type ContinueStmtNode

type ContinueStmtNode struct {
	CONTINUE Token
	Label    *LabelNode
}

ContinueStmtNode represents the production

ContinueStmt = "continue" [ Label ] .

func (*ContinueStmtNode) Position

func (n *ContinueStmtNode) Position() (r token.Position)

Position implements Node.

func (*ContinueStmtNode) Source

func (n *ContinueStmtNode) Source(full bool) string

Source implements Node.

type ConversionNode

type ConversionNode struct {
	TypeNode   Type
	LPAREN     Token
	Expression Expression
	COMMA      Token
	RPAREN     Token
	// contains filtered or unexported fields
}

ConversionNode represents the production

Conversion = Type "(" Expression [ "," ] ")" .

func (*ConversionNode) Position

func (n *ConversionNode) Position() (r token.Position)

Position implements Node.

func (*ConversionNode) Source

func (n *ConversionNode) Source(full bool) string

Source implements Node.

func (*ConversionNode) Type

func (n *ConversionNode) Type() Type

func (*ConversionNode) Value

func (n *ConversionNode) Value() constant.Value

type DeferStmtNode

type DeferStmtNode struct {
	DEFER      Token
	Expression Expression
}

DeferStmtNode represents the production

DeferStmt = "defer" Expression .

func (*DeferStmtNode) Position

func (n *DeferStmtNode) Position() (r token.Position)

Position implements Node.

func (*DeferStmtNode) Source

func (n *DeferStmtNode) Source(full bool) string

Source implements Node.

type EmbeddedFieldNode

type EmbeddedFieldNode struct {
	MUL      Token
	TypeName *TypeNameNode
	TypeArgs *TypeArgsNode
}

EmbeddedFieldNode represents the production

EmbeddedField = [ "*" ] TypeName [ TypeArgs ] .

func (*EmbeddedFieldNode) Position

func (n *EmbeddedFieldNode) Position() (r token.Position)

Position implements Node.

func (*EmbeddedFieldNode) Source

func (n *EmbeddedFieldNode) Source(full bool) string

Source implements Node.

type EmptyStmtNode

type EmptyStmtNode struct {
}

EmptyStmtNode represents the production

EmptyStmt =  .

func (*EmptyStmtNode) Position

func (n *EmptyStmtNode) Position() (r token.Position)

Position implements Node.

func (*EmptyStmtNode) Source

func (n *EmptyStmtNode) Source(full bool) string

Source implements Node.

type ErrWithPosition

type ErrWithPosition struct {
	// contains filtered or unexported fields
}

func (ErrWithPosition) String

func (e ErrWithPosition) String() string

type ExprCaseClauseListNode

type ExprCaseClauseListNode struct {
	ExprSwitchCase Node
	COLON          Token
	StatementList  *StatementListNode
	List           *ExprCaseClauseListNode
}

ExprCaseClauseListNode represents the production

ExprCaseClause = ExprSwitchCase ":" StatementList .

func (*ExprCaseClauseListNode) Position

func (n *ExprCaseClauseListNode) Position() (r token.Position)

Position implements Node.

func (*ExprCaseClauseListNode) Source

func (n *ExprCaseClauseListNode) Source(full bool) string

Source implements Node.

type ExprSwitchCase2Node

type ExprSwitchCase2Node struct {
	CASE           Token
	ExpressionList *ExpressionListNode
	DEFAULT        Token
}

ExprSwitchCase2Node represents the production

ExprSwitchCase = "case" ExpressionList | "default" .

func (*ExprSwitchCase2Node) Position

func (n *ExprSwitchCase2Node) Position() (r token.Position)

Position implements Node.

func (*ExprSwitchCase2Node) Source

func (n *ExprSwitchCase2Node) Source(full bool) string

Source implements Node.

type ExprSwitchCaseNode

type ExprSwitchCaseNode struct {
	CASE       Token
	Expression Expression
	DEFAULT    Token
}

ExprSwitchCaseNode represents the production

ExprSwitchCase = "case" ExpressionList | "default" .

func (*ExprSwitchCaseNode) Position

func (n *ExprSwitchCaseNode) Position() (r token.Position)

Position implements Node.

func (*ExprSwitchCaseNode) Source

func (n *ExprSwitchCaseNode) Source(full bool) string

Source implements Node.

type ExprSwitchStmtNode

type ExprSwitchStmtNode struct {
	SWITCH             Token
	Expression         Expression
	LBRACE             Token
	ExprCaseClauseList *ExprCaseClauseListNode
	RBRACE             Token
	SimpleStmt         Node
	SEMICOLON          Token
}

ExprSwitchStmtNode represents the production

ExprSwitchStmt = "switch" [ Expression ] "{" { ExprCaseClause } "}" | "switch" SimpleStmt ";" [ Expression ] "{" { ExprCaseClause } "}" .

func (*ExprSwitchStmtNode) Position

func (n *ExprSwitchStmtNode) Position() (r token.Position)

Position implements Node.

func (*ExprSwitchStmtNode) Source

func (n *ExprSwitchStmtNode) Source(full bool) string

Source implements Node.

type Expression

type Expression interface {
	Node
	// contains filtered or unexported methods
}

type ExpressionListNode

type ExpressionListNode struct {
	COMMA      Token
	Expression Expression
	List       *ExpressionListNode
}

ExpressionListNode represents the production

ExpressionList = Expression { "," Expression } .

func (*ExpressionListNode) Len

func (n *ExpressionListNode) Len() (r int)

Len reports the number of items in n.

func (*ExpressionListNode) Position

func (n *ExpressionListNode) Position() (r token.Position)

Position implements Node.

func (*ExpressionListNode) Source

func (n *ExpressionListNode) Source(full bool) string

Source implements Node.

type FallthroughStmtNode

type FallthroughStmtNode struct {
	FALLTHROUGH Token
}

FallthroughStmtNode represents the production

FallthroughStmt = "fallthrough" .

func (*FallthroughStmtNode) Position

func (n *FallthroughStmtNode) Position() (r token.Position)

Position implements Node.

func (*FallthroughStmtNode) Source

func (n *FallthroughStmtNode) Source(full bool) string

Source implements Node.

type Field

type Field struct {
	Declaration *FieldDeclNode
	Name        string
}

type FieldDeclListNode

type FieldDeclListNode struct {
	FieldDecl *FieldDeclNode
	SEMICOLON Token
	List      *FieldDeclListNode
}

FieldDeclListNode represents the production

FieldDeclListNode = { FieldDecl ";" } .

func (*FieldDeclListNode) Position

func (n *FieldDeclListNode) Position() (r token.Position)

Position implements Node.

func (*FieldDeclListNode) Source

func (n *FieldDeclListNode) Source(full bool) string

Source implements Node.

type FieldDeclNode

type FieldDeclNode struct {
	IdentifierList *IdentifierListNode
	TypeNode       Type
	EmbeddedField  *EmbeddedFieldNode
	Tag            *TagNode
}

FieldDeclNode represents the production

FieldDecl = ( IdentifierList Type | EmbeddedField ) [ Tag ] .

func (*FieldDeclNode) Position

func (n *FieldDeclNode) Position() (r token.Position)

Position implements Node.

func (*FieldDeclNode) Source

func (n *FieldDeclNode) Source(full bool) string

Source implements Node.

type FileFilter

type FileFilter func(cfg *Config, importPath string, matchedFSPaths []string, withTestFiles bool) (pkgFiles []string, err error)

type ForClauseNode

type ForClauseNode struct {
	InitStmt   Node
	SEMICOLON  Token
	Condition  Expression
	SEMICOLON2 Token
	PostStmt   Node
}

ForClauseNode represents the production

ForClause = [ InitStmt ] ";" [ Condition ] ";" [ PostStmt ] .

func (*ForClauseNode) Position

func (n *ForClauseNode) Position() (r token.Position)

Position implements Node.

func (*ForClauseNode) Source

func (n *ForClauseNode) Source(full bool) string

Source implements Node.

type ForStmtNode

type ForStmtNode struct {
	FOR         Token
	ForClause   *ForClauseNode
	RangeClause *RangeClauseNode
	Condition   Expression
	Block       *BlockNode
}

ForStmtNode represents the production

ForStmt = "for" [ ForClause | RangeClause | Condition ] Block .

func (*ForStmtNode) Position

func (n *ForStmtNode) Position() (r token.Position)

Position implements Node.

func (*ForStmtNode) Source

func (n *ForStmtNode) Source(full bool) string

Source implements Node.

type FunctionBodyNode

type FunctionBodyNode struct {
	Block *BlockNode
}

FunctionBodyNode represents the production

FunctionBody = Block .

func (*FunctionBodyNode) Position

func (n *FunctionBodyNode) Position() (r token.Position)

Position implements Node.

func (*FunctionBodyNode) Source

func (n *FunctionBodyNode) Source(full bool) string

Source implements Node.

type FunctionDeclNode

type FunctionDeclNode struct {
	FUNC           Token
	FunctionName   *FunctionNameNode
	TypeParameters *TypeParametersNode
	Signature      *SignatureNode
	FunctionBody   *FunctionBodyNode
	// contains filtered or unexported fields
}

FunctionDeclNode represents the production

FunctionDecl = "func" FunctionName [ TypeParameters ] Signature [ FunctionBody ] .

func (*FunctionDeclNode) Position

func (n *FunctionDeclNode) Position() (r token.Position)

Position implements Node.

func (*FunctionDeclNode) Source

func (n *FunctionDeclNode) Source(full bool) string

Source implements Node.

func (*FunctionDeclNode) Visible

func (n *FunctionDeclNode) Visible() int

Visible reports the first token index where n is visible (in scope). Applies to local scopes only.

type FunctionLitNode

type FunctionLitNode struct {
	FUNC         Token
	Signature    *SignatureNode
	FunctionBody *FunctionBodyNode
}

FunctionLitNode represents the production

FunctionLit = "func" Signature FunctionBody .

func (*FunctionLitNode) Position

func (n *FunctionLitNode) Position() (r token.Position)

Position implements Node.

func (*FunctionLitNode) Source

func (n *FunctionLitNode) Source(full bool) string

Source implements Node.

func (*FunctionLitNode) Type

func (n *FunctionLitNode) Type() Type

func (*FunctionLitNode) Value

func (n *FunctionLitNode) Value() constant.Value

type FunctionNameNode

type FunctionNameNode struct {
	IDENT Token
}

FunctionNameNode represents the production

FunctionName = identifier .

func (*FunctionNameNode) Position

func (n *FunctionNameNode) Position() (r token.Position)

Position implements Node.

func (*FunctionNameNode) Source

func (n *FunctionNameNode) Source(full bool) string

Source implements Node.

type FunctionTypeNode

type FunctionTypeNode struct {
	FUNC      Token
	Signature *SignatureNode
	// contains filtered or unexported fields
}

FunctionTypeNode represents the production

FunctionType = "func" Signature .

func (*FunctionTypeNode) Align

func (n *FunctionTypeNode) Align() int

func (*FunctionTypeNode) FieldAlign

func (n *FunctionTypeNode) FieldAlign() int

func (*FunctionTypeNode) Kind

func (n *FunctionTypeNode) Kind() Kind

func (*FunctionTypeNode) Position

func (n *FunctionTypeNode) Position() (r token.Position)

Position implements Node.

func (*FunctionTypeNode) Size

func (n *FunctionTypeNode) Size() int64

func (*FunctionTypeNode) Source

func (n *FunctionTypeNode) Source(full bool) string

Source implements Node.

func (*FunctionTypeNode) String

func (n *FunctionTypeNode) String() string

type GoStmtNode

type GoStmtNode struct {
	GO         Token
	Expression Expression
}

GoStmtNode represents the production

GoStmt = "go" Expression .

func (*GoStmtNode) Position

func (n *GoStmtNode) Position() (r token.Position)

Position implements Node.

func (*GoStmtNode) Source

func (n *GoStmtNode) Source(full bool) string

Source implements Node.

type GotoStmtNode

type GotoStmtNode struct {
	GOTO  Token
	Label *LabelNode
}

GotoStmtNode represents the production

GotoStmt = "goto" Label .

func (*GotoStmtNode) Position

func (n *GotoStmtNode) Position() (r token.Position)

Position implements Node.

func (*GotoStmtNode) Source

func (n *GotoStmtNode) Source(full bool) string

Source implements Node.

type IdentifierListNode

type IdentifierListNode struct {
	COMMA Token
	IDENT Token
	List  *IdentifierListNode
}

IdentifierListNode represents the production

IdentifierList = identifier { "," identifier } .

func (*IdentifierListNode) Len

func (n *IdentifierListNode) Len() (r int)

Len reports the number of items in n.

func (*IdentifierListNode) Position

func (n *IdentifierListNode) Position() (r token.Position)

Position implements Node.

func (*IdentifierListNode) Source

func (n *IdentifierListNode) Source(full bool) string

Source implements Node.

type IfElseStmtNode

type IfElseStmtNode struct {
	IF         Token
	Expression Expression
	Block      *BlockNode
	ELSE       Token
	ElseClause Node
	SimpleStmt Node
	SEMICOLON  Token
}

IfElseStmtNode represents the production

IfStmt = "if" Expression Block [ "else" ( IfStmt | Block ) ] | "if" SimpleStmt ";" Expression Block [ "else" ( IfStmt | Block ) ] .

func (*IfElseStmtNode) Position

func (n *IfElseStmtNode) Position() (r token.Position)

Position implements Node.

func (*IfElseStmtNode) Source

func (n *IfElseStmtNode) Source(full bool) string

Source implements Node.

type IfStmtNode

type IfStmtNode struct {
	IF         Token
	Expression Expression
	Block      *BlockNode
	SimpleStmt Node
	SEMICOLON  Token
}

IfStmtNode represents the production

IfStmt = "if" Expression Block [ "else" ( IfStmt | Block ) ] | "if" SimpleStmt ";" Expression Block [ "else" ( IfStmt | Block ) ] .

func (*IfStmtNode) Position

func (n *IfStmtNode) Position() (r token.Position)

Position implements Node.

func (*IfStmtNode) Source

func (n *IfStmtNode) Source(full bool) string

Source implements Node.

type ImportDeclListNode

type ImportDeclListNode struct {
	ImportDecl *ImportDeclNode
	SEMICOLON  Token
	List       *ImportDeclListNode
}

ImportDeclListNode represents the production

ImportDeclListNode = { ImportDecl ";" } .

func (*ImportDeclListNode) Position

func (n *ImportDeclListNode) Position() (r token.Position)

Position implements Node.

func (*ImportDeclListNode) Source

func (n *ImportDeclListNode) Source(full bool) string

Source implements Node.

type ImportDeclNode

type ImportDeclNode struct {
	IMPORT         Token
	LPAREN         Token
	ImportSpecList *ImportSpecListNode
	RPAREN         Token
}

ImportDeclNode represents the production

ImportDecl = "import" ( ImportSpec | "(" { ImportSpec ";" } ")" ) .

func (*ImportDeclNode) Position

func (n *ImportDeclNode) Position() (r token.Position)

Position implements Node.

func (*ImportDeclNode) Source

func (n *ImportDeclNode) Source(full bool) string

Source implements Node.

type ImportSpecListNode

type ImportSpecListNode struct {
	ImportSpec *ImportSpecNode
	SEMICOLON  Token
	List       *ImportSpecListNode
}

ImportSpecListNode represents the production

ImportSpecListNode = { ImportSpec ";" } .

func (*ImportSpecListNode) Position

func (n *ImportSpecListNode) Position() (r token.Position)

Position implements Node.

func (*ImportSpecListNode) Source

func (n *ImportSpecListNode) Source(full bool) string

Source implements Node.

type ImportSpecNode

type ImportSpecNode struct {
	PERIOD      Token
	PackageName Token
	ImportPath  *BasicLitNode
	// contains filtered or unexported fields
}

ImportSpecNode represents the production

ImportSpec = [ "." | PackageName ] ImportPath .

func (*ImportSpecNode) Position

func (n *ImportSpecNode) Position() (r token.Position)

Position implements Node.

func (*ImportSpecNode) Source

func (n *ImportSpecNode) Source(full bool) string

Source implements Node.

func (*ImportSpecNode) Visible

func (n *ImportSpecNode) Visible() int

Visible reports the first token index where n is visible (in scope). Applies to local scopes only.

type IncDecStmtNode

type IncDecStmtNode struct {
	Expression Expression
	Token      Token
}

IncDecStmtNode represents the production

IncDecStmt = Expression ( "++" | "--" ) .

func (*IncDecStmtNode) Position

func (n *IncDecStmtNode) Position() (r token.Position)

Position implements Node.

func (*IncDecStmtNode) Source

func (n *IncDecStmtNode) Source(full bool) string

Source implements Node.

type IndexNode

type IndexNode struct {
	LBRACK     Token
	Expression Expression
	RBRACK     Token
}

IndexNode represents the production

Index = "[" Expression "]" .

func (*IndexNode) Position

func (n *IndexNode) Position() (r token.Position)

Position implements Node.

func (*IndexNode) Source

func (n *IndexNode) Source(full bool) string

Source implements Node.

type InterfaceElemListNode

type InterfaceElemListNode struct {
	InterfaceElem *InterfaceElemNode
	SEMICOLON     Token
	List          *InterfaceElemListNode
}

InterfaceElemListNode represents the production

InterfaceElemListNode = { InterfaceElem ";" } .

func (*InterfaceElemListNode) Position

func (n *InterfaceElemListNode) Position() (r token.Position)

Position implements Node.

func (*InterfaceElemListNode) Source

func (n *InterfaceElemListNode) Source(full bool) string

Source implements Node.

type InterfaceElemNode

type InterfaceElemNode struct {
	MethodElem *MethodElemNode
	TypeElem   *TypeElemListNode
}

InterfaceElemNode represents the production

InterfaceElem = MethodElem | TypeElem .

func (*InterfaceElemNode) Position

func (n *InterfaceElemNode) Position() (r token.Position)

Position implements Node.

func (*InterfaceElemNode) Source

func (n *InterfaceElemNode) Source(full bool) string

Source implements Node.

type InterfaceTypeNode

type InterfaceTypeNode struct {
	INTERFACE         Token
	LBRACE            Token
	InterfaceElemList *InterfaceElemListNode
	RBRACE            Token
	// contains filtered or unexported fields
}

InterfaceTypeNode represents the production

InterfaceType = "interface" "{" { InterfaceElem ";" } "}" .

func (*InterfaceTypeNode) Align

func (n *InterfaceTypeNode) Align() int

func (*InterfaceTypeNode) FieldAlign

func (n *InterfaceTypeNode) FieldAlign() int

func (*InterfaceTypeNode) Kind

func (n *InterfaceTypeNode) Kind() Kind

func (*InterfaceTypeNode) Position

func (n *InterfaceTypeNode) Position() (r token.Position)

Position implements Node.

func (*InterfaceTypeNode) Size

func (n *InterfaceTypeNode) Size() int64

func (*InterfaceTypeNode) Source

func (n *InterfaceTypeNode) Source(full bool) string

Source implements Node.

func (*InterfaceTypeNode) String

func (n *InterfaceTypeNode) String() string

type InvalidType

type InvalidType struct{}

func (*InvalidType) Align

func (n *InvalidType) Align() int

func (*InvalidType) FieldAlign

func (n *InvalidType) FieldAlign() int

func (*InvalidType) Kind

func (n *InvalidType) Kind() Kind

func (*InvalidType) Position

func (n *InvalidType) Position() (r token.Position)

func (*InvalidType) Size

func (n *InvalidType) Size() int64

func (*InvalidType) Source

func (n *InvalidType) Source(full bool) string

func (*InvalidType) String

func (n *InvalidType) String() string

type IotaNode

type IotaNode struct {
	Iota Token
	// contains filtered or unexported fields
}

IotaNode represents the production

IotaNode = identifier .

func (*IotaNode) LexicalScope

func (n *IotaNode) LexicalScope() *Scope

func (*IotaNode) Position

func (n *IotaNode) Position() (r token.Position)

Position implements Node.

func (*IotaNode) Source

func (n *IotaNode) Source(full bool) string

Source implements Node.

type KeyedElementListNode

type KeyedElementListNode struct {
	KeyedElement Expression
	COMMA        Token
	List         *KeyedElementListNode
}

KeyedElementListNode represents the production

KeyedElementListNode = { KeyedElement "," } .

func (*KeyedElementListNode) Position

func (n *KeyedElementListNode) Position() (r token.Position)

Position implements Node.

func (*KeyedElementListNode) Source

func (n *KeyedElementListNode) Source(full bool) string

Source implements Node.

type KeyedElementNode

type KeyedElementNode struct {
	Element  Expression
	COLON    Token
	Element2 Expression
}

KeyedElementNode represents the production

KeyedElement = Element [ ":" Element ] .

func (*KeyedElementNode) Position

func (n *KeyedElementNode) Position() (r token.Position)

Position implements Node.

func (*KeyedElementNode) Source

func (n *KeyedElementNode) Source(full bool) string

Source implements Node.

func (*KeyedElementNode) Type

func (n *KeyedElementNode) Type() Type

func (*KeyedElementNode) Value

func (n *KeyedElementNode) Value() constant.Value

type Kind

type Kind byte

A Kind represents the specific kind of type that a Type represents. The zero Kind is not a valid kind.

const (
	InvalidKind Kind = iota // <invalid type>

	Array          // array
	Bool           // bool
	Chan           // chan
	Complex128     // complex128
	Complex64      // complex64
	Float32        // float32
	Float64        // float64
	Function       // function
	Int            // int
	Int16          // int16
	Int32          // int32
	Int64          // int64
	Int8           // int8
	Interface      // interface
	Map            // map
	Pointer        // pointer
	Slice          // slice
	String         // string
	Struct         // struct
	Tuple          // tuple
	Uint           // uint
	Uint16         // uint16
	Uint32         // uint32
	Uint64         // uint64
	Uint8          // uint8
	Uintptr        // uintptr
	UnsafePointer  // unsafe.Pointer
	UntypedBool    // untyped bool
	UntypedComplex // untyped complex
	UntypedFloat   // untyped float
	UntypedInt     // untyped int
	UntypedNil     // untyped nil
	UntypedRune    // untyped rune
	UntypedString  // untyped string
)

Values of type Kind

func (Kind) String

func (i Kind) String() string

type LabelNode

type LabelNode struct {
	IDENT Token
}

LabelNode represents the production

Label = identifier .

func (*LabelNode) Position

func (n *LabelNode) Position() (r token.Position)

Position implements Node.

func (*LabelNode) Source

func (n *LabelNode) Source(full bool) string

Source implements Node.

type LabeledStmtNode

type LabeledStmtNode struct {
	Label     *LabelNode
	COLON     Token
	Statement Node
}

LabeledStmtNode represents the production

LabeledStmt = Label ":" Statement .

func (*LabeledStmtNode) Position

func (n *LabeledStmtNode) Position() (r token.Position)

Position implements Node.

func (*LabeledStmtNode) Source

func (n *LabeledStmtNode) Source(full bool) string

Source implements Node.

type LiteralValueNode

type LiteralValueNode struct {
	LBRACE           Token
	KeyedElementList *KeyedElementListNode
	RBRACE           Token
}

LiteralValueNode represents the production

LiteralValue = "{" { KeyedElement "," } "}" .

func (*LiteralValueNode) Position

func (n *LiteralValueNode) Position() (r token.Position)

Position implements Node.

func (*LiteralValueNode) Source

func (n *LiteralValueNode) Source(full bool) string

Source implements Node.

func (*LiteralValueNode) Type

func (n *LiteralValueNode) Type() Type

func (*LiteralValueNode) Value

func (n *LiteralValueNode) Value() constant.Value

type MapTypeNode

type MapTypeNode struct {
	MAP         Token
	LBRACK      Token
	KeyType     Node
	RBRACK      Token
	ElementType Node
}

MapTypeNode represents the production

MapType = "map" "[" KeyType "]" ElementType .

func (*MapTypeNode) Align

func (n *MapTypeNode) Align() int

func (*MapTypeNode) FieldAlign

func (n *MapTypeNode) FieldAlign() int

func (*MapTypeNode) Kind

func (n *MapTypeNode) Kind() Kind

func (*MapTypeNode) Position

func (n *MapTypeNode) Position() (r token.Position)

Position implements Node.

func (*MapTypeNode) Size

func (n *MapTypeNode) Size() int64

func (*MapTypeNode) Source

func (n *MapTypeNode) Source(full bool) string

Source implements Node.

func (*MapTypeNode) String

func (n *MapTypeNode) String() string

type MethodDeclNode

type MethodDeclNode struct {
	FUNC         Token
	Receiver     *ParametersNode
	MethodName   Token
	Signature    *SignatureNode
	FunctionBody *FunctionBodyNode
}

MethodDeclNode represents the production

MethodDecl = "func" Receiver MethodName Signature [ FunctionBody ] .

func (*MethodDeclNode) Position

func (n *MethodDeclNode) Position() (r token.Position)

Position implements Node.

func (*MethodDeclNode) Source

func (n *MethodDeclNode) Source(full bool) string

Source implements Node.

type MethodElemNode

type MethodElemNode struct {
	MethodName Token
	Signature  *SignatureNode
	// contains filtered or unexported fields
}

MethodElemNode represents the production

MethodElem = MethodName Signature .

func (*MethodElemNode) Position

func (n *MethodElemNode) Position() (r token.Position)

Position implements Node.

func (*MethodElemNode) Source

func (n *MethodElemNode) Source(full bool) string

Source implements Node.

type MethodExprNode

type MethodExprNode struct {
	ReceiverType Node
	PERIOD       Token
	MethodName   Token
}

MethodExprNode represents the production

MethodExpr = ReceiverType "." MethodName .

func (*MethodExprNode) Position

func (n *MethodExprNode) Position() (r token.Position)

Position implements Node.

func (*MethodExprNode) Source

func (n *MethodExprNode) Source(full bool) string

Source implements Node.

func (*MethodExprNode) Type

func (n *MethodExprNode) Type() Type

func (*MethodExprNode) Value

func (n *MethodExprNode) Value() constant.Value

type Node

type Node interface {
	Position() token.Position
	Source(full bool) string
}

Node is an item of the CST tree.

type OperandNameNode

type OperandNameNode struct {
	Name Token
	// contains filtered or unexported fields
}

OperandNameNode represents the production

OperandName = identifier .

func (*OperandNameNode) LexicalScope

func (n *OperandNameNode) LexicalScope() *Scope

func (*OperandNameNode) Position

func (n *OperandNameNode) Position() (r token.Position)

Position implements Node.

func (*OperandNameNode) Source

func (n *OperandNameNode) Source(full bool) string

Source implements Node.

func (*OperandNameNode) Type

func (n *OperandNameNode) Type() Type

func (*OperandNameNode) Value

func (n *OperandNameNode) Value() constant.Value

type OperandNode

type OperandNode struct {
	OperandName  Expression
	TypeArgs     *TypeArgsNode
	LiteralValue *LiteralValueNode
}

OperandNode represents the production

Operand = Literal | OperandName [ TypeArgs ] [ LiteralValue ] .

func (*OperandNode) Position

func (n *OperandNode) Position() (r token.Position)

Position implements Node.

func (*OperandNode) Source

func (n *OperandNode) Source(full bool) string

Source implements Node.

func (*OperandNode) Type

func (n *OperandNode) Type() Type

func (*OperandNode) Value

func (n *OperandNode) Value() constant.Value

type OperandQualifiedNameNode

type OperandQualifiedNameNode struct {
	Name *QualifiedIdentNode
	// contains filtered or unexported fields
}

OperandQualifiedNameNode represents the production

OperandQualifiedName = QualifiedIdent .

func (*OperandQualifiedNameNode) LexicalScope

func (n *OperandQualifiedNameNode) LexicalScope() *Scope

func (*OperandQualifiedNameNode) Position

func (n *OperandQualifiedNameNode) Position() (r token.Position)

Position implements Node.

func (*OperandQualifiedNameNode) Source

func (n *OperandQualifiedNameNode) Source(full bool) string

Source implements Node.

func (*OperandQualifiedNameNode) Type

func (n *OperandQualifiedNameNode) Type() Type

func (*OperandQualifiedNameNode) Value

type Package

type Package struct {
	AST            map[string]*AST // AST maps fsPaths of individual files to their respective ASTs
	FSPath         string
	GoFiles        []fs.FileInfo
	ImportPath     string
	InvalidGoFiles map[string]error // errors for particular files, if any
	Name           Token
	Scope          *Scope // Package scope.
	Version        string
	// contains filtered or unexported fields
}

Package represents a Go package. The instance must not be mutated.

type PackageClauseNode

type PackageClauseNode struct {
	PACKAGE     Token
	PackageName Token
}

PackageClauseNode represents the production

PackageClause = "package" PackageName .

func (*PackageClauseNode) Position

func (n *PackageClauseNode) Position() (r token.Position)

Position implements Node.

func (*PackageClauseNode) Source

func (n *PackageClauseNode) Source(full bool) string

Source implements Node.

type ParameterDeclListNode

type ParameterDeclListNode struct {
	ParameterDecl *ParameterDeclNode
	COMMA         Token
	List          *ParameterDeclListNode
}

ParameterDeclListNode represents the production

ParameterDeclListNode = { ParameterDecl  "," } .

func (*ParameterDeclListNode) Position

func (n *ParameterDeclListNode) Position() (r token.Position)

Position implements Node.

func (*ParameterDeclListNode) Source

func (n *ParameterDeclListNode) Source(full bool) string

Source implements Node.

type ParameterDeclNode

type ParameterDeclNode struct {
	IdentifierList *IdentifierListNode
	ELLIPSIS       Token
	TypeNode       Type
	// contains filtered or unexported fields
}

ParameterDeclNode represents the production

ParameterDecl = [ IdentifierList ] [ "..." ] Type .

func (*ParameterDeclNode) Position

func (n *ParameterDeclNode) Position() (r token.Position)

Position implements Node.

func (*ParameterDeclNode) Source

func (n *ParameterDeclNode) Source(full bool) string

Source implements Node.

func (*ParameterDeclNode) Visible

func (n *ParameterDeclNode) Visible() int

Visible reports the first token index where n is visible (in scope). Applies to local scopes only.

type ParametersNode

type ParametersNode struct {
	LPAREN            Token
	ParameterDeclList *ParameterDeclListNode
	RPAREN            Token
}

ParametersNode represents the production

Parameters = "(" { ParameterDecl  "," } ")" .

func (*ParametersNode) Position

func (n *ParametersNode) Position() (r token.Position)

Position implements Node.

func (*ParametersNode) Source

func (n *ParametersNode) Source(full bool) string

Source implements Node.

type ParenthesizedExpressionNode

type ParenthesizedExpressionNode struct {
	LPAREN     Token
	Expression Expression
	RPAREN     Token
}

func (*ParenthesizedExpressionNode) Position

func (n *ParenthesizedExpressionNode) Position() (r token.Position)

Position implements Node.

func (*ParenthesizedExpressionNode) Source

func (n *ParenthesizedExpressionNode) Source(full bool) string

Source implements Node.

func (*ParenthesizedExpressionNode) Type

func (*ParenthesizedExpressionNode) Value

type ParenthesizedTypeNode

type ParenthesizedTypeNode struct {
	LPAREN   Token
	TypeNode Type
	RPAREN   Token
}

ParenthesizedTypeNode represents the production

ParenthesizedType = "(" Type ")" .

func (*ParenthesizedTypeNode) Align

func (n *ParenthesizedTypeNode) Align() int

func (*ParenthesizedTypeNode) FieldAlign

func (n *ParenthesizedTypeNode) FieldAlign() int

func (*ParenthesizedTypeNode) Kind

func (n *ParenthesizedTypeNode) Kind() Kind

func (*ParenthesizedTypeNode) Position

func (n *ParenthesizedTypeNode) Position() (r token.Position)

Position implements Node.

func (*ParenthesizedTypeNode) Size

func (n *ParenthesizedTypeNode) Size() int64

func (*ParenthesizedTypeNode) Source

func (n *ParenthesizedTypeNode) Source(full bool) string

Source implements Node.

func (*ParenthesizedTypeNode) String

func (n *ParenthesizedTypeNode) String() string

type PointerTypeNode

type PointerTypeNode struct {
	MUL      Token
	BaseType Type
	// contains filtered or unexported fields
}

PointerTypeNode represents the production

PointerType = "*" BaseType .

func (*PointerTypeNode) Align

func (n *PointerTypeNode) Align() int

func (*PointerTypeNode) FieldAlign

func (n *PointerTypeNode) FieldAlign() int

func (*PointerTypeNode) Kind

func (n *PointerTypeNode) Kind() Kind

func (*PointerTypeNode) Position

func (n *PointerTypeNode) Position() (r token.Position)

Position implements Node.

func (*PointerTypeNode) Size

func (n *PointerTypeNode) Size() int64

func (*PointerTypeNode) Source

func (n *PointerTypeNode) Source(full bool) string

Source implements Node.

func (*PointerTypeNode) String

func (n *PointerTypeNode) String() string

type PredeclaredType

type PredeclaredType struct {
	Node
	// contains filtered or unexported fields
}

func (*PredeclaredType) Align

func (n *PredeclaredType) Align() int

func (*PredeclaredType) FieldAlign

func (n *PredeclaredType) FieldAlign() int

func (*PredeclaredType) Kind

func (n *PredeclaredType) Kind() Kind

func (*PredeclaredType) Size

func (n *PredeclaredType) Size() int64

func (*PredeclaredType) String

func (n *PredeclaredType) String() string

type PrimaryExprNode

type PrimaryExprNode struct {
	PrimaryExpr Expression
	Postfix     Node
}

PrimaryExprNode represents the production

PrimaryExpr = Operand | Conversion | MethodExpr { Selector | Index | Slice | TypeAssertion | Arguments } .

func (*PrimaryExprNode) Position

func (n *PrimaryExprNode) Position() (r token.Position)

Position implements Node.

func (*PrimaryExprNode) Source

func (n *PrimaryExprNode) Source(full bool) string

Source implements Node.

func (*PrimaryExprNode) Type

func (n *PrimaryExprNode) Type() Type

func (*PrimaryExprNode) Value

func (n *PrimaryExprNode) Value() constant.Value

type QualifiedIdentNode

type QualifiedIdentNode struct {
	PackageName Token
	PERIOD      Token
	IDENT       Token
}

QualifiedIdentNode represents the production

QualifiedIdent = PackageName "." identifier .

func (*QualifiedIdentNode) Position

func (n *QualifiedIdentNode) Position() (r token.Position)

Position implements Node.

func (*QualifiedIdentNode) Source

func (n *QualifiedIdentNode) Source(full bool) string

Source implements Node.

type RangeClauseNode

type RangeClauseNode struct {
	RANGE          Token
	Expression     Expression
	ExpressionList *ExpressionListNode
	ASSIGN         Token
	IdentifierList *IdentifierListNode
	DEFINE         Token
}

RangeClauseNode represents the production

RangeClause = "range" Expression | ExpressionList "=" "range" Expression | IdentifierList ":=" "range" Expression .

func (*RangeClauseNode) Position

func (n *RangeClauseNode) Position() (r token.Position)

Position implements Node.

func (*RangeClauseNode) Source

func (n *RangeClauseNode) Source(full bool) string

Source implements Node.

type RecvStmtNode

type RecvStmtNode struct {
	ExpressionList *ExpressionListNode
	Token          Token
	IdentifierList *IdentifierListNode
	RecvExpr       Expression
}

RecvStmtNode represents the production

RecvStmt = [ ExpressionList "=" | IdentifierList ":=" ] RecvExpr .

func (*RecvStmtNode) Position

func (n *RecvStmtNode) Position() (r token.Position)

Position implements Node.

func (*RecvStmtNode) Source

func (n *RecvStmtNode) Source(full bool) string

Source implements Node.

type ResultNode

type ResultNode struct {
	Parameters *ParametersNode
	TypeNode   Type
}

ResultNode represents the production

Result = Parameters | Type .

func (*ResultNode) Position

func (n *ResultNode) Position() (r token.Position)

Position implements Node.

func (*ResultNode) Source

func (n *ResultNode) Source(full bool) string

Source implements Node.

type ReturnStmtNode

type ReturnStmtNode struct {
	RETURN         Token
	ExpressionList *ExpressionListNode
}

ReturnStmtNode represents the production

ReturnStmt = "return" [ ExpressionList ] .

func (*ReturnStmtNode) Position

func (n *ReturnStmtNode) Position() (r token.Position)

Position implements Node.

func (*ReturnStmtNode) Source

func (n *ReturnStmtNode) Source(full bool) string

Source implements Node.

type Scope

type Scope struct {
	// contains filtered or unexported fields
}

func (*Scope) Iterate

func (s *Scope) Iterate(f func(name string, n Node) (stop bool))

func (*Scope) Kind

func (s *Scope) Kind() ScopeKind

func (*Scope) Parent

func (s *Scope) Parent() *Scope

type ScopeKind

type ScopeKind int
const (
	UniverseScope ScopeKind
	PackageScope
	FileScope
	OtherScope
)

func (ScopeKind) String

func (i ScopeKind) String() string

type SelectStmtNode

type SelectStmtNode struct {
	SELECT         Token
	LBRACE         Token
	CommClauseList *CommClauseListNode
	RBRACE         Token
}

SelectStmtNode represents the production

SelectStmt = "select" "{" { CommClause } "}" .

func (*SelectStmtNode) Position

func (n *SelectStmtNode) Position() (r token.Position)

Position implements Node.

func (*SelectStmtNode) Source

func (n *SelectStmtNode) Source(full bool) string

Source implements Node.

type SelectorNode

type SelectorNode struct {
	PERIOD Token
	IDENT  Token
}

SelectorNode represents the production

Selector = "." identifier .

func (*SelectorNode) Position

func (n *SelectorNode) Position() (r token.Position)

Position implements Node.

func (*SelectorNode) Source

func (n *SelectorNode) Source(full bool) string

Source implements Node.

type SendStmtNode

type SendStmtNode struct {
	Channel    Expression
	ARROW      Token
	Expression Expression
}

SendStmtNode represents the production

SendStmt = Channel "<-" Expression .

func (*SendStmtNode) Position

func (n *SendStmtNode) Position() (r token.Position)

Position implements Node.

func (*SendStmtNode) Source

func (n *SendStmtNode) Source(full bool) string

Source implements Node.

type ShortVarDeclNode

type ShortVarDeclNode struct {
	IdentifierList *IdentifierListNode
	DEFINE         Token
	ExpressionList *ExpressionListNode
	// contains filtered or unexported fields
}

ShortVarDeclNode represents the production

ShortVarDecl = IdentifierList ":=" ExpressionList .

func (*ShortVarDeclNode) Position

func (n *ShortVarDeclNode) Position() (r token.Position)

Position implements Node.

func (*ShortVarDeclNode) Source

func (n *ShortVarDeclNode) Source(full bool) string

Source implements Node.

func (*ShortVarDeclNode) Visible

func (n *ShortVarDeclNode) Visible() int

Visible reports the first token index where n is visible (in scope). Applies to local scopes only.

type SignatureNode

type SignatureNode struct {
	Parameters *ParametersNode
	Result     *ResultNode
	// contains filtered or unexported fields
}

SignatureNode represents the production

Signature = Parameters [ Result ] .

func (*SignatureNode) Position

func (n *SignatureNode) Position() (r token.Position)

Position implements Node.

func (*SignatureNode) Source

func (n *SignatureNode) Source(full bool) string

Source implements Node.

func (*SignatureNode) Type

func (n *SignatureNode) Type() Type

type SliceNode

type SliceNode struct {
	LBRACK      Token
	Expression  Expression
	COLON       Token
	Expression2 Expression
	RBRACK      Token
	COLON2      Token
	Expression3 Expression
}

SliceNode represents the production

Slice = "[" [ Expression ] ":" [ Expression ] "]" | "[" [ Expression ] ":" Expression ":" Expression "]" .

func (*SliceNode) Position

func (n *SliceNode) Position() (r token.Position)

Position implements Node.

func (*SliceNode) Source

func (n *SliceNode) Source(full bool) string

Source implements Node.

type SliceTypeNode

type SliceTypeNode struct {
	LBRACK      Token
	RBRACK      Token
	ElementType Node
	// contains filtered or unexported fields
}

SliceTypeNode represents the production

SliceType = "[" "]" ElementType .

func (*SliceTypeNode) Align

func (n *SliceTypeNode) Align() int

func (*SliceTypeNode) FieldAlign

func (n *SliceTypeNode) FieldAlign() int

func (*SliceTypeNode) Kind

func (n *SliceTypeNode) Kind() Kind

func (*SliceTypeNode) Position

func (n *SliceTypeNode) Position() (r token.Position)

Position implements Node.

func (*SliceTypeNode) Size

func (n *SliceTypeNode) Size() int64

func (*SliceTypeNode) Source

func (n *SliceTypeNode) Source(full bool) string

Source implements Node.

func (*SliceTypeNode) String

func (n *SliceTypeNode) String() string

type SourceFileNode

type SourceFileNode struct {
	PackageClause    *PackageClauseNode
	SEMICOLON        Token
	ImportDeclList   *ImportDeclListNode
	TopLevelDeclList *TopLevelDeclListNode
}

SourceFileNode represents the production

SourceFile = PackageClause ";" { ImportDecl ";" } { TopLevelDecl ";" } .

func (*SourceFileNode) Position

func (n *SourceFileNode) Position() (r token.Position)

Position implements Node.

func (*SourceFileNode) Source

func (n *SourceFileNode) Source(full bool) string

Source implements Node.

type StatementListNode

type StatementListNode struct {
	Statement Node
	SEMICOLON Token
	List      *StatementListNode
}

StatementListNode represents the production

StatementList = { Statement ";" } .

func (*StatementListNode) Position

func (n *StatementListNode) Position() (r token.Position)

Position implements Node.

func (*StatementListNode) Source

func (n *StatementListNode) Source(full bool) string

Source implements Node.

type StructTypeNode

type StructTypeNode struct {
	STRUCT        Token
	LBRACE        Token
	FieldDeclList *FieldDeclListNode
	RBRACE        Token
	// contains filtered or unexported fields
}

StructTypeNode represents the production

StructType = "struct" "{" { FieldDecl ";" } "}" .

func (*StructTypeNode) Align

func (n *StructTypeNode) Align() int

func (*StructTypeNode) FieldAlign

func (n *StructTypeNode) FieldAlign() int

func (*StructTypeNode) Kind

func (n *StructTypeNode) Kind() Kind

func (*StructTypeNode) Position

func (n *StructTypeNode) Position() (r token.Position)

Position implements Node.

func (*StructTypeNode) Size

func (n *StructTypeNode) Size() int64

func (*StructTypeNode) Source

func (n *StructTypeNode) Source(full bool) string

Source implements Node.

func (*StructTypeNode) String

func (n *StructTypeNode) String() string

type SwitchStmtNode

type SwitchStmtNode struct {
	ExprSwitchStmt *ExprSwitchStmtNode
	TypeSwitchStmt *TypeSwitchStmtNode
}

SwitchStmtNode represents the production

SwitchStmt = ExprSwitchStmt | TypeSwitchStmt .

func (*SwitchStmtNode) Position

func (n *SwitchStmtNode) Position() (r token.Position)

Position implements Node.

func (*SwitchStmtNode) Source

func (n *SwitchStmtNode) Source(full bool) string

Source implements Node.

type TagNode

type TagNode struct {
	STRING Token
}

TagNode represents the production

Tag = string_lit .

func (*TagNode) Position

func (n *TagNode) Position() (r token.Position)

Position implements Node.

func (*TagNode) Source

func (n *TagNode) Source(full bool) string

Source implements Node.

type Token

type Token struct {
	// contains filtered or unexported fields
}

Token represents a lexeme, its position and its semantic value.

func (Token) Ch

func (t Token) Ch() token.Token

Ch returns which token t represents

func (Token) IsValid

func (t Token) IsValid() bool

IsValid reports t is a valid token. Zero value reports false.

func (Token) Next

func (t Token) Next() (r Token)

Next returns the token following t or a zero value if no such token exists.

func (Token) Position

func (t Token) Position() (r token.Position)

Positions implements Node.

func (Token) Prev

func (t Token) Prev() (r Token)

Prev returns the token preceding t or a zero value if no such token exists.

func (Token) Sep

func (t Token) Sep() string

Sep returns any separators, combined, preceding t.

func (Token) SetSep

func (t Token) SetSep(s string)

SetSep sets t's separator.

func (Token) SetSrc

func (t Token) SetSrc(s string)

SetSrc sets t's source form.

func (Token) Source

func (t Token) Source(full bool) string

Source implements Node.

func (Token) Src

func (t Token) Src() string

Src returns t's source form.

type TopLevelDeclListNode

type TopLevelDeclListNode struct {
	TopLevelDecl Node
	SEMICOLON    Token
	List         *TopLevelDeclListNode
}

TopLevelDeclListNode represents the production

TopLevelDeclListNode = { TopLevelDecl ";" .

func (*TopLevelDeclListNode) Position

func (n *TopLevelDeclListNode) Position() (r token.Position)

Position implements Node.

func (*TopLevelDeclListNode) Source

func (n *TopLevelDeclListNode) Source(full bool) string

Source implements Node.

type TupleType

type TupleType struct {
	Node
	Types []Type
}

func (*TupleType) Align

func (n *TupleType) Align() int

func (*TupleType) FieldAlign

func (n *TupleType) FieldAlign() int

func (*TupleType) Kind

func (n *TupleType) Kind() Kind

func (*TupleType) Size

func (n *TupleType) Size() int64

func (*TupleType) Source

func (n *TupleType) Source(full bool) (r string)

func (*TupleType) String

func (n *TupleType) String() string

type Type

type Type interface {
	Node

	// Align returns the alignment in bytes of a value of this type when allocated
	// in memory.
	Align() int

	// FieldAlign returns the alignment in bytes of a value of this type when used
	// as a field in a struct.
	FieldAlign() int

	// Kind returns the specific kind of this type.
	Kind() Kind

	// Size returns the number of bytes needed to store a value of the given type;
	// it is analogous to unsafe.Sizeof.
	Size() int64

	// String returns a string representation of the type.  The string
	// representation is not guaranteed to be unique among types.
	String() string
	// contains filtered or unexported methods
}

type TypeArgsNode

type TypeArgsNode struct {
	LBRACK   Token
	TypeList *TypeListNode
	COMMA    Token
	RBRACK   Token
}

TypeArgsNode represents the production

TypeArgs = "[" TypeList [ "," ] "]" .

func (*TypeArgsNode) Position

func (n *TypeArgsNode) Position() (r token.Position)

Position implements Node.

func (*TypeArgsNode) Source

func (n *TypeArgsNode) Source(full bool) string

Source implements Node.

type TypeAssertionNode

type TypeAssertionNode struct {
	PERIOD   Token
	LPAREN   Token
	TypeNode Type
	RPAREN   Token
}

TypeAssertionNode represents the production

TypeAssertion = "." "(" Type ")" .

func (*TypeAssertionNode) Position

func (n *TypeAssertionNode) Position() (r token.Position)

Position implements Node.

func (*TypeAssertionNode) Source

func (n *TypeAssertionNode) Source(full bool) string

Source implements Node.

type TypeCaseClauseListNode

type TypeCaseClauseListNode struct {
	TypeCaseClause *TypeCaseClauseNode
	List           *TypeCaseClauseListNode
}

TypeCaseClauseListNode represents the production

TypeCaseClauseListNode = { TypeCaseClause } .

func (*TypeCaseClauseListNode) Position

func (n *TypeCaseClauseListNode) Position() (r token.Position)

Position implements Node.

func (*TypeCaseClauseListNode) Source

func (n *TypeCaseClauseListNode) Source(full bool) string

Source implements Node.

type TypeCaseClauseNode

type TypeCaseClauseNode struct {
	TypeSwitchCase *TypeSwitchCaseNode
	COLON          Token
	StatementList  *StatementListNode
}

TypeCaseClauseNode represents the production

TypeCaseClause = TypeSwitchCase ":" StatementList .

func (*TypeCaseClauseNode) Position

func (n *TypeCaseClauseNode) Position() (r token.Position)

Position implements Node.

func (*TypeCaseClauseNode) Source

func (n *TypeCaseClauseNode) Source(full bool) string

Source implements Node.

type TypeCheck

type TypeCheck int
const (
	TypeCheckNone TypeCheck = iota
	TypeCheckAll
)

func (TypeCheck) String

func (i TypeCheck) String() string

type TypeConstraintNode

type TypeConstraintNode struct {
	TypeElem *TypeElemListNode
}

TypeConstraintNode represents the production

TypeConstraint = TypeElem .

func (*TypeConstraintNode) Position

func (n *TypeConstraintNode) Position() (r token.Position)

Position implements Node.

func (*TypeConstraintNode) Source

func (n *TypeConstraintNode) Source(full bool) string

Source implements Node.

type TypeDeclNode

type TypeDeclNode struct {
	TYPE         Token
	LPAREN       Token
	TypeSpecList *TypeSpecListNode
	RPAREN       Token
}

TypeDeclNode represents the production

TypeDecl = "type" ( TypeSpec | "(" { TypeSpec ";" } ")" ) .

func (*TypeDeclNode) Position

func (n *TypeDeclNode) Position() (r token.Position)

Position implements Node.

func (*TypeDeclNode) Source

func (n *TypeDeclNode) Source(full bool) string

Source implements Node.

type TypeDefNode

type TypeDefNode struct {
	IDENT          Token
	TypeParameters *TypeParametersNode
	TypeNode       Type
	// contains filtered or unexported fields
}

TypeDefNode represents the production

TypeDef = identifier [ TypeParameters ] Type .

func (*TypeDefNode) Align

func (n *TypeDefNode) Align() int

func (*TypeDefNode) FieldAlign

func (n *TypeDefNode) FieldAlign() int

func (*TypeDefNode) Kind

func (n *TypeDefNode) Kind() Kind

func (*TypeDefNode) Position

func (n *TypeDefNode) Position() (r token.Position)

Position implements Node.

func (*TypeDefNode) Size

func (n *TypeDefNode) Size() int64

func (*TypeDefNode) Source

func (n *TypeDefNode) Source(full bool) string

Source implements Node.

func (*TypeDefNode) String

func (n *TypeDefNode) String() string

func (*TypeDefNode) Visible

func (n *TypeDefNode) Visible() int

Visible reports the first token index where n is visible (in scope). Applies to local scopes only.

type TypeElemListNode

type TypeElemListNode struct {
	OR       Token
	TypeTerm *TypeTermNode
	List     *TypeElemListNode
}

TypeElemListNode represents the production

TypeElem = TypeTerm { "|" TypeTerm } .

func (*TypeElemListNode) Position

func (n *TypeElemListNode) Position() (r token.Position)

Position implements Node.

func (*TypeElemListNode) Source

func (n *TypeElemListNode) Source(full bool) string

Source implements Node.

type TypeListNode

type TypeListNode struct {
	COMMA    Token
	TypeNode Type
	List     *TypeListNode
}

TypeListNode represents the production

TypeList = Type { "," Type } .

func (*TypeListNode) Position

func (n *TypeListNode) Position() (r token.Position)

Position implements Node.

func (*TypeListNode) Source

func (n *TypeListNode) Source(full bool) string

Source implements Node.

type TypeNameNode

type TypeNameNode struct {
	Name Node
	// contains filtered or unexported fields
}

TypeNameNode represents the production

TypeName = QualifiedIdent | identifier .

func (*TypeNameNode) Align

func (n *TypeNameNode) Align() int

func (*TypeNameNode) FieldAlign

func (n *TypeNameNode) FieldAlign() int

func (*TypeNameNode) Kind

func (n *TypeNameNode) Kind() Kind

func (*TypeNameNode) LexicalScope

func (n *TypeNameNode) LexicalScope() *Scope

func (*TypeNameNode) Position

func (n *TypeNameNode) Position() (r token.Position)

Position implements Node.

func (*TypeNameNode) Size

func (n *TypeNameNode) Size() int64

func (*TypeNameNode) Source

func (n *TypeNameNode) Source(full bool) string

Source implements Node.

func (*TypeNameNode) String

func (n *TypeNameNode) String() string

type TypeNode

type TypeNode struct {
	TypeName *TypeNameNode
	TypeArgs *TypeArgsNode
}

TypeNode represents the production

Type = TypeName TypeArgs .

func (*TypeNode) Align

func (n *TypeNode) Align() int

func (*TypeNode) FieldAlign

func (n *TypeNode) FieldAlign() int

func (*TypeNode) Kind

func (n *TypeNode) Kind() Kind

func (*TypeNode) Position

func (n *TypeNode) Position() (r token.Position)

Position implements Node.

func (*TypeNode) Size

func (n *TypeNode) Size() int64

func (*TypeNode) Source

func (n *TypeNode) Source(full bool) string

Source implements Node.

func (*TypeNode) String

func (n *TypeNode) String() string

type TypeParamDeclNode

type TypeParamDeclNode struct {
	IdentifierList *IdentifierListNode
	TypeConstraint *TypeConstraintNode
}

TypeParamDeclNode represents the production

TypeParamDecl = IdentifierList TypeConstraint .

func (*TypeParamDeclNode) Position

func (n *TypeParamDeclNode) Position() (r token.Position)

Position implements Node.

func (*TypeParamDeclNode) Source

func (n *TypeParamDeclNode) Source(full bool) string

Source implements Node.

type TypeParamListNode

type TypeParamListNode struct {
	COMMA         Token
	TypeParamDecl *TypeParamDeclNode
	List          *TypeParamListNode
}

TypeParamListNode represents the production

TypeParamList = TypeParamDecl { "," TypeParamDecl } .

func (*TypeParamListNode) Position

func (n *TypeParamListNode) Position() (r token.Position)

Position implements Node.

func (*TypeParamListNode) Source

func (n *TypeParamListNode) Source(full bool) string

Source implements Node.

type TypeParametersNode

type TypeParametersNode struct {
	LBRACK        Token
	TypeParamList *TypeParamListNode
	COMMA         Token
	RBRACK        Token
}

TypeParametersNode represents the production

TypeParameters = "[" TypeParamList [ "," ] "]" .

func (*TypeParametersNode) Position

func (n *TypeParametersNode) Position() (r token.Position)

Position implements Node.

func (*TypeParametersNode) Source

func (n *TypeParametersNode) Source(full bool) string

Source implements Node.

type TypeSpecListNode

type TypeSpecListNode struct {
	TypeSpec  Node
	SEMICOLON Token
	List      *TypeSpecListNode
}

TypeSpecListNode represents the production

TypeSpecListNode = "type" ( TypeSpec | "(" { TypeSpec ";" } ")" ) .

func (*TypeSpecListNode) Position

func (n *TypeSpecListNode) Position() (r token.Position)

Position implements Node.

func (*TypeSpecListNode) Source

func (n *TypeSpecListNode) Source(full bool) string

Source implements Node.

type TypeSwitchCaseNode

type TypeSwitchCaseNode struct {
	CASE     Token
	TypeList *TypeListNode
	DEFAULT  Token
}

TypeSwitchCaseNode represents the production

TypeSwitchCase = "case" TypeList | "default" .

func (*TypeSwitchCaseNode) Position

func (n *TypeSwitchCaseNode) Position() (r token.Position)

Position implements Node.

func (*TypeSwitchCaseNode) Source

func (n *TypeSwitchCaseNode) Source(full bool) string

Source implements Node.

type TypeSwitchGuardNode

type TypeSwitchGuardNode struct {
	IDENT       Token
	DEFINE      Token
	PrimaryExpr Expression
	PERIOD      Token
	LPAREN      Token
	TYPE        Token
	RPAREN      Token
}

TypeSwitchGuardNode represents the production

TypeSwitchGuard = [ identifier ":=" ] PrimaryExpr "." "(" "type" ")" .

func (*TypeSwitchGuardNode) Position

func (n *TypeSwitchGuardNode) Position() (r token.Position)

Position implements Node.

func (*TypeSwitchGuardNode) Source

func (n *TypeSwitchGuardNode) Source(full bool) string

Source implements Node.

type TypeSwitchStmtNode

type TypeSwitchStmtNode struct {
	SWITCH             Token
	SimpleStmt         Node
	SEMICOLON          Token
	TypeSwitchGuard    *TypeSwitchGuardNode
	LBRACE             Token
	TypeCaseClauseList *TypeCaseClauseListNode
	RBRACE             Token
}

TypeSwitchStmtNode represents the production

TypeSwitchStmt = "switch" [ SimpleStmt ";" ] TypeSwitchGuard "{" { TypeCaseClause } "}" .

func (*TypeSwitchStmtNode) Position

func (n *TypeSwitchStmtNode) Position() (r token.Position)

Position implements Node.

func (*TypeSwitchStmtNode) Source

func (n *TypeSwitchStmtNode) Source(full bool) string

Source implements Node.

type TypeTermNode

type TypeTermNode struct {
	TypeNode       Type
	UnderlyingType *UnderlyingTypeNode
}

TypeTermNode represents the production

TypeTerm = Type | UnderlyingType .

func (*TypeTermNode) Position

func (n *TypeTermNode) Position() (r token.Position)

Position implements Node.

func (*TypeTermNode) Source

func (n *TypeTermNode) Source(full bool) string

Source implements Node.

type UnaryExprNode

type UnaryExprNode struct {
	Op        Token
	UnaryExpr Expression
	// contains filtered or unexported fields
}

UnaryExprNode represents the production

UnaryExpr = PrimaryExpr | ( "+" | "-" | "!" | "^" | "*" | "&" | "<-" ) UnaryExpr .

func (*UnaryExprNode) Position

func (n *UnaryExprNode) Position() (r token.Position)

Position implements Node.

func (*UnaryExprNode) Source

func (n *UnaryExprNode) Source(full bool) string

Source implements Node.

func (*UnaryExprNode) Type

func (n *UnaryExprNode) Type() Type

func (*UnaryExprNode) Value

func (n *UnaryExprNode) Value() constant.Value

type UnderlyingTypeNode

type UnderlyingTypeNode struct {
	TILDE    Token
	TypeNode Type
}

UnderlyingTypeNode represents the production

UnderlyingType = "~" Type .

func (*UnderlyingTypeNode) Position

func (n *UnderlyingTypeNode) Position() (r token.Position)

Position implements Node.

func (*UnderlyingTypeNode) Source

func (n *UnderlyingTypeNode) Source(full bool) string

Source implements Node.

type ValueExpression

type ValueExpression struct {
	Node
	// contains filtered or unexported fields
}

func (*ValueExpression) Type

func (n *ValueExpression) Type() Type

func (*ValueExpression) Value

func (n *ValueExpression) Value() constant.Value

type VarDeclNode

type VarDeclNode struct {
	VAR     Token
	LPAREN  Token
	VarSpec Node
	RPAREN  Token
}

VarDeclNode represents the production

VarDecl = "var" ( VarSpec | "(" { VarSpec ";" } ")" ) .

func (*VarDeclNode) Position

func (n *VarDeclNode) Position() (r token.Position)

Position implements Node.

func (*VarDeclNode) Source

func (n *VarDeclNode) Source(full bool) string

Source implements Node.

type VarSpec2Node

type VarSpec2Node struct {
	IdentifierList *IdentifierListNode
	TypeNode       Type
	ASSIGN         Token
	ExpressionList *ExpressionListNode
	// contains filtered or unexported fields
}

VarSpec2Node represents the production

VarSpec = IdentifierList ( Type [ "=" ExpressionList ] | "=" ExpressionList ) .

func (*VarSpec2Node) LexicalScope

func (n *VarSpec2Node) LexicalScope() *Scope

func (*VarSpec2Node) Position

func (n *VarSpec2Node) Position() (r token.Position)

Position implements Node.

func (*VarSpec2Node) Source

func (n *VarSpec2Node) Source(full bool) string

Source implements Node.

func (*VarSpec2Node) Visible

func (n *VarSpec2Node) Visible() int

Visible reports the first token index where n is visible (in scope). Applies to local scopes only.

type VarSpecListNode

type VarSpecListNode struct {
	VarSpec   Node
	SEMICOLON Token
	List      *VarSpecListNode
}

VarSpecListNode represents the production

VarSpecListNode = { VarSpec ";" } .

func (*VarSpecListNode) Position

func (n *VarSpecListNode) Position() (r token.Position)

Position implements Node.

func (*VarSpecListNode) Source

func (n *VarSpecListNode) Source(full bool) string

Source implements Node.

type VarSpecNode

type VarSpecNode struct {
	IDENT          Token
	TypeNode       Type
	ASSIGN         Token
	ExpressionList *ExpressionListNode
	// contains filtered or unexported fields
}

VarSpecNode represents the production

VarSpec = identifier ( Type [ "=" ExpressionList ] | "=" ExpressionList ) .

func (*VarSpecNode) LexicalScope

func (n *VarSpecNode) LexicalScope() *Scope

func (*VarSpecNode) Position

func (n *VarSpecNode) Position() (r token.Position)

Position implements Node.

func (*VarSpecNode) Source

func (n *VarSpecNode) Source(full bool) string

Source implements Node.

func (*VarSpecNode) Visible

func (n *VarSpecNode) Visible() int

Visible reports the first token index where n is visible (in scope). Applies to local scopes only.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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