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
- type Builtin
- type BuiltinFunction
- type CPath
- type Comma
- type Converter
- type Date
- type Decimal
- type Dict
- type DoDialect
- type EXword
- type Email
- type EnvR2
- type Error
- type EyrStack
- type Function
- type Gen
- 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
- type LiveEnv
- 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 (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 Spreadsheet
- func (s *Spreadsheet) AddRow(vals SpreadsheetRow)
- func (s Spreadsheet) Column(name string) Object
- func (s Spreadsheet) Columns(ps *ProgramState, names []string) Object
- func (s Spreadsheet) Dump(e Idxs) string
- func (s Spreadsheet) Equal(o Object) bool
- func (s Spreadsheet) GetColumnIndex(column string) int
- func (s Spreadsheet) GetColumns() List
- func (s Spreadsheet) GetKind() int
- func (s Spreadsheet) GetRow(ps *ProgramState, index int) SpreadsheetRow
- func (s Spreadsheet) GetRowNew(index int) Object
- func (s Spreadsheet) GetRowValue(column string, rrow SpreadsheetRow) (any, error)
- func (s *Spreadsheet) GetRows() []SpreadsheetRow
- func (s Spreadsheet) Inspect(e Idxs) string
- func (s Spreadsheet) NRows() int
- func (s Spreadsheet) Print(e Idxs) string
- func (s *Spreadsheet) RemoveRowByIndex(index int64)
- func (s *Spreadsheet) SetCols(vals []string)
- func (s Spreadsheet) Sum(name string) Object
- func (s Spreadsheet) Sum_Just(name string) (float64, error)
- func (s Spreadsheet) ToHtml() string
- func (s Spreadsheet) ToTxt() string
- func (s Spreadsheet) Trace(msg string)
- func (s Spreadsheet) Type() Type
- type SpreadsheetRow
- func (s SpreadsheetRow) Dump(e Idxs) string
- func (s SpreadsheetRow) Equal(o Object) bool
- func (s SpreadsheetRow) GetKind() int
- func (s SpreadsheetRow) Inspect(e Idxs) string
- func (s SpreadsheetRow) Print(e Idxs) string
- func (s SpreadsheetRow) ToDict() Dict
- func (s SpreadsheetRow) ToTxt() string
- func (s SpreadsheetRow) Trace(msg string)
- func (s SpreadsheetRow) Type() Type
- type String
- 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)
- func (ser *TSeries) Reset()
- func (ser *TSeries) RmLast() *TSeries
- func (ser *TSeries) SetPos(pos int)
- 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 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",
"Spreadsheet",
"Email",
"Kind",
"Kindword",
"Converter",
"Time",
"SpreadsheetRowType",
"Decimal",
"Vector",
"OpCPath",
"PipeCPath",
"Modword",
"LModword",
}
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 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 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 NewDictFromSeries ¶
type Error ¶
type Error struct {
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 Idxs ¶
type Idxs struct {
// contains filtered or unexported fields
}
func (Idxs) GetWordCount ¶
type Integer ¶
type Integer struct {
Value int64
}
func NewBoolean ¶ added in v0.0.26
func NewInteger ¶
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 ¶
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
}
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 { ... }
type Spreadsheet ¶
type Spreadsheet struct {
Cols []string
Rows []SpreadsheetRow
Kind Word
Indexes map[string]map[any][]int
}
func NewSpreadsheet ¶
func NewSpreadsheet(cols []string) *Spreadsheet
func (*Spreadsheet) AddRow ¶
func (s *Spreadsheet) AddRow(vals SpreadsheetRow)
Inspect returns a string representation of the Integer.
func (Spreadsheet) Column ¶
func (s Spreadsheet) Column(name string) Object
func (Spreadsheet) Columns ¶
func (s Spreadsheet) Columns(ps *ProgramState, names []string) Object
func (Spreadsheet) Dump ¶ added in v0.0.13
func (s Spreadsheet) Dump(e Idxs) string
func (Spreadsheet) Equal ¶ added in v0.0.11
func (s Spreadsheet) Equal(o Object) bool
func (Spreadsheet) GetColumnIndex ¶ added in v0.0.25
func (s Spreadsheet) GetColumnIndex(column string) int
func (Spreadsheet) GetColumns ¶
func (s Spreadsheet) GetColumns() List
func (Spreadsheet) GetKind ¶
func (s Spreadsheet) GetKind() int
func (Spreadsheet) GetRow ¶
func (s Spreadsheet) GetRow(ps *ProgramState, index int) SpreadsheetRow
func (Spreadsheet) GetRowNew ¶
func (s Spreadsheet) GetRowNew(index int) Object
func (Spreadsheet) GetRowValue ¶
func (s Spreadsheet) GetRowValue(column string, rrow SpreadsheetRow) (any, error)
func (*Spreadsheet) GetRows ¶
func (s *Spreadsheet) GetRows() []SpreadsheetRow
func (Spreadsheet) NRows ¶
func (s Spreadsheet) NRows() int
func (Spreadsheet) Print ¶ added in v0.0.13
func (s Spreadsheet) Print(e Idxs) string
Inspect returns a string representation of the Integer.
func (*Spreadsheet) RemoveRowByIndex ¶ added in v0.0.24
func (s *Spreadsheet) RemoveRowByIndex(index int64)
func (*Spreadsheet) SetCols ¶
func (s *Spreadsheet) SetCols(vals []string)
Inspect returns a string representation of the Integer.
func (Spreadsheet) Sum ¶
func (s Spreadsheet) Sum(name string) Object
func (Spreadsheet) ToHtml ¶
func (s Spreadsheet) ToHtml() string
Inspect returns a string representation of the Integer.
func (Spreadsheet) ToTxt ¶
func (s Spreadsheet) ToTxt() string
Inspect returns a string representation of the Integer.
func (Spreadsheet) Trace ¶
func (s Spreadsheet) Trace(msg string)
type SpreadsheetRow ¶
type SpreadsheetRow struct {
Values []any
Uplink *Spreadsheet
}
func NewSpreadsheetRow ¶
func NewSpreadsheetRow(values []any, uplink *Spreadsheet) *SpreadsheetRow
func SpreadsheetRowFromDict ¶ added in v0.0.25
func SpreadsheetRowFromDict(dict Dict, uplink *Spreadsheet) (bool, string, *SpreadsheetRow)
func (SpreadsheetRow) Dump ¶ added in v0.0.13
func (s SpreadsheetRow) Dump(e Idxs) string
func (SpreadsheetRow) Equal ¶ added in v0.0.11
func (s SpreadsheetRow) Equal(o Object) bool
Do not use when comparing a spreadsheet as a whole because column ordering is not guaranteed
func (SpreadsheetRow) GetKind ¶
func (s SpreadsheetRow) GetKind() int
func (SpreadsheetRow) Inspect ¶
func (s SpreadsheetRow) Inspect(e Idxs) string
Inspect returns a string
func (SpreadsheetRow) Print ¶ added in v0.0.13
func (s SpreadsheetRow) Print(e Idxs) string
Inspect returns a string representation of the Integer.
func (SpreadsheetRow) ToDict ¶ added in v0.0.19
func (s SpreadsheetRow) ToDict() Dict
func (SpreadsheetRow) ToTxt ¶
func (s SpreadsheetRow) ToTxt() string
func (SpreadsheetRow) Trace ¶
func (s SpreadsheetRow) Trace(msg string)
func (SpreadsheetRow) Type ¶
func (s SpreadsheetRow) Type() Type
Type returns the type of the Integer.
type TSeries ¶
type TSeries struct {
S []Object `bson:"series"`
// contains filtered or unexported fields
}
func NewBlockFromList ¶ added in v0.0.18
func NewTSeries ¶
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.
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 SpreadsheetType Type = 27 EmailType Type = 28 KindType Type = 29 KindwordType Type = 30 ConverterType Type = 31 TimeType Type = 32 SpreadsheetRowType Type = 33 DecimalType Type = 34 VectorType Type = 35 OpCPathType Type = 36 PipeCPathType Type = 37 ModwordType Type = 38 LModwordType Type = 39 )