| Modifier and Type | Field and Description |
|---|---|
| public int | _channel
The channel number for the current token |
| protected TokenFactory | _factory
How to create token objects |
| public boolean | _hitEOF
Once we see EOF on char stream, next token will be EOF. |
| public CharStream | |
| public int | |
| public final IntegerStack | |
| public String | _text
You can set the text for the current token to override what is in the input char buffer. |
| public Token | _token
The goal of all lexer rules/methods is to create a token object. |
| protected Tuple2 | |
| public int | _tokenStartCharIndex
What character index in the stream did the current token start at? |
| public int | _tokenStartCharPositionInLine
The character position of first character within the line |
| public int | _tokenStartLine
The line on which the first character of the token resides |
| public int | _type
The token type for the current token |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public Token | |
| public Token | |
| public List | |
| public int | |
| public String[] | |
| public String | |
| public int | |
| public int | getCharPositionInLine()
Implements org. |
| public String | |
| public String | |
| public CharStream | getInputStream()
Implements abstract org. Implements org. CharStream from which this token source is currently
providing tokens.
|
| public int | getLine()
Implements org. |
| public String[] | |
| public String | getSourceName()
Implements org. |
| public String | |
| public Token | |
| public TokenFactory | getTokenFactory()
Implements org. TokenFactory this token source is currently using for
creating Token objects from the input.
|
| public String[] | getTokenNames()
Implements abstract org.
Deprecated
Used to print out token names like ID during debugging and
error reporting.
|
| public int | |
| public void | |
| public void | |
| public Token | nextToken()
Implements org. |
| public void | |
| public int | |
| public void | |
| public void | |
| public void | recover(RecognitionException re)
Lexers can normally match any char in it's vocabulary after matching a token, so do the easy thing and just kill a character and hope it all works out. |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | setTokenFactory(TokenFactory
The factory)TokenFactory to use for creating tokens.Implements org. TokenFactory this token source should use for creating
Token objects from the input.
|
| public void | |
| public void | skip()
Instruct the lexer to skip creating a token for current lexer rule and look for another token. |
| protected void |
| _channel | back to summary |
|---|---|
| public int _channel The channel number for the current token | |
| _factory | back to summary |
|---|---|
| protected TokenFactory _factory How to create token objects | |
| _hitEOF | back to summary |
|---|---|
| public boolean _hitEOF Once we see EOF on char stream, next token will be EOF. If you have DONE : EOF ; then you see DONE EOF. | |
| _input | back to summary |
|---|---|
| public CharStream _input | |
| _mode | back to summary |
|---|---|
| public int _mode | |
| _modeStack | back to summary |
|---|---|
| public final IntegerStack _modeStack | |
| _text | back to summary |
|---|---|
| public String _text You can set the text for the current token to override what is in the input char buffer. Use setText() or can set this instance var. | |
| _token | back to summary |
|---|---|
| public Token _token The goal of all lexer rules/methods is to create a token object. This is an instance variable as multiple rules may collaborate to create a single token. nextToken will return this object after matching lexer rule(s). If you subclass to allow multiple token emissions, then set this to the last token to be matched or something nonnull so that the auto token emit mechanism will not emit another token. | |
| _tokenFactorySourcePair | back to summary |
|---|---|
| protected Tuple2<? extends TokenSource, CharStream> _tokenFactorySourcePair | |
| _tokenStartCharIndex | back to summary |
|---|---|
| public int _tokenStartCharIndex What character index in the stream did the current token start at? Needed, for example, to get the text for current token. Set at the start of nextToken. | |
| _tokenStartCharPositionInLine | back to summary |
|---|---|
| public int _tokenStartCharPositionInLine The character position of first character within the line | |
| _tokenStartLine | back to summary |
|---|---|
| public int _tokenStartLine The line on which the first character of the token resides | |
| _type | back to summary |
|---|---|
| public int _type The token type for the current token | |
| DEFAULT_MODE | back to summary |
|---|---|
| public static final int DEFAULT_MODE | |
| DEFAULT_TOKEN_CHANNEL | back to summary |
|---|---|
| public static final int DEFAULT_TOKEN_CHANNEL | |
| HIDDEN | back to summary |
|---|---|
| public static final int HIDDEN | |
| MAX_CHAR_VALUE | back to summary |
|---|---|
| public static final int MAX_CHAR_VALUE | |
| MIN_CHAR_VALUE | back to summary |
|---|---|
| public static final int MIN_CHAR_VALUE | |
| MORE | back to summary |
|---|---|
| public static final int MORE | |
| SKIP | back to summary |
|---|---|
| public static final int SKIP | |
| Lexer | back to summary |
|---|---|
| public Lexer(CharStream input) | |
| emit | back to summary |
|---|---|
| public void emit(Token token) By default does not support multiple emits per nextToken invocation for efficiency reasons. Subclass and override this method, nextToken, and getToken (to push tokens into a list and pull from that list rather than a single variable as this implementation does). | |
| emit | back to summary |
|---|---|
| public Token emit() The standard method called to automatically emit a token at the outermost lexical rule. The token object should point into the char buffer start..stop. If there is a text override in 'text', use that to set the token's text. Override this method to emit custom Token objects or provide a new factory. | |
| emitEOF | back to summary |
|---|---|
| public Token emitEOF() | |
| getAllTokens | back to summary |
|---|---|
| public List Return a list of all Token objects in input char stream. Forces load of all tokens. Does not include EOF token. | |
| getChannel | back to summary |
|---|---|
| public int getChannel() | |
| getChannelNames | back to summary |
|---|---|
public String[] getChannelNames()
| |
| getCharErrorDisplay | back to summary |
|---|---|
| public String getCharErrorDisplay(int c) | |
| getCharIndex | back to summary |
|---|---|
| public int getCharIndex() What is the index of the current character of lookahead? | |
| getCharPositionInLine | back to summary |
|---|---|
| public int getCharPositionInLine() Implements org. Doc from org. Get the index into the current line for the current position in the input stream. The first character on a line has position 0.
| |
| getErrorDisplay | back to summary |
|---|---|
| public String getErrorDisplay(String s) | |
| getErrorDisplay | back to summary |
|---|---|
| public String getErrorDisplay(int c) | |
| getInputStream | back to summary |
|---|---|
| public CharStream getInputStream() Implements abstract org. Implements org. Doc from org. Get the
| |
| getLine | back to summary |
|---|---|
| public int getLine() Implements org. Doc from org. Get the line number for the current position in the input stream. The first line in the input is line 1.
| |
| getModeNames | back to summary |
|---|---|
public String[] getModeNames()
| |
| getSourceName | back to summary |
|---|---|
| public String getSourceName() Implements org. Doc from org. Gets the name of the underlying input source. This method returns a
non-null, non-empty string. If such a name is not known, this method
returns
| |
| getText | back to summary |
|---|---|
| public String getText() Return the text matched so far for the current token or any text override. | |
| getToken | back to summary |
|---|---|
| public Token getToken() Override if emitting multiple tokens. | |
| getTokenFactory | back to summary |
|---|---|
| public TokenFactory getTokenFactory() Implements org. Doc from org. Gets the
| |
| getTokenNames | back to summary |
|---|---|
| public String[] getTokenNames() Implements abstract org. Deprecated
Used to print out token names like ID during debugging and error reporting. The generated parsers implement a method that overrides this to point to their String[] tokenNames.
| |
| getType | back to summary |
|---|---|
| public int getType() | |
| mode | back to summary |
|---|---|
| public void mode(int m) | |
| more | back to summary |
|---|---|
| public void more() | |
| nextToken | back to summary |
|---|---|
| public Token nextToken() Implements org. Return a token from this source; i.e., match a token on the char stream.
| |
| notifyListeners | back to summary |
|---|---|
| public void notifyListeners(LexerNoViableAltException e) | |
| popMode | back to summary |
|---|---|
| public int popMode() | |
| pushMode | back to summary |
|---|---|
| public void pushMode(int m) | |
| recover | back to summary |
|---|---|
| public void recover(LexerNoViableAltException e) | |
| recover | back to summary |
|---|---|
| public void recover(RecognitionException re) Lexers can normally match any char in it's vocabulary after matching a token, so do the easy thing and just kill a character and hope it all works out. You can instead use the rule invocation stack to do sophisticated error recovery if you are in a fragment rule. | |
| reset | back to summary |
|---|---|
| public void reset() | |
| setChannel | back to summary |
|---|---|
| public void setChannel(int channel) | |
| setCharPositionInLine | back to summary |
|---|---|
| public void setCharPositionInLine(int charPositionInLine) | |
| setInputStream | back to summary |
|---|---|
| public void setInputStream(CharStream input) Set the char stream and reset the lexer | |
| setLine | back to summary |
|---|---|
| public void setLine(int line) | |
| setText | back to summary |
|---|---|
| public void setText(String text) Set the complete text of this token; it wipes any previous changes to the text. | |
| setToken | back to summary |
|---|---|
| public void setToken(Token _token) | |
| setTokenFactory | back to summary |
|---|---|
| public void setTokenFactory(TokenFactory factory) Implements org. Doc from org. Set the
| |
| setType | back to summary |
|---|---|
| public void setType(int ttype) | |
| skip | back to summary |
|---|---|
| public void skip() Instruct the lexer to skip creating a token for current lexer rule and look for another token. nextToken() knows to keep looking when a lexer rule finishes with token set to SKIP_TOKEN. Recall that if token==null at end of any token rule, it creates one for you and emits it. | |
| validateInputStream | back to summary |
|---|---|
| protected void validateInputStream(ATN atn, CharStream input) | |