Documentation
¶
Index ¶
Constants ¶
const ( // INTEGER_OBJ is the object type for integers INTEGER_OBJ = "INTEGER" // BOOLEAN_OBJ is the object type for booleans BOOLEAN_OBJ = "BOOLEAN" // NULL_OBJ is the object type for nulls NULL_OBJ = "NULL" // RETURN_VALUE_OBJ is the object type for return values RETURN_VALUE_OBJ = "RETURN_VALUE" // ERROR_OBJ is the object type for errors ERROR_OBJ = "ERROR" // FUNCTION_OBJ is the object type for functions FUNCTION_OBJ = "FUNCTION" // STRING_OBJ is the object type for strings STRING_OBJ = "STRING" // BUILTIN_OBJ is the object type for builtin functions BUILTIN_OBJ = "BUILTIN" // ARRAY_OBJ is the object type for arrays ARRAY_OBJ = "ARRAY" // HASH_OBJ is the object type for hashes HASH_OBJ = "HASH" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Array ¶
type Array struct {
Elements []Object
}
Array is the object that holds arrays
type Boolean ¶
type Boolean struct {
Value bool
}
Boolean is the object that holds booleans
type Builtin ¶
type Builtin struct {
Fn BuiltinFunction
}
Builtin is the object that holds builtin functions
type BuiltinFunction ¶
BuiltinFunction is the type for functions defined by the interpreter
type Environment ¶
type Environment struct {
// contains filtered or unexported fields
}
Environment keeps track of identifiers and their values
func NewEnclosedEnvironment ¶
func NewEnclosedEnvironment(outer *Environment) *Environment
NewEnclosedEnvironment creates a newly scoped environment with a reference to the outer env
func NewEnvironment ¶
func NewEnvironment() *Environment
NewEnvironment creates a newly scoped environment
type Error ¶
type Error struct {
Message string
}
Error is the object that holds internal error messages
type Function ¶
type Function struct {
Parameters []*ast.Identifier
Body *ast.BlockStatement
Env *Environment
}
Function is the object that holds the reference to an executable function
type Hash ¶
Hash is the object that holds hashes
type Integer ¶
type Integer struct {
Value int64
}
Integer is the object that holds integers
type Null ¶
type Null struct{}
Null is the object that holds nulls
type ReturnValue ¶
type ReturnValue struct {
Value Object
}
ReturnValue is the object that holds return values
func (*ReturnValue) Inspect ¶
func (rv *ReturnValue) Inspect() string
Inspect returns a string with the value of the return value
func (*ReturnValue) Type ¶
func (rv *ReturnValue) Type() Type
Type returns the type string for the return value