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

#include <AST.hpp>

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

Public Member Functions

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

Private Member Functions

 AST (RefAST other)
 
ASToperator= (const AST &other)
 
ASToperator= (RefAST other)
 

Private Attributes

ASTRefref
 

Friends

struct ASTRef
 

Detailed Description

Definition at line 23 of file AST.hpp.

Constructor & Destructor Documentation

◆ AST() [1/3]

antlr::AST::AST ( )
inline

Definition at line 25 of file AST.hpp.

◆ AST() [2/3]

antlr::AST::AST ( const AST )
inline

Definition at line 26 of file AST.hpp.

◆ ~AST()

virtual antlr::AST::~AST ( )
inlinevirtual

Definition at line 27 of file AST.hpp.

References ANTLR_USE_NAMESPACE, OpenMD::operator<<(), and OpenMD::toString().

◆ AST() [3/3]

antlr::AST::AST ( RefAST  other)
private

Member Function Documentation

◆ addChild()

virtual void antlr::AST::addChild ( RefAST  c)
pure virtual

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

Implemented in antlr::BaseAST, and antlr::ASTNULLType.

Referenced by antlr::ASTFactory::makeASTRoot(), and antlr::ASTFactory::setASTNodeFactory().

◆ clone()

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

◆ equals()

virtual bool antlr::AST::equals ( RefAST  t) const
pure virtual

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

Implemented in antlr::BaseAST, and antlr::ASTNULLType.

Referenced by antlr::BaseAST::equalsList(), and antlr::BaseAST::equalsListPartial().

◆ equalsList()

virtual bool antlr::AST::equalsList ( RefAST  t) const
pure virtual

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

Implemented in antlr::BaseAST, and antlr::ASTNULLType.

Referenced by antlr::BaseAST::equalsList().

◆ equalsListPartial()

virtual bool antlr::AST::equalsListPartial ( RefAST  t) const
pure virtual

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

Implemented in antlr::BaseAST, and antlr::ASTNULLType.

Referenced by antlr::BaseAST::equalsListPartial().

◆ equalsTree()

virtual bool antlr::AST::equalsTree ( RefAST  t) const
pure virtual

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

Implemented in antlr::BaseAST, and antlr::ASTNULLType.

◆ equalsTreePartial()

virtual bool antlr::AST::equalsTreePartial ( RefAST  t) const
pure virtual

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

Implemented in antlr::BaseAST, and antlr::ASTNULLType.

◆ findAll()

virtual std ::vector<RefAST> antlr::AST::findAll ( RefAST  t)
pure virtual

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

Implemented in antlr::BaseAST, and antlr::ASTNULLType.

◆ findAllPartial()

virtual std ::vector<RefAST> antlr::AST::findAllPartial ( RefAST  t)
pure virtual

Walk the tree looking for all subtrees. Return a vector of RefAST that lets the caller walk the list of subtree roots found herein.

Implemented in antlr::BaseAST, and antlr::ASTNULLType.

◆ getFirstChild()

virtual RefAST antlr::AST::getFirstChild ( ) const
pure virtual

◆ getNextSibling()

◆ getNumberOfChildren()

virtual size_t antlr::AST::getNumberOfChildren ( ) const
pure virtual

Get the number of children. Returns 0 if the node is a leaf.

Implemented in antlr::BaseAST, and antlr::ASTNULLType.

◆ getText()

virtual std ::string antlr::AST::getText ( ) const
pure virtual

◆ getType()

virtual int antlr::AST::getType ( ) const
pure virtual

◆ initialize() [1/3]

virtual void antlr::AST::initialize ( int  t,
const std ::string &  txt 
)
pure virtual

Various initialization routines. Used by several factories to initialize an AST element.

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

Referenced by antlr::ASTFactory::create().

◆ initialize() [2/3]

virtual void antlr::AST::initialize ( RefAST  t)
pure virtual

◆ initialize() [3/3]

virtual void antlr::AST::initialize ( RefToken  t)
pure virtual

◆ operator=() [1/2]

AST& antlr::AST::operator= ( const AST other)
private

◆ operator=() [2/2]

AST& antlr::AST::operator= ( RefAST  other)
private

◆ setFirstChild()

virtual void antlr::AST::setFirstChild ( RefAST  c)
pure virtual

Set the first child of a node.

Implemented in antlr::BaseAST, and antlr::ASTNULLType.

Referenced by antlr::ASTFactory::addASTChild(), antlr::ASTFactory::dupTree(), and antlr::ASTFactory::make().

◆ setNextSibling()

virtual void antlr::AST::setNextSibling ( RefAST  n)
pure virtual

◆ setText()

virtual void antlr::AST::setText ( const std ::string &  txt)
pure virtual

Set the token text for this node.

Implemented in antlr::BaseAST, antlr::CommonAST, and antlr::ASTNULLType.

◆ setType()

virtual void antlr::AST::setType ( int  type)
pure virtual

Set the token type for this node.

Implemented in antlr::BaseAST, antlr::CommonAST, and antlr::ASTNULLType.

Referenced by antlr::ASTFactory::create().

◆ toString()

virtual std ::string antlr::AST::toString ( ) const
pure virtual

◆ toStringList()

virtual std ::string antlr::AST::toStringList ( ) const
pure virtual

Print out a child-sibling tree in LISP notation.

Implemented in antlr::BaseAST, and antlr::ASTNULLType.

Referenced by antlr::BaseAST::toStringList(), and antlr::BaseAST::toStringTree().

◆ toStringTree()

virtual std ::string antlr::AST::toStringTree ( ) const
pure virtual

Implemented in antlr::BaseAST, and antlr::ASTNULLType.

◆ typeName()

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

Return the type name for this AST node. (for XML output)

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

Referenced by antlr::ASTFactory::setASTNodeFactory().

Friends And Related Function Documentation

◆ ASTRef

friend struct ASTRef
friend

Definition at line 134 of file AST.hpp.

Member Data Documentation

◆ ref

ASTRef* antlr::AST::ref
private

Definition at line 135 of file AST.hpp.

Referenced by antlr::ASTRef::ASTRef(), and antlr::ASTRef::getRef().


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