[stringtemplate-interest] Including optional keywords as parameters to String Template

Terence Parr parrt at cs.usfca.edu
Fri May 15 10:13:58 PDT 2009


I'd label it with t='.module' and then pass it in as $t.
Ter
On May 14, 2009, at 10:48 PM, jevitha wrote:

>
> Hi,
>
>   I have a rule in my tree grammar (same in my parser grammar) which  
> has optional attribute which can occur in my input :
>
> className : (('.module')? name1 ) slashedName ;
>
> How can i construct a string template to include the optional  
> attribute (here its .module) to be sent as a parameter to the  
> template only if it occurs ... Since it is a keyword, and there is  
> no separate lexer rule written to match '.module' separately, I dono  
> how to pass the .module keyword as optional parameter to the template.
>
> .module keyword should be filled in the blank space of the following  
> rewrite rule:
>
> className : (('.module')? name1 ) slashedName
>        -> className(....... assemblyname = {$name1.st}  
> methodname={$slashedName.st})
>       ;
>
> Kindly suggest.
>
> Best Regards,
> Jevitha
>
> _______________________________________________
> stringtemplate-interest mailing list
> stringtemplate-interest at antlr.org
> http://www.antlr.org/mailman/listinfo/stringtemplate-interest

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/stringtemplate-interest/attachments/20090515/28abfc7b/attachment.html 


More information about the stringtemplate-interest mailing list