object

package
v0.0.0-...-444f7c5 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2023 License: BSD-2-Clause Imports: 5 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 {
	Value []Object
}

func (*Array) String

func (n *Array) String() string

func (*Array) Type

func (n *Array) Type() ObjectType

type Bool

type Bool struct {
	Value bool
}

func (*Bool) String

func (b *Bool) String() string

func (*Bool) Type

func (b *Bool) Type() ObjectType

type Env

type Env struct {
	// Stack is the primary storage of values.
	Stack stack
	Vars  vars
}

Env is an environment of the runtime which contains runtime values.

func NewEnv

func NewEnv() *Env

NewEnv returns a new object.Env instance.

type Null

type Null struct{}

func (*Null) String

func (n *Null) String() string

func (*Null) Type

func (n *Null) Type() ObjectType

type Number

type Number struct {
	Value float64
}

func (*Number) String

func (n *Number) String() string

func (*Number) Type

func (n *Number) Type() ObjectType

type Object

type Object interface {
	// Type returns the primitive type of the object.
	Type() ObjectType
	// String returns the string representation of the value.
	String() string
}

Object represents an object in the runtime.

type ObjectType

type ObjectType string
const (
	NumberType ObjectType = "Number"
	StringType ObjectType = "String"
	BoolType   ObjectType = "Bool"
	ObjType    ObjectType = "Obj"
	NullType   ObjectType = "Null"
	ArrayType  ObjectType = "Array"
)

type String

type String struct {
	Value string
}

func (*String) String

func (s *String) String() 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