object

package
v0.0.0-...-a199d56 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	INTEGER_OBJ           = "INTEGER"
	BOOLEAN_OBJ           = "BOOLEAN"
	NULL_OBJ              = "NULL"
	RETURN_VALUE_OBJ      = "RETURN_VALUE"
	ERROR_OBJ             = "ERROR"
	FUNCTION_OBJ          = "FUNCTION"
	STRING_OBJ            = "STRING"
	BUILTIN_OBJ           = "BUILTIN"
	ARRAY_OBJ             = "ARRAY"
	HASH_OBJ              = "HASH"
	EMPTY_OBJ             = "EMPTY"
	LOOP                  = "LOOP"
	LIST                  = "LIST"
	LIST_OBJ              = "LIST"
	URL_OBJ               = "URL"
	SCOPE_OBJ             = "SCOPE"
	BYTE_OBJ              = "BYTE"
	PROC_OBJ              = "PROC"
	ENV_OBJ               = "ENV"
	NOTIFICATION_OBJ      = "NOTIFICATION"
	SOCKET_OBJ            = "SOCKET"
	LITERAL_OBJ           = "LITERAL"
	DATABASE_OBJ          = "DATABASE"
	MODEL_OBJ             = "MODEL"
	BEGIN_OBJ             = "BEGIN"
	FLOAT_OBJ             = "FLOAT"
	ROUTE_OBJ             = "ROUTE"
	SIGNAL_OBJ            = "SIGNAL"
	ASM_OBJ               = "ASM"
	ASYNC_OBJ             = "ASYNC"
	SERVER_OBJ            = "SERVER"
	EVAL_OBJ              = "EVAL"
	COLOR_OBJ             = "COLOR"
	IMAGE_OBJ             = "IMAGE"
	LOAD_OBJ              = "LOAD"
	COMPILED_FUNCTION_OBJ = "COMPILED_FUNCTION"
	CLOSURE_OBJ           = "CLOSURE_OBJ"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Array

type Array struct {
	Elements []Object
}

func (*Array) Debug

func (ao *Array) Debug() string

func (*Array) Inspect

func (ao *Array) Inspect() string

func (*Array) Result

func (ao *Array) Result() string

func (*Array) Type

func (ao *Array) Type() ObjectType

type Async

type Async struct {
	Name         string
	ReturnResult Object
	Channel      chan Object
}

func (*Async) Debug

func (a *Async) Debug() string

func (*Async) Inspect

func (a *Async) Inspect() string

func (*Async) Result

func (a *Async) Result() string

func (*Async) Type

func (a *Async) Type() ObjectType

type Begin

type Begin struct {
	Name         string
	Error        Object
	State        bool
	ReturnResult interface{}
}

func (*Begin) Debug

func (b *Begin) Debug() string

func (*Begin) Inspect

func (b *Begin) Inspect() string

func (*Begin) Result

func (b *Begin) Result() string

func (*Begin) Type

func (b *Begin) Type() ObjectType

type Boolean

type Boolean struct {
	Value bool
}

func (*Boolean) Debug

func (b *Boolean) Debug() string

func (*Boolean) HashKey

func (b *Boolean) HashKey() HashKey

func (*Boolean) Inspect

func (b *Boolean) Inspect() string

func (*Boolean) Result

func (b *Boolean) Result() string

func (*Boolean) Type

func (b *Boolean) Type() ObjectType

type Builtin

type Builtin struct {
	Fn BuiltinFunction
}

func (*Builtin) Debug

func (b *Builtin) Debug() string

func (*Builtin) Inspect

func (b *Builtin) Inspect() string

func (*Builtin) Result

func (b *Builtin) Result() string

func (*Builtin) Type

func (b *Builtin) Type() ObjectType

type BuiltinFunction

type BuiltinFunction func(args ...Object) Object

type Byte

type Byte struct {
	Value byte
}

func (*Byte) Debug

func (b *Byte) Debug() string

func (*Byte) Inspect

func (b *Byte) Inspect() string

func (*Byte) Result

func (b *Byte) Result() string

func (*Byte) Type

func (b *Byte) Type() ObjectType

type Closure

type Closure struct {
	Fn   *CompiledFunction
	Free []Object
}

Closure holds a pointer to its compiled function and a slice of its free objects (variables it has access to that are not in either global or local scope)

func (*Closure) Debug

func (c *Closure) Debug() string

func (*Closure) Inspect

func (c *Closure) Inspect() string

Inspect returns a string representation of the Closure with its address

func (*Closure) Result

func (c *Closure) Result() string

func (*Closure) Type

func (c *Closure) Type() ObjectType

Type returns our Closure's ObjectType (ClosureObj)

type Color

type Color struct {
	Definition Object
	Color      interface{}
}

func (*Color) Debug

func (c *Color) Debug() string

func (*Color) Inspect

func (c *Color) Inspect() string

func (*Color) Result

func (c *Color) Result() string

func (*Color) Type

func (c *Color) Type() ObjectType

type CompiledFunction

type CompiledFunction struct {
	Instructions  code.Instructions
	NumLocals     int
	NumParameters int
}

CompiledFunction holds the instructions we get from the compilation of a function literal and is an object.Object, which means we can add it as a constant to our compiler.Bytecode and load it in the VM. It also holds the NumLocals which we pass to the VM to allocate the correct amount of stack space ("hole") to save the local bindings

func (*CompiledFunction) Debug

func (cf *CompiledFunction) Debug() string

func (*CompiledFunction) Inspect

func (cf *CompiledFunction) Inspect() string

Inspect returns the string "CompiledFunction[address]" - Address of 0th element in base 16 notation, with leading 0x

func (*CompiledFunction) Result

func (cf *CompiledFunction) Result() string

func (*CompiledFunction) Type

func (cf *CompiledFunction) Type() ObjectType

Type returns our CompiledFunction's ObjectType (CompiledFunctionObj)

type Database

type Database struct {
	DbType     string
	ConnString string
	Connection interface{}
	Error      bool
}

func (*Database) Debug

func (d *Database) Debug() string

func (*Database) Inspect

func (d *Database) Inspect() string

func (*Database) Result

func (d *Database) Result() string

func (*Database) Type

func (d *Database) Type() ObjectType

type Empty

type Empty struct{}

func (*Empty) Debug

func (n *Empty) Debug() string

func (*Empty) Inspect

func (n *Empty) Inspect() string

func (*Empty) Result

func (n *Empty) Result() string

func (*Empty) Type

func (n *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) Get

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

func (*Environment) GetLastFunctionName

func (e *Environment) GetLastFunctionName() string

func (*Environment) GetLastScope

func (e *Environment) GetLastScope() *Scope

func (*Environment) Set

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

type Error

type Error struct {
	Message string
}

func (*Error) Debug

func (e *Error) Debug() string

func (*Error) Inspect

func (e *Error) Inspect() string

func (*Error) Result

func (e *Error) Result() string

func (*Error) Type

func (e *Error) Type() ObjectType

type Eval

type Eval struct {
	Content Object
}

func (*Eval) Debug

func (e *Eval) Debug() string

func (*Eval) Inspect

func (e *Eval) Inspect() string

func (*Eval) Result

func (e *Eval) Result() string

func (*Eval) Type

func (e *Eval) Type() ObjectType

type File

type File struct {
	Filename Object
	MimeType Object
	Content  byte
}

type Float

type Float struct {
	Value float64
}

func (*Float) Debug

func (f *Float) Debug() string

func (*Float) Inspect

func (f *Float) Inspect() string

func (*Float) Result

func (f *Float) Result() string

func (*Float) Type

func (f *Float) Type() ObjectType

type Function

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

func (*Function) Debug

func (f *Function) Debug() string

func (*Function) Inspect

func (f *Function) Inspect() string

func (*Function) Result

func (f *Function) Result() string

func (*Function) Type

func (f *Function) Type() ObjectType

type Hash

type Hash struct {
	Pairs map[HashKey]HashPair
}

func (*Hash) Debug

func (h *Hash) Debug() string

func (*Hash) Inspect

func (h *Hash) Inspect() string

func (*Hash) Result

func (h *Hash) Result() string

func (*Hash) Type

func (h *Hash) Type() ObjectType

type HashKey

type HashKey struct {
	Type  ObjectType
	Value uint64
}

type HashPair

type HashPair struct {
	Key   Object
	Value Object
}

type Hashable

type Hashable interface {
	HashKey() HashKey
}

type Image

type Image struct {
	Name   Object
	Source interface{}
}

func (*Image) Debug

func (i *Image) Debug() string

func (*Image) Inspect

func (i *Image) Inspect() string

func (*Image) Result

func (i *Image) Result() string

func (*Image) Type

func (i *Image) Type() ObjectType

type Integer

type Integer struct {
	Value int64
}

func (*Integer) Debug

func (i *Integer) Debug() string

func (*Integer) HashKey

func (i *Integer) HashKey() HashKey

func (*Integer) Inspect

func (i *Integer) Inspect() string

func (*Integer) Result

func (i *Integer) Result() string

func (*Integer) Type

func (i *Integer) Type() ObjectType

type Literal

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

func (*Literal) Debug

func (l *Literal) Debug() string

func (*Literal) Inspect

func (l *Literal) Inspect() string

func (*Literal) Type

func (l *Literal) Type() ObjectType

type Load

type Load struct {
	File   string
	Env    *Environment
	SysEnv []Object
}

func (*Load) Debug

func (l *Load) Debug() string

func (*Load) Inspect

func (l *Load) Inspect() string

func (*Load) Result

func (l *Load) Result() string

func (*Load) Type

func (l *Load) Type() ObjectType

type Message

type Message struct {
	Request  string
	Response string
}

type Model

type Model struct {
	Database *Database
	Name     string
	Columns  interface{}
}

func (*Model) Debug

func (m *Model) Debug() string

func (*Model) Inspect

func (m *Model) Inspect() string

func (*Model) Result

func (m *Model) Result() string

func (*Model) Type

func (m *Model) Type() ObjectType

type Notification

type Notification struct {
	Title string
	Icon  string
}

func (*Notification) Debug

func (n *Notification) Debug() string

func (*Notification) Inspect

func (n *Notification) Inspect() string

func (*Notification) Result

func (n *Notification) Result() string

func (*Notification) Type

func (n *Notification) Type() ObjectType

type Null

type Null struct{}

func (*Null) Debug

func (n *Null) Debug() string

func (*Null) Inspect

func (n *Null) Inspect() string

func (*Null) Result

func (n *Null) Result() string

func (*Null) Type

func (n *Null) Type() ObjectType

type Object

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

type ObjectType

type ObjectType string

type Process

type Process struct {
	Name    string
	Pid     int64
	Output  string
	Command string
	Proc    *exec.Cmd
	Param   []Object
	Error   Object
}

func (*Process) Debug

func (p *Process) Debug() string

func (*Process) Inspect

func (p *Process) Inspect() string

func (*Process) Result

func (p *Process) Result() string

func (*Process) Type

func (p *Process) Type() ObjectType

type ReturnValue

type ReturnValue struct {
	Value Object
}

func (*ReturnValue) Debug

func (rv *ReturnValue) Debug() string

func (*ReturnValue) Inspect

func (rv *ReturnValue) Inspect() string

func (*ReturnValue) Result

func (rv *ReturnValue) Result() string

func (*ReturnValue) Type

func (rv *ReturnValue) Type() ObjectType

type Route

type Route struct {
	Config Object
}

func (*Route) Debug

func (r *Route) Debug() string

func (*Route) Inspect

func (r *Route) Inspect() string

func (*Route) Result

func (r *Route) Result() string

func (*Route) Type

func (r *Route) Type() ObjectType

type Scope

type Scope struct {
	Name string
	Body *ast.BlockStatement
	Vars []Object
	Env  *Environment
}

func (*Scope) Debug

func (f *Scope) Debug() string

func (*Scope) Inspect

func (f *Scope) Inspect() string

func (*Scope) Result

func (f *Scope) Result() string

func (*Scope) Type

func (f *Scope) Type() ObjectType

type Server

type Server struct {
	Server *http.Server
	Router *mux.Router
}

func (*Server) Debug

func (r *Server) Debug() string

func (*Server) Inspect

func (r *Server) Inspect() string

func (*Server) Result

func (r *Server) Result() string

func (*Server) Type

func (r *Server) Type() ObjectType

type Signal

type Signal struct {
	Name  string
	Value []byte
}

func (*Signal) Debug

func (r *Signal) Debug() string

func (*Signal) Inspect

func (r *Signal) Inspect() string

func (*Signal) Result

func (r *Signal) Result() string

func (*Signal) Type

func (r *Signal) Type() ObjectType

type Socket

type Socket struct {
	Addr            string
	Port            string
	ConType         string
	OnReady         string
	OnResponse      string
	OnRequest       string
	Env             *Environment
	Messages        []Message
	Debugger        bool
	DefaultResponse Object
}

func (*Socket) Debug

func (s *Socket) Debug() string

func (*Socket) DialMessage

func (s *Socket) DialMessage()

func (*Socket) DialServer

func (s *Socket) DialServer()

func (*Socket) FindResponse

func (s *Socket) FindResponse(request string) string

func (*Socket) Inspect

func (s *Socket) Inspect() string

func (*Socket) Result

func (s *Socket) Result() string

func (*Socket) Type

func (s *Socket) Type() ObjectType

type String

type String struct {
	Value string
}

func (*String) Debug

func (s *String) Debug() string

func (*String) HashKey

func (s *String) HashKey() HashKey

func (*String) Inspect

func (s *String) Inspect() string

func (*String) Result

func (s *String) Result() string

func (*String) Type

func (s *String) Type() ObjectType

type SysEnv

type SysEnv struct {
	Name  string
	Value string
}

func (*SysEnv) Debug

func (se *SysEnv) Debug() string

func (*SysEnv) Inspect

func (se *SysEnv) Inspect() string

func (*SysEnv) Result

func (se *SysEnv) Result() string

func (*SysEnv) Type

func (se *SysEnv) Type() ObjectType

type SyscallResult

type SyscallResult struct {
	Request  interface{}
	Response interface{}
	Error    interface{}
}

func (*SyscallResult) Debug

func (s *SyscallResult) Debug() string

func (*SyscallResult) Inspect

func (s *SyscallResult) Inspect() string

func (*SyscallResult) Result

func (s *SyscallResult) Result() string

func (*SyscallResult) Type

func (s *SyscallResult) Type() ObjectType

type Url

type Url struct {
	ResponseCode  int64
	Content       string
	ContentType   string
	ContentLength int64
	Server        string
}

func (*Url) Debug

func (u *Url) Debug() string

func (*Url) Inspect

func (u *Url) Inspect() string

func (*Url) Result

func (u *Url) Result() string

func (*Url) Type

func (u *Url) Type() ObjectType

type Warning

type Warning struct {
	Message string
}

func (*Warning) Debug

func (w *Warning) Debug() string

func (*Warning) Inspect

func (w *Warning) Inspect() string

func (*Warning) Result

func (w *Warning) Result() 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