getLiteralName abstract method
Gets the string literal associated with a token type. The string returned by this method, when not null, can be used unaltered in a parser grammar to represent this token type.
The following table shows examples of lexer rules and the literal names assigned to the corresponding token types.
Rule | Literal Name | Java String Literal |
---|---|---|
{@code THIS : 'this';} | {@code 'this'} | {@code "'this'"} |
{@code SQUOTE : '\'';} | {@code '\''} | {@code "'\\''"} |
{@code ID : [A-Z]+;} | n/a | null |
@param tokenType The token type.
@return The string literal associated with the specified token type, or null if no string literal is associated with the type.
Implementation
String? getLiteralName(int tokenType);