[antlr-interest] Re: nested return statements

genericised trigonometric at softhome.net
Thu Aug 15 08:26:55 PDT 2002

Here is an attempt to clarify my last post:

How can I make a parser rule so that I can use nested return 
statements like this:

blah returns[String s]
  : String p = (blah2)+
  { s=p; }

blah2 returns[String s]
  : i:(INT)
  { s=i.getText(); }

I can acheive this behaviour by editing the generated parser so that 
it contains rules like:

 String p
 if ((LA(1)==INT)) {
 return p
Essentially I want to have a heirarchy of nested rules wherby:

subsubrule returns a String that is caught by subrule
subrule adds to this and returns a String that is caught by rule
rule returns a String that is caught by the calling class.

Is this possible in ANTLR?

Davy Crocket


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

More information about the antlr-interest mailing list