#include <CharScanner.hpp>
Inheritance diagram for CharScanner:
Public Methods | |
CharScanner (InputBuffer &cb, bool case_sensitive) | |
CharScanner (InputBuffer *cb, bool case_sensitive) | |
CharScanner (const LexerSharedInputState &state, bool case_sensitive) | |
virtual | ~CharScanner () |
virtual int | LA (unsigned int i) |
virtual void | append (char c) |
virtual void | append (const ANTLR_USE_NAMESPACE(std) string &s) |
virtual void | commit () |
virtual void | consume () |
virtual void | consumeUntil (int c) |
virtual void | consumeUntil (const BitSet &set) |
virtual unsigned int | mark () |
Mark the current position and return a id for it. | |
virtual void | rewind (unsigned int pos) |
Rewind the scanner to a previously marked position. | |
virtual void | match (int c) |
See if input contains character 'c' throw MismatchedCharException if not. | |
virtual void | match (const BitSet &b) |
virtual void | match (const char *s) |
virtual void | match (const ANTLR_USE_NAMESPACE(std) string &s) |
virtual void | matchNot (int c) |
virtual void | matchRange (int c1, int c2) |
virtual bool | getCaseSensitive () const |
virtual void | setCaseSensitive (bool t) |
virtual bool | getCaseSensitiveLiterals () const=0 |
virtual int | getLine () const |
Get the line the scanner currently is in (starts at 1). | |
virtual void | setLine (int l) |
set the line number | |
virtual int | getColumn () const |
Get the column the scanner currently is in (starts at 1). | |
virtual void | setColumn (int c) |
set the column number | |
virtual const | ANTLR_USE_NAMESPACE (std) string &getFilename() const |
get the filename for the file currently used | |
virtual void | setFilename (const ANTLR_USE_NAMESPACE(std) string &f) |
Set the filename the scanner is using (used in error messages). | |
virtual bool | getCommitToPath () const |
virtual void | setCommitToPath (bool commit) |
virtual const | ANTLR_USE_NAMESPACE (std) string &getText() const |
virtual void | setText (const ANTLR_USE_NAMESPACE(std) string &s) |
virtual void | resetText () |
virtual RefToken | getTokenObject () const |
virtual void | newline () |
virtual void | tab () |
int | setTabsize (int size) |
set the tabsize. Returns the old tabsize | |
int | getTabSize () const |
Return the tabsize used by the scanner. | |
virtual void | panic () |
virtual void | panic (const ANTLR_USE_NAMESPACE(std) string &s) |
virtual void | reportError (const RecognitionException &e) |
virtual void | reportError (const ANTLR_USE_NAMESPACE(std) string &s) |
virtual void | reportWarning (const ANTLR_USE_NAMESPACE(std) string &s) |
virtual InputBuffer & | getInputBuffer () |
virtual LexerSharedInputState | getInputState () |
virtual void | setInputState (LexerSharedInputState state) |
virtual void | setTokenObjectFactory (factory_type factory) |
Set the factory for created tokens. | |
virtual int | testLiteralsTable (int ttype) const |
virtual int | testLiteralsTable (const ANTLR_USE_NAMESPACE(std) string &txt, int ttype) const |
virtual int | toLower (int c) const |
Override this method to get more specific case handling. | |
virtual void | uponEOF () |
virtual void | traceIndent () |
Methods used to change tracing behavior. | |
virtual void | traceIn (const char *rname) |
virtual void | traceOut (const char *rname) |
Static Public Attributes | |
const int | EOF_CHAR = EOF |
Protected Types | |
typedef RefToken(* | factory_type )() |
Protected Methods | |
ANTLR_USE_NAMESPACE (std) string text | |
ANTLR_USE_NAMESPACE (std) map< ANTLR_USE_NAMESPACE(std) string | |
virtual RefToken | makeToken (int t) |
Create a new RefToken of type t. | |
Protected Attributes | |
bool | saveConsumedInput |
factory_type | tokenFactory |
Factory for tokens. | |
bool | caseSensitive |
Is this lexer case sensitive. | |
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 |
|
|
|
|
|
|
|
|
|
|
|
|
|
Text of current token flag indicating wether consume saves characters |
|
return a copy of the current text buffer |
|
get the filename for the file currently used
|
|
|
|
|
|
|
|
|
|
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 line the scanner currently is in (starts at 1).
|
|
Return the tabsize used by the scanner.
|
|
|
|
|
|
Create a new RefToken of type t.
|
|
Mark the current position and return a id for it.
|
|
See if input contains string 's' throw MismatchedCharException if not
|
|
See if input contains string 's' throw MismatchedCharException if not
|
|
See if input contains element from bitset b 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 |
|
Terminate program using exit()
|
|
Terminate program using exit()
|
|
Parser error-reporting function can be overridden in subclass |
|
Report exception errors caught in nextToken() |
|
Parser warning-reporting function can be overridden in subclass |
|
|
|
Rewind the scanner to a previously marked position.
|
|
|
|
set the column number
|
|
|
|
Set the filename the scanner is using (used in error messages).
|
|
set the input state for the lexer.
|
|
set the line number
|
|
set the tabsize. Returns the old tabsize
|
|
|
|
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. |
|
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.
|
|
|
|
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"). |
|
used to return tokens w/o using return val
|
|
Is this lexer case sensitive.
|
|
Used during filter mode to indicate that path is desired. A subsequent scan error will report an error as usual if acceptPath=true; |
|
|
|
Input state, gives access to input stream, shared among different lexers.
|
|
|
|
|
|
|
|
tab size the scanner uses.
|
|
Factory for tokens.
|
|
|