guig / veloeclipse

Automatically exported from code.google.com/p/veloeclipse
Other
0 stars 1 forks source link

Error when escaped backslash at the end of a quoted string #6

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create test.vm with the following content:
#set($var = "\\" )
#set($var2 = "${var}")

What is the expected output? What do you see instead?

I expect no errors - there were none with the 2.0.6.

Instead, the second line is flagged as having an error:
Encountered "${" at test.vm[line 2, column 15]
Was expecting one of:
    <RPAREN> ...
    <WHITESPACE> ...
    "-" ...
    "+" ...
    "*" ...
    "/" ...
    "%" ...
    <LOGICAL_AND> ...
    <LOGICAL_OR> ...
    <LOGICAL_LT> ...
    <LOGICAL_LE> ...
    <LOGICAL_GT> ...
    <LOGICAL_GE> ...
    <LOGICAL_EQUALS> ...
    <LOGICAL_NOT_EQUALS> ...

What version of the product are you using? On what operating system?
Veloeclipse 2.0.7 on Eclipse 3.4.1 (M20080911-1700)

Please provide any additional information below.

Velocity 1.5 is happy with the syntax. 
If another non-backslash character is inserted after the second backslash, 
the error goes away. 
The error persists if additional backslashes are added within the quotes.
The error does not occur if the pair of backslashes is enclosed in single 
quotes.

The error goes away if the file is changed to:

#set($var = "\\")
#set($var2 = ")

This leads me to believe that a backslash immediately before quote is 
being taken as escaping the quote, regardless of other content.

Original issue reported on code.google.com by Van.Lept...@gmail.com on 17 Feb 2009 at 6:48

GoogleCodeExporter commented 8 years ago
Hmm, I'll look into this.   However, Veloeclipse is currently supporting 
Velocity 1.6 (I need to say this on the 
home page), even though I'm surprised there's a difference in parsing errors.. 

Normally I would say you should overwrite the plugin velocity jar with whatever 
velocity jar you're developing 
with, but unfortunately there was an API change between 1.5 and 1.6 that 
Veloeclipse depends on.

Original comment by byron.foster@gmail.com on 18 Feb 2009 at 10:12

GoogleCodeExporter commented 8 years ago
This appears to be an escape parse change in 1.6, It looks like a bug to me.

Original comment by byron.foster@gmail.com on 27 Feb 2009 at 2:00

GoogleCodeExporter commented 8 years ago
A bug with Velocity concering this has been filed here:

http://issues.apache.org/jira/browse/VELOCITY-709

Original comment by byron.foster@gmail.com on 20 Apr 2009 at 10:20