Documentation
¶
Index ¶
- Constants
- Variables
- func AssertListParam(val interface{}, astNode *parser.ASTNode, rrp *RumbleRuntimeProvider) ([]interface{}, error)
- func AssertMapParam(val interface{}, astNode *parser.ASTNode, rrp *RumbleRuntimeProvider) (map[interface{}]interface{}, error)
- func AssertNumParam(val interface{}, astNode *parser.ASTNode, rrp *RumbleRuntimeProvider) (float64, error)
- func GetFuncParams(astNode *parser.ASTNode, vs parser.VarsScope, is map[string]interface{}) ([]interface{}, error)
- func NewRootVariableScope(name string) parser.VarsScope
- func NewSinkVariableScope(name string, parent parser.VarsScope) parser.VarsScope
- func RegisterRumbleFunc(name string, valFunc RumbleFuncValidate, actFunc RumbleFunc) error
- func RumbleFuncs() []string
- func ScopeName(node *parser.ASTNode) string
- type RumbleFunc
- type RumbleFuncValidate
- type RumbleRuntimeProvider
- type RuntimeError
Constants ¶
const DefaultRootScopeName = "global"
DefaultRootScopeName is the default name of a root variable scope
Variables ¶
var ( ErrIsIterator = errors.New("Function is an iterator") ErrEndOfIteration = errors.New("End of iteration was reached") ErrContinueIteration = errors.New("End of iteration step - Continue iteration") )
Runtime related error types - these errors are specific errors of Rumble where the code might check for object equality
Functions ¶
func AssertListParam ¶
func AssertListParam(val interface{}, astNode *parser.ASTNode, rrp *RumbleRuntimeProvider) ([]interface{}, error)
AssertListParam converts a general interface{} parameter into a list.
func AssertMapParam ¶
func AssertMapParam(val interface{}, astNode *parser.ASTNode, rrp *RumbleRuntimeProvider) (map[interface{}]interface{}, error)
AssertMapParam converts a general interface{} parameter into a map.
func AssertNumParam ¶
func AssertNumParam(val interface{}, astNode *parser.ASTNode, rrp *RumbleRuntimeProvider) (float64, error)
AssertNumParam converts a general interface{} parameter into a number.
func GetFuncParams ¶
func GetFuncParams(astNode *parser.ASTNode, vs parser.VarsScope, is map[string]interface{}) ([]interface{}, error)
GetFuncParams interprets and returns the value of all parameters of a function.
func NewRootVariableScope ¶
NewRootVariableScope creates a new root variable scope.
func NewSinkVariableScope ¶
NewSinkVariableScope creates a new variable scope for a sink which knows its child scopes.
func RegisterRumbleFunc ¶
func RegisterRumbleFunc(name string, valFunc RumbleFuncValidate, actFunc RumbleFunc) error
RegisterRumbleFunc registers a new Rumble function.
Types ¶
type RumbleFunc ¶
type RumbleFunc func(string, *parser.ASTNode, parser.VarsScope, map[string]interface{}, *RumbleRuntimeProvider) (interface{}, error)
RumbleFunc represents a rumble function.
type RumbleFuncValidate ¶
type RumbleFuncValidate func(*parser.ASTNode, *RumbleRuntimeProvider) error
RumbleFuncValidate is called to validate the number of arguments, check the environment and to execute any initialisation code which might be necessary for the function.
type RumbleRuntimeProvider ¶
type RumbleRuntimeProvider struct { Name string // Name to identify the input // contains filtered or unexported fields }
RumbleRuntimeProvider defines the main interpreter datastructure and all functions for general evaluation.
func NewRumbleRuntimeProvider ¶
func NewRumbleRuntimeProvider(name string) *RumbleRuntimeProvider
NewRumbleRuntimeProvider returns a new instance of a Rumble runtime provider.
func (*RumbleRuntimeProvider) NewRuntimeError ¶
NewRuntimeError creates a new RuntimeError object.
type RuntimeError ¶
type RuntimeError struct { Source string // Name of the source which was given to the parser Type error // Error type (to be used for equal checks) Detail string // Details of this error Node *parser.ASTNode // AST Node where the error occurred Line int // Line of the error Pos int // Position of the error }
RuntimeError is a runtime related error
func (*RuntimeError) Error ¶
func (re *RuntimeError) Error() string
Error returns a human-readable string representation of this error.