#include <ExpressionParser.h>
Inheritance diagram for stx::ParseNode:
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. | |
ParseNode & | operator= (const ParseNode &pn) |
And disable assignment. |
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.
virtual stx::ParseNode::~ParseNode | ( | ) | [inline, virtual] |
Virtual destructor so derived classes can deallocate their children nodes.
Definition at line 283 of file ExpressionParser.h.
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().