amath
1.8.5
Simple command line calculator
|
Base class for all nodes in a syntax tree. More...
#include <nodes.h>
Public Member Functions | |
SyntaxNode () | |
virtual | ~SyntaxNode () |
void | SetFirstNode () |
bool | GetFirstNode () const |
SyntaxNode * | GetParent () const |
void | SetParent (SyntaxNode *node) |
virtual NodeType | GetNodeType ()=0 |
virtual ReductionType | GetReductionType () |
virtual void | ResetIterator () |
virtual SyntaxNode * | GetNext ()=0 |
virtual char * | GetTextCode ()=0 |
virtual char * | Execute ()=0 |
virtual void | Attach (SyntaxNode *node)=0 |
virtual void | Detach (SyntaxNode *node)=0 |
virtual void | Replace (SyntaxNode *n, SyntaxNode *x)=0 |
Protected Attributes | |
CharBuffer * | output |
SyntaxNode * | parent |
SyntaxNode * | iterator |
bool | leftBottom |
Base class for all nodes in a syntax tree.
More info is available at Wikipedia: https://wikipedia.org/wiki/Abstract_syntax_tree
SyntaxNode::SyntaxNode | ( | ) |
Definition at line 42 of file nodes.cpp.
References CharBuffer::CharBuffer(), iterator, leftBottom, output, and parent.
Referenced by ErrorNode::ErrorNode(), ExpressionNode::ExpressionNode(), StatementBlockNode::StatementBlockNode(), and StatementNode::StatementNode().
|
pure virtual |
Implemented in StatementBlockNode, NumericValueNode, ErrorNode, VariableNode, NumericOperator, FactorialNode, AbsoluteNode, FunctionNode, UnaryNode, StatementNode, SilentStatement, EvalStatement, and UserFunctionNode.
Referenced by Optimizer::BalanceTree().
|
pure virtual |
Implemented in StatementBlockNode, NumericValueNode, ErrorNode, VariableNode, NumericOperator, FactorialNode, AbsoluteNode, FunctionNode, UnaryNode, StatementNode, SilentStatement, EvalStatement, and UserFunctionNode.
Referenced by Optimizer::BalanceTree(), and Optimizer::ReduceUnaryNodes().
|
pure virtual |
Implemented in StatementBlockNode, ErrorNode, ExpressionNode, ListVariablesStatement, StatementNode, SilentStatement, EmptyStatement, DeleteStatement, HelpStatement, DigitsStatement, EvalStatement, InputStatement, OutputStatement, PrefsStatement, PromptStatement, AboutStatement, ClearStatement, ExitStatement, FunctionDefinitionNode, ListFunctionsStatement, LicenseStatement, MemoryStatement, VersionStatement, ListStatement, PlotStatement, DrawStatement, ExecuteStatement, LoadStatement, SaveStatement, and ShowStatement.
Referenced by Evaluator::Evaluate(), LoadStatement::Execute(), ExecuteStatement::Execute(), StatementBlockNode::Execute(), and PreferencesBase::SetPrefs().
bool SyntaxNode::GetFirstNode | ( | ) | const |
Definition at line 60 of file nodes.cpp.
References leftBottom.
|
pure virtual |
Implemented in NumericValueNode, StatementBlockNode, ErrorNode, VariableNode, NumericOperator, FactorialNode, AbsoluteNode, FunctionNode, UnaryNode, SilentStatement, StatementNode, EvalStatement, and UserFunctionNode.
Referenced by Optimizer::BalanceTree(), Optimizer::GetTreeDepth(), Optimizer::ReduceUnaryNodes(), Optimizer::ReduceValueNodes(), Optimizer::TagChildren(), and Optimizer::TagStartNode().
|
pure virtual |
Implemented in StatementBlockNode, ErrorNode, ExpressionNode, and StatementNode.
Referenced by Optimizer::BalanceTree(), and Optimizer::ReduceValueNodes().
SyntaxNode * SyntaxNode::GetParent | ( | ) | const |
Definition at line 70 of file nodes.cpp.
References parent.
Referenced by Optimizer::BalanceTree(), Optimizer::ReduceUnaryNodes(), and Optimizer::ReduceValueNodes().
|
virtual |
Reimplemented in ComplexiNode, PiNode, EulersNumberNode, NumericValueNode, SubtractionNode, AdditionNode, and UnaryNode.
Definition at line 55 of file nodes.cpp.
References nonereduc.
Referenced by Optimizer::ReduceUnaryNodes(), and Optimizer::ReduceValueNodes().
|
pure virtual |
Implemented in StatementBlockNode, ErrorNode, ExpressionNode, and StatementNode.
|
pure virtual |
Implemented in StatementBlockNode, NumericValueNode, ErrorNode, VariableNode, NumericOperator, FactorialNode, AbsoluteNode, FunctionNode, UnaryNode, StatementNode, SilentStatement, EvalStatement, and UserFunctionNode.
Referenced by Optimizer::ReduceUnaryNodes(), and Optimizer::ReduceValueNodes().
|
virtual |
Definition at line 80 of file nodes.cpp.
References iterator.
Referenced by Optimizer::BalanceTree(), Optimizer::GetTreeDepth(), Optimizer::ReduceUnaryNodes(), Optimizer::ReduceValueNodes(), Optimizer::TagChildren(), and Optimizer::TagStartNode().
void SyntaxNode::SetFirstNode | ( | ) |
Definition at line 65 of file nodes.cpp.
References leftBottom.
Referenced by Optimizer::TagStartNode().
void SyntaxNode::SetParent | ( | SyntaxNode * | node | ) |
Definition at line 75 of file nodes.cpp.
References parent.
Referenced by EvalStatement::Attach(), SilentStatement::Attach(), UnaryNode::Attach(), FunctionNode::Attach(), AbsoluteNode::Attach(), FactorialNode::Attach(), NumericOperator::Attach(), and Optimizer::TagChildren().
|
protected |
Definition at line 87 of file nodes.h.
Referenced by UserFunctionNode::GetNext(), EvalStatement::GetNext(), SilentStatement::GetNext(), UnaryNode::GetNext(), FunctionNode::GetNext(), AbsoluteNode::GetNext(), FactorialNode::GetNext(), NumericOperator::GetNext(), NumericOperator::Replace(), ResetIterator(), StatementBlockNode::StatementBlockNode(), and SyntaxNode().
|
protected |
Definition at line 88 of file nodes.h.
Referenced by GetFirstNode(), NumericValueNode::GetPrecedence(), SetFirstNode(), and SyntaxNode().
|
protected |
Definition at line 85 of file nodes.h.
Referenced by ExecuteStatement::Execute(), ShowStatement::Execute(), ListStatement::Execute(), PlotStatement::Execute(), MemoryStatement::Execute(), FunctionDefinitionNode::Execute(), InputStatement::Execute(), OutputStatement::Execute(), EvalStatement::Execute(), DigitsStatement::Execute(), DeleteStatement::Execute(), HelpStatement::Execute(), ErrorNode::Execute(), StatementBlockNode::Execute(), FunctionDefinitionNode::FunctionDefinitionNode(), NumericValueNode::GetNodeText(), FunctionDefinitionNode::GetText(), UnaryNode::GetText(), FunctionNode::GetText(), AbsoluteNode::GetText(), FactorialNode::GetText(), NumericOperator::GetText(), HelpStatement::StatementHelp(), SyntaxNode(), and ~SyntaxNode().
|
protected |
Definition at line 86 of file nodes.h.
Referenced by GetParent(), SetParent(), and SyntaxNode().