Documentation ¶
Index ¶
- Constants
- Variables
- func Check(name string, args []Object, checks ...CheckFunc) error
- func InspectObject(args ...Object) string
- func IsArray(o Object) bool
- func IsError(o Object) bool
- func IsHash(o Object) bool
- func IsNumber(o Object) bool
- func IsString(o Object) bool
- func IsTruthy(o Object) bool
- type Array
- type Boolean
- type Break
- type Builtin
- type BuiltinFunction
- type CallableMethod
- type CheckFunc
- type Cloneable
- type Comparable
- type Enum
- type Environment
- type Error
- type Float
- type FunctionLiteral
- type Hash
- type HashKey
- type HashPair
- type Hashable
- type Integer
- type Null
- type Object
- type ObjectType
- type ReturnValue
- type String
Constants ¶
View Source
const ( NULL_OBJ = "NULL" ERROR_OBJ = "ERROR" RETURN_VALUE_OBJ = "RETURN_VALUE" BREAK_VALUE_OBJ = "BREAK_VALUE" ENUM_OBJ = "ENUM" FUNCTION_OBJ = "FUNCTION" BUILTIN_OBJ = "BUILTIN" INTEGER_OBJ = "INTEGER" FLOAT_OBJ = "FLOAT" BOOLEAN_OBJ = "BOOLEAN" STRING_OBJ = "STRING" ARRAY_OBJ = "ARRAY" HASH_OBJ = "HASH" )
Variables ¶
View Source
var ( TRUE = &Boolean{Value: true} FALSE = &Boolean{Value: false} )
View Source
var ( // Arguments is argument that is passed from CLI arguments Arguments []string // StandardInput where is standard input StandardInput io.Reader // StandardOutput where is standard output StandardOutput io.Writer // ExitFunction where function responsible for exit ExitFunction func(int) )
View Source
var EPSILON float64 = 0.00000001
EPSILON is used only for internally usage only for now.
View Source
var (
NULL = &Null{}
)
Functions ¶
func InspectObject ¶
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 Break ¶
type Break struct {
Value Object
}
func (*Break) Type ¶
func (b *Break) Type() ObjectType
type Builtin ¶
type Builtin struct {
Fn BuiltinFunction
}
func NewBuiltin ¶
func NewBuiltin(function BuiltinFunction) *Builtin
func (*Builtin) Type ¶
func (b *Builtin) Type() ObjectType
type BuiltinFunction ¶
type CallableMethod ¶
CallableMethod is use for calling method in data type.
type CheckFunc ¶
CheckFunc signature for check arguments function
func OneOfType ¶
func OneOfType(types ...ObjectType) CheckFunc
OneOfType almost same as WithTypes but check one of type of ObjectType
func WithTypes ¶
func WithTypes(types ...ObjectType) CheckFunc
WithTypes combined with ExactArgs it will check if we got ObjectType by it is order.
type Comparable ¶
Comparable is the interface for comparing two Object and their underlying values. It is the responsibility of the caller (left) to check for types. E.g.: 1 > 1, it will return -1. left isn't greater than 1.
type Environment ¶
type Environment struct {
// contains filtered or unexported fields
}
func NewEnclosedEnvironment ¶
func NewEnclosedEnvironment(outer *Environment) *Environment
func NewEnvironment ¶
func NewEnvironment() *Environment
type Error ¶
type Error struct {
Message string
}
func NewErrorFormat ¶
func (*Error) Type ¶
func (e *Error) Type() ObjectType
type Float ¶
type Float struct { Value float64 // contains filtered or unexported fields }
func (*Float) Type ¶
func (f *Float) Type() ObjectType
type FunctionLiteral ¶
type FunctionLiteral struct { Parameters []ast.Expression Body *ast.BlockStatement Env *Environment }
func (*FunctionLiteral) Inspect ¶
func (f *FunctionLiteral) Inspect() string
func (*FunctionLiteral) Type ¶
func (f *FunctionLiteral) Type() ObjectType
type Hashable ¶
type Hashable interface {
HashKey() HashKey
}
Hashable exist for object implement it in order to be used in Hash object
type Integer ¶
type Integer struct {
Value int64
}
func (*Integer) Type ¶
func (i *Integer) Type() ObjectType
type Object ¶
type Object interface { Type() ObjectType Inspect() string }
type ObjectType ¶
type ObjectType string
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.