object

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NullObj        = "Null"
	TypeObj        = "Type"
	SetObj         = "Set"
	MapObj         = "Map"
	HexObj         = "Hex File"
	FileObj        = "File"
	ErrorObj       = "Error"
	ArrayObj       = "Array"
	StringObj      = "String"
	MethodObj      = "Method"
	IntegerObj     = "Int"
	BooleanObj     = "Bool"
	BuiltinObj     = "Builtin Function"
	FunctionObj    = "Function"
	ReturnValueObj = "Return value"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Array

type Array struct {
	Elements []Object
}

func (*Array) Inspect

func (arr *Array) Inspect() string

func (*Array) Type

func (arr *Array) Type() ObjectType

type Boolean

type Boolean struct {
	Value bool
}

func (*Boolean) HashKey

func (b *Boolean) HashKey() HashKey

func (*Boolean) Inspect

func (b *Boolean) Inspect() string

func (*Boolean) Type

func (b *Boolean) Type() ObjectType

type Builtin

type Builtin struct {
	Function BuiltinFunction
}

func (*Builtin) Inspect

func (b *Builtin) Inspect() string

func (*Builtin) Type

func (b *Builtin) Type() ObjectType

type BuiltinFunction

type BuiltinFunction func(args ...Object) Object

type Environment

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

func NewEnvironment

func NewEnvironment() *Environment

func WrappedEnvironment

func WrappedEnvironment(outerEnv *Environment) *Environment

func (*Environment) Get

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

func (*Environment) IsNestedBlock

func (env *Environment) IsNestedBlock() bool

func (*Environment) Set

func (env *Environment) Set(name string, obj Object) Object

type Error

type Error struct {
	// TODO add subtype info referring to a typed enum for different error values
	Message string
}

func (*Error) Inspect

func (e *Error) Inspect() string

func (*Error) Type

func (e *Error) Type() ObjectType

type Function

type Function struct {
	Parameters []*ast.Identifier
	Body       *ast.BlockStatement
	Env        *Environment
}

func (*Function) Inspect

func (f *Function) Inspect() string

func (*Function) Type

func (f *Function) Type() ObjectType

type HashKey

type HashKey struct {
	Type  ObjectType
	Value uint64
}

type HashPair

type HashPair struct {
	Key   Object
	Value Object
}

type Hashable

type Hashable interface {
	HashKey() HashKey
}

type HexFile added in v0.2.0

type HexFile struct {
	Name string
	File *hex.File
}

func (*HexFile) Inspect added in v0.2.0

func (hf *HexFile) Inspect() string

func (*HexFile) Type added in v0.2.0

func (hf *HexFile) Type() ObjectType

type Integer

type Integer struct {
	Value int64
}

func (*Integer) HashKey

func (i *Integer) HashKey() HashKey

func (*Integer) Inspect

func (i *Integer) Inspect() string

func (*Integer) Type

func (i *Integer) Type() ObjectType

type Map

type Map struct {
	Mappings map[HashKey]HashPair
}

func (*Map) Inspect

func (h *Map) Inspect() string

func (*Map) Type

func (h *Map) Type() ObjectType

type Method

type Method struct {
	MethodFunc MethodFunction
}

func (*Method) Inspect

func (m *Method) Inspect() string

func (*Method) Type

func (m *Method) Type() ObjectType

type MethodFunction

type MethodFunction func(this Object, args ...Object) Object

type Null

type Null struct{}

func (*Null) Inspect

func (n *Null) Inspect() string

func (*Null) Type

func (n *Null) 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

type Set added in v0.2.0

type Set struct {
	Elements map[HashKey]Object
}

func (*Set) Inspect added in v0.2.0

func (s *Set) Inspect() string

func (*Set) Type added in v0.2.0

func (s *Set) Type() ObjectType

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() ObjectType

type Type

type Type struct {
	Value ObjectType
}

func (*Type) Inspect

func (t *Type) Inspect() string

func (*Type) Type

func (t *Type) Type() ObjectType

Jump to

Keyboard shortcuts

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