Inheritance diagram for stx::Grammar::PNBinaryLogicExpr:
Public Member Functions | |
PNBinaryLogicExpr (ParseNode *_left, ParseNode *_right, std::string _op) | |
Constructor from the parser: both operand subnodes and the operator id. | |
virtual | ~PNBinaryLogicExpr () |
Recursively delete parse tree. | |
bool | do_operator (bool left, bool right) const |
Calculate the operator. | |
std::string | get_opstr () const |
Return the string of this operator. | |
virtual AnyScalar | evaluate (const class SymbolTable &st) const |
Applies the operator to the two recursive calculated values. | |
virtual bool | evaluate_const (AnyScalar *dest) const |
Applies the operator to the two recursive calculated const values. | |
virtual std::string | toString () const |
String (operandA op operandB). | |
ParseNode * | detach_left () |
Detach left node. | |
ParseNode * | detach_right () |
Detach right node. | |
Private Types | |
enum | { OP_AND, OP_OR } |
Comparison operation to perform: left op right. More... | |
Private Attributes | |
ParseNode * | left |
Pointers to the left of the two child parse trees. | |
ParseNode * | right |
Pointers to the right of the two child parse trees. | |
enum stx::Grammar::PNBinaryLogicExpr:: { ... } | op |
Comparison operation to perform: left op right. |
This node has two children.
Definition at line 823 of file ExpressionParser.cc.
anonymous enum [private] |
virtual AnyScalar stx::Grammar::PNBinaryLogicExpr::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 877 of file ExpressionParser.cc.
References stx::AnyScalar::ATTRTYPE_BOOL, do_operator(), stx::ParseNode::evaluate(), get_opstr(), stx::AnyScalar::getInteger(), stx::AnyScalar::getType(), left, and right.
virtual bool stx::Grammar::PNBinaryLogicExpr::evaluate_const | ( | AnyScalar * | dest | ) | const [inline, virtual] |
Applies the operator to the two recursive calculated const values.
Determining if this node is constant is somewhat more tricky than with the other parse nodes: AND with a false operand is always false. OR with a true operand is always true.
Implements stx::ParseNode.
Definition at line 898 of file ExpressionParser.cc.
References stx::AnyScalar::ATTRTYPE_BOOL, stx::AnyScalar::ATTRTYPE_INVALID, do_operator(), stx::ParseNode::evaluate_const(), get_opstr(), stx::AnyScalar::getInteger(), stx::AnyScalar::getType(), left, op, OP_AND, OP_OR, and right.