ANTLR Support Libraries 2.7.1+
Public Member Functions | Protected Attributes | Private Member Functions | List of all members
BaseAST Class Referenceabstract

#include <BaseAST.hpp>

Inheritance diagram for BaseAST:
Inheritance graph
[legend]
Collaboration diagram for BaseAST:
Collaboration graph
[legend]

Public Member Functions

 BaseAST ()
 
 BaseAST (const BaseAST &other)
 
virtual ~BaseAST ()
 
virtual const char * typeName (void) const =0
 Return the class name. More...
 
virtual RefAST clone (void) const =0
 Clone this AST node. More...
 
virtual bool equals (RefAST t) const
 Is node t equal to this in terms of token type and text? More...
 
virtual bool equalsList (RefAST t) const
 
virtual bool equalsListPartial (RefAST t) const
 
virtual bool equalsTree (RefAST t) const
 
virtual bool equalsTreePartial (RefAST t) const
 
virtual std ::vector< RefASTfindAll (RefAST t)
 
virtual std ::vector< RefASTfindAllPartial (RefAST t)
 
virtual void addChild (RefAST c)
 Add a node to the end of the child list for this node. More...
 
virtual size_t getNumberOfChildren () const
 
virtual RefAST getFirstChild () const
 Get the first child of this node; null if no children. More...
 
virtual RefAST getNextSibling () const
 Get the next sibling in line after this one. More...
 
virtual std ::string getText () const
 Get the token text for this node. More...
 
virtual int getType () const
 Get the token type for this node. More...
 
virtual void removeChildren ()
 Remove all children. More...
 
virtual void setFirstChild (RefAST c)
 Set the first child of a node. More...
 
virtual void setNextSibling (RefAST n)
 Set the next sibling after this one. More...
 
virtual void setText (const std ::string &txt)
 Set the token text for this node. More...
 
virtual void setType (int type)
 Set the token type for this node. More...
 
virtual std ::string toString () const
 Return string representation for the AST. More...
 
virtual std ::string toStringList () const
 Print out a child sibling tree in LISP notation. More...
 
virtual std ::string toStringTree () const
 
- Public Member Functions inherited from AST
 AST ()
 
 AST (const AST &)
 
virtual ~AST ()
 
virtual void initialize (int t, const std ::string &txt)=0
 
virtual void initialize (RefAST t)=0
 
virtual void initialize (RefToken t)=0
 

Protected Attributes

RefBaseAST down
 
RefBaseAST right
 

Private Member Functions

void doWorkForFindAll (std ::vector< RefAST > &v, RefAST target, bool partialMatch)
 

Constructor & Destructor Documentation

◆ BaseAST() [1/2]

BaseAST::BaseAST ( )
inline

◆ BaseAST() [2/2]

BaseAST::BaseAST ( const BaseAST other)
inline

◆ ~BaseAST()

virtual BaseAST::~BaseAST ( )
inlinevirtual

Member Function Documentation

◆ addChild()

virtual void BaseAST::addChild ( RefAST  c)
inlinevirtual

Add a node to the end of the child list for this node.

Implements AST.

◆ clone()

virtual RefAST BaseAST::clone ( void  ) const
pure virtual

Clone this AST node.

Implements AST.

Implemented in CommonAST, and CommonASTWithHiddenTokens.

◆ doWorkForFindAll()

void BaseAST::doWorkForFindAll ( std ::vector< RefAST > &  v,
RefAST  target,
bool  partialMatch 
)
private

◆ equals()

bool BaseAST::equals ( RefAST  t) const
inlinevirtual

Is node t equal to this in terms of token type and text?

Is node t equal to this in terms of token type and text?

Implements AST.

◆ equalsList()

bool BaseAST::equalsList ( RefAST  t) const
virtual

Is t an exact structural and equals() match of this tree. The 'this' reference is considered the start of a sibling list.

Implements AST.

◆ equalsListPartial()

bool BaseAST::equalsListPartial ( RefAST  sub) const
virtual

Is 't' a subtree of this list? The siblings of the root are NOT ignored.

Is 'sub' a subtree of this list? The siblings of the root are NOT ignored.

Implements AST.

◆ equalsTree()

bool BaseAST::equalsTree ( RefAST  t) const
virtual

Is tree rooted at 'this' equal to 't'? The siblings of 'this' are ignored.

Implements AST.

◆ equalsTreePartial()

bool BaseAST::equalsTreePartial ( RefAST  sub) const
virtual

Is 't' a subtree of the tree rooted at 'this'? The siblings of 'this' are ignored.

Is 'sub' a subtree of the tree rooted at 'this'? The siblings of 'this' are ignored.

Implements AST.

◆ findAll()

std::vector< RefAST > BaseAST::findAll ( RefAST  target)
virtual

Walk the tree looking for all exact subtree matches. Return an ASTEnumerator that lets the caller walk the list of subtree roots found herein.

Implements AST.

◆ findAllPartial()

std::vector< RefAST > BaseAST::findAllPartial ( RefAST  target)
virtual

Walk the tree looking for all subtrees. Return an ASTEnumerator that lets the caller walk the list of subtree roots found herein.

Implements AST.

◆ getFirstChild()

virtual RefAST BaseAST::getFirstChild ( ) const
inlinevirtual

Get the first child of this node; null if no children.

Implements AST.

◆ getNextSibling()

virtual RefAST BaseAST::getNextSibling ( ) const
inlinevirtual

Get the next sibling in line after this one.

Implements AST.

◆ getNumberOfChildren()

size_t BaseAST::getNumberOfChildren ( ) const
virtual

Get the number of child nodes of this node (shallow e.g. not of the whole tree it spans).

Implements AST.

◆ getText()

virtual std ::string BaseAST::getText ( ) const
inlinevirtual

Get the token text for this node.

Implements AST.

Reimplemented in CommonAST.

◆ getType()

virtual int BaseAST::getType ( ) const
inlinevirtual

Get the token type for this node.

Implements AST.

Reimplemented in CommonAST.

◆ removeChildren()

virtual void BaseAST::removeChildren ( )
inlinevirtual

Remove all children.

◆ setFirstChild()

virtual void BaseAST::setFirstChild ( RefAST  c)
inlinevirtual

Set the first child of a node.

Implements AST.

◆ setNextSibling()

virtual void BaseAST::setNextSibling ( RefAST  n)
inlinevirtual

Set the next sibling after this one.

Implements AST.

◆ setText()

virtual void BaseAST::setText ( const std ::string &  txt)
inlinevirtual

Set the token text for this node.

Implements AST.

Reimplemented in CommonAST.

◆ setType()

virtual void BaseAST::setType ( int  type)
inlinevirtual

Set the token type for this node.

Implements AST.

Reimplemented in CommonAST.

◆ toString()

virtual std ::string BaseAST::toString ( ) const
inlinevirtual

Return string representation for the AST.

Implements AST.

◆ toStringList()

std::string BaseAST::toStringList ( ) const
virtual

Print out a child sibling tree in LISP notation.

Implements AST.

◆ toStringTree()

std::string BaseAST::toStringTree ( ) const
virtual

Implements AST.

◆ typeName()

virtual const char* BaseAST::typeName ( void  ) const
pure virtual

Return the class name.

Implements AST.

Implemented in CommonAST, and CommonASTWithHiddenTokens.

Member Data Documentation

◆ down

RefBaseAST BaseAST::down
protected

◆ right

RefBaseAST BaseAST::right
protected

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