12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- /*
- * Public Domain Software
- *
- * I (Matthias Ladkau) am the author of the source code in this file.
- * I have placed the source code in this file in the public domain.
- *
- * For further information see: http://creativecommons.org/publicdomain/zero/1.0/
- */
- package parser
- /*
- RuntimeProvider provides runtime components for a parse tree.
- */
- type RuntimeProvider interface {
- /*
- Runtime returns a runtime component for a given ASTNode.
- */
- Runtime(node *ASTNode) Runtime
- }
- /*
- Runtime provides the runtime for an ASTNode.
- */
- type Runtime interface {
- /*
- Validate this runtime component and all its child components.
- */
- Validate() error
- /*
- Eval evaluate this runtime component. It gets passed the current variable
- scope and the instance state.
- The instance state is created per execution instance and can be used
- for generator functions to store their current state.
- */
- Eval(VarsScope, map[string]interface{}) (interface{}, error)
- }
- /*
- VarsScope is used to store variable data and keep track of scoping.
- */
- type VarsScope interface {
- /*
- NewChild creates a new child variable scope.
- */
- NewChild(name string) VarsScope
- /*
- SetValue sets a new value for a variable.
- */
- SetValue(varName string, varValue interface{}) error
- /*
- GetValue gets the current value of a variable.
- */
- GetValue(varName string) (interface{}, bool, error)
- /*
- String returns a string representation of this variable scope.
- */
- String() string
- }
|