velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Davide Mora <d_m...@yahoo.com>
Subject escape characters in #set
Date Fri, 30 Mar 2001 09:38:20 GMT

Hi!

i writing a template for ANT, with a lot of ${..}, and
i found a little problem:

set ( $myvar = "\${project}")

because i want my $myvar contains "${project}" without
be used by velocity.

this cause an error:

org.apache.velocity.runtime.parser.TokenMgrError:
Lexical error at line 23, column 15.  Encountered: "$"
(36), after : "\"\\" 	at
org.apache.velocity.runtime.parser.ParserTokenManager.getNextToken(ParserTokenManager.java:3496)
	at
org.apache.velocity.runtime.parser.Parser.jj_scan_token(Parser.java:3052)
	at
org.apache.velocity.runtime.parser.Parser.jj_3R_48(Parser.java:2320)
	at
org.apache.velocity.runtime.parser.Parser.jj_3R_35(Parser.java:2446)
	at
org.apache.velocity.runtime.parser.Parser.jj_3R_21(Parser.java:2497)
	at
org.apache.velocity.runtime.parser.Parser.jj_3_6(Parser.java:2895)
	at
org.apache.velocity.runtime.parser.Parser.jj_2_6(Parser.java:2186)
	at
org.apache.velocity.runtime.parser.Parser.Expression(Parser.java:1495)
	at
org.apache.velocity.runtime.parser.Parser.Assignment(Parser.java:1546)
	at
org.apache.velocity.runtime.parser.Parser.Expression(Parser.java:1496)
	at
org.apache.velocity.runtime.parser.Parser.SetDirective(Parser.java:1437)
	at
org.apache.velocity.runtime.parser.Parser.Statement(Parser.java:268)
	at
org.apache.velocity.runtime.parser.Parser.process(Parser.java:218)
	at
org.apache.velocity.runtime.parser.Parser.parse(Parser.java:78)
	at
org.apache.velocity.runtime.Runtime.parse(Runtime.java:584)
	at
org.apache.velocity.Template.process(Template.java:159)
	at
org.apache.velocity.runtime.resource.ResourceManager.getResource(ResourceManager.java:336)
	at
org.apache.velocity.runtime.Runtime.getTemplate(Runtime.java:625)
	at
org.apache.velocity.app.Velocity.getTemplate(Velocity.java:461)


the workaround is:

set ($usd = "\$")
set ( $myvar = "$usd{project}")

Thank you,
Davide

__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/?.refer=text

Mime
View raw message