Hi,
I am trying to get type and name attributes to work for return values specified
in a rule. For example,
if someone specifies the following rule:
kfloat returns [ double value ]
| KFLOAT
;
In the target language generator I need to be able to generate:
\...@property (assign, getter=get<it.name>, setter=set<it.name>\:) <it.type>
<it.name>;
where <it.type> is "double" and <it.name> is "value" (of course without the
quotes)
Currently all I have figured out how to get is:
double value;
using:
<ruleDescriptor.returnScope.attribute:{ <it.dec>; }; separator="\n">
I also need to use the same items to generate the getter and setter methods
like:
@synthesize value;
- (double)getValue
{
return( value );
}
- (void)setValue:(double)aVal
{
value = aVal;
}
So I have been trying something like this:
<scope.attributes:{...@synthesize <it.name>;}; separator="\n">
<scope.attributes.decl:{<"\n">- (<it.type>)get<it.name><"\n">{<"\n"> return(
<it.name> );<"\n">}<"\n\n">
- (void)set<it.name>:(<it.type>)aVal<"\n">{<"\n"> <it.name> =
aVal;<"\n">}<"\n\n">}; separator="\n">
Or this:
<scope.attributes.decl:{
- (<it.type>)get<it.name>
{
return( <it.name> );
}
- (void)set<it.name>\:(<it.type>)aVal
{
<it.name> = aVal;
}
}; separator="\n">
Any help would be greatly appreciated. I am just learning StringTemplate and it
may be something simple
biting me in the butt.
Thanks again,
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.