You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Mike Kienenberger <mk...@gmail.com> on 2014/04/01 15:53:48 UTC

Whitespacing parsing changes between 1.3.1 and 1.6.4?

I'm finally upgrading a project which was using velocity 1.3.1 to
1.6.4 (I might go with something newer, but I wanted to try to keep
things as simple as possible for a first try without adding the 1.7
new features, and Cayenne is using 1.6.4 right now).

One thing that hit me right away was that tabs are no longer allowed
between a directive and the left paren:

#set<tab>( $amountString = "Pay In Full" )

now dies with the following, and the error context is misleading.

ERROR [main 04-01 09:45:42] velocity:
org.apache.velocity.runtime.parser.ParseException: Encountered "=" at
line 190, column 25.
Was expecting one of:
    <RPAREN> ...
    "," ...
    <IDENTIFIER> ...
    "{" ...
    <WORD> ...
    <STRING_LITERAL> ...
    <INTEGER_LITERAL> ...
    "[" ...
    <FLOATING_POINT_LITERAL> ...
    "{" ...
    "true" ...
    "false" ...

The same thing happens with #if<tab>.  Replacing the tabs with spaces
causes the error to go away.

Is this a known issue with 1.6.4, or something that is a regression
for all recent versions of velocity?

I've been using whitespace between the directive and the left-paren to
provide indentation to make templates more readable, so this affects a
lot of code.    Replacing it with spaces could eventually happen, but
I don't have something automatic at hand to do it.

Thanks!

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


Re: Whitespacing parsing changes between 1.3.1 and 1.6.4?

Posted by Mike Kienenberger <mk...@gmail.com>.
I did a little more digging, and it looks like the problem is here:

  <SET_DIRECTIVE: (" "|"\t")*  ("#set" | "#{set}")  (" ")* "(">

which should be

  <SET_DIRECTIVE: (" "|"\t")*  ("#set" | "#{set}")  (" "|"\t")* "(">

It also looks like the problem remains in trunk.


On Tue, Apr 1, 2014 at 9:53 AM, Mike Kienenberger <mk...@gmail.com> wrote:
> I'm finally upgrading a project which was using velocity 1.3.1 to
> 1.6.4 (I might go with something newer, but I wanted to try to keep
> things as simple as possible for a first try without adding the 1.7
> new features, and Cayenne is using 1.6.4 right now).
>
> One thing that hit me right away was that tabs are no longer allowed
> between a directive and the left paren:
>
> #set<tab>( $amountString = "Pay In Full" )
>
> now dies with the following, and the error context is misleading.
>
> ERROR [main 04-01 09:45:42] velocity:
> org.apache.velocity.runtime.parser.ParseException: Encountered "=" at
> line 190, column 25.
> Was expecting one of:
>     <RPAREN> ...
>     "," ...
>     <IDENTIFIER> ...
>     "{" ...
>     <WORD> ...
>     <STRING_LITERAL> ...
>     <INTEGER_LITERAL> ...
>     "[" ...
>     <FLOATING_POINT_LITERAL> ...
>     "{" ...
>     "true" ...
>     "false" ...
>
> The same thing happens with #if<tab>.  Replacing the tabs with spaces
> causes the error to go away.
>
> Is this a known issue with 1.6.4, or something that is a regression
> for all recent versions of velocity?
>
> I've been using whitespace between the directive and the left-paren to
> provide indentation to make templates more readable, so this affects a
> lot of code.    Replacing it with spaces could eventually happen, but
> I don't have something automatic at hand to do it.
>
> Thanks!

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org