Documentation ¶
Index ¶
- Constants
- type Array
- type Boolean
- type Builtin
- type BuiltinFunction
- type Environment
- func (e *Environment) Copy(scope int, degrees bool, outer *Environment, program program, ...)
- func (e *Environment) DeleteData()
- func (e *Environment) DeleteFunctions()
- func (e *Environment) DeleteProcedures()
- func (e *Environment) DeleteStore()
- func (e *Environment) DeleteSubroutines()
- func (e *Environment) Dump() (scope int, degrees bool, outer *Environment, program program, ...)
- func (e *Environment) EndProgram()
- func (e *Environment) Get(name string) (Object, bool)
- func (e *Environment) GetArray(name string, subscripts []int) (Object, bool)
- func (e *Environment) GetFunction(name string) (*ast.FunctionDeclaration, bool)
- func (e *Environment) GetProcedure(name string) (*ast.ProcedureDeclaration, bool)
- func (e *Environment) GetSubroutine(name string) (*ast.SubroutineStatement, bool)
- func (e *Environment) Global(name string) bool
- func (e *Environment) IsBaseScope() bool
- func (e *Environment) IsGlobal(name string) bool
- func (e *Environment) KillScope()
- func (e *Environment) LeaveFunction()
- func (e *Environment) NewArray(name string, subscripts []int) (Object, bool)
- func (e *Environment) NewScope()
- func (e *Environment) PopData() Object
- func (e *Environment) PushData(obj Object)
- func (e *Environment) PushFunction(fun *ast.FunctionDeclaration)
- func (e *Environment) PushProcedure(proc *ast.ProcedureDeclaration)
- func (e *Environment) PushSubroutine(sub *ast.SubroutineStatement)
- func (e *Environment) Set(name string, val Object) Object
- func (e *Environment) SetArray(name string, subscripts []int, val Object) (Object, bool)
- func (e *Environment) Wipe()
- type Error
- type Function
- type Null
- type Numeric
- type Object
- type ObjectType
- type ReturnValue
- type String
- type Warning
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 Boolean ¶
type Boolean struct {
Value bool
}
func (*Boolean) Type ¶
func (b *Boolean) Type() ObjectType
type Builtin ¶
type Builtin struct {
Fn BuiltinFunction
}
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) 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) Wipe ¶
func (e *Environment) Wipe()
type Function ¶
type Function struct { Parameters []*ast.Identifier Body *ast.BlockStatement Env *Environment }
func (*Function) Type ¶
func (f *Function) Type() ObjectType
type Numeric ¶
type Numeric struct {
Value float64
}
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
Click to show internal directories.
Click to hide internal directories.