object

package
v0.0.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 7, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	INTEGER_OBJ  = "INTEGER"
	FLOAT_OBJ    = "FLOAT"
	DECIMAL_OBJ  = "DECIMAL"
	BOOLEAN_OBJ  = "BOOLEAN"
	RETURN_OBJ   = "RETURN"
	ERROR_OBJ    = "ERROR"
	NULL_OBJ     = "NULL"
	FUNCTION_OBJ = "FUNCTION"
	STRING_OBJ   = "STRING"
	BUILTIN_OBJ  = "BUILTIN"
	ARRAY_OBJ    = "ARRAY"
	HASH_OBJ     = "HASH"
	BREAK_OBJ    = "BREAK"
	SKIP_OBJ     = "SKIP"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Array

type Array struct {
	Elements []Object
}

func (*Array) Inspect

func (array *Array) Inspect() string

func (*Array) Type

func (array *Array) Type() string

type Boolean

type Boolean struct {
	Value bool
}

func (*Boolean) HashKey

func (b *Boolean) HashKey() HashKey

func (*Boolean) Inspect

func (boolean *Boolean) Inspect() string

func (*Boolean) Type

func (boolean *Boolean) Type() string

type Break added in v0.0.3

type Break struct{}

func (*Break) Inspect added in v0.0.3

func (b *Break) Inspect() string

func (*Break) Type added in v0.0.3

func (b *Break) Type() string

type Buffer

type Buffer struct {
	Value []bytes.Buffer
}

func (*Buffer) Inspect

func (buffer *Buffer) Inspect() string

func (*Buffer) Type

func (buffer *Buffer) Type() string

type Builtin

type Builtin struct {
	Func func(args ...Object) Object
	Desc string
	Name string
}

func (*Builtin) Inspect

func (builtin *Builtin) Inspect() string

func (*Builtin) Type

func (builtin *Builtin) Type() string

type Decimal added in v0.0.6

type Decimal struct {
	Value decimal.Decimal
}

func (*Decimal) Inspect added in v0.0.6

func (decimal *Decimal) Inspect() string

func (*Decimal) Type added in v0.0.6

func (decimal *Decimal) Type() string

type Environment

type Environment struct {
	// contains filtered or unexported fields
}

func NewEnvironment

func NewEnvironment() *Environment

func NewLocalEnvironment

func NewLocalEnvironment(outer *Environment) *Environment

func (*Environment) Get

func (e *Environment) Get(name string) (Object, bool)

func (*Environment) GetMainEnv added in v0.0.3

func (e *Environment) GetMainEnv() *Environment

func (*Environment) GetOuterEnv added in v0.0.3

func (e *Environment) GetOuterEnv() *Environment

func (*Environment) GetTargetEnv added in v0.0.6

func (e *Environment) GetTargetEnv(name string) *Environment

GetTargetEnv returns the environment that contains the variable with the given name If the variable is not found, it returns nil This is used to check if a variable is declared in the current scope or not

func (*Environment) Set

func (e *Environment) Set(name string, val Object, isConst bool) Object

type Error

type Error struct {
	Msg string
}

func (*Error) Inspect

func (err *Error) Inspect() string

func (*Error) Type

func (err *Error) Type() string

type Float added in v0.0.5

type Float struct {
	Value float64
}

func (*Float) Inspect added in v0.0.5

func (float *Float) Inspect() string

func (*Float) Type added in v0.0.5

func (float *Float) Type() string

type Function

type Function struct {
	Parameters []*ast.Identifier
	Body       *ast.BlockStatement
	// The environment in which the function was defined, This allow a closure
	Env *Environment
}

func (*Function) Inspect

func (function *Function) Inspect() string

func (*Function) Type

func (function *Function) Type() string

type Hash

type Hash struct {
	Pairs map[HashKey]HashPair
}

func (*Hash) Inspect

func (hash *Hash) Inspect() string

func (*Hash) Type

func (hash *Hash) Type() string

type HashKey

type HashKey struct {
	Type  string
	Value uint64
}

type HashPair

type HashPair struct {
	Key   Object
	Value Object
}

type Hashable

type Hashable interface {
	HashKey() HashKey
}

type Integer

type Integer struct {
	Value int64
}

func (*Integer) HashKey

func (i *Integer) HashKey() HashKey

func (*Integer) Inspect

func (integer *Integer) Inspect() string

func (*Integer) Type

func (integer *Integer) Type() string

type Null

type Null struct{}

func (*Null) Inspect

func (null *Null) Inspect() string

func (*Null) Type

func (null *Null) Type() string

type Object

type Object interface {
	Type() string
	Inspect() string
}

type Return

type Return struct {
	Value Object
}

func (*Return) Inspect

func (returnObj *Return) Inspect() string

func (*Return) Type

func (returnObj *Return) Type() string

type Skip added in v0.0.3

type Skip struct{}

func (*Skip) Inspect added in v0.0.3

func (s *Skip) Inspect() string

func (*Skip) Type added in v0.0.3

func (s *Skip) Type() string

type StoreType

type StoreType map[string]Object

type String

type String struct {
	Value string
}

func (*String) HashKey

func (str *String) HashKey() HashKey

func (*String) Inspect

func (str *String) Inspect() string

func (*String) Type

func (str *String) Type() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL