[antlr-interest] Re: ANTLR stringTemplates ObjC cleanup
Alan Condit
acondit at ipns.com
Sun Feb 13 14:02:35 PST 2011
I apologize but I find the StringTemplate documentation not very helpful.
I usually use the main documentation to get familiar with a project and
then a Cheat Sheet to remind me what works. In the case of StringTemplate
the Cheat Sheet saved the day. Below is the answer that worked.
Synthesize(scope) ::=<<
<scope.attributes:{a|@synthesize <a.name>;<\n>}; separator="\n">
>>
ruleAttributeScopeImplementation(scope) ::= <<
/* start of ruleAttributeScopeImplementation */
<if(scope.attributes)>
@implementation <scope.name>_Scope<\n>
<Synthesize(scope)> /* THIS WAS JUST TOO SIMPLE */
+ (<scope.name>_Scope *)new<scope.name>_Scope
{
return [[[<scope.name>_Scope alloc] init] retain];
}
/********* a bunch more lines of template ************/
/********* end of these more lines ************/
@end /* end of <scope.name>_Scope implemtation */<\n>
<endif>
>>
The answer was just too simple.
Alan
---
Alan Condit
1085 Tierra Ct.
Woodburn, OR 97071
Email -- acondit at ipns.com
Home-Office (503) 982-0906
More information about the antlr-interest
mailing list