You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Christoph Reck <Ch...@dlr.de> on 2000/11/06 13:39:51 UTC

[PROPOSAL] Parser Update

I've been thinking of the backslash problem using it as escape 
character. I believe the standard approach taken is in the wrong
direction, thus causing lateral problems (see gunnar's message 
below). 

Looking into the parser src, I see the escapes handled rather
hardwired. (are macros accessed bia $macroName or #macroName -
second is stated by documentation).

The simpler solution is to use special context identifiers
to represent the $ and # symbols. To emit an '$foo' and
'#if' text in schmoo use '$$foo' and '$#if' in the template,
thus not having to embed another syntax (escape cahracter) 
and keeping in line with the special VTL symbols! 

The generalization of this would be using ${(#|$)any text and characters}
to be passed literally.

Any votes in favour of this change?

Any objections? Well i've got one: what happens if input text
has a string '$$$' in it, VL would output schmoo with '$$'. 
To emit it correctly it would then need to be '${$$$}'. Anyway 
the current implementation already requires rewriting the input 
to the template. 

:) Christoph


Gunnar R|nning wrote:
> 
> "Geir Magnusson Jr." <ge...@optonline.net> writes:
> 
> >
> > 1) When a non-null reference (a reference that refers to actual data in
> > the Context) is preceeded by a '\', it will be rendered as $<reference>.
> >
> >
> > #set $foo = "woogie"
> > \$foo => $foo
> > \$bar => $bar
> >
> 
> So what about escaping the backslash itself ? Let's say I want the
> following output by accessing $foo :
> 
> "\woogie"
> 
> regards,
> 
>         Gunnar