Greetings all,

I hacked around on the stringTemplates in ANTLR earlier and got things to work, 
but now I am trying to really understand them.

I am trying to clean up my Objective-C templates in order to facilitate 
implementation of ST.stg in Objective-C.

I have got the template <ruleAttributeScopeImplementation(scope)> defined in 
genericParser. My question is how do I convert the template 
<ruleAttributeScopeImplementation(scope)> into the next two templates 
(<ruleAttributeScopeImplementation(scope)> and 
<ruleAttributeScopeImplementation.synthesize()> and get it to work. I guess 
more succinctly the question is how do I get Antlr to recognize a new named 
"sub" template and invoke it. Do I need to do something like this:

#pragma mark Rule attributes scope methods
<rules:{rule |
<rule.ruleDescriptor.ruleScope:ruleAttributeScopeImplementation.synthesize(scope=it)>}><\n>

in genericParser or do I need to do something more in 
<ruleAttributeScopeImplementation(scope)>???
If so, what???

/******* START OF EXAMPLES ********/

ruleAttributeScopeImplementation(scope) ::= <<
/* start of ruleAttributeScopeImplementation */
<if(scope.attributes)>
@implementation <scope.name>_Scope<\n>
/******* MOVE THE FOLLOWING LINE TO A NEW TEMPLATE *******/
<scope.attributes:{a|@synthesize <a.name>;}; separator="\n"><\n>

+ (<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>
>>

/******_________CONVERT ABOVE TO BELOW_________*******/

ruleAttributeScopeImplementation.synthesize(scope) ::=<<
<scope.attributes:{a|@synthesize <a.name>;}; separator="\n"><\n>
>>

ruleAttributeScopeImplementation(scope) ::= <<
/* start of ruleAttributeScopeImplementation */
<if(scope.attributes)>
@implementation <scope.name>_Scope<\n>
/********** INVOKE THE NEW TEMPLATE HERE **********/
<ruleAttributeScopeImplementation.synthesize(scope)>

+ (<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>
>>

Thanks in Advance for any help given,
Alan
---

Alan Condit
1085 Tierra Ct.
Woodburn, OR 97071

Email -- [email protected]
Home-Office (503) 982-0906


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