Added parens in Java.stg:
evalPredicate(pred,description) ::= "(<pred>)"
shows up as
if ( ((synpred1_T()&&( condition1 || condition2 ))) ) {
now for
parser grammar T;
rule1 : (rule2) => rule2 | A;
rule2 : { condition1 || condition2 }? => A ;
edit //depot/code/antlr/main/CHANGES.txt#83
edit //depot/code/antlr/main/src/org/antlr/codegen/templates/Java/
Java.stg#135
Change 5157 submitted.
Ter
On Jul 25, 2008, at 8:54 AM, Johannes Luber wrote:
> Sam Harwell schrieb:
>> The generated grammars need to parentheses around the expressions
>> in a gated semantic predicate when used in the
>> DFAxx_SpecialStateTransition functions. Here is an example failure
>> case:
>> rule1
>> : (rule2) => rule2
>> | rule3;
>> rule2
>> : { condition1 || condition2 }? => rule4
>> ;
>> The generated grammar will have something on the order of this in it:
>> if ( ((synpredxx_Grammar() && condition1 || condition2 )) ) { s =
>> xx; }
>> Clearly the order of operations does not behave as expected.
>> Sam
>
> A workaround is to manually insert the brackets. This bug is also in
> the Java target. Ter, I thought you had fixed it already?
>
> Johannes
_______________________________________________
antlr-dev mailing list
[email protected]
http://www.antlr.org:8080/mailman/listinfo/antlr-dev