antlr
public abstract class CharScanner extends Object implements TokenStream
| Field Summary | |
|---|---|
| protected boolean | caseSensitive |
| protected boolean | caseSensitiveLiterals |
| protected boolean | commitToPath Used during filter mode to indicate that path is desired.
|
| static char | EOF_CHAR |
| protected ANTLRHashString | hashString |
| protected LexerSharedInputState | inputState |
| protected Hashtable | literals |
| static char | NO_CHAR |
| protected boolean | saveConsumedInput |
| protected int | tabsize Tab chars are handled by tab() according to this value; override
method to do anything weird with tabs. |
| protected ANTLRStringBuffer | text |
| protected Class | tokenObjectClass |
| protected int | traceDepth Used to keep track of indentdepth for traceIn/Out |
| protected Token | _returnToken |
| Constructor Summary | |
|---|---|
| CharScanner() | |
| CharScanner(InputBuffer cb) | |
| CharScanner(LexerSharedInputState sharedState) | |
| Method Summary | |
|---|---|
| void | append(char c) |
| void | append(String s) |
| void | commit() |
| void | consume() |
| void | consumeUntil(int c) Consume chars until one matches the given char |
| void | consumeUntil(BitSet set) Consume chars until one matches the given set |
| boolean | getCaseSensitive() |
| boolean | getCaseSensitiveLiterals() |
| int | getColumn() |
| boolean | getCommitToPath() |
| String | getFilename() |
| InputBuffer | getInputBuffer() |
| LexerSharedInputState | getInputState() |
| int | getLine() |
| int | getTabSize() |
| String | getText() return a copy of the current text buffer |
| Token | getTokenObject() |
| char | LA(int i) |
| protected Token | makeToken(int t) |
| int | mark() |
| void | match(char c) |
| void | match(BitSet b) |
| void | match(String s) |
| void | matchNot(char c) |
| void | matchRange(char c1, char c2) |
| void | newline() |
| void | panic() |
| void | panic(String s) This method is executed by ANTLR internally when it detected an illegal
state that cannot be recovered from.
|
| void | reportError(RecognitionException ex) Parser error-reporting function can be overridden in subclass |
| void | reportError(String s) Parser error-reporting function can be overridden in subclass |
| void | reportWarning(String s) Parser warning-reporting function can be overridden in subclass |
| void | resetText() |
| void | rewind(int pos) |
| void | setCaseSensitive(boolean t) |
| void | setColumn(int c) |
| void | setCommitToPath(boolean commit) |
| void | setFilename(String f) |
| void | setInputState(LexerSharedInputState state) |
| void | setLine(int line) |
| void | setTabSize(int size) |
| void | setText(String s) |
| void | setTokenObjectClass(String cl) |
| void | tab() advance the current column number by an appropriate amount
according to tab size. |
| int | testLiteralsTable(int ttype) |
| int | testLiteralsTable(String text, int ttype) 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. |
| char | toLower(char c) |
| void | traceIn(String rname) |
| void | traceIndent() |
| void | traceOut(String rname) |
| void | uponEOF() This method is called by YourLexer.nextToken() when the lexer has
hit EOF condition. |
See Also: panic
java.lang.System.exit(int) and writes directly to
java.lang.System.err) , which is usually not appropriate when
a translator is embedded into a larger application. It is highly
recommended that this method be overridden to handle the error in a
way appropriate for your application (e.g. throw an unchecked
exception).