You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@freemarker.apache.org by dd...@apache.org on 2015/12/19 15:23:10 UTC

[1/8] incubator-freemarker git commit: (Added an AST test case)

Repository: incubator-freemarker
Updated Branches:
  refs/heads/2.3 c94252874 -> 5203c735a


(Added an AST test case)


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/d1dafa54
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/d1dafa54
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/d1dafa54

Branch: refs/heads/2.3
Commit: d1dafa5427b1caec463ca3f62cc89c416ae2a478
Parents: 204723f
Author: ddekany <dd...@apache.org>
Authored: Thu Dec 17 21:06:18 2015 +0100
Committer: ddekany <dd...@apache.org>
Committed: Thu Dec 17 21:06:18 2015 +0100

----------------------------------------------------------------------
 src/test/java/freemarker/core/ASTTest.java                       | 4 ++++
 src/test/resources/freemarker/core/ast-nestedignoredchildren.ast | 2 ++
 src/test/resources/freemarker/core/ast-nestedignoredchildren.ftl | 1 +
 3 files changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d1dafa54/src/test/java/freemarker/core/ASTTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/freemarker/core/ASTTest.java b/src/test/java/freemarker/core/ASTTest.java
index a700334..1981ba6 100644
--- a/src/test/java/freemarker/core/ASTTest.java
+++ b/src/test/java/freemarker/core/ASTTest.java
@@ -63,6 +63,10 @@ public class ASTTest extends FileTestCase {
         testAST("ast-multipleignoredchildren");
     }
     
+    public void testNestedIgnoredChildren() throws Exception {
+        testAST("ast-nestedignoredchildren");
+    }
+
     private void testAST(String testName) throws FileNotFoundException, IOException {
         final String templateName = testName + ".ftl";
         assertExpectedFileEqualsString(

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d1dafa54/src/test/resources/freemarker/core/ast-nestedignoredchildren.ast
----------------------------------------------------------------------
diff --git a/src/test/resources/freemarker/core/ast-nestedignoredchildren.ast b/src/test/resources/freemarker/core/ast-nestedignoredchildren.ast
new file mode 100644
index 0000000..5a43456
--- /dev/null
+++ b/src/test/resources/freemarker/core/ast-nestedignoredchildren.ast
@@ -0,0 +1,2 @@
+#outputformat  // f.c.OutputFormatBlock
+    - value: "HTML"  // f.c.StringLiteral

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d1dafa54/src/test/resources/freemarker/core/ast-nestedignoredchildren.ftl
----------------------------------------------------------------------
diff --git a/src/test/resources/freemarker/core/ast-nestedignoredchildren.ftl b/src/test/resources/freemarker/core/ast-nestedignoredchildren.ftl
new file mode 100644
index 0000000..2f6043a
--- /dev/null
+++ b/src/test/resources/freemarker/core/ast-nestedignoredchildren.ftl
@@ -0,0 +1 @@
+<#outputFormat 'HTML'><#outputFormat 'HTML'><#outputFormat 'HTML'></#outputFormat></#outputFormat></#outputFormat>
\ No newline at end of file


[3/8] incubator-freemarker git commit: (if/else tests to guard against certain AST-related bugs)

Posted by dd...@apache.org.
(if/else tests to guard against certain AST-related bugs)


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/448d50bd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/448d50bd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/448d50bd

Branch: refs/heads/2.3
Commit: 448d50bd50635bd876271213c9a6949dca625508
Parents: 4af2c81
Author: ddekany <dd...@apache.org>
Authored: Thu Dec 17 21:43:44 2015 +0100
Committer: ddekany <dd...@apache.org>
Committed: Thu Dec 17 21:43:44 2015 +0100

----------------------------------------------------------------------
 .../resources/freemarker/test/templatesuite/expected/if.txt    | 6 ++++++
 .../resources/freemarker/test/templatesuite/templates/if.ftl   | 6 ++++++
 2 files changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/448d50bd/src/test/resources/freemarker/test/templatesuite/expected/if.txt
----------------------------------------------------------------------
diff --git a/src/test/resources/freemarker/test/templatesuite/expected/if.txt b/src/test/resources/freemarker/test/templatesuite/expected/if.txt
index d3bcbfc..579e91d 100644
--- a/src/test/resources/freemarker/test/templatesuite/expected/if.txt
+++ b/src/test/resources/freemarker/test/templatesuite/expected/if.txt
@@ -1,6 +1,8 @@
 
 - good
 - good
+- good
+- good
 
 - good
 - good
@@ -13,9 +15,12 @@
 - good
 - good
 - good
+- good
 
 - good
 - good
+- good
+- good
 
 - good
 - good
@@ -28,6 +33,7 @@
 - good
 - good
 - good
+- good
 
 - 1
 - 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/448d50bd/src/test/resources/freemarker/test/templatesuite/templates/if.ftl
----------------------------------------------------------------------
diff --git a/src/test/resources/freemarker/test/templatesuite/templates/if.ftl b/src/test/resources/freemarker/test/templatesuite/templates/if.ftl
index 5d839ee..df9f19c 100644
--- a/src/test/resources/freemarker/test/templatesuite/templates/if.ftl
+++ b/src/test/resources/freemarker/test/templatesuite/templates/if.ftl
@@ -1,6 +1,8 @@
 <#assign x = 1>
 
 - <#if x == 1>good</#if>
+- <#if x == 1></#if>good
+- <#if x == 1>goo${missing!'d'}</#if>
 - <#if x == 0>wrong</#if>good
 
 - <#if x == 1>good<#else>wrong</#if>
@@ -14,10 +16,13 @@
 - <#if x == 1>good<#elseif x == 1>wrong</#if>
 - <#if x == 0>wrong<#elseif x == 1>good</#if>
 - <#if x == 0>wrong<#elseif x == 2>wrong</#if>good
+- <#if x == 0>wrong<#elseif x == 1><#else>wrong</#if>good
 
 <#-- Same with pre-calculable results, just in case later the dead code will be optimized out: -->
 - <#if 1 == 1>good</#if>
 - <#if 1 == 0>wrong</#if>good
+- <#if 1 == 1>goo${missing!'d'}</#if>
+- <#if 1 == 0>wrong</#if>good
 
 - <#if 1 == 1>good<#else>wrong</#if>
 - <#if 1 == 0>wrong<#else>good</#if>
@@ -30,6 +35,7 @@
 - <#if 1 == 1>good<#elseif 1 == 1>wrong</#if>
 - <#if 1 == 0>wrong<#elseif 1 == 1>good</#if>
 - <#if 1 == 0>wrong<#elseif 1 == 2>wrong</#if>good
+- <#if 1 == 0>wrong<#elseif 1 == 1><#else>wrong</#if>good
 
 <#-- Varying branch choice of the same AST nodes: -->
 <#list [1, 2, 3, 4] as x>


[4/8] incubator-freemarker git commit: (AST location information test)

Posted by dd...@apache.org.
(AST location information test)


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/cd6857c1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/cd6857c1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/cd6857c1

Branch: refs/heads/2.3
Commit: cd6857c18bd178fe0c480d8ac469e0fdcd09a0aa
Parents: 448d50b
Author: ddekany <dd...@apache.org>
Authored: Thu Dec 17 23:57:13 2015 +0100
Committer: ddekany <dd...@apache.org>
Committed: Thu Dec 17 23:57:13 2015 +0100

----------------------------------------------------------------------
 src/test/java/freemarker/core/ASTTest.java      | 19 ++++-
 .../resources/freemarker/core/ast-locations.ast | 87 ++++++++++++++++++++
 .../resources/freemarker/core/ast-locations.ftl | 10 +++
 3 files changed, 114 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/cd6857c1/src/test/java/freemarker/core/ASTTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/freemarker/core/ASTTest.java b/src/test/java/freemarker/core/ASTTest.java
index 1981ba6..8edb85e 100644
--- a/src/test/java/freemarker/core/ASTTest.java
+++ b/src/test/java/freemarker/core/ASTTest.java
@@ -22,6 +22,7 @@ package freemarker.core;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 
+import freemarker.core.ASTPrinter.Options;
 import freemarker.template.utility.StringUtil;
 import freemarker.test.utility.FileTestCase;
 
@@ -67,13 +68,27 @@ public class ASTTest extends FileTestCase {
         testAST("ast-nestedignoredchildren");
     }
 
+    public void testLocations() throws Exception {
+        testASTWithLocations("ast-locations");
+    }
+    
     private void testAST(String testName) throws FileNotFoundException, IOException {
+        testAST(testName, null);
+    }
+
+    private void testASTWithLocations(String testName) throws FileNotFoundException, IOException {
+        Options options = new Options();
+        options.setShowLocation(true);
+        testAST(testName, options);
+    }
+
+    private void testAST(String testName, Options ops) throws FileNotFoundException, IOException {
         final String templateName = testName + ".ftl";
         assertExpectedFileEqualsString(
                 testName + ".ast",
-                ASTPrinter.getASTAsString(templateName, normalizeLineBreaks(templateName)));
+                ASTPrinter.getASTAsString(templateName, normalizeLineBreaks(templateName), ops));
     }
-
+    
     private String normalizeLineBreaks(final String templateName) throws FileNotFoundException, IOException {
         return StringUtil.replace(loadResource(templateName), "\r\n", "\n").replace('\r', '\n');
     }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/cd6857c1/src/test/resources/freemarker/core/ast-locations.ast
----------------------------------------------------------------------
diff --git a/src/test/resources/freemarker/core/ast-locations.ast b/src/test/resources/freemarker/core/ast-locations.ast
new file mode 100644
index 0000000..1d94637
--- /dev/null
+++ b/src/test/resources/freemarker/core/ast-locations.ast
@@ -0,0 +1,87 @@
+#mixed_content  // f.c.MixedContent; Location 1:1-10:33
+    #if  // f.c.ConditionalBlock; Location 1:1-1:15
+        - condition: exp  // f.c.Identifier; Location 1:6-1:8
+        - AST-node subtype: "0"  // Integer
+    #if  // f.c.ConditionalBlock; Location 2:1-2:16
+        - condition: exp  // f.c.Identifier; Location 2:6-2:8
+        - AST-node subtype: "0"  // Integer
+        #text  // f.c.TextBlock; Location 2:10-2:10
+            - content: "1"  // String
+    #text  // f.c.TextBlock; Location 2:17-2:17
+        - content: "\n"  // String
+    #if  // f.c.ConditionalBlock; Location 3:1-3:20
+        - condition: exp  // f.c.Identifier; Location 3:6-3:8
+        - AST-node subtype: "0"  // Integer
+        ${...}  // f.c.DollarVariable; Location 3:10-3:13
+            - content: 1  // f.c.NumberLiteral; Location 3:12-3:12
+        #text  // f.c.TextBlock; Location 3:14-3:14
+            - content: "2"  // String
+    #text  // f.c.TextBlock; Location 3:21-3:21
+        - content: "\n"  // String
+    #if-#elseif-#else-container  // f.c.IfBlock; Location 4:1-4:22
+        #if  // f.c.ConditionalBlock; Location 4:1-4:9
+            - condition: exp  // f.c.Identifier; Location 4:6-4:8
+            - AST-node subtype: "0"  // Integer
+        #else  // f.c.ConditionalBlock; Location 4:10-4:16
+            - condition: null  // Null
+            - AST-node subtype: "1"  // Integer
+    #if-#elseif-#else-container  // f.c.IfBlock; Location 5:1-5:24
+        #if  // f.c.ConditionalBlock; Location 5:1-5:10
+            - condition: exp  // f.c.Identifier; Location 5:6-5:8
+            - AST-node subtype: "0"  // Integer
+            #text  // f.c.TextBlock; Location 5:10-5:10
+                - content: "1"  // String
+        #else  // f.c.ConditionalBlock; Location 5:11-5:18
+            - condition: null  // Null
+            - AST-node subtype: "1"  // Integer
+            #text  // f.c.TextBlock; Location 5:18-5:18
+                - content: "1"  // String
+    #text  // f.c.TextBlock; Location 5:25-5:25
+        - content: "\n"  // String
+    #if-#elseif-#else-container  // f.c.IfBlock; Location 6:1-6:32
+        #if  // f.c.ConditionalBlock; Location 6:1-6:14
+            - condition: exp  // f.c.Identifier; Location 6:6-6:8
+            - AST-node subtype: "0"  // Integer
+            ${...}  // f.c.DollarVariable; Location 6:10-6:13
+                - content: 1  // f.c.NumberLiteral; Location 6:12-6:12
+            #text  // f.c.TextBlock; Location 6:14-6:14
+                - content: "2"  // String
+        #else  // f.c.ConditionalBlock; Location 6:15-6:26
+            - condition: null  // Null
+            - AST-node subtype: "1"  // Integer
+            ${...}  // f.c.DollarVariable; Location 6:22-6:25
+                - content: 1  // f.c.NumberLiteral; Location 6:24-6:24
+            #text  // f.c.TextBlock; Location 6:26-6:26
+                - content: "2"  // String
+    #text  // f.c.TextBlock; Location 6:33-6:33
+        - content: "\n"  // String
+    #if-#elseif-#else-container  // f.c.IfBlock; Location 7:1-7:28
+        #if  // f.c.ConditionalBlock; Location 7:1-7:9
+            - condition: exp  // f.c.Identifier; Location 7:6-7:8
+            - AST-node subtype: "0"  // Integer
+        #elseif  // f.c.ConditionalBlock; Location 7:10-7:22
+            - condition: exp  // f.c.Identifier; Location 7:19-7:21
+            - AST-node subtype: "2"  // Integer
+    #if-#elseif-#else-container  // f.c.IfBlock; Location 8:1-8:29
+        #if  // f.c.ConditionalBlock; Location 8:1-8:9
+            - condition: exp  // f.c.Identifier; Location 8:6-8:8
+            - AST-node subtype: "0"  // Integer
+        #elseif  // f.c.ConditionalBlock; Location 8:10-8:23
+            - condition: exp  // f.c.Identifier; Location 8:19-8:21
+            - AST-node subtype: "2"  // Integer
+            #text  // f.c.TextBlock; Location 8:23-8:23
+                - content: "1"  // String
+    #text  // f.c.TextBlock; Location 8:30-8:30
+        - content: "\n"  // String
+    #attempt  // f.c.AttemptBlock; Location 9:1-9:31
+        - error handler: #recover  // f.c.RecoveryBlock; Location 9:11-9:20
+        #recover  // f.c.RecoveryBlock; Location 9:11-9:20
+    #attempt  // f.c.AttemptBlock; Location 10:1-10:33
+        - error handler: #recover  // f.c.RecoveryBlock; Location 10:12-10:22
+            #text  // f.c.TextBlock; Location 10:22-10:22
+                - content: "1"  // String
+        #text  // f.c.TextBlock; Location 10:11-10:11
+            - content: "1"  // String
+        #recover  // f.c.RecoveryBlock; Location 10:12-10:22
+            #text  // f.c.TextBlock; Location 10:22-10:22
+                - content: "1"  // String

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/cd6857c1/src/test/resources/freemarker/core/ast-locations.ftl
----------------------------------------------------------------------
diff --git a/src/test/resources/freemarker/core/ast-locations.ftl b/src/test/resources/freemarker/core/ast-locations.ftl
new file mode 100644
index 0000000..cecc19e
--- /dev/null
+++ b/src/test/resources/freemarker/core/ast-locations.ftl
@@ -0,0 +1,10 @@
+<#if exp></#if>
+<#if exp>1</#if>
+<#if exp>${1}2</#if>
+<#if exp><#else></#if>
+<#if exp>1<#else>1</#if>
+<#if exp>${1}2<#else>${1}2</#if>
+<#if exp><#elseif exp></#if>
+<#if exp><#elseif exp>1</#if>
+<#attempt><#recover></#attempt>
+<#attempt>1<#recover>1</#attempt>
\ No newline at end of file


[6/8] incubator-freemarker git commit: Added back FMParser.MixedContent and OptionalBlock products for backward compatibility for those dared to call the parser directly. We don't use them.

Posted by dd...@apache.org.
Added back FMParser.MixedContent and OptionalBlock products for backward compatibility for those dared to call the parser directly. We don't use them.


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/4fb95ebc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/4fb95ebc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/4fb95ebc

Branch: refs/heads/2.3
Commit: 4fb95ebc9339c488c64ef72ba03aa97f21c59cb8
Parents: f08867b
Author: ddekany <dd...@apache.org>
Authored: Fri Dec 18 21:58:03 2015 +0100
Committer: ddekany <dd...@apache.org>
Committed: Fri Dec 18 21:58:03 2015 +0100

----------------------------------------------------------------------
 .../core/TemplateElementArrayBuilder.java       |  4 ++
 src/main/javacc/FTL.jj                          | 60 ++++++++++++++++++++
 2 files changed, 64 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4fb95ebc/src/main/java/freemarker/core/TemplateElementArrayBuilder.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/TemplateElementArrayBuilder.java b/src/main/java/freemarker/core/TemplateElementArrayBuilder.java
index c18e48b..e44f12e 100644
--- a/src/main/java/freemarker/core/TemplateElementArrayBuilder.java
+++ b/src/main/java/freemarker/core/TemplateElementArrayBuilder.java
@@ -40,6 +40,10 @@ class TemplateElements {
     int getCount() {
         return count;
     }
+
+    TemplateElement getFirst() {
+        return buffer != null ? buffer[0] : null;
+    }
     
     TemplateElement getLast() {
         return buffer != null ? buffer[count - 1] : null;

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4fb95ebc/src/main/javacc/FTL.jj
----------------------------------------------------------------------
diff --git a/src/main/javacc/FTL.jj b/src/main/javacc/FTL.jj
index 254c27a..ad81e08 100644
--- a/src/main/javacc/FTL.jj
+++ b/src/main/javacc/FTL.jj
@@ -4003,6 +4003,66 @@ TemplateElements MixedContentElements() :
 }
 
 /**
+ * Not used anymore; kept for backward compatibility.
+ *
+ * @deprecated Use {@link #MixedContentElements} instead.
+ */
+MixedContent MixedContent() :
+{
+    MixedContent mixedContent = new MixedContent();
+    TemplateElement elem, begin = null;
+    mixedContentNesting++;
+}
+{
+    (
+        LOOKAHEAD(1) // Just tells javacc that we know what we're doing.
+        (
+            elem = PCData()
+            |
+            elem = StringOutput()
+            |
+            elem = NumericalOutput()
+            |
+            elem = FreemarkerDirective()
+        )
+        {
+            if (begin == null) {
+                begin = elem;
+            }
+            mixedContent.addElement(elem);
+        }
+    )+
+    {
+        mixedContentNesting--;
+        mixedContent.setLocation(template, begin, elem);
+        return mixedContent;
+    }
+}
+
+/**
+ * Not used anymore; kept for backward compatibility.
+ *
+ * <p>A production for a block of optional content.
+ * Returns an empty Text block if there is no
+ * content.
+ *
+ * @deprecated Use {@link #MixedContentElements} instead.
+ */
+TemplateElement OptionalBlock() :
+{
+    TemplateElement tp = null;
+}
+{
+    [
+        LOOKAHEAD(1) // has no effect but to get rid of a spurious warning.
+        tp = MixedContent()
+    ]
+    {
+        return tp != null ? tp : new TextBlock(CollectionUtils.EMPTY_CHAR_ARRAY, false);
+    }
+}
+
+/**
  * A production freemarker text that may contain
  * ${...} and #{...} but no directives.
  */


[2/8] incubator-freemarker git commit: (Test case to test #return in macros)

Posted by dd...@apache.org.
(Test case to test #return in macros)


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/4af2c81d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/4af2c81d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/4af2c81d

Branch: refs/heads/2.3
Commit: 4af2c81d9bba53fb8a6ad6b0a810bebb386871ba
Parents: d1dafa5
Author: ddekany <dd...@apache.org>
Authored: Thu Dec 17 21:32:48 2015 +0100
Committer: ddekany <dd...@apache.org>
Committed: Thu Dec 17 21:34:09 2015 +0100

----------------------------------------------------------------------
 .../test/templatesuite/expected/macros-return.txt   |  5 +++++
 .../test/templatesuite/templates/macros-return.ftl  | 16 ++++++++++++++++
 .../freemarker/test/templatesuite/testcases.xml     |  1 +
 3 files changed, 22 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4af2c81d/src/test/resources/freemarker/test/templatesuite/expected/macros-return.txt
----------------------------------------------------------------------
diff --git a/src/test/resources/freemarker/test/templatesuite/expected/macros-return.txt b/src/test/resources/freemarker/test/templatesuite/expected/macros-return.txt
new file mode 100644
index 0000000..c7f0329
--- /dev/null
+++ b/src/test/resources/freemarker/test/templatesuite/expected/macros-return.txt
@@ -0,0 +1,5 @@
+m{
+m{
+m{
+b{
+m:b{
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4af2c81d/src/test/resources/freemarker/test/templatesuite/templates/macros-return.ftl
----------------------------------------------------------------------
diff --git a/src/test/resources/freemarker/test/templatesuite/templates/macros-return.ftl b/src/test/resources/freemarker/test/templatesuite/templates/macros-return.ftl
new file mode 100644
index 0000000..d71bbd6
--- /dev/null
+++ b/src/test/resources/freemarker/test/templatesuite/templates/macros-return.ftl
@@ -0,0 +1,16 @@
+<#macro m>m{<#return>}</#macro>
+<@m/>
+
+<#macro m><#if true>m{<#return>}</#if></#macro>
+<@m/>
+
+<#macro m><#if true>m{<#return></#if>}</#macro>
+<@m/>
+
+<#macro b>b{<#nested>}</#macro>
+<#macro m><@b><#return></@></#macro>
+<@m/>
+
+<#macro b>b{<#nested>}</#macro>
+<#macro m>m:<@b><#return></@></#macro>
+<@m/>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4af2c81d/src/test/resources/freemarker/test/templatesuite/testcases.xml
----------------------------------------------------------------------
diff --git a/src/test/resources/freemarker/test/templatesuite/testcases.xml b/src/test/resources/freemarker/test/templatesuite/testcases.xml
index 4fbb6dd..31d6606 100644
--- a/src/test/resources/freemarker/test/templatesuite/testcases.xml
+++ b/src/test/resources/freemarker/test/templatesuite/testcases.xml
@@ -122,6 +122,7 @@
    <testCase name="loopvariable" />
    <testCase name="macros"/>
    <testCase name="macros2"/>
+   <testCase name="macros-return"/>
    <testCase name="multimodels"/>
    <testCase name="nested" />
    <testCase name="newlines1" />


[7/8] incubator-freemarker git commit: Fixing regression: Interpolations should be shown in the FTL stack trace

Posted by dd...@apache.org.
Fixing regression: Interpolations should be shown in the FTL stack trace


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/0e5213a8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/0e5213a8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/0e5213a8

Branch: refs/heads/2.3
Commit: 0e5213a8bd08bce7a24ede6a9cb09b1c3fb54fd9
Parents: 4fb95eb
Author: ddekany <dd...@apache.org>
Authored: Fri Dec 18 22:14:10 2015 +0100
Committer: ddekany <dd...@apache.org>
Committed: Fri Dec 18 22:14:10 2015 +0100

----------------------------------------------------------------------
 src/main/java/freemarker/core/Interpolation.java | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/0e5213a8/src/main/java/freemarker/core/Interpolation.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/Interpolation.java b/src/main/java/freemarker/core/Interpolation.java
index 2dcb11a..a58e9c2 100644
--- a/src/main/java/freemarker/core/Interpolation.java
+++ b/src/main/java/freemarker/core/Interpolation.java
@@ -40,4 +40,9 @@ abstract class Interpolation extends TemplateElement {
      */
     protected abstract Object calculateInterpolatedStringOrMarkup(Environment env) throws TemplateException;
 
+    @Override
+    boolean isShownInStackTrace() {
+        return true;
+    }
+    
 }


[5/8] incubator-freemarker git commit: (More AST location information tests)

Posted by dd...@apache.org.
(More AST location information tests)


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/f08867b6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/f08867b6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/f08867b6

Branch: refs/heads/2.3
Commit: f08867b604399abf9b0de8a6c89e1cbc560b300b
Parents: cd6857c
Author: ddekany <dd...@apache.org>
Authored: Fri Dec 18 21:41:16 2015 +0100
Committer: ddekany <dd...@apache.org>
Committed: Fri Dec 18 21:41:16 2015 +0100

----------------------------------------------------------------------
 .../resources/freemarker/core/ast-locations.ast | 52 +++++++++++++++++++-
 .../resources/freemarker/core/ast-locations.ftl | 10 +++-
 2 files changed, 60 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/f08867b6/src/test/resources/freemarker/core/ast-locations.ast
----------------------------------------------------------------------
diff --git a/src/test/resources/freemarker/core/ast-locations.ast b/src/test/resources/freemarker/core/ast-locations.ast
index 1d94637..fb8974a 100644
--- a/src/test/resources/freemarker/core/ast-locations.ast
+++ b/src/test/resources/freemarker/core/ast-locations.ast
@@ -1,4 +1,4 @@
-#mixed_content  // f.c.MixedContent; Location 1:1-10:33
+#mixed_content  // f.c.MixedContent; Location 1:1-18:8
     #if  // f.c.ConditionalBlock; Location 1:1-1:15
         - condition: exp  // f.c.Identifier; Location 1:6-1:8
         - AST-node subtype: "0"  // Integer
@@ -85,3 +85,53 @@
         #recover  // f.c.RecoveryBlock; Location 10:12-10:22
             #text  // f.c.TextBlock; Location 10:22-10:22
                 - content: "1"  // String
+    #text  // f.c.TextBlock; Location 10:34-10:34
+        - content: "\n"  // String
+    #list  // f.c.IteratorBlock; Location 11:1-11:22
+        - list source: s  // f.c.Identifier; Location 11:8-11:8
+        - target loop variable: "i"  // String
+    #list  // f.c.IteratorBlock; Location 12:1-12:23
+        - list source: s  // f.c.Identifier; Location 12:8-12:8
+        - target loop variable: "i"  // String
+        #text  // f.c.TextBlock; Location 12:15-12:15
+            - content: "1"  // String
+    #text  // f.c.TextBlock; Location 12:24-12:24
+        - content: "\n"  // String
+    #list  // f.c.IteratorBlock; Location 13:1-13:28
+        - list source: s  // f.c.Identifier; Location 13:8-13:8
+        - target loop variable: "i"  // String
+        #sep  // f.c.Sep; Location 13:15-13:20
+    #list  // f.c.IteratorBlock; Location 14:1-14:30
+        - list source: s  // f.c.Identifier; Location 14:8-14:8
+        - target loop variable: "i"  // String
+        #text  // f.c.TextBlock; Location 14:15-14:15
+            - content: "1"  // String
+        #sep  // f.c.Sep; Location 14:16-14:22
+            #text  // f.c.TextBlock; Location 14:22-14:22
+                - content: "1"  // String
+    #text  // f.c.TextBlock; Location 14:31-14:31
+        - content: "\n"  // String
+    #list  // f.c.IteratorBlock; Location 15:1-15:45
+        - list source: s  // f.c.Identifier; Location 15:8-15:8
+        #items  // f.c.Items; Location 15:10-15:37
+            - target loop variable: "i"  // String
+            #sep  // f.c.Sep; Location 15:23-15:28
+    #list  // f.c.IteratorBlock; Location 16:1-16:49
+        - list source: s  // f.c.Identifier; Location 16:8-16:8
+        #text  // f.c.TextBlock; Location 16:10-16:10
+            - content: "1"  // String
+        #items  // f.c.Items; Location 16:11-16:40
+            - target loop variable: "i"  // String
+            #text  // f.c.TextBlock; Location 16:24-16:24
+                - content: "1"  // String
+            #sep  // f.c.Sep; Location 16:25-16:31
+                #text  // f.c.TextBlock; Location 16:31-16:31
+                    - content: "1"  // String
+        #text  // f.c.TextBlock; Location 16:41-16:41
+            - content: "1"  // String
+    #text  // f.c.TextBlock; Location 16:50-17:2
+        - content: "\n1\n"  // String
+    ${...}  // f.c.DollarVariable; Location 18:1-18:8
+        - content: +  // f.c.AddConcatExpression; Location 18:3-18:7
+            - left-hand operand: x  // f.c.Identifier; Location 18:3-18:3
+            - right-hand operand: y  // f.c.Identifier; Location 18:7-18:7

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/f08867b6/src/test/resources/freemarker/core/ast-locations.ftl
----------------------------------------------------------------------
diff --git a/src/test/resources/freemarker/core/ast-locations.ftl b/src/test/resources/freemarker/core/ast-locations.ftl
index cecc19e..6f299c4 100644
--- a/src/test/resources/freemarker/core/ast-locations.ftl
+++ b/src/test/resources/freemarker/core/ast-locations.ftl
@@ -7,4 +7,12 @@
 <#if exp><#elseif exp></#if>
 <#if exp><#elseif exp>1</#if>
 <#attempt><#recover></#attempt>
-<#attempt>1<#recover>1</#attempt>
\ No newline at end of file
+<#attempt>1<#recover>1</#attempt>
+<#list s as i></#list>
+<#list s as i>1</#list>
+<#list s as i><#sep></#list>
+<#list s as i>1<#sep>1</#list>
+<#list s><#items as i><#sep></#items></#list>
+<#list s>1<#items as i>1<#sep>1</#items>1</#list>
+1
+${x + y}
\ No newline at end of file


[8/8] incubator-freemarker git commit: Merge remote-tracking branch 'origin/2.3-gae' into 2.3

Posted by dd...@apache.org.
Merge remote-tracking branch 'origin/2.3-gae' into 2.3


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/5203c735
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/5203c735
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/5203c735

Branch: refs/heads/2.3
Commit: 5203c735a39f745afa0b5e7b556bb1022968a9b5
Parents: c942528 0e5213a
Author: ddekany <dd...@apache.org>
Authored: Sat Dec 19 15:21:39 2015 +0100
Committer: ddekany <dd...@apache.org>
Committed: Sat Dec 19 15:21:39 2015 +0100

----------------------------------------------------------------------
 .../java/freemarker/core/Interpolation.java     |   5 +
 .../core/TemplateElementArrayBuilder.java       |   4 +
 src/main/javacc/FTL.jj                          |  60 ++++++++
 src/test/java/freemarker/core/ASTTest.java      |  23 +++-
 .../resources/freemarker/core/ast-locations.ast | 137 +++++++++++++++++++
 .../resources/freemarker/core/ast-locations.ftl |  18 +++
 .../core/ast-nestedignoredchildren.ast          |   2 +
 .../core/ast-nestedignoredchildren.ftl          |   1 +
 .../test/templatesuite/expected/if.txt          |   6 +
 .../templatesuite/expected/macros-return.txt    |   5 +
 .../test/templatesuite/templates/if.ftl         |   6 +
 .../templatesuite/templates/macros-return.ftl   |  16 +++
 .../freemarker/test/templatesuite/testcases.xml |   1 +
 13 files changed, 282 insertions(+), 2 deletions(-)
----------------------------------------------------------------------