object

package
v0.0.0-...-34d69fc Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LOCAL  = "LOCAL"
	PUBLIC = "PUBLIC"
	CONST  = "CONST" // 上書き不可
)
View Source
const (
	INTEGER_OBJ                       = "INTEGER"
	NULL_OBJ                          = "NULL"
	EMPTY_OBJ                         = "EMPTY"
	BOOLEAN_OBJ                       = "BOOLEAN"
	FUNCTION_OBJ                      = "FUNCTION"
	ERROR_OBJ                         = "ERROR"
	RESULT_VALUE_OBJ                  = "RESULT_VALUE"
	STRING_OBJ                        = "STRING"
	BUILTIN_FUNCTION_OBJ              = "BUILTIN_FUNCTION_OBJ"
	BUILTIN_CONSTANT_OBJ              = "BUILTIN_CONSTANT_OBJ"
	ARRAY_OBJ                         = "ARRAY"
	HASHTBL_OBJ                       = "HASHTBL_OBJ"
	BUILTIN_FUNC_RETURN_RESULT_OBJ    = "BUILTIN_FUNC_RETURN_RESULT"
	BUILTIN_FUNC_RETURN_REFERENCE_OBJ = "BUILTIN_FUNC_RETURN_REFERENCE"
)

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

type BindedObject

type BindedObject struct {
	Key    string // なくてもいいけどデバッグ用に入れている
	Object Object
	Type   BindedObjectType
}

type BindedObjectType

type BindedObjectType string

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

type BuiltinConstant

type BuiltinConstant struct {
	T     BuiltinConstantType
	Value Object
}

func (*BuiltinConstant) Inspect

func (bc *BuiltinConstant) Inspect() string

func (*BuiltinConstant) Type

func (bc *BuiltinConstant) Type() ObjectType

type BuiltinConstantType

type BuiltinConstantType string

type BuiltinFuncArgument

type BuiltinFuncArgument struct {
	Expression ast.Expression
	Value      Object
}

type BuiltinFuncReturnReference

type BuiltinFuncReturnReference struct {
	Expression ast.Expression
	Value      Object
	Result     Object
}

func (*BuiltinFuncReturnReference) Inspect

func (b *BuiltinFuncReturnReference) Inspect() string

func (*BuiltinFuncReturnReference) Type

type BuiltinFuncReturnResult

type BuiltinFuncReturnResult struct {
	Value Object
}

func (*BuiltinFuncReturnResult) Inspect

func (b *BuiltinFuncReturnResult) Inspect() string

func (*BuiltinFuncReturnResult) Type

type BuiltinFunction

type BuiltinFunction struct {
	Fn func(args ...BuiltinFuncArgument) Object
}

func (*BuiltinFunction) Inspect

func (bf *BuiltinFunction) Inspect() string

func (*BuiltinFunction) Type

func (bf *BuiltinFunction) Type() ObjectType

type Empty

type Empty struct{}

func (*Empty) Inspect

func (e *Empty) Inspect() string

func (*Empty) Type

func (e *Empty) Type() ObjectType

type Environment

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

func NewEnclosedEnvironment

func NewEnclosedEnvironment(outer *Environment) *Environment

func NewEnvironment

func NewEnvironment() *Environment

func (*Environment) BindedObject

func (e *Environment) BindedObject(name string) (*BindedObject, bool)

func (*Environment) Get

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

func (*Environment) Set

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

func (*Environment) SetConst

func (e *Environment) SetConst(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() ObjectType

type Function

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

func (*Function) Inspect

func (f *Function) Inspect() string

func (*Function) Type

func (f *Function) Type() ObjectType

type HashKey

type HashKey struct {
	Type  ObjectType
	Value uint64
}

type HashPair

type HashPair struct {
	Key   Object
	Value Object
}

type HashTable

type HashTable struct {
	Pairs      map[HashKey]HashPair
	IsSort     bool
	IsCasecare bool
}

func (*HashTable) GetPairByIndex

func (ht *HashTable) GetPairByIndex(index int) HashPair

func (*HashTable) Inspect

func (ht *HashTable) Inspect() string

func (*HashTable) Type

func (ht *HashTable) Type() ObjectType

type Hashable

type Hashable interface {
	HashKey() HashKey
}

type Integer

type Integer struct {
	Value int64
}

func (*Integer) HashKey

func (i *Integer) HashKey() HashKey

func (*Integer) Inspect

func (i *Integer) Inspect() string

func (*Integer) Type

func (i *Integer) Type() ObjectType

type Null

type Null struct{}

func (*Null) Inspect

func (n *Null) Inspect() string

func (*Null) Type

func (n *Null) Type() ObjectType

type Object

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

type ObjectType

type ObjectType string

type ResultValue

type ResultValue struct {
	Value Object
}

func (*ResultValue) Inspect

func (rv *ResultValue) Inspect() string

func (*ResultValue) Type

func (rv *ResultValue) Type() ObjectType

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

Jump to

Keyboard shortcuts

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