#include <Parser.hpp>
Inheritance diagram for Parser:
Public Methods | |
virtual | ~Parser () |
virtual int | LA (unsigned int i)=0 |
virtual RefToken | LT (unsigned int i)=0 |
Return the i-th token of lookahead. | |
virtual void | setASTNodeFactory (ASTFactory *factory) |
virtual void | setASTFactory (ASTFactory *factory) |
virtual ASTFactory * | getASTFactory () |
virtual RefAST | getAST () |
virtual | ANTLR_USE_NAMESPACE (std) string getFilename() const |
Return the filename of the input file. | |
virtual void | setFilename (const ANTLR_USE_NAMESPACE(std) string &f) |
Set the filename of the input file (used for error reporting). | |
virtual void | setInputState (ParserSharedInputState state) |
virtual ParserSharedInputState | getInputState () const |
virtual void | consume ()=0 |
Get another token object from the token stream. | |
virtual void | consumeUntil (int tokenType) |
Consume tokens until one matches the given token. | |
virtual void | consumeUntil (const BitSet &set) |
Consume tokens until one matches the given token set. | |
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 | |
virtual void | reportError (const RecognitionException &ex) |
Parser error-reporting function can be overridden in subclass. | |
virtual void | reportError (const ANTLR_USE_NAMESPACE(std) string &s) |
Parser error-reporting function can be overridden in subclass. | |
virtual void | reportWarning (const ANTLR_USE_NAMESPACE(std) string &s) |
Parser warning-reporting function can be overridden in subclass. | |
virtual void | panic () |
virtual const char * | getTokenName (int num) const=0 |
get the token name for the token number 'num' | |
virtual const char *const * | getTokenNames () const=0 |
get a vector with all token names | |
virtual int | getNumTokens (void) const=0 |
virtual void | traceIndent () |
virtual void | traceIn (const char *rname) |
virtual void | traceOut (const char *rname) |
Parser () | |
virtual | ~Parser () |
virtual void | parse (const string &filename) |
virtual void | parseFile (const string &filename)=0 |
virtual void | parseBuffer (char *buf, int len)=0 |
Parse a buffer. | |
virtual void | setAcroList (const WordSet *acronyms) |
virtual void | setAcroList (string filename) |
Set the acronym list from this file. | |
virtual long | fileTell () const=0 |
return the current byte position of the file being parsed | |
virtual long | getDocBytePos () const |
return the byte position at the beginning of the current document | |
virtual const string | getParseFile () const |
return the name of the file being parsed | |
Static Public Attributes | |
const string | category = "Parser" |
const string | identifier = "parser" |
Protected Methods | |
Parser (TokenBuffer &input_) | |
Parser (TokenBuffer *input_) | |
Parser (const ParserSharedInputState &state) | |
bool | isAcronym (const char *word) |
void | clearAcros () |
clears internal acronym list | |
Protected Attributes | |
ParserSharedInputState | inputState |
ASTFactory * | astFactory |
AST support code; parser and treeparser delegate to this object. | |
int | traceDepth |
long | docpos |
string | parsefile |
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:
|
|
|
|
|
|
|
|
|
|
|
|
|
Return the filename of the input file.
|
|
clears internal acronym list
|
|
Get another token object from the token stream.
Implemented in LLkParser. |
|
Consume tokens until one matches the given token set. Consume tokens until one matches the given token set |
|
Consume tokens until one matches the given token. Consume tokens until one matches the given token |
|
return the current byte position of the file being parsed
Implemented in ArabicParser, BrillPOSParser, ChineseCharParser, ChineseParser, IdentifinderParser, InqArabicParser, InQueryOpParser, ReutersParser, TrecParser, and WebParser. |
|
Get the root AST node of the generated AST. When using a custom AST type or heterogenous AST's, you'll have to convert it to the right type yourself. |
|
Return a pointer to the ASTFactory used. So you might use it in subsequent treewalkers or to reload AST's from disk. |
|
return the byte position at the beginning of the current document
|
|
|
|
Get the number of tokens defined. This one should be overridden in subclasses. |
|
return the name of the file being parsed
|
|
get the token name for the token number 'num'
|
|
get a vector with all token names
|
|
Checks to see if the word is in the acronym list. Returns false if the list is not set. |
|
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). Implemented in LLkParser. |
|
Return the i-th token of lookahead.
Implemented in LLkParser. |
|
Mark a spot in the input and return the position. Forwarded to TokenBuffer. |
|
Make sure current lookahead symbol matches the given set Throw an exception upon mismatch, which is catch by either the error handler or by the syntactic predicate. |
|
Make sure current lookahead symbol matches token type |
|
|
|
Give panic message and exit the program. can be overridden in subclass
|
|
Parse a file. use parseFile. this method will be deprecated in future |
|
Parse a buffer.
Implemented in ArabicParser, BrillPOSParser, ChineseCharParser, ChineseParser, IdentifinderParser, InqArabicParser, InQueryOpParser, ReutersParser, TrecParser, and WebParser. |
|
Parse a file. implementing subclasses should set parsefile string Implemented in ArabicParser, BrillPOSParser, ChineseCharParser, ChineseParser, IdentifinderParser, InqArabicParser, InQueryOpParser, ReutersParser, TrecParser, and WebParser. |
|
Parser error-reporting function can be overridden in subclass. Parser error-reporting function can be overridden in subclass |
|
Parser error-reporting function can be overridden in subclass. Parser error-reporting function can be overridden in subclass |
|
Parser warning-reporting function can be overridden in subclass. Parser warning-reporting function can be overridden in subclass |
|
rewind to a previously marked position
|
|
Set the acronym list from this file.
|
|
Set the acronym list. Can be an empty implementation if the parser is not designed to deal with acronyms by using a list. WordSet still belongs to the caller |
|
Specify the factory to be used during tree building. (Compulsory) Setting the factory is nowadays compulsory. |
|
DEPRECATED! Specify the factory to be used during tree building. (Compulsory) Setting the factory is nowadays compulsory.
|
|
Set the filename of the input file (used for error reporting).
|
|
|
|
Reimplemented in LLkParser. |
|
Set or change the input token buffer |
|
Reimplemented in LLkParser. |
|
AST support code; parser and treeparser delegate to this object.
|
|
Reimplemented from TextHandler. |
|
|
|
Reimplemented from TextHandler. Reimplemented in ArabicParser, BrillPOSParser, ChineseCharParser, ChineseParser, IdentifinderParser, InqArabicParser, InQueryOpParser, ReutersParser, TrecParser, and WebParser. |
|
|
|
|
|
|