[antlr-interest] to stop walking into a subtree

poroshpathor poroshpathor poroshpathor81 at yahoo.com
Mon Apr 4 19:30:06 PDT 2011


Hi, 

I am having a problem with ANTLR. I will be grateful to you if you can help me 
in this regard.

Following is a  rule at my tree grammar:

booleanexpression returns[boolean result] 
:  ^(AND op1 = booleanexpression op2 = booleanexpression) {if(op1&&op2) result = 
true; else result =false;}
;

My question:
I want to stop walking once I found op1 as false. In that case, I don't need to 
evaluate op2 anymore, the result is false anyway.
 
Is there any way to implement this?

Thanks in advance.
Porosh


      


More information about the antlr-interest mailing list