Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Parser.hpp File Reference

#include <antlr/config.hpp>
#include <antlr/BitSet.hpp>
#include <antlr/TokenBuffer.hpp>
#include <antlr/RecognitionException.hpp>
#include <antlr/ASTFactory.hpp>
#include <antlr/ParserSharedInputState.hpp>
#include <exception>

Go to the source code of this file.

Compounds

class  Parser
class  Tracer

Variables

bool DEBUG_PARSER


Variable Documentation

bool DEBUG_PARSER  
 

A generic ANTLR parser (LL(k) for k>=1) containing a bunch of utility routines useful at any lookahead depth. We distinguish between the LL(1) and LL(k) parsers because of efficiency. This may not be necessary in the near future.

Each parser object contains the state of the parse including a lookahead cache (the form of which is determined by the subclass), whether or not the parser is in guess mode, where tokens come from, etc...

During guess mode, the current lookahead token(s) and token type(s) cache must be saved because the token stream may not have been informed to save the token (via mark) before the try block. Guessing is started by:

  1. saving the lookahead cache.
  2. marking the current position in the TokenBuffer.
  3. increasing the guessing level.
After guessing, the parser state is restored by:
  1. restoring the lookahead cache.
  2. rewinding the TokenBuffer.
  3. decreasing the guessing level.
See also:
antlr.Token , antlr.TokenBuffer , antlr.TokenStream , antlr.LL1Parser , antlr.LLkParser


Generated on Wed Nov 3 12:59:16 2004 for Lemur Toolkit by doxygen1.2.18