Documentation
¶
Index ¶
- func ParseScript(input string) (*ast.Program, error)
- type Bytecode
- type CompilationScope
- type Compiler
- type EmittedInstruction
- type FastBlockCallPlan
- type FastCallPlan
- type FastConditionalBranch
- type FastConditionalPlan
- type FastLoopConditionalBranch
- type FastLoopConditionalPlan
- type FastLoopPart
- type FastLoopPartKind
- type FastLoopPlan
- type FastPartialDataPair
- type FastPartialPlan
- type FastPathStep
- type FastPathStepKind
- type FastRenderPlan
- type FastRenderReject
- type FastRenderSegment
- type FastRenderSegmentKind
- type FastValueKind
- type FastValuePair
- type FastValuePlan
- type Symbol
- type SymbolScope
- type SymbolTable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Bytecode ¶
type Bytecode struct {
Instructions code.Instructions
CallNames map[int]string
LocalNames map[int]string
LineNumbers map[int]int
Properties map[int]object.PropertyAccess
PropertyCaches []object.InlineCacheSlot
CallCaches []object.InlineCacheSlot
NumLocals int
NumGlobals int
Constants []object.Object
GlobalNames map[int]string
Static bool
StaticOutput string
FastRenderPlan *FastRenderPlan
FastRejectLine int
FastReject string
FastDiagnostics atomic.Value
HasHoles bool
HasPartials bool
HasContextWrites bool
}
func (*Bytecode) ContextWrites ¶ added in v5.0.13
type CompilationScope ¶
type CompilationScope struct {
// contains filtered or unexported fields
}
type Compiler ¶
type Compiler struct {
// contains filtered or unexported fields
}
func NewWithState ¶
func NewWithState(s *SymbolTable, constants []object.Object) *Compiler
type EmittedInstruction ¶
type FastBlockCallPlan ¶
type FastBlockCallPlan struct {
Name string
NameIndex int
Args []FastValuePlan
Block *ast.BlockStatement
BlockSource string
BlockBytecode *Bytecode
Line int
Cache object.InlineCacheSlot
}
type FastCallPlan ¶
type FastCallPlan struct {
Name string
NameIndex int
Args []FastValuePlan
Line int
Cache object.InlineCacheSlot
}
type FastConditionalBranch ¶
type FastConditionalBranch struct {
Condition FastValuePlan
Segments []FastRenderSegment
Line int
}
type FastConditionalPlan ¶
type FastConditionalPlan struct {
Branches []FastConditionalBranch
ElseSegments []FastRenderSegment
Line int
Silent bool
}
type FastLoopConditionalBranch ¶
type FastLoopConditionalBranch struct {
Condition FastValuePlan
Parts []FastLoopPart
Line int
}
type FastLoopConditionalPlan ¶
type FastLoopConditionalPlan struct {
Branches []FastLoopConditionalBranch
ElseParts []FastLoopPart
Line int
Silent bool
}
type FastLoopPart ¶
type FastLoopPart struct {
Kind FastLoopPartKind
Value string
NameIndex int
Receiver string
Full string
Line int
ValuePlan FastValuePlan
Call *FastCallPlan
BlockCall *FastBlockCallPlan
Partial *FastPartialPlan
Conditional *FastLoopConditionalPlan
Loop *FastLoopPlan
PropertyCache object.InlineCacheSlot
}
type FastLoopPartKind ¶
type FastLoopPartKind uint8
const ( FastLoopPartStatic FastLoopPartKind = iota FastLoopPartKey FastLoopPartValue FastLoopPartValueProperty FastLoopPartValuePath FastLoopPartCall FastLoopPartConditional FastLoopPartLoop FastLoopPartBreak FastLoopPartContinue FastLoopPartBlockCall FastLoopPartPartial FastLoopPartLet )
type FastLoopPlan ¶
type FastLoopPlan struct {
IterableName string
IterableNameIndex int
Iterable FastValuePlan
KeyName string
ValueName string
OuterNames []string
Parts []FastLoopPart
StaticSize int
Line int
}
type FastPartialDataPair ¶
type FastPartialDataPair struct {
Key string
Value FastValuePlan
Line int
}
type FastPartialPlan ¶
type FastPartialPlan struct {
Name string
Data []FastPartialDataPair
Line int
}
type FastPathStep ¶
type FastPathStep struct {
Kind FastPathStepKind
Value string
Index int
Receiver string
Full string
Method bool
Line int
PropertyCache object.InlineCacheSlot
CallCache object.InlineCacheSlot
}
type FastPathStepKind ¶
type FastPathStepKind uint8
const ( FastPathStepProperty FastPathStepKind = iota FastPathStepIndexInteger FastPathStepIndexString FastPathStepCall )
type FastRenderPlan ¶
type FastRenderPlan struct {
Bindings []string
Segments []FastRenderSegment
StaticSize int
NameCount int
// Prepared caches the VM-side mixed/static-name/simple plan built from this
// compiler plan. BindingPrepared caches interned context IDs for stable
// contexts. See vm/FAST_PATHS.md for the full fast path map.
Prepared atomic.Value
BindingPrepared atomic.Value
}
type FastRenderReject ¶
type FastRenderSegment ¶
type FastRenderSegment struct {
Kind FastRenderSegmentKind
Value string
NameIndex int
NullOnMissing bool
Property string
Receiver string
Full string
Line int
Loop *FastLoopPlan
ValuePlan FastValuePlan
Call *FastCallPlan
BlockCall *FastBlockCallPlan
Conditional *FastConditionalPlan
Partial *FastPartialPlan
PropertyCache object.InlineCacheSlot
CallCache object.InlineCacheSlot
OutputCache object.InlineCacheSlot
}
type FastRenderSegmentKind ¶
type FastRenderSegmentKind uint8
const ( FastRenderSegmentStatic FastRenderSegmentKind = iota FastRenderSegmentName FastRenderSegmentProperty FastRenderSegmentLoop FastRenderSegmentValue FastRenderSegmentCall FastRenderSegmentBlockCall FastRenderSegmentConditional FastRenderSegmentPartial FastRenderSegmentLet FastRenderSegmentAssign )
type FastValueKind ¶
type FastValueKind uint8
const ( FastValueInvalid FastValueKind = iota FastValueName FastValueString FastValueInteger FastValueFloat FastValueBool FastValuePath FastValueLoopKey FastValueInfix FastValueCall FastValuePrefix FastValueConcat FastValueArray FastValueHash )
type FastValuePair ¶
type FastValuePair struct {
Key string
Value FastValuePlan
Line int
}
type FastValuePlan ¶
type FastValuePlan struct {
Kind FastValueKind
Value string
NameIndex int
NullOnMissing bool
IntValue int64
FloatValue float64
BoolValue bool
Operator string
Left *FastValuePlan
Right *FastValuePlan
Call *FastCallPlan
Elements []FastValuePlan
Pairs []FastValuePair
Path []FastPathStep
Line int
}
type Symbol ¶
type Symbol struct {
Name string
Scope SymbolScope
Index int
}
type SymbolScope ¶
type SymbolScope string
const ( LocalScope SymbolScope = "LOCAL" GlobalScope SymbolScope = "GLOBAL" BuiltinScope SymbolScope = "BUILTIN" FreeScope SymbolScope = "FREE" FunctionScope SymbolScope = "FUNCTION" )
type SymbolTable ¶
type SymbolTable struct {
Outer *SymbolTable
FreeSymbols []Symbol
// contains filtered or unexported fields
}
func NewEnclosedSymbolTable ¶
func NewEnclosedSymbolTable(outer *SymbolTable) *SymbolTable
func NewInlineBlockSymbolTable ¶
func NewInlineBlockSymbolTable(outer *SymbolTable) *SymbolTable
func NewSymbolTable ¶
func NewSymbolTable() *SymbolTable
func (*SymbolTable) Define ¶
func (s *SymbolTable) Define(name string) Symbol
func (*SymbolTable) DefineBuiltin ¶
func (s *SymbolTable) DefineBuiltin(index int, name string) Symbol
func (*SymbolTable) DefineFunctionName ¶
func (s *SymbolTable) DefineFunctionName(name string) Symbol
Click to show internal directories.
Click to hide internal directories.