Documentation
¶
Index ¶
- Constants
- Variables
- func AssertValidSymbolName(name string)
- func DecodeDict[T any](dict RTDict) (T, error)
- func DecodeMap[T any](mp map[interface{}]interface{}) (T, error)
- func TypeName(t Type) string
- func ValidSymbolName(name string) error
- type ArgDef
- type Arguments
- func (args *Arguments) CheckBool(i int) (RTBool, error)
- func (args *Arguments) CheckDict(i int) (RTDict, error)
- func (args *Arguments) CheckFunction(i int) (RTFunction, error)
- func (args *Arguments) CheckNumber(i int) (RTNumber, error)
- func (args *Arguments) CheckString(i int) (RTString, error)
- func (args *Arguments) EnsureBool(i int) RTBool
- func (args *Arguments) EnsureDict(i int) RTDict
- func (args *Arguments) EnsureFunction(i int) RTFunction
- func (args *Arguments) EnsureNumber(i int) RTNumber
- func (args *Arguments) EnsureString(i int) RTString
- func (args *Arguments) Get(i int) RTValue
- func (args *Arguments) Len() int
- type CustomFunc
- type CustomFunctionType
- type CustomStructType
- type DescribableType
- type Field
- type PrimitiveType
- type RTArray
- type RTBool
- type RTDict
- type RTFunction
- type RTNil
- type RTNumber
- type RTString
- type RTValue
- type Runtime
- type Type
- type TypedArrayType
Constants ¶
View Source
const ( StringId = iota NumberId BoolId DictId FuncId ArrayId NilId AnyId )
Variables ¶
View Source
var ( STRING = PrimitiveType{StringId, "string"} NUMBER = PrimitiveType{NumberId, "number"} BOOL = PrimitiveType{BoolId, "bool"} DICT = PrimitiveType{DictId, "dict"} FUNC = PrimitiveType{FuncId, "func"} ARRAY = PrimitiveType{ArrayId, "array"} NIL = PrimitiveType{NilId, "nil"} ANY = PrimitiveType{AnyId, "any"} )
Functions ¶
func AssertValidSymbolName ¶
func AssertValidSymbolName(name string)
func DecodeDict ¶
func ValidSymbolName ¶
Types ¶
type Arguments ¶
type Arguments struct {
R Runtime
// contains filtered or unexported fields
}
func NewArguments ¶
func (*Arguments) CheckFunction ¶
func (args *Arguments) CheckFunction(i int) (RTFunction, error)
func (*Arguments) EnsureBool ¶
func (*Arguments) EnsureDict ¶
func (*Arguments) EnsureFunction ¶
func (args *Arguments) EnsureFunction(i int) RTFunction
func (*Arguments) EnsureNumber ¶
func (*Arguments) EnsureString ¶
type CustomFunc ¶
type CustomFunctionType ¶
type CustomStructType ¶
func Custom ¶
func Custom(name string, fields []Field) CustomStructType
func CustomStruct ¶
func CustomStruct(name string, fields []Field) CustomStructType
type DescribableType ¶
type DescribableType struct {
Type
// contains filtered or unexported fields
}
func TypeWithDesc ¶
func TypeWithDesc(t Type, desc string) DescribableType
func (DescribableType) Describe ¶
func (t DescribableType) Describe() string
type PrimitiveType ¶
type PrimitiveType struct {
// contains filtered or unexported fields
}
func (PrimitiveType) Id ¶
func (typ PrimitiveType) Id() int
func (PrimitiveType) Is ¶
func (typ PrimitiveType) Is(other Type) bool
func (PrimitiveType) Name ¶
func (typ PrimitiveType) Name() string
type RTFunction ¶
type RTFunction interface {
RTValue
}
type Runtime ¶
type Runtime interface {
Lang() string
ExecFile(path string) error
ExecString(source string) error
String(str string) RTString
Close()
RaiseError(format string, args ...interface{})
CheckString(v RTValue) (RTString, error)
CheckNumber(v RTValue) (RTNumber, error)
CheckDict(v RTValue) (RTDict, error)
CheckBool(v RTValue) (RTBool, error)
CheckFunction(v RTValue) (RTFunction, error)
CheckArray(v RTValue) (RTArray, error)
EnsureString(v RTValue) RTString
EnsureNumber(v RTValue) RTNumber
EnsureDict(v RTValue) RTDict
EnsureBool(v RTValue) RTBool
EnsureFunction(v RTValue) RTFunction
EnsureArray(v RTValue) RTArray
InvokeFunction(fn RTFunction, params ...RTValue) error
InvokeFunctionSafe(fn RTFunction, params ...RTValue) error
SetGlobal(name string, val RTValue) ([]string, error)
SetFunction(
name string,
desc string,
args []ArgDef,
fn CustomFunc,
) error
}
type TypedArrayType ¶
func TypedArray ¶
func TypedArray(itemType Type) TypedArrayType
Click to show internal directories.
Click to hide internal directories.