Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

EbnfNode Class Reference

#include <ebnf_node.hh>

Inheritance diagram for EbnfNode:

Inheritance graph
[legend]
Collaboration diagram for EbnfNode:

Collaboration graph
[legend]
List of all members.

Public Methods

 EbnfNode (const Position &pos_)
virtual EbnfNode* clone ()=0
virtual bool isLeaf ()
virtual int getChildCount ()=0
virtual EbnfNode& operator[] (int index)=0
virtual bool dfTraverse (EbnfNodeAlgo &algo) throw (EbnfNodeAlgoException)
virtual bool rdfTraverse (EbnfNodeAlgo &algo) throw (EbnfNodeAlgoException)
virtual ~EbnfNode ()
const PositiongetPos () const
virtual void dump (ostream &os) const=0

Private Attributes

Position pos

Detailed Description

This is the EBNF expansion nodes' interface. Nodes are built by an implementation of the IEbnfNodeBuilder. This interface only specifies the basic tree structure operations.

Definition at line 65 of file ebnf_node.hh.


Constructor & Destructor Documentation

EbnfNode::EbnfNode ( const Position & pos_ ) [inline]
 

Definition at line 69 of file ebnf_node.hh.

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

Force virtual destructors.

Definition at line 125 of file ebnf_node.hh.


Member Function Documentation

EbnfNode * EbnfNode::clone ( ) [pure virtual]
 

Virtual copy creation.

Reimplemented in EbnfOrNode, EbnfCatNode, EbnfStarNode, EbnfNonterminalNode, EbnfTerminalNode, and EbnfLambdaNode.

Referenced by EbnfNodeBuilder::createPlusNode(), and EbnfLl1CheckAlgo::operator()().

bool EbnfNode::isLeaf ( ) [inline, virtual]
 

Returns true if this node is a leaf node.

Definition at line 80 of file ebnf_node.hh.

int EbnfNode::getChildCount ( ) [pure virtual]
 

Returns the number of children nodes of this node.

Reimplemented in EbnfOrNode, EbnfCatNode, EbnfStarNode, EbnfNonterminalNode, EbnfTerminalNode, and EbnfLambdaNode.

Referenced by isLeaf().

EbnfNode & EbnfNode::operator[] ( int index ) [pure virtual]
 

Returns the index'th child of this node.

Precondition:
0 <= index <= getChildCount()

Reimplemented in EbnfOrNode, EbnfCatNode, EbnfStarNode, EbnfNonterminalNode, EbnfTerminalNode, and EbnfLambdaNode.

bool EbnfNode::dfTraverse ( EbnfNodeAlgo & algo ) throw (EbnfNodeAlgoException) [virtual]
 

Generic depth-first traversal method. At each node, the () operator of the EbnfNodeAlgo object is invoked, with *this as argument. It returns true if the whole tree was traversed, and false if the traversal was interrupted due to a call to the () operator of the EbnfNodeAlgo object returning false.

Exceptions:
EbnfNodeAlgoException   if the algorithm failed for some reason.

Definition at line 46 of file ebnf_node.cc.

bool EbnfNode::rdfTraverse ( EbnfNodeAlgo & algo ) throw (EbnfNodeAlgoException) [virtual]
 

Generic depth-first reversed order traversal method. At each node, the () operator of the EbnfNodeAlgo object is invoked, with *this as argument. It returns true if the whole tree was traversed, and false if the traversal was interrupted due to a call to the () operator of the EbnfNodeAlgo object returning false.

The difference between this and dfTraverse is that here the () operator is called for the root before recurring to the children nodes. This is particularly useful for inherited attributes.

Exceptions:
EbnfNodeAlgoException   if the algorithm failed for some reason.

Definition at line 55 of file ebnf_node.cc.

const Position & EbnfNode::getPos ( ) const [inline]
 

Returns the position in the input file that corresponds to this node.

Definition at line 130 of file ebnf_node.hh.

Referenced by EbnfLl1CheckAlgo::operator()(), LRecDetectAlgo::operator()(), NontermFixAlgo::operator()(), and LaEpDeclWriter::operator()().

void EbnfNode::dump ( ostream & os ) const [pure virtual]
 

Reimplemented in EbnfOrNode, EbnfCatNode, EbnfStarNode, EbnfNonterminalNode, EbnfTerminalNode, and EbnfLambdaNode.

Referenced by ProductionSpec::dump(), EbnfStarNode::dump(), EbnfCatNode::dump(), and EbnfOrNode::dump().


Member Data Documentation

Position EbnfNode::pos [private]
 

The position in the input grammar file that is closest to where this node belongs.

Definition at line 144 of file ebnf_node.hh.


The documentation for this class was generated from the following files:
Generated at Tue Jul 9 21:06:33 2002 for CppCC by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001