Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrorVariableExists "Variable already exists" ErrorVariableExists = errors.New("Variable already exists") // ErrorVariableDoesNotExist "Variable doesn't exist" ErrorVariableDoesNotExist = errors.New("Variable doesn't exist") // ErrorFunctionDoesNotExist "Function doesn't exist" ErrorFunctionDoesNotExist = errors.New("Function doesn't exist") // ErrorMaxDepth "Maximum depth is reached" ErrorMaxDepth = errors.New("Maximum depth is reached") // ErrorUserFunctionWrongCmd "Instructions in user functions should have valid "cmd" field" ErrorUserFunctionWrongCmd = errors.New("Instructions in user functions should have valid \"cmd\" field") // ErrorCannotConvertToFloat "Operands should be numeric" ErrorCannotConvertToFloat = errors.New("Operands should be numeric") )
Functions ¶
This section is empty.
Types ¶
type FuncScope ¶
type FuncScope struct {
// contains filtered or unexported fields
}
FuncScope scope of functions
func NewFuncScope ¶
NewFuncScope creates new scrop of functions
func NewInternalFuncScope ¶
NewInternalFuncScope creates FuncScope and fills it with internal functions
type Function ¶
type Function interface { // Execute executes logic provided by Function object Execute(globalVars, localVars *VarScope, internalFuncs, globalFuncs *FuncScope, depth int) error }
Function - basic function interface which describes Execute method
type Implementation ¶
type Implementation struct {
// contains filtered or unexported fields
}
Implementation implements Interpreter interface
type Interpreter ¶
type Interpreter interface {
Run() error
}
Interpreter describes short interpreter interface
func NewInterpreter ¶
func NewInterpreter(globalVars *VarScope, globalFuncs *FuncScope, output io.Writer, maxDepth int) Interpreter
NewInterpreter creates new instance of Implementation object
type UserFunction ¶
type UserFunction struct {
// contains filtered or unexported fields
}
UserFunction implements user-defined function which satisfy Function interface
func NewUserFunction ¶
func NewUserFunction(body []map[string]string) *UserFunction
NewUserFunction creates user-defined function object from instruction list
type VarScope ¶
VarScope contains scope of execution variables
Click to show internal directories.
Click to hide internal directories.