Inheritance diagram for stx::Grammar::PNBinaryArithmExpr:
Public Member Functions | |
PNBinaryArithmExpr (const ParseNode *_left, const ParseNode *_right, char _op) | |
Constructor from the parser: both operand subnodes and the operator id. | |
virtual | ~PNBinaryArithmExpr () |
Recursively delete parse tree. | |
virtual AnyScalar | evaluate (const class SymbolTable &st) const |
Applies the operator to the two recursive calculated values. | |
virtual bool | evaluate_const (AnyScalar *dest) const |
Returns false because this node isn't always constant. | |
virtual std::string | toString () const |
String representing (operandA op operandB). | |
Private Attributes | |
const ParseNode * | left |
Pointers to the left of the two child parse trees. | |
const ParseNode * | right |
Pointers to the right of the two child parse trees. | |
char | op |
Arithmetic operation to perform: left op right. |
This node has two children.
Definition at line 543 of file ExpressionParser.cc.
virtual AnyScalar stx::Grammar::PNBinaryArithmExpr::evaluate | ( | const class SymbolTable & | st | ) | const [inline, virtual] |
Applies the operator to the two recursive calculated values.
The actual switching between types is handled by AnyScalar's operators.
Implements stx::ParseNode.
Definition at line 574 of file ExpressionParser.cc.
References stx::ParseNode::evaluate(), left, op, and right.
virtual bool stx::Grammar::PNBinaryArithmExpr::evaluate_const | ( | AnyScalar * | dest | ) | const [inline, virtual] |
Returns false because this node isn't always constant.
Tries to calculate a constant subtree's value.
Implements stx::ParseNode.
Definition at line 598 of file ExpressionParser.cc.
References stx::AnyScalar::ATTRTYPE_INVALID, stx::ParseNode::evaluate_const(), left, op, and right.
char stx::Grammar::PNBinaryArithmExpr::op [private] |
Arithmetic operation to perform: left op right.
Further optimization would be to create an extra class for each op
Definition at line 554 of file ExpressionParser.cc.
Referenced by evaluate(), evaluate_const(), and toString().