1 /*
2  * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
3  * Use of this file is governed by the BSD 3-clause license that
4  * can be found in the LICENSE.txt file in the project root.
5  */
6 package org.antlr.v4.tool;
7 
8 import org.antlr.v4.Tool;
9 import org.antlr.v4.runtime.Lexer;
10 
11 /**
12  * A complex enumeration of all the error messages that the tool can issue.
13  * <p>
14  * When adding error messages, also add a description of the message to the
15  * Wiki with a location under the Wiki page
16  * <a href="http://www.antlr.org/wiki/display/ANTLR4/Errors+Reported+by+the+ANTLR+Tool">Errors Reported by the ANTLR Tool</a>.
17  *
18  * @author Jim Idle &lt;jimi@temporal-wave.com&gt;, Terence Parr
19  * @since 4.0
20  */
21 public enum ErrorType {
22 	/*
23 	 * Tool errors
24 	 */
25 
26 	/**
27 	 * Compiler Error 1.
28 	 *
29 	 * <p>cannot write file <em>filename</em>: <em>reason</em></p>
30 	 */
31 	CANNOT_WRITE_FILE(1, "cannot write file <arg>: <arg2>", ErrorSeverity.ERROR),
32 	/**
33 	 * Compiler Error 2.
34 	 *
35 	 * <p>unknown command-line option <em>option</em></p>
36 	 */
37 	INVALID_CMDLINE_ARG(2, "unknown command-line option <arg>", ErrorSeverity.ERROR),
38 	/**
39 	 * Compiler Error 3.
40 	 *
41 	 * <p>cannot find tokens file <em>filename</em></p>
42 	 */
43 	CANNOT_FIND_TOKENS_FILE_GIVEN_ON_CMDLINE(3, "cannot find tokens file <arg> given for <arg2>", ErrorSeverity.ERROR),
44 	/**
45 	 * Compiler Error 4.
46 	 *
47 	 * <p>cannot find tokens file <em>filename</em>: <em>reason</em></p>
48 	 */
49 	ERROR_READING_TOKENS_FILE(4, "error reading tokens file <arg>: <arg2>", ErrorSeverity.ERROR),
50 	/**
51 	 * Compiler Error 5.
52 	 *
53 	 * <p>directory not found: <em>directory</em></p>
54 	 */
55 	DIR_NOT_FOUND(5, "directory not found: <arg>", ErrorSeverity.ERROR),
56 	/**
57 	 * Compiler Error 6.
58 	 *
59 	 * <p>output directory is a file: <em>filename</em></p>
60 	 */
61 	OUTPUT_DIR_IS_FILE(6, "output directory is a file: <arg>", ErrorSeverity.ERROR),
62 	/**
63 	 * Compiler Error 7.
64 	 *
65 	 * <p>cannot find or open file: <em>filename</em></p>
66 	 */
67 	CANNOT_OPEN_FILE(7, "cannot find or open file: <arg><if(exception&&verbose)>; reason: <exception><endif>", ErrorSeverity.ERROR),
68 	/**
69 	 * Compiler Error 8.
70 	 *
71 	 * <p>
72 	 * grammar name <em>name</em> and file name <em>filename</em> differ</p>
73 	 */
74 	FILE_AND_GRAMMAR_NAME_DIFFER(8, "grammar name <arg> and file name <arg2> differ", ErrorSeverity.ERROR),
75 	/**
76 	 * Compiler Error 9.
77 	 *
78 	 * <p>invalid {@code -Dname=value} syntax: <em>syntax</em></p>
79 	 */
80 	BAD_OPTION_SET_SYNTAX(9, "invalid -Dname=value syntax: <arg>", ErrorSeverity.ERROR),
81 	/**
82 	 * Compiler Error 10.
83 	 *
84 	 * <p>warning treated as error</p>
85 	 */
86 	WARNING_TREATED_AS_ERROR(10, "warning treated as error", ErrorSeverity.ERROR_ONE_OFF),
87 	/**
88 	 * Compiler Error 11.
89 	 *
90 	 * <p>cannot find tokens file <em>filename</em>: <em>reason</em></p>
91 	 */
92 	ERROR_READING_IMPORTED_GRAMMAR(11, "error reading imported grammar <arg> referenced in <arg2>", ErrorSeverity.ERROR),
93 
94 	/**
95 	 * Compiler Error 20.
96 	 *
97 	 * <p>internal error: <em>message</em></p>
98 	 */
99 	INTERNAL_ERROR(20, "internal error: <arg> <arg2><if(exception&&verbose)>: <exception>" +
100 				   "<stackTrace; separator=\"\\n\"><endif>", ErrorSeverity.ERROR),
101 	/**
102 	 * Compiler Error 21.
103 	 *
104 	 * <p>.tokens file syntax error <em>filename</em>: <em>message</em></p>
105 	 */
106 	TOKENS_FILE_SYNTAX_ERROR(21, ".tokens file syntax error <arg>:<arg2>", ErrorSeverity.ERROR),
107 	/**
108 	 * Compiler Warning 22.
109 	 *
110 	 * <p>template error: <em>message</em></p>
111 	 */
112 	STRING_TEMPLATE_WARNING(22, "template error: <arg> <arg2><if(exception&&verbose)>: <exception>" +
113 				   "<stackTrace; separator=\"\\n\"><endif>", ErrorSeverity.WARNING),
114 
115 	/*
116 	 * Code generation errors
117 	 */
118 
119 	/**
120 	 * Compiler Error 30.
121 	 *
122 	 * <p>can't find code generation templates: <em>group</em></p>
123 	 */
124 	MISSING_CODE_GEN_TEMPLATES(30, "can't find code generation templates: <arg>", ErrorSeverity.ERROR),
125 	/**
126 	 * Compiler Error 31.
127 	 *
128 	 * <p>
129 	 * ANTLR cannot generate <em>language</em> code as of version
130 	 * <em>version</em></p>
131 	 */
132 	CANNOT_CREATE_TARGET_GENERATOR(31, "ANTLR cannot generate <arg> code as of version "+ Tool.VERSION, ErrorSeverity.ERROR_ONE_OFF),
133 	/**
134 	 * Compiler Error 32.
135 	 *
136 	 * <p>
137 	 * code generation template <em>template</em> has missing, misnamed, or
138 	 * incomplete arg list; missing <em>field</em></p>
139 	 */
140 	CODE_TEMPLATE_ARG_ISSUE(32, "code generation template <arg> has missing, misnamed, or incomplete arg list; missing <arg2>", ErrorSeverity.ERROR),
141 	/**
142 	 * Compiler Error 33.
143 	 *
144 	 * <p>missing code generation template <em>template</em></p>
145 	 */
146 	CODE_GEN_TEMPLATES_INCOMPLETE(33, "missing code generation template <arg>", ErrorSeverity.ERROR),
147 	/**
148 	 * Compiler Error 34.
149 	 *
150 	 * <p>
151 	 * no mapping to template name for output model class <em>class</em></p>
152 	 */
153 	NO_MODEL_TO_TEMPLATE_MAPPING(34, "no mapping to template name for output model class <arg>", ErrorSeverity.ERROR),
154     /**
155    	 * Compiler Error 35.
156    	 *
157    	 * <p>templates/target and tool aren't compatible</p>
158    	 */
159    	INCOMPATIBLE_TOOL_AND_TEMPLATES(35, "<arg3> code generation target requires ANTLR <arg2>; it can't be loaded by the current ANTLR <arg>", ErrorSeverity.ERROR),
160 
161 	/*
162 	 * Grammar errors
163 	 */
164 
165 	/**
166 	 * Compiler Error 50.
167 	 *
168 	 * <p>syntax error: <em>message</em></p>
169 	 */
170 	SYNTAX_ERROR(50, "syntax error: <arg>", ErrorSeverity.ERROR),
171 	/**
172 	 * Compiler Error 51.
173 	 *
174 	 * <p>rule <em>rule</em> redefinition; previous at line <em>line</em></p>
175 	 */
176 	RULE_REDEFINITION(51, "rule <arg> redefinition; previous at line <arg2>", ErrorSeverity.ERROR),
177 	/**
178 	 * Compiler Error 52.
179 	 *
180 	 * <p>lexer rule <em>rule</em> not allowed in parser</p>
181 	 */
182 	LEXER_RULES_NOT_ALLOWED(52, "lexer rule <arg> not allowed in parser", ErrorSeverity.ERROR),
183 	/**
184 	 * Compiler Error 53.
185 	 *
186 	 * <p>parser rule <em>rule</em> not allowed in lexer</p>
187 	 */
188 	PARSER_RULES_NOT_ALLOWED(53, "parser rule <arg> not allowed in lexer", ErrorSeverity.ERROR),
189 	/**
190 	 * Compiler Error 54.
191 	 *
192 	 * <p>
193 	 * repeated grammar prequel spec ({@code options}, {@code tokens}, or
194 	 * {@code import}); please merge</p>
195 	 */
196     REPEATED_PREQUEL(54, "repeated grammar prequel spec (options, tokens, or import); please merge", ErrorSeverity.ERROR),
197 	/**
198 	 * Compiler Error 56.
199 	 *
200 	 * <p>reference to undefined rule: <em>rule</em></p>
201 	 *
202 	 * @see #PARSER_RULE_REF_IN_LEXER_RULE
203 	 */
204 	UNDEFINED_RULE_REF(56, "reference to undefined rule: <arg>", ErrorSeverity.ERROR),
205 	/**
206 	 * Compiler Error 57.
207 	 *
208 	 * <p>
209 	 * reference to undefined rule <em>rule</em> in non-local ref
210 	 * <em>reference</em></p>
211 	 */
212 	UNDEFINED_RULE_IN_NONLOCAL_REF(57, "reference to undefined rule <arg> in non-local ref <arg3>", ErrorSeverity.ERROR),
213 	/**
214 	 * Compiler Error 60.
215 	 *
216 	 * <p>token names must start with an uppercase letter: <em>name</em></p>
217 	 */
218     TOKEN_NAMES_MUST_START_UPPER(60, "token names must start with an uppercase letter: <arg>", ErrorSeverity.ERROR),
219 	/**
220 	 * Compiler Error 63.
221 	 *
222 	 * <p>
223 	 * unknown attribute reference <em>attribute</em> in
224 	 * <em>expression</em></p>
225 	 */
226 	UNKNOWN_SIMPLE_ATTRIBUTE(63, "unknown attribute reference <arg> in <arg2>", ErrorSeverity.ERROR),
227 	/**
228 	 * Compiler Error 64.
229 	 *
230 	 * <p>
231 	 * parameter <em>parameter</em> of rule <em>rule</em> is not accessible
232 	 * in this scope: <em>expression</em></p>
233 	 */
234 	INVALID_RULE_PARAMETER_REF(64, "parameter <arg> of rule <arg2> is not accessible in this scope: <arg3>", ErrorSeverity.ERROR),
235 	/**
236 	 * Compiler Error 65.
237 	 *
238 	 * <p>
239 	 * unknown attribute <em>attribute</em> for rule <em>rule</em> in
240 	 * <em>expression</em></p>
241 	 */
242 	UNKNOWN_RULE_ATTRIBUTE(65, "unknown attribute <arg> for rule <arg2> in <arg3>", ErrorSeverity.ERROR),
243 	/**
244 	 * Compiler Error 66.
245 	 *
246 	 * <p>
247 	 * attribute <em>attribute</em> isn't a valid property in
248 	 * <em>expression</em></p>
249 	 */
250     UNKNOWN_ATTRIBUTE_IN_SCOPE(66, "attribute <arg> isn't a valid property in <arg2>", ErrorSeverity.ERROR),
251 	/**
252 	 * Compiler Error 67.
253 	 *
254 	 * <p>
255 	 * missing attribute access on rule reference <em>rule</em> in
256 	 * <em>expression</em></p>
257 	 */
258 	ISOLATED_RULE_REF(67, "missing attribute access on rule reference <arg> in <arg2>", ErrorSeverity.ERROR),
259 	/**
260 	 * Compiler Error 69.
261 	 *
262 	 * <p>label <em>label</em> conflicts with rule with same name</p>
263 	 */
264 	LABEL_CONFLICTS_WITH_RULE(69, "label <arg> conflicts with rule with same name", ErrorSeverity.ERROR),
265 	/**
266 	 * Compiler Error 70.
267 	 *
268 	 * <p>label <em>label</em> conflicts with token with same name</p>
269 	 */
270 	LABEL_CONFLICTS_WITH_TOKEN(70, "label <arg> conflicts with token with same name", ErrorSeverity.ERROR),
271 	/**
272 	 * Compiler Error 72.
273 	 *
274 	 * <p>label <em>label</em> conflicts with parameter with same name</p>
275 	 */
276 	LABEL_CONFLICTS_WITH_ARG(72, "label <arg> conflicts with parameter with same name", ErrorSeverity.ERROR),
277 	/**
278 	 * Compiler Error 73.
279 	 *
280 	 * <p>label <em>label</em> conflicts with return value with same name</p>
281 	 */
282 	LABEL_CONFLICTS_WITH_RETVAL(73, "label <arg> conflicts with return value with same name", ErrorSeverity.ERROR),
283 	/**
284 	 * Compiler Error 74.
285 	 *
286 	 * <p>label <em>label</em> conflicts with local with same name</p>
287 	 */
288 	LABEL_CONFLICTS_WITH_LOCAL(74, "label <arg> conflicts with local with same name", ErrorSeverity.ERROR),
289 	/**
290 	 * Compiler Error 75.
291 	 *
292 	 * <p>
293 	 * label <em>label</em> type mismatch with previous definition:
294 	 * <em>message</em></p>
295 	 */
296 	LABEL_TYPE_CONFLICT(75, "label <arg> type mismatch with previous definition: <arg2>", ErrorSeverity.ERROR),
297 	/**
298 	 * Compiler Error 76.
299 	 *
300 	 * <p>
301 	 * return value <em>name</em> conflicts with parameter with same name</p>
302 	 */
303 	RETVAL_CONFLICTS_WITH_ARG(76, "return value <arg> conflicts with parameter with same name", ErrorSeverity.ERROR),
304 	/**
305 	 * Compiler Error 79.
306 	 *
307 	 * <p>missing argument(s) on rule reference: <em>rule</em></p>
308 	 */
309 	MISSING_RULE_ARGS(79, "missing argument(s) on rule reference: <arg>", ErrorSeverity.ERROR),
310 	/**
311 	 * Compiler Error 80.
312 	 *
313 	 * <p>rule <em>rule</em> has no defined parameters</p>
314 	 */
315 	RULE_HAS_NO_ARGS(80, "rule <arg> has no defined parameters", ErrorSeverity.ERROR),
316 	/**
317 	 * Compiler Warning 83.
318 	 *
319 	 * <p>unsupported option <em>option</em></p>
320 	 */
321 	ILLEGAL_OPTION(83, "unsupported option <arg>", ErrorSeverity.WARNING),
322 	/**
323 	 * Compiler Warning 84.
324 	 *
325 	 * <p>unsupported option value <em>name</em>=<em>value</em></p>
326 	 */
327 	ILLEGAL_OPTION_VALUE(84, "unsupported option value <arg>=<arg2>", ErrorSeverity.WARNING),
328 	/**
329 	 * Compiler Error 94.
330 	 *
331 	 * <p>redefinition of <em>action</em> action</p>
332 	 */
333     ACTION_REDEFINITION(94, "redefinition of <arg> action", ErrorSeverity.ERROR),
334 	/**
335 	 * Compiler Error 99.
336 	 *
337 	 * <p>This error may take any of the following forms.</p>
338 	 *
339 	 * <ul>
340 	 * <li>grammar <em>grammar</em> has no rules</li>
341 	 * <li>implicitly generated grammar <em>grammar</em> has no rules</li>
342 	 * </ul>
343 	 */
344 	NO_RULES(99, "<if(arg2.implicitLexerOwner)>implicitly generated <endif>grammar <arg> has no rules", ErrorSeverity.ERROR),
345 	/**
346 	 * Compiler Error 105.
347 	 *
348 	 * <p>
349 	 * reference to undefined grammar in rule reference:
350 	 * <em>grammar</em>.<em>rule</em></p>
351 	 */
352 	NO_SUCH_GRAMMAR_SCOPE(105, "reference to undefined grammar in rule reference: <arg>.<arg2>", ErrorSeverity.ERROR),
353 	/**
354 	 * Compiler Error 106.
355 	 *
356 	 * <p>rule <em>rule</em> is not defined in grammar <em>grammar</em></p>
357 	 */
358 	NO_SUCH_RULE_IN_SCOPE(106, "rule <arg2> is not defined in grammar <arg>", ErrorSeverity.ERROR),
359 	/**
360 	 * Compiler Warning 108.
361 	 *
362 	 * <p>token name <em>Token</em> is already defined</p>
363 	 */
364 	TOKEN_NAME_REASSIGNMENT(108, "token name <arg> is already defined", ErrorSeverity.WARNING),
365 	/**
366 	 * Compiler Warning 109.
367 	 *
368 	 * <p>options ignored in imported grammar <em>grammar</em></p>
369 	 */
370 	OPTIONS_IN_DELEGATE(109, "options ignored in imported grammar <arg>", ErrorSeverity.WARNING),
371 	/**
372 	 * Compiler Error 110.
373 	 *
374 	 * <p>
375 	 * can't find or load grammar <em>grammar</em> from
376 	 * <em>filename</em></p>
377 	 */
378 	CANNOT_FIND_IMPORTED_GRAMMAR(110, "can't find or load grammar <arg>", ErrorSeverity.ERROR),
379 	/**
380 	 * Compiler Error 111.
381 	 *
382 	 * <p>
383 	 * <em>grammartype</em> grammar <em>grammar1</em> cannot import
384 	 * <em>grammartype</em> grammar <em>grammar2</em></p>
385 	 */
386 	INVALID_IMPORT(111, "<arg.typeString> grammar <arg.name> cannot import <arg2.typeString> grammar <arg2.name>", ErrorSeverity.ERROR),
387 	/**
388 	 * Compiler Error 113.
389 	 *
390 	 * <p>
391 	 * <em>grammartype</em> grammar <em>grammar1</em> and imported
392 	 * <em>grammartype</em> grammar <em>grammar2</em> both generate
393 	 * <em>recognizer</em></p>
394 	 */
395 	IMPORT_NAME_CLASH(113, "<arg.typeString> grammar <arg.name> and imported <arg2.typeString> grammar <arg2.name> both generate <arg2.recognizerName>", ErrorSeverity.ERROR),
396 	/**
397 	 * Compiler Error 114.
398 	 *
399 	 * <p>cannot find tokens file <em>filename</em></p>
400 	 */
401 	CANNOT_FIND_TOKENS_FILE_REFD_IN_GRAMMAR(114, "cannot find tokens file <arg>", ErrorSeverity.ERROR),
402 	/**
403 	 * Compiler Warning 118.
404 	 *
405 	 * <p>
406 	 * all operators of alt <em>alt</em> of left-recursive rule must have same
407 	 * associativity</p>
408 	 *
409 	 * @deprecated This warning is no longer applicable with the current syntax for specifying associativity.
410 	 */
411 	@Deprecated
412 	ALL_OPS_NEED_SAME_ASSOC(118, "all operators of alt <arg> of left-recursive rule must have same associativity", ErrorSeverity.WARNING),
413 	/**
414 	 * Compiler Error 119.
415 	 *
416 	 * <p>
417 	 * The following sets of rules are mutually left-recursive
418 	 * <em>[rules]</em></p>
419 	 */
420 	LEFT_RECURSION_CYCLES(119, "The following sets of rules are mutually left-recursive <arg:{c| [<c:{r|<r.name>}; separator=\", \">]}; separator=\" and \">", ErrorSeverity.ERROR),
421 	/**
422 	 * Compiler Error 120.
423 	 *
424 	 * <p>lexical modes are only allowed in lexer grammars</p>
425 	 */
426 	MODE_NOT_IN_LEXER(120, "lexical modes are only allowed in lexer grammars", ErrorSeverity.ERROR),
427 	/**
428 	 * Compiler Error 121.
429 	 *
430 	 * <p>cannot find an attribute name in attribute declaration</p>
431 	 */
432 	CANNOT_FIND_ATTRIBUTE_NAME_IN_DECL(121, "cannot find an attribute name in attribute declaration", ErrorSeverity.ERROR),
433 	/**
434 	 * Compiler Error 122.
435 	 *
436 	 * <p>rule <em>rule</em>: must label all alternatives or none</p>
437 	 */
438 	RULE_WITH_TOO_FEW_ALT_LABELS(122, "rule <arg>: must label all alternatives or none", ErrorSeverity.ERROR),
439 	/**
440 	 * Compiler Error 123.
441 	 *
442 	 * <p>
443 	 * rule alt label <em>label</em> redefined in rule <em>rule1</em>,
444 	 * originally in rule <em>rule2</em></p>
445 	 */
446 	ALT_LABEL_REDEF(123, "rule alt label <arg> redefined in rule <arg2>, originally in rule <arg3>", ErrorSeverity.ERROR),
447 	/**
448 	 * Compiler Error 124.
449 	 *
450 	 * <p>
451 	 * rule alt label <em>label</em> conflicts with rule <em>rule</em></p>
452 	 */
453 	ALT_LABEL_CONFLICTS_WITH_RULE(124, "rule alt label <arg> conflicts with rule <arg2>", ErrorSeverity.ERROR),
454 	/**
455 	 * Compiler Warning 125.
456 	 *
457 	 * <p>implicit definition of token <em>Token</em> in parser</p>
458 	 */
459 	IMPLICIT_TOKEN_DEFINITION(125, "implicit definition of token <arg> in parser", ErrorSeverity.WARNING),
460 	/**
461 	 * Compiler Error 126.
462 	 *
463 	 * <p>
464 	 * cannot create implicit token for string literal in non-combined grammar:
465 	 * <em>literal</em></p>
466 	 */
467 	IMPLICIT_STRING_DEFINITION(126, "cannot create implicit token for string literal in non-combined grammar: <arg>", ErrorSeverity.ERROR),
468 	/**
469 	 * Compiler Error 128.
470 	 *
471 	 * <p>
472 	 * attribute references not allowed in lexer actions:
473 	 * <em>expression</em></p>
474 	 */
475 	ATTRIBUTE_IN_LEXER_ACTION(128, "attribute references not allowed in lexer actions: $<arg>", ErrorSeverity.ERROR),
476 	/**
477 	 * Compiler Error 130.
478 	 *
479 	 * <p>label <em>label</em> assigned to a block which is not a set</p>
480 	 */
481 	LABEL_BLOCK_NOT_A_SET(130, "label <arg> assigned to a block which is not a set", ErrorSeverity.ERROR),
482 	/**
483 	 * Compiler Warning 131.
484 	 *
485 	 * <p>This warning may take any of the following forms.</p>
486 	 *
487 	 * <ul>
488 	 * <li>greedy block {@code ()*} contains wildcard; the non-greedy syntax {@code ()*?} may be preferred</li>
489 	 * <li>greedy block {@code ()+} contains wildcard; the non-greedy syntax {@code ()+?} may be preferred</li>
490 	 * </ul>
491 	 */
492 	EXPECTED_NON_GREEDY_WILDCARD_BLOCK(131, "greedy block ()<arg> contains wildcard; the non-greedy syntax ()<arg>? may be preferred", ErrorSeverity.WARNING),
493 	/**
494 	 * Compiler Error 132.
495 	 *
496 	 * <p>
497 	 * action in lexer rule <em>rule</em> must be last element of single
498 	 * outermost alt</p>
499 	 *
500 	 * @deprecated This error is no longer issued by ANTLR 4.2.
501 	 */
502 	@Deprecated
503 	LEXER_ACTION_PLACEMENT_ISSUE(132, "action in lexer rule <arg> must be last element of single outermost alt", ErrorSeverity.ERROR),
504 	/**
505 	 * Compiler Error 133.
506 	 *
507 	 * <p>
508 	 * {@code ->command} in lexer rule <em>rule</em> must be last element of
509 	 * single outermost alt</p>
510 	 */
511 	LEXER_COMMAND_PLACEMENT_ISSUE(133, "->command in lexer rule <arg> must be last element of single outermost alt", ErrorSeverity.ERROR),
512 	/**
513 	 * Compiler Error 134.
514 	 *
515 	 * <p>
516 	 * symbol <em>symbol</em> conflicts with generated code in target language
517 	 * or runtime</p>
518 	 *
519 	 * <p>
520 	 * Note: This error has the same number as the unrelated error
521 	 * {@link #UNSUPPORTED_REFERENCE_IN_LEXER_SET}.</p>
522 	 */
523 	USE_OF_BAD_WORD(134, "symbol <arg> conflicts with generated code in target language or runtime", ErrorSeverity.ERROR),
524 	/**
525 	 * Compiler Error 183.
526 	 *
527 	 * <p>rule reference <em>rule</em> is not currently supported in a set</p>
528 	 *
529 	 * <p>
530 	 * Note: This error has the same number as the unrelated error
531 	 * {@link #USE_OF_BAD_WORD}.</p>
532 	 */
533 	UNSUPPORTED_REFERENCE_IN_LEXER_SET(183, "rule reference <arg> is not currently supported in a set", ErrorSeverity.ERROR),
534 	/**
535 	 * Compiler Error 135.
536 	 *
537 	 * <p>cannot assign a value to list label <em>label</em></p>
538 	 */
539 	ASSIGNMENT_TO_LIST_LABEL(135, "cannot assign a value to list label <arg>", ErrorSeverity.ERROR),
540 	/**
541 	 * Compiler Error 136.
542 	 *
543 	 * <p>return value <em>name</em> conflicts with rule with same name</p>
544 	 */
545 	RETVAL_CONFLICTS_WITH_RULE(136, "return value <arg> conflicts with rule with same name", ErrorSeverity.ERROR),
546 	/**
547 	 * Compiler Error 137.
548 	 *
549 	 * <p>return value <em>name</em> conflicts with token with same name</p>
550 	 */
551 	RETVAL_CONFLICTS_WITH_TOKEN(137, "return value <arg> conflicts with token with same name", ErrorSeverity.ERROR),
552 	/**
553 	 * Compiler Error 138.
554 	 *
555 	 * <p>parameter <em>parameter</em> conflicts with rule with same name</p>
556 	 */
557 	ARG_CONFLICTS_WITH_RULE(138, "parameter <arg> conflicts with rule with same name", ErrorSeverity.ERROR),
558 	/**
559 	 * Compiler Error 139.
560 	 *
561 	 * <p>parameter <em>parameter</em> conflicts with token with same name</p>
562 	 */
563 	ARG_CONFLICTS_WITH_TOKEN(139, "parameter <arg> conflicts with token with same name", ErrorSeverity.ERROR),
564 	/**
565 	 * Compiler Error 140.
566 	 *
567 	 * <p>local <em>local</em> conflicts with rule with same name</p>
568 	 */
569 	LOCAL_CONFLICTS_WITH_RULE(140, "local <arg> conflicts with rule with same name", ErrorSeverity.ERROR),
570 	/**
571 	 * Compiler Error 141.
572 	 *
573 	 * <p>local <em>local</em> conflicts with rule token same name</p>
574 	 */
575 	LOCAL_CONFLICTS_WITH_TOKEN(141, "local <arg> conflicts with rule token same name", ErrorSeverity.ERROR),
576 	/**
577 	 * Compiler Error 142.
578 	 *
579 	 * <p>local <em>local</em> conflicts with parameter with same name</p>
580 	 */
581 	LOCAL_CONFLICTS_WITH_ARG(142, "local <arg> conflicts with parameter with same name", ErrorSeverity.ERROR),
582 	/**
583 	 * Compiler Error 143.
584 	 *
585 	 * <p>local <em>local</em> conflicts with return value with same name</p>
586 	 */
587 	LOCAL_CONFLICTS_WITH_RETVAL(143, "local <arg> conflicts with return value with same name", ErrorSeverity.ERROR),
588 	/**
589 	 * Compiler Error 144.
590 	 *
591 	 * <p>
592 	 * multi-character literals are not allowed in lexer sets:
593 	 * <em>literal</em></p>
594 	 */
595 	INVALID_LITERAL_IN_LEXER_SET(144, "multi-character literals are not allowed in lexer sets: <arg>", ErrorSeverity.ERROR),
596 	/**
597 	 * Compiler Error 145.
598 	 *
599 	 * <p>
600 	 * lexer mode <em>mode</em> must contain at least one non-fragment
601 	 * rule</p>
602 	 *
603 	 * <p>
604 	 * Every lexer mode must contain at least one rule which is not declared
605 	 * with the {@code fragment} modifier.</p>
606 	 */
607 	MODE_WITHOUT_RULES(145, "lexer mode <arg> must contain at least one non-fragment rule", ErrorSeverity.ERROR),
608 	/**
609 	 * Compiler Warning 146.
610 	 *
611 	 * <p>non-fragment lexer rule <em>rule</em> can match the empty string</p>
612 	 *
613 	 * <p>All non-fragment lexer rules must match at least one character.</p>
614 	 *
615 	 * <p>The following example shows this error.</p>
616 	 *
617 	 * <pre>
618 	 * Whitespace : [ \t]+;  // ok
619 	 * Whitespace : [ \t];   // ok
620 	 *
621 	 * fragment WS : [ \t]*; // ok
622 	 *
623 	 * Whitespace : [ \t]*;  // error 146
624 	 * </pre>
625 	 */
626 	EPSILON_TOKEN(146, "non-fragment lexer rule <arg> can match the empty string", ErrorSeverity.WARNING),
627 	/**
628 	 * Compiler Error 147.
629 	 *
630 	 * <p>
631 	 * left recursive rule <em>rule</em> must contain an alternative which is
632 	 * not left recursive</p>
633 	 *
634 	 * <p>Left-recursive rules must contain at least one alternative which is not
635 	 * left recursive.</p>
636 	 *
637 	 * <p>The following rule produces this error.</p>
638 	 *
639 	 * <pre>
640 	 * // error 147:
641 	 * a : a ID
642 	 *   | a INT
643 	 *   ;
644 	 * </pre>
645 	 */
646 	NO_NON_LR_ALTS(147, "left recursive rule <arg> must contain an alternative which is not left recursive", ErrorSeverity.ERROR),
647 	/**
648 	 * Compiler Error 148.
649 	 *
650 	 * <p>
651 	 * left recursive rule <em>rule</em> contains a left recursive alternative
652 	 * which can be followed by the empty string</p>
653 	 *
654 	 * <p>In left-recursive rules, all left-recursive alternatives must match at
655 	 * least one symbol following the recursive rule invocation.</p>
656 	 *
657 	 * <p>The following rule produces this error.</p>
658 	 *
659 	 * <pre>
660 	 * a : ID    // ok        (alternative is not left recursive)
661 	 *   | a INT // ok        (a must be follow by INT)
662 	 *   | a ID? // error 148 (the ID following a is optional)
663 	 *   ;
664 	 * </pre>
665 	 */
666 	EPSILON_LR_FOLLOW(148, "left recursive rule <arg> contains a left recursive alternative which can be followed by the empty string", ErrorSeverity.ERROR),
667 	/**
668 	 * Compiler Error 149.
669 	 *
670 	 * <p>
671 	 * lexer command <em>command</em> does not exist or is not supported by
672 	 * the current target</p>
673 	 *
674 	 * <p>Each lexer command requires an explicit implementation in the target
675 	 * templates. This error indicates that the command was incorrectly written
676 	 * or is not supported by the current target.</p>
677 	 *
678 	 * <p>The following rule produces this error.</p>
679 	 *
680 	 * <pre>
681 	 * X : 'foo' -&gt; type(Foo);  // ok
682 	 * Y : 'foo' -&gt; token(Foo); // error 149 (token is not a supported lexer command)
683 	 * </pre>
684 	 *
685 	 * @since 4.1
686 	 */
687 	INVALID_LEXER_COMMAND(149, "lexer command <arg> does not exist or is not supported by the current target", ErrorSeverity.ERROR),
688 	/**
689 	 * Compiler Error 150.
690 	 *
691 	 * <p>missing argument for lexer command <em>command</em></p>
692 	 *
693 	 * <p>Some lexer commands require an argument.</p>
694 	 *
695 	 * <p>The following rule produces this error.</p>
696 	 *
697 	 * <pre>
698 	 * X : 'foo' -&gt; type(Foo); // ok
699 	 * Y : 'foo' -&gt; type;      // error 150 (the type command requires an argument)
700 	 * </pre>
701 	 *
702 	 * @since 4.1
703 	 */
704 	MISSING_LEXER_COMMAND_ARGUMENT(150, "missing argument for lexer command <arg>", ErrorSeverity.ERROR),
705 	/**
706 	 * Compiler Error 151.
707 	 *
708 	 * <p>lexer command <em>command</em> does not take any arguments</p>
709 	 *
710 	 * <p>A lexer command which does not take parameters was invoked with an
711 	 * argument.</p>
712 	 *
713 	 * <p>The following rule produces this error.</p>
714 	 *
715 	 * <pre>
716 	 * X : 'foo' -&gt; popMode;    // ok
717 	 * Y : 'foo' -&gt; popMode(A); // error 151 (the popMode command does not take an argument)
718 	 * </pre>
719 	 *
720 	 * @since 4.1
721 	 */
722 	UNWANTED_LEXER_COMMAND_ARGUMENT(151, "lexer command <arg> does not take any arguments", ErrorSeverity.ERROR),
723 	/**
724 	 * Compiler Error 152.
725 	 *
726 	 * <p>unterminated string literal</p>
727 	 *
728 	 * <p>The grammar contains an unterminated string literal.</p>
729 	 *
730 	 * <p>The following rule produces this error.</p>
731 	 *
732 	 * <pre>
733 	 * x : 'x'; // ok
734 	 * y : 'y';  // error 152
735 	 * </pre>
736 	 *
737 	 * @since 4.1
738 	 */
739 	UNTERMINATED_STRING_LITERAL(152, "unterminated string literal", ErrorSeverity.ERROR),
740 	/**
741 	 * Compiler Error 153.
742 	 *
743 	 * <p>
744 	 * rule <em>rule</em> contains a closure with at least one alternative
745 	 * that can match an empty string</p>
746 	 *
747 	 * <p>A rule contains a closure ({@code (...)*}) or positive closure
748 	 * ({@code (...)+}) around an empty alternative.</p>
749 	 *
750 	 * <p>The following rule produces this error.</p>
751 	 *
752 	 * <pre>
753 	 * x  : ;
754 	 * y  : x+;                                // error 153
755 	 * z1 : ('foo' | 'bar'? 'bar2'?)*;         // error 153
756 	 * z2 : ('foo' | 'bar' 'bar2'? | 'bar2')*; // ok
757 	 * </pre>
758 	 *
759 	 * @since 4.1
760 	 */
761 	EPSILON_CLOSURE(153, "rule <arg> contains a closure with at least one alternative that can match an empty string", ErrorSeverity.ERROR),
762 	/**
763 	 * Compiler Warning 154.
764 	 *
765 	 * <p>
766 	 * rule <em>rule</em> contains an optional block with at least one
767 	 * alternative that can match an empty string</p>
768 	 *
769 	 * <p>A rule contains an optional block ({@code (...)?}) around an empty
770 	 * alternative.</p>
771 	 *
772 	 * <p>The following rule produces this warning.</p>
773 	 *
774 	 * <pre>
775 	 * x  : ;
776 	 * y  : x?;                                // warning 154
777 	 * z1 : ('foo' | 'bar'? 'bar2'?)?;         // warning 154
778 	 * z2 : ('foo' | 'bar' 'bar2'? | 'bar2')?; // ok
779 	 * </pre>
780 	 *
781 	 * @since 4.1
782 	 */
783 	EPSILON_OPTIONAL(154, "rule <arg> contains an optional block with at least one alternative that can match an empty string", ErrorSeverity.WARNING),
784 	/**
785 	 * Compiler Warning 155.
786 	 *
787 	 * <p>
788 	 * rule <em>rule</em> contains a lexer command with an unrecognized
789 	 * constant value; lexer interpreters may produce incorrect output</p>
790 	 *
791 	 * <p>A lexer rule contains a standard lexer command, but the constant value
792 	 * argument for the command is an unrecognized string. As a result, the
793 	 * lexer command will be translated as a custom lexer action, preventing the
794 	 * command from executing in some interpreted modes. The output of the lexer
795 	 * interpreter may not match the output of the generated lexer.</p>
796 	 *
797 	 * <p>The following rule produces this warning.</p>
798 	 *
799 	 * <pre>
800 	 * &#064;members {
801 	 * public static final int CUSTOM = HIDDEN + 1;
802 	 * }
803 	 *
804 	 * X : 'foo' -&gt; channel(HIDDEN);           // ok
805 	 * Y : 'bar' -&gt; channel(CUSTOM);           // warning 155
806 	 * </pre>
807 	 *
808 	 * @since 4.2
809 	 */
810 	UNKNOWN_LEXER_CONSTANT(155, "rule <arg> contains a lexer command with an unrecognized constant value; lexer interpreters may produce incorrect output", ErrorSeverity.WARNING),
811 	/**
812 	 * Compiler Error 156.
813 	 *
814 	 * <p>invalid escape sequence</p>
815 	 *
816 	 * <p>The grammar contains a string literal with an invalid escape sequence.</p>
817 	 *
818 	 * <p>The following rule produces this error.</p>
819 	 *
820 	 * <pre>
821 	 * x : 'x';  // ok
822 	 * y : '\u005Cu'; // error 156
823 	 * </pre>
824 	 *
825 	 * @since 4.2.1
826 	 */
827 	INVALID_ESCAPE_SEQUENCE(156, "invalid escape sequence <arg>", ErrorSeverity.WARNING),
828 	/**
829 	 * Compiler Warning 157.
830 	 *
831 	 * <p>rule <em>rule</em> contains an assoc element option in an
832 	 * unrecognized location</p>
833 	 *
834 	 * <p>
835 	 * In ANTLR 4.2, the position of the {@code assoc} element option was moved
836 	 * from the operator terminal(s) to the alternative itself. This warning is
837 	 * reported when an {@code assoc} element option is specified on a grammar
838 	 * element that is not recognized by the current version of ANTLR, and as a
839 	 * result will simply be ignored.
840 	 * </p>
841 	 *
842 	 * <p>The following rule produces this warning.</p>
843 	 *
844 	 * <pre>
845 	 * x : 'x'
846 	 *   | x '+'&lt;assoc=right&gt; x   // warning 157
847 	 *   |&lt;assoc=right&gt; x * x   // ok
848 	 *   ;
849 	 * </pre>
850 	 *
851 	 * @since 4.2.1
852 	 */
853 	UNRECOGNIZED_ASSOC_OPTION(157, "rule <arg> contains an assoc terminal option in an unrecognized location", ErrorSeverity.WARNING),
854 	/**
855 	 * Compiler Warning 158.
856 	 *
857 	 * <p>fragment rule <em>rule</em> contains an action or command which can
858 	 * never be executed</p>
859 	 *
860 	 * <p>A lexer rule which is marked with the {@code fragment} modifier
861 	 * contains an embedded action or lexer command. ANTLR lexers only execute
862 	 * commands and embedded actions located in the top-level matched rule.
863 	 * Since fragment rules can never be the top-level rule matched by a lexer,
864 	 * actions or commands placed in these rules can never be executed during
865 	 * the lexing process.</p>
866 	 *
867 	 * <p>The following rule produces this warning.</p>
868 	 *
869 	 * <pre>
870 	 * X1 : 'x' -&gt; more    // ok
871 	 *    ;
872 	 * Y1 : 'x' {more();}  // ok
873 	 *    ;
874 	 * fragment
875 	 * X2 : 'x' -&gt; more    // warning 158
876 	 *    ;
877 	 * fragment
878 	 * Y2 : 'x' {more();}  // warning 158
879 	 *    ;
880 	 * </pre>
881 	 *
882 	 * @since 4.2.1
883 	 */
884 	FRAGMENT_ACTION_IGNORED(158, "fragment rule <arg> contains an action or command which can never be executed", ErrorSeverity.WARNING),
885 	/**
886 	 * Compiler Error 159.
887 	 *
888 	 * <p>cannot declare a rule with reserved name <em>rule</em></p>
889 	 *
890 	 * <p>A rule was declared with a reserved name.</p>
891 	 *
892 	 * <p>The following rule produces this error.</p>
893 	 *
894 	 * <pre>
895 	 * EOF :  ' '   // error 159 (EOF is a reserved name)
896 	 *     ;
897 	 * </pre>
898 	 *
899 	 * @since 4.2.1
900 	 */
901 	RESERVED_RULE_NAME(159, "cannot declare a rule with reserved name <arg>", ErrorSeverity.ERROR),
902 	/**
903 	 * Compiler Error 160.
904 	 *
905 	 * <p>reference to parser rule <em>rule</em> in lexer rule <em>name</em></p>
906 	 *
907 	 * @see #UNDEFINED_RULE_REF
908 	 */
909 	PARSER_RULE_REF_IN_LEXER_RULE(160, "reference to parser rule <arg> in lexer rule <arg2>", ErrorSeverity.ERROR),
910 	/**
911 	 * Compiler Error 161.
912 	 *
913 	 * <p>channel <em>name</em> conflicts with token with same name</p>
914 	 */
915 	CHANNEL_CONFLICTS_WITH_TOKEN(161, "channel <arg> conflicts with token with same name", ErrorSeverity.ERROR),
916 	/**
917 	 * Compiler Error 162.
918 	 *
919 	 * <p>channel <em>name</em> conflicts with mode with same name</p>
920 	 */
921 	CHANNEL_CONFLICTS_WITH_MODE(162, "channel <arg> conflicts with mode with same name", ErrorSeverity.ERROR),
922 	/**
923 	 * Compiler Error 163.
924 	 *
925 	 * <p>custom channels are not supported in parser grammars</p>
926 	 */
927 	CHANNELS_BLOCK_IN_PARSER_GRAMMAR(163, "custom channels are not supported in parser grammars", ErrorSeverity.ERROR),
928 	/**
929 	 * Compiler Error 164.
930 	 *
931 	 * <p>custom channels are not supported in combined grammars</p>
932 	 */
933 	CHANNELS_BLOCK_IN_COMBINED_GRAMMAR(164, "custom channels are not supported in combined grammars", ErrorSeverity.ERROR),
934 
935 	NONCONFORMING_LR_RULE(169, "rule <arg> is left recursive but doesn't conform to a pattern ANTLR can handle", ErrorSeverity.ERROR),
936 	/**
937 	 * Compiler Error 170.
938 	 *
939 	 * <pre>
940 	 * mode M1;
941 	 * A1: 'a'; // ok
942 	 * mode M2;
943 	 * A2: 'a'; // ok
944 	 * M1: 'b'; // error 170
945 	 * </pre>
946 	 *
947 	 * <p>mode <em>name</em> conflicts with token with same name</p>
948 	 */
949 	MODE_CONFLICTS_WITH_TOKEN(170, "mode <arg> conflicts with token with same name", ErrorSeverity.ERROR),
950 	/**
951 	 * Compiler Error 171.
952 	 *
953 	 * <p>can not use or declare token with reserved name</p>
954 	 *
955 	 * <p>Reserved names: HIDDEN, DEFAULT_TOKEN_CHANNEL, SKIP, MORE, MAX_CHAR_VALUE, MIN_CHAR_VALUE.
956 	 *
957 	 * <p>Can be used but cannot be declared: EOF</p>
958 	 */
959 	TOKEN_CONFLICTS_WITH_COMMON_CONSTANTS(171, "cannot use or declare token with reserved name <arg>", ErrorSeverity.ERROR),
960 	/**
961 	 * Compiler Error 172.
962 	 *
963 	 * <p>can not use or declare channel with reserved name</p>
964 	 *
965 	 * <p>Reserved names: DEFAULT_MODE, SKIP, MORE, EOF, MAX_CHAR_VALUE, MIN_CHAR_VALUE.
966 	 *
967 	 * <p>Can be used but cannot be declared: HIDDEN, DEFAULT_TOKEN_CHANNEL</p>
968 	 */
969 	CHANNEL_CONFLICTS_WITH_COMMON_CONSTANTS(172, "cannot use or declare channel with reserved name <arg>", ErrorSeverity.ERROR),
970 	/**
971 	 * Compiler Error 173.
972 	 *
973 	 * <p>can not use or declare mode with reserved name</p>
974 	 *
975 	 * <p>Reserved names: HIDDEN, DEFAULT_TOKEN_CHANNEL, SKIP, MORE, MAX_CHAR_VALUE, MIN_CHAR_VALUE.
976 	 *
977 	 * <p>Can be used and cannot declared: DEFAULT_MODE</p>
978 	 */
979 	MODE_CONFLICTS_WITH_COMMON_CONSTANTS(173, "cannot use or declare mode with reserved name <arg>", ErrorSeverity.ERROR),
980 	/**
981 	 * Compiler Error 174.
982 	 *
983 	 * <p>empty strings not allowed</p>
984 	 *
985 	 * <pre>
986 	 * A: '''test''';
987 	 * B: '';
988 	 * C: 'test' '';
989 	 * D: [];
990 	 * E: [f-a];
991 	 * </pre>
992 	 */
993 	EMPTY_STRINGS_AND_SETS_NOT_ALLOWED(174, "string literals and sets cannot be empty: <arg>", ErrorSeverity.ERROR),
994 	/**
995 	 * Compiler Error 175.
996 	 *
997 	 * <p><em>name</em> is not a recognized token name</p>
998 	 *
999 	 * <pre>TOKEN: 'a' -> type(CHANNEL1); // error 175</pre>
1000 	 */
1001 	CONSTANT_VALUE_IS_NOT_A_RECOGNIZED_TOKEN_NAME(175, "<arg> is not a recognized token name", ErrorSeverity.ERROR),
1002 	/**
1003 	 * Compiler Error 176.
1004 	 *
1005 	 * <p><em>name</em>is not a recognized mode name</p>
1006 	 *
1007 	 * <pre>TOKEN: 'a' -> mode(MODE1); // error 176</pre>
1008 	 */
1009 	CONSTANT_VALUE_IS_NOT_A_RECOGNIZED_MODE_NAME(176, "<arg> is not a recognized mode name", ErrorSeverity.ERROR),
1010 	/**
1011 	 * Compiler Error 177.
1012 	 *
1013 	 * <p><em>name</em> is not a recognized channel name</p>
1014 	 *
1015 	 * <pre>TOKEN: 'a' -> channel(TOKEN1); // error 177</pre>
1016 	 */
1017 	CONSTANT_VALUE_IS_NOT_A_RECOGNIZED_CHANNEL_NAME(177, "<arg> is not a recognized channel name", ErrorSeverity.ERROR),
1018 	/*
1019 	* Compiler Warning 178.
1020 	*
1021 	* <p>lexer rule has a duplicated commands</p>
1022 	*
1023 	* <p>TOKEN: 'asdf' -> mode(MODE1), mode(MODE2);</p>
1024 	* */
1025 	DUPLICATED_COMMAND(178, "duplicated command <arg>", ErrorSeverity.WARNING),
1026 	/*
1027 	* Compiler Waring 179.
1028 	*
1029 	* <p>incompatible commands <em>command1</em> and <em>command2</em></p>
1030 	*
1031 	* <p>T00: 'a00' -> skip, more;</p>
1032 	 */
1033 	INCOMPATIBLE_COMMANDS(179, "incompatible commands <arg> and <arg2>", ErrorSeverity.WARNING),
1034 	/**
1035 	 * Compiler Warning 180.
1036 	 *
1037 	 * <p>chars "a-f" used multiple times in set [a-fc-m]</p>
1038 	 *
1039 	 * <pre>
1040 	 * A:    [aa-z];   // warning
1041 	 * B:    [a-fc-m]; // warning
1042 	 * </pre>
1043 	 *
1044 	 * TODO: Does not work with fragment rules.
1045 	 */
1046 	CHARACTERS_COLLISION_IN_SET(180, "chars <arg> used multiple times in set <arg2>", ErrorSeverity.WARNING),
1047 
1048 	/**
1049 	 * Compiler Warning 181
1050 	 *
1051 	 * <p>The token range operator makes no sense in the parser as token types
1052 	 * are not ordered (except in implementation).
1053 	 * </p>
1054 	 *
1055 	 * <pre>
1056 	 * grammar T;
1057 	 * a : 'A'..'Z' ;
1058 	 * </pre>
1059 	 *
1060 	 */
1061 	TOKEN_RANGE_IN_PARSER(181, "token ranges not allowed in parser: <arg>..<arg2>", ErrorSeverity.ERROR),
1062 
1063 	/**
1064 	 * Compiler Error 182.
1065 	 *
1066 	 * <p>Unicode properties cannot be part of a lexer charset range</p>
1067 	 *
1068 	 * <pre>
1069 	 * A: [\\p{Letter}-\\p{Number}];
1070 	 * </pre>
1071 	 */
1072 	UNICODE_PROPERTY_NOT_ALLOWED_IN_RANGE(
1073 			182,
1074 			"unicode property escapes not allowed in lexer charset range: <arg>",
1075 			ErrorSeverity.ERROR),
1076 
1077 	/**
1078 	 * Compiler Warning 184.
1079 	 *
1080 	 * <p>The token value overlapped by another token or self</p>
1081 	 *
1082 	 * <pre>
1083 	 * TOKEN1: 'value';
1084 	 * TOKEN2: 'value'; // warning
1085 	 * </pre>
1086 	 */
1087 	TOKEN_UNREACHABLE(
1088 			184,
1089 			"One of the token <arg> values unreachable. <arg2> is always overlapped by token <arg3>",
1090 			ErrorSeverity.WARNING),
1091 
1092 	/*
1093 	 * Backward incompatibility errors
1094 	 */
1095 
1096 	/**
1097 	 * Compiler Error 200.
1098 	 *
1099 	 * <p>tree grammars are not supported in ANTLR 4</p>
1100 	 *
1101 	 * <p>
1102 	 * This error message is provided as a compatibility notice for users
1103 	 * migrating from ANTLR 3. ANTLR 4 does not support tree grammars, but
1104 	 * instead offers automatically generated parse tree listeners and visitors
1105 	 * as a more maintainable alternative.</p>
1106 	 */
1107 	V3_TREE_GRAMMAR(200, "tree grammars are not supported in ANTLR 4", ErrorSeverity.ERROR),
1108 	/**
1109 	 * Compiler Warning 201.
1110 	 *
1111 	 * <p>
1112 	 * labels in lexer rules are not supported in ANTLR 4; actions cannot
1113 	 * reference elements of lexical rules but you can use
1114 	 * {@link Lexer#getText()} to get the entire text matched for the rule</p>
1115 	 *
1116 	 * <p>
1117 	 * ANTLR 4 uses a DFA for recognition of entire tokens, resulting in faster
1118 	 * and smaller lexers than ANTLR 3 produced. As a result, sub-rules
1119 	 * referenced within lexer rules are not tracked independently, and cannot
1120 	 * be assigned to labels.</p>
1121 	 */
1122 	V3_LEXER_LABEL(201, "labels in lexer rules are not supported in ANTLR 4; " +
1123 		"actions cannot reference elements of lexical rules but you can use " +
1124 		"getText() to get the entire text matched for the rule", ErrorSeverity.WARNING),
1125 	/**
1126 	 * Compiler Warning 202.
1127 	 *
1128 	 * <p>
1129 	 * {@code tokens {A; B;}} syntax is now {@code tokens {A, B}} in ANTLR
1130 	 * 4</p>
1131 	 *
1132 	 * <p>
1133 	 * ANTLR 4 uses comma-separated token declarations in the {@code tokens{}}
1134 	 * block. This warning appears when the tokens block is written using the
1135 	 * ANTLR 3 syntax of semicolon-terminated token declarations.</p>
1136 	 *
1137 	 * <p>
1138 	 * <strong>NOTE:</strong> ANTLR 4 does not allow a trailing comma to appear following the
1139 	 * last token declared in the {@code tokens{}} block.</p>
1140 	 */
1141 	V3_TOKENS_SYNTAX(202, "tokens {A; B;} syntax is now tokens {A, B} in ANTLR 4", ErrorSeverity.WARNING),
1142 	/**
1143 	 * Compiler Error 203.
1144 	 *
1145 	 * <p>
1146 	 * assignments in {@code tokens{}} are not supported in ANTLR 4; use lexical
1147 	 * rule <em>TokenName</em> : <em>LiteralValue</em>; instead</p>
1148 	 *
1149 	 * <p>
1150 	 * ANTLR 3 allowed literal tokens to be declared and assigned a value within
1151 	 * the {@code tokens{}} block. ANTLR 4 no longer offers this syntax. When
1152 	 * migrating a grammar from ANTLR 3 to ANTLR 4, any tokens with a literal
1153 	 * value declared in the {@code tokens{}} block should be converted to
1154 	 * standard lexer rules.</p>
1155 	 */
1156 	V3_ASSIGN_IN_TOKENS(203, "assignments in tokens{} are not supported in ANTLR 4; use lexical rule <arg> : <arg2>; instead", ErrorSeverity.ERROR),
1157 	/**
1158 	 * Compiler Warning 204.
1159 	 *
1160 	 * <p>
1161 	 * {@code {...}?=>} explicitly gated semantic predicates are deprecated in
1162 	 * ANTLR 4; use {@code {...}?} instead</p>
1163 	 *
1164 	 * <p>
1165 	 * ANTLR 4 treats semantic predicates consistently in a manner similar to
1166 	 * gated semantic predicates in ANTLR 3. When migrating a grammar from ANTLR
1167 	 * 3 to ANTLR 4, all uses of the gated semantic predicate syntax can be
1168 	 * safely converted to the standard semantic predicated syntax, which is the
1169 	 * only form used by ANTLR 4.</p>
1170 	 */
1171 	V3_GATED_SEMPRED(204, "{...}?=> explicitly gated semantic predicates are deprecated in ANTLR 4; use {...}? instead", ErrorSeverity.WARNING),
1172 	/**
1173 	 * Compiler Error 205.
1174 	 *
1175 	 * <p>{@code (...)=>} syntactic predicates are not supported in ANTLR 4</p>
1176 	 *
1177 	 * <p>
1178 	 * ANTLR 4's improved lookahead algorithms do not require the use of
1179 	 * syntactic predicates to disambiguate long lookahead sequences. The
1180 	 * syntactic predicates should be removed when migrating a grammar from
1181 	 * ANTLR 3 to ANTLR 4.</p>
1182 	 */
1183 	V3_SYNPRED(205, "(...)=> syntactic predicates are not supported in ANTLR 4", ErrorSeverity.ERROR),
1184 
1185     // Dependency sorting errors
1186 
1187     /** t1.g4 -> t2.g4 -> t3.g4 ->t1.g4 */
1188     //CIRCULAR_DEPENDENCY(200, "your grammars contain a circular dependency and cannot be sorted into a valid build order", ErrorSeverity.ERROR),
1189 	;
1190 
1191 	/**
1192 	 * The error or warning message, in StringTemplate 4 format using {@code <}
1193 	 * and {@code >} as the delimiters. Arguments for the message may be
1194 	 * referenced using the following names:
1195 	 *
1196 	 * <ul>
1197 	 * <li>{@code arg}: The first template argument</li>
1198 	 * <li>{@code arg2}: The second template argument</li>
1199 	 * <li>{@code arg3}: The third template argument</li>
1200 	 * <li>{@code verbose}: {@code true} if verbose messages were requested; otherwise, {@code false}</li>
1201 	 * <li>{@code exception}: The exception which resulted in the error, if any.</li>
1202 	 * <li>{@code stackTrace}: The stack trace for the exception, when available.</li>
1203 	 * </ul>
1204 	 */
1205 	public final String msg;
1206 	/**
1207 	 * The error or warning number.
1208 	 *
1209 	 * <p>The code should be unique, and following its
1210 	 * use in a release should not be altered or reassigned.</p>
1211 	 */
1212     public final int code;
1213 	/**
1214 	 * The error severity.
1215 	 */
1216     public final ErrorSeverity severity;
1217 
1218 	/**
1219 	 * Constructs a new {@link ErrorType} with the specified code, message, and
1220 	 * severity.
1221 	 *
1222 	 * @param code The unique error number.
1223 	 * @param msg The error message template.
1224 	 * @param severity The error severity.
1225 	 */
ErrorType(int code, String msg, ErrorSeverity severity)1226 	ErrorType(int code, String msg, ErrorSeverity severity) {
1227         this.code = code;
1228 		this.msg = msg;
1229         this.severity = severity;
1230 	}
1231 }
1232