[antlr-interest] Re: StringTemplate enhancement question

Terence Parr parrt at cs.usfca.edu
Tue Jun 22 12:36:01 PDT 2004


On Jun 22, 2004, at 12:07 PM, birmanstefan wrote:

> See comments inside :
>> Seems like the various pieces could go in together like this:
>>
>>      st.setAttribute("tokens.name,type", new Object[] {"Ter","342"})
>
>   I would prefer something like :
>
>        st.setAttributesFor("tokens", VectorOfIds, VectorOfValues) or
> better st.addAttributesFor(....).
>
> Where Vector of id's is the vector of tokens.id(attributes). Current
> value in VectorOfValues(properties) will be associated to
> VectorOfIds.get(currentIndex%VectorOfIds.size()), where % is modulo.
> The bad thing is that user must keep in mind to put in VectorOfValues
> a value for each id (N*VectorOfIds.size()), otherwise the values will
> be scrambled. Another issue would be the mechanism behind the scene,
> which would have to spread the values in the right places.
> If in the vectors will be objects then you can use classic mechanism
> of getProperty().

Hi Stefan,

Thanks for the ideas.  The problem is that I don't have the pieces of 
data in a Vector either.  I'd have to create the vectors manually and 
probably not conveniently.  You're right...the parallel arrays/vectors 
with ids and values could get out of sync.

I wonder if

st.setAttribute("tokens.name,type", new Object[] {"Ter","342"});

is not the cleanest solution given Java's "issues" ;)

Ter
--
CS Professor & Grad Director, University of San Francisco
Creator, ANTLR Parser Generator, http://www.antlr.org
Cofounder, http://www.jguru.com
Cofounder, http://www.knowspam.net enjoy email again!
Cofounder, http://www.peerscope.com pure link sharing





 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
     antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/
 



More information about the antlr-interest mailing list