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 trim directive AST class name)
Date Fri, 07 Jul 2017 23:00:11 GMT
Repository: incubator-freemarker
Updated Branches:
  refs/heads/3 92db58918 -> 344b95411


(Fixed trim directive AST class name)


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

Branch: refs/heads/3
Commit: 8be70ea94410e192236e7d61f9e8d023331efc16
Parents: 92db589
Author: ddekany <ddekany@apache.org>
Authored: Sat Jul 8 00:57:49 2017 +0200
Committer: ddekany <ddekany@apache.org>
Committed: Sat Jul 8 00:57:49 2017 +0200

----------------------------------------------------------------------
 .../freemarker/core/ASTDirTOrRtOrLtOrNt.java    | 109 +++++++++++++++++++
 .../apache/freemarker/core/ASTDirTOrTrOrTl.java | 109 -------------------
 .../apache/freemarker/core/ASTStaticText.java   |  10 +-
 freemarker-core/src/main/javacc/FTL.jj          |  10 +-
 4 files changed, 119 insertions(+), 119 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8be70ea9/freemarker-core/src/main/java/org/apache/freemarker/core/ASTDirTOrRtOrLtOrNt.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/ASTDirTOrRtOrLtOrNt.java
b/freemarker-core/src/main/java/org/apache/freemarker/core/ASTDirTOrRtOrLtOrNt.java
new file mode 100644
index 0000000..5b79e30
--- /dev/null
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/ASTDirTOrRtOrLtOrNt.java
@@ -0,0 +1,109 @@
+/*
+ * 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.
+ */
+
+package org.apache.freemarker.core;
+
+/**
+ * AST directive node: {@code #t}, {@code #tr}, {@code #tl}.
+ */
+final class ASTDirTOrRtOrLtOrNt extends ASTDirective {
+    
+    private static final int TYPE_T = 0;
+    private static final int TYPE_LT = 1;
+    private static final int TYPE_RT = 2;
+    private static final int TYPE_NT = 3;
+
+    final boolean left, right;
+
+    ASTDirTOrRtOrLtOrNt(boolean left, boolean right) {
+        this.left = left;
+        this.right = right;
+    }
+
+    @Override
+    ASTElement[] accept(Environment env) {
+        // This instruction does nothing at render-time, only parse-time.
+        return null;
+    }
+
+    @Override
+    protected String dump(boolean canonical) {
+        StringBuilder sb = new StringBuilder();
+        if (canonical) sb.append('<');
+        sb.append(getASTNodeDescriptor());
+        if (canonical) sb.append("/>");
+        return sb.toString();
+    }
+    
+    @Override
+    String getASTNodeDescriptor() {
+        if (left && right) {
+            return "#t";
+        } else if (left) {
+            return "#lt";
+        } else if (right) {
+            return "#rt";
+        } else {
+            return "#nt";
+        }
+    }
+    
+    @Override
+    boolean isIgnorable(boolean stripWhitespace) {
+        return true;
+    }
+
+    @Override
+    int getParameterCount() {
+        return 1;
+    }
+
+    @Override
+    Object getParameterValue(int idx) {
+        if (idx != 0) throw new IndexOutOfBoundsException();
+        int type;
+        if (left && right) {
+            type = TYPE_T;
+        } else if (left) {
+            type = TYPE_LT;
+        } else if (right) {
+            type = TYPE_RT;
+        } else {
+            type = TYPE_NT;
+        }
+        return Integer.valueOf(type);
+    }
+
+    @Override
+    ParameterRole getParameterRole(int idx) {
+        if (idx != 0) throw new IndexOutOfBoundsException();
+        return ParameterRole.AST_NODE_SUBTYPE;
+    }
+
+    @Override
+    boolean isOutputCacheable() {
+        return true;
+    }
+
+    @Override
+    boolean isNestedBlockRepeater() {
+        return false;
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8be70ea9/freemarker-core/src/main/java/org/apache/freemarker/core/ASTDirTOrTrOrTl.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/ASTDirTOrTrOrTl.java
b/freemarker-core/src/main/java/org/apache/freemarker/core/ASTDirTOrTrOrTl.java
deleted file mode 100644
index 3cf4b9d..0000000
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/ASTDirTOrTrOrTl.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.freemarker.core;
-
-/**
- * AST directive node: {@code #t}, {@code #tr}, {@code #tl}.
- */
-final class ASTDirTOrTrOrTl extends ASTDirective {
-    
-    private static final int TYPE_T = 0;
-    private static final int TYPE_LT = 1;
-    private static final int TYPE_RT = 2;
-    private static final int TYPE_NT = 3;
-
-    final boolean left, right;
-
-    ASTDirTOrTrOrTl(boolean left, boolean right) {
-        this.left = left;
-        this.right = right;
-    }
-
-    @Override
-    ASTElement[] accept(Environment env) {
-        // This instruction does nothing at render-time, only parse-time.
-        return null;
-    }
-
-    @Override
-    protected String dump(boolean canonical) {
-        StringBuilder sb = new StringBuilder();
-        if (canonical) sb.append('<');
-        sb.append(getASTNodeDescriptor());
-        if (canonical) sb.append("/>");
-        return sb.toString();
-    }
-    
-    @Override
-    String getASTNodeDescriptor() {
-        if (left && right) {
-            return "#t";
-        } else if (left) {
-            return "#lt";
-        } else if (right) {
-            return "#rt";
-        } else {
-            return "#nt";
-        }
-    }
-    
-    @Override
-    boolean isIgnorable(boolean stripWhitespace) {
-        return true;
-    }
-
-    @Override
-    int getParameterCount() {
-        return 1;
-    }
-
-    @Override
-    Object getParameterValue(int idx) {
-        if (idx != 0) throw new IndexOutOfBoundsException();
-        int type;
-        if (left && right) {
-            type = TYPE_T;
-        } else if (left) {
-            type = TYPE_LT;
-        } else if (right) {
-            type = TYPE_RT;
-        } else {
-            type = TYPE_NT;
-        }
-        return Integer.valueOf(type);
-    }
-
-    @Override
-    ParameterRole getParameterRole(int idx) {
-        if (idx != 0) throw new IndexOutOfBoundsException();
-        return ParameterRole.AST_NODE_SUBTYPE;
-    }
-
-    @Override
-    boolean isOutputCacheable() {
-        return true;
-    }
-
-    @Override
-    boolean isNestedBlockRepeater() {
-        return false;
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8be70ea9/freemarker-core/src/main/java/org/apache/freemarker/core/ASTStaticText.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/ASTStaticText.java b/freemarker-core/src/main/java/org/apache/freemarker/core/ASTStaticText.java
index 5e4b957..4353400 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/ASTStaticText.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/ASTStaticText.java
@@ -144,8 +144,8 @@ final class ASTStaticText extends ASTElement {
         for (ASTElement elem = nextTerminalNode();
              elem != null && elem.beginLine == endLine;
              elem = elem.nextTerminalNode()) {
-            if (elem instanceof ASTDirTOrTrOrTl) {
-                ASTDirTOrTrOrTl ti = (ASTDirTOrTrOrTl) elem;
+            if (elem instanceof ASTDirTOrRtOrLtOrNt) {
+                ASTDirTOrRtOrLtOrNt ti = (ASTDirTOrRtOrLtOrNt) elem;
                 if (!ti.left && !ti.right) {
                     result = true;
                 }
@@ -182,8 +182,8 @@ final class ASTStaticText extends ASTElement {
         for (ASTElement elem = prevTerminalNode();
              elem != null && elem.endLine == beginLine;
              elem = elem.prevTerminalNode()) {
-            if (elem instanceof ASTDirTOrTrOrTl) {
-                ASTDirTOrTrOrTl ti = (ASTDirTOrTrOrTl) elem;
+            if (elem instanceof ASTDirTOrRtOrLtOrNt) {
+                ASTDirTOrRtOrLtOrNt ti = (ASTDirTOrRtOrLtOrNt) elem;
                 if (!ti.left && !ti.right) {
                     result = true;
                 }
@@ -219,7 +219,7 @@ final class ASTStaticText extends ASTElement {
                                 if (te.heedsOpeningWhitespace()) {
                                     trimTrailingPart = false;
                                 }
-                                if (te instanceof ASTDirTOrTrOrTl && ((ASTDirTOrTrOrTl)
te).left) {
+                                if (te instanceof ASTDirTOrRtOrLtOrNt && ((ASTDirTOrRtOrLtOrNt)
te).left) {
                                     trimTrailingPart = true;
                                     break;
                                 }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8be70ea9/freemarker-core/src/main/javacc/FTL.jj
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/javacc/FTL.jj b/freemarker-core/src/main/javacc/FTL.jj
index fd07a66..84608ea 100644
--- a/freemarker-core/src/main/javacc/FTL.jj
+++ b/freemarker-core/src/main/javacc/FTL.jj
@@ -2649,17 +2649,17 @@ ASTElement Flush() :
 ASTElement Trim() :
 {
     Token t;
-    ASTDirTOrTrOrTl result = null;
+    ASTDirTOrRtOrLtOrNt result = null;
 }
 {
     (
-        t = <TRIM> { result = new ASTDirTOrTrOrTl(true, true); }
+        t = <TRIM> { result = new ASTDirTOrRtOrLtOrNt(true, true); }
         |
-        t = <LTRIM> { result = new ASTDirTOrTrOrTl(true, false); }
+        t = <LTRIM> { result = new ASTDirTOrRtOrLtOrNt(true, false); }
         |
-        t = <RTRIM> { result = new ASTDirTOrTrOrTl(false, true); }
+        t = <RTRIM> { result = new ASTDirTOrRtOrLtOrNt(false, true); }
         |
-        t = <NOTRIM> { result = new ASTDirTOrTrOrTl(false, false); }
+        t = <NOTRIM> { result = new ASTDirTOrRtOrLtOrNt(false, false); }
     )
     {
         result.setLocation(template, t, t);


Mime
View raw message