object

package
v0.0.0-...-f512efc Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	INTEGER_OBJ      = "INTEGER"
	BOOLEAN_OBJ      = "BOOLEAN"
	NULL_OBJ         = "NULL"
	RETURN_VALUE_OBJ = "RETURN_VALUE"
	ERROR_OBJ        = "ERROR"
	FUNCTION_OBJ     = "FUNCTION"
	STRING_OBJ       = "STRING"
	BUILTIN_OBJ      = "BUILTIN"
	ARRAY_OBJ        = "ARRAY"
	BREAK            = "BREAK"
	CONTINUE         = "CONTINUE"
	MAP_OBJ          = "MAP"
	QUOTE_OBJ        = "QUOTE"
	MACRO_OBJ        = "MARCO"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Array

type Array struct {
	Elements []Object
}

func (*Array) Inspect

func (a *Array) Inspect() string

func (*Array) Type

func (a *Array) Type() ObjectType

type Boolean

type Boolean struct {
	Hashable
	Value bool
}

func (*Boolean) Hash

func (b *Boolean) Hash() HashKey

func (*Boolean) Inspect

func (b *Boolean) Inspect() string

func (*Boolean) Type

func (b *Boolean) Type() ObjectType

type BuiltFunction

type BuiltFunction func(args ...Object) Object

type Builtin

type Builtin struct {
	Fn BuiltFunction
}

func (*Builtin) Inspect

func (b *Builtin) Inspect() string

func (*Builtin) Type

func (b *Builtin) Type() ObjectType

type Environment

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

func ExtendEnvironment

func ExtendEnvironment(outer *Environment) *Environment

func NewEnvironment

func NewEnvironment() *Environment

func (*Environment) Get

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

func (*Environment) Set

func (e *Environment) Set(name string, value Object) Object

type Error

type Error struct {
	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 Hashable

type Hashable interface {
	Hash() HashKey
}

type Integer

type Integer struct {
	Hashable
	Value int64
}

func (*Integer) Hash

func (i *Integer) Hash() HashKey

func (*Integer) Inspect

func (i *Integer) Inspect() string

func (*Integer) Type

func (i *Integer) Type() ObjectType

type LoopControl

type LoopControl struct {
	ControlType ObjectType
}

func (*LoopControl) Inspect

func (lc *LoopControl) Inspect() string

func (*LoopControl) Type

func (lc *LoopControl) Type() ObjectType

type Macro

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

func (*Macro) Inspect

func (m *Macro) Inspect() string

func (*Macro) Type

func (m *Macro) Type() ObjectType

type Map

type Map struct {
	Pairs map[HashKey]MapPair
}

func (*Map) Inspect

func (m *Map) Inspect() string

func (*Map) Type

func (m *Map) Type() ObjectType

type MapPair

type MapPair struct {
	Key   Object
	Value 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 Quote

type Quote struct {
	Node ast.Node
}

func (*Quote) Inspect

func (q *Quote) Inspect() string

func (*Quote) Type

func (q *Quote) Type() ObjectType

type ReturnValue

type ReturnValue struct {
	Value Object
}

func (*ReturnValue) Inspect

func (rv *ReturnValue) Inspect() string

func (*ReturnValue) Type

func (rv *ReturnValue) Type() ObjectType

type String

type String struct {
	Hashable
	Value string
}

func (*String) Hash

func (s *String) Hash() HashKey

func (*String) Inspect

func (s *String) Inspect() string

func (*String) Type

func (s *String) Type() ObjectType

Jump to

Keyboard shortcuts

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