Documentation
¶
Index ¶
Constants ¶
const ( // IntegerType represents a type of integers. IntegerType Type = "Integer" // FloatType represents a type of floating point numbers. FloatType = "Float" // BooleanType represents a type of booleans. BooleanType = "Boolean" // NilType represents a type of nil. NilType = "Nil" // ReturnValueType represents a type of return values. ReturnValueType = "ReturnValue" // ErrorType represents a type of errors. ErrorType = "Error" // FunctionType represents a type of functions. FunctionType = "Function" // StringType represents a type of strings. StringType = "String" // BuiltinType represents a type of builtin functions. BuiltinType = "Builtin" // ArrayType represents a type of arrays. ArrayType = "Array" // HashType represents a type of hashes. HashType = "Hash" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Array ¶
type Array struct {
Elements []Object
}
Array represents an array.
type Boolean ¶
type Boolean struct {
Value bool
}
Boolean represents a boolean.
type Builtin ¶
type Builtin struct {
Fucks BuiltinFunction
}
Builtin represents a builtin function.
type BuiltinFunction ¶
BuiltinFunction represents a function signature of builtin functions.
type Environment ¶
type Environment interface { // Get retrieves the value of a variable named by the `name`. // If the variable is present in the environment the value is returned and the boolean is true. // Otherwise the returned value will be nil and the boolean will be false. Get(name string) (Object, bool) // Set sets the `val` of a variable named by the `name` and returns the `val` itself. Set(name string, val Object) Object }
Environment associates values with variable names.
func NewEnclosedEnvironment ¶
func NewEnclosedEnvironment(outer Environment) Environment
NewEnclosedEnvironment creates a new Environment which holds the given outer Environment.
type Error ¶
type Error struct {
Message string
}
Error represents an error.
type Float ¶
type Float struct {
Value float64
}
Float represents an integer.
type Function ¶
type Function struct { Parameters []*ast.Ident Body *ast.BlockStatement Env Environment }
Function represents a function.
type Hash ¶
Hash represents a hash.
type Hashable ¶
type Hashable interface {
HashKey() HashKey
}
Hashable is the interface that is able to become a hash key.
type Integer ¶
type Integer struct {
Value int64
}
Integer represents an integer.
type Nil ¶
type Nil struct{}
Nil represents the absence of any value.
type ReturnValue ¶
type ReturnValue struct {
Value Object
}
ReturnValue represents a return value.
func (*ReturnValue) Inspect ¶
func (rv *ReturnValue) Inspect() string
Inspect returns a string representation of the ReturnValue.
func (*ReturnValue) Type ¶
func (rv *ReturnValue) Type() Type
Type returns the type of the ReturnValue.