public abstract class AbstractLexer
extends Lexer
implements SyntaxErrorReportable
Because antlr4 does not support generating lexer with specified interface, we have to create a super class for it and implement the interface.
Lexer-error-path helpers used from GroovyLexer.g4 actions also live
here so the grammar stays thin. Successful tokenisation never calls them.
Character display for diagnostics goes through getCharErrorDisplay(int)
so GString dollar errors and UNEXPECTED_CHAR share one escape policy.
| Fields inherited from class | Fields |
|---|---|
class Lexer |
DEFAULT_MODE, MORE, SKIP, DEFAULT_TOKEN_CHANNEL, HIDDEN, MIN_CHAR_VALUE, MAX_CHAR_VALUE, _input, _token, _tokenStartCharIndex, _tokenStartLine, _tokenStartCharPositionInLine, _hitEOF, _channel, _type, _modeStack, _mode, _text, EOF |
| Constructor and description |
|---|
AbstractLexer(CharStream input) |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public String |
getCharErrorDisplay(int c)Quoted diagnostic form of a code point. |
| Methods inherited from class | Name |
|---|---|
class Lexer |
action, addErrorListener, emit, emit, emitEOF, equals, getATN, getAllTokens, getChannel, getChannelNames, getCharErrorDisplay, getCharIndex, getCharPositionInLine, getClass, getErrorDisplay, getErrorDisplay, getErrorHeader, getErrorListenerDispatch, getErrorListeners, getGrammarFileName, getInputStream, getInputStream, getInterpreter, getLine, getModeNames, getParseInfo, getRuleIndexMap, getRuleNames, getSerializedATN, getSourceName, getState, getText, getToken, getTokenErrorDisplay, getTokenFactory, getTokenNames, getTokenType, getTokenTypeMap, getType, getVocabulary, hashCode, mode, more, nextToken, notify, notifyAll, notifyListeners, popMode, precpred, pushMode, recover, recover, removeErrorListener, removeErrorListeners, reset, sempred, setChannel, setCharPositionInLine, setInputStream, setInterpreter, setLine, setState, setText, setToken, setTokenFactory, setType, skip, toString, wait, wait, wait |
Quoted diagnostic form of a code point. Overrides ANTLR's UTF-16
(char) truncation and limited escapes so both unexpected-character
and GString-dollar messages can name invisible code points.
Copyright © 2003-2026 The Apache Software Foundation. All rights reserved.