Index

SymbolInfoCursor Class Reference

This class allows to navigate backwards or forwards through the symbols of a rule in order to get information about them. More...

#include "gsp__Symbol.h"


Public Functions

Private Functions

Private Variables

Friends


Detailed Description

This class allows to navigate backwards or forwards through the symbols of a rule in order to get information about them.

Information about symbols are contained within SymbolInfo objects.

An example of use is given in the implementation of the getPreviousSymbolInfo() method of base class Symbol:

Example:

 SymbolInfo Symbol::getPreviousSymbolInfo(const LLParser& parser) const
 {
   SymbolInfoCursor infoCursor(parent(), parser);
   infoCursor.prev();
   return infoCursor.getInfo();
 }


Functions Documentation

SymbolInfoCursor ( const Symbol & nonTerminal , const LLParser & parser 

Constructs a symbol information cursor pointing to the current parsed symbol (nonTerminal.getCurrentSymbolRank()) in the current parsed rule (nonTerminal.getCurrentRuleRank()) of the passed non-terminal.

See also:

Back to index

SymbolInfoCursor ( const Symbol & nonTerminal , const LLParser & parser , const unsigned long * uSymbolDescs   [  private  ] 

Constructs a symbol information cursor that allows to get information about symbols described by the passed list of symbol descriptions uSymbolDescs. It is assumed that the cursor is pointing just before the first symbol, i.e. next() must be called first to point to the first symbol.

This constructor is used internally by the generated code and is not intended for end-users.

nonTerminal is not relevant.

See also:

Back to index

~SymbolInfoCursor ( )   [  virtual  ] 

Destructor.

See also:

Back to index

bool next ( ) 

Moves the cursor to the next symbol in rule.

Returns true if the cursor could be moved successfully, false otherwise, i.e. if the current rule or symbol is invalid, or if the cursor was already positioned on the last symbol of the rule.

Information on the new current symbol can be obtained using the getInfo() method.

See also:

bool prev ( ) 
bool jump ( long lOffset 
SymbolInfo getInfo ( ) const 
Back to index

bool prev ( ) 

Moves the cursor to the previous symbol in rule.

Returns true if the cursor could be moved successfully, false otherwise, i.e. if the current rule or symbol is invalid, or if the cursor was already positioned on the first symbol of the rule.

Information on the new current symbol can be obtained using the getInfo() method.

See also:

bool next ( ) 
bool jump ( long lOffset 
SymbolInfo getInfo ( ) const 
Back to index

bool jump ( long lOffset 

Moves the cursor of the specified offset (negative or positive) in the rule.

Returns true if the cursor could be positioned on a valid symbol in the rule.

If the cursor would be positioned outside the valid range, the cursor is either put just before the first symbol or just after the last one, depending on respectively whether the new position would be negative or point beyond the last symbol of the rule. Returns false in all these cases.

Returns false if the current rule or symbol is invalid.

See also:

bool next ( ) 
bool prev ( ) 
SymbolInfo getInfo ( ) const 
Back to index

SymbolInfo getInfo ( ) const 

Returns in a SymbolInfo object the symbol information of the symbol on which is currently positioned the cursor.

Returns an invalid SymbolInfo object if the cursor is positioned on an invalid rule or an invalid symbol in the rule (outside valid position range).

See also:

bool next ( ) 
bool prev ( ) 
bool jump ( long lOffset 
Back to index


Generated with makedoc.