forked from jasder/antlr
* added check for v3 backward incompatibilities:
** (...)=> syntactic predicates
This commit is contained in:
parent
c5bf2ba0bd
commit
060343f027
|
@ -11,6 +11,7 @@ November 18, 2012
|
||||||
** tokens {A;B;} syntax
|
** tokens {A;B;} syntax
|
||||||
** tokens {A='C';} syntax
|
** tokens {A='C';} syntax
|
||||||
** {...}?=> gate semantic predicates
|
** {...}?=> gate semantic predicates
|
||||||
|
** (...)=> syntactic predicates
|
||||||
|
|
||||||
November 17, 2012
|
November 17, 2012
|
||||||
|
|
||||||
|
|
|
@ -453,6 +453,17 @@ LT : '<' ;
|
||||||
GT : '>' ;
|
GT : '>' ;
|
||||||
ASSIGN : '=' ;
|
ASSIGN : '=' ;
|
||||||
QUESTION : '?' ;
|
QUESTION : '?' ;
|
||||||
|
SYNPRED : '=>'
|
||||||
|
{
|
||||||
|
Token t = new CommonToken(input, state.type, state.channel,
|
||||||
|
state.tokenStartCharIndex, getCharIndex()-1);
|
||||||
|
t.setLine(state.tokenStartLine);
|
||||||
|
t.setText(state.text);
|
||||||
|
t.setCharPositionInLine(state.tokenStartCharPositionInLine);
|
||||||
|
grammarError(ErrorType.V3_SYNPRED, t);
|
||||||
|
$channel=HIDDEN;
|
||||||
|
}
|
||||||
|
;
|
||||||
STAR : '*' ;
|
STAR : '*' ;
|
||||||
PLUS : '+' ;
|
PLUS : '+' ;
|
||||||
PLUS_ASSIGN : '+=' ;
|
PLUS_ASSIGN : '+=' ;
|
||||||
|
|
|
@ -124,6 +124,7 @@ public enum ErrorType {
|
||||||
V3_TOKENS_SYNTAX(202, "'tokens {A; B;}' syntax is now 'tokens {A, B}' in ANTLR v4", ErrorSeverity.WARNING),
|
V3_TOKENS_SYNTAX(202, "'tokens {A; B;}' syntax is now 'tokens {A, B}' in ANTLR v4", ErrorSeverity.WARNING),
|
||||||
V3_ASSIGN_IN_TOKENS(203, "assignments in tokens{} are not supported in ANTLR v4; use lexical rule '<arg> : <arg2>;' instead", ErrorSeverity.ERROR_ONE_OFF),
|
V3_ASSIGN_IN_TOKENS(203, "assignments in tokens{} are not supported in ANTLR v4; use lexical rule '<arg> : <arg2>;' instead", ErrorSeverity.ERROR_ONE_OFF),
|
||||||
V3_GATED_SEMPRED(204, "{...}?=> gate semantic predicates in v3 behave like normal predicates in ANTLR v4; use {...}? instead", ErrorSeverity.WARNING_ONE_OFF),
|
V3_GATED_SEMPRED(204, "{...}?=> gate semantic predicates in v3 behave like normal predicates in ANTLR v4; use {...}? instead", ErrorSeverity.WARNING_ONE_OFF),
|
||||||
|
V3_SYNPRED(205, "(...)=> syntactic predicates are not needed or supported ANTLR v4; just delete them", ErrorSeverity.ERROR_ONE_OFF),
|
||||||
|
|
||||||
// Dependency sorting errors
|
// Dependency sorting errors
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue