stx::ParseNode Class Reference

ParseNode is the abstract node interface of different parse nodes. More...

#include <ExpressionParser.h>

Inheritance diagram for stx::ParseNode:

stx::Grammar::PNBinaryArithmExpr stx::Grammar::PNBinaryComparisonExpr stx::Grammar::PNBinaryLogicExpr stx::Grammar::PNCastExpr stx::Grammar::PNConstant stx::Grammar::PNFunction stx::Grammar::PNUnaryArithmExpr stx::Grammar::PNVariable List of all members.

Public Member Functions

virtual ~ParseNode ()
 Virtual destructor so derived classes can deallocate their children nodes.
virtual AnyScalar evaluate (const class SymbolTable &st=BasicSymbolTable()) const=0
 Function to recursively evaluate the contained parse tree and retrieve the calculated scalar value based on the given symbol table.
virtual bool evaluate_const (AnyScalar *dest) const=0
 (Internal) Function to check if the subtree evaluates to a constant expression.
virtual std::string toString () const=0
 Return the parsed expression as a string, which can be parsed again.

Protected Member Functions

 ParseNode ()
 Usual construction.
 ParseNode (const ParseNode &pn)
 Disable copy construction.
ParseNodeoperator= (const ParseNode &pn)
 And disable assignment.

Detailed Description

ParseNode is the abstract node interface of different parse nodes.

From these parse nodes the the ExpressionParser constructs a tree which can be evaluated using different SymbolTable settings.

Definition at line 267 of file ExpressionParser.h.


Constructor & Destructor Documentation

virtual stx::ParseNode::~ParseNode (  )  [inline, virtual]

Virtual destructor so derived classes can deallocate their children nodes.

Definition at line 283 of file ExpressionParser.h.


Member Function Documentation

virtual AnyScalar stx::ParseNode::evaluate ( const class SymbolTable st = BasicSymbolTable()  )  const [pure virtual]

Function to recursively evaluate the contained parse tree and retrieve the calculated scalar value based on the given symbol table.

Implemented in stx::Grammar::PNConstant, stx::Grammar::PNVariable, stx::Grammar::PNFunction, stx::Grammar::PNUnaryArithmExpr, stx::Grammar::PNBinaryArithmExpr, stx::Grammar::PNCastExpr, stx::Grammar::PNBinaryComparisonExpr, and stx::Grammar::PNBinaryLogicExpr.

Referenced by stx::Grammar::PNBinaryLogicExpr::evaluate(), stx::Grammar::PNBinaryComparisonExpr::evaluate(), stx::Grammar::PNCastExpr::evaluate(), stx::Grammar::PNBinaryArithmExpr::evaluate(), and stx::Grammar::PNUnaryArithmExpr::evaluate().

virtual bool stx::ParseNode::evaluate_const ( AnyScalar dest  )  const [pure virtual]

(Internal) Function to check if the subtree evaluates to a constant expression.

If dest == NULL then do a static check whether the node is always a constant (ignoring subnodes), if dest != NULL try to calculate the constant value and type recursively, thus the return value can be true for a non-constant tree node.

Implemented in stx::Grammar::PNConstant, stx::Grammar::PNVariable, stx::Grammar::PNFunction, stx::Grammar::PNUnaryArithmExpr, stx::Grammar::PNBinaryArithmExpr, stx::Grammar::PNCastExpr, stx::Grammar::PNBinaryComparisonExpr, and stx::Grammar::PNBinaryLogicExpr.

Referenced by stx::Grammar::build_expr(), stx::Grammar::PNBinaryLogicExpr::evaluate_const(), stx::Grammar::PNBinaryComparisonExpr::evaluate_const(), stx::Grammar::PNCastExpr::evaluate_const(), stx::Grammar::PNBinaryArithmExpr::evaluate_const(), and stx::Grammar::PNUnaryArithmExpr::evaluate_const().


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