public class GroovyLangLexer
extends GroovyLexer
The lexer for Groovy programming language, which is based on the lexer generated by Antlr4
| Fields inherited from class | Fields |
|---|---|
class GroovyLexer |
DQ_GSTRING_MODE, StringLiteral, VOCABULARY, _ATN, _serializedATN, channelNames, modeNames, ruleNames, tokenNames |
| Constructor and description |
|---|
GroovyLangLexer(Reader reader) |
GroovyLangLexer(CharStream input) |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public Token |
nextToken()Returns the next token, with a special case for EOF after a bare $ in a GString. |
|
public void |
notifyListeners(LexerNoViableAltException e)Report a lexical error. |
|
public void |
recover(LexerNoViableAltException e)Abort lexing on the first lexical error. |
|
protected void |
rollbackOneChar() |
| Methods inherited from class | Name |
|---|---|
class GroovyLexer |
action, emit, enterParenCallback, exitParenCallback, getChannelNames, getErrorColumn, getErrorLine, getGrammarFileName, getModeNames, getRuleNames, getSerializedATN, getSyntaxErrorSource, getTokenNames, getVocabulary, handleComment, isErrorIgnored, popMode, rollbackOneChar, sempred, setErrorIgnored |
Returns the next token, with a special case for EOF after a bare $ in a GString.
After GStringBegin or GStringPart matches a trailing $ at the
end of input, Antlr marks _hitEOF and would skip
GSTRING_TYPE_SELECTOR_MODE entirely on the subsequent call. Detect that
situation and report the dollar-body error instead of a generic unexpected-EOF parse
failure.
Report a lexical error. When the failure is inside
GSTRING_TYPE_SELECTOR_MODE (after a $ in a GString), emit the
dedicated dollar-body diagnostic instead of Antlr's generic token-recognition message.
e - the recognition failure raised by the ATN simulator Abort lexing on the first lexical error. For an invalid character after $
in a GString, throw GroovySyntaxError so the parser layer can surface a
source-located syntax error without retrying SLL?LL or falling back to a generic
exception message.
e - the recognition failure raised by the ATN simulatorCopyright © 2003-2026 The Apache Software Foundation. All rights reserved.