OpenMD 3.1
Molecular Dynamics in the Open
Loading...
Searching...
No Matches
antlr::BaseAST Class Referenceabstract
+ Inheritance diagram for antlr::BaseAST:

Public Member Functions

 BaseAST (const BaseAST &other)
 
virtual const char * typeName (void) const =0
 Return the class name.
 
virtual RefAST clone (void) const =0
 Clone this AST node.
 
virtual bool equals (RefAST t) const
 Is node t equal to this in terms of token type and text?
 
virtual bool equalsList (RefAST t) const
 Is t an exact structural and equals() match of this tree.
 
virtual bool equalsListPartial (RefAST t) const
 Is 't' a subtree of this list? The siblings of the root are NOT ignored.
 
virtual bool equalsTree (RefAST t) const
 Is tree rooted at 'this' equal to 't'? The siblings of 'this' are ignored.
 
virtual bool equalsTreePartial (RefAST t) const
 Is 't' a subtree of the tree rooted at 'this'? The siblings of 'this' are ignored.
 
virtual std ::vector< RefASTfindAll (RefAST t)
 Walk the tree looking for all exact subtree matches.
 
virtual std ::vector< RefASTfindAllPartial (RefAST t)
 Walk the tree looking for all subtrees.
 
virtual void addChild (RefAST c)
 Add a node to the end of the child list for this node.
 
virtual size_t getNumberOfChildren () const
 Get the number of child nodes of this node (shallow e.g.
 
virtual RefAST getFirstChild () const
 Get the first child of this node; null if no children.
 
virtual RefAST getNextSibling () const
 Get the next sibling in line after this one.
 
virtual std::string getText () const
 Get the token text for this node.
 
virtual int getType () const
 Get the token type for this node.
 
virtual void removeChildren ()
 Remove all children.
 
virtual void setFirstChild (RefAST c)
 Set the first child of a node.
 
virtual void setNextSibling (RefAST n)
 Set the next sibling after this one.
 
virtual void setText (const std ::string &)
 Set the token text for this node.
 
virtual void setType (int)
 Set the token type for this node.
 
virtual std::string toString () const
 Return string representation for the AST.
 
virtual std::string toStringList () const
 Print out a child sibling tree in LISP notation.
 
virtual std::string toStringTree () const
 
- Public Member Functions inherited from antlr::AST
 AST (const AST &)
 
virtual void initialize (int t, const std ::string &txt)=0
 Various initialization routines.
 
virtual void initialize (RefAST t)=0
 
virtual void initialize (RefToken t)=0
 

Protected Attributes

RefBaseAST down
 
RefBaseAST right
 

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.

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.

◆ clone()

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

Clone this AST node.

Implements antlr::AST.

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

◆ equals()

bool antlr::BaseAST::equals ( RefAST t) const
inlinevirtual

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(), getText(), antlr::AST::getType(), and 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 t) 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 t) 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.

◆ 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.

◆ 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(), and toStringList().

◆ 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.

◆ 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 equals().

◆ 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 equals().

◆ removeChildren()

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

Remove all children.

Definition at line 122 of file BaseAST.hpp.

◆ 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 & )
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 )
inlinevirtual

Set the token type for this node.

Implements antlr::AST.

Reimplemented in antlr::CommonAST.

Definition at line 145 of file BaseAST.hpp.

◆ 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.

Referenced by toStringList().

◆ 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 getFirstChild(), getNextSibling(), toString(), and antlr::AST::toStringList().

◆ toStringTree()

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

Implements antlr::AST.

Definition at line 214 of file BaseAST.cpp.

◆ 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.

Member Data Documentation

◆ down

RefBaseAST antlr::BaseAST::down
protected

Definition at line 172 of file BaseAST.hpp.

◆ right

RefBaseAST antlr::BaseAST::right
protected

Definition at line 173 of file BaseAST.hpp.


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