KDevelop API Documentation

LLkParser Class Reference

An LL(k) parser. More...

#include <LLkParser.hpp>

Inheritance diagram for LLkParser:

Parser List of all members.

Public Member Functions

 LLkParser (const ParserSharedInputState &lexer, int k_)
 An LL(k) parser.

 LLkParser (TokenBuffer &tokenBuf, int k_)
 LLkParser (TokenStream &lexer, int k_)
virtual void consume ()
 Consume another token from the input stream.

virtual int LA (int i)
 Return the token type of the ith token of lookahead where i=1 is the current token being examined by the parser (i.e., it has not been matched yet).

virtual RefToken LT (int i)
 Return the i-th token of lookahead.

virtual void traceIn (const char *rname)
virtual void traceOut (const char *rname)

Protected Attributes

int k
 the lookahead this LL(k) parser is using.


Private Member Functions

void trace (const char *ee, const char *rname)

Detailed Description

An LL(k) parser.

See also:
antlr.Token

antlr.TokenBuffer

antlr.LL1Parser

Definition at line 24 of file LLkParser.hpp.


Constructor & Destructor Documentation

LLkParser::LLkParser const ParserSharedInputState state,
int  k_
 

An LL(k) parser.

See also:
antlr.Token

antlr.TokenBuffer

antlr.LL1Parser

Definition at line 26 of file LLkParser.cpp.

Referenced by LLkParser().

LLkParser::LLkParser TokenBuffer tokenBuf,
int  k_
 

Definition at line 31 of file LLkParser.cpp.

References LLkParser().

LLkParser::LLkParser TokenStream lexer,
int  k_
 

Definition at line 36 of file LLkParser.cpp.

References LLkParser().


Member Function Documentation

virtual void LLkParser::consume  )  [inline, virtual]
 

Consume another token from the input stream.

Can only write sequentially! If you need 3 tokens ahead, you must consume() 3 times.

Note that it is possible to overwrite tokens that have not been matched. For example, calling consume() 3 times when k=2, means that the first token consumed will be overwritten with the 3rd.

Implements Parser.

Definition at line 39 of file LLkParser.hpp.

virtual int LLkParser::LA int  i  )  [inline, virtual]
 

Return the token type of the ith token of lookahead where i=1 is the current token being examined by the parser (i.e., it has not been matched yet).

Implements Parser.

Definition at line 44 of file LLkParser.hpp.

virtual RefToken LLkParser::LT int  i  )  [inline, virtual]
 

Return the i-th token of lookahead.

Implements Parser.

Definition at line 49 of file LLkParser.hpp.

References RefToken.

Referenced by trace().

void LLkParser::trace const char *  ee,
const char *  rname
[private]
 

Definition at line 41 of file LLkParser.cpp.

References endl(), k, LT(), trace(), and Parser::traceIndent().

Referenced by trace(), traceIn(), and traceOut().

void LLkParser::traceIn const char *  rname  )  [virtual]
 

Reimplemented from Parser.

Definition at line 71 of file LLkParser.cpp.

References trace(), and traceIn().

Referenced by traceIn().

void LLkParser::traceOut const char *  rname  )  [virtual]
 

Reimplemented from Parser.

Definition at line 77 of file LLkParser.cpp.

References trace(), and traceOut().

Referenced by traceOut().


Member Data Documentation

int LLkParser::k [protected]
 

the lookahead this LL(k) parser is using.

Definition at line 55 of file LLkParser.hpp.

Referenced by trace().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for KDevelop Version 3.0.4.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Oct 19 08:02:04 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003