object

package
v0.0.0-...-9a48fe3 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	INTEGER_OBJ = "INTEGER"
	FLOAT_OBJ   = "FLOAT"
	STRING_OBJ  = "STRING"
	BOOLEAN_OBJ = "BOOLEAN"
	ARRAY_OBJ   = "ARRAY"
	HASH_OBJ    = "HASH"

	NULL_OBJ  = "NULL"
	ERROR_OBJ = "ERROR"

	RETURN_VALUE_OBJ = "RETURN_VALUE"
	FUNCTION_OBJ     = "FUNCTION"

	BUILTIN_OBJ = "BUILTIN"
	QUOTE_OBJ   = "QUOTE"
	MACRO_OBJ   = "MACRO"
	FILE_OBJ    = "FILE"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Array

type Array struct {
	Elements []Object
	// contains filtered or unexported fields
}

func (*Array) Inspect

func (ao *Array) Inspect() string

func (*Array) InvokeMethod

func (ao *Array) InvokeMethod(method string, args ...Object) Object

func (*Array) Next

func (ao *Array) Next() (Object, Object, bool)

func (*Array) Reset

func (ao *Array) Reset()

func (*Array) Type

func (ao *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) InvokeMethod

func (b *Boolean) InvokeMethod(method string, args ...Object) Object

func (*Boolean) Type

func (b *Boolean) Type() ObjectType

type Builtin

type Builtin struct {
	Fn func(token token.Token, args ...Object) Object
}

func (*Builtin) Inspect

func (b *Builtin) Inspect() string

func (*Builtin) InvokeMethod

func (b *Builtin) InvokeMethod(method string, args ...Object) Object

func (*Builtin) Type

func (b *Builtin) Type() ObjectType

type Environment

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

func NewEnclosedEnvironment

func NewEnclosedEnvironment(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, val Object) Object

type Error

type Error struct {
	Message   string
	ErrorName string
	FileName  string
	Token     token.Token
}

func (*Error) Inspect

func (e *Error) Inspect() string

func (*Error) InvokeMethod

func (e *Error) InvokeMethod(method string, args ...Object) Object

func (*Error) Type

func (e *Error) Type() ObjectType

type File

type File struct {
	File *os.File
}

func (*File) Inspect

func (f *File) Inspect() string

func (*File) InvokeMethod

func (f *File) InvokeMethod(method string, args ...Object) Object

func (*File) Type

func (f *File) Type() ObjectType

type Float

type Float struct {
	Value float64
}

func (*Float) Inspect

func (f *Float) Inspect() string

func (*Float) InvokeMethod

func (f *Float) InvokeMethod(method string, args ...Object) Object

func (*Float) Type

func (f *Float) 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) InvokeMethod

func (f *Function) InvokeMethod(method string, args ...Object) Object

func (*Function) Type

func (f *Function) Type() ObjectType

type Hash

type Hash struct {
	Pairs map[HashKey]HashPair
	// contains filtered or unexported fields
}

func (*Hash) Inspect

func (h *Hash) Inspect() string

func (*Hash) InvokeMethod

func (h *Hash) InvokeMethod(method string, args ...Object) Object

func (*Hash) Next

func (h *Hash) Next() (Object, Object, bool)

func (*Hash) Reset

func (h *Hash) Reset()

func (*Hash) Type

func (h *Hash) 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 Integer

type Integer struct {
	Value int64
}

func (*Integer) HashKey

func (i *Integer) HashKey() HashKey

func (*Integer) Inspect

func (i *Integer) Inspect() string

func (*Integer) InvokeMethod

func (i *Integer) InvokeMethod(method string, args ...Object) Object

func (*Integer) Type

func (i *Integer) Type() ObjectType

type Iterable

type Iterable interface {
	Reset()
	Next() (Object, Object, bool)
}

type Macro

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

func (*Macro) Inspect

func (m *Macro) Inspect() string

func (*Macro) InvokeMethod

func (q *Macro) InvokeMethod(method string, args ...Object) Object

func (*Macro) Type

func (m *Macro) Type() ObjectType

type Null

type Null struct{}

func (*Null) Inspect

func (n *Null) Inspect() string

func (*Null) InvokeMethod

func (n *Null) InvokeMethod(method string, args ...Object) Object

func (*Null) Type

func (n *Null) Type() ObjectType

type Object

type Object interface {
	Type() ObjectType
	Inspect() string
	InvokeMethod(method string, args ...Object) Object
}

type ObjectType

type ObjectType string

type Quote

type Quote struct {
	Node ast.Node
}

func (*Quote) Inspect

func (q *Quote) Inspect() string

func (*Quote) InvokeMethod

func (q *Quote) InvokeMethod(method string, args ...Object) Object

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) InvokeMethod

func (rv *ReturnValue) InvokeMethod(method string, args ...Object) Object

func (*ReturnValue) Type

func (rv *ReturnValue) Type() ObjectType

type String

type String struct {
	Value string
	// contains filtered or unexported fields
}

func (*String) HashKey

func (s *String) HashKey() HashKey

func (*String) Inspect

func (s *String) Inspect() string

func (*String) InvokeMethod

func (s *String) InvokeMethod(method string, args ...Object) Object

func (*String) Next

func (s *String) Next() (Object, Object, bool)

func (*String) Reset

func (s *String) Reset()

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