(Renamed ConverterUtils to internal.)
Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/d357910a Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/d357910a Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/d357910a Branch: refs/heads/3 Commit: d357910a569c6a1875b909baa211683232ac6170 Parents: 372cc48 Author: ddekany <[email protected]> Authored: Mon Oct 23 21:36:04 2017 +0200 Committer: ddekany <[email protected]> Committed: Mon Oct 23 21:36:04 2017 +0200 ---------------------------------------------------------------------- .../core/FM2ASTToFM3SourceConverter.java | 20 +++---- .../freemarker/converter/ConverterUtils.java | 57 -------------------- .../freemarker/converter/_ConverterUtils.java | 57 ++++++++++++++++++++ 3 files changed, 67 insertions(+), 67 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d357910a/freemarker-converter/src/main/java/freemarker/core/FM2ASTToFM3SourceConverter.java ---------------------------------------------------------------------- diff --git a/freemarker-converter/src/main/java/freemarker/core/FM2ASTToFM3SourceConverter.java b/freemarker-converter/src/main/java/freemarker/core/FM2ASTToFM3SourceConverter.java index fc85424..cb2ae18 100644 --- a/freemarker-converter/src/main/java/freemarker/core/FM2ASTToFM3SourceConverter.java +++ b/freemarker-converter/src/main/java/freemarker/core/FM2ASTToFM3SourceConverter.java @@ -34,7 +34,7 @@ import org.apache.commons.io.IOUtils; import org.apache.freemarker.converter.ConversionMarkers; import org.apache.freemarker.converter.ConverterException; import org.apache.freemarker.converter.UnconvertableLegacyFeatureException; -import org.apache.freemarker.converter.ConverterUtils; +import org.apache.freemarker.converter._ConverterUtils; import org.apache.freemarker.core.util.TemplateLanguageUtils; import org.apache.freemarker.core.util._ClassUtils; import org.apache.freemarker.core.util._NullArgumentException; @@ -778,11 +778,11 @@ public class FM2ASTToFM3SourceConverter { String postVar2WSAndComment = readWSAndExpComments(getEndPositionExclusive(listSource)); printExp(listSource); - printWithConvertedExpComments(ConverterUtils.rightTrim(postVar2WSAndComment)); + printWithConvertedExpComments(_ConverterUtils.rightTrim(postVar2WSAndComment)); print(" as "); print(TemplateLanguageUtils.escapeIdentifier(loopVal1)); - printWithConvertedExpComments(ConverterUtils.rightTrim(postVar1WSAndComment)); - printWithConvertedExpComments(ConverterUtils.rightTrim(postInWSAndComment)); + printWithConvertedExpComments(_ConverterUtils.rightTrim(postVar1WSAndComment)); + printWithConvertedExpComments(_ConverterUtils.rightTrim(postInWSAndComment)); } else { throw new UnexpectedNodeContentException(node, "Expected #list or #foreach as node symbol", null); } @@ -837,7 +837,7 @@ public class FM2ASTToFM3SourceConverter { // We only have removed thing after in the src => no need for spacing after us int commentPos = postNameWSOrComment.indexOf("--") - 1; if (commentPos >= 0) { - printWithConvertedExpComments(ConverterUtils.rightTrim(postNameWSOrComment)); + printWithConvertedExpComments(_ConverterUtils.rightTrim(postNameWSOrComment)); } } @@ -857,7 +857,7 @@ public class FM2ASTToFM3SourceConverter { } else { int commentPos = postParamWSOrComment.indexOf("--") - 1; if (commentPos >= 0) { - printWithConvertedExpComments(ConverterUtils.rightTrim(postParamWSOrComment)); + printWithConvertedExpComments(_ConverterUtils.rightTrim(postParamWSOrComment)); } } } @@ -2410,7 +2410,7 @@ public class FM2ASTToFM3SourceConverter { private int printWSAndExpCommentsIfContainsComment(int pos) throws ConverterException { String sep = readWSAndExpComments(pos); - if (!ConverterUtils.isWhitespaceOnly(sep)) { + if (!_ConverterUtils.isWhitespaceOnly(sep)) { printWithConvertedExpComments(sep); } pos += sep.length(); @@ -2515,7 +2515,7 @@ public class FM2ASTToFM3SourceConverter { raw = false; } char quotationC = c; - if (!ConverterUtils.isQuotationChar(quotationC)) { + if (!_ConverterUtils.isQuotationChar(quotationC)) { throw new IllegalArgumentException("The specifies position is not the beginning of a string literal"); } @@ -2539,7 +2539,7 @@ public class FM2ASTToFM3SourceConverter { return false; } char c = src.charAt(pos); - return (ConverterUtils.isQuotationChar(c) || c == 'r' && pos < src.length() + 1 && ConverterUtils + return (_ConverterUtils.isQuotationChar(c) || c == 'r' && pos < src.length() + 1 && _ConverterUtils .isQuotationChar(src.charAt(pos + 1))); } @@ -2580,7 +2580,7 @@ public class FM2ASTToFM3SourceConverter { } int i = 0; - while (i < s.length() && !ConverterUtils.isUpperCaseLetter(s.charAt(i))) { + while (i < s.length() && !_ConverterUtils.isUpperCaseLetter(s.charAt(i))) { i++; } result = i < s.length(); http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d357910a/freemarker-converter/src/main/java/org/apache/freemarker/converter/ConverterUtils.java ---------------------------------------------------------------------- diff --git a/freemarker-converter/src/main/java/org/apache/freemarker/converter/ConverterUtils.java b/freemarker-converter/src/main/java/org/apache/freemarker/converter/ConverterUtils.java deleted file mode 100644 index c8c9a24..0000000 --- a/freemarker-converter/src/main/java/org/apache/freemarker/converter/ConverterUtils.java +++ /dev/null @@ -1,57 +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.converter; - -/** Don't use this; used internally by FreeMarker, might changes without notice. */ -public final class ConverterUtils { - - private ConverterUtils() { - // - } - - public static boolean isUpperCaseLetter(char c) { - return Character.isUpperCase(c) && Character.isLetter(c); - } - - public static String rightTrim(String s) { - if (s == null) { - return null; - } - - int i = s.length() - 1; - while (i >= 0 && Character.isWhitespace(s.charAt(i))) { - i--; - } - return i != -1 ? s.substring(0, i + 1) : ""; - } - - public static boolean isQuotationChar(char q) { - return q == '\'' || q == '\"'; - } - - public static boolean isWhitespaceOnly(String s) { - for (int i = 0; i < s.length(); i++) { - if (!Character.isWhitespace(s.charAt(i))) { - return false; - } - } - return true; - } -} http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d357910a/freemarker-converter/src/main/java/org/apache/freemarker/converter/_ConverterUtils.java ---------------------------------------------------------------------- diff --git a/freemarker-converter/src/main/java/org/apache/freemarker/converter/_ConverterUtils.java b/freemarker-converter/src/main/java/org/apache/freemarker/converter/_ConverterUtils.java new file mode 100644 index 0000000..f8851c9 --- /dev/null +++ b/freemarker-converter/src/main/java/org/apache/freemarker/converter/_ConverterUtils.java @@ -0,0 +1,57 @@ +/* + * 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.converter; + +/** Don't use this; used internally by FreeMarker, might changes without notice. */ +public final class _ConverterUtils { + + private _ConverterUtils() { + // + } + + public static boolean isUpperCaseLetter(char c) { + return Character.isUpperCase(c) && Character.isLetter(c); + } + + public static String rightTrim(String s) { + if (s == null) { + return null; + } + + int i = s.length() - 1; + while (i >= 0 && Character.isWhitespace(s.charAt(i))) { + i--; + } + return i != -1 ? s.substring(0, i + 1) : ""; + } + + public static boolean isQuotationChar(char q) { + return q == '\'' || q == '\"'; + } + + public static boolean isWhitespaceOnly(String s) { + for (int i = 0; i < s.length(); i++) { + if (!Character.isWhitespace(s.charAt(i))) { + return false; + } + } + return true; + } +}
