Documentation ¶
Index ¶
- Constants
- Variables
- func CopyVariableState(variables, ctx *map[string]Node)
- func DumpNode(node Node) string
- func EnsureSingleType(val *Node, nth int, nt NodeType, who string)
- func EnsureType(val *[]Node, nth int, nt NodeType, who string)
- func EnsureTypes(val *[]Node, nth int, nt []NodeType, who string)
- func Hash(node Node) (string, error)
- func LoadObject(key int) (interface{}, bool)
- func ReplaceEnd(s, old, new string, n int) string
- func Rev(s string) string
- func StoreObject(val interface{}) int
- type FnLiteral
- type ListNode
- type MacroDef
- type MacroParameter
- type MapNode
- type Node
- func AtomNode(val string) Node
- func BoolNode(val bool) Node
- func DoVariableCall(node parser.Node, val Node, variables *map[string]Node) Node
- func FloatNode(val float64) Node
- func IntNode(val int) Node
- func NodeList(val []Node) Node
- func NodeMap(val map[string]Node) Node
- func OptionNode(val Node, err bool) Node
- func Run(nodes []parser.Node, variables *map[string]Node) (returnVal Node)
- func StringNode(val string) Node
- type NodeType
- type StructDef
Constants ¶
const ( // BUILTIN_MATH the built in math system function BUILTIN_MATH string = "--builtin-do-math!" // BUILTIN_COMPARE comparison functions BUILTIN_COMPARE string = "--builtin-do-compare!" // BUILTIN_COMPARE_ARITHMETIC arithmetic comparison functions BUILTIN_COMPARE_ARITHMETIC string = "--builtin-do-compare-arithmetic!" // BUILTIN_BOOL boolean algebra functions BUILTIN_BOOL string = "--builtin-do-bool!" // BUILTIN_BITWISE bitwise functions BUILTIN_BITWISE string = "--builtin-do-bitwise!" )
const ( // USE include function USE string = "use" // TYPE type function TYPE string = "type" // MAP_ACCESS map access function MAP_ACCESS string = "[]" // FREE object store free function FREE string = "free" // EXEC_FILE current file EXEC_FILE string = "EXEC-FILE" // SELF current process id SELF string = "self" )
noinspection GoSnakeCaseUsage
Variables ¶
var BasePath string
BasePath base path from which to import stdlib
var LibBasePath string
LibBasePath path from which to import libraries
var Nothing = Node{ Value: 0, NodeType: 0, }
Nothing represents an empty return (int 0)
Functions ¶
func CopyVariableState ¶
CopyVariableState copy the variable state to another map
func EnsureSingleType ¶
EnsureSingleType ensures the variable type of the parameter for a native function is valid
func EnsureType ¶
EnsureType ensures the variable type of the parameter for a native function is valid
func EnsureTypes ¶
EnsureTypes ensures the variable type of the parameter for a native function is valid
func LoadObject ¶
LoadObject load an object from the object store by its ptr
func ReplaceEnd ¶
ReplaceEnd replaces a substring in a string starting from the end
func StoreObject ¶
func StoreObject(val interface{}) int
StoreObject store an object and return a pseudo ptr to it
Types ¶
type MacroDef ¶
type MacroDef struct { Parameters []MacroParameter Body []parser.Node }
MacroDef definition of a macro function
type MacroParameter ¶
MacroParameter parameter of a macro function
type Node ¶
type Node struct { Value interface{} NodeType NodeType }
Node a variable node
func DoVariableCall ¶
DoVariableCall calls a fn variable
func StringNode ¶
StringNode returns an interpreter.Node from a string
type NodeType ¶
type NodeType uint8
NodeType a variable type
const ( // NODETYPE_INT int variable type NODETYPE_INT NodeType = 0 // NODETYPE_FLOAT float variable type NODETYPE_FLOAT NodeType = 1 // NODETYPE_STRING string variable type NODETYPE_STRING NodeType = 2 // NODETYPE_BOOL bool variable type NODETYPE_BOOL NodeType = 3 // NODETYPE_ATOM atom variable type NODETYPE_ATOM NodeType = 4 // NODETYPE_FN function literal NODETYPE_FN NodeType = 5 // NODETYPE_LIST list type NODETYPE_LIST NodeType = 6 // NODETYPE_MAP map type NODETYPE_MAP NodeType = 7 // NODETYPE_STRUCT struct type NODETYPE_STRUCT NodeType = 8 // NODETYPE_MACRO macro type NODETYPE_MACRO NodeType = 9 )