Enum ErrorType

  • All Implemented Interfaces:
    Serializable, Comparable<ErrorType>

    public enum ErrorType
    extends Enum<ErrorType>
    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.

    Since:
    4.0
    Author:
    Jim Idle <jimi@temporal-wave.com>, Terence Parr
    • Enum Constant Detail

      • CANNOT_WRITE_FILE

        public static final ErrorType CANNOT_WRITE_FILE
        Compiler Error 1.

        cannot write file filename: reason

      • INVALID_CMDLINE_ARG

        public static final ErrorType INVALID_CMDLINE_ARG
        Compiler Error 2.

        unknown command-line option option

      • CANNOT_FIND_TOKENS_FILE_GIVEN_ON_CMDLINE

        public static final ErrorType CANNOT_FIND_TOKENS_FILE_GIVEN_ON_CMDLINE
        Compiler Error 3.

        cannot find tokens file filename

      • ERROR_READING_TOKENS_FILE

        public static final ErrorType ERROR_READING_TOKENS_FILE
        Compiler Error 4.

        cannot find tokens file filename: reason

      • DIR_NOT_FOUND

        public static final ErrorType DIR_NOT_FOUND
        Compiler Error 5.

        directory not found: directory

      • OUTPUT_DIR_IS_FILE

        public static final ErrorType OUTPUT_DIR_IS_FILE
        Compiler Error 6.

        output directory is a file: filename

      • CANNOT_OPEN_FILE

        public static final ErrorType CANNOT_OPEN_FILE
        Compiler Error 7.

        cannot find or open file: filename

      • FILE_AND_GRAMMAR_NAME_DIFFER

        public static final ErrorType FILE_AND_GRAMMAR_NAME_DIFFER
        Compiler Error 8.

        grammar name name and file name filename differ

      • BAD_OPTION_SET_SYNTAX

        public static final ErrorType BAD_OPTION_SET_SYNTAX
        Compiler Error 9.

        invalid -Dname=value syntax: syntax

      • WARNING_TREATED_AS_ERROR

        public static final ErrorType WARNING_TREATED_AS_ERROR
        Compiler Error 10.

        warning treated as error

      • ERROR_READING_IMPORTED_GRAMMAR

        public static final ErrorType ERROR_READING_IMPORTED_GRAMMAR
        Compiler Error 11.

        cannot find tokens file filename: reason

      • INTERNAL_ERROR

        public static final ErrorType INTERNAL_ERROR
        Compiler Error 20.

        internal error: message

      • TOKENS_FILE_SYNTAX_ERROR

        public static final ErrorType TOKENS_FILE_SYNTAX_ERROR
        Compiler Error 21.

        .tokens file syntax error filename: message

      • STRING_TEMPLATE_WARNING

        public static final ErrorType STRING_TEMPLATE_WARNING
        Compiler Warning 22.

        template error: message

      • MISSING_CODE_GEN_TEMPLATES

        public static final ErrorType MISSING_CODE_GEN_TEMPLATES
        Compiler Error 30.

        can't find code generation templates: group

      • CANNOT_CREATE_TARGET_GENERATOR

        public static final ErrorType CANNOT_CREATE_TARGET_GENERATOR
        Compiler Error 31.

        ANTLR cannot generate language code as of version version

      • CODE_TEMPLATE_ARG_ISSUE

        public static final ErrorType CODE_TEMPLATE_ARG_ISSUE
        Compiler Error 32.

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

      • CODE_GEN_TEMPLATES_INCOMPLETE

        public static final ErrorType CODE_GEN_TEMPLATES_INCOMPLETE
        Compiler Error 33.

        missing code generation template template

      • NO_MODEL_TO_TEMPLATE_MAPPING

        public static final ErrorType NO_MODEL_TO_TEMPLATE_MAPPING
        Compiler Error 34.

        no mapping to template name for output model class class

      • INCOMPATIBLE_TOOL_AND_TEMPLATES

        public static final ErrorType INCOMPATIBLE_TOOL_AND_TEMPLATES
        Compiler Error 35.

        templates/target and tool aren't compatible

      • SYNTAX_ERROR

        public static final ErrorType SYNTAX_ERROR
        Compiler Error 50.

        syntax error: message

      • RULE_REDEFINITION

        public static final ErrorType RULE_REDEFINITION
        Compiler Error 51.

        rule rule redefinition; previous at line line

      • LEXER_RULES_NOT_ALLOWED

        public static final ErrorType LEXER_RULES_NOT_ALLOWED
        Compiler Error 52.

        lexer rule rule not allowed in parser

      • PARSER_RULES_NOT_ALLOWED

        public static final ErrorType PARSER_RULES_NOT_ALLOWED
        Compiler Error 53.

        parser rule rule not allowed in lexer

      • REPEATED_PREQUEL

        public static final ErrorType REPEATED_PREQUEL
        Compiler Error 54.

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

      • UNDEFINED_RULE_IN_NONLOCAL_REF

        public static final ErrorType UNDEFINED_RULE_IN_NONLOCAL_REF
        Compiler Error 57.

        reference to undefined rule rule in non-local ref reference

      • TOKEN_NAMES_MUST_START_UPPER

        public static final ErrorType TOKEN_NAMES_MUST_START_UPPER
        Compiler Error 60.

        token names must start with an uppercase letter: name

      • UNKNOWN_SIMPLE_ATTRIBUTE

        public static final ErrorType UNKNOWN_SIMPLE_ATTRIBUTE
        Compiler Error 63.

        unknown attribute reference attribute in expression

      • INVALID_RULE_PARAMETER_REF

        public static final ErrorType INVALID_RULE_PARAMETER_REF
        Compiler Error 64.

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

      • UNKNOWN_RULE_ATTRIBUTE

        public static final ErrorType UNKNOWN_RULE_ATTRIBUTE
        Compiler Error 65.

        unknown attribute attribute for rule rule in expression

      • UNKNOWN_ATTRIBUTE_IN_SCOPE

        public static final ErrorType UNKNOWN_ATTRIBUTE_IN_SCOPE
        Compiler Error 66.

        attribute attribute isn't a valid property in expression

      • ISOLATED_RULE_REF

        public static final ErrorType ISOLATED_RULE_REF
        Compiler Error 67.

        missing attribute access on rule reference rule in expression

      • LABEL_CONFLICTS_WITH_RULE

        public static final ErrorType LABEL_CONFLICTS_WITH_RULE
        Compiler Error 69.

        label label conflicts with rule with same name

      • LABEL_CONFLICTS_WITH_TOKEN

        public static final ErrorType LABEL_CONFLICTS_WITH_TOKEN
        Compiler Error 70.

        label label conflicts with token with same name

      • LABEL_CONFLICTS_WITH_ARG

        public static final ErrorType LABEL_CONFLICTS_WITH_ARG
        Compiler Error 72.

        label label conflicts with parameter with same name

      • LABEL_CONFLICTS_WITH_RETVAL

        public static final ErrorType LABEL_CONFLICTS_WITH_RETVAL
        Compiler Error 73.

        label label conflicts with return value with same name

      • LABEL_CONFLICTS_WITH_LOCAL

        public static final ErrorType LABEL_CONFLICTS_WITH_LOCAL
        Compiler Error 74.

        label label conflicts with local with same name

      • LABEL_TYPE_CONFLICT

        public static final ErrorType LABEL_TYPE_CONFLICT
        Compiler Error 75.

        label label type mismatch with previous definition: message

      • RETVAL_CONFLICTS_WITH_ARG

        public static final ErrorType RETVAL_CONFLICTS_WITH_ARG
        Compiler Error 76.

        return value name conflicts with parameter with same name

      • MISSING_RULE_ARGS

        public static final ErrorType MISSING_RULE_ARGS
        Compiler Error 79.

        missing argument(s) on rule reference: rule

      • RULE_HAS_NO_ARGS

        public static final ErrorType RULE_HAS_NO_ARGS
        Compiler Error 80.

        rule rule has no defined parameters

      • ILLEGAL_OPTION

        public static final ErrorType ILLEGAL_OPTION
        Compiler Warning 83.

        unsupported option option

      • ILLEGAL_OPTION_VALUE

        public static final ErrorType ILLEGAL_OPTION_VALUE
        Compiler Warning 84.

        unsupported option value name=value

      • ACTION_REDEFINITION

        public static final ErrorType ACTION_REDEFINITION
        Compiler Error 94.

        redefinition of action action

      • NO_RULES

        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_SCOPE

        public static final ErrorType NO_SUCH_GRAMMAR_SCOPE
        Compiler Error 105.

        reference to undefined grammar in rule reference: grammar.rule

      • NO_SUCH_RULE_IN_SCOPE

        public static final ErrorType NO_SUCH_RULE_IN_SCOPE
        Compiler Error 106.

        rule rule is not defined in grammar grammar

      • TOKEN_NAME_REASSIGNMENT

        public static final ErrorType TOKEN_NAME_REASSIGNMENT
        Compiler Warning 108.

        token name Token is already defined

      • OPTIONS_IN_DELEGATE

        public static final ErrorType OPTIONS_IN_DELEGATE
        Compiler Warning 109.

        options ignored in imported grammar grammar

      • CANNOT_FIND_IMPORTED_GRAMMAR

        public static final ErrorType CANNOT_FIND_IMPORTED_GRAMMAR
        Compiler Error 110.

        can't find or load grammar grammar from filename

      • INVALID_IMPORT

        public static final ErrorType INVALID_IMPORT
        Compiler Error 111.

        grammartype grammar grammar1 cannot import grammartype grammar grammar2

      • IMPORT_NAME_CLASH

        public static final ErrorType IMPORT_NAME_CLASH
        Compiler Error 113.

        grammartype grammar grammar1 and imported grammartype grammar grammar2 both generate recognizer

      • CANNOT_FIND_TOKENS_FILE_REFD_IN_GRAMMAR

        public static final ErrorType CANNOT_FIND_TOKENS_FILE_REFD_IN_GRAMMAR
        Compiler Error 114.

        cannot find tokens file filename

      • ALL_OPS_NEED_SAME_ASSOC

        @Deprecated
        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

      • LEFT_RECURSION_CYCLES

        public static final ErrorType LEFT_RECURSION_CYCLES
        Compiler Error 119.

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

      • MODE_NOT_IN_LEXER

        public static final ErrorType MODE_NOT_IN_LEXER
        Compiler Error 120.

        lexical modes are only allowed in lexer grammars

      • CANNOT_FIND_ATTRIBUTE_NAME_IN_DECL

        public static final ErrorType CANNOT_FIND_ATTRIBUTE_NAME_IN_DECL
        Compiler Error 121.

        cannot find an attribute name in attribute declaration

      • RULE_WITH_TOO_FEW_ALT_LABELS

        public static final ErrorType RULE_WITH_TOO_FEW_ALT_LABELS
        Compiler Error 122.

        rule rule: must label all alternatives or none

      • ALT_LABEL_REDEF

        public static final ErrorType ALT_LABEL_REDEF
        Compiler Error 123.

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

      • ALT_LABEL_CONFLICTS_WITH_RULE

        public static final ErrorType ALT_LABEL_CONFLICTS_WITH_RULE
        Compiler Error 124.

        rule alt label label conflicts with rule rule

      • IMPLICIT_TOKEN_DEFINITION

        public static final ErrorType IMPLICIT_TOKEN_DEFINITION
        Compiler Warning 125.

        implicit definition of token Token in parser

      • IMPLICIT_STRING_DEFINITION

        public static final ErrorType IMPLICIT_STRING_DEFINITION
        Compiler Error 126.

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

      • ATTRIBUTE_IN_LEXER_ACTION

        public static final ErrorType ATTRIBUTE_IN_LEXER_ACTION
        Compiler Error 128.

        attribute references not allowed in lexer actions: expression

      • LABEL_BLOCK_NOT_A_SET

        public static final ErrorType LABEL_BLOCK_NOT_A_SET
        Compiler Error 130.

        label label assigned to a block which is not a set

      • EXPECTED_NON_GREEDY_WILDCARD_BLOCK

        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
      • LEXER_ACTION_PLACEMENT_ISSUE

        @Deprecated
        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

      • LEXER_COMMAND_PLACEMENT_ISSUE

        public static final ErrorType LEXER_COMMAND_PLACEMENT_ISSUE
        Compiler Error 133.

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

      • USE_OF_BAD_WORD

        @Deprecated
        public static final ErrorType USE_OF_BAD_WORD
        Deprecated.
        Compiler Error 134.

        symbol symbol conflicts with generated code in target language or runtime

      • UNSUPPORTED_REFERENCE_IN_LEXER_SET

        public static final ErrorType UNSUPPORTED_REFERENCE_IN_LEXER_SET
        Compiler Error 183.

        rule reference rule is not currently supported in a set

      • ASSIGNMENT_TO_LIST_LABEL

        public static final ErrorType ASSIGNMENT_TO_LIST_LABEL
        Compiler Error 135.

        cannot assign a value to list label label

      • RETVAL_CONFLICTS_WITH_RULE

        public static final ErrorType RETVAL_CONFLICTS_WITH_RULE
        Compiler Error 136.

        return value name conflicts with rule with same name

      • RETVAL_CONFLICTS_WITH_TOKEN

        public static final ErrorType RETVAL_CONFLICTS_WITH_TOKEN
        Compiler Error 137.

        return value name conflicts with token with same name

      • ARG_CONFLICTS_WITH_RULE

        public static final ErrorType ARG_CONFLICTS_WITH_RULE
        Compiler Error 138.

        parameter parameter conflicts with rule with same name

      • ARG_CONFLICTS_WITH_TOKEN

        public static final ErrorType ARG_CONFLICTS_WITH_TOKEN
        Compiler Error 139.

        parameter parameter conflicts with token with same name

      • LOCAL_CONFLICTS_WITH_RULE

        public static final ErrorType LOCAL_CONFLICTS_WITH_RULE
        Compiler Error 140.

        local local conflicts with rule with same name

      • LOCAL_CONFLICTS_WITH_TOKEN

        public static final ErrorType LOCAL_CONFLICTS_WITH_TOKEN
        Compiler Error 141.

        local local conflicts with rule token same name

      • LOCAL_CONFLICTS_WITH_ARG

        public static final ErrorType LOCAL_CONFLICTS_WITH_ARG
        Compiler Error 142.

        local local conflicts with parameter with same name

      • LOCAL_CONFLICTS_WITH_RETVAL

        public static final ErrorType LOCAL_CONFLICTS_WITH_RETVAL
        Compiler Error 143.

        local local conflicts with return value with same name

      • INVALID_LITERAL_IN_LEXER_SET

        public static final ErrorType INVALID_LITERAL_IN_LEXER_SET
        Compiler Error 144.

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

      • MODE_WITHOUT_RULES

        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.

      • EPSILON_TOKEN

        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
         
      • NO_NON_LR_ALTS

        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
           ;
         
      • EPSILON_LR_FOLLOW

        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)
           ;
         
      • INVALID_LEXER_COMMAND

        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
      • MISSING_LEXER_COMMAND_ARGUMENT

        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
      • UNWANTED_LEXER_COMMAND_ARGUMENT

        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
      • UNTERMINATED_STRING_LITERAL

        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
      • EPSILON_CLOSURE

        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_OPTIONAL

        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
      • UNKNOWN_LEXER_CONSTANT

        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
      • INVALID_ESCAPE_SEQUENCE

        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
      • UNRECOGNIZED_ASSOC_OPTION

        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
      • FRAGMENT_ACTION_IGNORED

        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
      • RESERVED_RULE_NAME

        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
      • PARSER_RULE_REF_IN_LEXER_RULE

        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
      • CHANNEL_CONFLICTS_WITH_TOKEN

        public static final ErrorType CHANNEL_CONFLICTS_WITH_TOKEN
        Compiler Error 161.

        channel name conflicts with token with same name

      • CHANNEL_CONFLICTS_WITH_MODE

        public static final ErrorType CHANNEL_CONFLICTS_WITH_MODE
        Compiler Error 162.

        channel name conflicts with mode with same name

      • CHANNELS_BLOCK_IN_PARSER_GRAMMAR

        public static final ErrorType CHANNELS_BLOCK_IN_PARSER_GRAMMAR
        Compiler Error 163.

        custom channels are not supported in parser grammars

      • CHANNELS_BLOCK_IN_COMBINED_GRAMMAR

        public static final ErrorType CHANNELS_BLOCK_IN_COMBINED_GRAMMAR
        Compiler Error 164.

        custom channels are not supported in combined grammars

      • NONCONFORMING_LR_RULE

        public static final ErrorType NONCONFORMING_LR_RULE
      • MODE_CONFLICTS_WITH_TOKEN

        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

      • TOKEN_CONFLICTS_WITH_COMMON_CONSTANTS

        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

      • CHANNEL_CONFLICTS_WITH_COMMON_CONSTANTS

        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

      • MODE_CONFLICTS_WITH_COMMON_CONSTANTS

        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

      • EMPTY_STRINGS_AND_SETS_NOT_ALLOWED

        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];
         
      • CONSTANT_VALUE_IS_NOT_A_RECOGNIZED_TOKEN_NAME

        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
      • CONSTANT_VALUE_IS_NOT_A_RECOGNIZED_MODE_NAME

        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_CHANNEL_NAME

        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
      • DUPLICATED_COMMAND

        public static final ErrorType DUPLICATED_COMMAND
      • INCOMPATIBLE_COMMANDS

        public static final ErrorType INCOMPATIBLE_COMMANDS
      • CHARACTERS_COLLISION_IN_SET

        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.
      • TOKEN_RANGE_IN_PARSER

        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' ;
         
      • UNICODE_PROPERTY_NOT_ALLOWED_IN_RANGE

        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}];
         
      • TOKEN_UNREACHABLE

        public static final ErrorType TOKEN_UNREACHABLE
        Compiler Warning 184.

        The token value overlapped by another token or self

         TOKEN1: 'value';
         TOKEN2: 'value'; // warning
         
      • RANGE_PROBABLY_CONTAINS_NOT_IMPLIED_CHARACTERS

        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
         
      • EOF_CLOSURE

        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
         
      • REDUNDANT_CASE_INSENSITIVE_LEXER_RULE_OPTION

        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
         
      • V3_TREE_GRAMMAR

        @Deprecated
        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.

      • V3_LEXER_LABEL

        @Deprecated
        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.

      • V3_TOKENS_SYNTAX

        @Deprecated
        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.

      • V3_ASSIGN_IN_TOKENS

        @Deprecated
        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.

      • V3_GATED_SEMPRED

        @Deprecated
        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.

      • V3_SYNPRED

        @Deprecated
        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.

    • Field Detail

      • msg

        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.
      • code

        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.

      • severity

        public final ErrorSeverity severity
        The error severity.
    • Method Detail

      • values

        public static ErrorType[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (ErrorType c : ErrorType.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static ErrorType valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null