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