Documentation
¶
Index ¶
- Variables
- func ToValue(obj Object, json ...bool) (any, error)
- func TypeCheck(shouldBe *Type, is *Type) bool
- type Any
- type Attribute
- type BasicFnArg
- type Bool
- type Byte
- type Char
- type Dict
- func (i *Dict) Clone() Object
- func (i *Dict) Debug() *debug.Debug
- func (i *Dict) GetPrototype() Prototype
- func (i *Dict) ID() string
- func (i *Dict) Inspect() string
- func (i *Dict) Iterator() func() (Object, Object, bool)
- func (i *Dict) String() string
- func (i *Dict) Type() *Type
- func (i *Dict) TypeString() string
- func (i *Dict) Value() any
- type DictPrototype
- type Element
- func (e *Element) Clone() Object
- func (e *Element) Debug() *debug.Debug
- func (e *Element) GetPrototype() Prototype
- func (e *Element) ID() string
- func (e *Element) Inspect() string
- func (e *Element) String() string
- func (e *Element) Type() *Type
- func (e *Element) TypeString() string
- func (e *Element) Value() any
- type ElementChild
- type ElementData
- type ElementPrototype
- type Float
- type FnArg
- type Function
- func (i *Function) Clone() Object
- func (i *Function) Debug() *debug.Debug
- func (i *Function) GetPrototype() Prototype
- func (i *Function) ID() string
- func (i *Function) Inspect() string
- func (i *Function) String() string
- func (i *Function) Type() *Type
- func (i *Function) TypeString() string
- func (i *Function) Value() any
- type FunctionPrototype
- type Int
- func (i *Int) Clone() Object
- func (i *Int) Debug() *debug.Debug
- func (i *Int) GetPrototype() Prototype
- func (i *Int) ID() string
- func (i *Int) Inspect() string
- func (i *Int) Iterator() func() (Object, Object, bool)
- func (i *Int) String() string
- func (i *Int) Type() *Type
- func (i *Int) TypeString() string
- func (i *Int) Value() any
- type IntPrototype
- type List
- func (i *List) Clone() Object
- func (i *List) Debug() *debug.Debug
- func (i *List) GetPrototype() Prototype
- func (i *List) ID() string
- func (i *List) Inspect() string
- func (i *List) Iterator() func() (Object, Object, bool)
- func (i *List) String() string
- func (i *List) Type() *Type
- func (i *List) TypeString() string
- func (i *List) Value() any
- type ListPrototype
- type NilObj
- func (n *NilObj) Clone() Object
- func (n *NilObj) Debug() *debug.Debug
- func (n *NilObj) GetPrototype() Prototype
- func (n *NilObj) ID() string
- func (n *NilObj) Inspect() string
- func (n *NilObj) String() string
- func (n *NilObj) Type() *Type
- func (n *NilObj) TypeString() string
- func (n *NilObj) Value() any
- type Object
- type ObjectType
- type OrderedMap
- func (om *OrderedMap) Delete(key Object)
- func (om *OrderedMap) Get(key Object) (Object, bool)
- func (om *OrderedMap) Iterate(fn func(key Object, value Object) bool)
- func (om *OrderedMap) IterateErr(f func(key Object, value Object) error) error
- func (om *OrderedMap) Len() int
- func (om *OrderedMap) Set(key Object, value Object)
- type Prototype
- type Ref
- type Signal
- func (i *Signal) Clone() Object
- func (i *Signal) Debug() *debug.Debug
- func (i *Signal) GetCarry() Object
- func (i *Signal) GetPrototype() Prototype
- func (i *Signal) ID() string
- func (i *Signal) Inspect() string
- func (i *Signal) SetCarry(carry Object) *Signal
- func (i *Signal) String() string
- func (i *Signal) Type() *Type
- func (i *Signal) TypeString() string
- func (i *Signal) Value() any
- type String
- func (i *String) Clone() Object
- func (i *String) Debug() *debug.Debug
- func (i *String) GetPrototype() Prototype
- func (i *String) ID() string
- func (i *String) Inspect() string
- func (s *String) Iterator() func() (Object, Object, bool)
- func (i *String) String() string
- func (i *String) Type() *Type
- func (i *String) TypeString() string
- func (i *String) Value() any
- type StringPrototype
- type Struct
- func (i *Struct) Clone() Object
- func (i *Struct) Debug() *debug.Debug
- func (i *Struct) GetPrototype() Prototype
- func (i *Struct) ID() string
- func (i *Struct) Inspect() string
- func (s *Struct) NewInstance() (*StructInstance, error)
- func (s *Struct) Settable() []string
- func (i *Struct) String() string
- func (i *Struct) Type() *Type
- func (i *Struct) TypeString() string
- func (i *Struct) Value() any
- type StructDefinition
- type StructField
- type StructInstance
- func (i *StructInstance) Clone() Object
- func (i *StructInstance) Debug() *debug.Debug
- func (i *StructInstance) GetPrototype() Prototype
- func (i *StructInstance) ID() string
- func (i *StructInstance) Inspect() string
- func (s *StructInstance) Iterator() func() (Object, Object, bool)
- func (i *StructInstance) String() string
- func (i *StructInstance) Type() *Type
- func (i *StructInstance) TypeString() string
- func (i *StructInstance) Value() any
- type StructPrototype
- func (s *StructPrototype) Clone() *StructPrototype
- func (s *StructPrototype) GetObject(name string) (Object, bool)
- func (s *StructPrototype) Implement()
- func (s *StructPrototype) Implemented() bool
- func (sp *StructPrototype) IsBase() bool
- func (s *StructPrototype) Lock()
- func (sp *StructPrototype) NewInstance(instance *StructInstance) (*StructPrototype, error)
- func (s *StructPrototype) Objects() map[string]Object
- func (s *StructPrototype) SetObject(name string, value Object) error
- func (s *StructPrototype) Unlock()
- type Type
Constants ¶
This section is empty.
Variables ¶
View Source
var ( TypeInt = &Type{BaseType: ObjectTypeInt, Content: "int"} TypeFloat = &Type{BaseType: ObjectTypeFloat, Content: "float"} TypeBool = &Type{BaseType: ObjectTypeBool, Content: "bool"} TypeString = &Type{BaseType: ObjectTypeString, Content: "string"} TypeChar = &Type{BaseType: ObjectTypeChar, Content: "char"} TypeByte = &Type{BaseType: ObjectTypeByte, Content: "byte"} TypeList = &Type{BaseType: ObjectTypeList, Element: TypeAny} TypeDict = &Type{BaseType: ObjectTypeDict, Key: TypeAny, Value: TypeAny} TypeStructInstance = Nullable(&Type{BaseType: ObjectTypeStructInstance}) TypeStructDefinition = &Type{BaseType: ObjectTypeStructDefinition} TypeNil = &Type{BaseType: ObjectTypeNil, Content: "nil"} TypeAny = &Type{BaseType: ObjectTypeAny, Content: "any"} TypeVoid = &Type{BaseType: ObjectTypeVoid, Content: "void"} TypeHtml = &Type{BaseType: ObjectTypeHtml, Content: "html"} )
View Source
var ErrIndexOutOfBounds = errors.New("index out of bounds")
View Source
var TypeNumber = NewUnionType(TypeInt, TypeFloat)
Functions ¶
Types ¶
type Any ¶
type Any struct { Data Object // contains filtered or unexported fields }
func (*Any) GetPrototype ¶
func (*Any) TypeString ¶
type BasicFnArg ¶
func (*BasicFnArg) Default ¶
func (b *BasicFnArg) Default() Object
func (*BasicFnArg) Name ¶
func (b *BasicFnArg) Name() string
func (*BasicFnArg) Type ¶
func (b *BasicFnArg) Type() *Type
type Bool ¶
type Bool struct { Data bool // contains filtered or unexported fields }
func (*Bool) GetPrototype ¶
func (*Bool) TypeString ¶
type Byte ¶
type Byte struct { Data byte // contains filtered or unexported fields }
func (*Byte) GetPrototype ¶
func (*Byte) TypeString ¶
type Char ¶
type Char struct { Data rune // contains filtered or unexported fields }
func (*Char) GetPrototype ¶
func (*Char) TypeString ¶
type Dict ¶
type Dict struct { Data *OrderedMap KeyType *Type ValueType *Type // contains filtered or unexported fields }
func (*Dict) GetPrototype ¶
func (*Dict) TypeString ¶
type DictPrototype ¶
type DictPrototype struct {
// contains filtered or unexported fields
}
func NewDictPrototype ¶
func NewDictPrototype(base *Dict) *DictPrototype
func (*DictPrototype) Objects ¶
func (dp *DictPrototype) Objects() map[string]Object
type Element ¶
type Element struct { Data *ElementData // contains filtered or unexported fields }
func NewElement ¶
func NewElement(data *ElementData, debug *debug.Debug) *Element
func (*Element) GetPrototype ¶
func (*Element) TypeString ¶
type ElementChild ¶
type ElementData ¶
type ElementData struct { TagName string Args []Attribute Children []ElementChild SelfClose bool }
type ElementPrototype ¶
type ElementPrototype struct {
// contains filtered or unexported fields
}
func NewElementPrototype ¶
func NewElementPrototype(base *Element) *ElementPrototype
func (*ElementPrototype) GetObject ¶
func (e *ElementPrototype) GetObject(name string) (Object, bool)
func (*ElementPrototype) Objects ¶
func (e *ElementPrototype) Objects() map[string]Object
type Float ¶
type Float struct { Data float64 // contains filtered or unexported fields }
func (*Float) GetPrototype ¶
func (*Float) TypeString ¶
type Function ¶
type Function struct { Data func(args []Object) (Object, error) ArgTypes []FnArg ReturnType *Type // contains filtered or unexported fields }
func NewFunction ¶
func NewTypedFunction ¶
func (*Function) GetPrototype ¶
func (*Function) TypeString ¶
type FunctionPrototype ¶
type FunctionPrototype struct {
// contains filtered or unexported fields
}
func NewFunctionPrototype ¶
func NewFunctionPrototype(base *Function) *FunctionPrototype
func (*FunctionPrototype) GetObject ¶
func (fp *FunctionPrototype) GetObject(name string) (Object, bool)
func (*FunctionPrototype) Objects ¶
func (fp *FunctionPrototype) Objects() map[string]Object
type Int ¶
type Int struct { Data int64 // contains filtered or unexported fields }
func (*Int) GetPrototype ¶
func (*Int) TypeString ¶
type IntPrototype ¶
type IntPrototype struct {
// contains filtered or unexported fields
}
func NewIntPrototype ¶
func NewIntPrototype(base *Int) *IntPrototype
func (*IntPrototype) Objects ¶
func (i *IntPrototype) Objects() map[string]Object
type ListPrototype ¶
type ListPrototype struct {
// contains filtered or unexported fields
}
func NewListPrototype ¶
func NewListPrototype(base *List) *ListPrototype
func (*ListPrototype) Objects ¶
func (lp *ListPrototype) Objects() map[string]Object
type NilObj ¶
type NilObj struct{}
var Nil *NilObj
func (*NilObj) GetPrototype ¶
func (*NilObj) TypeString ¶
type Object ¶
type Object interface { ID() string Type() *Type Inspect() string TypeString() string String() string GetPrototype() Prototype Value() any Debug() *debug.Debug Clone() Object }
func DefaultValue ¶
type ObjectType ¶
type ObjectType int
const ( ObjectTypeInt ObjectType = iota ObjectTypeFloat ObjectTypeBool ObjectTypeString ObjectTypeChar ObjectTypeByte ObjectTypeList ObjectTypeDict ObjectTypeStructInstance ObjectTypeStructDefinition ObjectTypeFunction ObjectTypeNil ObjectTypeAny ObjectTypeVoid ObjectTypeSignal // TypeSignal is not really a type, it is used for break, continue statements ObjectTypeHtml )
func (ObjectType) Base ¶
func (ot ObjectType) Base() ObjectType
func (ObjectType) Hashable ¶
func (ot ObjectType) Hashable() bool
func (ObjectType) String ¶
func (ot ObjectType) String() string
type OrderedMap ¶
type OrderedMap struct {
// contains filtered or unexported fields
}
func NewOrderedMap ¶
func NewOrderedMap() *OrderedMap
func (*OrderedMap) Delete ¶
func (om *OrderedMap) Delete(key Object)
func (*OrderedMap) IterateErr ¶
func (om *OrderedMap) IterateErr(f func(key Object, value Object) error) error
func (*OrderedMap) Len ¶
func (om *OrderedMap) Len() int
func (*OrderedMap) Set ¶
func (om *OrderedMap) Set(key Object, value Object)
type String ¶
type String struct { Data string // contains filtered or unexported fields }
func (*String) GetPrototype ¶
func (*String) TypeString ¶
type StringPrototype ¶
type StringPrototype struct {
// contains filtered or unexported fields
}
func NewStringPrototype ¶
func NewStringPrototype(base *String) *StringPrototype
func (*StringPrototype) Objects ¶
func (s *StringPrototype) Objects() map[string]Object
type Struct ¶
type Struct struct { Name string Data []StructField // contains filtered or unexported fields }
func (*Struct) GetPrototype ¶
func (*Struct) NewInstance ¶
func (s *Struct) NewInstance() (*StructInstance, error)
func (*Struct) TypeString ¶
type StructDefinition ¶
type StructDefinition struct { Name string Fields []StructField Debug debug.Debug }
type StructField ¶
type StructInstance ¶
type StructInstance struct { Name string // contains filtered or unexported fields }
func NewStructInstance ¶
func (*StructInstance) Clone ¶
func (i *StructInstance) Clone() Object
func (*StructInstance) Debug ¶
func (i *StructInstance) Debug() *debug.Debug
func (*StructInstance) GetPrototype ¶
func (i *StructInstance) GetPrototype() Prototype
func (*StructInstance) ID ¶
func (i *StructInstance) ID() string
func (*StructInstance) Inspect ¶
func (i *StructInstance) Inspect() string
func (*StructInstance) String ¶
func (i *StructInstance) String() string
func (*StructInstance) Type ¶
func (i *StructInstance) Type() *Type
func (*StructInstance) TypeString ¶
func (i *StructInstance) TypeString() string
func (*StructInstance) Value ¶
func (i *StructInstance) Value() any
type StructPrototype ¶
type StructPrototype struct {
// contains filtered or unexported fields
}
func NewStructPrototype ¶
func NewStructPrototype(base *Struct) *StructPrototype
func (*StructPrototype) Clone ¶
func (s *StructPrototype) Clone() *StructPrototype
func (*StructPrototype) Implement ¶
func (s *StructPrototype) Implement()
func (*StructPrototype) Implemented ¶
func (s *StructPrototype) Implemented() bool
func (*StructPrototype) IsBase ¶
func (sp *StructPrototype) IsBase() bool
func (*StructPrototype) Lock ¶
func (s *StructPrototype) Lock()
func (*StructPrototype) NewInstance ¶
func (sp *StructPrototype) NewInstance(instance *StructInstance) (*StructPrototype, error)
func (*StructPrototype) Objects ¶
func (s *StructPrototype) Objects() map[string]Object
func (*StructPrototype) SetObject ¶
func (s *StructPrototype) SetObject(name string, value Object) error
func (*StructPrototype) Unlock ¶
func (s *StructPrototype) Unlock()
type Type ¶
type Type struct { BaseType ObjectType Content string // "int", "string", etc. (used for simple types) Key *Type // if Kind == "DICT", represents the key type Value *Type // if Kind == "DICT", represents the value type or if Kind == "FUNCTION", represents the return type Element *Type // if Kind == "LIST", represents the element type Args []*Type // if Kind == "FUNCTION", represents the function argument types ID string // if BaseType == ObjectTypeStructInstance, represents the struct ID Next *Type // if it's an union type, represents the next type in the union }
Type represents a type in the language.
func NewDictType ¶
func NewFunctionType ¶
func NewListType ¶
func NewUnionType ¶
func (*Type) Base ¶
func (t *Type) Base() ObjectType
Source Files
¶
Click to show internal directories.
Click to hide internal directories.