object

package
v0.0.0-...-68482a3 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NUMERIC_OBJ      = "NUMERIC"
	BOOLEAN_OBJ      = "BOOLEAN"
	ARRAY_OBJ        = "ARRAY"
	NULL_OBJ         = "NULL" // RM Basic didn't have null...I think it just created a new var with zero or "" value...maybe?
	RETURN_VALUE_OBJ = "RETURN_VALUE"
	FUNCTION_OBJ     = "FUNCTION"
	STRING_OBJ       = "STRING"
	BUILTIN_OBJ      = "BUILTIN"
	ERROR_OBJ        = "ERROR"
	WARNING_OBJ      = "WARNING"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Array

type Array struct {
	Items      []Object
	Subscripts []int
}

func (*Array) Inspect

func (b *Array) Inspect() string

func (*Array) Type

func (b *Array) Type() ObjectType

type Boolean

type Boolean struct {
	Value bool
}

func (*Boolean) Inspect

func (b *Boolean) Inspect() string

func (*Boolean) Type

func (b *Boolean) Type() ObjectType

type Builtin

type Builtin struct {
	Fn BuiltinFunction
}

func (*Builtin) Inspect

func (b *Builtin) Inspect() string

func (*Builtin) Type

func (b *Builtin) Type() ObjectType

type BuiltinFunction

type BuiltinFunction func(env *Environment, g *game.Game, args []Object) Object

type Environment

type Environment struct {
	GlobalEnv *Environment

	Degrees bool

	Program   program
	JumpStack jumpStack
	Prerun    bool

	LeaveFunctionSignal bool
	EndProgramSignal    bool
	ReturnVals          []Object
	// contains filtered or unexported fields
}

func NewEnclosedEnvironment

func NewEnclosedEnvironment(outer *Environment) *Environment

func NewEnvironment

func NewEnvironment(GlobalEnv *Environment) *Environment

func (*Environment) Copy

func (e *Environment) Copy(scope int, degrees bool, outer *Environment,
	program program, jumpStack jumpStack, prerun bool,
	dataItems []Object, subroutines []*ast.SubroutineStatement, functions []*ast.FunctionDeclaration,
	procedures []*ast.ProcedureDeclaration, leaveFunctionSignal bool, endProgramSignal bool,
	returnVals []Object)

func (*Environment) DeleteData

func (e *Environment) DeleteData()

func (*Environment) DeleteFunctions

func (e *Environment) DeleteFunctions()

func (*Environment) DeleteProcedures

func (e *Environment) DeleteProcedures()

func (*Environment) DeleteStore

func (e *Environment) DeleteStore()

func (*Environment) DeleteSubroutines

func (e *Environment) DeleteSubroutines()

func (*Environment) Dump

func (e *Environment) Dump() (scope int, degrees bool, outer *Environment,
	program program, jumpStack jumpStack, prerun bool,
	dataItems []Object, subroutines []*ast.SubroutineStatement, functions []*ast.FunctionDeclaration,
	procedures []*ast.ProcedureDeclaration, leaveFunctionSignal bool, endProgramSignal bool,
	returnVals []Object)

Dump and Copy are used to transfer global data, including the program itself, from a parent env to a child env

func (*Environment) EndProgram

func (e *Environment) EndProgram()

func (*Environment) Get

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

func (*Environment) GetArray

func (e *Environment) GetArray(name string, subscripts []int) (Object, bool)

func (*Environment) GetFunction

func (e *Environment) GetFunction(name string) (*ast.FunctionDeclaration, bool)

func (*Environment) GetProcedure

func (e *Environment) GetProcedure(name string) (*ast.ProcedureDeclaration, bool)

func (*Environment) GetSubroutine

func (e *Environment) GetSubroutine(name string) (*ast.SubroutineStatement, bool)

func (*Environment) Global

func (e *Environment) Global(name string) bool

func (*Environment) IsBaseScope

func (e *Environment) IsBaseScope() bool

func (*Environment) IsGlobal

func (e *Environment) IsGlobal(name string) bool

func (*Environment) KillScope

func (e *Environment) KillScope()

func (*Environment) LeaveFunction

func (e *Environment) LeaveFunction()

func (*Environment) NewArray

func (e *Environment) NewArray(name string, subscripts []int) (Object, bool)

func (*Environment) NewScope

func (e *Environment) NewScope()

func (*Environment) PopData

func (e *Environment) PopData() Object

func (*Environment) PushData

func (e *Environment) PushData(obj Object)

func (*Environment) PushFunction

func (e *Environment) PushFunction(fun *ast.FunctionDeclaration)

func (*Environment) PushProcedure

func (e *Environment) PushProcedure(proc *ast.ProcedureDeclaration)

func (*Environment) PushSubroutine

func (e *Environment) PushSubroutine(sub *ast.SubroutineStatement)

func (*Environment) Set

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

func (*Environment) SetArray

func (e *Environment) SetArray(name string, subscripts []int, val Object) (Object, bool)

func (*Environment) Wipe

func (e *Environment) Wipe()

type Error

type Error struct {
	Message         string
	ErrorTokenIndex int
}

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 Null

type Null struct{}

func (*Null) Inspect

func (n *Null) Inspect() string

func (*Null) Type

func (n *Null) Type() ObjectType

type Numeric

type Numeric struct {
	Value float64
}

func (*Numeric) Inspect

func (i *Numeric) Inspect() string

func (*Numeric) Type

func (i *Numeric) Type() ObjectType

type Object

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

type ObjectType

type ObjectType string

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 {
	Value string
}

func (*String) Inspect

func (s *String) Inspect() string

func (*String) Type

func (s *String) Type() ObjectType

type Warning

type Warning struct {
	Message string
}

func (*Warning) Inspect

func (w *Warning) Inspect() string

func (*Warning) Type

func (w *Warning) Type() ObjectType

Jump to

Keyboard shortcuts

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