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 2017/08/05 14:26:59 UTC
[39/50] incubator-freemarker git commit: Fixed some parser error
message glitches.
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
Commit: 15afde13463306d0e96f09211e0ccdf92d9ec71e
Parents: 16ff174
Author: ddekany <dd...@apache.org>
Authored: Sat Aug 5 10:01:56 2017 +0200
Committer: ddekany <dd...@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");