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

jevitha jevitha at gmail.com
Thu May 14 06:29:31 PDT 2009


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090514/8d263d71/attachment.html 


More information about the antlr-interest mailing list