object

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// IntegerObj represents integer objects
	IntegerObj = "INTEGER"
	// FloatObj represents floating point objects
	FloatObj = "FLOAT"
	// BooleanObj represents boolean objects
	BooleanObj = "BOOLEAN"
	// SoundObj represents a Reverb sound abstraction object
	SoundObj = "SOUND"
	// NullObj represents the concept of null
	NullObj = "NULL"
	// ReturnValueObj represents a value returned from a function
	ReturnValueObj = "RETURN_VALUE"
	// ErrorObj represents an error return from the interpreter
	ErrorObj = "ERROR"
	// FunctionObj represents a user-defined function object
	FunctionObj = "FUNCTION"
	// BuiltinObj represents a Reverb function object
	BuiltinObj = "BUILTIN"
	// ArrayObj represents an array object
	ArrayObj = "ARRAY"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Array

type Array struct {
	Elements []Object
}

Array represents the array data type

func (*Array) Inspect

func (a *Array) Inspect() string

Inspect returns the string value of the array object

func (*Array) Type

func (a *Array) Type() Type

Type returns the array object type

type Boolean

type Boolean struct {
	Value bool
}

Boolean represents the boolean data type

func (*Boolean) Inspect

func (b *Boolean) Inspect() string

Inspect returns the string value of the boolean object

func (*Boolean) Type

func (b *Boolean) Type() Type

Type returns the boolean object type

type Builtin

type Builtin struct {
	Fn BuiltinFunction
}

Builtin represents a builtin function object

func (*Builtin) Inspect

func (b *Builtin) Inspect() string

Inspect returns the string value of the builtin function object

func (*Builtin) Type

func (b *Builtin) Type() Type

Type returns the builtin function object type

type BuiltinFunction

type BuiltinFunction func(args ...Object) Object

BuiltinFunction represent functions that are part of the Reverb standard library

type Environment

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

Environment represents a virtual environment within Reverb

func NewEnclosedEnvironment

func NewEnclosedEnvironment(outer *Environment) *Environment

NewEnclosedEnvironment creates an extended environment

func NewEnvironment

func NewEnvironment() *Environment

NewEnvironment creates a new environment instance

func (*Environment) Get

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

Get returns an object within the environment

func (*Environment) Set

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

Set assigns a new object within the environment

type Error

type Error struct {
	Message string
}

Error represents an interpreter error

func (*Error) Inspect

func (e *Error) Inspect() string

Inspect returns the string value of the the error object

func (*Error) Type

func (e *Error) Type() Type

Type returns the error object type

type Float

type Float struct {
	Value float64
}

Float represents the floating point data type

func (*Float) Inspect

func (f *Float) Inspect() string

Inspect returns the string value of the float object

func (*Float) Type

func (f *Float) Type() Type

Type returns the float object type

type Function

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

Function represents the function type

func (*Function) Inspect

func (f *Function) Inspect() string

Inspect returns the string value of the function object

func (*Function) Type

func (f *Function) Type() Type

Type returns the function object type

type Integer

type Integer struct {
	Value int64
}

Integer represents the integer data type

func (*Integer) Inspect

func (i *Integer) Inspect() string

Inspect returns the string value of the integer object

func (*Integer) Type

func (i *Integer) Type() Type

Type returns the integer object type

type Null

type Null struct{}

Null represents the null data type

func (*Null) Inspect

func (n *Null) Inspect() string

Inspect returns the string value of the null object

func (*Null) Type

func (n *Null) Type() Type

Type returns the null object type

type Object

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

Object represents the smallest component of a Reverb program

type ReturnValue

type ReturnValue struct {
	Value Object
}

ReturnValue represents the return value object

func (*ReturnValue) Inspect

func (rv *ReturnValue) Inspect() string

Inspect returns the string value of the return value object

func (*ReturnValue) Type

func (rv *ReturnValue) Type() Type

Type returns the return value object type

type Sound

type Sound struct {
	Value sounds.Sound
}

Sound represents an abstraction of the go-sounds Sound interface for Reverb

func (*Sound) Inspect

func (s *Sound) Inspect() string

Inspect returns the string value of the sound object

func (*Sound) Type

func (s *Sound) Type() Type

Type returns the sound object type

type Type

type Type string

Type represents the type of an object

Jump to

Keyboard shortcuts

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