Documentation
¶
Index ¶
- func AddVariable(ctx *Context, name string, pos token.Pos) symbol.Symbol
- func AddVariableToScope(ctx *Context, scope *symbol.Scope, name string, pos token.Pos) symbol.Symbol
- type AST
- type ASTs
- type AndExpr
- type AnonFuncExpr
- type ArrayElement
- type ArrayElementBlock
- type ArrayLiteral
- type AssignOpStmt
- type AssignOperator
- type AssignStmt
- type BinaryExpr
- type BreakContinueEmitter
- type BreakStmt
- type Context
- func (c *Context) CurrentFunc() *Func
- func (c *Context) CurrentScope() *symbol.Scope
- func (c *Context) Emitter() *vm.Emitter
- func (c *Context) FindSymbol(symName string) symbol.Symbol
- func (c *Context) IsInLiftableScope() bool
- func (c *Context) Len() int
- func (c *Context) Main() *Main
- func (c *Context) ModuleRegistry() *ModuleRegistry
- func (c *Context) Parent() AST
- func (c *Context) Peek(n int) AST
- func (c *Context) RunPassChild(parent AST, child AST, pass Pass)
- type ContinueStmt
- type DeferStmt
- type Expr
- type ExprStmt
- type Exprs
- type ExternFn
- type ForStmt
- func (s *ForStmt) EmitBreak(pos token.Pos, e *vm.Emitter)
- func (s *ForStmt) EmitContinue(pos token.Pos, e *vm.Emitter)
- func (s *ForStmt) IsLiftableScope()
- func (b *ForStmt) Pos() token.Pos
- func (s *ForStmt) RunPass(ctx *Context, pass Pass)
- func (s *ForStmt) Scope() *symbol.Scope
- func (b *ForStmt) SetPos(pos token.Pos)
- type ForVar
- type Func
- func (f *Func) IdxFunc() int
- func (f *Func) IsIter() bool
- func (f *Func) IsLiftableScope()
- func (f *Func) IterNRet() int
- func (f *Func) NewCapture(sym symbol.Symbol) *symbol.CaptureSymbol
- func (f *Func) NewLocal() *symbol.LocalVarSymbol
- func (f *Func) NewParam() *symbol.ParamSymbol
- func (b *Func) Pos() token.Pos
- func (f *Func) RunPass(ctx *Context, pass Pass)
- func (f *Func) Scope() *symbol.Scope
- func (f *Func) SetIterNRet(nret int)
- func (b *Func) SetPos(pos token.Pos)
- type FuncCallExpr
- type FuncParam
- type FuncStmt
- type GraphPrinter
- type IfBlock
- type IfStmt
- type Import
- type IncDecOp
- type IncDecStmt
- type IndexExpr
- type LValue
- type LiftableScope
- type LiteralExpr
- type Main
- func (m *Main) AddGlobalParam(ctx *Context, name string, param *meta.Param, pos token.Pos) symbol.Symbol
- func (m *Main) AddModule(module AST)
- func (m *Main) AddNativeFn(name string, extFn *vm.NativeFn)
- func (m *Main) Metadata() *meta.Metadata
- func (m *Main) NewGlobal() *symbol.GlobalVarSymbol
- func (b *Main) Pos() token.Pos
- func (m *Main) RunPass(ctx *Context, pass Pass)
- func (m *Main) Scope() *symbol.Scope
- func (b *Main) SetPos(pos token.Pos)
- type MemberAccess
- type MetaAttrib
- type MetaParam
- type ModuleRegistry
- func (r *ModuleRegistry) AddModule(name string, m *symbol.Module)
- func (r *ModuleRegistry) GetModule(name string) *symbol.Module
- func (r *ModuleRegistry) GetNativeLoader(name string) func(r NativeModuleContext)
- func (r *ModuleRegistry) RegisterNativeModuleLoader(name string, regFn func(r NativeModuleContext)) error
- type NativeModuleContext
- type Nop
- type ObjectField
- type ObjectFieldBlock
- type ObjectLiteral
- type Operator
- type OrExpr
- type Pass
- type PassRunner
- type Printer
- type RegexLiteral
- type ReturnStmt
- type Scope
- type SimpleRef
- type SliceExpr
- type Stack
- type StmtBlock
- type TernaryExpr
- type ThrowStmt
- type TryCatchStmt
- type Type
- type UnaryExpr
- type UnaryOp
- type Unit
- type Value
- type VarDeclStmt
- type WhileStmt
- type YieldStmt
- type ZeroExpr
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddVariable ¶
Don't forget to call emitVariableInit for new variables.
Types ¶
type AnonFuncExpr ¶
type AnonFuncExpr struct {
Func
}
func (*AnonFuncExpr) RunPass ¶
func (e *AnonFuncExpr) RunPass(ctx *Context, pass Pass)
type ArrayElement ¶
type ArrayElement struct {
Val Expr
// contains filtered or unexported fields
}
func (*ArrayElement) RunPass ¶
func (e *ArrayElement) RunPass(ctx *Context, pass Pass)
type ArrayElementBlock ¶
type ArrayElementBlock struct {
Elements ASTs
// contains filtered or unexported fields
}
func (*ArrayElementBlock) RunPass ¶
func (b *ArrayElementBlock) RunPass(ctx *Context, pass Pass)
func (*ArrayElementBlock) Scope ¶
func (b *ArrayElementBlock) Scope() *symbol.Scope
type ArrayLiteral ¶
type ArrayLiteral struct {
Block *ArrayElementBlock
// contains filtered or unexported fields
}
func (*ArrayLiteral) RunPass ¶
func (a *ArrayLiteral) RunPass(ctx *Context, pass Pass)
func (*ArrayLiteral) Scope ¶
func (a *ArrayLiteral) Scope() *symbol.Scope
type AssignOpStmt ¶ added in v0.2.0
type AssignOpStmt struct {
Op Operator
LValue *LValue
RValue Expr
// contains filtered or unexported fields
}
func (*AssignOpStmt) RunPass ¶ added in v0.2.0
func (s *AssignOpStmt) RunPass(ctx *Context, pass Pass)
type AssignOperator ¶ added in v0.2.0
type AssignOperator int
type AssignStmt ¶
func (*AssignStmt) RunPass ¶
func (s *AssignStmt) RunPass(ctx *Context, pass Pass)
type BinaryExpr ¶
type BinaryExpr struct {
Left Expr
Op Operator
Right Expr
// contains filtered or unexported fields
}
func (*BinaryExpr) RunPass ¶
func (e *BinaryExpr) RunPass(ctx *Context, pass Pass)
type BreakContinueEmitter ¶
type Context ¶
type Context struct {
Stack
*errlogger.ErrLoggerWrapper
// contains filtered or unexported fields
}
func NewContext ¶
func NewContext( moduleRegistry *ModuleRegistry, l *errlogger.ErrLoggerWrapper, ) *Context
func (*Context) CurrentFunc ¶
func (*Context) CurrentScope ¶
func (*Context) IsInLiftableScope ¶
func (*Context) ModuleRegistry ¶
func (c *Context) ModuleRegistry() *ModuleRegistry
type ContinueStmt ¶
type ContinueStmt struct {
// contains filtered or unexported fields
}
func (*ContinueStmt) RunPass ¶
func (s *ContinueStmt) RunPass(ctx *Context, pass Pass)
type DeferStmt ¶
type DeferStmt struct {
// contains filtered or unexported fields
}
func NewDeferStmt ¶
func NewDeferStmt(callExpr *FuncCallExpr) *DeferStmt
type ExternFn ¶
type ForStmt ¶
type ForStmt struct {
ForVars ASTs
IterExpr Expr
Block AST
// contains filtered or unexported fields
}
func (*ForStmt) IsLiftableScope ¶
func (s *ForStmt) IsLiftableScope()
type Func ¶
type Func struct {
Params ASTs
Block *StmtBlock
IsClosure bool
DebugName string
// contains filtered or unexported fields
}
func (*Func) IsLiftableScope ¶
func (f *Func) IsLiftableScope()
func (*Func) NewCapture ¶
func (f *Func) NewCapture(sym symbol.Symbol) *symbol.CaptureSymbol
func (*Func) NewLocal ¶
func (f *Func) NewLocal() *symbol.LocalVarSymbol
func (*Func) NewParam ¶
func (f *Func) NewParam() *symbol.ParamSymbol
func (*Func) SetIterNRet ¶
type FuncCallExpr ¶
type FuncCallExpr struct {
Target Expr
Args Exprs
RetN int
Expand bool
Pipeline bool
// contains filtered or unexported fields
}
func (*FuncCallExpr) RunPass ¶
func (c *FuncCallExpr) RunPass(ctx *Context, pass Pass)
type GraphPrinter ¶
type GraphPrinter struct {
// contains filtered or unexported fields
}
func NewGraphPrinter ¶
func NewGraphPrinter(out io.Writer) *GraphPrinter
func (*GraphPrinter) PrintGraph ¶
func (p *GraphPrinter) PrintGraph(root Printer)
func (*GraphPrinter) PrintNode ¶
func (p *GraphPrinter) PrintNode(label string, children ...Printer)
type Import ¶
type IncDecStmt ¶ added in v0.2.0
func (*IncDecStmt) RunPass ¶ added in v0.2.0
func (s *IncDecStmt) RunPass(ctx *Context, pass Pass)
type LiftableScope ¶
type LiftableScope interface {
IsLiftableScope()
}
type LiteralExpr ¶
func (*LiteralExpr) RunPass ¶
func (e *LiteralExpr) RunPass(ctx *Context, pass Pass)
type Main ¶
type Main struct {
// contains filtered or unexported fields
}
func (*Main) AddGlobalParam ¶
func (*Main) NewGlobal ¶
func (m *Main) NewGlobal() *symbol.GlobalVarSymbol
type MemberAccess ¶
type MemberAccess struct {
Target Expr
Member token.Token
ModuleMember symbol.Symbol
// contains filtered or unexported fields
}
func (*MemberAccess) RunPass ¶
func (a *MemberAccess) RunPass(ctx *Context, pass Pass)
type MetaAttrib ¶
func (*MetaAttrib) RunPass ¶
func (a *MetaAttrib) RunPass(ctx *Context, pass Pass)
type MetaParam ¶
type ModuleRegistry ¶
type ModuleRegistry struct {
// contains filtered or unexported fields
}
func NewModuleRegistry ¶
func NewModuleRegistry() *ModuleRegistry
func (*ModuleRegistry) AddModule ¶
func (r *ModuleRegistry) AddModule(name string, m *symbol.Module)
func (*ModuleRegistry) GetNativeLoader ¶
func (r *ModuleRegistry) GetNativeLoader(name string) func(r NativeModuleContext)
func (*ModuleRegistry) RegisterNativeModuleLoader ¶
func (r *ModuleRegistry) RegisterNativeModuleLoader( name string, regFn func(r NativeModuleContext), ) error
type NativeModuleContext ¶
type ObjectField ¶
type ObjectField struct {
NameID string
NameExpr Expr
Val Expr
// contains filtered or unexported fields
}
func (*ObjectField) RunPass ¶
func (s *ObjectField) RunPass(ctx *Context, pass Pass)
type ObjectFieldBlock ¶
type ObjectFieldBlock struct {
Fields ASTs
// contains filtered or unexported fields
}
func (*ObjectFieldBlock) RunPass ¶
func (b *ObjectFieldBlock) RunPass(ctx *Context, pass Pass)
func (*ObjectFieldBlock) Scope ¶
func (b *ObjectFieldBlock) Scope() *symbol.Scope
type ObjectLiteral ¶
type ObjectLiteral struct {
FieldBlock *ObjectFieldBlock
// contains filtered or unexported fields
}
func (*ObjectLiteral) RunPass ¶
func (s *ObjectLiteral) RunPass(ctx *Context, pass Pass)
func (*ObjectLiteral) Scope ¶
func (s *ObjectLiteral) Scope() *symbol.Scope
type PassRunner ¶
type Printer ¶
type Printer interface {
Print(p *GraphPrinter)
}
type RegexLiteral ¶
type RegexLiteral struct {
RegexDef string
// contains filtered or unexported fields
}
func (*RegexLiteral) RunPass ¶
func (l *RegexLiteral) RunPass(ctx *Context, pass Pass)
type ReturnStmt ¶
type ReturnStmt struct {
Values Exprs
// contains filtered or unexported fields
}
func (*ReturnStmt) RunPass ¶
func (s *ReturnStmt) RunPass(ctx *Context, pass Pass)
type SimpleRef ¶
type TernaryExpr ¶
type TernaryExpr struct {
Condition Expr
Then Expr
Else Expr
// contains filtered or unexported fields
}
func (*TernaryExpr) RunPass ¶
func (e *TernaryExpr) RunPass(ctx *Context, pass Pass)
type TryCatchStmt ¶
type TryCatchStmt struct {
// contains filtered or unexported fields
}
func NewTryCatchStmt ¶
func NewTryCatchStmt( tryBlock AST, catchVar *token.Token, catchStmts AST, ) *TryCatchStmt
func (*TryCatchStmt) RunPass ¶
func (s *TryCatchStmt) RunPass(ctx *Context, pass Pass)
type Unit ¶ added in v0.2.0
type VarDeclStmt ¶
type VarDeclStmt struct {
Vars []token.Token
InitValues Exprs
// contains filtered or unexported fields
}
func (*VarDeclStmt) RunPass ¶
func (s *VarDeclStmt) RunPass(ctx *Context, pass Pass)
Source Files
¶
- and_expr.go
- anon_func_expr.go
- array_element.go
- array_literal.go
- assign_op_stmt.go
- assign_stmt.go
- ast.go
- ast_ternary_expr.go
- binary_expr.go
- break_stmt.go
- context.go
- continue_stmt.go
- defer_stmt.go
- expr_stmt.go
- external_func.go
- for_stmt.go
- func_base.go
- func_call_expr.go
- func_param.go
- func_stmt.go
- if_stmt.go
- import_stmt.go
- inc_dec_stmt.go
- index_expr.go
- literal_expr.go
- lvalue.go
- main.go
- member_access.go
- meta_param.go
- module_registry.go
- nop.go
- object_field.go
- object_literal.go
- or_expr.go
- printer.go
- regex_literal.go
- return_stmt.go
- simple_ref.go
- slice_expr.go
- stack.go
- stmt_block.go
- throw_stmt.go
- try_catch_stmt.go
- unary_expr.go
- unit.go
- var_base.go
- var_decl_stmt.go
- while_stmt.go
- yield_stmt.go
- zero_expr.go
Click to show internal directories.
Click to hide internal directories.