stx::Grammar::PNBinaryArithmExpr Class Reference

Parse tree node representing a binary operators: +, -, * and / for numeric values. More...

Inheritance diagram for stx::Grammar::PNBinaryArithmExpr:

stx::ParseNode List of all members.

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 ParseNodeleft
 Pointers to the left of the two child parse trees.
const ParseNoderight
 Pointers to the right of the two child parse trees.
char op
 Arithmetic operation to perform: left op right.

Detailed Description

Parse tree node representing a binary operators: +, -, * and / for numeric values.

This node has two children.

Definition at line 543 of file ExpressionParser.cc.


Member Function Documentation

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.


Member Data Documentation

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().


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