escapevelocity icon indicating copy to clipboard operation
escapevelocity copied to clipboard

Unable to set variable to array

Open jdreddaway opened this issue 5 years ago • 1 comments

See https://stackoverflow.com/questions/56138416/how-to-set-variable-to-array-in-velocity

I am trying to do the following:

#set ($my = "blah")
#set ($say = ["not", $my, "fault"])

But I get the following error:

error: An error occurred in the @AutoProtoModel processor while processing com.google.protobuf.contrib.autoprotomodel.prototype.AlbumModel:
  com.google.escapevelocity.ParseException: Expected an expression, on line 46, at text starting: ["not", $my, "fault"...
    com.google.escapevelocity.Parser.parseException(Parser.java:1093)
    com.google.escapevelocity.Parser.parsePrimary(Parser.java:923)
    com.google.escapevelocity.Parser.parseUnaryExpression(Parser.java:890)
    com.google.escapevelocity.Parser.parseExpression(Parser.java:797)
    com.google.escapevelocity.Parser.parseSet(Parser.java:401)
    com.google.escapevelocity.Parser.parseDirective(Parser.java:328)
    com.google.escapevelocity.Parser.parseNode(Parser.java:218)
    com.google.escapevelocity.Parser.parseTokens(Parser.java:126)
    com.google.escapevelocity.Parser.parse(Parser.java:118)
    com.google.escapevelocity.Template.parseFrom(Template.java:112)
    com.google.escapevelocity.Template.parseFrom(Template.java:94)
    com.google.protobuf.contrib.autoprotomodel.prototype.BackingClassGenerator.loadTemplate(BackingClassGenerator.java:97)
...

jdreddaway avatar May 14 '19 20:05 jdreddaway

Yes, array literals are not currently supported, though I have a prototype implementation that is not yet submitted.

eamonnmcmanus avatar May 15 '19 15:05 eamonnmcmanus