[antlr-interest] breaking out of a closure loop

praveenray pray at eagleinvsys.com
Tue Dec 11 11:36:37 PST 2001


Is it possible to break out of a ()* or ()+ loop explicitly? I mean,
Can I use 'break' statement inside the loop like this:

class myParser extends Parser;
somerule
{ bool bQuit=false; } 
      :  SOME_TOKEN 
            ( 
              bQuit = otherRule
              { if (bQuit) break; }
            )+
           END_TOKEN
        ;
otherRule returns [bool bRet]
{ bRet = false; } 
                             : A B
                               ( C | D {bRet=true;}
                               );

 Will it have any side effects? If yes, what is a safe way to break
out of a loop after I have seen some special character?
                 


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list