PUMA Library Reference Manual
Loading...
Searching...
No Matches
Puma::PreTree Class Referenceabstract

#include <Puma/PreTree.h>

+ Inheritance diagram for Puma::PreTree:

Description

Base class for all C preprocessor syntax tree nodes.

Public Member Functions

virtual ~PreTree ()
 Destructor. More...
 
virtual bool isLeaf () const
 Check if the node is a leaf, i.e. 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...
 

Protected Member Functions

 PreTree ()
 Constructor. More...
 

Constructor & Destructor Documentation

◆ PreTree()

Puma::PreTree::PreTree ( )
inlineprotected

Constructor.

◆ ~PreTree()

virtual Puma::PreTree::~PreTree ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ accept()

◆ add_daughter()

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

Add a daughter (semantic child node).

Parameters
dThe daughter to add.

Reimplemented in Puma::PreTreeComposite.

◆ add_son()

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

Add a son (syntactic child node).

Parameters
sThe son to add.

Reimplemented in Puma::PreTreeComposite.

◆ daughter()

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

Get the n-th daughter.

Parameters
nThe index of the daughter.

Reimplemented in Puma::PreTreeComposite.

◆ daughters()

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

Get the number of daughters.

Reimplemented in Puma::PreTreeComposite.

◆ endToken()

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

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

Reimplemented in Puma::PreTreeComposite, and Puma::PreTreeToken.

◆ isLeaf()

virtual bool Puma::PreTree::isLeaf ( ) const
virtual

Check if the node is a leaf, i.e.

it has no child nodes.

◆ replace_daughter()

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

Replace the n-th daughter.

Parameters
nThe index of the daughter.
new_dThe new daughter.

Reimplemented in Puma::PreTreeComposite.

◆ replace_son()

virtual void Puma::PreTree::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 in Puma::PreTreeComposite.

◆ son()

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

Get the n-th son.

Parameters
nThe index of the son.

Reimplemented in Puma::PreTreeComposite.

◆ sons()

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

Get the number of sons.

Reimplemented in Puma::PreTreeComposite.

◆ startToken()

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

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

Reimplemented in Puma::PreTreeComposite, and Puma::PreTreeToken.