Package org.apache.groovy.parser.antlr4
Class AbstractLexer
java.lang.Object
org.antlr.v4.runtime.Recognizer<Integer,org.antlr.v4.runtime.atn.LexerATNSimulator>
org.antlr.v4.runtime.Lexer
org.apache.groovy.parser.antlr4.AbstractLexer
- All Implemented Interfaces:
org.antlr.v4.runtime.TokenSource,SyntaxErrorReportable
- Direct Known Subclasses:
GroovyLexer
public abstract class AbstractLexer
extends org.antlr.v4.runtime.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.
-
Field Summary
Fields inherited from class org.antlr.v4.runtime.Lexer
_channel, _factory, _hitEOF, _input, _mode, _modeStack, _text, _token, _tokenFactorySourcePair, _tokenStartCharIndex, _tokenStartCharPositionInLine, _tokenStartLine, _type, DEFAULT_MODE, DEFAULT_TOKEN_CHANNEL, HIDDEN, MAX_CHAR_VALUE, MIN_CHAR_VALUE, MORE, SKIPFields inherited from class org.antlr.v4.runtime.Recognizer
_interp, EOFFields inherited from interface org.apache.groovy.parser.antlr4.SyntaxErrorReportable
NO_OFFSET -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetCharErrorDisplay(int c) Quoted diagnostic form of a code point.Methods inherited from class org.antlr.v4.runtime.Lexer
emit, emit, emitEOF, getAllTokens, getChannel, getChannelNames, getCharIndex, getCharPositionInLine, getErrorDisplay, getErrorDisplay, getInputStream, getLine, getModeNames, getSourceName, getText, getToken, getTokenFactory, getTokenNames, getType, mode, more, nextToken, notifyListeners, popMode, pushMode, recover, recover, reset, setChannel, setCharPositionInLine, setInputStream, setLine, setText, setToken, setTokenFactory, setType, skip, validateInputStreamMethods inherited from class org.antlr.v4.runtime.Recognizer
action, addErrorListener, getATN, getErrorHeader, getErrorListenerDispatch, getErrorListeners, getGrammarFileName, getInterpreter, getParseInfo, getRuleIndexMap, getRuleNames, getSerializedATN, getState, getTokenErrorDisplay, getTokenType, getTokenTypeMap, getVocabulary, precpred, removeErrorListener, removeErrorListeners, sempred, setInterpreter, setStateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.groovy.parser.antlr4.SyntaxErrorReportable
genPositionInfo, genPositionInfo, getErrorColumn, getErrorLine, getSyntaxErrorSource, require, require, require, require, require, require, throwSyntaxError, throwSyntaxError
-
Constructor Details
-
AbstractLexer
public AbstractLexer(org.antlr.v4.runtime.CharStream input)
-
-
Method Details
-
getCharErrorDisplay
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.- Overrides:
getCharErrorDisplayin classorg.antlr.v4.runtime.Lexer
-