Blob Blame History Raw
From c119c7d20b46c91f2c661e4f3789194041c4ba16 Mon Sep 17 00:00:00 2001
From: Michael Simacek <msimacek@redhat.com>
Date: Tue, 4 Apr 2017 16:56:33 +0200
Subject: [PATCH] Fix compatibility with javacc 7

---
 build.xml                                        | 16 +++++++++++++++-
 src/main/java/freemarker/core/TokenMgrError.java |  5 +++++
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/source/build.xml b/source/build.xml
index 6542da9..20d1d56 100644
--- a/source/build.xml
+++ b/source/build.xml
@@ -131,13 +131,27 @@
 
     <mkdir dir="${_javaccOutputDir}" />
     <ivy:retrieve conf="parser" pattern="build/javacc-home.tmp/[artifact].[ext]" />
+    <!-- avoid usage of word template which is now a keyword in javacc -->
+    <copy file="src/main/javacc/FTL.jj" tofile="${_javaccOutputDir}/FTL.jj"/>
+    <replace
+      file="${_javaccOutputDir}/FTL.jj"
+      token="template"
+      value="xtemplate"
+    />
     <javacc:generate
-      target="src/main/javacc/FTL.jj"
+      target="${_javaccOutputDir}/FTL.jj"
       outputdirectory="${_javaccOutputDir}"
       javacchome="/usr/share/java/" jdkversion="1.3"
     />
     <delete dir="build/javacc-home.tmp" />
     
+    <!-- undo template keyword replacement -->
+    <replace
+      dir="${_javaccOutputDir}"
+      token="xtemplate"
+      value="template"
+    />
+
     <replace
       file="${_javaccOutputDir}/FMParser.java"
       token="private final LookaheadSuccess"
diff --git a/source/src/main/java/freemarker/core/TokenMgrError.java b/source/src/main/java/freemarker/core/TokenMgrError.java
index 34354ee..0d00d36 100644
--- a/source/src/main/java/freemarker/core/TokenMgrError.java
+++ b/source/src/main/java/freemarker/core/TokenMgrError.java
@@ -194,6 +194,11 @@ public class TokenMgrError extends Error
       this.endColumnNumber = this.columnNumber; 
    }
 
+
+    public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, int curChar, int reason) {
+        this(EOFSeen, lexState, errorLine, errorColumn, errorAfter, (char)curChar, reason);
+    }
+
    /**
     * 1-based line number of the unexpected character(s).
     * 
-- 
2.9.3