freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ddek...@apache.org
Subject [1/3] incubator-freemarker git commit: Fixed some parser error message glitches.
Date Sat, 05 Aug 2017 09:05:58 GMT
Repository: incubator-freemarker
Updated Branches:
  refs/heads/2.3-gae 16ff17463 -> 2aebfe533


Fixed some parser error message glitches.


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

Branch: refs/heads/2.3-gae
Commit: 15afde13463306d0e96f09211e0ccdf92d9ec71e
Parents: 16ff174
Author: ddekany <ddekany@apache.org>
Authored: Sat Aug 5 10:01:56 2017 +0200
Committer: ddekany <ddekany@apache.org>
Committed: Sat Aug 5 10:03:03 2017 +0200

----------------------------------------------------------------------
 src/main/javacc/FTL.jj                                      | 6 +++---
 src/test/java/freemarker/core/ParsingErrorMessagesTest.java | 2 ++
 2 files changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/15afde13/src/main/javacc/FTL.jj
----------------------------------------------------------------------
diff --git a/src/main/javacc/FTL.jj b/src/main/javacc/FTL.jj
index b011c41..175614c 100644
--- a/src/main/javacc/FTL.jj
+++ b/src/main/javacc/FTL.jj
@@ -3227,7 +3227,7 @@ Macro Macro() :
     )
     {
         if (inMacro || inFunction) {
-            throw new ParseException("Macros cannot be nested.", template, start);
+            throw new ParseException("Macro or function definitions can't be nested into
each other.", template, start);
         }
         if (isFunction) inFunction = true; else inMacro = true;
     }
@@ -3294,12 +3294,12 @@ Macro Macro() :
     (
         end = <END_MACRO>
         {
-        	if (isFunction) throw new ParseException("Expected function end tag here.", template,
start);
+        	if (isFunction) throw new ParseException("Expected function end tag here.", template,
end);
     	}
         |
         end = <END_FUNCTION>
         {
-    		if (!isFunction) throw new ParseException("Expected macro end tag here.", template,
start);
+    		if (!isFunction) throw new ParseException("Expected macro end tag here.", template,
end);
     	}
     )
     {

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/15afde13/src/test/java/freemarker/core/ParsingErrorMessagesTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/freemarker/core/ParsingErrorMessagesTest.java b/src/test/java/freemarker/core/ParsingErrorMessagesTest.java
index 53194a8..e471a31 100644
--- a/src/test/java/freemarker/core/ParsingErrorMessagesTest.java
+++ b/src/test/java/freemarker/core/ParsingErrorMessagesTest.java
@@ -61,7 +61,9 @@ public class ParsingErrorMessagesTest {
     @Test
     public void testUnclosedDirectives() {
         assertErrorContains("<#macro x>", "#macro", "unclosed");
+        assertErrorContains("<#macro x></#function>", "macro end tag");
         assertErrorContains("<#function x>", "#macro", "unclosed");
+        assertErrorContains("<#function x></#macro>", "function end tag");
         assertErrorContains("<#assign x>", "#assign", "unclosed");
         assertErrorContains("<#macro m><#local x>", "#local", "unclosed");
         assertErrorContains("<#global x>", "#global", "unclosed");


Mime
View raw message