Puma Reference Manual | Puma: Puma::PreTree Class Reference |
Base class for all C preprocessor syntax tree nodes. More...
#include <Puma/PreTree.h>
Inherited by Puma::PreCondSemNode, Puma::PreError, Puma::PreInclSemNode, Puma::PreTreeComposite, and Puma::PreTreeToken.
Public Member Functions | |
virtual | ~PreTree () |
Destructor. | |
virtual bool | isLeaf () const |
Check if the node is a leaf, i.e. | |
virtual void | accept (PreVisitor &)=0 |
Part of the tree visitor pattern. | |
virtual void | add_son (PreTree *s) |
Add a son (syntactic child node). | |
virtual void | replace_son (int n, PreTree *new_s) |
Replace the n-th son. | |
virtual PreTree * | son (int n) const |
Get the n-th son. | |
virtual int | sons () const |
Get the number of sons. | |
virtual void | add_daughter (PreTree *d) |
Add a daughter (semantic child node). | |
virtual void | replace_daughter (int n, PreTree *new_d) |
Replace the n-th daughter. | |
virtual PreTree * | daughter (int n) const |
Get the n-th daughter. | |
virtual int | daughters () const |
Get the number of daughters. | |
virtual Token * | startToken () const |
Get the first token of the syntactic construct represented by the sub-tree. | |
virtual Token * | endToken () const |
Get the last token of the syntactic construct represented by the sub-tree. | |
Protected Member Functions | |
PreTree () | |
Constructor. |
Base class for all C preprocessor syntax tree nodes.
Puma::PreTree::PreTree | ( | ) | [inline, protected] |
Constructor.
virtual Puma::PreTree::~PreTree | ( | ) | [inline, virtual] |
Destructor.
virtual void Puma::PreTree::accept | ( | PreVisitor & | ) | [pure virtual] |
Part of the tree visitor pattern.
Calls the node visiting function suitable for the actual node type.
Implemented in Puma::PreTreeComposite, Puma::PreProgram, Puma::PreDirectiveGroups, Puma::PreConditionalGroup, Puma::PreElsePart, Puma::PreElifPart, Puma::PreIfDirective, Puma::PreIfdefDirective, Puma::PreIfndefDirective, Puma::PreElifDirective, Puma::PreElseDirective, Puma::PreEndifDirective, Puma::PreIncludeDirective, Puma::PreAssertDirective, Puma::PreUnassertDirective, Puma::PreDefineFunctionDirective, Puma::PreDefineConstantDirective, Puma::PreUndefDirective, Puma::PreWarningDirective, Puma::PreErrorDirective, Puma::PreIdentifierList, Puma::PreTokenList, Puma::PreTokenListPart, Puma::PreCondSemNode, Puma::PreInclSemNode, Puma::PreError, and Puma::PreTreeToken.
virtual void Puma::PreTree::add_daughter | ( | PreTree * | d | ) | [virtual] |
Add a daughter (semantic child node).
d | The daughter to add. |
virtual void Puma::PreTree::add_son | ( | PreTree * | s | ) | [virtual] |
Add a son (syntactic child node).
s | The son to add. |
virtual PreTree* Puma::PreTree::daughter | ( | int | n | ) | const [virtual] |
Get the n-th daughter.
n | The index of the daughter. |
Reimplemented in Puma::PreTreeComposite.
virtual int Puma::PreTree::daughters | ( | ) | const [virtual] |
Get the number of daughters.
Reimplemented in Puma::PreTreeComposite.
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.
virtual bool Puma::PreTree::isLeaf | ( | ) | const [virtual] |
Check if the node is a leaf, i.e.
it has no child nodes.
virtual void Puma::PreTree::replace_daughter | ( | int | n, | |
PreTree * | new_d | |||
) | [virtual] |
Replace the n-th daughter.
n | The index of the daughter. | |
new_d | The new daughter. |
virtual void Puma::PreTree::replace_son | ( | int | n, | |
PreTree * | new_s | |||
) | [virtual] |
Replace the n-th son.
n | The index of the son to replace. | |
new_s | The new son. |
virtual PreTree* Puma::PreTree::son | ( | int | n | ) | const [virtual] |
virtual int Puma::PreTree::sons | ( | ) | const [virtual] |
Get the number of sons.
Reimplemented in Puma::PreTreeComposite.
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.