object

package
v0.0.0-...-8df0819 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NULL     = "NULL"
	BOOLEAN  = "BOOLEAN"
	INTEGER  = "INTEGER"
	FLOAT    = "FLOAT"
	BYTES    = "BYTES"
	STRING   = "STRING"
	RETURN   = "RETURN"
	ERROR    = "ERROR"
	FUNCTION = "FUNCTION"
	BUILTIN  = "BUILTIN"
	LIST     = "LIST"
	HASH     = "HASH"
	FILE     = "FILE"
	BREAK    = "BREAK"
	CONTINUE = "CONTINUE"
	CLASS    = "CLASS"
	INSTANCE = "INSTANCE"
	THIS     = "THIS"
	MODULE   = "MODULE"
	ORIGIN   = "ORIGIN"
)

Variables

View Source
var Builtins = map[string]*Builtin{}

Functions

This section is empty.

Types

type Boolean

type Boolean struct {
	Value bool
}

func (*Boolean) HashKey

func (b *Boolean) HashKey() HashKey

func (*Boolean) String

func (b *Boolean) String() string

func (*Boolean) Type

func (b *Boolean) Type() Type

type Break

type Break struct{}

func (*Break) String

func (b *Break) String() string

func (*Break) Type

func (b *Break) Type() Type

type Builtin

type Builtin struct {
	Name string
	Fn   BuiltinFunction
}

func (*Builtin) String

func (b *Builtin) String() string

func (*Builtin) Type

func (b *Builtin) Type() Type

type BuiltinFunction

type BuiltinFunction func(args []Object) Object

type Bytes

type Bytes struct {
	Value []byte
}

func (*Bytes) Method

func (b *Bytes) Method(method string, args []Object) Object

func (*Bytes) String

func (b *Bytes) String() string

func (*Bytes) Type

func (b *Bytes) Type() Type

type Class

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

func (*Class) String

func (c *Class) String() string

func (*Class) Type

func (c *Class) Type() Type

type Continue

type Continue struct{}

func (*Continue) String

func (c *Continue) String() string

func (*Continue) Type

func (c *Continue) Type() Type

type Environment

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

func NewEnclosedEnvironment

func NewEnclosedEnvironment(outer *Environment) *Environment

func NewEnvironment

func NewEnvironment(directory string) *Environment

func (*Environment) All

func (e *Environment) All() map[string]Object

func (*Environment) Del

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

func (*Environment) Get

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

func (*Environment) GetDirectory

func (e *Environment) GetDirectory() string

func (*Environment) Has

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

func (*Environment) Set

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

func (*Environment) SetDirectory

func (e *Environment) SetDirectory(directory string)

type Error

type Error struct {
	Message string
}

func NewError

func NewError(format string, a ...interface{}) *Error

func (*Error) String

func (e *Error) String() string

func (*Error) Type

func (e *Error) Type() Type

type File

type File struct {
	Filename string
	Reader   *bufio.Reader
	Writer   *bufio.Writer
	Handle   *os.File
}

func (*File) Method

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

func (*File) String

func (f *File) String() string

func (*File) Type

func (f *File) Type() Type

type Float

type Float struct {
	Value float64
}

func (*Float) String

func (f *Float) String() string

func (*Float) Type

func (f *Float) Type() Type

type Function

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

func (*Function) String

func (f *Function) String() string

func (*Function) Type

func (f *Function) Type() Type

type Handler

type Handler interface {
	Method(method string, args []Object) Object
}

type Hash

type Hash struct {
	Pairs map[HashKey]HashPair
	// contains filtered or unexported fields
}

func (*Hash) Method

func (h *Hash) Method(method string, args []Object) Object

func (*Hash) Next

func (h *Hash) Next() (Object, Object)

func (*Hash) Reset

func (h *Hash) Reset()

func (*Hash) String

func (h *Hash) String() string

func (*Hash) Type

func (h *Hash) Type() Type

type HashKey

type HashKey struct {
	Type  Type
	Value uint64
}

type HashPair

type HashPair struct {
	Key   Object
	Value Object
}

type Hashable

type Hashable interface {
	HashKey() HashKey
}

type Instance

type Instance struct {
	Class *Class
	Env   *Environment
}

func (*Instance) String

func (i *Instance) String() string

func (*Instance) Type

func (i *Instance) Type() Type

type Integer

type Integer struct {
	Value int64
}

func (*Integer) HashKey

func (i *Integer) HashKey() HashKey

func (*Integer) String

func (i *Integer) String() string

func (*Integer) Type

func (i *Integer) Type() Type

type Iterable

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

type List

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

func (*List) Method

func (l *List) Method(method string, args []Object) Object

func (*List) Next

func (l *List) Next() (Object, Object)

func (*List) Reset

func (l *List) Reset()

func (*List) String

func (l *List) String() string

func (*List) Type

func (l *List) Type() Type

type Module

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

func (*Module) String

func (m *Module) String() string

func (*Module) Type

func (m *Module) Type() Type

type ModuleFunction

type ModuleFunction func(args []Object) Object

type ModuleProperty

type ModuleProperty func() Object

type Null

type Null struct{}

func (*Null) String

func (n *Null) String() string

func (*Null) Type

func (n *Null) Type() Type

type Object

type Object interface {
	Type() Type
	String() string
}

type Origin

type Origin struct {
	Name    string
	Handler Handler
}

func (*Origin) Method

func (o *Origin) Method(method string, args []Object) Object

func (*Origin) String

func (o *Origin) String() string

func (*Origin) Type

func (o *Origin) Type() Type

type Return

type Return struct {
	Value Object
}

func (*Return) String

func (r *Return) String() string

func (*Return) Type

func (r *Return) Type() Type

type String

type String struct {
	Value string
	// contains filtered or unexported fields
}

func (*String) HashKey

func (s *String) HashKey() HashKey

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) String

func (s *String) String() string

func (*String) Type

func (s *String) Type() Type

type This

type This struct {
	Instance *Instance
}

func (*This) String

func (t *This) String() string

func (*This) Type

func (t *This) Type() Type

type Type

type Type string

Jump to

Keyboard shortcuts

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