Documentation
¶
Index ¶
- Variables
- type ArgCtx
- type Array
- func (a *Array) Access(access any) (Object, bool)
- func (a *Array) Copy() Object
- func (a *Array) Method(name string) Method
- func (a *Array) Methods() []string
- func (a *Array) SetVariable(name string, value Object) error
- func (a *Array) String() string
- func (a *Array) Type() ObjType
- func (a *Array) Value() any
- func (a *Array) Variable(variable string) Object
- func (a *Array) Variables() []string
- type Base
- type Bool
- func (b *Bool) Copy() Object
- func (*Bool) Method(name string) Method
- func (*Bool) Methods() []string
- func (b *Bool) Name() string
- func (*Bool) SetVariable(_ string, _ Object) error
- func (b *Bool) String() string
- func (*Bool) Type() ObjType
- func (b *Bool) Value() any
- func (b *Bool) Variable(name string) Object
- func (*Bool) Variables() []string
- type Definition
- func (d *Definition) Copy() Object
- func (d *Definition) Method(name string) Method
- func (d *Definition) Methods() []string
- func (d *Definition) NewInstance() (Object, error)
- func (d *Definition) SetVariable(name string, value Object) error
- func (d *Definition) String() string
- func (d *Definition) Type() ObjType
- func (d *Definition) TypeString() string
- func (d *Definition) Value() any
- func (d *Definition) Variable(variable string) Object
- func (d *Definition) Variables() []string
- type ExecFunc
- type ExecFuncV2
- type Executer
- type Float
- func (f *Float) Copy() Object
- func (f *Float) Method(name string) Method
- func (f *Float) Methods() []string
- func (f *Float) Name() string
- func (f *Float) SetVariable(_ string, _ Object) error
- func (f *Float) String() string
- func (f *Float) Type() ObjType
- func (f *Float) Value() any
- func (f *Float) Variable(name string) Object
- func (f *Float) Variables() []string
- type Fn
- func (f *Fn) Copy() Object
- func (f *Fn) Method(name string) Method
- func (f *Fn) Methods() []string
- func (f *Fn) Name() string
- func (f *Fn) SetVariable(_ string, _ Object) error
- func (f *Fn) String() string
- func (f *Fn) Type() ObjType
- func (f *Fn) Value() any
- func (f *Fn) Variable(name string) Object
- func (f *Fn) Variables() []string
- type Function
- func (f *Function) Args() []string
- func (f *Function) Debug() *models.Debug
- func (f *Function) Execute(args []Object) (Object, error)
- func (f *Function) GetVariadicArg() string
- func (f *Function) HasVariadicArg() bool
- func (f *Function) WithArg(arg string) *Function
- func (f *Function) WithArgs(args []string) *Function
- func (f *Function) WithDebug(debug *models.Debug) *Function
- func (f *Function) WithTypeSafeArgs(typesafeArgs ...TypeSafeArg) *Function
- func (f *Function) WithVariadicArg(arg string) *Function
- type FunctionV2
- type IOStream
- func (i *IOStream) Copy() Object
- func (i *IOStream) Method(name string) Method
- func (i *IOStream) Methods() []string
- func (f *IOStream) Name() string
- func (i *IOStream) SetVariable(_ string, _ Object) error
- func (i *IOStream) String() string
- func (f *IOStream) Type() ObjType
- func (f *IOStream) Value() any
- func (i *IOStream) Variable(name string) Object
- func (*IOStream) Variables() []string
- type Instance
- func (i *Instance) Copy() Object
- func (i *Instance) Definition() *Definition
- func (i *Instance) Method(name string) Method
- func (i *Instance) Methods() []string
- func (i *Instance) SetVariable(name string, value Object) error
- func (i *Instance) String() string
- func (*Instance) Type() ObjType
- func (i *Instance) TypeString() string
- func (i *Instance) Value() any
- func (i *Instance) Variable(variable string) Object
- func (i *Instance) Variables() []string
- type Integer
- func (i *Integer) Copy() Object
- func (i *Integer) Method(name string) Method
- func (i *Integer) Methods() []string
- func (i *Integer) Name() string
- func (i *Integer) SetVariable(_ string, _ Object) error
- func (i *Integer) String() string
- func (i *Integer) Type() ObjType
- func (i *Integer) Value() any
- func (i *Integer) Variable(name string) Object
- func (i *Integer) Variables() []string
- type List
- func (l *List) Copy() Object
- func (l *List) Method(name string) Method
- func (l *List) Methods() []string
- func (l *List) Name() string
- func (l *List) SetVariable(_ string, _ Object) error
- func (l *List) String() string
- func (l *List) Type() ObjType
- func (l *List) Value() any
- func (l *List) Variable(variable string) Object
- func (l *List) Variables() []string
- type Method
- type Module
- type Nil
- type ObjAddr
- func (o *ObjAddr) Copy() Object
- func (o *ObjAddr) Method(name string) Method
- func (*ObjAddr) Methods() []string
- func (*ObjAddr) SetVariable(_ string, _ Object) error
- func (o *ObjAddr) String() string
- func (*ObjAddr) Type() ObjType
- func (o *ObjAddr) Value() any
- func (*ObjAddr) Variable(_ string) Object
- func (*ObjAddr) Variables() []string
- type ObjType
- type Object
- func Addr(s Object) Object
- func FromValue(data any) (Object, error)
- func GetListValue(l Object) []Object
- func Immute(obj Object) Object
- func NewArray(name string, debug *models.Debug, keys []Object, values []Object) Object
- func NewArrayMap(name string, debug *models.Debug, m map[string]Object) Object
- func NewBool(name string, b bool, debug *models.Debug) Object
- func NewFloat(name string, f float64, debug *models.Debug) Object
- func NewFn(name string, debug *models.Debug, fn Method) Object
- func NewIOStream(name string, r io.Reader) Object
- func NewInteger(name string, i int, debug *models.Debug) Object
- func NewList(name string, li []Object, debug *models.Debug) Object
- func NewNil(name string, debug *models.Debug) Object
- func NewRef(name string, debug *models.Debug, r Object) Object
- func NewString(name, s string, debug *models.Debug) Object
- type Ref
- func (r *Ref) Copy() Object
- func (r *Ref) Method(name string) Method
- func (r *Ref) Methods() []string
- func (r *Ref) Name() string
- func (r *Ref) SetVariable(name string, value Object) error
- func (r *Ref) String() string
- func (r *Ref) Type() ObjType
- func (r *Ref) Value() any
- func (r *Ref) Variable(name string) Object
- func (r *Ref) Variables() []string
- type String
- func (s *String) Copy() Object
- func (s *String) Method(name string) Method
- func (s *String) Methods() []string
- func (s *String) SetVariable(_ string, _ Object) error
- func (s *String) String() string
- func (s *String) Type() ObjType
- func (s *String) Value() any
- func (s *String) Variable(variable string) Object
- func (s *String) Variables() []string
- type TypeSafeArg
- type VariadicMethod
Constants ¶
This section is empty.
Variables ¶
View Source
var NilObject = Nil{}
Functions ¶
This section is empty.
Types ¶
type ArgCtx ¶
type ArgCtx struct {
// contains filtered or unexported fields
}
func NewArgCtx ¶
func NewArgCtx(fn *FunctionV2, args []Object) *ArgCtx
type Array ¶
type Definition ¶
type Definition struct {
Base
// contains filtered or unexported fields
}
func NewDefinition ¶
func (*Definition) Copy ¶
func (d *Definition) Copy() Object
func (*Definition) Method ¶
func (d *Definition) Method(name string) Method
func (*Definition) Methods ¶
func (d *Definition) Methods() []string
func (*Definition) NewInstance ¶
func (d *Definition) NewInstance() (Object, error)
func (*Definition) SetVariable ¶
func (d *Definition) SetVariable(name string, value Object) error
func (*Definition) String ¶
func (d *Definition) String() string
func (*Definition) Type ¶
func (d *Definition) Type() ObjType
func (*Definition) TypeString ¶
func (d *Definition) TypeString() string
func (*Definition) Value ¶
func (d *Definition) Value() any
func (*Definition) Variable ¶
func (d *Definition) Variable(variable string) Object
func (*Definition) Variables ¶
func (d *Definition) Variables() []string
type ExecFuncV2 ¶
type Executer ¶
type Executer interface {
GetVariable(name string) (Object, error)
Variables() []string
AssignVariable(name string, object Object) error
GetMethod(name string) (Method, error)
Execute(nodes []*models.Node) (Object, error)
GetNew() Executer
}
Executer represents a node executer in the runtime
type Float ¶
type Float struct {
Base
// contains filtered or unexported fields
}
Float represents a float object
type Function ¶
type Function struct {
// Method is a method of the function
Method
// contains filtered or unexported fields
}
Function represents a function method
func NewFunction ¶
NewFunction creates a new function method
func (*Function) GetVariadicArg ¶
func (*Function) HasVariadicArg ¶
func (*Function) WithTypeSafeArgs ¶
func (f *Function) WithTypeSafeArgs(typesafeArgs ...TypeSafeArg) *Function
func (*Function) WithVariadicArg ¶
type FunctionV2 ¶
type FunctionV2 struct {
// contains filtered or unexported fields
}
func FnV2 ¶
func FnV2(exec ExecFuncV2) *FunctionV2
func (*FunctionV2) Adapter ¶
func (f *FunctionV2) Adapter() *Function
func (*FunctionV2) WithArg ¶
func (f *FunctionV2) WithArg(arg string) *FunctionV2
func (*FunctionV2) WithDebug ¶
func (f *FunctionV2) WithDebug(debug *models.Debug) *FunctionV2
func (*FunctionV2) WithTypeSafeArgs ¶
func (f *FunctionV2) WithTypeSafeArgs(typesafeArgs ...TypeSafeArg) *FunctionV2
func (*FunctionV2) WithVariadicArg ¶
func (f *FunctionV2) WithVariadicArg(arg string) *FunctionV2
type Instance ¶
type Instance struct {
Base
// contains filtered or unexported fields
}
func NewDefinitionInstance ¶
func NewDefinitionInstance(def *Definition, ex Executer) *Instance
func (*Instance) Definition ¶
func (i *Instance) Definition() *Definition
func (*Instance) TypeString ¶
type List ¶
type List struct {
Base
// contains filtered or unexported fields
}
List represents a list object
type Method ¶
type Method interface {
// Args returns the arguments of the method
Args() []string
// Execute executes the method with the given arguments
Execute(args []Object) (Object, error)
}
Method represents a method in the language
type Module ¶
type Module interface {
// Namespace returns the namespace of the module
Namespace() string
// Objects returns the objects of the module
Objects() map[string]Object
// Methods returns the methods of the module
Methods() map[string]Method
}
Module represents a module in the language
type ObjType ¶
type ObjType string
ObjType is the type of the object
const ( TString ObjType = "<Object:string>" TInt ObjType = "<Object:int>" TFloat ObjType = "<Object:float>" TBool ObjType = "<Object:bool>" TList ObjType = "<Object:list>" TNothing ObjType = "<Object:nothing>" TNil ObjType = "<Object:nil>" TDefinition ObjType = "<Definition>" TInstance ObjType = "<Object:instance>" TFunction ObjType = "<Function>" TIOStream ObjType = "<Object:iostream>" TArray ObjType = "<Object:array>" TFnRef ObjType = "<Object:function>" TAddr ObjType = "<Object:address>" TAny ObjType = "<Object:any>" )
type Object ¶
type Object interface {
// Type returns the type of the object
Type() ObjType
// Name is the name of the object, or empty string if the object is inlined
Name() string
// Rename renames the object
Rename(s string)
// Value returns the value of the object
Value() any
// IsMutable returns if the object is mutable
IsMutable() bool
// Immute makes the object immutable
Immute()
// Method returns a method by name
Method(name string) Method
// Methods returns the method names of the object
Methods() []string
// Variable returns a variable by name
Variable(name string) Object
// Variables returns the variable names of the object
Variables() []string
// SetVariable sets a variable by name
SetVariable(name string, object Object) error
// Debug returns the debug information of the object
Debug() *models.Debug
// String returns the string representation of the object
String() string
// Copy returns a copy of the object
Copy() Object
}
Object represents an object in the language
func GetListValue ¶
type String ¶
type String struct {
Base
// contains filtered or unexported fields
}
String represents a string object
type TypeSafeArg ¶
type VariadicMethod ¶
type VariadicMethod interface {
Method
// HasVariadicArg returns if the method has a variadic argument
HasVariadicArg() bool
// GetVariadicArg returns the variadic argument of the method
GetVariadicArg() string
}
VariadicMethod represents a variadic method in the language
Click to show internal directories.
Click to hide internal directories.