Documentation
¶
Overview ¶
object.go
series.go
Index ¶
- Constants
- Variables
- func ArrayFloat32FromSeries(block TSeries) []float32
- func DereferenceAny(x any) any
- func IsPointer(x any) bool
- func IsPointer2(x reflect.Value) bool
- func LeftPad(s string, padStr string, padCount int) string
- func ReferenceAny(x any) any
- func RyeToRaw(res Object, idx *Idxs) any
- func SetValue(ps *ProgramState, word string, val Object)
- type Argword
- type Block
- func (i Block) Dump(e Idxs) string
- func (i Block) Equal(o Object) bool
- func (o Block) Get(i int) Object
- func (i Block) GetKind() int
- func (b Block) Inspect(e Idxs) string
- func (o Block) Length() int
- func (o Block) MakeNew(data []Object) Object
- func (b Block) Print(e Idxs) string
- func (i Block) Trace(msg string)
- func (i Block) Type() Type
- type Boolean
- type Builtin
- type BuiltinFunction
- type CPath
- type Collection
- type Comma
- type Converter
- type Date
- type Decimal
- type Dict
- type DoDialect
- type EXword
- type Email
- type EnvR2
- type Error
- func NewError(message string) *Error
- func NewError1(status int) *Error
- func NewError2(status int, message string) *Error
- func NewError4(status int, message string, error *Error, values map[string]Object) *Error
- func NewError5(kind Word, status int, message string, error *Error, values map[string]Object) *Error
- type EyrStack
- type Function
- type Gen
- func (e *Gen) Get(kind int, word int) (Object, bool)
- func (e *Gen) GetKinds() map[int]int
- func (e *Gen) GetMethods(kind int) []int
- func (e Gen) PreviewKinds(idxs Idxs, filter string) string
- func (e Gen) PreviewMethods(idxs Idxs, kind int, filter string) string
- func (e *Gen) Print(idxs Idxs)
- func (e *Gen) Set(kind int, word int, val Object) Object
- type Genword
- type Getword
- type Idxs
- type Integer
- type Kind
- func (i Kind) Dump(e Idxs) string
- func (i Kind) Equal(o Object) bool
- func (i Kind) GetKind() int
- func (i Kind) HasConverter(from int) bool
- func (i Kind) Inspect(e Idxs) string
- func (i Kind) Print(e Idxs) string
- func (i Kind) SetConverter(from int, spec Block)
- func (i Kind) Trace(msg string)
- func (i Kind) Type() Type
- type Kindword
- type LModword
- type LSetword
- type List
- func (i List) Dump(e Idxs) string
- func (i List) Equal(o Object) bool
- func (o List) Get(i int) Object
- func (i List) GetKind() int
- func (i List) Inspect(idxs Idxs) string
- func (o List) Length() int
- func (o List) MakeNew(data []Object) Object
- func (i List) Print(idxs Idxs) string
- func (i List) Trace(msg string)
- func (i List) Type() Type
- type LiveEnv
- type Mapping
- type Modword
- type Native
- type Object
- type Opword
- type Pipeword
- type ProgramState
- type RyeCtx
- func (e RyeCtx) Copy() *RyeCtx
- func (i RyeCtx) Dump(e Idxs) string
- func (i RyeCtx) DumpBare(e Idxs) string
- func (i RyeCtx) Equal(o Object) bool
- func (e *RyeCtx) Get(word int) (Object, bool)
- func (e *RyeCtx) Get2(word int) (Object, bool, *RyeCtx)
- func (i RyeCtx) GetKind() int
- func (e RyeCtx) GetState() map[int]Object
- func (e RyeCtx) GetWords(idxs Idxs) Block
- func (e RyeCtx) GetWordsAsStrings(idxs Idxs) Block
- func (i RyeCtx) Inspect(e Idxs) string
- func (e *RyeCtx) Mod(word int, val Object) bool
- func (e RyeCtx) Preview(idxs Idxs, filter string) string
- func (e RyeCtx) Print(idxs Idxs) string
- func (e *RyeCtx) Set(word int, val Object) Object
- func (e *RyeCtx) SetNew(word int, val Object, idxs *Idxs) bool
- func (i RyeCtx) Trace(msg string)
- func (i RyeCtx) Type() Type
- func (e *RyeCtx) Unset(word int, idxs *Idxs) Object
- type Setword
- type SprNode
- type String
- func (i String) Dump(e Idxs) string
- func (i String) Equal(o Object) bool
- func (o String) Get(i int) Object
- func (i String) GetKind() int
- func (i String) Inspect(e Idxs) string
- func (o String) Length() int
- func (o String) MakeNew(data []Object) Object
- func (i String) Print(e Idxs) string
- func (i String) Trace(msg string)
- func (i String) Type() Type
- type TSeries
- func (ser *TSeries) Append(obj Object) *TSeries
- func (ser *TSeries) AppendMul(objs []Object) *TSeries
- func (ser TSeries) AtLast() bool
- func (ser TSeries) Ended() bool
- func (ser TSeries) Get(n int) Object
- func (ser *TSeries) GetAll() []Object
- func (ser *TSeries) GetPos() int
- func (ser TSeries) Len() int
- func (ser *TSeries) Next()
- func (ser TSeries) PGet(n int) *Object
- func (ser TSeries) Peek() Object
- func (ser *TSeries) Pop() Object
- func (ser TSeries) Pos() int
- func (ser TSeries) PositionAndSurroundingElements(idxs Idxs) string
- func (ser *TSeries) Put(obj Object) bool
- func (ser *TSeries) Reset()
- func (ser *TSeries) RmLast() *TSeries
- func (ser *TSeries) SetPos(pos int)
- type Table
- func (s *Table) AddRow(vals TableRow)
- func (s Table) Columns(ps *ProgramState, names []string) Object
- func (s Table) Dump(e Idxs) string
- func (s Table) Equal(o Object) bool
- func (o Table) Get(i int) Object
- func (s Table) GetColumn(name string) Object
- func (s Table) GetColumnIndex(column string) int
- func (s Table) GetColumns() List
- func (s Table) GetKind() int
- func (s Table) GetRow(ps *ProgramState, index int) TableRow
- func (s Table) GetRowNew(index int) Object
- func (s Table) GetRowValue(column string, rrow TableRow) (any, error)
- func (s *Table) GetRows() []TableRow
- func (s Table) Inspect(e Idxs) string
- func (o Table) Length() int
- func (o Table) MakeNew(data []Object) Object
- func (s Table) NRows() int
- func (s Table) Print(e Idxs) string
- func (s *Table) RemoveRowByIndex(index int64)
- func (s *Table) SetCols(vals []string)
- func (s Table) Sum(name string) Object
- func (s Table) Sum_Just(name string) (float64, error)
- func (s Table) ToHtml() string
- func (s Table) ToTxt() string
- func (s Table) Trace(msg string)
- func (s Table) Type() Type
- type TableRow
- func AddTableRowAndBlock(row TableRow, updatesBlock TSeries, idx *Idxs) TableRow
- func AddTableRowAndDict(row TableRow, dict Dict) TableRow
- func AddTableRowAndMap(row TableRow, dict map[string]any) TableRow
- func NewTableRow(values []any, uplink *Table) *TableRow
- func TableRowFromDict(dict Dict, uplink *Table) (bool, string, *TableRow)
- func (s TableRow) Dump(e Idxs) string
- func (s TableRow) Equal(o Object) bool
- func (s TableRow) GetKind() int
- func (s TableRow) Inspect(e Idxs) string
- func (s TableRow) Print(e Idxs) string
- func (s TableRow) ToDict() Dict
- func (s TableRow) ToTxt() string
- func (s TableRow) Trace(msg string)
- func (s TableRow) Type() Type
- type Tagword
- type Time
- type Type
- type Uri
- func (i Uri) Dump(e Idxs) string
- func (i Uri) Equal(o Object) bool
- func (i Uri) GetFullUri(e Idxs) string
- func (i Uri) GetKind() int
- func (i Uri) GetPath() string
- func (i Uri) GetProtocol() Word
- func (i Uri) Inspect(e Idxs) string
- func (i Uri) Print(e Idxs) string
- func (i Uri) Trace(msg string)
- func (i Uri) Type() Type
- type VarBuiltin
- type VarBuiltinFunction
- type Vector
- type Void
- type Word
- type Xword
Constants ¶
const STACK_SIZE int = 1000
Variables ¶
var NativeTypes = [...]string{
"Block",
"Integer",
"Word",
"Setword",
"Opword",
"Pipeword",
"Builtin",
"Function",
"Error",
"Comma",
"Void",
"String",
"Tagword",
"Genword",
"Getword",
"Argword",
"Native",
"Uri",
"LSetword",
"Ctx",
"Dict",
"List",
"Date",
"CPath",
"Xword",
"EXword",
"Table",
"Email",
"Kind",
"Kindword",
"Converter",
"Time",
"TableRowType",
"Decimal",
"Vector",
"OpCPath",
"PipeCPath",
"Modword",
"LModword",
"Boolean",
"VarBuiltin",
}
Functions ¶
func ArrayFloat32FromSeries ¶
func DereferenceAny ¶ added in v0.0.25
func IsPointer2 ¶ added in v0.0.25
func ReferenceAny ¶ added in v0.0.25
func SetValue ¶
func SetValue(ps *ProgramState, word string, val Object)
Types ¶
type Argword ¶
func NewArgword ¶
type Block ¶
func List2Block ¶ added in v0.0.35
func List2Block(ps *ProgramState, s List) Block
type Boolean ¶ added in v0.0.40
type Boolean struct {
Value bool
}
func NewBoolean ¶ added in v0.0.26
type Builtin ¶
type Builtin struct {
Fn BuiltinFunction
Argsn int
Cur0 Object
Cur1 Object
Cur2 Object
Cur3 Object
Cur4 Object
AcceptFailure bool
Pure bool
Doc string
}
Builtin represents a builtin function. TODO: Builtin is just temporary ... we need to make something else, that holds natives and user functions. Interface should be the same ... would it be better (faster) to have concrete type probably.
func NewBuiltin ¶
type BuiltinFunction ¶
type BuiltinFunction func(ps *ProgramState, arg0 Object, arg1 Object, arg2 Object, arg3 Object, arg4 Object) Object
BuiltinFunction represents a function signature of builtin functions. ///type BuiltinFunction func(ps *ProgramState, args ...Object) Object
type CPath ¶
type CPath struct {
Mode int // 0 Cpath, 1 OpCpath , 2 PipeCPath
Cnt int
Word1 Word
Word2 Word
Word3 Word
}
func (CPath) GetWordNumber ¶
type Collection ¶ added in v0.0.35
string, list, block, spreadsheet, spreadsheetrow
type Dict ¶
Dict -- nonindexed and unboxed map ... for example for params from request etc, so we don't neet to idex keys and it doesn't need boxed values I think it should have option of having Kind too ...
func MergeDictAndBlock ¶ added in v0.0.33
func MergeTwoDicts ¶ added in v0.0.33
func NewDictFromSeries ¶
type Error ¶
type Error struct {
Kind Word
Status int
Message string
Parent *Error
Values map[string]Object
CodeContext *RyeCtx
CodeBlock TSeries
}
type EyrStack ¶ added in v0.0.22
func NewEyrStack ¶ added in v0.0.22
func NewEyrStack() *EyrStack
func (*EyrStack) Peek ¶ added in v0.0.22
func (s *EyrStack) Peek(es *ProgramState, offset int) Object
Pop removes and returns the top element of stack.
func (*EyrStack) Pop ¶ added in v0.0.22
func (s *EyrStack) Pop(es *ProgramState) Object
Pop removes and returns the top element of stack.
func (*EyrStack) Push ¶ added in v0.0.22
func (s *EyrStack) Push(es *ProgramState, x Object)
Push adds a new number to the stack
type Function ¶
type Function struct {
Argsn int
Spec Block
Body Block
Ctx *RyeCtx
Pure bool
Doc string
InCtx bool
}
func NewFunctionC ¶
type Gen ¶
type Gen struct {
// contains filtered or unexported fields
}
func (*Gen) GetMethods ¶ added in v0.0.35
func (Gen) PreviewKinds ¶ added in v0.0.35
func (Gen) PreviewMethods ¶ added in v0.0.35
type Idxs ¶
type Idxs struct {
// contains filtered or unexported fields
}
func (Idxs) GetWordCount ¶
type LModword ¶ added in v0.0.20
type LModword struct {
Index int
}
func NewLModword ¶ added in v0.0.20
type LiveEnv ¶ added in v0.0.20
func NewLiveEnv ¶ added in v0.0.20
func NewLiveEnv() *LiveEnv
func (*LiveEnv) ClearUpdates ¶ added in v0.0.20
func (le *LiveEnv) ClearUpdates()
type Modword ¶ added in v0.0.20
type Modword struct {
Index int
}
func NewModword ¶ added in v0.0.20
type Object ¶
type Object interface {
Type() Type
Trace(msg string)
GetKind() int
Equal(p Object) bool
// Print returns a string representation of the Object.
Print(e Idxs) string
// Inspect returns a diagnostic string representation of the Object.
Inspect(e Idxs) string
// Dump returns a string representation of the Object, intended for serialization.
Dump(e Idxs) string
}
func ToRyeValue ¶
func ToRyeValueAggressive ¶ added in v0.0.35
func ToRyeValueAggressive(ps *ProgramState, val any) Object
type Pipeword ¶
func NewPipeword ¶
type ProgramState ¶
type ProgramState struct {
Ser TSeries // current block of code
Res Object // result of expression
Ctx *RyeCtx // Env object ()
PCtx *RyeCtx // Env object () -- pure countext
Idx *Idxs // Idx object (index of words)
Args []int // names of current arguments (indexes of names)
Gen *Gen // map[int]map[int]Object // list of Generic kinds / code
Inj Object // Injected first value in a block evaluation
Injnow bool
ReturnFlag bool
ErrorFlag bool
FailureFlag bool
ForcedResult Object
SkipFlag bool
InErrHandler bool
ScriptPath string // holds the path to the script that is being imported (doed) currently
WorkingPath string // holds the path to CWD (can be changed in program with specific functions)
AllowMod bool
LiveObj *LiveEnv
Dialect DoDialect
Stack *EyrStack
Embedded bool
DeferBlocks []Block // blocks to be executed when function exits or program terminates
}
func AddToProgramState ¶
func AddToProgramState(ps *ProgramState, ser TSeries, idx *Idxs) *ProgramState
func NewProgramState ¶
func NewProgramState(ser TSeries, idx *Idxs) *ProgramState
func NewProgramStateNEW ¶ added in v0.0.15
func NewProgramStateNEW() *ProgramState
func (*ProgramState) Dump ¶ added in v0.0.13
func (ps *ProgramState) Dump() string
func (*ProgramState) ResetStack ¶ added in v0.0.22
func (ps *ProgramState) ResetStack()
type RyeCtx ¶
type RyeCtx struct {
Parent *RyeCtx
Kind Word
Doc string
// contains filtered or unexported fields
}
func (RyeCtx) DumpBare ¶ added in v0.0.16
DumpBare returns the string representation of the context without wraping it in context { ... }
func (RyeCtx) GetWordsAsStrings ¶ added in v0.0.36
type TSeries ¶
type TSeries struct {
S []Object `bson:"series"` // The underlying slice of Objects
// contains filtered or unexported fields
}
TSeries represents a series of Objects with a position pointer. It provides methods for traversing, accessing, and modifying the series.
func NewBlockFromList ¶ added in v0.0.18
func NewTSeries ¶
NewTSeries creates a new TSeries with the given slice of Objects. The position pointer is initialized to 0 (beginning of the series).
func (*TSeries) Append ¶
Append adds a single Object to the end of the series and returns the modified series.
func (*TSeries) AppendMul ¶
AppendMul adds multiple Objects to the end of the series and returns the modified series.
func (TSeries) AtLast ¶
AtLast returns true if the position is at or beyond the last element of the series.
func (TSeries) Get ¶
Get returns the Object at the specified position n. Returns nil if the position is out of bounds.
func (*TSeries) GetAll ¶
GetAll returns the underlying slice of Objects. Note: This returns a direct reference to the internal slice, not a copy.
func (*TSeries) GetPos ¶
GetPos returns the current position in the series. This is an alias for Pos() but as a pointer receiver method.
func (TSeries) PGet ¶
PGet returns a pointer to the Object at position n in the series. WARNING: This returns a direct pointer to the internal object, which allows modification of the original object. Use with caution to avoid unintended side effects. For read-only access, prefer using Get() instead.
func (TSeries) Peek ¶
Peek returns the Object at the current position without advancing the position. Returns nil if the position is out of bounds.
func (*TSeries) Pop ¶
Pop returns the Object at the current position and advances the position. Returns nil if the position is out of bounds.
func (TSeries) PositionAndSurroundingElements ¶ added in v0.0.13
PositionAndSurroundingElements returns a string of the position of the series, marked with (here) and 10 surrounding elements.
func (*TSeries) Put ¶
Put replaces the Object at the position before the current position (pos-1) with the given Object. Returns true if successful, false if the position is out of bounds. Note: This is typically used after Pop() to replace the item that was just popped.
func (*TSeries) Reset ¶
func (ser *TSeries) Reset()
Reset sets the position pointer back to the beginning of the series.
type Table ¶ added in v0.0.33
func (Table) Columns ¶ added in v0.0.33
func (s Table) Columns(ps *ProgramState, names []string) Object
func (Table) GetColumnIndex ¶ added in v0.0.33
func (Table) GetColumns ¶ added in v0.0.33
func (Table) GetRowValue ¶ added in v0.0.33
func (*Table) RemoveRowByIndex ¶ added in v0.0.33
type TableRow ¶ added in v0.0.33
func AddTableRowAndBlock ¶ added in v0.0.33
func AddTableRowAndDict ¶ added in v0.0.33
func AddTableRowAndMap ¶ added in v0.0.33
func NewTableRow ¶ added in v0.0.33
func TableRowFromDict ¶ added in v0.0.33
func (TableRow) Equal ¶ added in v0.0.33
Do not use when comparing a table as a whole because column ordering is not guaranteed
type Type ¶
type Type int
const ( BlockType Type = 1 IntegerType Type = 2 WordType Type = 3 SetwordType Type = 4 OpwordType Type = 5 PipewordType Type = 6 BuiltinType Type = 7 FunctionType Type = 8 ErrorType Type = 9 CommaType Type = 10 VoidType Type = 11 StringType Type = 12 TagwordType Type = 13 GenwordType Type = 14 GetwordType Type = 15 ArgwordType Type = 16 NativeType Type = 17 UriType Type = 18 LSetwordType Type = 19 CtxType Type = 20 DictType Type = 21 ListType Type = 22 DateType Type = 23 CPathType Type = 24 XwordType Type = 25 EXwordType Type = 26 TableType Type = 27 EmailType Type = 28 KindType Type = 29 KindwordType Type = 30 ConverterType Type = 31 TimeType Type = 32 TableRowType Type = 33 DecimalType Type = 34 VectorType Type = 35 OpCPathType Type = 36 PipeCPathType Type = 37 ModwordType Type = 38 LModwordType Type = 39 BooleanType Type = 40 VarBuiltinType Type = 41 )
type Uri ¶
func NewFileUri ¶ added in v0.0.23
func (Uri) GetFullUri ¶ added in v0.0.17
func (Uri) GetProtocol ¶
type VarBuiltin ¶ added in v0.0.40
type VarBuiltin struct {
Fn VarBuiltinFunction
Argsn int
AcceptFailure bool
Pure bool
Doc string
}
VarBuiltin represents a builtin function with variadic arguments.
func NewVarBuiltin ¶ added in v0.0.40
func NewVarBuiltin(fn VarBuiltinFunction, argsn int, acceptFailure bool, pure bool, doc string) *VarBuiltin
func (VarBuiltin) Dump ¶ added in v0.0.40
func (i VarBuiltin) Dump(e Idxs) string
func (VarBuiltin) Equal ¶ added in v0.0.40
func (i VarBuiltin) Equal(o Object) bool
func (VarBuiltin) GetKind ¶ added in v0.0.40
func (i VarBuiltin) GetKind() int
func (VarBuiltin) Inspect ¶ added in v0.0.40
func (b VarBuiltin) Inspect(e Idxs) string
func (VarBuiltin) Print ¶ added in v0.0.40
func (b VarBuiltin) Print(e Idxs) string
func (VarBuiltin) Trace ¶ added in v0.0.40
func (i VarBuiltin) Trace(msg string)
func (VarBuiltin) Type ¶ added in v0.0.40
func (b VarBuiltin) Type() Type
type VarBuiltinFunction ¶ added in v0.0.40
type VarBuiltinFunction func(ps *ProgramState, args ...Object) Object
VarBuiltinFunction represents a function signature of variadic builtin functions.