* added check for v3 backward incompatibilities:
** labels in lexer rules
This commit is contained in:
parent
fafc804fdf
commit
ae111eddbd
|
@ -7,6 +7,7 @@ November 18, 2012
|
|||
* added notion of one-off error
|
||||
* added check for v3 backward incompatibilities:
|
||||
** tree grammars
|
||||
** labels in lexer rules
|
||||
|
||||
November 17, 2012
|
||||
|
||||
|
|
|
@ -382,6 +382,15 @@ public class BasicSemanticChecks extends GrammarTreeVisitor {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void enterLabeledLexerElement(GrammarAST tree) {
|
||||
Token label = ((GrammarAST)tree.getChild(0)).getToken();
|
||||
g.tool.errMgr.grammarError(ErrorType.V3_LEXER_LABEL,
|
||||
g.fileName,
|
||||
label,
|
||||
label.getText());
|
||||
}
|
||||
|
||||
/** Check option is appropriate for grammar, rule, subrule */
|
||||
boolean checkOptions(GrammarAST parent,
|
||||
Token optionID,
|
||||
|
|
|
@ -118,6 +118,9 @@ public enum ErrorType {
|
|||
|
||||
// Backward incompatibility errors
|
||||
V3_TREE_GRAMMAR(200, "tree grammars are not supported in ANTLR v4", ErrorSeverity.ERROR_ONE_OFF),
|
||||
V3_LEXER_LABEL(201, "labels in lexer rules are not supported in ANTLR v4; " +
|
||||
"actions cannot reference elements of lexical rules but you can use " +
|
||||
"getText() to get the entire text matched for the rule", ErrorSeverity.ERROR_ONE_OFF),
|
||||
|
||||
// Dependency sorting errors
|
||||
|
||||
|
|
Loading…
Reference in New Issue