object

package
v0.0.0-...-8bbaf59 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

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

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

type Builtin

type Builtin struct {
	Fn BuiltinFunction
}

func (*Builtin) Inspect

func (b *Builtin) Inspect() string

func (*Builtin) Type

func (b *Builtin) Type() Type

type BuiltinFunction

type BuiltinFunction func(args ...Object) Object

type Closure

type Closure interface {
	// contains filtered or unexported methods
}

type Environment

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

func ExtendEnvironment

func ExtendEnvironment(obj Closure, args []Object) *Environment

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
}

func (*Error) Inspect

func (e *Error) Inspect() string

func (*Error) Type

func (e *Error) Type() Type

type Function

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

func (*Function) Inspect

func (f *Function) Inspect() string

func (*Function) Type

func (f *Function) Type() Type

type Hash

type Hash struct {
	Pairs map[HashKey]HashPair
}

func (*Hash) Inspect

func (h *Hash) Inspect() string

func (*Hash) Type

func (h *Hash) Type() Type

type HashKey

type HashKey struct {
	Type  Type
	Value uint64
}

type HashPair

type HashPair struct {
	Key   Object
	Value Object
}

type Hashable

type Hashable interface {
	HashKey() HashKey
}

type Macro

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

func (*Macro) Inspect

func (m *Macro) Inspect() string

func (*Macro) Type

func (m *Macro) Type() Type

type Null

type Null struct{}

func (*Null) Inspect

func (n *Null) Inspect() string

func (*Null) Type

func (n *Null) Type() Type

type Number

type Number struct {
	Value float64
}

func (*Number) HashKey

func (i *Number) HashKey() HashKey

func (*Number) Inspect

func (i *Number) Inspect() string

func (*Number) Type

func (i *Number) Type() Type

type Object

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

type Quote

type Quote struct {
	Node ast.Node
}

func (*Quote) Inspect

func (q *Quote) Inspect() string

func (*Quote) Type

func (q *Quote) Type() Type

type ReturnValue

type ReturnValue struct {
	Value Object
}

func (*ReturnValue) Inspect

func (rv *ReturnValue) Inspect() string

func (*ReturnValue) Type

func (rv *ReturnValue) Type() Type

type String

type String struct {
	Value string
}

func (*String) HashKey

func (s *String) HashKey() HashKey

func (*String) Inspect

func (s *String) Inspect() string

func (*String) Type

func (s *String) Type() Type

type Type

type Type int
const (
	ANY Type = iota
	NUMBER
	BOOLEAN
	NULL
	RETURN_VALUE
	ERROR
	FUNCTION
	BUILTIN
	STRING
	ARRAY
	HASH
	QUOTE
	MACRO
)

func (Type) String

func (t Type) String() string

Jump to

Keyboard shortcuts

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