Package org.apache.groovy.parser.antlr4

# Class GroovyLangLexer

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
org.apache.groovy.parser.antlr4.GroovyLexer
org.apache.groovy.parser.antlr4.GroovyLangLexer

All Implemented Interfaces:
  `org.antlr.v4.runtime.TokenSource`, `SyntaxErrorReportable`

public class GroovyLangLexer extends GroovyLexer
The lexer for Groovy programming language, which is based on the lexer generated by Antlr4

- ## Field Summary

  ### Fields inherited from class org.apache.groovy.parser.antlr4.GroovyLexer

  `_ATN, _serializedATN, ABSTRACT, ADD, ADD_ASSIGN, AND, AND_ASSIGN, ARROW, AS, ASSERT, ASSIGN, ASYNC, AT, AWAIT, BITAND, BITNOT, BITOR, BooleanLiteral, BREAK, BuiltInPrimitiveType, CapitalizedIdentifier, CASE, CATCH, channelNames, CLASS, COLON, COMMA, CONST, CONTINUE, DEC, DEF, DEFAULT, DEFER, DIV, DIV_ASSIGN, DO, DOLLAR_SLASHY_GSTRING_MODE, DOT, DQ_GSTRING_MODE, ELLIPSIS, ELSE, ELVIS, ELVIS_ASSIGN, ENUM, EQUAL, EXTENDS, FINAL, FINALLY, FloatingPointLiteral, FOR, GE, GOTO, GSTRING_PATH_MODE, GSTRING_TYPE_SELECTOR_MODE, GStringBegin, GStringEnd, GStringPart, GStringPathPart, GT, IDENTICAL, Identifier, IF, IMPLEMENTS, IMPLIES, IMPORT, IN, INC, INSTANCEOF, IntegerLiteral, INTERFACE, LBRACE, LBRACK, LE, LPAREN, LSHIFT_ASSIGN, LT, METHOD_POINTER, METHOD_REFERENCE, MOD, MOD_ASSIGN, modeNames, MODULE, MUL, MUL_ASSIGN, NATIVE, NEW, NL, NON_SEALED, NOT, NOT_IDENTICAL, NOT_IN, NOT_INSTANCEOF, NOTEQUAL, NullLiteral, OR, OR_ASSIGN, PACKAGE, PERMITS, POWER, POWER_ASSIGN, PRIVATE, PROTECTED, PUBLIC, QUESTION, RANGE_EXCLUSIVE_FULL, RANGE_EXCLUSIVE_LEFT, RANGE_EXCLUSIVE_RIGHT, RANGE_INCLUSIVE, RBRACE, RBRACK, RECORD, REGEX_FIND, REGEX_MATCH, RETURN, RollBackOne, RPAREN, RSHIFT_ASSIGN, ruleNames, SAFE_CHAIN_DOT, SAFE_DOT, SAFE_INDEX, SEALED, SEMI, SH_COMMENT, SLASHY_GSTRING_MODE, SPACESHIP, SPREAD_DOT, STATIC, STRICTFP, StringLiteral, SUB, SUB_ASSIGN, SUPER, SWITCH, SYNCHRONIZED, TDQ_GSTRING_MODE, THIS, THREADSAFE, THROW, THROWS, tokenNames, TRAIT, TRANSIENT, TRY, UNEXPECTED_CHAR, URSHIFT_ASSIGN, VAL, VAR, VOCABULARY, VOID, VOLATILE, WHILE, WS, XOR, XOR_ASSIGN, YIELD`

  ### 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, SKIP`

  ### Fields inherited from class org.antlr.v4.runtime.Recognizer

  `_interp, EOF`

  ### Fields inherited from interface org.apache.groovy.parser.antlr4.SyntaxErrorReportable

  `NO_OFFSET`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `GroovyLangLexer(Reader reader)`
  `GroovyLangLexer(org.antlr.v4.runtime.CharStream input)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `org.antlr.v4.runtime.Token`
  `nextToken()`
  Returns the next token, with a special case for EOF after a bare `$` in a GString.
  `void`
  `notifyListeners(org.antlr.v4.runtime.LexerNoViableAltException e)`
  Report a lexical error.
  `void`
  `recover(org.antlr.v4.runtime.LexerNoViableAltException e)`
  Abort lexing on the first lexical error.
  `protected void`
  `rollbackOneChar()`
  just a hook, which will be overrided by GroovyLangLexer

  ### Methods inherited from class org.apache.groovy.parser.antlr4.GroovyLexer

  `action, emit, enterParenCallback, exitParenCallback, getChannelNames, getErrorColumn, getErrorLine, getGrammarFileName, getModeNames, getRuleNames, getSerializedATN, getSyntaxErrorSource, getTokenNames, getVocabulary, handleComment, isErrorIgnored, popMode, sempred, setErrorIgnored`

  ### Methods inherited from class org.antlr.v4.runtime.Lexer

  `emit, emitEOF, getAllTokens, getChannel, getCharErrorDisplay, getCharIndex, getCharPositionInLine, getErrorDisplay, getErrorDisplay, getInputStream, getLine, getSourceName, getText, getToken, getTokenFactory, getType, mode, more, pushMode, recover, reset, setChannel, setCharPositionInLine, setInputStream, setLine, setText, setToken, setTokenFactory, setType, skip, validateInputStream`

  ### Methods inherited from class org.antlr.v4.runtime.Recognizer

  `addErrorListener, getATN, getErrorHeader, getErrorListenerDispatch, getErrorListeners, getInterpreter, getParseInfo, getRuleIndexMap, getState, getTokenErrorDisplay, getTokenType, getTokenTypeMap, precpred, removeErrorListener, removeErrorListeners, setInterpreter, setState`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface org.apache.groovy.parser.antlr4.SyntaxErrorReportable

  `genPositionInfo, genPositionInfo, require, require, require, require, require, require, throwSyntaxError, throwSyntaxError`

- ## Constructor Details

  - ### GroovyLangLexer

    public GroovyLangLexer(Reader reader) throws IOException
    Throws:
      `IOException`

  - ### GroovyLangLexer

    public GroovyLangLexer(org.antlr.v4.runtime.CharStream input)

- ## Method Details

  - ### nextToken

    public org.antlr.v4.runtime.Token nextToken()
    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 `GroovyLexer.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.

    Specified by:
      `nextToken` in interface `org.antlr.v4.runtime.TokenSource`
    Overrides:
      `nextToken` in class `org.antlr.v4.runtime.Lexer`
    Returns:
      the next token from the input

  - ### notifyListeners

    public void notifyListeners(org.antlr.v4.runtime.LexerNoViableAltException e)
    Report a lexical error. When the failure is inside `GroovyLexer.GSTRING_TYPE_SELECTOR_MODE` (after a `$` in a GString), emit the dedicated dollar-body diagnostic instead of Antlr's generic token-recognition message.
    Overrides:
      `notifyListeners` in class `org.antlr.v4.runtime.Lexer`
    Parameters:
      `e` - the recognition failure raised by the ATN simulator

  - ### recover

    public void recover(org.antlr.v4.runtime.LexerNoViableAltException e)
    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.
    Overrides:
      `recover` in class `org.antlr.v4.runtime.Lexer`
    Parameters:
      `e` - the recognition failure raised by the ATN simulator

  - ### rollbackOneChar

    protected void rollbackOneChar()
    Description copied from class: `GroovyLexer`
    just a hook, which will be overrided by GroovyLangLexer
    Overrides:
      `rollbackOneChar` in class `GroovyLexer`