18 #ifndef ExprPatterns_h
19 #define ExprPatterns_h
58 if (name.compare(func->name()) == 0)
return func;
66 for (
int i = 0; i <
max; ++i)
83 for (
int i = 1; i < numChildren && curveFunc; i += 3) {
86 else if (!
isScalar(curveFunc->child(i + 1)))
88 else if (!
isScalar(curveFunc->child(i + 2)))
101 for (
int i = 1; i < numChildren && ccurveFunc; i += 3) {
102 if (!
isScalar(ccurveFunc->child(i)))
104 else if (!
isScalar(ccurveFunc->child(i + 1)) && !
isLitVec(ccurveFunc->child(i + 1)))
106 else if (!
isScalar(ccurveFunc->child(i + 2)))
117 if (
isScalar(assign->child(0)))
return assign;
125 if (
isLitVec(assign->child(0)))
return assign;
133 if (
isStrFunc(assign->child(0)))
return assign;
const ExprAssignNode * isVectorAssign(const ExprNode *testee)
const ExprAssignNode * isCcurveAssign(const ExprNode *testee)
const ExprStrNode * isString(const ExprNode *testee)
bool hasCurveNumArgs(const ExprFuncNode *testee)
Node that constructs a vector from three scalars.
const ExprNumNode * isScalar(const ExprNode *testee)
Node that references a variable.
const ExprVecNode * isLitVec(const ExprNode *testee)
Node that stores a string.
const ExprVecNode * isVector(const ExprNode *testee)
const ExprFuncNode * isCcurveFunc(const ExprNode *testee)
const ExprAssignNode * isCurveAssign(const ExprNode *testee)
const ExprAssignNode * isAssign(const ExprNode *testee)
const ExprFuncNode * isFunc(const ExprNode *testee)
double max(double x, double y)
Node that calls a function.
const ExprAssignNode * isScalarAssign(const ExprNode *testee)
const ExprAssignNode * isStrFuncAssign(const ExprNode *testee)
Node that compute a local variable assignment.
int numChildren() const
Number of children.
const ExprFuncNode * isCurveFunc(const ExprNode *testee)
Node that stores a numeric constant.
const ExprVarNode * isVariable(const ExprNode *testee)
const ExprNode * child(size_t i) const
Get 0 indexed child.
const ExprFuncNode * isStrFunc(const ExprNode *testee)
const ExprFuncNode * isNamedFunc(const ExprNode *testee, const std::string &name)