Documentation ¶
Index ¶
- Constants
- Variables
- type Array
- type Boolean
- type Builtin
- type BuiltinFunction
- type Environment
- func (e *Environment) AddAcknowledgement(ack string)
- func (e *Environment) AllowsPrivateAccess(str *ast.Struct) bool
- func (e *Environment) Assign(name string, val Object) (Object, error)
- func (e *Environment) Get(name string) (Object, bool)
- func (e *Environment) GetStruct(name string) (*ast.Struct, bool)
- func (e *Environment) IsCurrentStructInstance(structInstance *StructInstance) bool
- func (e *Environment) Set(name string, val Object) Object
- func (e *Environment) SetCurrentStructInstance(structInstance *StructInstance)
- func (e *Environment) SetStruct(structDef *ast.Struct) *ast.Struct
- func (e *Environment) String() string
- type Error
- type Function
- type Hash
- type HashKey
- type HashPair
- type Hashable
- type Integer
- type LazyObject
- type Method
- type Null
- type Object
- type ObjectType
- type ReturnValue
- type String
- type StructInstance
- func (self *StructInstance) EvolveInto(other *StructInstance)
- func (self *StructInstance) GetFieldValue(fieldName string) Object
- func (self *StructInstance) GetMethod(methodName string) Object
- func (self *StructInstance) Inspect() string
- func (self *StructInstance) IsField(fieldName string) bool
- func (self *StructInstance) IsMethod(methodName string) bool
- func (self *StructInstance) IsPublicField(fieldName string) bool
- func (self *StructInstance) IsPublicMethod(methodName string) bool
- func (self *StructInstance) SetFieldValue(fieldName string, value Object) Object
- func (self *StructInstance) Type() ObjectType
Constants ¶
View Source
const ( INTEGER_OBJ = "INTEGER" BOOLEAN_OBJ = "BOOLEAN" NULL_OBJ = "NULL" RETURN_VALUE_OBJ = "RETURN_VALUE" ERROR_OBJ = "ERROR" FUNCTION_OBJ = "FUNCTION" STRING_OBJ = "STRING" BUILTIN_OBJ = "BUILTIN" ARRAY_OBJ = "ARRAY" HASH_OBJ = "HASH" // TODO: see if this ever gets printed, if so we should call it a `notaclass` or `NAC` STRUCT_OBJ = "STRUCT" METHOD_OBJ = "METHOD" LAZY_OBJ = "LAZY" )
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Array ¶
type Array struct {
Elements []Object
}
func (*Array) Type ¶
func (ao *Array) Type() ObjectType
type Boolean ¶
type Boolean struct {
Value bool
}
func (*Boolean) Type ¶
func (b *Boolean) Type() ObjectType
type Builtin ¶
type Builtin struct {
Fn BuiltinFunction
}
func (*Builtin) Type ¶
func (b *Builtin) Type() ObjectType
type BuiltinFunction ¶
type Environment ¶
type Environment struct {
// contains filtered or unexported fields
}
func NewEnclosedEnvironment ¶
func NewEnclosedEnvironment(outer *Environment) *Environment
func NewEnvironment ¶
func NewEnvironment() *Environment
func OnlyStructs ¶
func OnlyStructs(env *Environment) *Environment
Hack for now that allows us to access all the defined structs without accessing any variables. A better solution would be to store that in a separate environment
func (*Environment) AddAcknowledgement ¶
func (e *Environment) AddAcknowledgement(ack string)
func (*Environment) AllowsPrivateAccess ¶
func (e *Environment) AllowsPrivateAccess(str *ast.Struct) bool
func (*Environment) Assign ¶
func (e *Environment) Assign(name string, val Object) (Object, error)
assign expects the variable to be declared and findable in the environment chain somewhere. Wherever it's found in the chain we'll store the new value
func (*Environment) IsCurrentStructInstance ¶
func (e *Environment) IsCurrentStructInstance(structInstance *StructInstance) bool
func (*Environment) Set ¶
func (e *Environment) Set(name string, val Object) Object
Set is for declaring variables and then assigning to them in the current environment. If the variable is declared in a parent environment, that variable will now be shadowed
func (*Environment) SetCurrentStructInstance ¶
func (e *Environment) SetCurrentStructInstance(structInstance *StructInstance)
func (*Environment) String ¶
func (e *Environment) String() string
type Error ¶
type Error struct {
Message string
}
func (*Error) Type ¶
func (e *Error) Type() ObjectType
type Function ¶
type Function struct { Parameters []*ast.Identifier Body *ast.BlockStatement Env *Environment }
func (*Function) Type ¶
func (f *Function) Type() ObjectType
type HashKey ¶
type HashKey struct { Type ObjectType Value uint64 }
type Integer ¶
type Integer struct {
Value int64
}
func (*Integer) Type ¶
func (i *Integer) Type() ObjectType
type LazyObject ¶
func (*LazyObject) Inspect ¶
func (self *LazyObject) Inspect() string
func (*LazyObject) Type ¶
func (self *LazyObject) Type() ObjectType
type Method ¶
type Method struct { Name string StructMethod ast.StructMethod // not sure if we need an env here, or if we do which env to pass. Env *Environment StructInstance *StructInstance }
func (*Method) Type ¶
func (self *Method) Type() ObjectType
type Object ¶
type Object interface { Type() ObjectType Inspect() string }
type ObjectType ¶
type ObjectType string
type ReturnValue ¶
type ReturnValue struct {
Value Object
}
func (*ReturnValue) Inspect ¶
func (rv *ReturnValue) Inspect() string
func (*ReturnValue) Type ¶
func (rv *ReturnValue) Type() ObjectType
type String ¶
type String struct {
Value string
}
func (*String) Type ¶
func (s *String) Type() ObjectType
type StructInstance ¶
func (*StructInstance) EvolveInto ¶
func (self *StructInstance) EvolveInto(other *StructInstance)
func (*StructInstance) GetFieldValue ¶
func (self *StructInstance) GetFieldValue(fieldName string) Object
func (*StructInstance) GetMethod ¶
func (self *StructInstance) GetMethod(methodName string) Object
func (*StructInstance) Inspect ¶
func (self *StructInstance) Inspect() string
func (*StructInstance) IsField ¶
func (self *StructInstance) IsField(fieldName string) bool
func (*StructInstance) IsMethod ¶
func (self *StructInstance) IsMethod(methodName string) bool
func (*StructInstance) IsPublicField ¶
func (self *StructInstance) IsPublicField(fieldName string) bool
assumes we've already determined that the field exists
func (*StructInstance) IsPublicMethod ¶
func (self *StructInstance) IsPublicMethod(methodName string) bool
assumes we've already determined that the method exists
func (*StructInstance) SetFieldValue ¶
func (self *StructInstance) SetFieldValue(fieldName string, value Object) Object
func (*StructInstance) Type ¶
func (self *StructInstance) Type() ObjectType
Click to show internal directories.
Click to hide internal directories.