Documentation
¶
Index ¶
- func Code(n Coder, opt ...CodeOption) string
- func CodeStmtsW(w io.Writer, n Stmts, opt ...CodeOption)
- func CodeW(w io.Writer, n Coder, opt ...CodeOption)
- func IsExpr(n Node) (ok bool)
- func IsStatement(v Node) (ok bool)
- func Lit(value string, pos source.Pos) ast.Literal
- type ArgVarLit
- type ArgsKeywordExpr
- type ArgsList
- type ArrayExpr
- type AssignStmt
- type BadDecl
- type BadExpr
- type BadStmt
- type BinaryExpr
- type BlockExpr
- type BlockStmt
- func (s *BlockStmt) End() source.Pos
- func (s *BlockStmt) LeftBrace() string
- func (s *BlockStmt) Pos() source.Pos
- func (s *BlockStmt) RightBrace() string
- func (s *BlockStmt) StmtNode()
- func (s *BlockStmt) String() string
- func (s *BlockStmt) WriteCode(ctx *CodeWriteContext)
- func (s *BlockStmt) WriteCodeInSelfDepth(ctx *CodeWriteContext, selfDepth bool)
- 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) ToFuncParams() (fp *FuncParams, err error)
- func (c *CallArgs) WriteCode(ctx *CodeWriteContext)
- func (c *CallArgs) WriteCodeBrace(ctx *CodeWriteContext, lbrace, rbrace string)
- 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 *CodeWriteContext)
- type CalleeKeywordExpr
- type CatchStmt
- type CharLit
- type ClosureExpr
- type CodeBeginStmt
- type CodeEndStmt
- type CodeOption
- type CodeWriteContext
- func (c CodeWriteContext) Buffer(do func(ctx *CodeWriteContext)) string
- func (c *CodeWriteContext) CurrentPrefix() string
- func (c *CodeWriteContext) Pop()
- func (c *CodeWriteContext) PrevPrefix() string
- func (c *CodeWriteContext) Printf(format string, args ...interface{})
- func (c *CodeWriteContext) Push(n ast.Node)
- func (c *CodeWriteContext) Top() ast.Node
- func (c *CodeWriteContext) With(n ast.Node, cb func() error) (err error)
- func (c CodeWriteContext) WithoutPrefix() *CodeWriteContext
- func (c *CodeWriteContext) WriteExprs(sep string, expr ...Expr)
- func (c *CodeWriteContext) WriteLine(s string)
- func (c *CodeWriteContext) WritePrefix()
- func (c *CodeWriteContext) WritePrefixedLine()
- func (c *CodeWriteContext) WritePrevPrefix()
- func (c *CodeWriteContext) WriteSecondLine()
- func (c *CodeWriteContext) WriteSemi()
- func (c *CodeWriteContext) WriteSemiOrDoubleLine()
- func (c *CodeWriteContext) WriteStmts(smt ...Stmt)
- type CodeWriter
- type Coder
- type CondExpr
- type ConfigOptions
- type ConfigStmt
- type DecimalLit
- type Decl
- type DeclStmt
- type DictElementFuncExpr
- type DictElementLit
- func (e *DictElementLit) End() source.Pos
- func (e *DictElementLit) ExprNode()
- func (e *DictElementLit) Func() (f *DictElementFuncExpr)
- func (e *DictElementLit) IsFunc() (ok bool)
- func (e *DictElementLit) Pos() source.Pos
- func (e *DictElementLit) String() string
- func (e *DictElementLit) WriteCode(ctx *CodeWriteContext)
- type DictExpr
- type DotFileLit
- type DotFileNameLit
- type EmbedExpr
- type EmptyStmt
- type Expr
- type ExprSelector
- type ExprStmt
- type Exprs
- type FinallyStmt
- type FlagLit
- type FloatLit
- type ForInStmt
- type ForStmt
- type FuncExpr
- type FuncParams
- type FuncType
- type GenDecl
- type IdentExpr
- type IdentList
- type IfStmt
- type ImportExpr
- type IncDecStmt
- type IndexExpr
- type IntLit
- type IsModuleLit
- type KeyValueArrayLit
- type KeyValueLit
- type KeyValuePairLit
- type KeyValueSepLit
- type MixedTextExpr
- type MixedTextStmt
- func (s *MixedTextStmt) End() source.Pos
- func (s *MixedTextStmt) ExprNode()
- func (s *MixedTextStmt) Pos() source.Pos
- func (s *MixedTextStmt) StmtNode()
- func (s *MixedTextStmt) String() string
- func (s *MixedTextStmt) TrimLinePrefix(prefix string)
- func (s *MixedTextStmt) ValidLit() ast.Literal
- func (s *MixedTextStmt) Value() string
- func (s *MixedTextStmt) WriteCode(ctx *CodeWriteContext)
- type MixedTextStmtFlag
- type MixedValueStmt
- type MultiParenExpr
- func (e *MultiParenExpr) End() source.Pos
- func (e *MultiParenExpr) ExprNode()
- func (e *MultiParenExpr) Pos() source.Pos
- func (e *MultiParenExpr) Split() (left []Expr, right []Expr)
- func (e *MultiParenExpr) String() string
- func (e *MultiParenExpr) ToCallArgs(strict bool) (args *CallArgs, err *NodeError)
- func (e *MultiParenExpr) ToFuncParams() (params FuncParams, err *NodeError)
- func (e *MultiParenExpr) ToMultiParenExpr() *MultiParenExpr
- func (e *MultiParenExpr) WriteCode(ctx *CodeWriteContext)
- type NamedArgExpr
- type NamedArgVarLit
- type NamedArgsKeywordExpr
- type NamedArgsList
- type NamedParamSpec
- type NilLit
- type Node
- type NodeError
- type NullishSelectorExpr
- type ParamSpec
- type ParenExpr
- type RawHeredocLit
- type RawStringLit
- type Return
- type ReturnExpr
- type ReturnStmt
- type SelectorExpr
- type SliceExpr
- type Spec
- type StdErrLit
- type StdInLit
- type StdOutLit
- type Stmt
- type Stmts
- func (s *Stmts) Append(n ...Stmt)
- func (s Stmts) Each(f func(i int, sep bool, s Stmt))
- func (s Stmts) Filter(f func(i int, s Stmt) bool) (l Stmts)
- func (s Stmts) Map(f func(i int, s Stmt) Stmt) (l Stmts)
- func (s *Stmts) Prepend(n ...Stmt)
- func (s Stmts) String() string
- func (s Stmts) WriteCode(ctx *CodeWriteContext)
- type StmtsExpr
- type StringLit
- type TemplateLit
- type ThrowExpr
- type ThrowStmt
- type ToMultiParenConverter
- type TranspileOptions
- type TryStmt
- type TypedIdentExpr
- type UintLit
- type UnaryExpr
- type ValueSpec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Code ¶
func Code(n Coder, opt ...CodeOption) string
func CodeStmtsW ¶
func CodeStmtsW(w io.Writer, n Stmts, opt ...CodeOption)
func IsStatement ¶
IsStatement returns true if given value is implements interface{ StmtNode() }.
Types ¶
type ArgVarLit ¶
ArgVarLit represents an variadic of argument.
func (*ArgVarLit) WriteCode ¶
func (e *ArgVarLit) WriteCode(ctx *CodeWriteContext)
type ArgsKeywordExpr ¶
func ArgsKW ¶
func ArgsKW(pos source.Pos) *ArgsKeywordExpr
func (*ArgsKeywordExpr) End ¶
func (c *ArgsKeywordExpr) End() source.Pos
func (*ArgsKeywordExpr) ExprNode ¶
func (c *ArgsKeywordExpr) ExprNode()
func (*ArgsKeywordExpr) Pos ¶
func (c *ArgsKeywordExpr) Pos() source.Pos
func (*ArgsKeywordExpr) String ¶
func (c *ArgsKeywordExpr) String() string
func (*ArgsKeywordExpr) WriteCode ¶
func (c *ArgsKeywordExpr) WriteCode(ctx *CodeWriteContext)
type ArgsList ¶
type ArgsList struct {
Var *TypedIdentExpr
Values []*TypedIdentExpr
}
ArgsList represents a list of identifiers.
func Args ¶
func Args(vari *TypedIdentExpr, names ...Expr) ArgsList
func (*ArgsList) PrependValue ¶
func (n *ArgsList) PrependValue(v ...*TypedIdentExpr)
type ArrayExpr ¶
ArrayExpr represents an array literal.
func (*ArrayExpr) WriteCode ¶
func (e *ArrayExpr) WriteCode(ctx *CodeWriteContext)
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 *CodeWriteContext)
type BadDecl ¶
A BadDecl node is a placeholder for declarations containing syntax errors for which no correct declaration nodes can be created.
func (*BadDecl) WriteCode ¶
func (d *BadDecl) WriteCode(ctx *CodeWriteContext)
type BadExpr ¶
BadExpr represents a bad expression.
func (*BadExpr) WriteCode ¶
func (e *BadExpr) WriteCode(ctx *CodeWriteContext)
type BadStmt ¶
BadStmt represents a bad statement.
func (*BadStmt) WriteCode ¶
func (s *BadStmt) WriteCode(ctx *CodeWriteContext)
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 *CodeWriteContext)
type BlockStmt ¶
BlockStmt represents a block statement.
func (*BlockStmt) RightBrace ¶
func (*BlockStmt) WriteCode ¶
func (s *BlockStmt) WriteCode(ctx *CodeWriteContext)
func (*BlockStmt) WriteCodeInSelfDepth ¶
func (s *BlockStmt) WriteCodeInSelfDepth(ctx *CodeWriteContext, selfDepth bool)
type BoolLit ¶
BoolLit represents a boolean literal.
func (*BoolLit) WriteCode ¶
func (e *BoolLit) WriteCode(ctx *CodeWriteContext)
type BranchStmt ¶
BranchStmt represents a branch statement.
func SBreak ¶
func SBreak(pos source.Pos) *BranchStmt
func SContinue ¶
func SContinue(pos source.Pos) *BranchStmt
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
func (*BranchStmt) WriteCode ¶
func (s *BranchStmt) WriteCode(ctx *CodeWriteContext)
type CallArgs ¶
type CallArgs struct {
LParen source.Pos
Args CallExprArgs
NamedArgs CallExprNamedArgs
RParen source.Pos
}
func (*CallArgs) ToFuncParams ¶
func (c *CallArgs) ToFuncParams() (fp *FuncParams, err error)
func (*CallArgs) WriteCode ¶
func (c *CallArgs) WriteCode(ctx *CodeWriteContext)
func (*CallArgs) WriteCodeBrace ¶
func (c *CallArgs) WriteCodeBrace(ctx *CodeWriteContext, lbrace, rbrace string)
type CallExpr ¶
CallExpr represents a function call expression.
func ECallProxy ¶
func (*CallExpr) WriteCode ¶
func (e *CallExpr) WriteCode(ctx *CodeWriteContext)
type CallExprArgs ¶
CallExprArgs represents a call expression arguments.
func NewCallExprArgs ¶
func NewCallExprArgs( argVar *ArgVarLit, args ...Expr, ) (ce CallExprArgs)
func (*CallExprArgs) String ¶
func (a *CallExprArgs) String() string
func (*CallExprArgs) Valid ¶
func (a *CallExprArgs) Valid() bool
func (*CallExprArgs) WriteCode ¶
func (a *CallExprArgs) WriteCode(ctx *CodeWriteContext)
type CallExprNamedArgs ¶
type CallExprNamedArgs struct {
Names []NamedArgExpr
Values []Expr
Var *NamedArgVarLit
}
CallExprNamedArgs represents a call expression keyword arguments.
func NewCallExprNamedArgs ¶
func NewCallExprNamedArgs( argVar *NamedArgVarLit, names []NamedArgExpr, values []Expr, ) (ce CallExprNamedArgs)
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 *CodeWriteContext)
type CalleeKeywordExpr ¶
func CaleeKW ¶
func CaleeKW(pos source.Pos) *CalleeKeywordExpr
func (*CalleeKeywordExpr) End ¶
func (c *CalleeKeywordExpr) End() source.Pos
func (*CalleeKeywordExpr) ExprNode ¶
func (c *CalleeKeywordExpr) ExprNode()
func (*CalleeKeywordExpr) Pos ¶
func (c *CalleeKeywordExpr) Pos() source.Pos
func (*CalleeKeywordExpr) String ¶
func (c *CalleeKeywordExpr) String() string
func (*CalleeKeywordExpr) WriteCode ¶
func (c *CalleeKeywordExpr) WriteCode(ctx *CodeWriteContext)
type CatchStmt ¶
type CatchStmt struct {
CatchPos source.Pos
Ident *IdentExpr // can be nil if ident is missing
Body *BlockStmt
}
CatchStmt represents an catch statement.
func (*CatchStmt) WriteCode ¶
func (s *CatchStmt) WriteCode(ctx *CodeWriteContext)
type CharLit ¶
CharLit represents a character literal.
func (*CharLit) WriteCode ¶
func (e *CharLit) WriteCode(ctx *CodeWriteContext)
type ClosureExpr ¶
type ClosureExpr struct {
ast.NodeData
Params FuncParams
LambdaToken token.Token
LambdaPos source.Pos
Body Expr
}
ClosureExpr represents a function closure literal.
func EClosure ¶
func EClosure(funcType *FuncType, body Expr) *ClosureExpr
func (*ClosureExpr) End ¶
func (e *ClosureExpr) End() source.Pos
End returns the position of first character immediately after the node.
func (*ClosureExpr) ExprNode ¶
func (e *ClosureExpr) ExprNode()
func (*ClosureExpr) Pos ¶
func (e *ClosureExpr) Pos() source.Pos
Pos returns the position of first character belonging to the node.
func (*ClosureExpr) String ¶
func (e *ClosureExpr) String() string
func (*ClosureExpr) WriteCode ¶
func (e *ClosureExpr) WriteCode(ctx *CodeWriteContext)
type CodeBeginStmt ¶
func SCodeBegin ¶
func SCodeBegin(lit ast.Literal, removeSpace bool) *CodeBeginStmt
func (CodeBeginStmt) End ¶
func (s CodeBeginStmt) End() source.Pos
func (CodeBeginStmt) Pos ¶
func (s CodeBeginStmt) Pos() source.Pos
func (CodeBeginStmt) StmtNode ¶
func (s CodeBeginStmt) StmtNode()
func (CodeBeginStmt) String ¶
func (s CodeBeginStmt) String() string
func (*CodeBeginStmt) WriteCode ¶
func (s *CodeBeginStmt) WriteCode(ctx *CodeWriteContext)
type CodeEndStmt ¶
func (CodeEndStmt) End ¶
func (s CodeEndStmt) End() source.Pos
func (CodeEndStmt) Pos ¶
func (s CodeEndStmt) Pos() source.Pos
func (CodeEndStmt) StmtNode ¶
func (s CodeEndStmt) StmtNode()
func (CodeEndStmt) String ¶
func (s CodeEndStmt) String() string
func (*CodeEndStmt) WriteCode ¶
func (s *CodeEndStmt) WriteCode(ctx *CodeWriteContext)
type CodeOption ¶
type CodeOption func(ctx *CodeWriteContext)
func CodeTranspile ¶
func CodeTranspile(v *TranspileOptions) CodeOption
func CodeWithPrefix ¶
func CodeWithPrefix(prefix string) CodeOption
type CodeWriteContext ¶
type CodeWriteContext struct {
Stack []ast.Node
Depth int
Prefix string
Transpile *TranspileOptions
CodeWriter
}
func NewCodeWriteContext ¶
func NewCodeWriteContext(codeWriter CodeWriter, opt ...CodeOption) *CodeWriteContext
func (CodeWriteContext) Buffer ¶
func (c CodeWriteContext) Buffer(do func(ctx *CodeWriteContext)) string
func (*CodeWriteContext) CurrentPrefix ¶
func (c *CodeWriteContext) CurrentPrefix() string
func (*CodeWriteContext) Pop ¶
func (c *CodeWriteContext) Pop()
func (*CodeWriteContext) PrevPrefix ¶
func (c *CodeWriteContext) PrevPrefix() string
func (*CodeWriteContext) Printf ¶
func (c *CodeWriteContext) Printf(format string, args ...interface{})
func (*CodeWriteContext) Push ¶
func (c *CodeWriteContext) Push(n ast.Node)
func (*CodeWriteContext) Top ¶
func (c *CodeWriteContext) Top() ast.Node
func (*CodeWriteContext) With ¶
func (c *CodeWriteContext) With(n ast.Node, cb func() error) (err error)
func (CodeWriteContext) WithoutPrefix ¶
func (c CodeWriteContext) WithoutPrefix() *CodeWriteContext
func (*CodeWriteContext) WriteExprs ¶
func (c *CodeWriteContext) WriteExprs(sep string, expr ...Expr)
func (*CodeWriteContext) WriteLine ¶
func (c *CodeWriteContext) WriteLine(s string)
func (*CodeWriteContext) WritePrefix ¶
func (c *CodeWriteContext) WritePrefix()
func (*CodeWriteContext) WritePrefixedLine ¶
func (c *CodeWriteContext) WritePrefixedLine()
func (*CodeWriteContext) WritePrevPrefix ¶
func (c *CodeWriteContext) WritePrevPrefix()
func (*CodeWriteContext) WriteSecondLine ¶
func (c *CodeWriteContext) WriteSecondLine()
func (*CodeWriteContext) WriteSemi ¶
func (c *CodeWriteContext) WriteSemi()
func (*CodeWriteContext) WriteSemiOrDoubleLine ¶
func (c *CodeWriteContext) WriteSemiOrDoubleLine()
func (*CodeWriteContext) WriteStmts ¶
func (c *CodeWriteContext) WriteStmts(smt ...Stmt)
type CodeWriter ¶
type CodeWriter interface {
io.Writer
WriteString(s ...string)
WriteSingleByte(b byte)
WriteRune(b rune)
WriteLine(s ...string)
WriteLines(l ...string)
}
func NewCodeWriter ¶
func NewCodeWriter(w io.Writer) CodeWriter
type Coder ¶
type Coder interface {
WriteCode(ctx *CodeWriteContext)
}
type CondExpr ¶
CondExpr represents a ternary conditional expression.
func (*CondExpr) WriteCode ¶
func (e *CondExpr) WriteCode(ctx *CodeWriteContext)
type ConfigOptions ¶
type ConfigStmt ¶
type ConfigStmt struct {
ConfigPos source.Pos
Elements []*KeyValuePairLit
Options ConfigOptions
}
func SConfig ¶
func SConfig(start source.Pos, opts ...*KeyValuePairLit) *ConfigStmt
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
func (*ConfigStmt) WriteCode ¶
func (c *ConfigStmt) WriteCode(ctx *CodeWriteContext)
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
func (*DecimalLit) WriteCode ¶
func (e *DecimalLit) WriteCode(ctx *CodeWriteContext)
type DeclStmt ¶
type DeclStmt struct {
Decl // *GenDecl with VAR token
}
A DeclStmt node represents a declaration in a statement list.
type DictElementFuncExpr ¶
type DictElementFuncExpr struct {
Expr
}
func EDictElementClosure ¶
func EDictElementClosure(c *ClosureExpr) *DictElementFuncExpr
func EDictElementFunc ¶
func EDictElementFunc(f *FuncExpr) *DictElementFuncExpr
func (*DictElementFuncExpr) Closure ¶
func (e *DictElementFuncExpr) Closure() (c *ClosureExpr)
func (*DictElementFuncExpr) Func ¶
func (e *DictElementFuncExpr) Func() (f *FuncExpr)
type DictElementLit ¶
DictElementLit represents a map element.
func MapElement ¶
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) Func ¶
func (e *DictElementLit) Func() (f *DictElementFuncExpr)
func (*DictElementLit) IsFunc ¶
func (e *DictElementLit) IsFunc() (ok bool)
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
func (*DictElementLit) WriteCode ¶
func (e *DictElementLit) WriteCode(ctx *CodeWriteContext)
type DictExpr ¶
type DictExpr struct {
LBrace source.Pos
Elements []*DictElementLit
RBrace source.Pos
}
DictExpr represents a map literal.
func (*DictExpr) WriteCode ¶
func (e *DictExpr) WriteCode(ctx *CodeWriteContext)
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
func (*DotFileLit) WriteCode ¶
func (e *DotFileLit) WriteCode(ctx *CodeWriteContext)
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
func (*DotFileNameLit) WriteCode ¶
func (e *DotFileNameLit) WriteCode(ctx *CodeWriteContext)
type EmbedExpr ¶
EmbedExpr represents an embed expression
func (*EmbedExpr) WriteCode ¶
func (e *EmbedExpr) WriteCode(ctx *CodeWriteContext)
type EmptyStmt ¶
EmptyStmt represents an empty statement.
func (*EmptyStmt) WriteCode ¶
func (s *EmptyStmt) WriteCode(*CodeWriteContext)
type ExprSelector ¶
type ExprStmt ¶
type ExprStmt struct {
Expr Expr
}
ExprStmt represents an expression statement.
func (*ExprStmt) WriteCode ¶
func (s *ExprStmt) WriteCode(ctx *CodeWriteContext)
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 *CodeWriteContext)
type FlagLit ¶
FlagLit represents a yes literal.
func (*FlagLit) WriteCode ¶
func (e *FlagLit) WriteCode(ctx *CodeWriteContext)
type FloatLit ¶
FloatLit represents a floating point literal.
func (*FloatLit) WriteCode ¶
func (e *FloatLit) WriteCode(ctx *CodeWriteContext)
type ForInStmt ¶
type ForInStmt struct {
ForPos source.Pos
Key *IdentExpr
Value *IdentExpr
Iterable Expr
Body *BlockStmt
Else *BlockStmt
}
ForInStmt represents a for-in statement.
func (*ForInStmt) WriteCode ¶
func (s *ForInStmt) WriteCode(ctx *CodeWriteContext)
type ForStmt ¶
ForStmt represents a for statement.
func (*ForStmt) WriteCode ¶
func (s *ForStmt) WriteCode(ctx *CodeWriteContext)
type FuncExpr ¶
type FuncExpr struct {
ast.NodeData
Type *FuncType
Body *BlockStmt
LambdaPos source.Pos
BodyExpr Expr
}
FuncExpr represents a function literal.
func EFuncBodyE ¶
func (*FuncExpr) WriteCode ¶
func (e *FuncExpr) WriteCode(ctx *CodeWriteContext)
type FuncParams ¶
type FuncParams struct {
LParen source.Pos
Args ArgsList
NamedArgs NamedArgsList
RParen source.Pos
}
FuncParams represents a function paramsw.
func (*FuncParams) Caller ¶
func (n *FuncParams) Caller() (c *CallArgs)
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
func (FuncParams) WithNamedValuesNil ¶
func (n FuncParams) WithNamedValuesNil() (c *FuncParams)
type FuncType ¶
type FuncType struct {
FuncPos source.Pos
Ident *IdentExpr
Params FuncParams
AllowMethods bool
}
FuncType represents a function type definition.
func ProxyFuncType ¶
func ProxyFuncType() *FuncType
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 *CodeWriteContext)
type IdentExpr ¶
IdentExpr represents an identifier.
func EEmptyIdent ¶
func (*IdentExpr) WriteCode ¶
func (e *IdentExpr) WriteCode(ctx *CodeWriteContext)
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 *CodeWriteContext)
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
func (*ImportExpr) WriteCode ¶
func (e *ImportExpr) WriteCode(ctx *CodeWriteContext)
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 *CodeWriteContext)
type IndexExpr ¶
IndexExpr represents an index expression.
func (*IndexExpr) WriteCode ¶
func (e *IndexExpr) WriteCode(ctx *CodeWriteContext)
type IntLit ¶
IntLit represents an integer literal.
func (*IntLit) WriteCode ¶
func (e *IntLit) WriteCode(ctx *CodeWriteContext)
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
func (*IsModuleLit) WriteCode ¶
func (e *IsModuleLit) WriteCode(ctx *CodeWriteContext)
type KeyValueArrayLit ¶
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) ToMultiParenExpr ¶
func (e *KeyValueArrayLit) ToMultiParenExpr() *MultiParenExpr
func (*KeyValueArrayLit) WriteCode ¶
func (e *KeyValueArrayLit) WriteCode(ctx *CodeWriteContext)
type KeyValueLit ¶
KeyValueLit represents a key value element.
func KV ¶
func KV(key Expr, value ...Expr) *KeyValueLit
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 *CodeWriteContext)
type KeyValuePairLit ¶
KeyValuePairLit represents a key value pair element.
func KVp ¶
func KVp(key Expr, value ...Expr) *KeyValuePairLit
func (*KeyValuePairLit) End ¶
func (e *KeyValuePairLit) End() source.Pos
End returns the position of first character immediately after the node.
func (*KeyValuePairLit) ExprNode ¶
func (e *KeyValuePairLit) ExprNode()
func (*KeyValuePairLit) Pos ¶
func (e *KeyValuePairLit) Pos() source.Pos
Pos returns the position of first character belonging to the node.
func (*KeyValuePairLit) String ¶
func (e *KeyValuePairLit) String() string
func (*KeyValuePairLit) WriteCode ¶
func (e *KeyValuePairLit) WriteCode(ctx *CodeWriteContext)
type KeyValueSepLit ¶
KeyValueSepLit represents a key value separator in paren context
func (*KeyValueSepLit) End ¶
func (e *KeyValueSepLit) End() source.Pos
End returns the position of first character immediately after the node.
func (*KeyValueSepLit) ExprNode ¶
func (e *KeyValueSepLit) ExprNode()
func (*KeyValueSepLit) Pos ¶
func (e *KeyValueSepLit) Pos() source.Pos
Pos returns the position of first character belonging to the node.
func (*KeyValueSepLit) String ¶
func (e *KeyValueSepLit) String() string
func (*KeyValueSepLit) WriteCode ¶
func (e *KeyValueSepLit) WriteCode(ctx *CodeWriteContext)
type MixedTextExpr ¶
type MixedTextExpr struct {
StartLit ast.Literal
EndLit ast.Literal
Stmt MixedTextStmt
}
func (*MixedTextExpr) End ¶
func (e *MixedTextExpr) End() source.Pos
func (*MixedTextExpr) ExprNode ¶
func (e *MixedTextExpr) ExprNode()
func (*MixedTextExpr) Pos ¶
func (e *MixedTextExpr) Pos() source.Pos
func (*MixedTextExpr) String ¶
func (e *MixedTextExpr) String() string
func (*MixedTextExpr) WriteCode ¶
func (e *MixedTextExpr) WriteCode(ctx *CodeWriteContext)
type MixedTextStmt ¶
type MixedTextStmt struct {
Lit ast.Literal
Flags MixedTextStmtFlag
LParen source.Pos
RParen source.Pos
}
MixedTextStmt represents an MixedTextStmt.
func SMixedText ¶
func SMixedText(pos source.Pos, vlit string, flags ...MixedTextStmtFlag) *MixedTextStmt
func (*MixedTextStmt) End ¶
func (s *MixedTextStmt) End() source.Pos
func (*MixedTextStmt) ExprNode ¶
func (s *MixedTextStmt) ExprNode()
func (*MixedTextStmt) Pos ¶
func (s *MixedTextStmt) Pos() source.Pos
func (*MixedTextStmt) StmtNode ¶
func (s *MixedTextStmt) StmtNode()
func (*MixedTextStmt) String ¶
func (s *MixedTextStmt) String() string
func (*MixedTextStmt) TrimLinePrefix ¶
func (s *MixedTextStmt) TrimLinePrefix(prefix string)
func (*MixedTextStmt) ValidLit ¶
func (s *MixedTextStmt) ValidLit() ast.Literal
func (*MixedTextStmt) Value ¶
func (s *MixedTextStmt) Value() string
func (*MixedTextStmt) WriteCode ¶
func (s *MixedTextStmt) WriteCode(ctx *CodeWriteContext)
type MixedTextStmtFlag ¶
type MixedTextStmtFlag uint
const ( RemoveLeftSpaces MixedTextStmtFlag = 1 << iota RemoveRightSpaces )
func (MixedTextStmtFlag) Has ¶
func (s MixedTextStmtFlag) Has(f MixedTextStmtFlag) bool
func (MixedTextStmtFlag) String ¶
func (s MixedTextStmtFlag) String() string
type MixedValueStmt ¶
type MixedValueStmt struct {
Expr Expr
StartLit ast.Literal
EndLit ast.Literal
RemoveLeftSpace bool
RemoveRightSpace bool
Eq bool
}
MixedValueStmt represents to text wrapped expression.
func SMixedValue ¶
func SMixedValue(start, end ast.Literal, expr Expr) *MixedValueStmt
func (*MixedValueStmt) End ¶
func (s *MixedValueStmt) End() source.Pos
End returns the position of first character immediately after the node.
func (*MixedValueStmt) ExprNode ¶
func (s *MixedValueStmt) ExprNode()
func (*MixedValueStmt) Pos ¶
func (s *MixedValueStmt) Pos() source.Pos
Pos returns the position of first character belonging to the node.
func (*MixedValueStmt) StmtNode ¶
func (s *MixedValueStmt) StmtNode()
func (*MixedValueStmt) String ¶
func (s *MixedValueStmt) String() string
func (*MixedValueStmt) WriteCode ¶
func (s *MixedValueStmt) WriteCode(ctx *CodeWriteContext)
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) Split ¶
func (e *MultiParenExpr) Split() (left []Expr, right []Expr)
func (*MultiParenExpr) String ¶
func (e *MultiParenExpr) String() string
func (*MultiParenExpr) ToCallArgs ¶
func (e *MultiParenExpr) ToCallArgs(strict bool) (args *CallArgs, err *NodeError)
func (*MultiParenExpr) ToFuncParams ¶
func (e *MultiParenExpr) ToFuncParams() (params FuncParams, err *NodeError)
func (*MultiParenExpr) ToMultiParenExpr ¶
func (e *MultiParenExpr) ToMultiParenExpr() *MultiParenExpr
func (*MultiParenExpr) WriteCode ¶
func (e *MultiParenExpr) WriteCode(ctx *CodeWriteContext)
type NamedArgExpr ¶
func (*NamedArgExpr) Expr ¶
func (e *NamedArgExpr) Expr() Expr
func (*NamedArgExpr) Name ¶
func (e *NamedArgExpr) Name() string
func (*NamedArgExpr) String ¶
func (e *NamedArgExpr) String() string
func (*NamedArgExpr) WriteCode ¶
func (e *NamedArgExpr) WriteCode(ctx *CodeWriteContext)
type NamedArgVarLit ¶
NamedArgVarLit represents an variadic of named argument.
func NamedArgVar ¶
func NamedArgVar(pos source.Pos, value Expr) *NamedArgVarLit
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 *CodeWriteContext)
type NamedArgsKeywordExpr ¶
func NamedArgsKW ¶
func NamedArgsKW(pos source.Pos) *NamedArgsKeywordExpr
func (*NamedArgsKeywordExpr) End ¶
func (c *NamedArgsKeywordExpr) End() source.Pos
func (*NamedArgsKeywordExpr) ExprNode ¶
func (c *NamedArgsKeywordExpr) ExprNode()
func (*NamedArgsKeywordExpr) Pos ¶
func (c *NamedArgsKeywordExpr) Pos() source.Pos
func (*NamedArgsKeywordExpr) String ¶
func (c *NamedArgsKeywordExpr) String() string
func (*NamedArgsKeywordExpr) WriteCode ¶
func (c *NamedArgsKeywordExpr) WriteCode(ctx *CodeWriteContext)
type NamedArgsList ¶
type NamedArgsList struct {
Var *TypedIdentExpr
Names []*TypedIdentExpr
Values []Expr
}
NamedArgsList represents a list of identifier with value pairs.
func NamedArgs ¶
func NamedArgs(vari *TypedIdentExpr, names []*TypedIdentExpr, values []Expr) NamedArgsList
func (*NamedArgsList) Add ¶
func (n *NamedArgsList) Add(name *TypedIdentExpr, 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 *TypedIdentExpr
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 *CodeWriteContext)
type NilLit ¶
NilLit represents an nil literal.
func (*NilLit) WriteCode ¶
func (e *NilLit) WriteCode(ctx *CodeWriteContext)
type NullishSelectorExpr ¶
NullishSelectorExpr represents a selector expression.
func ENullish ¶
func ENullish( sel, expr Expr, ) *NullishSelectorExpr
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
func (*NullishSelectorExpr) WriteCode ¶
func (e *NullishSelectorExpr) WriteCode(ctx *CodeWriteContext)
type ParamSpec ¶
type ParamSpec struct {
Ident *TypedIdentExpr
Variadic bool
}
A ParamSpec node represents a parameter declaration
func (*ParamSpec) WriteCode ¶
func (s *ParamSpec) WriteCode(ctx *CodeWriteContext)
type ParenExpr ¶
ParenExpr represents a parenthesis wrapped expression.
func (*ParenExpr) ToMultiParenExpr ¶
func (e *ParenExpr) ToMultiParenExpr() *MultiParenExpr
func (*ParenExpr) WriteCode ¶
func (e *ParenExpr) WriteCode(ctx *CodeWriteContext)
type RawHeredocLit ¶
func RawHeredoc ¶
func RawHeredoc(value string, pos source.Pos) *RawHeredocLit
func (*RawHeredocLit) End ¶
func (e *RawHeredocLit) End() source.Pos
End returns the position of first character immediately after the node.
func (*RawHeredocLit) ExprNode ¶
func (e *RawHeredocLit) ExprNode()
func (*RawHeredocLit) Pos ¶
func (e *RawHeredocLit) Pos() source.Pos
Pos returns the position of first character belonging to the node.
func (*RawHeredocLit) String ¶
func (e *RawHeredocLit) String() string
func (*RawHeredocLit) Value ¶
func (e *RawHeredocLit) Value() string
func (*RawHeredocLit) WriteCode ¶
func (e *RawHeredocLit) WriteCode(ctx *CodeWriteContext)
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
func (*RawStringLit) WriteCode ¶
func (e *RawStringLit) WriteCode(ctx *CodeWriteContext)
type Return ¶
Return represents an return expression.
func (*Return) WriteCode ¶
func (s *Return) WriteCode(ctx *CodeWriteContext)
type ReturnExpr ¶
type ReturnExpr struct {
Return
}
ReturnExpr represents an return expression.
func EReturnExpr ¶
func EReturnExpr(pos source.Pos, result Expr) *ReturnExpr
func (*ReturnExpr) ExprNode ¶
func (s *ReturnExpr) ExprNode()
type ReturnStmt ¶
type ReturnStmt struct {
Return
}
ReturnStmt represents a return statement.
func (*ReturnStmt) StmtNode ¶
func (s *ReturnStmt) StmtNode()
func (*ReturnStmt) WriteCode ¶
func (s *ReturnStmt) WriteCode(ctx *CodeWriteContext)
type SelectorExpr ¶
SelectorExpr represents a selector expression.
func ESelector ¶
func ESelector(x, sel Expr) *SelectorExpr
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
func (*SelectorExpr) WriteCode ¶
func (e *SelectorExpr) WriteCode(ctx *CodeWriteContext)
type SliceExpr ¶
SliceExpr represents a slice expression.
func (*SliceExpr) WriteCode ¶
func (e *SliceExpr) WriteCode(ctx *CodeWriteContext)
type Spec ¶
Spec node represents a single (non-parenthesized) variable declaration. The Spec type stands for any of *ParamSpec or *ValueSpec.
func NewNamedParamSpec ¶
func NewNamedParamSpec(ident *TypedIdentExpr, value Expr) Spec
func NewParamSpec ¶
func NewParamSpec(variadic bool, ident *TypedIdentExpr) Spec
func NewValueSpec ¶
type StdErrLit ¶
StdErrLit represents an STDERR literal.
func (*StdErrLit) WriteCode ¶
func (e *StdErrLit) WriteCode(ctx *CodeWriteContext)
type StdInLit ¶
StdInLit represents an STDIN literal.
func (*StdInLit) WriteCode ¶
func (e *StdInLit) WriteCode(ctx *CodeWriteContext)
type StdOutLit ¶
StdOutLit represents an STDOUT literal.
func (*StdOutLit) WriteCode ¶
func (e *StdOutLit) WriteCode(ctx *CodeWriteContext)
type Stmts ¶
type Stmts []Stmt
func (Stmts) WriteCode ¶
func (s Stmts) WriteCode(ctx *CodeWriteContext)
type StmtsExpr ¶
type StmtsExpr struct {
Stmts Stmts
}
func (*StmtsExpr) WriteCode ¶
func (s *StmtsExpr) WriteCode(ctx *CodeWriteContext)
type StringLit ¶
StringLit represents a string literal.
func (*StringLit) WriteCode ¶
func (e *StringLit) WriteCode(ctx *CodeWriteContext)
type TemplateLit ¶
TemplateLit represents an variadic of argument.
func (*TemplateLit) End ¶
func (e *TemplateLit) End() source.Pos
func (*TemplateLit) ExprNode ¶
func (e *TemplateLit) ExprNode()
func (*TemplateLit) Pos ¶
func (e *TemplateLit) Pos() source.Pos
func (*TemplateLit) String ¶
func (e *TemplateLit) String() string
func (*TemplateLit) WriteCode ¶
func (e *TemplateLit) WriteCode(ctx *CodeWriteContext)
type ThrowExpr ¶
ThrowExpr represents an throw expression.
func (*ThrowExpr) WriteCode ¶
func (s *ThrowExpr) WriteCode(ctx *CodeWriteContext)
type ThrowStmt ¶
ThrowStmt represents an throw statement.
func (*ThrowStmt) WriteCode ¶
func (s *ThrowStmt) WriteCode(ctx *CodeWriteContext)
type ToMultiParenConverter ¶
type ToMultiParenConverter interface {
Expr
ToMultiParenExpr() *MultiParenExpr
}
type TranspileOptions ¶
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 *CodeWriteContext)
type TypedIdentExpr ¶
func ETypedIdent ¶
func ETypedIdent(ident *IdentExpr, typ ...*IdentExpr) *TypedIdentExpr
func (*TypedIdentExpr) End ¶
func (e *TypedIdentExpr) End() source.Pos
End returns the position of first character immediately after the node.
func (*TypedIdentExpr) ExprNode ¶
func (e *TypedIdentExpr) ExprNode()
func (*TypedIdentExpr) Pos ¶
func (e *TypedIdentExpr) Pos() source.Pos
Pos returns the position of first character belonging to the node.
func (*TypedIdentExpr) String ¶
func (e *TypedIdentExpr) String() string
func (*TypedIdentExpr) WriteCode ¶
func (e *TypedIdentExpr) WriteCode(ctx *CodeWriteContext)
type UintLit ¶
UintLit represents an unsigned integer literal.
func (*UintLit) WriteCode ¶
func (e *UintLit) WriteCode(ctx *CodeWriteContext)
type UnaryExpr ¶
UnaryExpr represents an unary operator expression.
func (*UnaryExpr) WriteCode ¶
func (e *UnaryExpr) WriteCode(ctx *CodeWriteContext)
type ValueSpec ¶
type ValueSpec struct {
Idents []*IdentExpr // 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 *CodeWriteContext)