MODE_CONFLICTS_WITH_TOKEN error restored.

This commit is contained in:
Ivan Kochurkin 2016-11-29 18:13:57 +03:00
parent 8fe4def4ed
commit f76ca22763
3 changed files with 23 additions and 9 deletions

View File

@ -127,7 +127,7 @@ public class TestSymbolIssues extends BaseJavaToolTest {
"M1: 'b';\n",
// YIELDS
"error(" + ErrorType.DECLARATION_CONFLICTS_WITH_COMMON_CONSTANTS.code + "): F.g4:3:0: cannot declare mode, token or channel with reserved name M1\n"
"error(" + ErrorType.MODE_CONFLICTS_WITH_TOKEN.code + "): F.g4:3:0: mode M1 conflicts with token with same name\n"
};
@Before

View File

@ -283,7 +283,7 @@ public class SymbolChecks {
if (g.getTokenType(modeName) != Token.INVALID_TYPE) {
Rule rule = lexerGrammar.modes.get(modeName).iterator().next();
g.tool.errMgr.grammarError(ErrorType.DECLARATION_CONFLICTS_WITH_COMMON_CONSTANTS, g.fileName, rule.ast.parent.getToken(), modeName);
g.tool.errMgr.grammarError(ErrorType.MODE_CONFLICTS_WITH_TOKEN, g.fileName, rule.ast.parent.getToken(), modeName);
}
}
}

View File

@ -960,13 +960,27 @@ public enum ErrorType {
/**
* Compiler Error 170.
*
* <pre>
* mode M1;
* A1: 'a'; // ok
* mode M2;
* A2: 'a'; // ok
* M1: 'b'; // error 170
* </pre>
*
* <p>mode <em>name</em> conflicts with token with same name</p>
*/
MODE_CONFLICTS_WITH_TOKEN(170, "mode <arg> conflicts with token with same name", ErrorSeverity.ERROR),
/**
* Compiler Error 171.
*
* <p>can not declare mode, token or channel with reserved name</p>
*
* <p>Reserved names: HIDDEN, DEFAULT_TOKEN_CHANNEL, DEFAULT_MODE, SKIP, MORE, EOF, MAX_CHAR_VALUE, MIN_CHAR_VALUE.
*/
DECLARATION_CONFLICTS_WITH_COMMON_CONSTANTS(170, "cannot declare mode, token or channel with reserved name <arg>", ErrorSeverity.ERROR),
DECLARATION_CONFLICTS_WITH_COMMON_CONSTANTS(171, "cannot declare mode, token or channel with reserved name <arg>", ErrorSeverity.ERROR),
/**
* Compiler Error 171.
* Compiler Error 172.
*
* <p>string literals cannot be empty</p>
*
@ -974,22 +988,22 @@ public enum ErrorType {
* <pre>B: '';</pre>
* <pre>C: 'test' '';</pre>
*/
EMPTY_STRINGS_NOT_ALLOWED(171, "string literals cannot be empty", ErrorSeverity.ERROR),
EMPTY_STRINGS_NOT_ALLOWED(172, "string literals cannot be empty", ErrorSeverity.ERROR),
/*
* Compiler Warning 172.
* Compiler Warning 173.
*
* <p>lexer rule has a duplicated commands</p>
*
* <p>TOKEN: 'asdf' -> mode(MODE1), mode(MODE2);</p>
* */
DUPLICATED_COMMAND(172, "duplicated command <arg>", ErrorSeverity.WARNING),
/* Compiler Waring 173
DUPLICATED_COMMAND(173, "duplicated command <arg>", ErrorSeverity.WARNING),
/* Compiler Waring 174.
*
* <p>incompatible commands <em>command1</em> and <em>command2</em></p>
*
* <p>T00: 'a00' -> skip, more;</p>
*/
INCOMPATIBLE_COMMANDS(173, "incompatible commands <arg> and <arg2>", ErrorSeverity.WARNING),
INCOMPATIBLE_COMMANDS(174, "incompatible commands <arg> and <arg2>", ErrorSeverity.WARNING),
/*
* Backward incompatibility errors