Also, for "simple token" matches I end up with stuff like:

numeric_literal
        :       INTEGER_LITERAL -> template(id={$INTEGER_LITERAL.text}) "<id>"
        |       DECIMAL_LITERAL -> template(id={$DECIMAL_LITERAL.text}) "<id>"
        |       FLOATING_POINT_LITERAL -> 
template(id={$FLOATING_POINT_LITERAL.text})
"<id>"
        ;

Is the a better pattern which can be applied here?

On Wed, 2009-04-29 at 18:43 -0500, Steve Ebersole wrote:
> I am trying to develop a grammar which uses StringTemplate for its
> rendering.  But I find something rather annoying and wanted to see if I
> am just missing something.  Basically I have a bunch of rules which call
> other rules; the "top" rule is just to group like rules together.  For
> example:
> 
> function
>   : castFunction
>   | trimFunction
>   ...
>   ;
> 
> All the rules under function return StringTemplates.  Yet in order to
> get any output, I need to do the following:
> 
> function
>   : castFunction -> {$castFunction.st}
>   | trimFunction -> {$trimFunction.st}
>   ...
>   ;
> 
> Which seems redundant to me.  Is there something I am missing?
> 
-- 
Steve Ebersole <st...@hibernate.org>
Hibernate.org


List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to il-antlr-interest@googlegroups.com
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to