[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;
{ bool bQuit=false; } 
      :  SOME_TOKEN 
              bQuit = otherRule
              { if (bQuit) break; }
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