[stringtemplate-interest] suppressing newlines and empty strings

David Ray ray at soartech.com
Tue Nov 8 13:16:13 PST 2005


Luis,

Thanks for your feedback.  I'm using the Java version (2.2). Here's an 
example:

foo(bar) ::=
<<
hello $bar$
 >>

yum() ::=
<<
$foo(bar="")$
 >>

With this, I get the following error:

    problem parsing template 'yum', line 1:11: unexpected char: '"'

If I replace bar="" with bar="x" or any other non-empty string, 
everything works.  This isn't a show-stopper bug, just kind of annoying :)

Dave

Luis Leal wrote:
> Hi Dave,
> 
> 1. I don't think it's possible
> 2. Which version of StringTemplate are you using? C# or Java? If it's C#,
> please send a small sample to me and I'll see if I can track it down. :-)
> 
> Regards
> 
> Luis
> 
> -----Original Message-----
> From: stringtemplate-interest-bounces at antlr.org
> [mailto:stringtemplate-interest-bounces at antlr.org]On Behalf Of David Ray
> Sent: 08 November 2005 07:04 PM
> To: stringtemplate-interest at antlr.org
> Subject: [stringtemplate-interest] suppressing newlines and empty
> strings
> 
> 
> Hello,
> 
> I have a couple StringTemplate questions:
> 
> 1) Is there any way to do a line continuation (like \ in C) in a
> template? I've got a template whose output I'd like to have on a single
> line, but I'd like to break it up a bit to make the template code more
> readable.
> 
> 2) I get an error when I try to pass an empty string literal to a
> template parameter:
> 
>     $foo(bar="")$
> 
> Is there a way to do this or am I missing something?
> 
> Thanks,
> Dave
> 
> _______________________________________________
> stringtemplate-interest mailing list
> stringtemplate-interest at antlr.org
> http://www.antlr.org:8080/mailman/listinfo/stringtemplate-interest
> 
> 


More information about the stringtemplate-interest mailing list