Fix detection of unsupported block options

This commit is contained in:
Sam Harwell 2012-10-14 12:07:37 -05:00
parent 850fe5b9c2
commit 65793adfc8
2 changed files with 4 additions and 4 deletions

View File

@ -338,14 +338,14 @@ public class BasicSemanticChecks extends GrammarTreeVisitor {
{
boolean ok = true;
if ( parent.getType()==ANTLRParser.BLOCK ) {
if ( g.isLexer() && Grammar.LexerSubruleOptions.contains(optionID.getText()) ) { // block
if ( g.isLexer() && !Grammar.LexerBlockOptions.contains(optionID.getText()) ) { // block
g.tool.errMgr.grammarError(ErrorType.ILLEGAL_OPTION,
g.fileName,
optionID,
optionID.getText());
ok = false;
}
if ( !g.isLexer() && Grammar.ParserSubruleOptions.contains(optionID.getText()) ) { // block
if ( !g.isLexer() && !Grammar.ParserBlockOptions.contains(optionID.getText()) ) { // block
g.tool.errMgr.grammarError(ErrorType.ILLEGAL_OPTION,
g.fileName,
optionID,

View File

@ -82,10 +82,10 @@ public class Grammar implements AttributeResolver {
public static final Set<String> ruleOptions = new HashSet<String>() {{
}};
public static final Set<String> ParserSubruleOptions = new HashSet<String>() {{
public static final Set<String> ParserBlockOptions = new HashSet<String>() {{
}};
public static final Set<String> LexerSubruleOptions = new HashSet<String>() {{
public static final Set<String> LexerBlockOptions = new HashSet<String>() {{
}};
/** Legal options for terminal refs like ID<assoc=right> */