stx::Grammar::PNBinaryLogicExpr Class Reference

Parse tree node representing a binary logic operator: and, or, &&, ||. More...

Inheritance diagram for stx::Grammar::PNBinaryLogicExpr:

stx::ParseNode List of all members.

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).
ParseNodedetach_left ()
 Detach left node.
ParseNodedetach_right ()
 Detach right node.

Private Types

enum  { OP_AND, OP_OR }
 Comparison operation to perform: left op right. More...

Private Attributes

ParseNodeleft
 Pointers to the left of the two child parse trees.
ParseNoderight
 Pointers to the right of the two child parse trees.
enum stx::Grammar::PNBinaryLogicExpr:: { ... }  op
 Comparison operation to perform: left op right.

Detailed Description

Parse tree node representing a binary logic operator: and, or, &&, ||.

This node has two children.

Definition at line 823 of file ExpressionParser.cc.


Member Enumeration Documentation

anonymous enum [private]

Comparison operation to perform: left op right.

Enumerator:
OP_AND 
OP_OR 

Definition at line 833 of file ExpressionParser.cc.


Member Function Documentation

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.


The documentation for this class was generated from the following file:
Generated on Tue Jul 17 16:51:58 2007 for STX Expression Parser by  doxygen 1.5.2