Handle INVALID_CHAR_SET error.

This commit is contained in:
Ivan Kochurkin 2017-03-03 13:40:40 +03:00
parent f6cda7f0ea
commit 9b5f039e46
1 changed files with 5 additions and 3 deletions

View File

@ -476,9 +476,11 @@ public class LexerATNFactory extends ParserATNFactory {
offset = escapeParseResult.parseLength;
}
else if (c == '-' && !state.inRange) {
if (state.mode == CharSetParseState.Mode.PREV_PROPERTY) {
g.tool.errMgr.grammarError(ErrorType.UNICODE_PROPERTY_NOT_ALLOWED_IN_RANGE,
g.fileName, charSetAST.getToken(), charSetAST.getText());
if (state.mode == CharSetParseState.Mode.PREV_PROPERTY || i == 0 || i == n - 1) {
ErrorType errorType = state.mode == CharSetParseState.Mode.PREV_PROPERTY
? ErrorType.UNICODE_PROPERTY_NOT_ALLOWED_IN_RANGE
: ErrorType.INVALID_CHAR_SET;
g.tool.errMgr.grammarError(errorType, g.fileName, charSetAST.getToken(), charSetAST.getText());
state = CharSetParseState.ERROR;
}
else {