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

EbnfLl1CheckAlgo Class Reference

Inheritance diagram for EbnfLl1CheckAlgo:

Inheritance graph
Collaboration diagram for EbnfLl1CheckAlgo:

Collaboration graph
List of all members.

Public Methods

 EbnfLl1CheckAlgo (ITokenSpec &tokens_, int globalLa_)
virtual bool operator() (EbnfNode &n) throw (EbnfNodeAlgoException)
void warn (const Position &pos, vBitset v)

Public Attributes

int globalLa
bool usesLa

Detailed Description

This is a "check-and-try-to-fix" algorithm. It inspects each node and, for choice nodes, it checks that the choice is LL(1). If not, it ensures that a LOOKAHEAD is present (by adding one if the user did not and the global lookahead is larger than 1). If nothing can be done to make the choice point decidable, it prints a warning about it.

Definition at line 562 of file

Constructor & Destructor Documentation

EbnfLl1CheckAlgo::EbnfLl1CheckAlgo ( ITokenSpec & tokens_,
int globalLa_ ) [inline]

Definition at line 566 of file

Member Function Documentation

bool EbnfLl1CheckAlgo::operator() ( EbnfNode & n ) throw (EbnfNodeAlgoException) [inline, virtual]

This gets called for each EBNF node during the traversal.

Reimplemented from EbnfNodeAlgo.

Definition at line 570 of file

void EbnfLl1CheckAlgo::warn ( const Position & pos,
vBitset v ) [inline]

Prints a warning saying taht at the given position an non LL(1) choice point with no lookahead was detected.

Definition at line 642 of file

Referenced by operator()().

Member Data Documentation

ITokenSpec & EbnfLl1CheckAlgo::tokens

The list of tokens (this is only used by the warn method to print out the common lookahead tokens.

Definition at line 658 of file

int EbnfLl1CheckAlgo::globalLa

The global lookahead's value.

Definition at line 663 of file

bool EbnfLl1CheckAlgo::usesLa

At the end of trversing all the trees of all the productions, this field is set to true if any lookahead larger than one was used at all. This is used for printing a warning if the OWN_STRINGS option was not set to true when lookaheads are used, because these two things dont go along with each other too well (the reason being that during the lookahead the internal scanner's buffer may be refilled making all the existing image pointers of the previously created token objects to indicate the wrong things, or, even worse, the buffer may be grown and reallocated which wil make all those pointers dangle).

Definition at line 676 of file

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