AST Class Reference

#include <AST.hpp>

Inheritance diagram for AST:

Inheritance graph
[legend]
Collaboration diagram for AST:

Collaboration graph
[legend]

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).
virtual RefAST clone (void) const =0
 Clone this AST node.
virtual bool equals (RefAST t) const =0
 Is node t equal to this in terms of token type and text?
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 ANTLR_USE_NAMESPACE (std) vector< RefAST > findAll(RefAST t)=0
virtual ANTLR_USE_NAMESPACE (std) vector< RefAST > findAllPartial(RefAST t)=0
virtual void addChild (RefAST c)=0
 Add a node to the end of the child list for this node.
virtual size_t getNumberOfChildren () const =0
 Get the number of children. Returns 0 if the node is a leaf.
virtual RefAST getFirstChild () const =0
 Get the first child of this node; null if no children.
virtual RefAST getNextSibling () const =0
 Get the next sibling in line after this one.
virtual ANTLR_USE_NAMESPACE (std) string getText() const =0
 Get the token text for this node.
virtual int getType () const =0
 Get the token type for this node.
virtual void initialize (int t, const ANTLR_USE_NAMESPACE(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.
virtual void setNextSibling (RefAST n)=0
 Set the next sibling after this one.
virtual void setText (const ANTLR_USE_NAMESPACE(std) string &txt)=0
 Set the token text for this node.
virtual void setType (int type)=0
 Set the token type for this node.
virtual ANTLR_USE_NAMESPACE (std) string toString() const =0
 Return this AST node as a string.
virtual ANTLR_USE_NAMESPACE (std) string toStringList() const =0
 Print out a child-sibling tree in LISP notation.
virtual ANTLR_USE_NAMESPACE (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::AST (  )  [inline]

Definition at line 25 of file AST.hpp.

AST::AST ( const AST  )  [inline]

Definition at line 26 of file AST.hpp.

virtual AST::~AST (  )  [inline, virtual]

Definition at line 27 of file AST.hpp.

AST::AST ( RefAST  other  )  [private]


Member Function Documentation

virtual const char* AST::typeName ( void   )  const [pure virtual]

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

Implemented in ASTNULLType, BaseAST, CommonAST, and CommonASTWithHiddenTokens.

virtual RefAST AST::clone ( void   )  const [pure virtual]

Clone this AST node.

Implemented in ASTNULLType, BaseAST, CommonAST, and CommonASTWithHiddenTokens.

virtual bool AST::equals ( RefAST  t  )  const [pure virtual]

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

Implemented in ASTNULLType, and BaseAST.

virtual bool 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 ASTNULLType, and BaseAST.

virtual bool AST::equalsListPartial ( RefAST  t  )  const [pure virtual]

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

Implemented in ASTNULLType, and BaseAST.

virtual bool AST::equalsTree ( RefAST  t  )  const [pure virtual]

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

Implemented in ASTNULLType, and BaseAST.

virtual bool 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 ASTNULLType, and BaseAST.

virtual AST::ANTLR_USE_NAMESPACE ( std   )  [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 ASTNULLType, ASTNULLType, BaseAST, BaseAST, and CommonAST.

virtual AST::ANTLR_USE_NAMESPACE ( std   )  [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 ASTNULLType, ASTNULLType, BaseAST, BaseAST, and CommonAST.

virtual void AST::addChild ( RefAST  c  )  [pure virtual]

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

Implemented in ASTNULLType, and BaseAST.

virtual size_t AST::getNumberOfChildren (  )  const [pure virtual]

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

Implemented in ASTNULLType, and BaseAST.

virtual RefAST AST::getFirstChild (  )  const [pure virtual]

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

Implemented in ASTNULLType, and BaseAST.

virtual RefAST AST::getNextSibling (  )  const [pure virtual]

Get the next sibling in line after this one.

Implemented in ASTNULLType, and BaseAST.

virtual AST::ANTLR_USE_NAMESPACE ( std   )  const [pure virtual]

Get the token text for this node.

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

virtual int AST::getType (  )  const [pure virtual]

Get the token type for this node.

Implemented in ASTNULLType, BaseAST, and CommonAST.

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

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

Implemented in ASTNULLType, CommonAST, and CommonASTWithHiddenTokens.

virtual void AST::initialize ( RefAST  t  )  [pure virtual]

virtual void AST::initialize ( RefToken  t  )  [pure virtual]

virtual void AST::setFirstChild ( RefAST  c  )  [pure virtual]

Set the first child of a node.

Implemented in ASTNULLType, and BaseAST.

virtual void AST::setNextSibling ( RefAST  n  )  [pure virtual]

Set the next sibling after this one.

Implemented in ASTNULLType, and BaseAST.

virtual void AST::setText ( const ANTLR_USE_NAMESPACE(std) string &  txt  )  [pure virtual]

Set the token text for this node.

Implemented in ASTNULLType, BaseAST, and CommonAST.

virtual void AST::setType ( int  type  )  [pure virtual]

Set the token type for this node.

Implemented in ASTNULLType, BaseAST, and CommonAST.

virtual AST::ANTLR_USE_NAMESPACE ( std   )  const [pure virtual]

Return this AST node as a string.

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

virtual AST::ANTLR_USE_NAMESPACE ( std   )  const [pure virtual]

Print out a child-sibling tree in LISP notation.

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

virtual AST::ANTLR_USE_NAMESPACE ( std   )  const [pure virtual]

AST& AST::operator= ( const AST other  )  [private]

AST& AST::operator= ( RefAST  other  )  [private]


Friends And Related Function Documentation

friend struct ASTRef [friend]

Definition at line 134 of file AST.hpp.


Field Documentation

ASTRef* AST::ref [private]

Definition at line 135 of file AST.hpp.


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

Generated on Tue Mar 31 20:19:25 2009 for ctrump by  doxygen 1.5.6