Documentation
¶
Index ¶
- Constants
- Variables
- func About() string
- func DownloadCellTo(rawURL, destPath string) error
- func ErrOperatorOverrideNotCallable(operator string) error
- func LoadScriptFromFile(path string) ([]byte, error)
- func Name() string
- func PrintBytecode(script *Script, name string) string
- func VFprint(w io.Writer, a ...Value) (n int, err error)
- func VFprintf(w io.Writer, format string, a ...Value) (n int, err error)
- func VFprintln(w io.Writer, a ...Value) (n int, err error)
- func VSprintf(format string, a ...Value) (string, error)
- func Version() string
- type Array
- func (xs *Array) Binop(ctx *Context, op uint64, rhs Value) (Value, error)
- func (xs *Array) Boolean() Bool
- func (xs *Array) Clone() Value
- func (xs *Array) Equals(ctx *Context, other Value) Bool
- func (xs *Array) Get(ctx *Context, index Value) Value
- func (xs *Array) GetVTable(ctx *Context) Value
- func (xs *Array) IsCallable() Bool
- func (xs *Array) IsIterable() Bool
- func (xs *Array) Iterator(ctx *Context) Value
- func (xs *Array) LookUp(ctx *Context, message Value) Value
- func (xs *Array) MarshalJSON() ([]byte, error)
- func (xs *Array) ObjectKey() string
- func (xs *Array) Prefix(ctx *Context, op uint64) (Value, error)
- func (xs *Array) Set(index, val Value) error
- func (xs *Array) String() string
- func (xs *Array) Type() string
- type ArrayIterator
- func (it *ArrayIterator) Clone() Value
- func (it *ArrayIterator) IsIterable() Bool
- func (it *ArrayIterator) Iterator(ctx *Context) Value
- func (it *ArrayIterator) Key(ctx *Context) Value
- func (it *ArrayIterator) Next() bool
- func (it *ArrayIterator) ObjectKey() string
- func (it *ArrayIterator) String() string
- func (it *ArrayIterator) Type() string
- func (it *ArrayIterator) Value(ctx *Context) Value
- type Bool
- func (b Bool) Binop(ctx *Context, op uint64, rhs Value) (Value, error)
- func (b Bool) Boolean() Bool
- func (b Bool) Call(ctx *Context, args ...Value) (Value, error)
- func (b Bool) Clone() Value
- func (b Bool) Equals(ctx *Context, other Value) Bool
- func (b Bool) Get(ctx *Context, index Value) Value
- func (b Bool) GetVTable(ctx *Context) Value
- func (b Bool) IsCallable() Bool
- func (b Bool) IsIterable() Bool
- func (b Bool) Iterator(ctx *Context) Value
- func (b Bool) LookUp(ctx *Context, message Value) Value
- func (b Bool) ObjectKey() string
- func (b Bool) Prefix(ctx *Context, op uint64) (Value, error)
- func (b Bool) Set(index, val Value) error
- func (b Bool) String() string
- func (b Bool) Type() string
- type Bundle
- type Bytes
- func (b *Bytes) Binop(ctx *Context, op uint64, rhs Value) (Value, error)
- func (b *Bytes) Boolean() Bool
- func (b *Bytes) Clone() Value
- func (b *Bytes) Equals(ctx *Context, other Value) Bool
- func (b *Bytes) Get(ctx *Context, index Value) Value
- func (b *Bytes) GetVTable(ctx *Context) Value
- func (b *Bytes) IsCallable() Bool
- func (b *Bytes) IsIterable() Bool
- func (b *Bytes) Iterator(ctx *Context) Value
- func (b *Bytes) LookUp(ctx *Context, message Value) Value
- func (b *Bytes) ObjectKey() string
- func (b *Bytes) Prefix(ctx *Context, op uint64) (Value, error)
- func (b *Bytes) Set(index, val Value) error
- func (b Bytes) String() string
- func (b *Bytes) Type() string
- type BytesIterator
- func (bi *BytesIterator) Clone() Value
- func (bi *BytesIterator) IsIterable() Bool
- func (bi *BytesIterator) Iterator(ctx *Context) Value
- func (bi *BytesIterator) Key(ctx *Context) Value
- func (bi *BytesIterator) Next() bool
- func (it *BytesIterator) ObjectKey() string
- func (bi *BytesIterator) String() string
- func (bi *BytesIterator) Type() string
- func (bi *BytesIterator) Value(ctx *Context) Value
- type Context
- func (ctx *Context) Compile() (err error)
- func (ctx *Context) CompileAndRun() (err error)
- func (ctx *Context) IsMainThreadRunning() bool
- func (ctx *Context) MeasureRunTime() (end time.Duration, err error)
- func (ctx *Context) PrintAST(withColors bool) error
- func (ctx *Context) PrintCallStack() error
- func (ctx *Context) PrintMachineCode() error
- func (ctx *Context) PrintTokens() error
- func (ctx *Context) Run() error
- func (ctx *Context) RunDebugSession() (err error)
- func (ctx *Context) SetContextID(contextId string)
- func (ctx *Context) SetExtensionsLoader(extensionsLoader ExtensionsLoader)
- func (ctx *Context) SetSource(src []byte)
- type CoreFunction
- type Enum
- func (e *Enum) Binop(ctx *Context, op uint64, rhs Value) (Value, error)
- func (e *Enum) Boolean() Bool
- func (e *Enum) Call(ctx *Context, args ...Value) (Value, error)
- func (e *Enum) Clone() Value
- func (e *Enum) Equals(ctx *Context, other Value) Bool
- func (e *Enum) Get(ctx *Context, index Value) Value
- func (e *Enum) GetVTable(ctx *Context) Value
- func (e *Enum) IsCallable() Bool
- func (e *Enum) IsIterable() Bool
- func (e *Enum) Iterator(ctx *Context) Value
- func (e *Enum) LookUp(ctx *Context, message Value) Value
- func (e *Enum) MarshalJSON() ([]byte, error)
- func (e *Enum) ObjectKey() string
- func (e *Enum) Prefix(ctx *Context, op uint64) (Value, error)
- func (e *Enum) Set(Value, Value) error
- func (e Enum) String() string
- func (e *Enum) Type() string
- type ExtensionsLoader
- type File
- func (file *File) Binop(ctx *Context, op uint64, rhs Value) (Value, error)
- func (file *File) Boolean() Bool
- func (file *File) Clone() Value
- func (file *File) Equals(ctx *Context, other Value) Bool
- func (vf *File) GetMethod(name string) (Value, bool)
- func (file *File) GetVTable(ctx *Context) Value
- func (file *File) LookUp(ctx *Context, message Value) Value
- func (file *File) ObjectKey() string
- func (file *File) Prefix(ctx *Context, op uint64) (Value, error)
- func (file *File) String() string
- func (file *File) Type() string
- type Float
- func (f Float) Binop(ctx *Context, op uint64, rhs Value) (Value, error)
- func (f Float) Boolean() Bool
- func (f Float) Call(ctx *Context, args ...Value) (Value, error)
- func (f Float) Clone() Value
- func (f Float) Equals(ctx *Context, other Value) Bool
- func (f Float) Get(ctx *Context, index Value) Value
- func (f Float) GetVTable(ctx *Context) Value
- func (f Float) IsCallable() Bool
- func (f Float) IsIterable() Bool
- func (f Float) Iterator(ctx *Context) Value
- func (f Float) LookUp(ctx *Context, message Value) Value
- func (f Float) ObjectKey() string
- func (f Float) Prefix(ctx *Context, op uint64) (Value, error)
- func (f Float) Set(index, val Value) error
- func (f Float) String() string
- func (f Float) Type() string
- type Function
- func (f *Function) Binop(ctx *Context, op uint64, r Value) (Value, error)
- func (f *Function) Boolean() Bool
- func (f *Function) Clone() Value
- func (f *Function) Equals(ctx *Context, other Value) Bool
- func (f *Function) GetVTable(ctx *Context) Value
- func (f *Function) IsCallable() Bool
- func (f *Function) LookUp(ctx *Context, message Value) Value
- func (f *Function) ObjectKey() string
- func (f *Function) Prefix(ctx *Context, op uint64) (Value, error)
- func (f Function) String() string
- func (f *Function) Type() string
- type Integer
- func (l Integer) Binop(ctx *Context, op uint64, rhs Value) (Value, error)
- func (i Integer) Boolean() Bool
- func (i Integer) Call(ctx *Context, args ...Value) (Value, error)
- func (i Integer) Clone() Value
- func (i Integer) Equals(ctx *Context, other Value) Bool
- func (i Integer) Get(ctx *Context, index Value) Value
- func (i Integer) GetVTable(ctx *Context) Value
- func (i Integer) IsCallable() Bool
- func (i Integer) IsIterable() Bool
- func (i Integer) Iterator(ctx *Context) Value
- func (i Integer) LookUp(ctx *Context, message Value) Value
- func (i Integer) ObjectKey() string
- func (i Integer) Prefix(ctx *Context, op uint64) (Value, error)
- func (i Integer) Set(index, val Value) error
- func (i Integer) String() string
- func (i Integer) Type() string
- type IntegerIterator
- func (it *IntegerIterator) Clone() Value
- func (it *IntegerIterator) IsIterable() Bool
- func (it *IntegerIterator) Iterator(ctx *Context) Value
- func (it *IntegerIterator) Key(ctx *Context) Value
- func (it *IntegerIterator) Next() bool
- func (it *IntegerIterator) ObjectKey() string
- func (it *IntegerIterator) String() string
- func (it *IntegerIterator) Type() string
- func (it *IntegerIterator) Value(ctx *Context) Value
- type Iterator
- type Lexer
- type MapScriptIPLine
- type NativeFunction
- func (nativeFn NativeFunction) Binop(ctx *Context, op uint64, r Value) (Value, error)
- func (nativeFn NativeFunction) Boolean() Bool
- func (nativeFn NativeFunction) Call(ctx *Context, args ...Value) (Value, error)
- func (nativeFn NativeFunction) Clone() Value
- func (nativeFn NativeFunction) Equals(ctx *Context, other Value) Bool
- func (nativeFn NativeFunction) Get(ctx *Context, index Value) Value
- func (nativeFn NativeFunction) GetVTable(ctx *Context) Value
- func (nativeFn NativeFunction) IsCallable() Bool
- func (nativeFn NativeFunction) IsIterable() Bool
- func (nativeFn NativeFunction) Iterator(ctx *Context) Value
- func (nativeFn NativeFunction) LookUp(ctx *Context, message Value) Value
- func (nativeFn NativeFunction) MarshalJSON() ([]byte, error)
- func (nativeFn NativeFunction) ObjectKey() string
- func (nativeFn NativeFunction) Prefix(ctx *Context, op uint64) (Value, error)
- func (nativeFn NativeFunction) Set(index, val Value) error
- func (nativeFn NativeFunction) String() string
- func (nativeFn NativeFunction) Type() string
- type NilValue
- func (n NilValue) Binop(ctx *Context, op uint64, rhs Value) (Value, error)
- func (n NilValue) Boolean() Bool
- func (n NilValue) Clone() Value
- func (n NilValue) Equals(ctx *Context, other Value) Bool
- func (n NilValue) LookUp(ctx *Context, message Value) Value
- func (n NilValue) ObjectKey() string
- func (n NilValue) Prefix(ctx *Context, op uint64) (Value, error)
- func (n NilValue) String() string
- func (n NilValue) Type() string
- type Object
- func (o *Object) Binop(ctx *Context, op uint64, rhs Value) (Value, error)
- func (o *Object) Boolean() Bool
- func (o *Object) Call(ctx *Context, args ...Value) (Value, error)
- func (o *Object) Clone() Value
- func (o *Object) Equals(ctx *Context, other Value) Bool
- func (o *Object) Get(ctx *Context, message Value) Value
- func (o *Object) GetVTable(ctx *Context) Value
- func (o *Object) IsCallable() Bool
- func (o *Object) IsIterable() Bool
- func (o *Object) Iterator(ctx *Context) Value
- func (o *Object) LookUp(ctx *Context, message Value) Value
- func (o *Object) MarshalJSON() ([]byte, error)
- func (o *Object) ObjectKey() string
- func (o *Object) Prefix(ctx *Context, op uint64) (Value, error)
- func (o *Object) Set(index, val Value) error
- func (o *Object) String() string
- func (o *Object) Type() string
- type ObjectIterator
- func (it *ObjectIterator) Clone() Value
- func (it *ObjectIterator) IsIterable() Bool
- func (it *ObjectIterator) Iterator(ctx *Context) Value
- func (it *ObjectIterator) Key(ctx *Context) Value
- func (it *ObjectIterator) Next() bool
- func (it *ObjectIterator) ObjectKey() string
- func (it *ObjectIterator) String() string
- func (it *ObjectIterator) Type() string
- func (it *ObjectIterator) Value(ctx *Context) Value
- type RGB
- type ReferenceSemanticsImpl
- func (i *ReferenceSemanticsImpl) Binop(*Context, uint64, Value) (Value, error)
- func (i *ReferenceSemanticsImpl) Boolean() Bool
- func (i *ReferenceSemanticsImpl) Call(ctx *Context, args ...Value) (Value, error)
- func (i *ReferenceSemanticsImpl) Clone() Value
- func (i *ReferenceSemanticsImpl) Equals(*Context, Value) Bool
- func (i *ReferenceSemanticsImpl) Get(*Context, Value) Value
- func (i *ReferenceSemanticsImpl) GetVTable(ctx *Context) Value
- func (i *ReferenceSemanticsImpl) IsCallable() Bool
- func (i *ReferenceSemanticsImpl) IsIterable() Bool
- func (i *ReferenceSemanticsImpl) Iterator(*Context) Value
- func (i *ReferenceSemanticsImpl) LookUp(*Context, Value) Value
- func (i *ReferenceSemanticsImpl) MarshalJSON() ([]byte, error)
- func (i *ReferenceSemanticsImpl) ObjectKey() string
- func (i *ReferenceSemanticsImpl) Prefix(*Context, uint64) (Value, error)
- func (i *ReferenceSemanticsImpl) Set(Value, Value) error
- func (i ReferenceSemanticsImpl) String() string
- func (i *ReferenceSemanticsImpl) Type() string
- type Script
- type StackFrameInfo
- type String
- func (s *String) Binop(ctx *Context, op uint64, rhs Value) (Value, error)
- func (s *String) Boolean() Bool
- func (s *String) Clone() Value
- func (s *String) Equals(ctx *Context, other Value) Bool
- func (s *String) Get(ctx *Context, index Value) Value
- func (s *String) GetVTable(ctx *Context) Value
- func (s *String) IsCallable() Bool
- func (s *String) IsIterable() Bool
- func (s *String) Iterator(ctx *Context) Value
- func (s *String) LookUp(ctx *Context, message Value) Value
- func (s *String) MarshalJSON() ([]byte, error)
- func (s *String) ObjectKey() string
- func (s *String) Prefix(ctx *Context, op uint64) (Value, error)
- func (s *String) Set(index, val Value) error
- func (s String) String() string
- func (s *String) Type() string
- type StringIterator
- func (it *StringIterator) Clone() Value
- func (it *StringIterator) IsIterable() Bool
- func (it *StringIterator) Iterator(ctx *Context) Value
- func (it *StringIterator) Key(ctx *Context) Value
- func (it *StringIterator) Next() bool
- func (it *StringIterator) ObjectKey() string
- func (it *StringIterator) String() string
- func (it *StringIterator) Type() string
- func (it *StringIterator) Value(ctx *Context) Value
- type Style
- func (s *Style) Bg16(idx uint8) *Style
- func (s *Style) Bg256(idx uint8) *Style
- func (s *Style) BgHex(hex string) (*Style, error)
- func (s *Style) BgHexMust(hex string) *Style
- func (s *Style) BgName(name string) (*Style, error)
- func (s *Style) BgRGB(r, g, b uint8) *Style
- func (s *Style) Binop(ctx *Context, op uint64, rhs Value) (Value, error)
- func (s *Style) Blink() *Style
- func (s *Style) Bold() *Style
- func (s *Style) Boolean() Bool
- func (s *Style) Clone() Value
- func (s *Style) Dim() *Style
- func (s *Style) Enabled(on bool) *Style
- func (s *Style) Equals(ctx *Context, other Value) Bool
- func (s *Style) Fg16(idx uint8) *Style
- func (s *Style) Fg256(idx uint8) *Style
- func (s *Style) FgHex(hex string) (*Style, error)
- func (s *Style) FgHexMust(hex string) *Style
- func (s *Style) FgName(name string) (*Style, error)
- func (s *Style) FgRGB(r, g, b uint8) *Style
- func (s *Style) Fill(a ...any) string
- func (s *Style) GetVTable(ctx *Context) Value
- func (s *Style) Italic() *Style
- func (s *Style) LookUp(ctx *Context, message Value) Value
- func (s *Style) NoReset() *Style
- func (s *Style) ObjectKey() string
- func (s *Style) Prefix(ctx *Context, op uint64) (Value, error)
- func (s *Style) Reverse() *Style
- func (s *Style) Sprint(a ...any) string
- func (s *Style) Sprintf(format string, a ...any) string
- func (s *Style) Strike() *Style
- func (s *Style) String() string
- func (s *Style) Type() string
- func (s *Style) Underline() *Style
- func (s *Style) Width(w int) *Style
- type Thread
- func (th *Thread) Binop(ctx *Context, op uint64, rhs Value) (Value, error)
- func (th *Thread) Boolean() Bool
- func (th *Thread) Clone() Value
- func (th *Thread) Equals(ctx *Context, other Value) Bool
- func (th *Thread) GetVTable(ctx *Context) Value
- func (th *Thread) LookUp(ctx *Context, message Value) Value
- func (th *Thread) ObjectKey() string
- func (th *Thread) Prefix(ctx *Context, op uint64) (Value, error)
- func (th *Thread) Reset(fn *Function) *Thread
- func (th *Thread) String() string
- func (th *Thread) Type() string
- type ThreadState
- type Time
- func (t Time) Binop(ctx *Context, op uint64, rhs Value) (Value, error)
- func (t Time) Boolean() Bool
- func (t Time) Call(ctx *Context, args ...Value) (Value, error)
- func (t Time) Clone() Value
- func (t Time) Equals(ctx *Context, other Value) Bool
- func (t Time) Get(ctx *Context, index Value) Value
- func (t Time) GetVTable(ctx *Context) Value
- func (t Time) IsCallable() Bool
- func (t Time) IsIterable() Bool
- func (t Time) Iterator(ctx *Context) Value
- func (t Time) LookUp(ctx *Context, message Value) Value
- func (t Time) MarshalJSON() ([]byte, error)
- func (t Time) ObjectKey() string
- func (t Time) Prefix(ctx *Context, op uint64) (Value, error)
- func (t Time) Set(index, val Value) error
- func (t Time) String() string
- func (t Time) Type() string
- type UserIterator
- func (vi *UserIterator) Boolean() Bool
- func (vi *UserIterator) Clone() Value
- func (vi *UserIterator) IsIterable() Bool
- func (vi *UserIterator) Iterator(ctx *Context) Value
- func (vi *UserIterator) Key(ctx *Context) Value
- func (vi *UserIterator) Next() bool
- func (it *UserIterator) ObjectKey() string
- func (vi *UserIterator) String() string
- func (vi *UserIterator) Type() string
- func (vi *UserIterator) Value(ctx *Context) Value
- type VM
- type Value
- type ValueSemanticsImpl
- func (i ValueSemanticsImpl) Binop(*Context, uint64, Value) (Value, error)
- func (i ValueSemanticsImpl) Boolean() Bool
- func (i ValueSemanticsImpl) Call(ctx *Context, args ...Value) (Value, error)
- func (i ValueSemanticsImpl) Clone() Value
- func (i ValueSemanticsImpl) Equals(*Context, Value) Bool
- func (i ValueSemanticsImpl) Get(*Context, Value) Value
- func (i ValueSemanticsImpl) GetVTable(ctx *Context) Value
- func (i ValueSemanticsImpl) IsCallable() Bool
- func (i ValueSemanticsImpl) IsIterable() Bool
- func (i ValueSemanticsImpl) Iterator(*Context) Value
- func (i ValueSemanticsImpl) LookUp(*Context, Value) Value
- func (i ValueSemanticsImpl) MarshalJSON() ([]byte, error)
- func (i ValueSemanticsImpl) ObjectKey() string
- func (i ValueSemanticsImpl) Prefix(*Context, uint64) (Value, error)
- func (i ValueSemanticsImpl) Set(Value, Value) error
- func (i ValueSemanticsImpl) String() string
- func (i ValueSemanticsImpl) Type() string
- type VidaBytesBuilder
- func (bb *VidaBytesBuilder) Binop(ctx *Context, op uint64, rhs Value) (Value, error)
- func (bb *VidaBytesBuilder) Clone() Value
- func (bb *VidaBytesBuilder) Equals(ctx *Context, other Value) Bool
- func (bb *VidaBytesBuilder) GetVTable(ctx *Context) Value
- func (bb *VidaBytesBuilder) LookUp(ctx *Context, message Value) Value
- func (bb *VidaBytesBuilder) ObjectKey() string
- func (bb *VidaBytesBuilder) Prefix(ctx *Context, op uint64) (Value, error)
- func (bb *VidaBytesBuilder) String() string
- func (bb *VidaBytesBuilder) Type() string
- type VidaError
- func (e *VidaError) Binop(ctx *Context, op uint64, rhs Value) (Value, error)
- func (e *VidaError) Boolean() Bool
- func (e *VidaError) Clone() Value
- func (e *VidaError) Equals(ctx *Context, other Value) Bool
- func (e *VidaError) Error() string
- func (e *VidaError) Get(ctx *Context, index Value) Value
- func (e *VidaError) GetVTable(ctx *Context) Value
- func (e *VidaError) IsCallable() Bool
- func (e *VidaError) IsIterable() Bool
- func (e *VidaError) Iterator(ctx *Context) Value
- func (e *VidaError) LookUp(ctx *Context, message Value) Value
- func (e *VidaError) ObjectKey() string
- func (e *VidaError) Prefix(ctx *Context, op uint64) (Value, error)
- func (e *VidaError) Set(index, val Value) error
- func (e *VidaError) String() string
- func (e *VidaError) Type() string
- type VidaRunTimeError
- type VidaStringBuilder
- func (sb *VidaStringBuilder) Binop(ctx *Context, op uint64, rhs Value) (Value, error)
- func (sb *VidaStringBuilder) Clone() Value
- func (sb *VidaStringBuilder) Equals(ctx *Context, other Value) Bool
- func (sb *VidaStringBuilder) GetVTable(ctx *Context) Value
- func (sb *VidaStringBuilder) LookUp(ctx *Context, message Value) Value
- func (sb *VidaStringBuilder) ObjectKey() string
- func (sb *VidaStringBuilder) Prefix(ctx *Context, op uint64) (Value, error)
- func (sb *VidaStringBuilder) String() string
- func (sb *VidaStringBuilder) Type() string
Constants ¶
const ( VidaFileExtension = ".vida" DefaultInputPrompt = "Input > " EmptyString = "" DefaultValField = "value" DefaultCloseMethodName = "close" )
const ( VIDAPATH = "VIDAPATH" ProjectCellsDir = "cells" VidaPathDirName = "vida-cells" )
const ( FileErrType = "File" LexicalErrType = "Lexical" SyntaxErrType = "Syntax" BuildErrType = "Build" RunTimeErrType = "Runtime" AssertionErrType = "Assertion Failure" ExceptionErrType = "Exception" MaxMemSize = 0x7FFF_FFFF )
const ( ErrStringLimit = internalBasicError("max size for strings has been reached") ErrOpNotDefinedForIterators = internalBasicError("operation not defined for iterators") ErrValueNotIndexable = internalBasicError("value not indexable") ErrPrefixOpNotDefined = internalBasicError("prefix operation not defined") ErrBinaryOpNotDefined = internalBasicError("binary operation not defined") ErrDivisionByZero = internalBasicError("division by zero") ErrExpectedInteger = internalBasicError("expected a value of type integer") ErrExpectedIntegerDifferentFromZero = internalBasicError("expected an integer value different from zero") ErrValueNotIterable = internalBasicError("value is not iterable") ErrValueNotCallable = internalBasicError("value is not callable") ErrStackOverflow = internalBasicError("stack overflow") ErrArity = internalBasicError("number of arguments different from function arity") ErrNotEnoughArgs = internalBasicError("not enough arguments passed to the function") ErrVariadicArgs = internalBasicError("expected an array for variadic arguments or the given array overflows the stack") ErrSlice = internalBasicError("could not process the slice") ErrView = internalBasicError("could not process the view") ErrValueIsConstant = internalBasicError("value is constant") ErrMaxMemSize = internalBasicError("max memory size reached") ErrNotImplemented = internalBasicError("not implemented functionality for this value") ErrNotThread = internalBasicError("value is not a thread") ErrResumingNotSuspendedThread = internalBasicError("cannot run a completed, running or waiting thread") ErrNotAFunction = internalBasicError("threads must be build from functions") ErrSuspendingMainThread = internalBasicError("cannot suspend the main thread") ErrSuspendingRunningThread = internalBasicError("cannot suspend a running thread") ErrClosingAThread = internalBasicError("cannot complete a running, waiting or completed thread") ErrStartThreadSignal = internalBasicError("start-thread-signal") ErrResumeThreadSignal = internalBasicError("resume-thread-signal") ErrSuspendThreadSignal = internalBasicError("suspend-thread-signal") ErrRecyclingThread = internalBasicError("cannot recycle an active thread") ErrSoringMixedTypes = internalBasicError("cannot sort mixed data types") ErrParallelArgs = internalBasicError("arguments for parallel tasks must be non empty arrays") ErrParallelFn = internalBasicError("first argument of a parallel argument must be a function") ErrNonNegativeIntegerTimeout = internalBasicError("timeout must be a non negative integer milliseconds") ErrNonEmptyTaskArray = internalBasicError("parallel tasks must be inside a non empty array") ErrInvalidJSON = internalBasicError("invalid json") ErrExpectedString = internalBasicError("expected argument of type string") ErrExpectedIntegerArg = internalBasicError("expected argument of type integer") ErrExpectedBool = internalBasicError("expected argument of type bool") ErrInvalidNumberOfArguments = internalBasicError("invalid number of arguments") ErrInvalidTypeOfArgument = internalBasicError("invalid type of argument") )
const False = Bool(false)
const True = Bool(true)
Variables ¶
var Nil = NilValue{}
Functions ¶
func DownloadCellTo ¶
DownloadCellTo fetches rawURL and writes it verbatim to destPath, creating any needed directories. It does not check for an existing cached file — callers decide caching policy.
func ErrOperatorOverrideNotCallable ¶
ErrOperatorOverrideNotCallable reports that a vtable entry was found under a binary operator's message name (e.g. "add", "lt" — see tokenBinopToString) but the value stored there is not a function — so it cannot actually be used as an operator override. This is kept distinct from ErrBinaryOpNotDefined on purpose: "no override exists" and "an override exists but is broken" are different problems for a developer to diagnose, and collapsing them into the same generic message hides a very findable mistake (usually a plain value assigned to a vtable slot where a function was meant to go).
Note: this does not apply to equality ("eq"). Object.Equals has its own separate, inline override-lookup logic and can't surface this error at all, since the Value.Equals contract returns only a Bool, with no error channel — a non-callable "eq" override is currently treated the same as no override at all (falls back to pointer identity) rather than erroring.
func LoadScriptFromFile ¶
func PrintBytecode ¶
Types ¶
type Array ¶
type Array struct {
ReferenceSemanticsImpl
Value []Value
}
func (*Array) IsCallable ¶
func (*Array) IsIterable ¶
func (*Array) MarshalJSON ¶
type ArrayIterator ¶
type ArrayIterator struct {
ReferenceSemanticsImpl
Array []Value
Init int
End int
}
func (*ArrayIterator) Clone ¶
func (it *ArrayIterator) Clone() Value
func (*ArrayIterator) IsIterable ¶ added in v0.5.11
func (it *ArrayIterator) IsIterable() Bool
func (*ArrayIterator) Iterator ¶ added in v0.5.11
func (it *ArrayIterator) Iterator(ctx *Context) Value
func (*ArrayIterator) Key ¶
func (it *ArrayIterator) Key(ctx *Context) Value
func (*ArrayIterator) Next ¶
func (it *ArrayIterator) Next() bool
func (*ArrayIterator) ObjectKey ¶ added in v0.5.11
func (it *ArrayIterator) ObjectKey() string
func (*ArrayIterator) String ¶
func (it *ArrayIterator) String() string
func (*ArrayIterator) Type ¶
func (it *ArrayIterator) Type() string
func (*ArrayIterator) Value ¶
func (it *ArrayIterator) Value(ctx *Context) Value
type Bundle ¶ added in v0.5.11
type Bundle struct {
// Source is the generated, single-file .vida program. It has no
// remaining local import(...) calls: every local dependency has been
// inlined. Remote imports (disallowed directly in code, same as in
// ordinary compilation) still surface as an error during bundling.
Source []byte
// Entry is the resolved, absolute path of the script that was bundled.
Entry string
// Files lists every file folded into Source, starting with Entry,
// followed by its dependencies in the order they were first
// encountered (depth-first).
Files []string
}
Bundle is the result of flattening a script's import graph into a single self-contained source file.
func BundleSource ¶ added in v0.5.11
BundleSource walks entryPath's import graph -- exactly the same resolution rules the compiler itself uses (relative to each importing file, then that file's 'cells' directory, then VIDAPATH) -- and produces a single .vida file with every local dependency inlined.
Each dependency is wrapped as `let __vida_bundle_N = fun { ... }` and every import("...") call site that used to load it becomes a call to that function, preserving the original re-execute-on-every-import semantics. A dependency's own top-level `let` declarations are rewritten to `var` so that dependencies don't collide in a shared global namespace once they're all compiled as one program (they're independent modules in the original multi-file compilation; wrapping keeps them independent). A dependency's trailing `export <expr>` becomes `ret <expr>`, matching how import() already treats it. The entry file itself is left otherwise untouched -- its own top-level `let`s and any `export` (a no-op at the true top level, exactly as it is today) keep their original meaning.
type Bytes ¶
type Bytes struct {
ReferenceSemanticsImpl
Value []byte
}
func (*Bytes) IsCallable ¶
func (*Bytes) IsIterable ¶
type BytesIterator ¶
type BytesIterator struct {
ReferenceSemanticsImpl
Bytes []byte
Init int
End int
}
func (*BytesIterator) Clone ¶
func (bi *BytesIterator) Clone() Value
func (*BytesIterator) IsIterable ¶ added in v0.5.11
func (bi *BytesIterator) IsIterable() Bool
func (*BytesIterator) Iterator ¶ added in v0.5.11
func (bi *BytesIterator) Iterator(ctx *Context) Value
func (*BytesIterator) Key ¶
func (bi *BytesIterator) Key(ctx *Context) Value
func (*BytesIterator) Next ¶
func (bi *BytesIterator) Next() bool
func (*BytesIterator) ObjectKey ¶ added in v0.5.11
func (it *BytesIterator) ObjectKey() string
func (*BytesIterator) String ¶
func (bi *BytesIterator) String() string
func (*BytesIterator) Type ¶
func (bi *BytesIterator) Type() string
func (*BytesIterator) Value ¶
func (bi *BytesIterator) Value(ctx *Context) Value
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
func NewContext ¶
func NewContext(src []byte, contextID string, extensionsLoader ExtensionsLoader) *Context
func (*Context) CompileAndRun ¶
func (*Context) IsMainThreadRunning ¶
func (*Context) MeasureRunTime ¶
func (*Context) PrintCallStack ¶
func (*Context) PrintMachineCode ¶
func (*Context) PrintTokens ¶
func (*Context) RunDebugSession ¶
func (*Context) SetContextID ¶
func (*Context) SetExtensionsLoader ¶
func (ctx *Context) SetExtensionsLoader(extensionsLoader ExtensionsLoader)
type CoreFunction ¶
type CoreFunction struct {
ReferenceSemanticsImpl
Code []uint64
FreeVarsInfo []freeVarsInfo
ScriptID string
MapScriptIPLine MapScriptIPLine
FreeVarsCount int
Arity int
IsVarArg bool
}
func (*CoreFunction) Boolean ¶
func (c *CoreFunction) Boolean() Bool
func (*CoreFunction) Clone ¶
func (f *CoreFunction) Clone() Value
func (CoreFunction) String ¶
func (f CoreFunction) String() string
func (*CoreFunction) Type ¶
func (c *CoreFunction) Type() string
type ExtensionsLoader ¶
type File ¶ added in v0.5.11
type File struct {
ReferenceSemanticsImpl
Handler *os.File
Reader *bufio.Reader
Writer *bufio.Writer
Path string
Flags int
IsClosed bool
}
File Handler API
type Function ¶
type Function struct {
ReferenceSemanticsImpl
FreeVarStore []Value
CoreFn *CoreFunction
}
func (*Function) IsCallable ¶
type Integer ¶
type Integer int64
func StringLength ¶
func (Integer) IsCallable ¶
func (Integer) IsIterable ¶
type IntegerIterator ¶
type IntegerIterator struct {
ReferenceSemanticsImpl
Init Integer
End Integer
}
func (*IntegerIterator) Clone ¶
func (it *IntegerIterator) Clone() Value
func (*IntegerIterator) IsIterable ¶ added in v0.5.11
func (it *IntegerIterator) IsIterable() Bool
func (*IntegerIterator) Iterator ¶ added in v0.5.11
func (it *IntegerIterator) Iterator(ctx *Context) Value
func (*IntegerIterator) Key ¶
func (it *IntegerIterator) Key(ctx *Context) Value
func (*IntegerIterator) Next ¶
func (it *IntegerIterator) Next() bool
func (*IntegerIterator) ObjectKey ¶ added in v0.5.11
func (it *IntegerIterator) ObjectKey() string
func (*IntegerIterator) String ¶
func (it *IntegerIterator) String() string
func (*IntegerIterator) Type ¶
func (it *IntegerIterator) Type() string
func (*IntegerIterator) Value ¶
func (it *IntegerIterator) Value(ctx *Context) Value
type Lexer ¶
type Lexer struct {
ScriptID string
LexicalError *VidaRunTimeError
// contains filtered or unexported fields
}
type MapScriptIPLine ¶
type NativeFunction ¶
func (NativeFunction) Boolean ¶
func (nativeFn NativeFunction) Boolean() Bool
func (NativeFunction) Call ¶
func (nativeFn NativeFunction) Call(ctx *Context, args ...Value) (Value, error)
func (NativeFunction) Clone ¶
func (nativeFn NativeFunction) Clone() Value
func (NativeFunction) Equals ¶
func (nativeFn NativeFunction) Equals(ctx *Context, other Value) Bool
func (NativeFunction) GetVTable ¶
func (nativeFn NativeFunction) GetVTable(ctx *Context) Value
func (NativeFunction) IsCallable ¶
func (nativeFn NativeFunction) IsCallable() Bool
func (NativeFunction) IsIterable ¶
func (nativeFn NativeFunction) IsIterable() Bool
func (NativeFunction) Iterator ¶
func (nativeFn NativeFunction) Iterator(ctx *Context) Value
func (NativeFunction) LookUp ¶
func (nativeFn NativeFunction) LookUp(ctx *Context, message Value) Value
func (NativeFunction) MarshalJSON ¶
func (nativeFn NativeFunction) MarshalJSON() ([]byte, error)
func (NativeFunction) ObjectKey ¶
func (nativeFn NativeFunction) ObjectKey() string
func (NativeFunction) Prefix ¶
func (nativeFn NativeFunction) Prefix(ctx *Context, op uint64) (Value, error)
func (NativeFunction) Set ¶
func (nativeFn NativeFunction) Set(index, val Value) error
func (NativeFunction) String ¶
func (nativeFn NativeFunction) String() string
func (NativeFunction) Type ¶
func (nativeFn NativeFunction) Type() string
type NilValue ¶
type NilValue struct {
ValueSemanticsImpl
}
type Object ¶
type Object struct {
ReferenceSemanticsImpl
Value map[string]Value
VTable *Object
}
func (*Object) IsCallable ¶
func (*Object) IsIterable ¶
func (*Object) MarshalJSON ¶
type ObjectIterator ¶
type ObjectIterator struct {
ReferenceSemanticsImpl
Keys []string
Obj map[string]Value
Init int
End int
}
func (*ObjectIterator) Clone ¶
func (it *ObjectIterator) Clone() Value
func (*ObjectIterator) IsIterable ¶ added in v0.5.11
func (it *ObjectIterator) IsIterable() Bool
func (*ObjectIterator) Iterator ¶ added in v0.5.11
func (it *ObjectIterator) Iterator(ctx *Context) Value
func (*ObjectIterator) Key ¶
func (it *ObjectIterator) Key(ctx *Context) Value
func (*ObjectIterator) Next ¶
func (it *ObjectIterator) Next() bool
func (*ObjectIterator) ObjectKey ¶ added in v0.5.11
func (it *ObjectIterator) ObjectKey() string
func (*ObjectIterator) String ¶
func (it *ObjectIterator) String() string
func (*ObjectIterator) Type ¶
func (it *ObjectIterator) Type() string
func (*ObjectIterator) Value ¶
func (it *ObjectIterator) Value(ctx *Context) Value
type ReferenceSemanticsImpl ¶
type ReferenceSemanticsImpl struct{}
Reference semantics default impl
func (*ReferenceSemanticsImpl) Boolean ¶
func (i *ReferenceSemanticsImpl) Boolean() Bool
func (*ReferenceSemanticsImpl) Call ¶
func (i *ReferenceSemanticsImpl) Call(ctx *Context, args ...Value) (Value, error)
func (*ReferenceSemanticsImpl) Clone ¶
func (i *ReferenceSemanticsImpl) Clone() Value
func (*ReferenceSemanticsImpl) Equals ¶
func (i *ReferenceSemanticsImpl) Equals(*Context, Value) Bool
func (*ReferenceSemanticsImpl) GetVTable ¶
func (i *ReferenceSemanticsImpl) GetVTable(ctx *Context) Value
func (*ReferenceSemanticsImpl) IsCallable ¶
func (i *ReferenceSemanticsImpl) IsCallable() Bool
func (*ReferenceSemanticsImpl) IsIterable ¶
func (i *ReferenceSemanticsImpl) IsIterable() Bool
func (*ReferenceSemanticsImpl) Iterator ¶
func (i *ReferenceSemanticsImpl) Iterator(*Context) Value
func (*ReferenceSemanticsImpl) LookUp ¶
func (i *ReferenceSemanticsImpl) LookUp(*Context, Value) Value
func (*ReferenceSemanticsImpl) MarshalJSON ¶
func (i *ReferenceSemanticsImpl) MarshalJSON() ([]byte, error)
func (*ReferenceSemanticsImpl) ObjectKey ¶
func (i *ReferenceSemanticsImpl) ObjectKey() string
func (*ReferenceSemanticsImpl) Prefix ¶
func (i *ReferenceSemanticsImpl) Prefix(*Context, uint64) (Value, error)
func (ReferenceSemanticsImpl) String ¶
func (i ReferenceSemanticsImpl) String() string
func (*ReferenceSemanticsImpl) Type ¶
func (i *ReferenceSemanticsImpl) Type() string
type StackFrameInfo ¶
func (StackFrameInfo) Error ¶
func (sfi StackFrameInfo) Error() string
type String ¶
type String struct {
ReferenceSemanticsImpl
Runes []rune
Value string
}
func (*String) IsCallable ¶
func (*String) IsIterable ¶
func (*String) MarshalJSON ¶
type StringIterator ¶
type StringIterator struct {
ReferenceSemanticsImpl
Runes []rune
Init int
End int
}
func (*StringIterator) Clone ¶
func (it *StringIterator) Clone() Value
func (*StringIterator) IsIterable ¶ added in v0.5.11
func (it *StringIterator) IsIterable() Bool
func (*StringIterator) Iterator ¶ added in v0.5.11
func (it *StringIterator) Iterator(ctx *Context) Value
func (*StringIterator) Key ¶
func (it *StringIterator) Key(ctx *Context) Value
func (*StringIterator) Next ¶
func (it *StringIterator) Next() bool
func (*StringIterator) ObjectKey ¶ added in v0.5.11
func (it *StringIterator) ObjectKey() string
func (*StringIterator) String ¶
func (it *StringIterator) String() string
func (*StringIterator) Type ¶
func (it *StringIterator) Type() string
func (*StringIterator) Value ¶
func (it *StringIterator) Value(ctx *Context) Value
type Style ¶
type Style struct {
ReferenceSemanticsImpl
// contains filtered or unexported fields
}
func (*Style) BgHexMust ¶
BgHexMust is BgHex without the error return, for call sites using a compile-time-known-valid literal. Panics on malformed input — do not use with user- or script-supplied strings.
type Thread ¶
type Thread struct {
ReferenceSemanticsImpl
Frames []frame
Stack []Value
Script *Script
Frame *frame
Invoker *Thread
State ThreadState
Channel Value
Reg uint64
// contains filtered or unexported fields
}
type ThreadState ¶
type ThreadState int
const ( Ready ThreadState = iota Running Suspended Waiting Done )
func (ThreadState) String ¶
func (state ThreadState) String() string
type UserIterator ¶ added in v0.5.11
type UserIterator struct {
ReferenceSemanticsImpl
// contains filtered or unexported fields
}
func (*UserIterator) Boolean ¶ added in v0.5.11
func (vi *UserIterator) Boolean() Bool
func (*UserIterator) Clone ¶ added in v0.5.11
func (vi *UserIterator) Clone() Value
func (*UserIterator) IsIterable ¶ added in v0.5.11
func (vi *UserIterator) IsIterable() Bool
func (*UserIterator) Iterator ¶ added in v0.5.11
func (vi *UserIterator) Iterator(ctx *Context) Value
func (*UserIterator) Key ¶ added in v0.5.11
func (vi *UserIterator) Key(ctx *Context) Value
func (*UserIterator) Next ¶ added in v0.5.11
func (vi *UserIterator) Next() bool
func (*UserIterator) ObjectKey ¶ added in v0.5.11
func (it *UserIterator) ObjectKey() string
func (*UserIterator) String ¶ added in v0.5.11
func (vi *UserIterator) String() string
func (*UserIterator) Type ¶ added in v0.5.11
func (vi *UserIterator) Type() string
func (*UserIterator) Value ¶ added in v0.5.11
func (vi *UserIterator) Value(ctx *Context) Value
type Value ¶
type Value interface {
Boolean() Bool
Prefix(ctx *Context, op uint64) (Value, error)
Binop(ctx *Context, op uint64, other Value) (Value, error)
Get(ctx *Context, message Value) Value
Set(Value, Value) error
Equals(ctx *Context, value Value) Bool
IsIterable() Bool
Iterator(ctx *Context) Value
IsCallable() Bool
Call(ctx *Context, args ...Value) (Value, error)
String() string
Type() string
Clone() Value
ObjectKey() string
LookUp(ctx *Context, message Value) Value
GetVTable(ctx *Context) Value
}
type ValueSemanticsImpl ¶
type ValueSemanticsImpl struct{}
Value semantics default impl
func (ValueSemanticsImpl) Boolean ¶
func (i ValueSemanticsImpl) Boolean() Bool
func (ValueSemanticsImpl) Call ¶
func (i ValueSemanticsImpl) Call(ctx *Context, args ...Value) (Value, error)
func (ValueSemanticsImpl) Clone ¶
func (i ValueSemanticsImpl) Clone() Value
func (ValueSemanticsImpl) GetVTable ¶
func (i ValueSemanticsImpl) GetVTable(ctx *Context) Value
func (ValueSemanticsImpl) IsCallable ¶
func (i ValueSemanticsImpl) IsCallable() Bool
func (ValueSemanticsImpl) IsIterable ¶
func (i ValueSemanticsImpl) IsIterable() Bool
func (ValueSemanticsImpl) Iterator ¶
func (i ValueSemanticsImpl) Iterator(*Context) Value
func (ValueSemanticsImpl) MarshalJSON ¶
func (i ValueSemanticsImpl) MarshalJSON() ([]byte, error)
func (ValueSemanticsImpl) ObjectKey ¶
func (i ValueSemanticsImpl) ObjectKey() string
func (ValueSemanticsImpl) Prefix ¶
func (i ValueSemanticsImpl) Prefix(*Context, uint64) (Value, error)
func (ValueSemanticsImpl) String ¶
func (i ValueSemanticsImpl) String() string
func (ValueSemanticsImpl) Type ¶
func (i ValueSemanticsImpl) Type() string
type VidaBytesBuilder ¶
type VidaBytesBuilder struct {
ReferenceSemanticsImpl
Buffer *bytes.Buffer
}
Bytes Builder Value
func (*VidaBytesBuilder) Clone ¶
func (bb *VidaBytesBuilder) Clone() Value
func (*VidaBytesBuilder) Equals ¶
func (bb *VidaBytesBuilder) Equals(ctx *Context, other Value) Bool
func (*VidaBytesBuilder) GetVTable ¶
func (bb *VidaBytesBuilder) GetVTable(ctx *Context) Value
func (*VidaBytesBuilder) LookUp ¶
func (bb *VidaBytesBuilder) LookUp(ctx *Context, message Value) Value
func (*VidaBytesBuilder) ObjectKey ¶
func (bb *VidaBytesBuilder) ObjectKey() string
func (*VidaBytesBuilder) Prefix ¶
func (bb *VidaBytesBuilder) Prefix(ctx *Context, op uint64) (Value, error)
func (*VidaBytesBuilder) String ¶
func (bb *VidaBytesBuilder) String() string
func (*VidaBytesBuilder) Type ¶
func (bb *VidaBytesBuilder) Type() string
type VidaError ¶
type VidaError struct {
ReferenceSemanticsImpl
Message Value
}
func (*VidaError) IsCallable ¶
func (*VidaError) IsIterable ¶
type VidaRunTimeError ¶
func NewRuntimeError ¶
func NewRuntimeError(scriptID string, message string, errorType string, line uint) *VidaRunTimeError
func (*VidaRunTimeError) Error ¶
func (e *VidaRunTimeError) Error() string
type VidaStringBuilder ¶
type VidaStringBuilder struct {
ReferenceSemanticsImpl
Builder *strings.Builder
}
String Builder Value
func (*VidaStringBuilder) Clone ¶
func (sb *VidaStringBuilder) Clone() Value
func (*VidaStringBuilder) Equals ¶
func (sb *VidaStringBuilder) Equals(ctx *Context, other Value) Bool
func (*VidaStringBuilder) GetVTable ¶
func (sb *VidaStringBuilder) GetVTable(ctx *Context) Value
func (*VidaStringBuilder) LookUp ¶
func (sb *VidaStringBuilder) LookUp(ctx *Context, message Value) Value
func (*VidaStringBuilder) ObjectKey ¶
func (sb *VidaStringBuilder) ObjectKey() string
func (*VidaStringBuilder) Prefix ¶
func (sb *VidaStringBuilder) Prefix(ctx *Context, op uint64) (Value, error)
func (*VidaStringBuilder) String ¶
func (sb *VidaStringBuilder) String() string
func (*VidaStringBuilder) Type ¶
func (sb *VidaStringBuilder) Type() string
Source Files
¶
- array.go
- assembler.go
- bool.go
- builders.go
- bundler.go
- bytes.go
- casting.go
- co.go
- compiler.go
- context.go
- debug.go
- disassembler.go
- enum.go
- error.go
- file.go
- fmt.go
- format.go
- foundation.go
- fs.go
- function.go
- global.go
- http.go
- io.go
- isa.go
- iter.go
- json.go
- kbuilder.go
- lexer.go
- math.go
- nil.go
- numbers.go
- object.go
- os.go
- parser.go
- path.go
- random.go
- regex.go
- sbuilder.go
- script.go
- string.go
- style.go
- task.go
- text.go
- thread.go
- time.go
- value.go
- vida.go
- vm.go
- vrterror.go
- vtable.go