OpenMD  2.5
Molecular Dynamics in the Open
antlr::BaseAST Class Referenceabstract

#include <BaseAST.hpp>

Inheritance diagram for antlr::BaseAST:
antlr::AST antlr::CommonAST antlr::CommonASTWithHiddenTokens

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 antlr::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)
 

Detailed Description

Definition at line 23 of file BaseAST.hpp.

Constructor & Destructor Documentation

◆ BaseAST() [1/2]

antlr::BaseAST::BaseAST ( )
inline

Definition at line 25 of file BaseAST.hpp.

◆ BaseAST() [2/2]

antlr::BaseAST::BaseAST ( const BaseAST other)
inline

Definition at line 28 of file BaseAST.hpp.

◆ ~BaseAST()

virtual antlr::BaseAST::~BaseAST ( )
inlinevirtual

Definition at line 32 of file BaseAST.hpp.

References ANTLR_USE_NAMESPACE.

Member Function Documentation

◆ addChild()

virtual void antlr::BaseAST::addChild ( RefAST  c)
inlinevirtual

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

Implements antlr::AST.

Definition at line 77 of file BaseAST.hpp.

References right.

◆ clone()

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

Clone this AST node.

Implements antlr::AST.

Implemented in antlr::CommonAST, and antlr::CommonASTWithHiddenTokens.

◆ doWorkForFindAll()

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

Definition at line 37 of file BaseAST.cpp.

References antlr::AST::getNextSibling().

Referenced by findAll(), and findAllPartial().

◆ equals()

bool antlr::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 antlr::AST.

Definition at line 182 of file BaseAST.hpp.

References antlr::AST::getText(), and antlr::AST::getType().

Referenced by equalsTree(), and equalsTreePartial().

◆ equalsList()

bool antlr::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 antlr::AST.

Definition at line 60 of file BaseAST.cpp.

References antlr::AST::equals(), antlr::AST::equalsList(), antlr::AST::getFirstChild(), and antlr::AST::getNextSibling().

Referenced by equalsTree().

◆ equalsListPartial()

bool antlr::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 antlr::AST.

Definition at line 93 of file BaseAST.cpp.

References antlr::AST::equals(), antlr::AST::equalsListPartial(), antlr::AST::getFirstChild(), and antlr::AST::getNextSibling().

Referenced by equalsTreePartial().

◆ equalsTree()

bool antlr::BaseAST::equalsTree ( RefAST  t) const
virtual

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

Implements antlr::AST.

Definition at line 123 of file BaseAST.cpp.

References equals(), equalsList(), antlr::AST::getFirstChild(), and getFirstChild().

◆ equalsTreePartial()

bool antlr::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 antlr::AST.

Definition at line 143 of file BaseAST.cpp.

References equals(), equalsListPartial(), antlr::AST::getFirstChild(), and getFirstChild().

◆ findAll()

std::vector< RefAST > antlr::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 antlr::AST.

Definition at line 164 of file BaseAST.cpp.

References ANTLR_USE_NAMESPACE, and doWorkForFindAll().

◆ findAllPartial()

std::vector< RefAST > antlr::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 antlr::AST.

Definition at line 180 of file BaseAST.cpp.

References ANTLR_USE_NAMESPACE, and doWorkForFindAll().

◆ getFirstChild()

virtual RefAST antlr::BaseAST::getFirstChild ( ) const
inlinevirtual

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

Implements antlr::AST.

Definition at line 100 of file BaseAST.hpp.

Referenced by equalsTree(), equalsTreePartial(), toStringList(), and toStringTree().

◆ getNextSibling()

virtual RefAST antlr::BaseAST::getNextSibling ( ) const
inlinevirtual

Get the next sibling in line after this one.

Implements antlr::AST.

Definition at line 105 of file BaseAST.hpp.

Referenced by toStringList().

◆ getNumberOfChildren()

size_t antlr::BaseAST::getNumberOfChildren ( ) const
virtual

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

Implements antlr::AST.

Definition at line 20 of file BaseAST.cpp.

References down, and right.

◆ getText()

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

Get the token text for this node.

Implements antlr::AST.

Reimplemented in antlr::CommonAST.

Definition at line 111 of file BaseAST.hpp.

Referenced by toStringTree().

◆ getType()

virtual int antlr::BaseAST::getType ( ) const
inlinevirtual

Get the token type for this node.

Implements antlr::AST.

Reimplemented in antlr::CommonAST.

Definition at line 116 of file BaseAST.hpp.

Referenced by toStringTree().

◆ removeChildren()

virtual void antlr::BaseAST::removeChildren ( )
inlinevirtual

Remove all children.

Definition at line 122 of file BaseAST.hpp.

References antlr::nullAST.

◆ setFirstChild()

virtual void antlr::BaseAST::setFirstChild ( RefAST  c)
inlinevirtual

Set the first child of a node.

Implements antlr::AST.

Definition at line 128 of file BaseAST.hpp.

◆ setNextSibling()

virtual void antlr::BaseAST::setNextSibling ( RefAST  n)
inlinevirtual

Set the next sibling after this one.

Implements antlr::AST.

Definition at line 134 of file BaseAST.hpp.

◆ setText()

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

Set the token text for this node.

Implements antlr::AST.

Reimplemented in antlr::CommonAST.

Definition at line 140 of file BaseAST.hpp.

◆ setType()

virtual void antlr::BaseAST::setType ( int  type)
inlinevirtual

Set the token type for this node.

Implements antlr::AST.

Reimplemented in antlr::CommonAST.

Definition at line 145 of file BaseAST.hpp.

References ANTLR_USE_NAMESPACE.

◆ toString()

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

Return string representation for the AST.

Implements antlr::AST.

Definition at line 163 of file BaseAST.hpp.

References ANTLR_USE_NAMESPACE.

Referenced by toStringList(), and toStringTree().

◆ toStringList()

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

Print out a child sibling tree in LISP notation.

Implements antlr::AST.

Definition at line 191 of file BaseAST.cpp.

References ANTLR_USE_NAMESPACE, getFirstChild(), getNextSibling(), toString(), and antlr::AST::toStringList().

◆ toStringTree()

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

◆ typeName()

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

Return the class name.

Implements antlr::AST.

Implemented in antlr::CommonAST, and antlr::CommonASTWithHiddenTokens.

Referenced by toStringTree().

Member Data Documentation

◆ down

RefBaseAST antlr::BaseAST::down
protected

Definition at line 172 of file BaseAST.hpp.

Referenced by getNumberOfChildren().

◆ right

RefBaseAST antlr::BaseAST::right
protected

Definition at line 173 of file BaseAST.hpp.

Referenced by addChild(), and getNumberOfChildren().


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