This is an automated email from the ASF dual-hosted git repository.

cbrisson pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/velocity-engine.git


The following commit(s) were added to refs/heads/master by this push:
     new aade261  [engine] Fix VELOCITY-927
aade261 is described below

commit aade2612b1f9ba2c673771c882385ae639c977dd
Author: Claude Brisson <[email protected]>
AuthorDate: Sat Feb 27 09:36:00 2021 +0100

    [engine] Fix VELOCITY-927
---
 velocity-engine-core/src/main/parser/Parser.jjt    |  2 +-
 .../velocity/test/issues/Velocity927TestCase.java  | 39 ++++++++++++++++++++++
 2 files changed, 40 insertions(+), 1 deletion(-)

diff --git a/velocity-engine-core/src/main/parser/Parser.jjt 
b/velocity-engine-core/src/main/parser/Parser.jjt
index df5748d..593d044 100644
--- a/velocity-engine-core/src/main/parser/Parser.jjt
+++ b/velocity-engine-core/src/main/parser/Parser.jjt
@@ -2073,7 +2073,7 @@ void Map() : {}
 {
     <LEFT_CURLEY>
     (
-      LOOKAHEAD(2) Parameter() <COLON> Parameter() (<COMMA> Parameter() 
<COLON> Parameter() )*
+      LOOKAHEAD(( <WHITESPACE> | <NEWLINE> )* Parameter() <COLON>) ( 
Parameter() <COLON> Parameter() (<COMMA> Parameter() <COLON> Parameter() )* )
       |
       ( <WHITESPACE> | <NEWLINE> )*
      )
diff --git 
a/velocity-engine-core/src/test/java/org/apache/velocity/test/issues/Velocity927TestCase.java
 
b/velocity-engine-core/src/test/java/org/apache/velocity/test/issues/Velocity927TestCase.java
new file mode 100755
index 0000000..218ed7f
--- /dev/null
+++ 
b/velocity-engine-core/src/test/java/org/apache/velocity/test/issues/Velocity927TestCase.java
@@ -0,0 +1,39 @@
+package org.apache.velocity.test.issues;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.velocity.test.BaseTestCase;
+
+/**
+ * This class tests bugfix for 
http://stackoverflow.com/questions/32805217/bug-or-hidden-feature-in-apache-velocity
+ */
+public class Velocity927TestCase extends BaseTestCase
+{
+    public Velocity927TestCase(String name)
+    {
+       super(name);
+    }
+
+    public void testIt()
+    {
+        assertEvalEquals("", "#set($map = {\n })");
+    }
+
+}

Reply via email to