Documentation ¶
Index ¶
- Constants
- Variables
- func IsTrue(obj Object) bool
- type Array
- type Boolean
- type Break
- type Builtin
- type BuiltinFunc
- type Continue
- type Error
- type Function
- type Hash
- type HashKey
- type HashPair
- type Hashable
- type Iterable
- type Nil
- type Number
- type Object
- type ObjectType
- type ReturnValue
- type Scope
- type String
- type Tuple
Constants ¶
View Source
const ( NUMBER_OBJ = "NUMBER" NIL_OBJ = "NIL_OBJ" BOOLEAN_OBJ = "BOOLEAN" STRING_OBJ = "STRING" ERROR_OBJ = "ERROR" RETURN_VALUE_OBJ = "RETURN_VALUE" FUNCTION_OBJ = "FUNCTION" BUILTIN_OBJ = "BUILTIN" ARRAY_OBJ = "ARRAY" TUPLE_OBJ = "TUPLE" HASH_OBJ = "HASH" BREAK_OBJ = "BREAK" CONTINUE_OBJ = "CONTINUE" )
Variables ¶
View Source
var ( ERR_ARGUMENT = "wrong number of arguments. expected=%d, got=%d" ERR_NOMETHOD = "undefined method '%s' for object %s" ERR_INDEX = "index error: '%d' out of range" ERR_KEY = "key error: type %s is not hashable" ERR_PREFIXOP = "unsupported operator for prefix expression:'%s' and type: %s" ERR_INFIXOP = "unsupported operator for infix expression: %s '%s' %s" ERR_POSTFIXOP = "unsupported operator for postfix expression:'%s' and type: %s" ERR_UNKNOWNIDENT = "unknown identifier: '%s' is not defined" ERR_DIVIDEBYZERO = "divide by zero" ERR_NOTFUNCTION = "not a function: %s" ERR_PARAMTYPE = "%s argument for '%s' should be type %s. got=%s" ERR_NOTITERABLE = "foreach's operating type must be iterable" ERR_NOINDEXABLE = "index error: type %s is not indexable" )
Functions ¶
Types ¶
type Array ¶
type Array struct {
Members []Object
}
func (*Array) CallMethod ¶
func (*Array) Type ¶
func (a *Array) Type() ObjectType
type Boolean ¶
type Boolean struct {
Bool bool
}
func NewBooleanObj ¶
func (*Boolean) CallMethod ¶
func (*Boolean) Type ¶
func (b *Boolean) Type() ObjectType
type Break ¶
type Break struct{}
func (*Break) CallMethod ¶
func (*Break) Type ¶
func (b *Break) Type() ObjectType
type Builtin ¶
type Builtin struct {
Fn BuiltinFunc
}
func (*Builtin) CallMethod ¶
func (*Builtin) Type ¶
func (b *Builtin) Type() ObjectType
type Continue ¶
type Continue struct{}
func (*Continue) CallMethod ¶
func (*Continue) Type ¶
func (c *Continue) Type() ObjectType
type Error ¶
type Error struct {
Message string
}
func (*Error) CallMethod ¶
func (*Error) Type ¶
func (e *Error) Type() ObjectType
type Function ¶
type Function struct { Literal *ast.FunctionLiteral Scope *Scope }
func (*Function) CallMethod ¶
func (*Function) Type ¶
func (f *Function) Type() ObjectType
type HashKey ¶
type HashKey struct { Type ObjectType Value uint64 }
type Iterable ¶
type Iterable interface {
// contains filtered or unexported methods
}
Whether the Object is iterable (HASH, ARRAY, STRING, TUPLE, Some of the GoObject)
type Nil ¶
type Nil struct { }
func (*Nil) CallMethod ¶
func (*Nil) Type ¶
func (n *Nil) Type() ObjectType
type Number ¶
type Number struct {
Value float64
}
func (*Number) CallMethod ¶
func (*Number) Type ¶
func (n *Number) Type() ObjectType
type Object ¶
type ReturnValue ¶
type ReturnValue struct {
Value Object
}
func (*ReturnValue) CallMethod ¶
func (*ReturnValue) Inspect ¶
func (rv *ReturnValue) Inspect() string
func (*ReturnValue) Type ¶
func (rv *ReturnValue) Type() ObjectType
type Scope ¶
func (*Scope) DebugPrint ¶
type String ¶
type String struct {
String string
}
func (*String) CallMethod ¶
func (*String) Type ¶
func (s *String) Type() ObjectType
type Tuple ¶
type Tuple struct { // Used in function return values. // if a function returns multiple values, they will wrap the results into a tuple, // the flag will be set to true IsMulti bool Members []Object }
func (*Tuple) CallMethod ¶
func (*Tuple) Type ¶
func (t *Tuple) Type() ObjectType
Click to show internal directories.
Click to hide internal directories.