node

package
v0.0.0-...-aea1278 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: MIT Imports: 12 Imported by: 0

Documentation ¶

Index ¶

Constants ¶

This section is empty.

Variables ¶

This section is empty.

Functions ¶

func IsStatement ¶

func IsStatement(v any) bool

IsStatement returns true if given value is implements interface{ StmtNode() }.

func WriteCode ¶

func WriteCode(ctx *CodeWriterContext, node ...ast.Node) (err error)

func WriteCodeExprs ¶

func WriteCodeExprs(ctx *CodeWriterContext, sep string, expr ...Expr) (err error)

func WriteCodeStmts ¶

func WriteCodeStmts(ctx *CodeWriterContext, stmt ...Stmt) (err error)

func WriteCodeValidStmts ¶

func WriteCodeValidStmts(ctx *CodeWriterContext, stmt ...Stmt) (err error)

Types ¶

type ArgVarLit ¶

type ArgVarLit struct {
	TokenPos source.Pos
	Value    Expr
}

ArgVarLit represents an variadic of argument.

func (*ArgVarLit) End ¶

func (e *ArgVarLit) End() source.Pos

func (*ArgVarLit) ExprNode ¶

func (e *ArgVarLit) ExprNode()

func (*ArgVarLit) Pos ¶

func (e *ArgVarLit) Pos() source.Pos

func (*ArgVarLit) String ¶

func (e *ArgVarLit) String() string

func (*ArgVarLit) WriteCode ¶

func (e *ArgVarLit) WriteCode(ctx *CodeWriterContext) (err error)

type ArgsKeyword ¶

type ArgsKeyword struct {
	TokenPos source.Pos
	Literal  string
}

func (*ArgsKeyword) End ¶

func (c *ArgsKeyword) End() source.Pos

func (*ArgsKeyword) ExprNode ¶

func (c *ArgsKeyword) ExprNode()

func (*ArgsKeyword) Pos ¶

func (c *ArgsKeyword) Pos() source.Pos

func (*ArgsKeyword) String ¶

func (c *ArgsKeyword) String() string

type ArgsList ¶

type ArgsList struct {
	Var    *TypedIdent
	Values []*TypedIdent
}

ArgsList represents a list of identifiers.

func (*ArgsList) End ¶

func (n *ArgsList) End() source.Pos

End returns the position of first character immediately after the node.

func (*ArgsList) NumFields ¶

func (n *ArgsList) NumFields() int

NumFields returns the number of fields.

func (*ArgsList) Pos ¶

func (n *ArgsList) Pos() source.Pos

Pos returns the position of first character belonging to the node.

func (*ArgsList) String ¶

func (n *ArgsList) String() string

type ArrayLit ¶

type ArrayLit struct {
	Elements []Expr
	LBrack   source.Pos
	RBrack   source.Pos
}

ArrayLit represents an array literal.

func (*ArrayLit) End ¶

func (e *ArrayLit) End() source.Pos

End returns the position of first character immediately after the node.

func (*ArrayLit) ExprNode ¶

func (e *ArrayLit) ExprNode()

func (*ArrayLit) Pos ¶

func (e *ArrayLit) Pos() source.Pos

Pos returns the position of first character belonging to the node.

func (*ArrayLit) String ¶

func (e *ArrayLit) String() string

func (*ArrayLit) WriteCode ¶

func (e *ArrayLit) WriteCode(ctx *CodeWriterContext) (err error)

type AssignStmt ¶

type AssignStmt struct {
	LHS      []Expr
	RHS      []Expr
	Token    token.Token
	TokenPos source.Pos
}

AssignStmt represents an assignment statement.

func (*AssignStmt) End ¶

func (s *AssignStmt) End() source.Pos

End returns the position of first character immediately after the node.

func (*AssignStmt) Pos ¶

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

Pos returns the position of first character belonging to the node.

func (*AssignStmt) StmtNode ¶

func (s *AssignStmt) StmtNode()

func (*AssignStmt) String ¶

func (s *AssignStmt) String() string

func (*AssignStmt) WriteCode ¶

func (s *AssignStmt) WriteCode(ctx *CodeWriterContext) (err error)

type BadDecl ¶

type BadDecl struct {
	From, To source.Pos // position range of bad declaration
}

A BadDecl node is a placeholder for declarations containing syntax errors for which no correct declaration nodes can be created.

func (*BadDecl) End ¶

func (d *BadDecl) End() source.Pos

End returns the position of first character immediately after the node.

func (*BadDecl) Pos ¶

func (d *BadDecl) Pos() source.Pos

Pos returns the position of first character belonging to the node.

func (*BadDecl) String ¶

func (*BadDecl) String() string

type BadExpr ¶

type BadExpr struct {
	From source.Pos
	To   source.Pos
}

BadExpr represents a bad expression.

func (*BadExpr) End ¶

func (e *BadExpr) End() source.Pos

End returns the position of first character immediately after the node.

func (*BadExpr) ExprNode ¶

func (e *BadExpr) ExprNode()

func (*BadExpr) Pos ¶

func (e *BadExpr) Pos() source.Pos

Pos returns the position of first character belonging to the node.

func (*BadExpr) String ¶

func (e *BadExpr) String() string

type BadStmt ¶

type BadStmt struct {
	From source.Pos
	To   source.Pos
}

BadStmt represents a bad statement.

func (*BadStmt) End ¶

func (s *BadStmt) End() source.Pos

End returns the position of first character immediately after the node.

func (*BadStmt) Pos ¶

func (s *BadStmt) Pos() source.Pos

Pos returns the position of first character belonging to the node.

func (*BadStmt) StmtNode ¶

func (s *BadStmt) StmtNode()

func (*BadStmt) String ¶

func (s *BadStmt) String() string

type BinaryExpr ¶

type BinaryExpr struct {
	LHS      Expr
	RHS      Expr
	Token    token.Token
	TokenPos source.Pos
}

BinaryExpr represents a binary operator expression.

func (*BinaryExpr) End ¶

func (e *BinaryExpr) End() source.Pos

End returns the position of first character immediately after the node.

func (*BinaryExpr) ExprNode ¶

func (e *BinaryExpr) ExprNode()

func (*BinaryExpr) Pos ¶

func (e *BinaryExpr) Pos() source.Pos

Pos returns the position of first character belonging to the node.

func (*BinaryExpr) String ¶

func (e *BinaryExpr) String() string

func (*BinaryExpr) WriteCode ¶

func (e *BinaryExpr) WriteCode(ctx *CodeWriterContext) (err error)

type BlockExpr ¶

type BlockExpr struct {
	*BlockStmt
}

func (BlockExpr) ExprNode ¶

func (b BlockExpr) ExprNode()

type BlockStmt ¶

type BlockStmt struct {
	Stmts  []Stmt
	LBrace source.Pos
	RBrace source.Pos
}

BlockStmt represents a block statement.

func (*BlockStmt) End ¶

func (s *BlockStmt) End() source.Pos

End returns the position of first character immediately after the node.

func (*BlockStmt) Pos ¶

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

Pos returns the position of first character belonging to the node.

func (*BlockStmt) StmtNode ¶

func (s *BlockStmt) StmtNode()

func (*BlockStmt) String ¶

func (s *BlockStmt) String() string

func (*BlockStmt) WriteCode ¶

func (s *BlockStmt) WriteCode(ctx *CodeWriterContext) (err error)

type BoolExpr ¶

type BoolExpr interface {
	Expr
	Bool() bool
}

type BoolLit ¶

type BoolLit struct {
	Value    bool
	ValuePos source.Pos
	Literal  string
}

BoolLit represents a boolean literal.

func (*BoolLit) Bool ¶

func (e *BoolLit) Bool() bool

func (*BoolLit) End ¶

func (e *BoolLit) End() source.Pos

End returns the position of first character immediately after the node.

func (*BoolLit) ExprNode ¶

func (e *BoolLit) ExprNode()

func (*BoolLit) Pos ¶

func (e *BoolLit) Pos() source.Pos

Pos returns the position of first character belonging to the node.

func (*BoolLit) String ¶

func (e *BoolLit) String() string

type BranchStmt ¶

type BranchStmt struct {
	Token    token.Token
	TokenPos source.Pos
	Label    *Ident
}

BranchStmt represents a branch statement.

func (*BranchStmt) End ¶

func (s *BranchStmt) End() source.Pos

End returns the position of first character immediately after the node.

func (*BranchStmt) Pos ¶

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

Pos returns the position of first character belonging to the node.

func (*BranchStmt) StmtNode ¶

func (s *BranchStmt) StmtNode()

func (*BranchStmt) String ¶

func (s *BranchStmt) String() string

type CallArgs ¶

type CallArgs struct {
	LParen    source.Pos
	Args      CallExprArgs
	NamedArgs CallExprNamedArgs
	RParen    source.Pos
}

func (*CallArgs) End ¶

func (c *CallArgs) End() source.Pos

End returns the position of first character immediately after the node.

func (*CallArgs) Pos ¶

func (c *CallArgs) Pos() source.Pos

Pos returns the position of first character belonging to the node.

func (*CallArgs) String ¶

func (c *CallArgs) String() string

func (*CallArgs) StringArg ¶

func (c *CallArgs) StringArg(w io.Writer, lbrace, rbrace string)

func (*CallArgs) StringW ¶

func (c *CallArgs) StringW(w io.Writer)

func (*CallArgs) WriteCode ¶

func (c *CallArgs) WriteCode(ctx *CodeWriterContext) (err error)

func (*CallArgs) WriteCodeBrace ¶

func (c *CallArgs) WriteCodeBrace(ctx *CodeWriterContext, lbrace, rbrace string) (err error)

type CallExpr ¶

type CallExpr struct {
	Func Expr
	CallArgs
}

CallExpr represents a function call expression.

func (*CallExpr) End ¶

func (e *CallExpr) End() source.Pos

End returns the position of first character immediately after the node.

func (*CallExpr) ExprNode ¶

func (e *CallExpr) ExprNode()

func (*CallExpr) Pos ¶

func (e *CallExpr) Pos() source.Pos

Pos returns the position of first character belonging to the node.

func (*CallExpr) String ¶

func (e *CallExpr) String() string

type CallExprArgs ¶

type CallExprArgs struct {
	Values []Expr
	Var    *ArgVarLit
}

CallExprArgs represents a call expression arguments.

func (*CallExprArgs) String ¶

func (a *CallExprArgs) String() string

func (*CallExprArgs) Valid ¶

func (a *CallExprArgs) Valid() bool

func (*CallExprArgs) WriteCode ¶

func (a *CallExprArgs) WriteCode(ctx *CodeWriterContext) (err error)

type CallExprNamedArgs ¶

type CallExprNamedArgs struct {
	Names  []NamedArgExpr
	Values []Expr
	Var    *NamedArgVarLit
}

CallExprNamedArgs represents a call expression keyword arguments.

func (*CallExprNamedArgs) Append ¶

func (a *CallExprNamedArgs) Append(name NamedArgExpr, value Expr) *CallExprNamedArgs

func (*CallExprNamedArgs) AppendS ¶

func (a *CallExprNamedArgs) AppendS(name string, value Expr) *CallExprNamedArgs

func (*CallExprNamedArgs) Get ¶

func (a *CallExprNamedArgs) Get(name NamedArgExpr) (index int, value Expr)

func (*CallExprNamedArgs) NamesExpr ¶

func (a *CallExprNamedArgs) NamesExpr() (r []Expr)

func (*CallExprNamedArgs) Prepend ¶

func (a *CallExprNamedArgs) Prepend(name NamedArgExpr, value Expr) *CallExprNamedArgs

func (*CallExprNamedArgs) String ¶

func (a *CallExprNamedArgs) String() string

func (*CallExprNamedArgs) Valid ¶

func (a *CallExprNamedArgs) Valid() bool

func (*CallExprNamedArgs) WriteCode ¶

func (a *CallExprNamedArgs) WriteCode(ctx *CodeWriterContext) (err error)

type CalleeKeyword ¶

type CalleeKeyword struct {
	TokenPos source.Pos
	Literal  string
}

func (*CalleeKeyword) End ¶

func (c *CalleeKeyword) End() source.Pos

func (*CalleeKeyword) ExprNode ¶

func (c *CalleeKeyword) ExprNode()

func (*CalleeKeyword) Pos ¶

func (c *CalleeKeyword) Pos() source.Pos

func (*CalleeKeyword) String ¶

func (c *CalleeKeyword) String() string

type CatchStmt ¶

type CatchStmt struct {
	CatchPos source.Pos
	Ident    *Ident // can be nil if ident is missing
	Body     *BlockStmt
}

CatchStmt represents an catch statement.

func (*CatchStmt) End ¶

func (s *CatchStmt) End() source.Pos

End returns the position of first character immediately after the node.

func (*CatchStmt) Pos ¶

func (s *CatchStmt) Pos() source.Pos

Pos returns the position of first character belonging to the node.

func (*CatchStmt) StmtNode ¶

func (s *CatchStmt) StmtNode()

func (*CatchStmt) String ¶

func (s *CatchStmt) String() string

func (*CatchStmt) WriteCode ¶

func (s *CatchStmt) WriteCode(ctx *CodeWriterContext) (err error)

type CharLit ¶

type CharLit struct {
	Value    rune
	ValuePos source.Pos
	Literal  string
}

CharLit represents a character literal.

func (*CharLit) End ¶

func (e *CharLit) End() source.Pos

End returns the position of first character immediately after the node.

func (*CharLit) ExprNode ¶

func (e *CharLit) ExprNode()

func (*CharLit) Pos ¶

func (e *CharLit) Pos() source.Pos

Pos returns the position of first character belonging to the node.

func (*CharLit) String ¶

func (e *CharLit) String() string

type ClosureLit ¶

type ClosureLit struct {
	ast.NodeData
	Type *FuncType
	Body Expr
}

ClosureLit represents a function closure literal.

func (*ClosureLit) End ¶

func (e *ClosureLit) End() source.Pos

End returns the position of first character immediately after the node.

func (*ClosureLit) ExprNode ¶

func (e *ClosureLit) ExprNode()

func (*ClosureLit) Pos ¶

func (e *ClosureLit) Pos() source.Pos

Pos returns the position of first character belonging to the node.

func (*ClosureLit) String ¶

func (e *ClosureLit) String() string

type CodeWriter ¶

type CodeWriter interface {
	io.Writer
	io.StringWriter
	io.ByteWriter
}

type CodeWriterContext ¶

type CodeWriterContext struct {
	Stack []ast.Node
	CodeWriter
	ExprToTextFunc string
}

func (*CodeWriterContext) Pop ¶

func (c *CodeWriterContext) Pop()

func (*CodeWriterContext) Push ¶

func (c *CodeWriterContext) Push(n ast.Node)

func (*CodeWriterContext) Top ¶

func (c *CodeWriterContext) Top() ast.Node

func (*CodeWriterContext) With ¶

func (c *CodeWriterContext) With(n ast.Node, cb func() error) (err error)

type Coder ¶

type Coder interface {
	WriteCode(ctx *CodeWriterContext) error
}

type CondExpr ¶

type CondExpr struct {
	Cond        Expr
	True        Expr
	False       Expr
	QuestionPos source.Pos
	ColonPos    source.Pos
}

CondExpr represents a ternary conditional expression.

func (*CondExpr) End ¶

func (e *CondExpr) End() source.Pos

End returns the position of first character immediately after the node.

func (*CondExpr) ExprNode ¶

func (e *CondExpr) ExprNode()

func (*CondExpr) Pos ¶

func (e *CondExpr) Pos() source.Pos

Pos returns the position of first character belonging to the node.

func (*CondExpr) String ¶

func (e *CondExpr) String() string

type ConfigOptions ¶

type ConfigOptions struct {
	Mixed          bool
	NoMixed        bool
	WriteFunc      Expr
	ExprToTextFunc Expr
}

type ConfigStmt ¶

type ConfigStmt struct {
	ConfigPos source.Pos
	Elements  []*KeyValueLit
	Options   ConfigOptions
}

func (*ConfigStmt) End ¶

func (c *ConfigStmt) End() source.Pos

func (*ConfigStmt) ParseElements ¶

func (c *ConfigStmt) ParseElements()

func (*ConfigStmt) Pos ¶

func (c *ConfigStmt) Pos() source.Pos

func (*ConfigStmt) StmtNode ¶

func (c *ConfigStmt) StmtNode()

func (*ConfigStmt) String ¶

func (c *ConfigStmt) String() string

type DecimalLit ¶

type DecimalLit struct {
	Value    decimal.Decimal
	ValuePos source.Pos
	Literal  string
}

DecimalLit represents a floating point literal.

func (*DecimalLit) End ¶

func (e *DecimalLit) End() source.Pos

End returns the position of first character immediately after the node.

func (*DecimalLit) ExprNode ¶

func (e *DecimalLit) ExprNode()

func (*DecimalLit) Pos ¶

func (e *DecimalLit) Pos() source.Pos

Pos returns the position of first character belonging to the node.

func (*DecimalLit) String ¶

func (e *DecimalLit) String() string

type Decl ¶

type Decl interface {
	ast.Node
	// contains filtered or unexported methods
}

Decl wraps methods for all declaration nodes.

type DeclStmt ¶

type DeclStmt struct {
	Decl // *GenDecl with VAR token
}

A DeclStmt node represents a declaration in a statement list.

func (*DeclStmt) StmtNode ¶

func (*DeclStmt) StmtNode()

type DictElementLit ¶

type DictElementLit struct {
	Key      string
	KeyPos   source.Pos
	ColonPos source.Pos
	Value    Expr
}

DictElementLit represents a map element.

func (*DictElementLit) End ¶

func (e *DictElementLit) End() source.Pos

End returns the position of first character immediately after the node.

func (*DictElementLit) ExprNode ¶

func (e *DictElementLit) ExprNode()

func (*DictElementLit) Pos ¶

func (e *DictElementLit) Pos() source.Pos

Pos returns the position of first character belonging to the node.

func (*DictElementLit) String ¶

func (e *DictElementLit) String() string

type DictLit ¶

type DictLit struct {
	LBrace   source.Pos
	Elements []*DictElementLit
	RBrace   source.Pos
}

DictLit represents a map literal.

func (*DictLit) End ¶

func (e *DictLit) End() source.Pos

End returns the position of first character immediately after the node.

func (*DictLit) ExprNode ¶

func (e *DictLit) ExprNode()

func (*DictLit) Pos ¶

func (e *DictLit) Pos() source.Pos

Pos returns the position of first character belonging to the node.

func (*DictLit) String ¶

func (e *DictLit) String() string

type DotFileLit ¶

type DotFileLit struct {
	TokenPos source.Pos
}

DotFileLit represents an __name__ literal.

func (*DotFileLit) End ¶

func (e *DotFileLit) End() source.Pos

End DotFileLit the position of first character immediately after the node.

func (*DotFileLit) ExprNode ¶

func (e *DotFileLit) ExprNode()

func (*DotFileLit) Pos ¶

func (e *DotFileLit) Pos() source.Pos

Pos returns the position of first character belonging to the node.

func (*DotFileLit) String ¶

func (e *DotFileLit) String() string

type DotFileNameLit ¶

type DotFileNameLit struct {
	TokenPos source.Pos
}

DotFileNameLit represents an __name__ literal.

func (*DotFileNameLit) End ¶

func (e *DotFileNameLit) End() source.Pos

End DotFileNameLit the position of first character immediately after the node.

func (*DotFileNameLit) ExprNode ¶

func (e *DotFileNameLit) ExprNode()

func (*DotFileNameLit) Pos ¶

func (e *DotFileNameLit) Pos() source.Pos

Pos returns the position of first character belonging to the node.

func (*DotFileNameLit) String ¶

func (e *DotFileNameLit) String() string

type EllipsisValue ¶

type EllipsisValue struct {
	Pos   source.Pos
	Value Expr
}

type EmptyStmt ¶

type EmptyStmt struct {
	Semicolon source.Pos
	Implicit  bool
}

EmptyStmt represents an empty statement.

func (*EmptyStmt) End ¶

func (s *EmptyStmt) End() source.Pos

End returns the position of first character immediately after the node.

func (*EmptyStmt) Pos ¶

func (s *EmptyStmt) Pos() source.Pos

Pos returns the position of first character belonging to the node.

func (*EmptyStmt) StmtNode ¶

func (s *EmptyStmt) StmtNode()

func (*EmptyStmt) String ¶

func (s *EmptyStmt) String() string

type Expr ¶

type Expr interface {
	ast.Node
	ExprNode()
}

Expr represents an expression node in the AST.

type ExprSelector ¶

type ExprSelector interface {
	Expr
	SelectorExpr() Expr
}

type ExprStmt ¶

type ExprStmt struct {
	Expr Expr
}

ExprStmt represents an expression statement.

func (*ExprStmt) End ¶

func (s *ExprStmt) End() source.Pos

End returns the position of first character immediately after the node.

func (*ExprStmt) Pos ¶

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

Pos returns the position of first character belonging to the node.

func (*ExprStmt) StmtNode ¶

func (s *ExprStmt) StmtNode()

func (*ExprStmt) String ¶

func (s *ExprStmt) String() string

type ExprToTextStmt ¶

type ExprToTextStmt struct {
	Expr     Expr
	StartLit ast.Literal
	EndLit   ast.Literal
}

ExprToTextStmt represents to text wrapped expression.

func NewExprToTextStmt ¶

func NewExprToTextStmt(r rune, expr Expr) *ExprToTextStmt

func (*ExprToTextStmt) End ¶

func (s *ExprToTextStmt) End() source.Pos

End returns the position of first character immediately after the node.

func (*ExprToTextStmt) ExprNode ¶

func (s *ExprToTextStmt) ExprNode()

func (*ExprToTextStmt) Pos ¶

func (s *ExprToTextStmt) Pos() source.Pos

Pos returns the position of first character belonging to the node.

func (*ExprToTextStmt) StmtNode ¶

func (s *ExprToTextStmt) StmtNode()

func (*ExprToTextStmt) String ¶

func (s *ExprToTextStmt) String() string

func (*ExprToTextStmt) WriteCode ¶

func (s *ExprToTextStmt) WriteCode(ctx *CodeWriterContext) (err error)

type FinallyStmt ¶

type FinallyStmt struct {
	FinallyPos source.Pos
	Body       *BlockStmt
}

FinallyStmt represents an finally statement.

func (*FinallyStmt) End ¶

func (s *FinallyStmt) End() source.Pos

End returns the position of first character immediately after the node.

func (*FinallyStmt) Pos ¶

func (s *FinallyStmt) Pos() source.Pos

Pos returns the position of first character belonging to the node.

func (*FinallyStmt) StmtNode ¶

func (s *FinallyStmt) StmtNode()

func (*FinallyStmt) String ¶

func (s *FinallyStmt) String() string

func (*FinallyStmt) WriteCode ¶

func (s *FinallyStmt) WriteCode(ctx *CodeWriterContext) (err error)

type FlagLit ¶

type FlagLit struct {
	ValuePos source.Pos
	Literal  string
	Value    bool
}

FlagLit represents a yes literal.

func (*FlagLit) Bool ¶

func (e *FlagLit) Bool() bool

func (*FlagLit) End ¶

func (e *FlagLit) End() source.Pos

End returns the position of first character immediately after the node.

func (*FlagLit) ExprNode ¶

func (e *FlagLit) ExprNode()

func (*FlagLit) Pos ¶

func (e *FlagLit) Pos() source.Pos

Pos returns the position of first character belonging to the node.

func (*FlagLit) String ¶

func (e *FlagLit) String() string

type FloatLit ¶

type FloatLit struct {
	Value    float64
	ValuePos source.Pos
	Literal  string
}

FloatLit represents a floating point literal.

func (*FloatLit) End ¶

func (e *FloatLit) End() source.Pos

End returns the position of first character immediately after the node.

func (*FloatLit) ExprNode ¶

func (e *FloatLit) ExprNode()

func (*FloatLit) Pos ¶

func (e *FloatLit) Pos() source.Pos

Pos returns the position of first character belonging to the node.

func (*FloatLit) String ¶

func (e *FloatLit) String() string

type ForInStmt ¶

type ForInStmt struct {
	ForPos   source.Pos
	Key      *Ident
	Value    *Ident
	Iterable Expr
	Body     *BlockStmt
	Else     *BlockStmt
}

ForInStmt represents a for-in statement.

func (*ForInStmt) End ¶

func (s *ForInStmt) End() source.Pos

End returns the position of first character immediately after the node.

func (*ForInStmt) Pos ¶

func (s *ForInStmt) Pos() source.Pos

Pos returns the position of first character belonging to the node.

func (*ForInStmt) StmtNode ¶

func (s *ForInStmt) StmtNode()

func (*ForInStmt) String ¶

func (s *ForInStmt) String() string

func (*ForInStmt) WriteCode ¶

func (s *ForInStmt) WriteCode(ctx *CodeWriterContext) (err error)

type ForStmt ¶

type ForStmt struct {
	ForPos source.Pos
	Init   Stmt
	Cond   Expr
	Post   Stmt
	Body   *BlockStmt
}

ForStmt represents a for statement.

func (*ForStmt) End ¶

func (s *ForStmt) End() source.Pos

End returns the position of first character immediately after the node.

func (*ForStmt) Pos ¶

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

Pos returns the position of first character belonging to the node.

func (*ForStmt) StmtNode ¶

func (s *ForStmt) StmtNode()

func (*ForStmt) String ¶

func (s *ForStmt) String() string

func (*ForStmt) WriteCode ¶

func (s *ForStmt) WriteCode(ctx *CodeWriterContext) (err error)

type FuncLit ¶

type FuncLit struct {
	ast.NodeData
	Type *FuncType
	Body *BlockStmt
}

FuncLit represents a function literal.

func (*FuncLit) End ¶

func (e *FuncLit) End() source.Pos

End returns the position of first character immediately after the node.

func (*FuncLit) ExprNode ¶

func (e *FuncLit) ExprNode()

func (*FuncLit) Pos ¶

func (e *FuncLit) Pos() source.Pos

Pos returns the position of first character belonging to the node.

func (*FuncLit) String ¶

func (e *FuncLit) String() string

type FuncParams ¶

type FuncParams struct {
	LParen    source.Pos
	Args      ArgsList
	NamedArgs NamedArgsList
	RParen    source.Pos
}

FuncParams represents a function paramsw.

func (*FuncParams) End ¶

func (n *FuncParams) End() (pos source.Pos)

End returns the position of first character immediately after the node.

func (*FuncParams) Pos ¶

func (n *FuncParams) Pos() (pos source.Pos)

Pos returns the position of first character belonging to the node.

func (*FuncParams) String ¶

func (n *FuncParams) String() string

type FuncType ¶

type FuncType struct {
	Token        token.Token
	FuncPos      source.Pos
	Ident        *Ident
	Params       FuncParams
	AllowMethods bool
}

FuncType represents a function type definition.

func (*FuncType) End ¶

func (e *FuncType) End() source.Pos

End returns the position of first character immediately after the node.

func (*FuncType) ExprNode ¶

func (e *FuncType) ExprNode()

func (*FuncType) Pos ¶

func (e *FuncType) Pos() source.Pos

Pos returns the position of first character belonging to the node.

func (*FuncType) String ¶

func (e *FuncType) String() string

type GenDecl ¶

type GenDecl struct {
	TokPos source.Pos  // position of Tok
	Tok    token.Token // Var
	Lparen source.Pos  // position of '(', if any
	Specs  []Spec
	Rparen source.Pos // position of ')', if any
}

A GenDecl node (generic declaration node) represents a variable declaration. A valid Lparen position (Lparen.Line > 0) indicates a parenthesized declaration.

Relationship between Tok value and Specs element type:

token.Var     *ValueSpec

func (*GenDecl) End ¶

func (d *GenDecl) End() source.Pos

End returns the position of first character immediately after the node.

func (*GenDecl) Pos ¶

func (d *GenDecl) Pos() source.Pos

Pos returns the position of first character belonging to the node.

func (*GenDecl) String ¶

func (d *GenDecl) String() string

func (*GenDecl) WriteCode ¶

func (d *GenDecl) WriteCode(ctx *CodeWriterContext) (err error)

type Ident ¶

type Ident struct {
	Name    string
	NamePos source.Pos
}

Ident represents an identifier.

func (*Ident) End ¶

func (e *Ident) End() source.Pos

End returns the position of first character immediately after the node.

func (*Ident) ExprNode ¶

func (e *Ident) ExprNode()

func (*Ident) Pos ¶

func (e *Ident) Pos() source.Pos

Pos returns the position of first character belonging to the node.

func (*Ident) String ¶

func (e *Ident) String() string

type IdentList ¶

type IdentList struct {
	LParen  source.Pos
	VarArgs bool
	List    []*Ident
	RParen  source.Pos
}

IdentList represents a list of identifiers.

func (*IdentList) End ¶

func (n *IdentList) End() source.Pos

End returns the position of first character immediately after the node.

func (*IdentList) NumFields ¶

func (n *IdentList) NumFields() int

NumFields returns the number of fields.

func (*IdentList) Pos ¶

func (n *IdentList) Pos() source.Pos

Pos returns the position of first character belonging to the node.

func (*IdentList) String ¶

func (n *IdentList) String() string

type IfStmt ¶

type IfStmt struct {
	IfPos source.Pos
	Init  Stmt
	Cond  Expr
	Body  *BlockStmt
	Else  Stmt // else branch; or nil
}

IfStmt represents an if statement.

func (*IfStmt) End ¶

func (s *IfStmt) End() source.Pos

End returns the position of first character immediately after the node.

func (*IfStmt) Pos ¶

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

Pos returns the position of first character belonging to the node.

func (*IfStmt) StmtNode ¶

func (s *IfStmt) StmtNode()

func (*IfStmt) String ¶

func (s *IfStmt) String() string

func (*IfStmt) WriteCode ¶

func (s *IfStmt) WriteCode(ctx *CodeWriterContext) (err error)

type ImportExpr ¶

type ImportExpr struct {
	ModuleName string
	Token      token.Token
	TokenPos   source.Pos
}

ImportExpr represents an import expression

func (*ImportExpr) End ¶

func (e *ImportExpr) End() source.Pos

End returns the position of first character immediately after the node.

func (*ImportExpr) ExprNode ¶

func (e *ImportExpr) ExprNode()

func (*ImportExpr) Pos ¶

func (e *ImportExpr) Pos() source.Pos

Pos returns the position of first character belonging to the node.

func (*ImportExpr) String ¶

func (e *ImportExpr) String() string

type IncDecStmt ¶

type IncDecStmt struct {
	Expr     Expr
	Token    token.Token
	TokenPos source.Pos
}

IncDecStmt represents increment or decrement statement.

func (*IncDecStmt) End ¶

func (s *IncDecStmt) End() source.Pos

End returns the position of first character immediately after the node.

func (*IncDecStmt) Pos ¶

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

Pos returns the position of first character belonging to the node.

func (*IncDecStmt) StmtNode ¶

func (s *IncDecStmt) StmtNode()

func (*IncDecStmt) String ¶

func (s *IncDecStmt) String() string

func (*IncDecStmt) WriteCode ¶

func (s *IncDecStmt) WriteCode(ctx *CodeWriterContext) (err error)

type IndexExpr ¶

type IndexExpr struct {
	Expr   Expr
	LBrack source.Pos
	Index  Expr
	RBrack source.Pos
}

IndexExpr represents an index expression.

func (*IndexExpr) End ¶

func (e *IndexExpr) End() source.Pos

End returns the position of first character immediately after the node.

func (*IndexExpr) ExprNode ¶

func (e *IndexExpr) ExprNode()

func (*IndexExpr) Pos ¶

func (e *IndexExpr) Pos() source.Pos

Pos returns the position of first character belonging to the node.

func (*IndexExpr) String ¶

func (e *IndexExpr) String() string

type IntLit ¶

type IntLit struct {
	Value    int64
	ValuePos source.Pos
	Literal  string
}

IntLit represents an integer literal.

func (*IntLit) End ¶

func (e *IntLit) End() source.Pos

End returns the position of first character immediately after the node.

func (*IntLit) ExprNode ¶

func (e *IntLit) ExprNode()

func (*IntLit) Pos ¶

func (e *IntLit) Pos() source.Pos

Pos returns the position of first character belonging to the node.

func (*IntLit) String ¶

func (e *IntLit) String() string

type IsModuleLit ¶

type IsModuleLit struct {
	TokenPos source.Pos
}

IsModuleLit represents an __is_module__ literal.

func (*IsModuleLit) End ¶

func (e *IsModuleLit) End() source.Pos

End IsModuleLit the position of first character immediately after the node.

func (*IsModuleLit) ExprNode ¶

func (e *IsModuleLit) ExprNode()

func (*IsModuleLit) Pos ¶

func (e *IsModuleLit) Pos() source.Pos

Pos returns the position of first character belonging to the node.

func (*IsModuleLit) String ¶

func (e *IsModuleLit) String() string

type KeyValueArrayLit ¶

type KeyValueArrayLit struct {
	LBrace   source.Pos
	Elements []*KeyValueLit
	RBrace   source.Pos
}

KeyValueArrayLit represents a key value array literal.

func (*KeyValueArrayLit) End ¶

func (e *KeyValueArrayLit) End() source.Pos

End returns the position of first character immediately after the node.

func (*KeyValueArrayLit) ExprNode ¶

func (e *KeyValueArrayLit) ExprNode()

func (*KeyValueArrayLit) Pos ¶

func (e *KeyValueArrayLit) Pos() source.Pos

Pos returns the position of first character belonging to the node.

func (*KeyValueArrayLit) String ¶

func (e *KeyValueArrayLit) String() string

func (*KeyValueArrayLit) WriteCode ¶

func (e *KeyValueArrayLit) WriteCode(ctx *CodeWriterContext) (err error)

type KeyValueLit ¶

type KeyValueLit struct {
	Key   Expr
	Value Expr
}

KeyValueLit represents a key value element.

func (*KeyValueLit) ElementString ¶

func (e *KeyValueLit) ElementString() string

func (*KeyValueLit) End ¶

func (e *KeyValueLit) End() source.Pos

End returns the position of first character immediately after the node.

func (*KeyValueLit) ExprNode ¶

func (e *KeyValueLit) ExprNode()

func (*KeyValueLit) Pos ¶

func (e *KeyValueLit) Pos() source.Pos

Pos returns the position of first character belonging to the node.

func (*KeyValueLit) String ¶

func (e *KeyValueLit) String() string

func (*KeyValueLit) WriteCode ¶

func (e *KeyValueLit) WriteCode(ctx *CodeWriterContext) (err error)

type MultiParenExpr ¶

type MultiParenExpr struct {
	Exprs  []Expr
	LParen source.Pos
	RParen source.Pos
}

MultiParenExpr represents a parenthesis wrapped expressions.

func (*MultiParenExpr) End ¶

func (e *MultiParenExpr) End() source.Pos

End returns the position of first character immediately after the node.

func (*MultiParenExpr) ExprNode ¶

func (e *MultiParenExpr) ExprNode()

func (*MultiParenExpr) Pos ¶

func (e *MultiParenExpr) Pos() source.Pos

Pos returns the position of first character belonging to the node.

func (*MultiParenExpr) String ¶

func (e *MultiParenExpr) String() string

type NamedArgExpr ¶

type NamedArgExpr struct {
	Lit   *StringLit
	Ident *Ident
}

func (*NamedArgExpr) Expr ¶

func (e *NamedArgExpr) Expr() Expr

func (*NamedArgExpr) Name ¶

func (e *NamedArgExpr) Name() string

func (*NamedArgExpr) NameString ¶

func (e *NamedArgExpr) NameString() *StringLit

func (*NamedArgExpr) String ¶

func (e *NamedArgExpr) String() string

type NamedArgVarLit ¶

type NamedArgVarLit struct {
	TokenPos source.Pos
	Value    Expr
}

NamedArgVarLit represents an variadic of named argument.

func (*NamedArgVarLit) End ¶

func (e *NamedArgVarLit) End() source.Pos

func (*NamedArgVarLit) ExprNode ¶

func (e *NamedArgVarLit) ExprNode()

func (*NamedArgVarLit) Pos ¶

func (e *NamedArgVarLit) Pos() source.Pos

func (*NamedArgVarLit) String ¶

func (e *NamedArgVarLit) String() string

func (*NamedArgVarLit) WriteCode ¶

func (e *NamedArgVarLit) WriteCode(ctx *CodeWriterContext) (err error)

type NamedArgsKeyword ¶

type NamedArgsKeyword struct {
	TokenPos source.Pos
	Literal  string
}

func (*NamedArgsKeyword) End ¶

func (c *NamedArgsKeyword) End() source.Pos

func (*NamedArgsKeyword) ExprNode ¶

func (c *NamedArgsKeyword) ExprNode()

func (*NamedArgsKeyword) Pos ¶

func (c *NamedArgsKeyword) Pos() source.Pos

func (*NamedArgsKeyword) String ¶

func (c *NamedArgsKeyword) String() string

type NamedArgsList ¶

type NamedArgsList struct {
	Var    *TypedIdent
	Names  []*TypedIdent
	Values []Expr
}

NamedArgsList represents a list of identifier with value pairs.

func (*NamedArgsList) Add ¶

func (n *NamedArgsList) Add(name *TypedIdent, value Expr) *NamedArgsList

func (*NamedArgsList) End ¶

func (n *NamedArgsList) End() source.Pos

End returns the position of first character immediately after the node.

func (*NamedArgsList) NumFields ¶

func (n *NamedArgsList) NumFields() int

NumFields returns the number of fields.

func (*NamedArgsList) Pos ¶

func (n *NamedArgsList) Pos() source.Pos

Pos returns the position of first character belonging to the node.

func (*NamedArgsList) String ¶

func (n *NamedArgsList) String() string

type NamedParamSpec ¶

type NamedParamSpec struct {
	Ident *TypedIdent
	Value Expr
}

A NamedParamSpec node represents a named parameter declaration

func (*NamedParamSpec) End ¶

func (s *NamedParamSpec) End() source.Pos

End returns the position of first character immediately after the spec.

func (*NamedParamSpec) Pos ¶

func (s *NamedParamSpec) Pos() source.Pos

Pos returns the position of first character belonging to the spec.

func (*NamedParamSpec) String ¶

func (s *NamedParamSpec) String() string

func (*NamedParamSpec) WriteCode ¶

func (s *NamedParamSpec) WriteCode(ctx *CodeWriterContext) (err error)

type NilLit ¶

type NilLit struct {
	TokenPos source.Pos
}

NilLit represents an nil literal.

func (*NilLit) End ¶

func (e *NilLit) End() source.Pos

End returns the position of first character immediately after the node.

func (*NilLit) ExprNode ¶

func (e *NilLit) ExprNode()

func (*NilLit) Pos ¶

func (e *NilLit) Pos() source.Pos

Pos returns the position of first character belonging to the node.

func (*NilLit) String ¶

func (e *NilLit) String() string

type NullishSelectorExpr ¶

type NullishSelectorExpr struct {
	Expr Expr
	Sel  Expr
}

NullishSelectorExpr represents a selector expression.

func (*NullishSelectorExpr) End ¶

func (e *NullishSelectorExpr) End() source.Pos

End returns the position of first character immediately after the node.

func (*NullishSelectorExpr) ExprNode ¶

func (e *NullishSelectorExpr) ExprNode()

func (*NullishSelectorExpr) Pos ¶

func (e *NullishSelectorExpr) Pos() source.Pos

Pos returns the position of first character belonging to the node.

func (*NullishSelectorExpr) SelectorExpr ¶

func (e *NullishSelectorExpr) SelectorExpr() Expr

func (*NullishSelectorExpr) String ¶

func (e *NullishSelectorExpr) String() string

type ParamSpec ¶

type ParamSpec struct {
	Ident    *TypedIdent
	Variadic bool
}

A ParamSpec node represents a parameter declaration

func (*ParamSpec) End ¶

func (s *ParamSpec) End() source.Pos

End returns the position of first character immediately after the spec.

func (*ParamSpec) Pos ¶

func (s *ParamSpec) Pos() source.Pos

Pos returns the position of first character belonging to the spec.

func (*ParamSpec) String ¶

func (s *ParamSpec) String() string

func (*ParamSpec) WriteCode ¶

func (s *ParamSpec) WriteCode(ctx *CodeWriterContext) (err error)

type ParenExpr ¶

type ParenExpr struct {
	Expr   Expr
	LParen source.Pos
	RParen source.Pos
}

ParenExpr represents a parenthesis wrapped expression.

func (*ParenExpr) End ¶

func (e *ParenExpr) End() source.Pos

End returns the position of first character immediately after the node.

func (*ParenExpr) ExprNode ¶

func (e *ParenExpr) ExprNode()

func (*ParenExpr) Pos ¶

func (e *ParenExpr) Pos() source.Pos

Pos returns the position of first character belonging to the node.

func (*ParenExpr) String ¶

func (e *ParenExpr) String() string

type RawStringLit ¶

type RawStringLit struct {
	Literal    string
	LiteralPos source.Pos
	Quoted     bool
}

func (*RawStringLit) End ¶

func (e *RawStringLit) End() source.Pos

End returns the position of first character immediately after the node.

func (*RawStringLit) ExprNode ¶

func (e *RawStringLit) ExprNode()

func (*RawStringLit) Pos ¶

func (e *RawStringLit) Pos() source.Pos

Pos returns the position of first character belonging to the node.

func (*RawStringLit) QuotedValue ¶

func (e *RawStringLit) QuotedValue() string

func (*RawStringLit) String ¶

func (e *RawStringLit) String() string

func (*RawStringLit) UnquotedValue ¶

func (e *RawStringLit) UnquotedValue() string

type RawStringStmt ¶

type RawStringStmt struct {
	MixedExprRune rune
	Lits          []*RawStringLit
}

RawStringStmt represents an RawStringStmt.

func (*RawStringStmt) End ¶

func (s *RawStringStmt) End() source.Pos

func (*RawStringStmt) ExprNode ¶

func (s *RawStringStmt) ExprNode()

func (*RawStringStmt) Pos ¶

func (s *RawStringStmt) Pos() source.Pos

func (*RawStringStmt) Quoted ¶

func (s *RawStringStmt) Quoted() string

func (*RawStringStmt) StmtNode ¶

func (s *RawStringStmt) StmtNode()

func (*RawStringStmt) String ¶

func (s *RawStringStmt) String() string

func (*RawStringStmt) TrimLinePrefix ¶

func (s *RawStringStmt) TrimLinePrefix(prefix string)

func (*RawStringStmt) Unquoted ¶

func (s *RawStringStmt) Unquoted() string

func (*RawStringStmt) Value ¶

func (s *RawStringStmt) Value() string

func (*RawStringStmt) WriteCode ¶

func (s *RawStringStmt) WriteCode(ctx *CodeWriterContext) (err error)

type ReturnStmt ¶

type ReturnStmt struct {
	ReturnPos source.Pos
	Result    Expr
}

ReturnStmt represents a return statement.

func (*ReturnStmt) End ¶

func (s *ReturnStmt) End() source.Pos

End returns the position of first character immediately after the node.

func (*ReturnStmt) Pos ¶

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

Pos returns the position of first character belonging to the node.

func (*ReturnStmt) StmtNode ¶

func (s *ReturnStmt) StmtNode()

func (*ReturnStmt) String ¶

func (s *ReturnStmt) String() string

func (*ReturnStmt) WriteCode ¶

func (s *ReturnStmt) WriteCode(ctx *CodeWriterContext) (err error)

type SelectorExpr ¶

type SelectorExpr struct {
	Expr Expr
	Sel  Expr
}

SelectorExpr represents a selector expression.

func (*SelectorExpr) End ¶

func (e *SelectorExpr) End() source.Pos

End returns the position of first character immediately after the node.

func (*SelectorExpr) ExprNode ¶

func (e *SelectorExpr) ExprNode()

func (*SelectorExpr) Pos ¶

func (e *SelectorExpr) Pos() source.Pos

Pos returns the position of first character belonging to the node.

func (*SelectorExpr) SelectorExpr ¶

func (e *SelectorExpr) SelectorExpr() Expr

func (*SelectorExpr) String ¶

func (e *SelectorExpr) String() string

type SliceExpr ¶

type SliceExpr struct {
	Expr   Expr
	LBrack source.Pos
	Low    Expr
	High   Expr
	RBrack source.Pos
}

SliceExpr represents a slice expression.

func (*SliceExpr) End ¶

func (e *SliceExpr) End() source.Pos

End returns the position of first character immediately after the node.

func (*SliceExpr) ExprNode ¶

func (e *SliceExpr) ExprNode()

func (*SliceExpr) Pos ¶

func (e *SliceExpr) Pos() source.Pos

Pos returns the position of first character belonging to the node.

func (*SliceExpr) String ¶

func (e *SliceExpr) String() string

type Spec ¶

type Spec interface {
	ast.Node
	// contains filtered or unexported methods
}

Spec node represents a single (non-parenthesized) variable declaration. The Spec type stands for any of *ParamSpec or *ValueSpec.

type StdErrLit ¶

type StdErrLit struct {
	TokenPos source.Pos
}

StdErrLit represents an STDERR literal.

func (*StdErrLit) End ¶

func (e *StdErrLit) End() source.Pos

End StdErrLit the position of first character immediately after the node.

func (*StdErrLit) ExprNode ¶

func (e *StdErrLit) ExprNode()

func (*StdErrLit) Pos ¶

func (e *StdErrLit) Pos() source.Pos

Pos returns the position of first character belonging to the node.

func (*StdErrLit) String ¶

func (e *StdErrLit) String() string

type StdInLit ¶

type StdInLit struct {
	TokenPos source.Pos
}

StdInLit represents an STDIN literal.

func (*StdInLit) End ¶

func (e *StdInLit) End() source.Pos

End returns the position of first character immediately after the node.

func (*StdInLit) ExprNode ¶

func (e *StdInLit) ExprNode()

func (*StdInLit) Pos ¶

func (e *StdInLit) Pos() source.Pos

Pos returns the position of first character belonging to the node.

func (*StdInLit) String ¶

func (e *StdInLit) String() string

type StdOutLit ¶

type StdOutLit struct {
	TokenPos source.Pos
}

StdOutLit represents an STDOUT literal.

func (*StdOutLit) End ¶

func (e *StdOutLit) End() source.Pos

End returns the position of first character immediately after the node.

func (*StdOutLit) ExprNode ¶

func (e *StdOutLit) ExprNode()

func (*StdOutLit) Pos ¶

func (e *StdOutLit) Pos() source.Pos

Pos returns the position of first character belonging to the node.

func (*StdOutLit) String ¶

func (e *StdOutLit) String() string

type Stmt ¶

type Stmt interface {
	ast.Node
	StmtNode()
}

Stmt represents a statement in the AST.

type StmtsExpr ¶

type StmtsExpr struct {
	Stmts []Stmt
}

func (*StmtsExpr) End ¶

func (s *StmtsExpr) End() source.Pos

func (*StmtsExpr) ExprNode ¶

func (s *StmtsExpr) ExprNode()

func (*StmtsExpr) Pos ¶

func (s *StmtsExpr) Pos() source.Pos

func (*StmtsExpr) String ¶

func (s *StmtsExpr) String() string

func (*StmtsExpr) WriteCode ¶

func (s *StmtsExpr) WriteCode(ctx *CodeWriterContext) (err error)

type StringLit ¶

type StringLit struct {
	Value    string
	ValuePos source.Pos
	Literal  string
}

StringLit represents a string literal.

func (*StringLit) CanIdent ¶

func (e *StringLit) CanIdent() bool

func (*StringLit) End ¶

func (e *StringLit) End() source.Pos

End returns the position of first character immediately after the node.

func (*StringLit) ExprNode ¶

func (e *StringLit) ExprNode()

func (*StringLit) Pos ¶

func (e *StringLit) Pos() source.Pos

Pos returns the position of first character belonging to the node.

func (*StringLit) String ¶

func (e *StringLit) String() string

type ThrowStmt ¶

type ThrowStmt struct {
	ThrowPos source.Pos
	Expr     Expr
}

ThrowStmt represents an throw statement.

func (*ThrowStmt) End ¶

func (s *ThrowStmt) End() source.Pos

End returns the position of first character immediately after the node.

func (*ThrowStmt) Pos ¶

func (s *ThrowStmt) Pos() source.Pos

Pos returns the position of first character belonging to the node.

func (*ThrowStmt) StmtNode ¶

func (s *ThrowStmt) StmtNode()

func (*ThrowStmt) String ¶

func (s *ThrowStmt) String() string

func (*ThrowStmt) WriteCode ¶

func (s *ThrowStmt) WriteCode(ctx *CodeWriterContext) (err error)

type TryStmt ¶

type TryStmt struct {
	TryPos  source.Pos
	Body    *BlockStmt
	Catch   *CatchStmt   // catch branch; or nil
	Finally *FinallyStmt // finally branch; or nil
}

TryStmt represents an try statement.

func (*TryStmt) End ¶

func (s *TryStmt) End() source.Pos

End returns the position of first character immediately after the node.

func (*TryStmt) Pos ¶

func (s *TryStmt) Pos() source.Pos

Pos returns the position of first character belonging to the node.

func (*TryStmt) StmtNode ¶

func (s *TryStmt) StmtNode()

func (*TryStmt) String ¶

func (s *TryStmt) String() string

func (*TryStmt) WriteCode ¶

func (s *TryStmt) WriteCode(ctx *CodeWriterContext) (err error)

type TypedIdent ¶

type TypedIdent struct {
	Ident *Ident
	Type  []*Ident
}

func (*TypedIdent) End ¶

func (e *TypedIdent) End() source.Pos

End returns the position of first character immediately after the node.

func (*TypedIdent) ExprNode ¶

func (e *TypedIdent) ExprNode()

func (*TypedIdent) Pos ¶

func (e *TypedIdent) Pos() source.Pos

Pos returns the position of first character belonging to the node.

func (*TypedIdent) String ¶

func (e *TypedIdent) String() string

type UintLit ¶

type UintLit struct {
	Value    uint64
	ValuePos source.Pos
	Literal  string
}

UintLit represents an unsigned integer literal.

func (*UintLit) End ¶

func (e *UintLit) End() source.Pos

End returns the position of first character immediately after the node.

func (*UintLit) ExprNode ¶

func (e *UintLit) ExprNode()

func (*UintLit) Pos ¶

func (e *UintLit) Pos() source.Pos

Pos returns the position of first character belonging to the node.

func (*UintLit) String ¶

func (e *UintLit) String() string

type UnaryExpr ¶

type UnaryExpr struct {
	Expr     Expr
	Token    token.Token
	TokenPos source.Pos
}

UnaryExpr represents an unary operator expression.

func (*UnaryExpr) End ¶

func (e *UnaryExpr) End() source.Pos

End returns the position of first character immediately after the node.

func (*UnaryExpr) ExprNode ¶

func (e *UnaryExpr) ExprNode()

func (*UnaryExpr) Pos ¶

func (e *UnaryExpr) Pos() source.Pos

Pos returns the position of first character belonging to the node.

func (*UnaryExpr) String ¶

func (e *UnaryExpr) String() string

type ValueSpec ¶

type ValueSpec struct {
	Idents []*Ident // TODO: slice is reserved for tuple assignment
	Values []Expr   // initial values; or nil
	Data   any      // iota
}

A ValueSpec node represents a variable declaration

func (*ValueSpec) End ¶

func (s *ValueSpec) End() source.Pos

End returns the position of first character immediately after the spec.

func (*ValueSpec) Pos ¶

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

Pos returns the position of first character belonging to the spec.

func (*ValueSpec) String ¶

func (s *ValueSpec) String() string

func (*ValueSpec) WriteCode ¶

func (s *ValueSpec) WriteCode(ctx *CodeWriterContext) (err error)

Jump to

Keyboard shortcuts

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