Documentation ¶
Index ¶
- Constants
- Variables
- func BoundArrayIndex(i, min, max int) int
- func MapIsEmpty(t map[string]tok.Token) bool
- func MapLength(t map[string]tok.Token) (l int)
- type BobType
- type ContextType
- func (ctx *ContextType) Call(name string, params ...interface{}) (result []reflect.Value, err error)
- func (ctx *ContextType) DumpContext()
- func (ctx *ContextType) GetFromContext(id string) (v interface{}, t int, f bool)
- func (ctx *ContextType) IsDefinedContext(id string) (f bool)
- func (ctx *ContextType) NameOfType(t int) (rv string)
- func (ctx *ContextType) PopFromContext(id string)
- func (ctx *ContextType) PushInContext(id string, ty int, val interface{})
- func (ctx *ContextType) SetInContext(id string, ty int, val interface{}) (err error)
- type ContextValueType
- type EvalType
- func (eval *EvalType) CallFunction(match string, plist []tok.Token) (rv tok.Token)
- func (eval *EvalType) DclFunction(id string, fx interface{})
- func (eval *EvalType) InitFunctions()
- func (eval *EvalType) ListTokens() string
- func (eval *EvalType) ParseArrayRef() (rv tok.Token)
- func (eval *EvalType) ParseJSON() (rv tok.Token)
- func (eval *EvalType) ParsePlist() (rv []tok.Token)
- func (eval *EvalType) Pres0() (rv tok.Token)
- func (eval *EvalType) Pres1() (TkL tok.Token)
- func (eval *EvalType) Pres2() (TkL tok.Token)
- func (eval *EvalType) Pres3() (TkL tok.Token)
- func (eval *EvalType) Pres4() (TkL tok.Token)
- func (eval *EvalType) Pres5() (TkL tok.Token)
- func (eval *EvalType) Pres5a() (TkL tok.Token)
- func (eval *EvalType) Pres6() (TkL tok.Token)
- func (eval *EvalType) Pres7() (TkL tok.Token)
- func (eval *EvalType) Pres8() (TkL tok.Token)
- func (eval *EvalType) Pres9() (TkL tok.Token)
- func (eval *EvalType) PresA() (TkL tok.Token)
- func (eval *EvalType) PresB() (TkL tok.Token)
- func (eval *EvalType) PresC() (TkL tok.Token)
- func (eval *EvalType) PresD() (TkL tok.Token)
- func (eval *EvalType) PresE() (TkL tok.Token)
- func (eval *EvalType) PresF() (TkL tok.Token)
- func (eval *EvalType) PresG() (TkL tok.Token)
- func (eval *EvalType) PresTop() (TkL tok.Token)
- func (eval *EvalType) SetErrorInfo(rv *tok.Token, format string, args ...interface{})
- func (eval *EvalType) TypeConvertToNumber(TkL tok.Token) (rv tok.Token)
Constants ¶
const ( CtxType_NULL = 0 CtxType_Int = 1 CtxType_Str = 2 CtxType_Bool = 3 CtxType_Float = 4 CtxType_ArrayOf = 5 CtxType_MapOf = 6 CtxType_SMapOf = 7 CtxType_KMapOf = 8 CtxType_Error = 9 CtxType_ID = 10 CtxType_Func = 11 CtxType_TypeCast = 12 CtxType_Token = 13 // Id is equvilant token (and, or, xor etc) )
Variables ¶
var (
ErrParamsNotAdapted = errors.New("The number of params is not adapted.")
)
Functions ¶
func BoundArrayIndex ¶
func MapIsEmpty ¶
-------------------------------------------------------------------------------------------------------------------------------------------------------
Types ¶
type ContextType ¶
type ContextType struct { Store map[string]*ContextValueType // contains filtered or unexported fields }
func NewContextType ¶
func NewContextType() (rv *ContextType)
func (*ContextType) Call ¶
func (ctx *ContextType) Call(name string, params ...interface{}) (result []reflect.Value, err error)
Call a function that has been placed in the table
func (*ContextType) DumpContext ¶
func (ctx *ContextType) DumpContext()
func (*ContextType) GetFromContext ¶
func (ctx *ContextType) GetFromContext(id string) (v interface{}, t int, f bool)
func (*ContextType) IsDefinedContext ¶
func (ctx *ContextType) IsDefinedContext(id string) (f bool)
func (*ContextType) NameOfType ¶
func (ctx *ContextType) NameOfType(t int) (rv string)
fmt.Printf(" Found, Type=%d\n", t, eval.Ctx.NameOfType(t))
func (*ContextType) PopFromContext ¶
func (ctx *ContextType) PopFromContext(id string)
func (*ContextType) PushInContext ¶
func (ctx *ContextType) PushInContext(id string, ty int, val interface{})
func (*ContextType) SetInContext ¶
func (ctx *ContextType) SetInContext(id string, ty int, val interface{}) (err error)
type ContextValueType ¶
type ContextValueType struct { TypeOf int Val interface{} Func reflect.Value Prev *ContextValueType }
type EvalType ¶
type EvalType struct { Pos int // Ctx *ContextType // Mm []tok.Token // Lax_DCL bool // If true, then auto declare on all assignments // Lax_ArrayHash bool // If true, then [a] == a, { "x":a } == a // FloatEQThrUse bool // If true then compare floats using threshold // FloatEQThr float64 // PrintErrorMsg bool TestCase string }
func (*EvalType) CallFunction ¶
-------------------------------------------------------------------------------------------------------------------------------------------------------
func (*EvalType) DclFunction ¶
------------------------------------------------------------------------------------------------------------------------------------------------------- Create the function with Fx ptr in the symbol table.
func (*EvalType) InitFunctions ¶
func (eval *EvalType) InitFunctions()
-------------------------------------------------------------------------------------------------------------------------------------------------------
func (*EvalType) ListTokens ¶
------------------------------------------------------------------------------------------------------------------------------------------------------- This is called form PresG (pipe) during error conditions.
func (*EvalType) ParseArrayRef ¶
-------------------------------------------------------------------------------------------------------------------------------------------------------
func (*EvalType) ParseJSON ¶
-------------------------------------------------------------------------------------------------------------------------------------------------------
func (*EvalType) ParsePlist ¶
-------------------------------------------------------------------------------------------------------------------------------------------------------
func (*EvalType) Pres0 ¶
-------------------------------------------------------------------------------------------------------------------------------------------------------
func (*EvalType) Pres1 ¶
-------------------------------------------------------------------------------------------------------------------------------------------------------
Array Slice Ops
Expr [ : Expr ] Expr [ Expr : ] Expr [ : ] Expr [ ExprID ] -- -- Map Ref Expr . Name -- -- Map Ref xyzzy
ArrayId(expr) [ ... ] MapId(expr) . Name List
xyzzy1857 - not working
Array is just a postfix '[' or '.' operator (Could have been -> too) -->> search for occurrence of "name" in hash
func (*EvalType) Pres2 ¶
------------------------------------------------------------------------------------------------------------------------------------------------------- Unary !
func (*EvalType) Pres3 ¶
------------------------------------------------------------------------------------------------------------------------------------------------------- Unary +, -
func (*EvalType) Pres4 ¶
------------------------------------------------------------------------------------------------------------------------------------------------------- Parse multiplication and division, *, /, %
func (*EvalType) Pres5 ¶
------------------------------------------------------------------------------------------------------------------------------------------------------- Parse addition and subtraction, -, + (binary)
func (*EvalType) Pres5a ¶
------------------------------------------------------------------------------------------------------------------------------------------------------- Parse addition and subtraction, <<, >> (binary)
func (*EvalType) Pres6 ¶
------------------------------------------------------------------------------------------------------------------------------------------------------- Parse Compare OPS, <, <=, >, >=
func (*EvalType) Pres7 ¶
------------------------------------------------------------------------------------------------------------------------------------------------------- !=, ==, <>
func (*EvalType) Pres8 ¶
------------------------------------------------------------------------------------------------------------------------------------------------------- &
func (*EvalType) Pres9 ¶
------------------------------------------------------------------------------------------------------------------------------------------------------- | -- Change to "bor" token/ID
func (*EvalType) PresA ¶
------------------------------------------------------------------------------------------------------------------------------------------------------- ^
func (*EvalType) PresB ¶
------------------------------------------------------------------------------------------------------------------------------------------------------- &&
func (*EvalType) PresC ¶
------------------------------------------------------------------------------------------------------------------------------------------------------- ||
func (*EvalType) PresD ¶
------------------------------------------------------------------------------------------------------------------------------------------------------- Not Used Uet
func (*EvalType) PresE ¶
------------------------------------------------------------------------------------------------------------------------------------------------------- = (assignment), += etc. :=?? Right To Left - how, Recursion?? array and append?? xyzzy R->L not implemented - just one assignemtn at the moment
func (*EvalType) PresF ¶
------------------------------------------------------------------------------------------------------------------------------------------------------- Computational IF ?:
func (*EvalType) PresG ¶
-------------------------------------------------------------------------------------------------------------------------------------------------------
expr | function-name ( values, ... ) | function-name ( values, ... )
x | Fx | Fy ( w, v ) | Fy ( m, n )
a, b := Fx ( x ) c, err := Fy ( a, b, w, v ) d := Fy ( c, m, n )
-------------------------------------------------------------------------------------------------------------------------------------------------------
func (*EvalType) PresTop ¶
-------------------------------------------------------------------------------------------------------------------------------------------------------
func (*EvalType) SetErrorInfo ¶
-------------------------------------------------------------------------------------------------------------------------------------------------------