Documentation
¶
Index ¶
Constants ¶
This section is empty.
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 GetBuiltinByName ¶
func (*Builtin) Type ¶
func (b *Builtin) Type() ObjectType
type BuiltinFunction ¶
type Closure ¶
type Closure struct {
Fn *CompiledFunction
Free []Object
}
func (*Closure) Type ¶
func (c *Closure) Type() ObjectType
type CompiledFunction ¶
type CompiledFunction struct {
Instructions code.Instructions
NumLocals int
NumParams int
}
func (*CompiledFunction) Inspect ¶
func (cf *CompiledFunction) Inspect() string
func (*CompiledFunction) Type ¶
func (cf *CompiledFunction) Type() ObjectType
type Environment ¶
type Environment struct {
// contains filtered or unexported fields
}
func NewEnclosedEnvironment ¶
func NewEnclosedEnvironment(outer *Environment) *Environment
func NewEnvironment ¶
func NewEnvironment() *Environment
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 Number ¶
type Number struct {
Value float64
}
func (*Number) Type ¶
func (n *Number) Type() ObjectType
type Object ¶
type Object interface {
Type() ObjectType
Inspect() string
}
type ObjectType ¶
type ObjectType string
const ( NumberObj ObjectType = "NUMBER" BooleanObj ObjectType = "BOOLEAN" NullObj ObjectType = "NULL" StringObj ObjectType = "STRING" ArrayObj ObjectType = "ARRAY" HashObj ObjectType = "HASH" FunctionObj ObjectType = "FUNCTION" ReturnObj ObjectType = "RETURN_VALUE" ErrorObj ObjectType = "ERROR" BuiltinObj ObjectType = "BUILTIN" CompiledFunctionObj ObjectType = "COMPILED_FUNCTION" ClosureObj ObjectType = "CLOSURE" )
type ReturnValue ¶
type ReturnValue struct {
Value Object
}
func (*ReturnValue) Inspect ¶
func (rv *ReturnValue) Inspect() string
func (*ReturnValue) Type ¶
func (rv *ReturnValue) Type() ObjectType
Click to show internal directories.
Click to hide internal directories.