[stringtemplate-interest] Attaching model to stringtemplate group

Terence Parr parrt at cs.usfca.edu
Sun Sep 23 11:26:01 PDT 2007


On Sep 23, 2007, at 11:09 AM, Johannes Luber wrote:
> /** This rule generates the content elements. */
> CreateContent(element) ::= <<
> <if(element.IsRootElement)>
> <element.Name>Content =
> 	<element.Children:{c|<CreateContent(element=c)>}>
> <endif>
> <if(element.IsAndElement)>(<element.Children:{c|<CreateContent 
> (element=c)>};
> separator=",\n">)<endif>
> <if(element.IsOrElement)>(<element.Children:{c|<CreateContent 
> (element=c)>};
> separator="|\n">)<endif><endif>
> <if(element.IsOptionalElement)><element.Children:{c|<CreateContent 
> (element=c)>}>?<endif>
> <if(element.IsZeroOrMoreElement)><element.Children:{c|<CreateContent 
> (element=c)>}>*<endif>
> <if(element.IsOneOrMoreElement)><element.Children:{c|<CreateContent 
> (element=c)>}>+<endif>
> <if(element.IsEmptyElement)><element.Name>Content = empty<endif>
> <if(element.IsTextElement)><element.Name>Content = text<endif>
> <if(element.IsAnyElement)><element.Name>Content = *<endif>
> <if(element.IsLeafElement)>element <element.Name> {
> <element.Name>Content }<endif>
>

When you create an instance of CreateContent, use setAttribute to set  
"element", right?

> As you can see the second rule is to be used recursively. How do I  
> setup
> the string template objects with the tree objects? How am I  
> supposed to
> set the values correctly? The elements have properties with the same
> name as the tested attribute. Do you need any other information?
>
> On another note: Having read your problem with extended typing  
> sessions:
> Did you consider already to switch the keyboard layout? I recommend
> Colemak on <http://www.colemak.com>. Better than Dvorák and once  
> you get
> up to speed, even faster than Dvorák. I'm using it to reduce the  
> strain
> on my fingers, too, and have been very satisfied. The only problem is
> the speed hit you take. The first week is especially gruesome and it
> took a few months to return to the old marks, so the undertaking is  
> not
> for the faint of hard. :( But it is better than having constantly  
> pain,
> isn't it?

Yeah, tried dvorak etc...  Basically I type 12 hours a day every  
day...tha'ts the issue ;)
Tr


More information about the stringtemplate-interest mailing list