Documentation ¶
Index ¶
- func IsStatement(v any) bool
- func WriteCode(ctx *CodeWriterContext, node ...ast.Node) (err error)
- func WriteCodeExprs(ctx *CodeWriterContext, sep string, expr ...Expr) (err error)
- func WriteCodeStmts(ctx *CodeWriterContext, stmt ...Stmt) (err error)
- func WriteCodeValidStmts(ctx *CodeWriterContext, stmt ...Stmt) (err error)
- type ArgVarLit
- type ArgsKeyword
- type ArgsList
- type ArrayLit
- type AssignStmt
- type BadDecl
- type BadExpr
- type BadStmt
- type BinaryExpr
- type BlockExpr
- type BlockStmt
- type BoolExpr
- type BoolLit
- type BranchStmt
- type CallArgs
- func (c *CallArgs) End() source.Pos
- func (c *CallArgs) Pos() source.Pos
- func (c *CallArgs) String() string
- func (c *CallArgs) StringArg(w io.Writer, lbrace, rbrace string)
- func (c *CallArgs) StringW(w io.Writer)
- func (c *CallArgs) WriteCode(ctx *CodeWriterContext) (err error)
- func (c *CallArgs) WriteCodeBrace(ctx *CodeWriterContext, lbrace, rbrace string) (err error)
- type CallExpr
- type CallExprArgs
- type CallExprNamedArgs
- func (a *CallExprNamedArgs) Append(name NamedArgExpr, value Expr) *CallExprNamedArgs
- func (a *CallExprNamedArgs) AppendS(name string, value Expr) *CallExprNamedArgs
- func (a *CallExprNamedArgs) Get(name NamedArgExpr) (index int, value Expr)
- func (a *CallExprNamedArgs) NamesExpr() (r []Expr)
- func (a *CallExprNamedArgs) Prepend(name NamedArgExpr, value Expr) *CallExprNamedArgs
- func (a *CallExprNamedArgs) String() string
- func (a *CallExprNamedArgs) Valid() bool
- func (a *CallExprNamedArgs) WriteCode(ctx *CodeWriterContext) (err error)
- type CalleeKeyword
- type CatchStmt
- type CharLit
- type ClosureLit
- type CodeWriter
- type CodeWriterContext
- type Coder
- type CondExpr
- type ConfigOptions
- type ConfigStmt
- type DecimalLit
- type Decl
- type DeclStmt
- type DictElementLit
- type DictLit
- type DotFileLit
- type DotFileNameLit
- type EllipsisValue
- type EmptyStmt
- type Expr
- type ExprSelector
- type ExprStmt
- type ExprToTextStmt
- type FinallyStmt
- type FlagLit
- type FloatLit
- type ForInStmt
- type ForStmt
- type FuncLit
- type FuncParams
- type FuncType
- type GenDecl
- type Ident
- type IdentList
- type IfStmt
- type ImportExpr
- type IncDecStmt
- type IndexExpr
- type IntLit
- type IsModuleLit
- type KeyValueArrayLit
- type KeyValueLit
- type MultiParenExpr
- type NamedArgExpr
- type NamedArgVarLit
- type NamedArgsKeyword
- type NamedArgsList
- type NamedParamSpec
- type NilLit
- type NullishSelectorExpr
- type ParamSpec
- type ParenExpr
- type RawStringLit
- type RawStringStmt
- func (s *RawStringStmt) End() source.Pos
- func (s *RawStringStmt) ExprNode()
- func (s *RawStringStmt) Pos() source.Pos
- func (s *RawStringStmt) Quoted() string
- func (s *RawStringStmt) StmtNode()
- func (s *RawStringStmt) String() string
- func (s *RawStringStmt) TrimLinePrefix(prefix string)
- func (s *RawStringStmt) Unquoted() string
- func (s *RawStringStmt) Value() string
- func (s *RawStringStmt) WriteCode(ctx *CodeWriterContext) (err error)
- type ReturnStmt
- type SelectorExpr
- type SliceExpr
- type Spec
- type StdErrLit
- type StdInLit
- type StdOutLit
- type Stmt
- type StmtsExpr
- type StringLit
- type ThrowStmt
- type TryStmt
- type TypedIdent
- type UintLit
- type UnaryExpr
- type ValueSpec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsStatement ¶
IsStatement returns true if given value is implements interface{ StmtNode() }.
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 ¶
ArgVarLit represents an variadic of argument.
func (*ArgVarLit) WriteCode ¶
func (e *ArgVarLit) WriteCode(ctx *CodeWriterContext) (err error)
type ArgsKeyword ¶
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.
type ArrayLit ¶
ArrayLit represents an array literal.
func (*ArrayLit) WriteCode ¶
func (e *ArrayLit) WriteCode(ctx *CodeWriterContext) (err error)
type AssignStmt ¶
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 ¶
A BadDecl node is a placeholder for declarations containing syntax errors for which no correct declaration nodes can be created.
type BadExpr ¶
BadExpr represents a bad expression.
type BadStmt ¶
BadStmt represents a bad statement.
type BinaryExpr ¶
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 BlockStmt ¶
BlockStmt represents a block statement.
func (*BlockStmt) WriteCode ¶
func (s *BlockStmt) WriteCode(ctx *CodeWriterContext) (err error)
type BoolLit ¶
BoolLit represents a boolean literal.
type BranchStmt ¶
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) 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 ¶
CallExpr represents a function call expression.
type CallExprArgs ¶
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 ¶
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) WriteCode ¶
func (s *CatchStmt) WriteCode(ctx *CodeWriterContext) (err error)
type CharLit ¶
CharLit represents a character literal.
type ClosureLit ¶
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
type Coder ¶
type Coder interface {
WriteCode(ctx *CodeWriterContext) error
}
type CondExpr ¶
CondExpr represents a ternary conditional expression.
type ConfigOptions ¶
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 ¶
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 DeclStmt ¶
type DeclStmt struct {
Decl // *GenDecl with VAR token
}
A DeclStmt node represents a declaration in a statement list.
type DictElementLit ¶
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.
type DotFileLit ¶
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 ¶
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 EmptyStmt ¶
EmptyStmt represents an empty statement.
type ExprSelector ¶
type ExprStmt ¶
type ExprStmt struct {
Expr Expr
}
ExprStmt represents an expression statement.
type ExprToTextStmt ¶
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 ¶
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 ¶
FlagLit represents a yes literal.
type FloatLit ¶
FloatLit represents a floating point literal.
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) WriteCode ¶
func (s *ForInStmt) WriteCode(ctx *CodeWriterContext) (err error)
type ForStmt ¶
ForStmt represents a for statement.
func (*ForStmt) WriteCode ¶
func (s *ForStmt) WriteCode(ctx *CodeWriterContext) (err error)
type FuncLit ¶
FuncLit represents a function literal.
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.
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) WriteCode ¶
func (d *GenDecl) WriteCode(ctx *CodeWriterContext) (err error)
type Ident ¶
Ident represents an identifier.
type IdentList ¶
IdentList represents a list of identifiers.
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) WriteCode ¶
func (s *IfStmt) WriteCode(ctx *CodeWriterContext) (err error)
type ImportExpr ¶
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 ¶
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 ¶
IndexExpr represents an index expression.
type IntLit ¶
IntLit represents an integer literal.
type IsModuleLit ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
NilLit represents an nil literal.
type NullishSelectorExpr ¶
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) WriteCode ¶
func (s *ParamSpec) WriteCode(ctx *CodeWriterContext) (err error)
type ParenExpr ¶
ParenExpr represents a parenthesis wrapped expression.
type RawStringLit ¶
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 ¶
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 ¶
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 ¶
SliceExpr represents a slice expression.
type Spec ¶
Spec node represents a single (non-parenthesized) variable declaration. The Spec type stands for any of *ParamSpec or *ValueSpec.
type StdErrLit ¶
StdErrLit represents an STDERR literal.
type StdInLit ¶
StdInLit represents an STDIN literal.
type StdOutLit ¶
StdOutLit represents an STDOUT literal.
type StmtsExpr ¶
type StmtsExpr struct {
Stmts []Stmt
}
func (*StmtsExpr) WriteCode ¶
func (s *StmtsExpr) WriteCode(ctx *CodeWriterContext) (err error)
type StringLit ¶
StringLit represents a string literal.
type ThrowStmt ¶
ThrowStmt represents an throw statement.
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) WriteCode ¶
func (s *TryStmt) WriteCode(ctx *CodeWriterContext) (err error)
type TypedIdent ¶
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 ¶
UintLit represents an unsigned integer literal.
type UnaryExpr ¶
UnaryExpr represents an unary operator expression.
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) WriteCode ¶
func (s *ValueSpec) WriteCode(ctx *CodeWriterContext) (err error)