[antlr-interest] [BUG] 3.0b4 no complaint on parser reference to lexical fragment
John B. Brodie
jbb at acm.org
Sun Nov 12 15:38:08 PST 2006
Sorry if this is a duplicate.
This incorrect grammar draws no error report from org.antlr.Tool
grammar t;
@members {
private static final String [] x = new String[]{
"b", // no syntax error
"c" // draws syntax error
};
public static void main(String[] args) {
for (int i=0; i < x.length; ++i) {
try {
tLexer lexer = new tLexer(new ANTLRStringStream(x[i]));
CommonTokenStream tokens = new CommonTokenStream(lexer);
t parser = new t(tokens);
parser.startRule();
} catch(Exception e) {
e.printStackTrace();
}
}
}
}
startRule : a EOF;
a : B | C ; // reference to a fragment, C
B : 'b' ;
fragment C : 'c' ; // not visible to parser
More information about the antlr-interest
mailing list