Hi. try either <struct(typename="yourStructObject"> or  
<yourStructObject:struct()>
Ter
On Jul 8, 2009, at 1:16 PM, Behdad Forghani wrote:

> Hi,
>
> I have a  question regarding templates. I have spent a lot of time  
> to get the syntax right with no success. I cannot get the syntax of  
> calling a template within a template to work.
> I expected the syntax to be:
> <template(<arg>)>
> I.e.,
> if the first template is:
> template1(arg1) ::= "... <arg1> ..."
>
> Then for the second template to call the first template, the syntax  
> would be:
> template2(arg) :: <<
> ...
> <template1(<arg>)>
> ...
>>>
>
> This does not seem to work.
>
>
> I want to declare a C structure. The typename may not be present.  
> I.e.,
> sometimes it is struct {} x; and sometimes it is struct y {} x;. So,  
> in
> the string template I have:
>
> struct(typename) ::="struct <typename>"
>
> Now I want to define a template to call struct.  I expected the
> following to work, but it doesn't:
>
> headerFileStruct(typename, fieldname) ::= <<
>  <struct(<typename>)> {
>   int length;
> } fieldname;
>>>
>
> I have tried <struct(typename)>, <struct<$typename$>> and any  
> possiblity
> that I could think of with now luck.
>
> Another question, jsut to doublecheck, is there a way to trace and  
> debug
> stringtemplates? Not that this would have helped with not knowing the
> syntax.
>
> Thanks for your help and providing Antlr.
>
>
> Behdad
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: 
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address


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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to