Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var FuncTypes = []any{ 1: new(func() time.Duration), 2: new(func() time.Month), 3: new(func() time.Time), 4: new(func() time.Weekday), 5: new(func() []interface{}), 6: new(func() []uint8), 7: new(func() interface{}), 8: new(func() bool), 9: new(func() uint8), 10: new(func() float32), 11: new(func() float64), 12: new(func() int), 13: new(func() int16), 14: new(func() int32), 15: new(func() int64), 16: new(func() int8), 17: new(func() map[string]interface{}), 18: new(func() int32), 19: new(func() string), 20: new(func() uint), 21: new(func() uint16), 22: new(func() uint32), 23: new(func() uint64), 24: new(func() uint8), 25: new(func(time.Duration) time.Duration), 26: new(func(time.Duration) time.Time), 27: new(func(time.Time) time.Duration), 28: new(func(time.Time) bool), 29: new(func([]interface{}) []interface{}), 30: new(func([]interface{}) interface{}), 31: new(func([]interface{}) map[string]interface{}), 32: new(func([]interface{}, string) string), 33: new(func([]uint8) string), 34: new(func([]string, string) string), 35: new(func(interface{}) []interface{}), 36: new(func(interface{}) interface{}), 37: new(func(interface{}) bool), 38: new(func(interface{}) float64), 39: new(func(interface{}) int), 40: new(func(interface{}) map[string]interface{}), 41: new(func(interface{}) string), 42: new(func(interface{}, interface{}) []interface{}), 43: new(func(interface{}, interface{}) interface{}), 44: new(func(interface{}, interface{}) bool), 45: new(func(interface{}, interface{}) string), 46: new(func(bool) bool), 47: new(func(bool) float64), 48: new(func(bool) int), 49: new(func(bool) string), 50: new(func(bool, bool) bool), 51: new(func(float32) float64), 52: new(func(float64) bool), 53: new(func(float64) float32), 54: new(func(float64) float64), 55: new(func(float64) int), 56: new(func(float64) string), 57: new(func(float64, float64) bool), 58: new(func(int) bool), 59: new(func(int) float64), 60: new(func(int) int), 61: new(func(int) string), 62: new(func(int, int) bool), 63: new(func(int, int) int), 64: new(func(int, int) string), 65: new(func(int16) int32), 66: new(func(int32) float64), 67: new(func(int32) int), 68: new(func(int32) int64), 69: new(func(int64) time.Time), 70: new(func(int8) int), 71: new(func(int8) int16), 72: new(func(string) []uint8), 73: new(func(string) []string), 74: new(func(string) bool), 75: new(func(string) float64), 76: new(func(string) int), 77: new(func(string) string), 78: new(func(string, uint8) int), 79: new(func(string, int) int), 80: new(func(string, int32) int), 81: new(func(string, string) bool), 82: new(func(string, string) string), 83: new(func(uint) float64), 84: new(func(uint) int), 85: new(func(uint) uint), 86: new(func(uint16) uint), 87: new(func(uint32) uint64), 88: new(func(uint64) float64), 89: new(func(uint64) int64), 90: new(func(uint8) uint8), }
View Source
var ( // MemoryBudget represents an upper limit of memory usage. MemoryBudget uint = 1e6 )
Functions ¶
Types ¶
type Opcode ¶
type Opcode byte
const ( OpInvalid Opcode = iota OpPush OpInt OpPop OpStore OpLoadVar OpLoadConst OpLoadField OpLoadFast OpLoadMethod OpLoadFunc OpLoadEnv OpFetch OpFetchField OpMethod OpTrue OpFalse OpNil OpNegate OpNot OpEqual OpEqualInt OpEqualString OpJump OpJumpIfTrue OpJumpIfFalse OpJumpIfNil OpJumpIfNotNil OpJumpIfEnd OpJumpBackward OpIn OpLess OpMore OpLessOrEqual OpMoreOrEqual OpAdd OpSubtract OpMultiply OpDivide OpModulo OpExponent OpRange OpMatches OpMatchesConst OpContains OpStartsWith OpEndsWith OpSlice OpCall OpCall0 OpCall1 OpCall2 OpCall3 OpCallN OpCallFast OpCallSafe OpCallTyped OpCallBuiltin1 OpArray OpMap OpLen OpCast OpDeref OpIncrementIndex OpDecrementIndex OpIncrementCount OpGetIndex OpGetCount OpGetLen OpGetAcc OpSetAcc OpSetIndex OpPointer OpThrow OpCreate OpGroupBy OpSortBy OpSort OpProfileStart OpProfileEnd OpBegin OpEnd // This opcode must be at the end of this list. )
type Program ¶
type Program struct { Bytecode []Opcode Arguments []int Constants []any // contains filtered or unexported fields }
Program represents a compiled expression.
func NewProgram ¶
func NewProgram( source file.Source, node ast.Node, locations []file.Location, variables int, constants []any, bytecode []Opcode, arguments []int, functions []Function, debugInfo map[string]string, span *Span, ) *Program
NewProgram returns a new Program. It's used by the compiler.
func (*Program) Disassemble ¶
Disassemble returns opcodes as a string.
func (*Program) DisassembleWriter ¶
DisassembleWriter takes a writer and writes opcodes to it.
type Span ¶ added in v1.16.2
Source Files ¶
Click to show internal directories.
Click to hide internal directories.