26 #include "ExprConfig.h"
32 class ExecutionEngine;
64 virtual void eval(
double* result) = 0;
65 virtual void eval(
const char** resultStr) = 0;
101 Error(
const std::string& errorIn,
const int startPosIn,
const int endPosIn)
119 void setExpr(
const std::string& e);
155 bool usesVar(
const std::string& name)
const;
159 bool usesFunc(
const std::string& name)
const;
185 void evalMultiple(
VarBlock* varBlock,
int outputVarBlockOffset,
size_t rangeStart,
size_t rangeEnd)
const;
205 void addError(
const std::string& error,
const int startPos,
const int endPos)
const {
294 mutable std::set<std::string>
_vars;
int endPos
Error end offset in expression string.
void prepIfNeeded() const
bool usesVar(const std::string &name) const
A thread local evaluation context. Just allocate and fill in with data.
EvaluationStrategy
Types of evaluation strategies that are available.
void setContext(const Context &context)
virtual ExprVarRef * resolveVar(const std::string &name) const
std::vector< std::string > _threadUnsafeFunctionCalls
void addError(const std::string &error, const int startPos, const int endPos) const
int startPos
Error start offset in expression string.
void setDesiredReturnType(const ExprType &type)
bool usesFunc(const std::string &name) const
Function Definition, used in parse tree and func table.
void evalMultiple(VarBlock *varBlock, int outputVarBlockOffset, size_t rangeStart, size_t rangeEnd) const
Evaluate multiple blocks.
bool isThreadSafe() const
std::string error
Text of error.
void setThreadUnsafe(const std::string &functionName) const
Represents a parse or type checking error in an expression.
void debugPrintLLVM() const
virtual void setType(const ExprType &type)
sets (current) type to given type
const std::string & parseError() const
EvaluationStrategy _evaluationStrategy
const std::vector< std::pair< int, int > > & getComments() const
double length(const Vec3d &v)
const std::string & getExpr() const
Get the string that this expression is currently set to evaluate.
std::set< std::string > _funcs
const Context & context() const
ExprType _desiredReturnType
static bool debugging
Whether to debug expressions.
A class that lets you register for the variables used by one or more expressions. ...
void debugPrintParseTree() const
static Context & global()
The global default context of the seexpr.
void addVar(const char *n) const
add local variable (this is for internal use)
Expression & operator=(const Expression &e)
const VarBlockCreator * _varBlockCreator
std::vector< Error > _errors
void debugPrintInterpreter() const
const std::vector< Error > & getErrors() const
const VarBlockCreator * varBlockCreator() const
void addFunc(const char *n) const
add function evaluation (this is for internal use)
const double * evalFP(VarBlock *varBlock=nullptr) const
< b ></b >< br >< b ></b ></td >< td > vector constructor< br > vector component access n must be
const char * evalStr(VarBlock *varBlock=nullptr) const
std::set< std::string > _vars
void setVarBlockCreator(const VarBlockCreator *varBlockCreator)
void setExpr(const std::string &e)
const std::vector< std::string > & getThreadUnsafeFunctionCalls() const
ExprVarEnvBuilder _envBuilder
std::vector< std::pair< int, int > > _comments
virtual ExprFunc * resolveFunc(const std::string &name) const
virtual ExprType type() const
returns (current) type
virtual void eval(double *result)=0
returns this variable's value by setting result
void parseIfNeeded() const
const ExprType & returnType() const
Interpreter * _interpreter
ExprVarRef(const ExprType &type)
static EvaluationStrategy defaultEvaluationStrategy
What evaluation strategy to use by default.
void addComment(int pos, int length)
LLVMEvaluator * _llvmEvaluator
abstract class for implementing variable references
Expression(EvaluationStrategy be=Expression::defaultEvaluationStrategy)
Error(const std::string &errorIn, const int startPosIn, const int endPosIn)
Variable scope builder is used by the type checking and code gen to track visiblity of variables and ...