Top Description Fields Constructors Methods
org.antlr.v4.tool

public final Enum ErrorType

extends Enum<ErrorType>
Class Inheritance
Imports
org.antlr.v4.Tool, org.antlr.v4.runtime.Lexer

A complex enumeration of all the error messages that the tool can issue.

When adding error messages, also add a description of the message to the Wiki with a location under the Wiki page Errors Reported by the ANTLR Tool.

Author
Jim Idle <[email protected]>, Terence Parr
Since
4.0

Field Summary

Modifier and TypeField and Description
public static final ErrorType
ACTION_REDEFINITION

Compiler Error 94.

public static final ErrorType
ALL_OPS_NEED_SAME_ASSOC

Compiler Warning 118.

public static final ErrorType
ALT_LABEL_CONFLICTS_WITH_RULE

Compiler Error 124.

public static final ErrorType
ALT_LABEL_REDEF

Compiler Error 123.

public static final ErrorType
ARG_CONFLICTS_WITH_RULE

Compiler Error 138.

public static final ErrorType
ARG_CONFLICTS_WITH_TOKEN

Compiler Error 139.

public static final ErrorType
ASSIGNMENT_TO_LIST_LABEL

Compiler Error 135.

public static final ErrorType
ATTRIBUTE_IN_LEXER_ACTION

Compiler Error 128.

public static final ErrorType
BAD_OPTION_SET_SYNTAX

Compiler Error 9.

public static final ErrorType
public static final ErrorType
public static final ErrorType
CANNOT_FIND_IMPORTED_GRAMMAR

Compiler Error 110.

public static final ErrorType
public static final ErrorType
public static final ErrorType
CANNOT_OPEN_FILE

Compiler Error 7.

public static final ErrorType
CANNOT_WRITE_FILE

Compiler Error 1.

public static final ErrorType
public static final ErrorType
CHANNEL_CONFLICTS_WITH_MODE

Compiler Error 162.

public static final ErrorType
CHANNEL_CONFLICTS_WITH_TOKEN

Compiler Error 161.

public static final ErrorType
public static final ErrorType
public static final ErrorType
CHARACTERS_COLLISION_IN_SET

Compiler Warning 180.

public final int
code

The error or warning number.

public static final ErrorType
public static final ErrorType
CODE_TEMPLATE_ARG_ISSUE

Compiler Error 32.

public static final ErrorType
public static final ErrorType
public static final ErrorType
public static final ErrorType
DIR_NOT_FOUND

Compiler Error 5.

public static final ErrorType
public static final ErrorType
public static final ErrorType
EOF_CLOSURE

rule rule contains a closure with at least one alternative that can match EOF

A rule contains a closure ((...)*) or positive closure ((...)+) around EOF.

public static final ErrorType
EPSILON_CLOSURE

Compiler Error 153.

public static final ErrorType
EPSILON_LR_FOLLOW

Compiler Error 148.

public static final ErrorType
EPSILON_OPTIONAL

Compiler Warning 154.

public static final ErrorType
EPSILON_TOKEN

Compiler Warning 146.

public static final ErrorType
public static final ErrorType
ERROR_READING_TOKENS_FILE

Compiler Error 4.

public static final ErrorType
public static final ErrorType
public static final ErrorType
FRAGMENT_ACTION_IGNORED

Compiler Warning 158.

public static final ErrorType
ILLEGAL_OPTION

Compiler Warning 83.

public static final ErrorType
ILLEGAL_OPTION_VALUE

Compiler Warning 84.

public static final ErrorType
IMPLICIT_STRING_DEFINITION

Compiler Error 126.

public static final ErrorType
IMPLICIT_TOKEN_DEFINITION

Compiler Warning 125.

public static final ErrorType
IMPORT_NAME_CLASH

Compiler Error 113.

public static final ErrorType
public static final ErrorType
public static final ErrorType
INTERNAL_ERROR

Compiler Error 20.

public static final ErrorType
INVALID_CMDLINE_ARG

Compiler Error 2.

public static final ErrorType
INVALID_ESCAPE_SEQUENCE

Compiler Error 156.

public static final ErrorType
INVALID_IMPORT

Compiler Error 111.

public static final ErrorType
INVALID_LEXER_COMMAND

Compiler Error 149.

public static final ErrorType
INVALID_LITERAL_IN_LEXER_SET

Compiler Error 144.

public static final ErrorType
INVALID_RULE_PARAMETER_REF

Compiler Error 64.

public static final ErrorType
ISOLATED_RULE_REF

Compiler Error 67.

public static final ErrorType
LABEL_BLOCK_NOT_A_SET

Compiler Error 130.

public static final ErrorType
LABEL_CONFLICTS_WITH_ARG

Compiler Error 72.

public static final ErrorType
LABEL_CONFLICTS_WITH_LOCAL

Compiler Error 74.

public static final ErrorType
LABEL_CONFLICTS_WITH_RETVAL

Compiler Error 73.

public static final ErrorType
LABEL_CONFLICTS_WITH_RULE

Compiler Error 69.

public static final ErrorType
LABEL_CONFLICTS_WITH_TOKEN

Compiler Error 70.

public static final ErrorType
LABEL_TYPE_CONFLICT

Compiler Error 75.

public static final ErrorType
LEFT_RECURSION_CYCLES

Compiler Error 119.

public static final ErrorType
LEXER_ACTION_PLACEMENT_ISSUE

Compiler Error 132.

public static final ErrorType
LEXER_COMMAND_PLACEMENT_ISSUE

Compiler Error 133.

public static final ErrorType
LEXER_RULES_NOT_ALLOWED

Compiler Error 52.

public static final ErrorType
LOCAL_CONFLICTS_WITH_ARG

Compiler Error 142.

public static final ErrorType
LOCAL_CONFLICTS_WITH_RETVAL

Compiler Error 143.

public static final ErrorType
LOCAL_CONFLICTS_WITH_RULE

Compiler Error 140.

public static final ErrorType
LOCAL_CONFLICTS_WITH_TOKEN

Compiler Error 141.

public static final ErrorType
MISSING_CODE_GEN_TEMPLATES

Compiler Error 30.

public static final ErrorType
MISSING_LEXER_COMMAND_ARGUMENT

Compiler Error 150.

public static final ErrorType
MISSING_RULE_ARGS

Compiler Error 79.

public static final ErrorType
public static final ErrorType
MODE_CONFLICTS_WITH_TOKEN

Compiler Error 170.

public static final ErrorType
MODE_NOT_IN_LEXER

Compiler Error 120.

public static final ErrorType
MODE_WITHOUT_RULES

Compiler Error 145.

public final String
msg

The error or warning message, in StringTemplate 4 format using < and > as the delimiters.

public static final ErrorType
NO_MODEL_TO_TEMPLATE_MAPPING

Compiler Error 34.

public static final ErrorType
NO_NON_LR_ALTS

Compiler Error 147.

public static final ErrorType
NO_RULES

Compiler Error 99.

public static final ErrorType
NO_SUCH_GRAMMAR_SCOPE

Compiler Error 105.

public static final ErrorType
NO_SUCH_RULE_IN_SCOPE

Compiler Error 106.

public static final ErrorType
public static final ErrorType
OPTIONS_IN_DELEGATE

Compiler Warning 109.

public static final ErrorType
OUTPUT_DIR_IS_FILE

Compiler Error 6.

public static final ErrorType
PARSER_RULE_REF_IN_LEXER_RULE

Compiler Error 160.

public static final ErrorType
PARSER_RULES_NOT_ALLOWED

Compiler Error 53.

public static final ErrorType
RANGE_PROBABLY_CONTAINS_NOT_IMPLIED_CHARACTERS

Range probably contains not implied characters.

public static final ErrorType
REDUNDANT_CASE_INSENSITIVE_LEXER_RULE_OPTION

Redundant caseInsensitive lexer rule option

options { caseInsensitive=true; }
TOKEN options { caseInsensitive=true; } : [a-z]+ -> caseInsensitive(true); // warning
public static final ErrorType
REPEATED_PREQUEL

Compiler Error 54.

public static final ErrorType
RESERVED_RULE_NAME

Compiler Error 159.

public static final ErrorType
RETVAL_CONFLICTS_WITH_ARG

Compiler Error 76.

public static final ErrorType
RETVAL_CONFLICTS_WITH_RULE

Compiler Error 136.

public static final ErrorType
RETVAL_CONFLICTS_WITH_TOKEN

Compiler Error 137.

public static final ErrorType
RULE_HAS_NO_ARGS

Compiler Error 80.

public static final ErrorType
RULE_REDEFINITION

Compiler Error 51.

public static final ErrorType
RULE_WITH_TOO_FEW_ALT_LABELS

Compiler Error 122.

public final ErrorSeverity
severity

The error severity.

public static final ErrorType
STRING_TEMPLATE_WARNING

Compiler Warning 22.

public static final ErrorType
SYNTAX_ERROR

Compiler Error 50.

public static final ErrorType
public static final ErrorType
TOKEN_NAME_REASSIGNMENT

Compiler Warning 108.

public static final ErrorType
TOKEN_NAMES_MUST_START_UPPER

Compiler Error 60.

public static final ErrorType
TOKEN_RANGE_IN_PARSER

Compiler Warning 181

The token range operator makes no sense in the parser as token types are not ordered (except in implementation).

public static final ErrorType
TOKEN_UNREACHABLE

Compiler Warning 184.

public static final ErrorType
TOKENS_FILE_SYNTAX_ERROR

Compiler Error 21.

public static final ErrorType
public static final ErrorType
UNDEFINED_RULE_REF

Compiler Error 56.

public static final ErrorType
public static final ErrorType
UNKNOWN_ATTRIBUTE_IN_SCOPE

Compiler Error 66.

public static final ErrorType
UNKNOWN_LEXER_CONSTANT

Compiler Warning 155.

public static final ErrorType
UNKNOWN_RULE_ATTRIBUTE

Compiler Error 65.

public static final ErrorType
UNKNOWN_SIMPLE_ATTRIBUTE

Compiler Error 63.

public static final ErrorType
UNRECOGNIZED_ASSOC_OPTION

Compiler Warning 157.

public static final ErrorType
public static final ErrorType
UNTERMINATED_STRING_LITERAL

Compiler Error 152.

public static final ErrorType
public static final ErrorType
USE_OF_BAD_WORD

Compiler Error 134.

public static final ErrorType
V3_ASSIGN_IN_TOKENS

Compiler Error 203.

public static final ErrorType
V3_GATED_SEMPRED

Compiler Warning 204.

public static final ErrorType
V3_LEXER_LABEL

Compiler Warning 201.

public static final ErrorType
V3_SYNPRED

Compiler Error 205.

public static final ErrorType
V3_TOKENS_SYNTAX

Compiler Warning 202.

public static final ErrorType
V3_TREE_GRAMMAR

Compiler Error 200.

public static final ErrorType
WARNING_TREATED_AS_ERROR

Compiler Error 10.

Constructor Summary

AccessConstructor and Description
private
ErrorType(int
The unique error number.
code
,
String
The error message template.
msg
,
ErrorSeverity
The error severity.
severity
)

Constructs a new ErrorType with the specified code, message, and severity.

Method Summary

Modifier and TypeMethod and Description
public static ErrorType
public static ErrorType[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

ACTION_REDEFINITIONback to summary
public static final ErrorType ACTION_REDEFINITION

Compiler Error 94.

redefinition of action action

ALL_OPS_NEED_SAME_ASSOCback to summary
public static final ErrorType ALL_OPS_NEED_SAME_ASSOC

Deprecated

This warning is no longer applicable with the current syntax for specifying associativity.

Compiler Warning 118.

all operators of alt alt of left-recursive rule must have same associativity

Annotations
@Deprecated
ALT_LABEL_CONFLICTS_WITH_RULEback to summary
public static final ErrorType ALT_LABEL_CONFLICTS_WITH_RULE

Compiler Error 124.

rule alt label label conflicts with rule rule

ALT_LABEL_REDEFback to summary
public static final ErrorType ALT_LABEL_REDEF

Compiler Error 123.

rule alt label label redefined in rule rule1, originally in rule rule2

ARG_CONFLICTS_WITH_RULEback to summary
public static final ErrorType ARG_CONFLICTS_WITH_RULE

Compiler Error 138.

parameter parameter conflicts with rule with same name

ARG_CONFLICTS_WITH_TOKENback to summary
public static final ErrorType ARG_CONFLICTS_WITH_TOKEN

Compiler Error 139.

parameter parameter conflicts with token with same name

ASSIGNMENT_TO_LIST_LABELback to summary
public static final ErrorType ASSIGNMENT_TO_LIST_LABEL

Compiler Error 135.

cannot assign a value to list label label

ATTRIBUTE_IN_LEXER_ACTIONback to summary
public static final ErrorType ATTRIBUTE_IN_LEXER_ACTION

Compiler Error 128.

attribute references not allowed in lexer actions: expression

BAD_OPTION_SET_SYNTAXback to summary
public static final ErrorType BAD_OPTION_SET_SYNTAX

Compiler Error 9.

invalid -Dname=value syntax: syntax

CANNOT_CREATE_TARGET_GENERATORback to summary
public static final ErrorType CANNOT_CREATE_TARGET_GENERATOR

Compiler Error 31.

ANTLR cannot generate language code as of version version

CANNOT_FIND_ATTRIBUTE_NAME_IN_DECLback to summary
public static final ErrorType CANNOT_FIND_ATTRIBUTE_NAME_IN_DECL

Compiler Error 121.

cannot find an attribute name in attribute declaration

CANNOT_FIND_IMPORTED_GRAMMARback to summary
public static final ErrorType CANNOT_FIND_IMPORTED_GRAMMAR

Compiler Error 110.

can't find or load grammar grammar from filename

CANNOT_FIND_TOKENS_FILE_GIVEN_ON_CMDLINEback to summary
public static final ErrorType CANNOT_FIND_TOKENS_FILE_GIVEN_ON_CMDLINE

Compiler Error 3.

cannot find tokens file filename

CANNOT_FIND_TOKENS_FILE_REFD_IN_GRAMMARback to summary
public static final ErrorType CANNOT_FIND_TOKENS_FILE_REFD_IN_GRAMMAR

Compiler Error 114.

cannot find tokens file filename

CANNOT_OPEN_FILEback to summary
public static final ErrorType CANNOT_OPEN_FILE

Compiler Error 7.

cannot find or open file: filename

CANNOT_WRITE_FILEback to summary
public static final ErrorType CANNOT_WRITE_FILE

Compiler Error 1.

cannot write file filename: reason

CHANNEL_CONFLICTS_WITH_COMMON_CONSTANTSback to summary
public static final ErrorType CHANNEL_CONFLICTS_WITH_COMMON_CONSTANTS

Compiler Error 172.

can not use or declare channel with reserved name

Reserved names: DEFAULT_MODE, SKIP, MORE, EOF, MAX_CHAR_VALUE, MIN_CHAR_VALUE.

Can be used but cannot be declared: HIDDEN, DEFAULT_TOKEN_CHANNEL

CHANNEL_CONFLICTS_WITH_MODEback to summary
public static final ErrorType CHANNEL_CONFLICTS_WITH_MODE

Compiler Error 162.

channel name conflicts with mode with same name

CHANNEL_CONFLICTS_WITH_TOKENback to summary
public static final ErrorType CHANNEL_CONFLICTS_WITH_TOKEN

Compiler Error 161.

channel name conflicts with token with same name

CHANNELS_BLOCK_IN_COMBINED_GRAMMARback to summary
public static final ErrorType CHANNELS_BLOCK_IN_COMBINED_GRAMMAR

Compiler Error 164.

custom channels are not supported in combined grammars

CHANNELS_BLOCK_IN_PARSER_GRAMMARback to summary
public static final ErrorType CHANNELS_BLOCK_IN_PARSER_GRAMMAR

Compiler Error 163.

custom channels are not supported in parser grammars

CHARACTERS_COLLISION_IN_SETback to summary
public static final ErrorType CHARACTERS_COLLISION_IN_SET

Compiler Warning 180.

chars "a-f" used multiple times in set [a-fc-m]

A:    [aa-z];   // warning
B:    [a-fc-m]; // warning
TODO: Does not work with fragment rules.
codeback to summary
public final int code

The error or warning number.

The code should be unique, and following its use in a release should not be altered or reassigned.

CODE_GEN_TEMPLATES_INCOMPLETEback to summary
public static final ErrorType CODE_GEN_TEMPLATES_INCOMPLETE

Compiler Error 33.

missing code generation template template

CODE_TEMPLATE_ARG_ISSUEback to summary
public static final ErrorType CODE_TEMPLATE_ARG_ISSUE

Compiler Error 32.

code generation template template has missing, misnamed, or incomplete arg list; missing field

CONSTANT_VALUE_IS_NOT_A_RECOGNIZED_CHANNEL_NAMEback to summary
public static final ErrorType CONSTANT_VALUE_IS_NOT_A_RECOGNIZED_CHANNEL_NAME

Compiler Error 177.

name is not a recognized channel name

TOKEN: 'a' -> channel(TOKEN1); // error 177
CONSTANT_VALUE_IS_NOT_A_RECOGNIZED_MODE_NAMEback to summary
public static final ErrorType CONSTANT_VALUE_IS_NOT_A_RECOGNIZED_MODE_NAME

Compiler Error 176.

nameis not a recognized mode name

TOKEN: 'a' -> mode(MODE1); // error 176
CONSTANT_VALUE_IS_NOT_A_RECOGNIZED_TOKEN_NAMEback to summary
public static final ErrorType CONSTANT_VALUE_IS_NOT_A_RECOGNIZED_TOKEN_NAME

Compiler Error 175.

name is not a recognized token name

TOKEN: 'a' -> type(CHANNEL1); // error 175
DIR_NOT_FOUNDback to summary
public static final ErrorType DIR_NOT_FOUND

Compiler Error 5.

directory not found: directory

DUPLICATED_COMMANDback to summary
public static final ErrorType DUPLICATED_COMMAND
EMPTY_STRINGS_AND_SETS_NOT_ALLOWEDback to summary
public static final ErrorType EMPTY_STRINGS_AND_SETS_NOT_ALLOWED

Compiler Error 174.

empty strings and sets not allowed

A: '''test''';
B: '';
C: 'test' '';
D: [];
E: [f-a];
EOF_CLOSUREback to summary
public static final ErrorType EOF_CLOSURE

rule rule contains a closure with at least one alternative that can match EOF

A rule contains a closure ((...)*) or positive closure ((...)+) around EOF.

The following rule produces this error.

x : EOF*;         // error
y : EOF+;         // error
z : EOF;         // ok
EPSILON_CLOSUREback to summary
public static final ErrorType EPSILON_CLOSURE

Compiler Error 153.

rule rule contains a closure with at least one alternative that can match an empty string

A rule contains a closure ((...)*) or positive closure ((...)+) around an empty alternative.

The following rule produces this error.

x  : ;
y  : x+;                                // error 153
z1 : ('foo' | 'bar'? 'bar2'?)*;         // error 153
z2 : ('foo' | 'bar' 'bar2'? | 'bar2')*; // ok
Since
4.1
EPSILON_LR_FOLLOWback to summary
public static final ErrorType EPSILON_LR_FOLLOW

Compiler Error 148.

left recursive rule rule contains a left recursive alternative which can be followed by the empty string

In left-recursive rules, all left-recursive alternatives must match at least one symbol following the recursive rule invocation.

The following rule produces this error.

a : ID    // ok        (alternative is not left recursive)
  | a INT // ok        (a must be follow by INT)
  | a ID? // error 148 (the ID following a is optional)
  ;
EPSILON_OPTIONALback to summary
public static final ErrorType EPSILON_OPTIONAL

Compiler Warning 154.

rule rule contains an optional block with at least one alternative that can match an empty string

A rule contains an optional block ((...)?) around an empty alternative.

The following rule produces this warning.

x  : ;
y  : x?;                                // warning 154
z1 : ('foo' | 'bar'? 'bar2'?)?;         // warning 154
z2 : ('foo' | 'bar' 'bar2'? | 'bar2')?; // ok
Since
4.1
EPSILON_TOKENback to summary
public static final ErrorType EPSILON_TOKEN

Compiler Warning 146.

non-fragment lexer rule rule can match the empty string

All non-fragment lexer rules must match at least one character.

The following example shows this error.

Whitespace : [ \t]+;  // ok
Whitespace : [ \t];   // ok

fragment WS : [ \t]*; // ok

Whitespace : [ \t]*;  // error 146
ERROR_READING_IMPORTED_GRAMMARback to summary
public static final ErrorType ERROR_READING_IMPORTED_GRAMMAR

Compiler Error 11.

cannot find tokens file filename: reason

ERROR_READING_TOKENS_FILEback to summary
public static final ErrorType ERROR_READING_TOKENS_FILE

Compiler Error 4.

cannot find tokens file filename: reason

EXPECTED_NON_GREEDY_WILDCARD_BLOCKback to summary
public static final ErrorType EXPECTED_NON_GREEDY_WILDCARD_BLOCK

Compiler Warning 131.

This warning may take any of the following forms.

  • greedy block ()* contains wildcard; the non-greedy syntax ()*? may be preferred
  • greedy block ()+ contains wildcard; the non-greedy syntax ()+? may be preferred
FILE_AND_GRAMMAR_NAME_DIFFERback to summary
public static final ErrorType FILE_AND_GRAMMAR_NAME_DIFFER

Compiler Error 8.

grammar name name and file name filename differ

FRAGMENT_ACTION_IGNOREDback to summary
public static final ErrorType FRAGMENT_ACTION_IGNORED

Compiler Warning 158.

fragment rule rule contains an action or command which can never be executed

A lexer rule which is marked with the fragment modifier contains an embedded action or lexer command. ANTLR lexers only execute commands and embedded actions located in the top-level matched rule. Since fragment rules can never be the top-level rule matched by a lexer, actions or commands placed in these rules can never be executed during the lexing process.

The following rule produces this warning.

X1 : 'x' -> more    // ok
   ;
Y1 : 'x' {more();}  // ok
   ;
fragment
X2 : 'x' -> more    // warning 158
   ;
fragment
Y2 : 'x' {more();}  // warning 158
   ;
Since
4.2.1
ILLEGAL_OPTIONback to summary
public static final ErrorType ILLEGAL_OPTION

Compiler Warning 83.

unsupported option option

ILLEGAL_OPTION_VALUEback to summary
public static final ErrorType ILLEGAL_OPTION_VALUE

Compiler Warning 84.

unsupported option value name=value

IMPLICIT_STRING_DEFINITIONback to summary
public static final ErrorType IMPLICIT_STRING_DEFINITION

Compiler Error 126.

cannot create implicit token for string literal in non-combined grammar: literal

IMPLICIT_TOKEN_DEFINITIONback to summary
public static final ErrorType IMPLICIT_TOKEN_DEFINITION

Compiler Warning 125.

implicit definition of token Token in parser

IMPORT_NAME_CLASHback to summary
public static final ErrorType IMPORT_NAME_CLASH

Compiler Error 113.

grammartype grammar grammar1 and imported grammartype grammar grammar2 both generate recognizer

INCOMPATIBLE_COMMANDSback to summary
public static final ErrorType INCOMPATIBLE_COMMANDS
INCOMPATIBLE_TOOL_AND_TEMPLATESback to summary
public static final ErrorType INCOMPATIBLE_TOOL_AND_TEMPLATES

Compiler Error 35.

templates/target and tool aren't compatible

INTERNAL_ERRORback to summary
public static final ErrorType INTERNAL_ERROR

Compiler Error 20.

internal error: message

INVALID_CMDLINE_ARGback to summary
public static final ErrorType INVALID_CMDLINE_ARG

Compiler Error 2.

unknown command-line option option

INVALID_ESCAPE_SEQUENCEback to summary
public static final ErrorType INVALID_ESCAPE_SEQUENCE

Compiler Error 156.

invalid escape sequence

The grammar contains a string literal with an invalid escape sequence.

The following rule produces this error.

x : 'x';  // ok
y : '\u'; // error 156
Since
4.2.1
INVALID_IMPORTback to summary
public static final ErrorType INVALID_IMPORT

Compiler Error 111.

grammartype grammar grammar1 cannot import grammartype grammar grammar2

INVALID_LEXER_COMMANDback to summary
public static final ErrorType INVALID_LEXER_COMMAND

Compiler Error 149.

lexer command command does not exist or is not supported by the current target

Each lexer command requires an explicit implementation in the target templates. This error indicates that the command was incorrectly written or is not supported by the current target.

The following rule produces this error.

X : 'foo' -> type(Foo);  // ok
Y : 'foo' -> token(Foo); // error 149 (token is not a supported lexer command)
Since
4.1
INVALID_LITERAL_IN_LEXER_SETback to summary
public static final ErrorType INVALID_LITERAL_IN_LEXER_SET

Compiler Error 144.

multi-character literals are not allowed in lexer sets: literal

INVALID_RULE_PARAMETER_REFback to summary
public static final ErrorType INVALID_RULE_PARAMETER_REF

Compiler Error 64.

parameter parameter of rule rule is not accessible in this scope: expression

ISOLATED_RULE_REFback to summary
public static final ErrorType ISOLATED_RULE_REF

Compiler Error 67.

missing attribute access on rule reference rule in expression

LABEL_BLOCK_NOT_A_SETback to summary
public static final ErrorType LABEL_BLOCK_NOT_A_SET

Compiler Error 130.

label label assigned to a block which is not a set

LABEL_CONFLICTS_WITH_ARGback to summary
public static final ErrorType LABEL_CONFLICTS_WITH_ARG

Compiler Error 72.

label label conflicts with parameter with same name

LABEL_CONFLICTS_WITH_LOCALback to summary
public static final ErrorType LABEL_CONFLICTS_WITH_LOCAL

Compiler Error 74.

label label conflicts with local with same name

LABEL_CONFLICTS_WITH_RETVALback to summary
public static final ErrorType LABEL_CONFLICTS_WITH_RETVAL

Compiler Error 73.

label label conflicts with return value with same name

LABEL_CONFLICTS_WITH_RULEback to summary
public static final ErrorType LABEL_CONFLICTS_WITH_RULE

Compiler Error 69.

label label conflicts with rule with same name

LABEL_CONFLICTS_WITH_TOKENback to summary
public static final ErrorType LABEL_CONFLICTS_WITH_TOKEN

Compiler Error 70.

label label conflicts with token with same name

LABEL_TYPE_CONFLICTback to summary
public static final ErrorType LABEL_TYPE_CONFLICT

Compiler Error 75.

label label type mismatch with previous definition: message

LEFT_RECURSION_CYCLESback to summary
public static final ErrorType LEFT_RECURSION_CYCLES

Compiler Error 119.

The following sets of rules are mutually left-recursive [rules]

LEXER_ACTION_PLACEMENT_ISSUEback to summary
public static final ErrorType LEXER_ACTION_PLACEMENT_ISSUE

Deprecated

This error is no longer issued by ANTLR 4.2.

Compiler Error 132.

action in lexer rule rule must be last element of single outermost alt

Annotations
@Deprecated
LEXER_COMMAND_PLACEMENT_ISSUEback to summary
public static final ErrorType LEXER_COMMAND_PLACEMENT_ISSUE

Compiler Error 133.

->command in lexer rule rule must be last element of single outermost alt

LEXER_RULES_NOT_ALLOWEDback to summary
public static final ErrorType LEXER_RULES_NOT_ALLOWED

Compiler Error 52.

lexer rule rule not allowed in parser

LOCAL_CONFLICTS_WITH_ARGback to summary
public static final ErrorType LOCAL_CONFLICTS_WITH_ARG

Compiler Error 142.

local local conflicts with parameter with same name

LOCAL_CONFLICTS_WITH_RETVALback to summary
public static final ErrorType LOCAL_CONFLICTS_WITH_RETVAL

Compiler Error 143.

local local conflicts with return value with same name

LOCAL_CONFLICTS_WITH_RULEback to summary
public static final ErrorType LOCAL_CONFLICTS_WITH_RULE

Compiler Error 140.

local local conflicts with rule with same name

LOCAL_CONFLICTS_WITH_TOKENback to summary
public static final ErrorType LOCAL_CONFLICTS_WITH_TOKEN

Compiler Error 141.

local local conflicts with rule token same name

MISSING_CODE_GEN_TEMPLATESback to summary
public static final ErrorType MISSING_CODE_GEN_TEMPLATES

Compiler Error 30.

can't find code generation templates: group

MISSING_LEXER_COMMAND_ARGUMENTback to summary
public static final ErrorType MISSING_LEXER_COMMAND_ARGUMENT

Compiler Error 150.

missing argument for lexer command command

Some lexer commands require an argument.

The following rule produces this error.

X : 'foo' -> type(Foo); // ok
Y : 'foo' -> type;      // error 150 (the type command requires an argument)
Since
4.1
MISSING_RULE_ARGSback to summary
public static final ErrorType MISSING_RULE_ARGS

Compiler Error 79.

missing argument(s) on rule reference: rule

MODE_CONFLICTS_WITH_COMMON_CONSTANTSback to summary
public static final ErrorType MODE_CONFLICTS_WITH_COMMON_CONSTANTS

Compiler Error 173.

can not use or declare mode with reserved name

Reserved names: HIDDEN, DEFAULT_TOKEN_CHANNEL, SKIP, MORE, MAX_CHAR_VALUE, MIN_CHAR_VALUE.

Can be used and cannot declared: DEFAULT_MODE

MODE_CONFLICTS_WITH_TOKENback to summary
public static final ErrorType MODE_CONFLICTS_WITH_TOKEN

Compiler Error 170.

mode M1;
A1: 'a'; // ok
mode M2;
A2: 'a'; // ok
M1: 'b'; // error 170

mode name conflicts with token with same name

MODE_NOT_IN_LEXERback to summary
public static final ErrorType MODE_NOT_IN_LEXER

Compiler Error 120.

lexical modes are only allowed in lexer grammars

MODE_WITHOUT_RULESback to summary
public static final ErrorType MODE_WITHOUT_RULES

Compiler Error 145.

lexer mode mode must contain at least one non-fragment rule

Every lexer mode must contain at least one rule which is not declared with the fragment modifier.

msgback to summary
public final String msg

The error or warning message, in StringTemplate 4 format using < and > as the delimiters. Arguments for the message may be referenced using the following names:

  • arg: The first template argument
  • arg2: The second template argument
  • arg3: The third template argument
  • verbose: true if verbose messages were requested; otherwise, false
  • exception: The exception which resulted in the error, if any.
  • stackTrace: The stack trace for the exception, when available.
NO_MODEL_TO_TEMPLATE_MAPPINGback to summary
public static final ErrorType NO_MODEL_TO_TEMPLATE_MAPPING

Compiler Error 34.

no mapping to template name for output model class class

NO_NON_LR_ALTSback to summary
public static final ErrorType NO_NON_LR_ALTS

Compiler Error 147.

left recursive rule rule must contain an alternative which is not left recursive

Left-recursive rules must contain at least one alternative which is not left recursive.

The following rule produces this error.

// error 147:
a : a ID
  | a INT
  ;
NO_RULESback to summary
public static final ErrorType NO_RULES

Compiler Error 99.

This error may take any of the following forms.

  • grammar grammar has no rules
  • implicitly generated grammar grammar has no rules
NO_SUCH_GRAMMAR_SCOPEback to summary
public static final ErrorType NO_SUCH_GRAMMAR_SCOPE

Compiler Error 105.

reference to undefined grammar in rule reference: grammar.rule

NO_SUCH_RULE_IN_SCOPEback to summary
public static final ErrorType NO_SUCH_RULE_IN_SCOPE

Compiler Error 106.

rule rule is not defined in grammar grammar

NONCONFORMING_LR_RULEback to summary
public static final ErrorType NONCONFORMING_LR_RULE
OPTIONS_IN_DELEGATEback to summary
public static final ErrorType OPTIONS_IN_DELEGATE

Compiler Warning 109.

options ignored in imported grammar grammar

OUTPUT_DIR_IS_FILEback to summary
public static final ErrorType OUTPUT_DIR_IS_FILE

Compiler Error 6.

output directory is a file: filename

PARSER_RULE_REF_IN_LEXER_RULEback to summary
public static final ErrorType PARSER_RULE_REF_IN_LEXER_RULE

Compiler Error 160.

reference to parser rule rule in lexer rule name

See Also
UNDEFINED_RULE_REF
PARSER_RULES_NOT_ALLOWEDback to summary
public static final ErrorType PARSER_RULES_NOT_ALLOWED

Compiler Error 53.

parser rule rule not allowed in lexer

RANGE_PROBABLY_CONTAINS_NOT_IMPLIED_CHARACTERSback to summary
public static final ErrorType RANGE_PROBABLY_CONTAINS_NOT_IMPLIED_CHARACTERS

Range probably contains not implied characters. Both bounds should be defined in lower or UPPER case For instance, the range [A-z] (ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxy) probably contains not implied characters: [\]^_` Use the following definition: [A-Za-z] If the characters are implied, include them explicitly: [A-Za-z[\\\]^_`]

TOKEN: [A-z]; // warning
REDUNDANT_CASE_INSENSITIVE_LEXER_RULE_OPTIONback to summary
public static final ErrorType REDUNDANT_CASE_INSENSITIVE_LEXER_RULE_OPTION

Redundant caseInsensitive lexer rule option

options { caseInsensitive=true; }
TOKEN options { caseInsensitive=true; } : [a-z]+ -> caseInsensitive(true); // warning
REPEATED_PREQUELback to summary
public static final ErrorType REPEATED_PREQUEL

Compiler Error 54.

repeated grammar prequel spec (options, tokens, or import); please merge

RESERVED_RULE_NAMEback to summary
public static final ErrorType RESERVED_RULE_NAME

Compiler Error 159.

cannot declare a rule with reserved name rule

A rule was declared with a reserved name.

The following rule produces this error.

EOF :  ' '   // error 159 (EOF is a reserved name)
    ;
Since
4.2.1
RETVAL_CONFLICTS_WITH_ARGback to summary
public static final ErrorType RETVAL_CONFLICTS_WITH_ARG

Compiler Error 76.

return value name conflicts with parameter with same name

RETVAL_CONFLICTS_WITH_RULEback to summary
public static final ErrorType RETVAL_CONFLICTS_WITH_RULE

Compiler Error 136.

return value name conflicts with rule with same name

RETVAL_CONFLICTS_WITH_TOKENback to summary
public static final ErrorType RETVAL_CONFLICTS_WITH_TOKEN

Compiler Error 137.

return value name conflicts with token with same name

RULE_HAS_NO_ARGSback to summary
public static final ErrorType RULE_HAS_NO_ARGS

Compiler Error 80.

rule rule has no defined parameters

RULE_REDEFINITIONback to summary
public static final ErrorType RULE_REDEFINITION

Compiler Error 51.

rule rule redefinition; previous at line line

RULE_WITH_TOO_FEW_ALT_LABELSback to summary
public static final ErrorType RULE_WITH_TOO_FEW_ALT_LABELS

Compiler Error 122.

rule rule: must label all alternatives or none

severityback to summary
public final ErrorSeverity severity

The error severity.

STRING_TEMPLATE_WARNINGback to summary
public static final ErrorType STRING_TEMPLATE_WARNING

Compiler Warning 22.

template error: message

SYNTAX_ERRORback to summary
public static final ErrorType SYNTAX_ERROR

Compiler Error 50.

syntax error: message

TOKEN_CONFLICTS_WITH_COMMON_CONSTANTSback to summary
public static final ErrorType TOKEN_CONFLICTS_WITH_COMMON_CONSTANTS

Compiler Error 171.

can not use or declare token with reserved name

Reserved names: HIDDEN, DEFAULT_TOKEN_CHANNEL, SKIP, MORE, MAX_CHAR_VALUE, MIN_CHAR_VALUE.

Can be used but cannot be declared: EOF

TOKEN_NAME_REASSIGNMENTback to summary
public static final ErrorType TOKEN_NAME_REASSIGNMENT

Compiler Warning 108.

token name Token is already defined

TOKEN_NAMES_MUST_START_UPPERback to summary
public static final ErrorType TOKEN_NAMES_MUST_START_UPPER

Compiler Error 60.

token names must start with an uppercase letter: name

TOKEN_RANGE_IN_PARSERback to summary
public static final ErrorType TOKEN_RANGE_IN_PARSER

Compiler Warning 181

The token range operator makes no sense in the parser as token types are not ordered (except in implementation).

grammar T;
a : 'A'..'Z' ;
TOKEN_UNREACHABLEback to summary
public static final ErrorType TOKEN_UNREACHABLE

Compiler Warning 184.

The token value overlapped by another token or self

TOKEN1: 'value';
TOKEN2: 'value'; // warning
TOKENS_FILE_SYNTAX_ERRORback to summary
public static final ErrorType TOKENS_FILE_SYNTAX_ERROR

Compiler Error 21.

.tokens file syntax error filename: message

UNDEFINED_RULE_IN_NONLOCAL_REFback to summary
public static final ErrorType UNDEFINED_RULE_IN_NONLOCAL_REF

Compiler Error 57.

reference to undefined rule rule in non-local ref reference

UNDEFINED_RULE_REFback to summary
public static final ErrorType UNDEFINED_RULE_REF

Compiler Error 56.

reference to undefined rule: rule

See Also
PARSER_RULE_REF_IN_LEXER_RULE
UNICODE_PROPERTY_NOT_ALLOWED_IN_RANGEback to summary
public static final ErrorType UNICODE_PROPERTY_NOT_ALLOWED_IN_RANGE

Compiler Error 182.

Unicode properties cannot be part of a lexer charset range

A: [\\p{Letter}-\\p{Number}];
UNKNOWN_ATTRIBUTE_IN_SCOPEback to summary
public static final ErrorType UNKNOWN_ATTRIBUTE_IN_SCOPE

Compiler Error 66.

attribute attribute isn't a valid property in expression

UNKNOWN_LEXER_CONSTANTback to summary
public static final ErrorType UNKNOWN_LEXER_CONSTANT

Compiler Warning 155.

rule rule contains a lexer command with an unrecognized constant value; lexer interpreters may produce incorrect output

A lexer rule contains a standard lexer command, but the constant value argument for the command is an unrecognized string. As a result, the lexer command will be translated as a custom lexer action, preventing the command from executing in some interpreted modes. The output of the lexer interpreter may not match the output of the generated lexer.

The following rule produces this warning.

@members {
public static final int CUSTOM = HIDDEN + 1;
}

X : 'foo' -> channel(HIDDEN);           // ok
Y : 'bar' -> channel(CUSTOM);           // warning 155
Since
4.2
UNKNOWN_RULE_ATTRIBUTEback to summary
public static final ErrorType UNKNOWN_RULE_ATTRIBUTE

Compiler Error 65.

unknown attribute attribute for rule rule in expression

UNKNOWN_SIMPLE_ATTRIBUTEback to summary
public static final ErrorType UNKNOWN_SIMPLE_ATTRIBUTE

Compiler Error 63.

unknown attribute reference attribute in expression

UNRECOGNIZED_ASSOC_OPTIONback to summary
public static final ErrorType UNRECOGNIZED_ASSOC_OPTION

Compiler Warning 157.

rule rule contains an assoc element option in an unrecognized location

In ANTLR 4.2, the position of the assoc element option was moved from the operator terminal(s) to the alternative itself. This warning is reported when an assoc element option is specified on a grammar element that is not recognized by the current version of ANTLR, and as a result will simply be ignored.

The following rule produces this warning.

x : 'x'
  | x '+'<assoc=right> x   // warning 157
  |<assoc=right> x * x   // ok
  ;
Since
4.2.1
UNSUPPORTED_REFERENCE_IN_LEXER_SETback to summary
public static final ErrorType UNSUPPORTED_REFERENCE_IN_LEXER_SET

Compiler Error 183.

rule reference rule is not currently supported in a set

UNTERMINATED_STRING_LITERALback to summary
public static final ErrorType UNTERMINATED_STRING_LITERAL

Compiler Error 152.

unterminated string literal

The grammar contains an unterminated string literal.

The following rule produces this error.

x : 'x'; // ok
y : 'y';  // error 152
Since
4.1
UNWANTED_LEXER_COMMAND_ARGUMENTback to summary
public static final ErrorType UNWANTED_LEXER_COMMAND_ARGUMENT

Compiler Error 151.

lexer command command does not take any arguments

A lexer command which does not take parameters was invoked with an argument.

The following rule produces this error.

X : 'foo' -> popMode;    // ok
Y : 'foo' -> popMode(A); // error 151 (the popMode command does not take an argument)
Since
4.1
USE_OF_BAD_WORDback to summary
public static final ErrorType USE_OF_BAD_WORD

Deprecated

Compiler Error 134.

symbol symbol conflicts with generated code in target language or runtime

Annotations
@Deprecated
V3_ASSIGN_IN_TOKENSback to summary
public static final ErrorType V3_ASSIGN_IN_TOKENS

Deprecated

Compiler Error 203.

assignments in tokens{} are not supported in ANTLR 4; use lexical rule TokenName : LiteralValue; instead

ANTLR 3 allowed literal tokens to be declared and assigned a value within the tokens{} block. ANTLR 4 no longer offers this syntax. When migrating a grammar from ANTLR 3 to ANTLR 4, any tokens with a literal value declared in the tokens{} block should be converted to standard lexer rules.

Annotations
@Deprecated
V3_GATED_SEMPREDback to summary
public static final ErrorType V3_GATED_SEMPRED

Deprecated

Compiler Warning 204.

{...}?=> explicitly gated semantic predicates are deprecated in ANTLR 4; use {...}? instead

ANTLR 4 treats semantic predicates consistently in a manner similar to gated semantic predicates in ANTLR 3. When migrating a grammar from ANTLR 3 to ANTLR 4, all uses of the gated semantic predicate syntax can be safely converted to the standard semantic predicated syntax, which is the only form used by ANTLR 4.

Annotations
@Deprecated
V3_LEXER_LABELback to summary
public static final ErrorType V3_LEXER_LABEL

Deprecated

Compiler Warning 201.

labels in lexer rules are not supported in ANTLR 4; actions cannot reference elements of lexical rules but you can use Lexer#getText() to get the entire text matched for the rule

ANTLR 4 uses a DFA for recognition of entire tokens, resulting in faster and smaller lexers than ANTLR 3 produced. As a result, sub-rules referenced within lexer rules are not tracked independently, and cannot be assigned to labels.

Annotations
@Deprecated
V3_SYNPREDback to summary
public static final ErrorType V3_SYNPRED

Deprecated

Compiler Error 205.

(...)=> syntactic predicates are not supported in ANTLR 4

ANTLR 4's improved lookahead algorithms do not require the use of syntactic predicates to disambiguate long lookahead sequences. The syntactic predicates should be removed when migrating a grammar from ANTLR 3 to ANTLR 4.

Annotations
@Deprecated
V3_TOKENS_SYNTAXback to summary
public static final ErrorType V3_TOKENS_SYNTAX

Deprecated

Compiler Warning 202.

tokens {A; B;} syntax is now tokens {A, B} in ANTLR 4

ANTLR 4 uses comma-separated token declarations in the tokens{} block. This warning appears when the tokens block is written using the ANTLR 3 syntax of semicolon-terminated token declarations.

Note

ANTLR 4 does not allow a trailing comma to appear following the last token declared in the tokens{} block.

Annotations
@Deprecated
V3_TREE_GRAMMARback to summary
public static final ErrorType V3_TREE_GRAMMAR

Deprecated

Compiler Error 200.

tree grammars are not supported in ANTLR 4

This error message is provided as a compatibility notice for users migrating from ANTLR 3. ANTLR 4 does not support tree grammars, but instead offers automatically generated parse tree listeners and visitors as a more maintainable alternative.

Annotations
@Deprecated
WARNING_TREATED_AS_ERRORback to summary
public static final ErrorType WARNING_TREATED_AS_ERROR

Compiler Error 10.

warning treated as error

Constructor Detail

ErrorTypeback to summary
private ErrorType(int code, String msg, ErrorSeverity severity)

Constructs a new ErrorType with the specified code, message, and severity.

Parameters
code:int

The unique error number.

msg:String

The error message template.

severity:ErrorSeverity

The error severity.

Method Detail

valueOfback to summary
public static ErrorType valueOf(String name)
valuesback to summary
public static ErrorType[] values()