[antlr-interest] Re: StringTemplate question
llza2003
luisl at scarab.co.za
Fri Jan 2 08:49:24 PST 2004
Hi,
I have to admit my interest isn't purely altruistic. I really would
like to be able to nest anonymous templates. I just figured it would
be unfair to ask someone to implement my requirement without at least
giving it a bash myself. ;)
I have a patch available which I'd be happy to email to anybody who's
interested. It's for the C# port only unfortunately. I haven't had
time to apply it to the Java version. It isn't a big change so it
should be easy to port from C# to Java. Specifically:
1. Changed lexer in action.g to recognize nested anonymous templates
2. Changed lexer in action.g to recognize \r as whitespace
3. Changed scarfing in parseAttributeExpressionChunk in
StringTemplate.cs to recognize nested anonymous templates
The code isn't the prettiest, but it seems to work more or less.
Caveat Emptor. :)
Luis
--- In antlr-interest at yahoogroups.com, Terence Parr <parrt at c...>
wrote:
>
> On Thursday, January 1, 2004, at 01:10 PM, llza2003 wrote:
>
> > Hi,
> >
> > It seems it is not possible to nest anonymous templates in the
> > StringTemplate library, e.g.
> >
> > $A:{$attr:{$attr.B$}$}$
>
> Howdy :) Hmm...Yeah, I think somebody else found this too...yep,
found
> this in my bugs list:
>
> * Matthew Ford: Support nested anon templates or return better
error.
>
> Sorry about that...no conceptual reason, just a very bad scanner
(which
> I do by hand since the delimiters are unrestricted). Actually, it
> might be in the stringtemplate action lexer itself not the thing
that
> chunk up the template.
>
> Sure, send in a patch if you want :) Matthew will thank you too...
>
> Thanks for your interest...
>
> Ter
>
> > Is this in fact true? If so, is there a conceptual reason why
this is
> > not supported? It seems reasonably straightforward to implement
and I
> > thought I should check before I rush off and implement something
that
> > is already supported or, even worse, not conceptually sound.
> >
> > :-)
> >
> > Luis
> >
> >
> >
> >
> > 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/
> >
> >
> >
> --
> Professor Comp. Sci., University of San Francisco
> Creator, ANTLR Parser Generator, http://www.antlr.org
> Co-founder, http://www.jguru.com
> Co-founder, http://www.knowspam.net enjoy email again!
> Co-founder, 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