Documentation ¶
Index ¶
Constants ¶
View Source
const ( BOOLEAN_OBJ = "BOOLEAN" BUILTIN_OBJ = "BUILTIN" ERROR_OBJ = "ERROR" FUNCTION_OBJ = "FUNCTION" LIST_OBJ = "LIST" MAP_OBJ = "MAP" NULL_OBJ = "NULL" NUMBER_OBJ = "NUMBER" RETURN_VALUE_OBJ = "RETURN_VALUE" STRING_OBJ = "STRING" MODULE_OBJ = "MODULE" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Boolean ¶
type Boolean struct {
Value bool
}
func (*Boolean) Type ¶
func (b *Boolean) Type() ObjectType
type Builtin ¶
type Builtin struct { Name string Fn BuiltinFunction }
func (*Builtin) Type ¶
func (b *Builtin) Type() ObjectType
type BuiltinFunction ¶
type BuiltinFunction func(env *Environment, args ...Object) Object
type Environment ¶
type Environment struct {
// contains filtered or unexported fields
}
Environment is an object that holds a mapping of names to bound objects
func NewEnclosedEnvironment ¶
func NewEnclosedEnvironment(outer *Environment) *Environment
func NewEnvironment ¶
func NewEnvironment() *Environment
NewEnvironment constructs a new Environment object to hold bindings of identifiers to their names
func (*Environment) All ¶
func (e *Environment) All() map[string]Object
All returns all stored identifiers.
func (*Environment) Exported ¶
func (e *Environment) Exported() *Map
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 Defaults map[string]ast.Expression Env *Environment }
func (*Function) Type ¶
func (f *Function) Type() ObjectType
type List ¶
type List struct {
Elements []Object
}
func (*List) Type ¶
func (ao *List) Type() ObjectType
type MapKey ¶
type MapKey struct { Type ObjectType Value uint64 }
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) MapKey ¶
MapKey defines the key for maps that can be comparable and unique.
Note: There is a _very_ small chance that the following will result in the same hash being generated for different string values (hash collisions). Research "separate chaining" and "open addressing" techniques to work around the problem.
func (*String) Type ¶
func (s *String) Type() ObjectType
Click to show internal directories.
Click to hide internal directories.