object

package
v0.5.16 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2023 License: GPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	INTEGER_OBJ      = "NAMBA"
	FLOAT_OBJ        = "DESIMALI"
	BOOLEAN_OBJ      = "BOOLEAN"
	NULL_OBJ         = "TUPU"
	RETURN_VALUE_OBJ = "RUDISHA"
	ERROR_OBJ        = "KOSA"
	FUNCTION_OBJ     = "UNDO (FUNCTION)"
	STRING_OBJ       = "NENO"
	BUILTIN_OBJ      = "YA_NDANI"
	ARRAY_OBJ        = "ORODHA"
	DICT_OBJ         = "KAMUSI"
	CONTINUE_OBJ     = "ENDELEA"
	BREAK_OBJ        = "VUNJA"
	FILE_OBJ         = "FAILI"
	TIME_OBJ         = "MUDA"
	JSON_OBJ         = "JSONI"
	MODULE_OBJ       = "MODULE"
	BYTE_OBJ         = "BYTE"
	PACKAGE_OBJ      = "PAKEJI"
	INSTANCE         = "PAKEJI"
	AT               = "@"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Array

type Array struct {
	Elements []Object
	// contains filtered or unexported fields
}

func (*Array) Inspect

func (ao *Array) Inspect() string

func (*Array) Method

func (a *Array) Method(method string, args []Object) Object

func (*Array) Next

func (ao *Array) Next() (Object, Object)

func (*Array) Reset

func (ao *Array) Reset()

func (*Array) Type

func (ao *Array) Type() ObjectType

type At

type At struct {
	Instance *Instance
}

func (*At) Inspect

func (a *At) Inspect() string

func (*At) Type

func (a *At) Type() ObjectType

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 Break

type Break struct{}

func (*Break) Inspect

func (b *Break) Inspect() string

func (*Break) Type

func (b *Break) 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(args ...Object) Object

type Byte

type Byte struct {
	Value  []byte
	String string
}

func (*Byte) Inspect

func (b *Byte) Inspect() string

func (*Byte) Type

func (b *Byte) Type() ObjectType

type Continue

type Continue struct{}

func (*Continue) Inspect

func (c *Continue) Inspect() string

func (*Continue) Type

func (c *Continue) Type() ObjectType

type Dict

type Dict struct {
	Pairs map[HashKey]DictPair
	// contains filtered or unexported fields
}

func (*Dict) Inspect

func (d *Dict) Inspect() string

func (*Dict) Next

func (d *Dict) Next() (Object, Object)

func (*Dict) Reset

func (d *Dict) Reset()

func (*Dict) Type

func (d *Dict) Type() ObjectType

type DictPair

type DictPair struct {
	Key   Object
	Value Object
}

type Environment

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

func NewEnclosedEnvironment

func NewEnclosedEnvironment(outer *Environment) *Environment

func NewEnvironment

func NewEnvironment() *Environment

func (*Environment) Del

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

func (*Environment) Get

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

func (*Environment) Set

func (e *Environment) Set(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 File

type File struct {
	Filename string
	Content  string // To read the file
}

func (*File) Inspect

func (f *File) Inspect() string

func (*File) Method

func (f *File) Method(method string, args []Object) Object

func (*File) Type

func (f *File) Type() ObjectType

type Float

type Float struct {
	Value float64
}

func (*Float) HashKey

func (f *Float) HashKey() HashKey

func (*Float) Inspect

func (f *Float) Inspect() string

func (*Float) Type

func (f *Float) Type() ObjectType

type Function

type Function struct {
	Name       string
	Parameters []*ast.Identifier
	Defaults   map[string]ast.Expression
	Body       *ast.BlockStatement
	Env        *Environment
}

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 Hashable

type Hashable interface {
	HashKey() HashKey
}

type Instance

type Instance struct {
	Package *Package
	Env     *Environment
}

func (*Instance) Inspect

func (i *Instance) Inspect() string

func (*Instance) Type

func (i *Instance) Type() ObjectType

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 Iterable

type Iterable interface {
	Next() (Object, Object)
	Reset()
}

Iterable interface for dicts, strings and arrays

type Module

type Module struct {
	Name      string
	Functions map[string]ModuleFunction
}

func (*Module) Inspect

func (m *Module) Inspect() string

func (*Module) Type

func (m *Module) Type() ObjectType

type ModuleFunction

type ModuleFunction func(args []Object, defs map[string]Object) Object

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 Package

type Package struct {
	Name  *ast.Identifier
	Env   *Environment
	Scope *Environment
}

func (*Package) Inspect

func (p *Package) Inspect() string

func (*Package) Type

func (p *Package) Type() ObjectType

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
	// contains filtered or unexported fields
}

func (*String) HashKey

func (s *String) HashKey() HashKey

func (*String) Inspect

func (s *String) Inspect() string

func (*String) Method

func (s *String) Method(method string, args []Object) Object

func (*String) Next

func (s *String) Next() (Object, Object)

func (*String) Reset

func (s *String) Reset()

func (*String) Type

func (s *String) Type() ObjectType

type Time

type Time struct {
	TimeValue string
}

func (*Time) Inspect

func (t *Time) Inspect() string

func (*Time) Method

func (t *Time) Method(method string, args []Object, defs map[string]Object) Object

func (*Time) Type

func (t *Time) Type() ObjectType

Jump to

Keyboard shortcuts

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