PUMA Library Reference Manual
Puma::PreTreeComposite Class Referenceabstract

#include <Puma/PreTreeComposite.h>

+ Inheritance diagram for Puma::PreTreeComposite:

Description

Base class for all C preprocessor syntax tree composite nodes.

Public Member Functions

virtual ~PreTreeComposite ()
 Destructor. More...
 
virtual void accept (PreVisitor &)=0
 Part of the tree visitor pattern. More...
 
virtual void add_son (PreTree *s)
 Add a son (syntactic child node). More...
 
virtual void replace_son (int n, PreTree *new_s)
 Replace the n-th son. More...
 
virtual PreTreeson (int n) const
 Get the n-th son. More...
 
virtual int sons () const
 Get the number of sons. More...
 
virtual void add_daughter (PreTree *d)
 Add a daughter (semantic child node). More...
 
virtual void replace_daughter (int n, PreTree *new_d)
 Replace the n-th daughter. More...
 
virtual PreTreedaughter (int n) const
 Get the n-th daughter. More...
 
virtual int daughters () const
 Get the number of daughters. More...
 
virtual TokenstartToken () const
 Get the first token of the syntactic construct represented by the sub-tree. More...
 
virtual TokenendToken () const
 Get the last token of the syntactic construct represented by the sub-tree. More...
 
- Public Member Functions inherited from Puma::PreTree
virtual ~PreTree ()
 Destructor. More...
 
virtual bool isLeaf () const
 Check if the node is a leaf, i.e. More...
 

Static Public Attributes

static const int DYNAMIC = -1
 Dynamic number of sons and daughters. More...
 

Protected Member Functions

 PreTreeComposite (int s, int d)
 Constructor. More...
 
- Protected Member Functions inherited from Puma::PreTree
 PreTree ()
 Constructor. More...
 

Constructor & Destructor Documentation

◆ PreTreeComposite()

Puma::PreTreeComposite::PreTreeComposite ( int  s,
int  d 
)
protected

Constructor.

Parameters
sNumber of sons (syntactic child nodes).
dNumber of daughters (semantic child nodes).

◆ ~PreTreeComposite()

virtual Puma::PreTreeComposite::~PreTreeComposite ( )
virtual

Destructor.

Member Function Documentation

◆ accept()

◆ add_daughter()

virtual void Puma::PreTreeComposite::add_daughter ( PreTree d)
virtual

Add a daughter (semantic child node).

Parameters
dThe daughter to add.

Reimplemented from Puma::PreTree.

◆ add_son()

virtual void Puma::PreTreeComposite::add_son ( PreTree s)
virtual

Add a son (syntactic child node).

Parameters
sThe son to add.

Reimplemented from Puma::PreTree.

◆ daughter()

virtual PreTree* Puma::PreTreeComposite::daughter ( int  n) const
virtual

Get the n-th daughter.

Parameters
nThe index of the daughter.

Reimplemented from Puma::PreTree.

◆ daughters()

virtual int Puma::PreTreeComposite::daughters ( ) const
virtual

Get the number of daughters.

Reimplemented from Puma::PreTree.

◆ endToken()

virtual Token* Puma::PreTreeComposite::endToken ( ) const
virtual

Get the last token of the syntactic construct represented by the sub-tree.

Reimplemented from Puma::PreTree.

◆ replace_daughter()

virtual void Puma::PreTreeComposite::replace_daughter ( int  n,
PreTree new_d 
)
virtual

Replace the n-th daughter.

Parameters
nThe index of the daughter.
new_dThe new daughter.

Reimplemented from Puma::PreTree.

◆ replace_son()

virtual void Puma::PreTreeComposite::replace_son ( int  n,
PreTree new_s 
)
virtual

Replace the n-th son.

Parameters
nThe index of the son to replace.
new_sThe new son.

Reimplemented from Puma::PreTree.

◆ son()

virtual PreTree* Puma::PreTreeComposite::son ( int  n) const
virtual

Get the n-th son.

Parameters
nThe index of the son.

Reimplemented from Puma::PreTree.

◆ sons()

virtual int Puma::PreTreeComposite::sons ( ) const
virtual

Get the number of sons.

Reimplemented from Puma::PreTree.

◆ startToken()

virtual Token* Puma::PreTreeComposite::startToken ( ) const
virtual

Get the first token of the syntactic construct represented by the sub-tree.

Reimplemented from Puma::PreTree.

Member Data Documentation

◆ DYNAMIC

const int Puma::PreTreeComposite::DYNAMIC = -1
static

Dynamic number of sons and daughters.