amath  1.8.5
Simple command line calculator
StatementNode Class Referenceabstract

Base class for all statements in a syntax tree. More...

#include <node.h>

Inheritance diagram for StatementNode:
Collaboration diagram for StatementNode:

Public Member Functions

 StatementNode ()
 
 StatementNode (const char *text)
 
virtual ~StatementNode ()
 
NodeType GetNodeType ()
 
virtual SyntaxNodeGetNext ()
 
virtual char * GetTextCode ()
 
virtual char * Execute ()=0
 
void Attach (SyntaxNode *node)
 
void Detach (SyntaxNode *node)
 
void Replace (SyntaxNode *n, SyntaxNode *x)
 
- Public Member Functions inherited from SyntaxNode
 SyntaxNode ()
 
virtual ~SyntaxNode ()
 
void SetFirstNode ()
 
bool GetFirstNode () const
 
SyntaxNodeGetParent () const
 
void SetParent (SyntaxNode *node)
 
virtual ReductionType GetReductionType ()
 
virtual void ResetIterator ()
 

Protected Attributes

char * statementText
 
- Protected Attributes inherited from SyntaxNode
CharBufferoutput
 
SyntaxNodeparent
 
SyntaxNodeiterator
 
bool leftBottom
 

Detailed Description

Base class for all statements in a syntax tree.

Definition at line 40 of file node.h.

Constructor & Destructor Documentation

◆ StatementNode() [1/2]

StatementNode::StatementNode ( )

Definition at line 34 of file node.cpp.

References AllocAndCopy(), statementText, and SyntaxNode::SyntaxNode().

Referenced by AboutStatement::AboutStatement(), ClearStatement::ClearStatement(), DeleteStatement::DeleteStatement(), DigitsStatement::DigitsStatement(), DrawStatement::DrawStatement(), EmptyStatement::EmptyStatement(), EvalStatement::EvalStatement(), ExecuteStatement::ExecuteStatement(), ExitStatement::ExitStatement(), FunctionDefinitionNode::FunctionDefinitionNode(), HelpStatement::HelpStatement(), InputStatement::InputStatement(), LicenseStatement::LicenseStatement(), ListFunctionsStatement::ListFunctionsStatement(), ListStatement::ListStatement(), ListVariablesStatement::ListVariablesStatement(), LoadStatement::LoadStatement(), MemoryStatement::MemoryStatement(), OutputStatement::OutputStatement(), PlotStatement::PlotStatement(), PrefsStatement::PrefsStatement(), PromptStatement::PromptStatement(), SaveStatement::SaveStatement(), ShowStatement::ShowStatement(), SilentStatement::SilentStatement(), and VersionStatement::VersionStatement().

34  :
35  SyntaxNode()
36 {
38 }
#define EMPTYSTRING
Definition: amath.h:213
char * statementText
Definition: node.h:55
SyntaxNode()
Definition: nodes.cpp:42
unsigned int AllocAndCopy(char **destination, const char *source)
Allocate memory and copy a string into the array.
Definition: alloccpy.c:40
Here is the call graph for this function:
Here is the caller graph for this function:

◆ StatementNode() [2/2]

StatementNode::StatementNode ( const char *  text)

Definition at line 40 of file node.cpp.

References AllocAndCopy(), statementText, and SyntaxNode::SyntaxNode().

40  :
41  SyntaxNode()
42 {
44 }
char * statementText
Definition: node.h:55
SyntaxNode()
Definition: nodes.cpp:42
unsigned int AllocAndCopy(char **destination, const char *source)
Allocate memory and copy a string into the array.
Definition: alloccpy.c:40
Here is the call graph for this function:

◆ ~StatementNode()

StatementNode::~StatementNode ( )
virtual

Definition at line 46 of file node.cpp.

References statementText.

47 {
48  delete statementText;
49 }
char * statementText
Definition: node.h:55

Member Function Documentation

◆ Attach()

void StatementNode::Attach ( SyntaxNode node)
virtual

Implements SyntaxNode.

Reimplemented in SilentStatement, and EvalStatement.

Definition at line 66 of file node.cpp.

67 {
68 }

◆ Detach()

void StatementNode::Detach ( SyntaxNode node)
virtual

Implements SyntaxNode.

Reimplemented in SilentStatement, and EvalStatement.

Definition at line 70 of file node.cpp.

71 {
72 }

◆ Execute()

◆ GetNext()

SyntaxNode * StatementNode::GetNext ( )
virtual

Implements SyntaxNode.

Reimplemented in SilentStatement, and EvalStatement.

Definition at line 61 of file node.cpp.

62 {
63  return nullptr;
64 }

◆ GetNodeType()

NodeType StatementNode::GetNodeType ( )
virtual

Implements SyntaxNode.

Definition at line 51 of file node.cpp.

References statement.

52 {
53  return statement;
54 }

◆ GetTextCode()

char * StatementNode::GetTextCode ( )
virtual

Implements SyntaxNode.

Definition at line 56 of file node.cpp.

References statementText.

57 {
58  return statementText;
59 }
char * statementText
Definition: node.h:55

◆ Replace()

void StatementNode::Replace ( SyntaxNode n,
SyntaxNode x 
)
virtual

Implements SyntaxNode.

Reimplemented in SilentStatement, and EvalStatement.

Definition at line 74 of file node.cpp.

75 {
76 }

Member Data Documentation

◆ statementText


The documentation for this class was generated from the following files: