[antlr-interest] fixed bug in predicate collecting

Terence Parr parrt at cs.usfca.edu
Mon Jun 19 16:47:17 PDT 2006


Emond,

Thanks for finding that bug.  It was not only a bug in the gated  
predicates, but a bug also in general predicate collecting.  I can  
send you a tarball to try out your problem.  This unit test works:

	public void testGatedPred2() throws Exception {
		String grammar =
			"grammar foo;\n" +
			"@lexer::members {boolean sig=false;}\n"+
			"a : (A|B)+ ;\n" +
			"A : 'a' {System.out.print(\"A\"); sig=true;} ;\n" +
			"B : 'b' ;\n" +
			"C : {sig}?=> ('a'|'b') {System.out.print(\"C\");} ;\n";
		String found =
			TestCompileAndExecSupport.execParser("foo.g", grammar, "foo",  
"fooLexer",
												 "a", "aa", false);
		String expecting = "AC\n";
		assertEqual(found, expecting);
	}

works now.  Unit test added.

Thanks,
Terence


More information about the antlr-interest mailing list