amath  1.8.5
Simple command line calculator
FunctionDefinitionNode Class Reference

A syntax node able to define a user defined function. More...

#include <funcdef.h>

Inheritance diagram for FunctionDefinitionNode:
Collaboration diagram for FunctionDefinitionNode:

Public Member Functions

 FunctionDefinitionNode ()
 
char * GetText () const
 
char * Execute ()
 
- Public Member Functions inherited from StatementNode
 StatementNode ()
 
 StatementNode (const char *text)
 
virtual ~StatementNode ()
 
NodeType GetNodeType ()
 
virtual SyntaxNodeGetNext ()
 
virtual char * GetTextCode ()
 
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 ()
 

Additional Inherited Members

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

Detailed Description

A syntax node able to define a user defined function.

Definition at line 39 of file funcdef.h.

Constructor & Destructor Documentation

◆ FunctionDefinitionNode()

FunctionDefinitionNode::FunctionDefinitionNode ( )

Definition at line 32 of file funcdef.cpp.

References CharBuffer::Empty(), CharBuffer::EnsureMinimumSize(), SyntaxNode::output, and StatementNode::StatementNode().

Referenced by Parser::ParseFunctionDef().

32  :
34 {
36  output->Empty();
37 }
void Empty()
Definition: charbuf.cpp:218
void EnsureMinimumSize()
Definition: charbuf.cpp:100
StatementNode()
Definition: node.cpp:34
CharBuffer * output
Definition: nodes.h:85
Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ Execute()

char * FunctionDefinitionNode::Execute ( )
virtual

Implements StatementNode.

Definition at line 39 of file funcdef.cpp.

References CharBuffer::GetString(), and SyntaxNode::output.

40 {
41  // TODO: Move function definition logic from parser to here.
42  return output->GetString();
43 }
char * GetString() const
Definition: charbuf.cpp:306
CharBuffer * output
Definition: nodes.h:85
Here is the call graph for this function:

◆ GetText()

char * FunctionDefinitionNode::GetText ( ) const

Definition at line 45 of file funcdef.cpp.

References CharBuffer::GetString(), and SyntaxNode::output.

46 {
47  return output->GetString();
48 }
char * GetString() const
Definition: charbuf.cpp:306
CharBuffer * output
Definition: nodes.h:85
Here is the call graph for this function:

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