ANTLR Support Libraries 2.7.1+
|
#include <LLkParser.hpp>
Public Member Functions | |
LLkParser (const ParserSharedInputState &lexer, int k_) | |
LLkParser (TokenBuffer &tokenBuf, int k_) | |
LLkParser (TokenStream &lexer, int k_) | |
virtual void | consume () |
virtual int | LA (unsigned int i) |
virtual RefToken | LT (unsigned int i) |
Return the i-th token of lookahead. More... | |
virtual void | traceIn (const char *rname) |
virtual void | traceOut (const char *rname) |
![]() | |
virtual | ~Parser () |
virtual void | setASTNodeFactory (ASTFactory *factory) |
virtual void | setASTFactory (ASTFactory *factory) |
virtual ASTFactory * | getASTFactory () |
virtual RefAST | getAST ()=0 |
virtual std ::string | getFilename () const |
Return the filename of the input file. More... | |
virtual void | setFilename (const std ::string &f) |
Set the filename of the input file (used for error reporting). More... | |
virtual void | setInputState (ParserSharedInputState state) |
virtual ParserSharedInputState | getInputState () const |
virtual void | consumeUntil (int tokenType) |
Consume tokens until one matches the given token. More... | |
virtual void | consumeUntil (const BitSet &set) |
Consume tokens until one matches the given token set. More... | |
virtual void | match (int t) |
virtual void | matchNot (int t) |
virtual void | match (const BitSet &b) |
virtual unsigned int | mark () |
virtual void | rewind (unsigned int pos) |
rewind to a previously marked position More... | |
virtual void | recover (const RecognitionException &ex, const BitSet &tokenSet) |
virtual void | reportError (const RecognitionException &ex) |
Parser error-reporting function can be overridden in subclass. More... | |
virtual void | reportError (const std ::string &s) |
Parser error-reporting function can be overridden in subclass. More... | |
virtual void | reportWarning (const std ::string &s) |
Parser warning-reporting function can be overridden in subclass. More... | |
virtual const char * | getTokenName (int num) const =0 |
get the token name for the token number 'num' More... | |
virtual const char *const * | getTokenNames () const =0 |
get a vector with all token names More... | |
virtual int | getNumTokens (void) const =0 |
virtual void | traceIndent () |
Protected Attributes | |
int | k |
the lookahead this LL(k) parser is using. More... | |
![]() | |
ParserSharedInputState | inputState |
ASTFactory * | astFactory |
AST support code; parser and treeparser delegate to this object. More... | |
int | traceDepth |
Private Member Functions | |
void | trace (const char *ee, const char *rname) |
Additional Inherited Members | |
![]() | |
Parser (TokenBuffer &input) | |
Parser (TokenBuffer *input) | |
Parser (const ParserSharedInputState &state) | |
An LL(k) parser.
LLkParser::LLkParser | ( | const ParserSharedInputState & | state, |
int | k_ | ||
) |
An LL(k) parser.
LLkParser::LLkParser | ( | TokenBuffer & | tokenBuf, |
int | k_ | ||
) |
LLkParser::LLkParser | ( | TokenStream & | lexer, |
int | k_ | ||
) |
|
inlinevirtual |
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.
|
inlinevirtual |
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.
|
inlinevirtual |
Return the i-th token of lookahead.
Implements Parser.
|
private |
|
virtual |
Reimplemented from Parser.
|
virtual |
Reimplemented from Parser.
|
protected |
the lookahead this LL(k) parser is using.