[stringtemplate-interest] StringTemplate Literals
H.E. Sum
hackitoergosum at yahoo.com
Fri Feb 27 13:45:53 PST 2009
Yes, that does work, but quotes get interpreted. I'm using templates for my custom web framework and a lot of javascript libraries use $ as a global variable so my inline javascript gets mangled.
I decided to take the plunge into the stringtemplate source and added a VERBATIM token type to the DefaultTemplateLexer. (Just copied the mCOMMENT action and made it return the token instead of skipping). So now I can write $@ Output text with $ and "strings" @$ in my templates. Thanks for creating this tool and making the source available for us to hack.
----- Original Message ----
From: Terence Parr <parrt at cs.usfca.edu>
To: H.E. Sum <hackitoergosum at yahoo.com>
Cc: stringtemplate-interest at antlr.org
Sent: Thursday, February 26, 2009 8:49:40 PM
Subject: Re: [stringtemplate-interest] StringTemplate Literals
On Feb 24, 2009, at 5:57 PM, H.E. Sum wrote:
> Is there a way to specify that a region of text should be interpreted
> as a literal string so we don't have to escape every instance of a
> delimiter? In other words, I'd like something that functions like $! Comments !$, but would get outputted verbatim.
Hmm...good question. Perhaps as string parameter?
<anotherTemplate(arg="string not interpreted")>
strings might be examined though...give it a try.
Ter
More information about the stringtemplate-interest
mailing list