Documentation ¶
Overview ¶
Package object : Object definitions used to evaluate program AST nodes
Index ¶
Constants ¶
const ( INTEGER_OBJ = "INTEGER" FLOAT_OBJ = "FLOAT" 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" CHAR_OBJ = "CHAR" )
ObjectTypes
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Array ¶
type Array struct {
Elements []Object
}
Array : Object representing an array of elements
type Boolean ¶
type Boolean struct {
Value bool
}
Boolean : Object representing a boolean
type Builtin ¶
type Builtin struct {
Fn BuiltinFunction
}
Builtin : Object representing a built in function
type BuiltinFunction ¶
BuiltinFunction : A predefined function included in the interpreter
type Character ¶
type Character struct {
Value byte
}
Character : Object representing an character
type Environment ¶
type Environment struct {
// contains filtered or unexported fields
}
Environment : Contains information about values that have mapped to a declared identifier so they can be accessed throughout the lifetime of a program
func NewEnclosedEnvironment ¶
func NewEnclosedEnvironment(outer *Environment) *Environment
NewEnclosedEnvironment : Creates a new Environment nested inside a higher level Environment for use in functions
func NewEnvironment ¶
func NewEnvironment() *Environment
NewEnvironment : Creates a new Environment at the highest level with no identifier mappings
type Error ¶
type Error struct {
Message string
}
Error : Object representing an error during evaluation
type Float ¶
type Float struct {
Value float64
}
Float : Object representing a float
type Function ¶
type Function struct { Parameters []*ast.Identifier Body *ast.BlockStatement Env *Environment }
Function : Object representing a function including its parameters and body statements
type Hash ¶
Hash : Object representing a map of key-value pairs
type HashKey ¶
type HashKey struct { Type ObjectType Value uint64 }
HashKey : Definitions for how to determine the keys for a hash for each type of object
type Hashable ¶
type Hashable interface {
HashKey() HashKey
}
Hashable : Defines Objects that are usable as keys in a Hash
type Integer ¶
type Integer struct {
Value int64
}
Integer : Object representing an integer
type Null ¶
type Null struct{}
Null : Object representing a null value
type Number ¶
type Number interface {
// contains filtered or unexported methods
}
Number : Generic number type
type ReturnValue ¶
type ReturnValue struct {
Value Object
}
ReturnValue : Object representing a return value
func (*ReturnValue) Inspect ¶
func (rv *ReturnValue) Inspect() string
Inspect : Returns string representation of the wrapped Object's value