ANTLR Support Libraries 2.7.1+
|
#include <CharScanner.hpp>
Classes | |
class | Tracer |
Static Public Attributes | |
static const int | EOF_CHAR = EOF |
Protected Types | |
typedef RefToken(* | factory_type) () |
Protected Member Functions | |
virtual RefToken | makeToken (int t) |
Create a new RefToken of type t. | |
Protected Attributes | |
std::string | text |
bool | saveConsumedInput |
flag indicating wether consume saves characters | |
factory_type | tokenFactory |
Factory for tokens. | |
bool | caseSensitive |
Is this lexer case sensitive. | |
std ::map< std ::string, int, CharScannerLiteralsLess > | literals |
RefToken | _returnToken |
used to return tokens w/o using return val | |
LexerSharedInputState | inputState |
Input state, gives access to input stream, shared among different lexers. | |
bool | commitToPath |
int | tabsize |
tab size the scanner uses. | |
int | traceDepth |
Private Member Functions | |
CharScanner (const CharScanner &other) | |
CharScanner & | operator= (const CharScanner &other) |
Static Private Attributes | |
static const int | NO_CHAR = 0 |
Superclass of generated lexers
CharScanner::CharScanner | ( | InputBuffer & | cb, |
bool | case_sensitive ) |
CharScanner::CharScanner | ( | InputBuffer * | cb, |
bool | case_sensitive ) |
CharScanner::CharScanner | ( | const LexerSharedInputState & | state, |
bool | case_sensitive ) |
|
inlinevirtual |
|
private |
Consume chars until one matches the given set
Consume chars until one matches the given char
Get the column the scanner currently is in (starts at 1)
get the filename for the file currently used
|
inlinevirtual |
|
inlinevirtual |
Get the line the scanner currently is in (starts at 1)
|
inline |
Return the tabsize used by the scanner.
return a copy of the current text buffer
Create a new RefToken of type t.
Mark the current position and return a id for it.
See if input contains element from bitset b throw MismatchedCharException if not
See if input contains string 's' throw MismatchedCharException if not
See if input contains string 's' throw MismatchedCharException if not
See if input contains character 'c' throw MismatchedCharException if not.
See if input does not contain character 'c' throw MismatchedCharException if not
See if input contains character in range c1-c2 throw MismatchedCharException if not
Used to keep track of line breaks, needs to be called from within generated lexers when a
\r is encountered.
|
private |
|
inlinevirtual |
called by the generated lexer to do error recovery, override to customize the behaviour.
|
virtual |
Report exception errors caught in nextToken()
Parser error-reporting function can be overridden in subclass
Parser warning-reporting function can be overridden in subclass
Rewind the scanner to a previously marked position.
Set the filename the scanner is using (used in error messages)
|
inlinevirtual |
set the input state for the lexer.
|
inlinevirtual |
Set the factory for created tokens.
Advance the current column number by an appropriate amount according to the tabsize. This method needs to be explicitly called from the lexer rules encountering tabs.
|
inlinevirtual |
Test the text passed in against the literals table Override this method to perform a different literals test This is used primarily when you want to test a portion of a token
Test the token text against the literals table Override this method to perform a different literals test
Override this method to get more specific case handling.
|
virtual |
Methods used to change tracing behavior.
This method is called by YourLexer::nextToken() when the lexer has hit EOF condition. EOF is NOT a character. This method is not called if EOF is reached during syntactic predicate evaluation or during evaluation of normal lexical rules, which presumably would be an IOException. This traps the "normal" EOF condition.
uponEOF() is called after the complete evaluation of the previous token and only if your parser asks for another token beyond that last non-EOF token.
You might want to throw token or char stream exceptions like: "Heh, premature eof" or a retry stream exception ("I found the end of this file, go back to referencing file").
|
protected |
used to return tokens w/o using return val
|
protected |
Is this lexer case sensitive.
|
protected |
Used during filter mode to indicate that path is desired. A subsequent scan error will report an error as usual if acceptPath=true;
|
protected |
Input state, gives access to input stream, shared among different lexers.
|
protected |
|
protected |
flag indicating wether consume saves characters
|
protected |
tab size the scanner uses.
|
protected |
Text of current token
|
protected |
Factory for tokens.
|
protected |