freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ddek...@apache.org
Subject [35/54] [partial] incubator-freemarker git commit: Top level package name change to org.apache.freemarker, and some of of the internal package structure changes. Other smaller cleanup. To be continued...
Date Thu, 16 Feb 2017 23:09:00 GMT
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ecb4e230/src/main/java/freemarker/core/NonStringOrTemplateOutputException.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/NonStringOrTemplateOutputException.java b/src/main/java/freemarker/core/NonStringOrTemplateOutputException.java
deleted file mode 100644
index 9368839..0000000
--- a/src/main/java/freemarker/core/NonStringOrTemplateOutputException.java
+++ /dev/null
@@ -1,77 +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 freemarker.core;
-
-import freemarker.template.TemplateModel;
-import freemarker.template.TemplateScalarModel;
-
-/**
- * Indicates that a {@link TemplateScalarModel} (or maybe something that can be automatically coerced
- * to that) or {@link TemplateMarkupOutputModel} value was expected, but the value had a different type.
- */
-public class NonStringOrTemplateOutputException extends UnexpectedTypeException {
-
-    static final String STRING_COERCABLE_TYPES_OR_TOM_DESC
-            = NonStringException.STRING_COERCABLE_TYPES_DESC + ", or \"template output\" ";
-    
-    static final Class[] STRING_COERCABLE_TYPES_AND_TOM;
-    static {
-        STRING_COERCABLE_TYPES_AND_TOM = new Class[NonStringException.STRING_COERCABLE_TYPES.length + 1];
-        int i;
-        for (i = 0; i < NonStringException.STRING_COERCABLE_TYPES.length; i++) {
-            STRING_COERCABLE_TYPES_AND_TOM[i] = NonStringException.STRING_COERCABLE_TYPES[i];
-        }
-        STRING_COERCABLE_TYPES_AND_TOM[i] = TemplateMarkupOutputModel.class;
-    };
-    
-    private static final String DEFAULT_DESCRIPTION
-            = "Expecting " + NonStringOrTemplateOutputException.STRING_COERCABLE_TYPES_OR_TOM_DESC + " value here";
-
-    public NonStringOrTemplateOutputException(Environment env) {
-        super(env, DEFAULT_DESCRIPTION);
-    }
-
-    public NonStringOrTemplateOutputException(String description, Environment env) {
-        super(env, description);
-    }
- 
-    NonStringOrTemplateOutputException(Environment env, _ErrorDescriptionBuilder description) {
-        super(env, description);
-    }
-
-    NonStringOrTemplateOutputException(
-            Expression blamed, TemplateModel model, Environment env)
-            throws InvalidReferenceException {
-        super(blamed, model, NonStringOrTemplateOutputException.STRING_COERCABLE_TYPES_OR_TOM_DESC, STRING_COERCABLE_TYPES_AND_TOM, env);
-    }
-
-    NonStringOrTemplateOutputException(
-            Expression blamed, TemplateModel model, String tip,
-            Environment env)
-            throws InvalidReferenceException {
-        super(blamed, model, NonStringOrTemplateOutputException.STRING_COERCABLE_TYPES_OR_TOM_DESC, STRING_COERCABLE_TYPES_AND_TOM, tip, env);
-    }
-
-    NonStringOrTemplateOutputException(
-            Expression blamed, TemplateModel model, String[] tips, Environment env) throws InvalidReferenceException {
-        super(blamed, model, NonStringOrTemplateOutputException.STRING_COERCABLE_TYPES_OR_TOM_DESC, STRING_COERCABLE_TYPES_AND_TOM, tips, env);
-    }
-        
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ecb4e230/src/main/java/freemarker/core/NonUserDefinedDirectiveLikeException.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/NonUserDefinedDirectiveLikeException.java b/src/main/java/freemarker/core/NonUserDefinedDirectiveLikeException.java
deleted file mode 100644
index ba37df1..0000000
--- a/src/main/java/freemarker/core/NonUserDefinedDirectiveLikeException.java
+++ /dev/null
@@ -1,67 +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 freemarker.core;
-
-import freemarker.template.TemplateDirectiveModel;
-import freemarker.template.TemplateModel;
-import freemarker.template.TemplateTransformModel;
-
-/**
- * Indicates that a {@link TemplateDirectiveModel} or {@link TemplateTransformModel} or {@link Macro} value was
- * expected, but the value had a different type.
- * 
- * @since 2.3.21
- */
-class NonUserDefinedDirectiveLikeException extends UnexpectedTypeException {
-
-    private static final Class[] EXPECTED_TYPES = new Class[] {
-        TemplateDirectiveModel.class, TemplateTransformModel.class, Macro.class };
-    
-    public NonUserDefinedDirectiveLikeException(Environment env) {
-        super(env, "Expecting user-defined directive, transform or macro value here");
-    }
-
-    public NonUserDefinedDirectiveLikeException(String description, Environment env) {
-        super(env, description);
-    }
-
-    NonUserDefinedDirectiveLikeException(Environment env, _ErrorDescriptionBuilder description) {
-        super(env, description);
-    }
-
-    NonUserDefinedDirectiveLikeException(
-            Expression blamed, TemplateModel model, Environment env)
-            throws InvalidReferenceException {
-        super(blamed, model, "user-defined directive, transform or macro", EXPECTED_TYPES, env);
-    }
-
-    NonUserDefinedDirectiveLikeException(
-            Expression blamed, TemplateModel model, String tip,
-            Environment env)
-            throws InvalidReferenceException {
-        super(blamed, model, "user-defined directive, transform or macro", EXPECTED_TYPES, tip, env);
-    }
-
-    NonUserDefinedDirectiveLikeException(
-            Expression blamed, TemplateModel model, String[] tips, Environment env) throws InvalidReferenceException {
-        super(blamed, model, "user-defined directive, transform or macro", EXPECTED_TYPES, tips, env);
-    }    
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ecb4e230/src/main/java/freemarker/core/NotExpression.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/NotExpression.java b/src/main/java/freemarker/core/NotExpression.java
deleted file mode 100644
index 504d997..0000000
--- a/src/main/java/freemarker/core/NotExpression.java
+++ /dev/null
@@ -1,75 +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 freemarker.core;
-
-import freemarker.template.TemplateException;
-
-final class NotExpression extends BooleanExpression {
-
-    private final Expression target;
-
-    NotExpression(Expression target) {
-        this.target = target;
-    }
-
-    @Override
-    boolean evalToBoolean(Environment env) throws TemplateException {
-        return (!target.evalToBoolean(env));
-    }
-
-    @Override
-    public String getCanonicalForm() {
-        return "!" + target.getCanonicalForm();
-    }
- 
-    @Override
-    String getNodeTypeSymbol() {
-        return "!";
-    }
-    
-    @Override
-    boolean isLiteral() {
-        return target.isLiteral();
-    }
-
-    @Override
-    protected Expression deepCloneWithIdentifierReplaced_inner(
-            String replacedIdentifier, Expression replacement, ReplacemenetState replacementState) {
-    	return new NotExpression(
-    	        target.deepCloneWithIdentifierReplaced(replacedIdentifier, replacement, replacementState));
-    }
-
-    @Override
-    int getParameterCount() {
-        return 1;
-    }
-
-    @Override
-    Object getParameterValue(int idx) {
-        if (idx != 0) throw new IndexOutOfBoundsException();
-        return target;
-    }
-
-    @Override
-    ParameterRole getParameterRole(int idx) {
-        if (idx != 0) throw new IndexOutOfBoundsException();
-        return ParameterRole.RIGHT_HAND_OPERAND;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ecb4e230/src/main/java/freemarker/core/NumberLiteral.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/NumberLiteral.java b/src/main/java/freemarker/core/NumberLiteral.java
deleted file mode 100644
index 40b63d5..0000000
--- a/src/main/java/freemarker/core/NumberLiteral.java
+++ /dev/null
@@ -1,93 +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 freemarker.core;
-
-import freemarker.template.SimpleNumber;
-import freemarker.template.TemplateException;
-import freemarker.template.TemplateModel;
-import freemarker.template.TemplateNumberModel;
-
-/**
- * A simple implementation of the <tt>TemplateNumberModel</tt>
- * interface. Note that this class is immutable.
- */
-final class NumberLiteral extends Expression implements TemplateNumberModel {
-
-    private final Number value;
-
-    public NumberLiteral(Number value) {
-        this.value = value;
-    }
-    
-    @Override
-    TemplateModel _eval(Environment env) {
-        return new SimpleNumber(value);
-    }
-
-    @Override
-    public String evalAndCoerceToPlainText(Environment env) throws TemplateException {
-        return env.formatNumberToPlainText(this, this, false);
-    }
-
-    public Number getAsNumber() {
-        return value;
-    }
-    
-    String getName() {
-        return "the number: '" + value + "'";
-    }
-
-    @Override
-    public String getCanonicalForm() {
-        return value.toString();
-    }
-    
-    @Override
-    String getNodeTypeSymbol() {
-        return getCanonicalForm();
-    }
-    
-    @Override
-    boolean isLiteral() {
-        return true;
-    }
-
-    @Override
-    protected Expression deepCloneWithIdentifierReplaced_inner(
-            String replacedIdentifier, Expression replacement, ReplacemenetState replacementState) {
-        return new NumberLiteral(value);
-    }
-    
-    @Override
-    int getParameterCount() {
-        return 0;
-    }
-
-    @Override
-    Object getParameterValue(int idx) {
-        throw new IndexOutOfBoundsException();
-    }
-
-    @Override
-    ParameterRole getParameterRole(int idx) {
-        throw new IndexOutOfBoundsException();
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ecb4e230/src/main/java/freemarker/core/NumericalOutput.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/NumericalOutput.java b/src/main/java/freemarker/core/NumericalOutput.java
deleted file mode 100644
index 3e6e53a..0000000
--- a/src/main/java/freemarker/core/NumericalOutput.java
+++ /dev/null
@@ -1,173 +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 freemarker.core;
-
-import java.io.IOException;
-import java.io.Writer;
-import java.text.NumberFormat;
-import java.util.Locale;
-
-import freemarker.template.TemplateException;
-import freemarker.template.utility.StringUtil;
-
-/**
- * An instruction that outputs the value of a numerical expression.
- */
-final class NumericalOutput extends Interpolation {
-
-    private final Expression expression;
-    private final boolean hasFormat;
-    private final int minFracDigits;
-    private final int maxFracDigits;
-    /** For OutputFormat-based auto-escaping */
-    private final MarkupOutputFormat autoEscapeOutputFormat;
-    private volatile FormatHolder formatCache; // creating new NumberFormat is slow operation
-
-    NumericalOutput(Expression expression, MarkupOutputFormat autoEscapeOutputFormat) {
-        this.expression = expression;
-        hasFormat = false;
-        this.minFracDigits = 0;
-        this.maxFracDigits = 0;
-        this.autoEscapeOutputFormat = autoEscapeOutputFormat;
-    }
-
-    NumericalOutput(Expression expression,
-            int minFracDigits, int maxFracDigits,
-            MarkupOutputFormat autoEscapeOutputFormat) {
-        this.expression = expression;
-        hasFormat = true;
-        this.minFracDigits = minFracDigits;
-        this.maxFracDigits = maxFracDigits;
-        this.autoEscapeOutputFormat = autoEscapeOutputFormat;
-    }
-
-    @Override
-    TemplateElement[] accept(Environment env) throws TemplateException, IOException {
-        String s = calculateInterpolatedStringOrMarkup(env);
-        Writer out = env.getOut();
-        if (autoEscapeOutputFormat != null) {
-            autoEscapeOutputFormat.output(s, out);
-        } else {
-            out.write(s);
-        }
-        return null;
-    }
-
-    @Override
-    protected String calculateInterpolatedStringOrMarkup(Environment env) throws TemplateException {
-        Number num = expression.evalToNumber(env);
-        
-        FormatHolder fmth = formatCache;  // atomic sampling
-        if (fmth == null || !fmth.locale.equals(env.getLocale())) {
-            synchronized (this) {
-                fmth = formatCache;
-                if (fmth == null || !fmth.locale.equals(env.getLocale())) {
-                    NumberFormat fmt = NumberFormat.getNumberInstance(env.getLocale());
-                    if (hasFormat) {
-                        fmt.setMinimumFractionDigits(minFracDigits);
-                        fmt.setMaximumFractionDigits(maxFracDigits);
-                    } else {
-                        fmt.setMinimumFractionDigits(0);
-                        fmt.setMaximumFractionDigits(50);
-                    }
-                    fmt.setGroupingUsed(false);
-                    formatCache = new FormatHolder(fmt, env.getLocale());
-                    fmth = formatCache;
-                }
-            }
-        }
-        // We must use Format even if hasFormat == false.
-        // Some locales may use non-Arabic digits, thus replacing the
-        // decimal separator in the result of toString() is not enough.
-        String s = fmth.format.format(num);
-        return s;
-    }
-
-    @Override
-    protected String dump(boolean canonical, boolean inStringLiteral) {
-        StringBuilder buf = new StringBuilder("#{");
-        final String exprCF = expression.getCanonicalForm();
-        buf.append(inStringLiteral ? StringUtil.FTLStringLiteralEnc(exprCF, '"') : exprCF);
-        if (hasFormat) {
-            buf.append(" ; ");
-            buf.append("m");
-            buf.append(minFracDigits);
-            buf.append("M");
-            buf.append(maxFracDigits);
-        }
-        buf.append("}");
-        return buf.toString();
-    }
-    
-    @Override
-    String getNodeTypeSymbol() {
-        return "#{...}";
-    }
-
-    @Override
-    boolean heedsOpeningWhitespace() {
-        return true;
-    }
-
-    @Override
-    boolean heedsTrailingWhitespace() {
-        return true;
-    }
-    
-    private static class FormatHolder {
-        final NumberFormat format;
-        final Locale locale;
-        
-        FormatHolder(NumberFormat format, Locale locale) {
-            this.format = format;
-            this.locale = locale;
-        }
-    }
-
-    @Override
-    int getParameterCount() {
-        return 3;
-    }
-
-    @Override
-    Object getParameterValue(int idx) {
-        switch (idx) {
-        case 0: return expression;
-        case 1: return Integer.valueOf(minFracDigits);
-        case 2: return Integer.valueOf(maxFracDigits);
-        default: throw new IndexOutOfBoundsException();
-        }
-    }
-
-    @Override
-    ParameterRole getParameterRole(int idx) {
-        switch (idx) {
-        case 0: return ParameterRole.CONTENT;
-        case 1: return ParameterRole.MINIMUM_DECIMALS;
-        case 2: return ParameterRole.MAXIMUM_DECIMALS;
-        default: throw new IndexOutOfBoundsException();
-        }
-    }
-
-    @Override
-    boolean isNestedBlockRepeater() {
-        return false;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ecb4e230/src/main/java/freemarker/core/OptInTemplateClassResolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/OptInTemplateClassResolver.java b/src/main/java/freemarker/core/OptInTemplateClassResolver.java
deleted file mode 100644
index 729c685..0000000
--- a/src/main/java/freemarker/core/OptInTemplateClassResolver.java
+++ /dev/null
@@ -1,158 +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 freemarker.core;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import freemarker.template.Template;
-import freemarker.template.TemplateException;
-import freemarker.template.utility.ClassUtil;
-import freemarker.template.utility.StringUtil;
-
-/**
- * A {@link TemplateClassResolver} that resolves only the classes whose name 
- * was specified in the constructor.
- */
-public class OptInTemplateClassResolver implements TemplateClassResolver {
-    
-    private final Set/*<String>*/ allowedClasses;
-    private final List/*<String>*/ trustedTemplatePrefixes;
-    private final Set/*<String>*/ trustedTemplateNames;
-    
-    /**
-     * Creates a new instance. 
-     *
-     * @param allowedClasses the {@link Set} of {@link String}-s that contains
-     *     the full-qualified names of the allowed classes.
-     *     Can be <code>null</code> (means not class is allowed).
-     * @param trustedTemplates the {@link List} of {@link String}-s that contains
-     *     template names (i.e., template root directory relative paths)
-     *     and prefix patterns (like <code>"include/*"</code>) of templates
-     *     for which {@link TemplateClassResolver#UNRESTRICTED_RESOLVER} will be 
-     *     used (which is not as safe as {@link OptInTemplateClassResolver}).
-     *     The list items need not start with <code>"/"</code> (if they are, it
-     *     will be removed). List items ending with <code>"*"</code> are treated
-     *     as prefixes (i.e. <code>"foo*"</code> matches <code>"foobar"</code>,
-     *     <code>"foo/bar/baaz"</code>, <code>"foowhatever/bar/baaz"</code>,
-     *     etc.). The <code>"*"</code> has no special meaning anywhere else.
-     *     The matched template name is the name (template root directory
-     *     relative path) of the template that directly (lexically) contains the
-     *     operation (like <code>?new</code>) that wants to get the class. Thus,
-     *     if a trusted template includes a non-trusted template, the
-     *     <code>allowedClasses</code> restriction will apply in the included
-     *     template.
-     *     This parameter can be <code>null</code> (means no trusted templates).
-     */
-    public OptInTemplateClassResolver(
-            Set allowedClasses, List trustedTemplates) {
-        this.allowedClasses = allowedClasses != null ? allowedClasses : Collections.EMPTY_SET;
-        if (trustedTemplates != null) {
-            trustedTemplateNames = new HashSet();
-            trustedTemplatePrefixes = new ArrayList();
-            
-            Iterator it = trustedTemplates.iterator();
-            while (it.hasNext()) {
-                String li = (String) it.next();
-                if (li.startsWith("/")) li = li.substring(1);
-                if (li.endsWith("*")) {
-                    trustedTemplatePrefixes.add(li.substring(0, li.length() - 1));
-                } else {
-                    trustedTemplateNames.add(li);
-                }
-            }
-        } else {
-            trustedTemplateNames = Collections.EMPTY_SET;
-            trustedTemplatePrefixes = Collections.EMPTY_LIST;
-        }
-    }
-
-    @Override
-    public Class resolve(String className, Environment env, Template template)
-    throws TemplateException {
-        String templateName = safeGetTemplateName(template);
-        
-        if (templateName != null
-                && (trustedTemplateNames.contains(templateName)
-                        || hasMatchingPrefix(templateName))) {
-            return TemplateClassResolver.UNRESTRICTED_RESOLVER.resolve(className, env, template);
-        } else {
-            if (!allowedClasses.contains(className)) {
-                throw new _MiscTemplateException(env,
-                        "Instantiating ", className, " is not allowed in the template for security reasons. (If you "
-                        + "run into this problem when using ?new in a template, you may want to check the \"",
-                        Configurable.NEW_BUILTIN_CLASS_RESOLVER_KEY,
-                        "\" setting in the FreeMarker configuration.)");
-            } else {
-                try {
-                    return ClassUtil.forName(className);
-                } catch (ClassNotFoundException e) {
-                    throw new _MiscTemplateException(e, env);
-                }
-            }
-        }
-    }
-
-    /**
-     * Extract the template name from the template object which will be matched
-     * against the trusted template names and pattern. 
-     */
-    protected String safeGetTemplateName(Template template) {
-        if (template == null) return null;
-        
-        String name = template.getName();
-        if (name == null) return null;
-
-        // Detect exploits, return null if one is suspected:
-        String decodedName = name;
-        if (decodedName.indexOf('%') != -1) {
-            decodedName = StringUtil.replace(decodedName, "%2e", ".", false, false);
-            decodedName = StringUtil.replace(decodedName, "%2E", ".", false, false);
-            decodedName = StringUtil.replace(decodedName, "%2f", "/", false, false);
-            decodedName = StringUtil.replace(decodedName, "%2F", "/", false, false);
-            decodedName = StringUtil.replace(decodedName, "%5c", "\\", false, false);
-            decodedName = StringUtil.replace(decodedName, "%5C", "\\", false, false);
-        }
-        int dotDotIdx = decodedName.indexOf("..");
-        if (dotDotIdx != -1) {
-            int before = dotDotIdx - 1 >= 0 ? decodedName.charAt(dotDotIdx - 1) : -1;
-            int after = dotDotIdx + 2 < decodedName.length() ? decodedName.charAt(dotDotIdx + 2) : -1;
-            if ((before == -1 || before == '/' || before == '\\')
-                    && (after == -1 || after == '/' || after == '\\')) {
-                return null;
-            }
-        }
-        
-        return name.startsWith("/") ? name.substring(1) : name;
-    }
-
-    private boolean hasMatchingPrefix(String name) {
-        for (int i = 0; i < trustedTemplatePrefixes.size(); i++) {
-            String prefix = (String) trustedTemplatePrefixes.get(i);
-            if (name.startsWith(prefix)) return true;
-        }
-        return false;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ecb4e230/src/main/java/freemarker/core/OrExpression.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/OrExpression.java b/src/main/java/freemarker/core/OrExpression.java
deleted file mode 100644
index 62beafb..0000000
--- a/src/main/java/freemarker/core/OrExpression.java
+++ /dev/null
@@ -1,81 +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 freemarker.core;
-
-import freemarker.template.TemplateException;
-
-final class OrExpression extends BooleanExpression {
-
-    private final Expression lho;
-    private final Expression rho;
-
-    OrExpression(Expression lho, Expression rho) {
-        this.lho = lho;
-        this.rho = rho;
-    }
-
-    @Override
-    boolean evalToBoolean(Environment env) throws TemplateException {
-        return lho.evalToBoolean(env) || rho.evalToBoolean(env);
-    }
-
-    @Override
-    public String getCanonicalForm() {
-        return lho.getCanonicalForm() + " || " + rho.getCanonicalForm();
-    }
-    
-    @Override
-    String getNodeTypeSymbol() {
-        return "||";
-    }
-
-    @Override
-    boolean isLiteral() {
-        return constantValue != null || (lho.isLiteral() && rho.isLiteral());
-    }
-
-    @Override
-    protected Expression deepCloneWithIdentifierReplaced_inner(
-            String replacedIdentifier, Expression replacement, ReplacemenetState replacementState) {
-    	return new OrExpression(
-    	        lho.deepCloneWithIdentifierReplaced(replacedIdentifier, replacement, replacementState),
-    	        rho.deepCloneWithIdentifierReplaced(replacedIdentifier, replacement, replacementState));
-    }
-
-    @Override
-    int getParameterCount() {
-        return 2;
-    }
-
-    @Override
-    Object getParameterValue(int idx) {
-        switch (idx) {
-        case 0: return lho;
-        case 1: return rho;
-        default: throw new IndexOutOfBoundsException();
-        }
-    }
-
-    @Override
-    ParameterRole getParameterRole(int idx) {
-        return ParameterRole.forBinaryOperatorOperand(idx);
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ecb4e230/src/main/java/freemarker/core/OutputFormat.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/OutputFormat.java b/src/main/java/freemarker/core/OutputFormat.java
deleted file mode 100644
index 5f4bc60..0000000
--- a/src/main/java/freemarker/core/OutputFormat.java
+++ /dev/null
@@ -1,84 +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 freemarker.core;
-
-import freemarker.template.Configuration;
-import freemarker.template.utility.ClassUtil;
-import freemarker.template.utility.StringUtil;
-
-/**
- * Represents an output format. If you need auto-escaping, see its subclass, {@link MarkupOutputFormat}. 
- * 
- * @see Configuration#setOutputFormat(OutputFormat)
- * @see Configuration#setRegisteredCustomOutputFormats(java.util.Collection)
- * @see MarkupOutputFormat
- * 
- * @since 2.3.24
- */
-public abstract class OutputFormat {
-
-    /**
-     * The short name used to refer to this format (like in the {@code #ftl} header).
-     */
-    public abstract String getName();
-    
-    /**
-     * Returns the MIME type of the output format. This might comes handy when generating a HTTP response. {@code null}
-     * if this output format doesn't clearly corresponds to a specific MIME type.
-     */
-    public abstract String getMimeType();
-
-    /**
-     * Tells if this output format allows inserting {@link TemplateMarkupOutputModel}-s of another output formats into
-     * it. If {@code true}, the foreign {@link TemplateMarkupOutputModel} will be inserted into the output as is (like
-     * if the surrounding output format was the same). This is usually a bad idea allow, as such an event could indicate
-     * application bugs. If this method returns {@code false} (recommended), then FreeMarker will try to assimilate the
-     * inserted value by converting its format to this format, which will currently (2.3.24) cause exception, unless the
-     * inserted value is made by escaping plain text and the target format is non-escaping, in which case format
-     * conversion is trivially possible. (It's not impossible that conversions will be extended beyond this, if there
-     * will be demand for that.)
-     * 
-     * <p>
-     * {@code true} value is used by {@link UndefinedOutputFormat}.
-     */
-    public abstract boolean isOutputFormatMixingAllowed();
-
-    /**
-     * Returns the short description of this format, to be used in error messages.
-     * Override {@link #toStringExtraProperties()} to customize this.
-     */
-    @Override
-    public final String toString() {
-        String extras = toStringExtraProperties();
-        return getName() + "("
-                + "mimeType=" + StringUtil.jQuote(getMimeType()) + ", "
-                + "class=" + ClassUtil.getShortClassNameOfObject(this, true)
-                + (extras.length() != 0 ? ", " : "") + extras
-                + ")";
-    }
-    
-    /**
-     * Should be like {@code "foo=\"something\", bar=123"}; this will be inserted inside the parentheses in
-     * {@link #toString()}. Shouldn't return {@code null}; should return {@code ""} if there are no extra properties.  
-     */
-    protected String toStringExtraProperties() {
-        return "";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ecb4e230/src/main/java/freemarker/core/OutputFormatBlock.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/OutputFormatBlock.java b/src/main/java/freemarker/core/OutputFormatBlock.java
deleted file mode 100644
index 1b5a746..0000000
--- a/src/main/java/freemarker/core/OutputFormatBlock.java
+++ /dev/null
@@ -1,87 +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 freemarker.core;
-
-import java.io.IOException;
-
-import freemarker.template.TemplateException;
-
-/**
- * An #outputFormat element
- */
-final class OutputFormatBlock extends TemplateElement {
-    
-    private final Expression paramExp;
-
-    OutputFormatBlock(TemplateElements children, Expression paramExp) { 
-        this.paramExp = paramExp; 
-        setChildren(children);
-    }
-
-    @Override
-    TemplateElement[] accept(Environment env) throws TemplateException, IOException {
-        return getChildBuffer();
-    }
-
-    @Override
-    protected String dump(boolean canonical) {
-        if (canonical) {
-            return "<" + getNodeTypeSymbol() + " \"" + paramExp.getCanonicalForm() + "\">"
-                    + getChildrenCanonicalForm() + "</" + getNodeTypeSymbol() + ">";
-        } else {
-            return getNodeTypeSymbol();
-        }
-    }
-    
-    @Override
-    String getNodeTypeSymbol() {
-        return "#outputformat";
-    }
-    
-    @Override
-    int getParameterCount() {
-        return 1;
-    }
-
-    @Override
-    Object getParameterValue(int idx) {
-        if (idx == 0) return paramExp;
-        else
-            throw new IndexOutOfBoundsException();
-    }
-
-    @Override
-    ParameterRole getParameterRole(int idx) {
-        if (idx == 0) return ParameterRole.VALUE;
-        else
-            throw new IndexOutOfBoundsException();
-    }
-
-    @Override
-    boolean isIgnorable(boolean stripWhitespace) {
-        return getChildCount() == 0;
-    }
-
-    @Override
-    boolean isNestedBlockRepeater() {
-        return false;
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ecb4e230/src/main/java/freemarker/core/OutputFormatBoundBuiltIn.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/OutputFormatBoundBuiltIn.java b/src/main/java/freemarker/core/OutputFormatBoundBuiltIn.java
deleted file mode 100644
index 2bcc106..0000000
--- a/src/main/java/freemarker/core/OutputFormatBoundBuiltIn.java
+++ /dev/null
@@ -1,48 +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 freemarker.core;
-
-import freemarker.template.TemplateException;
-import freemarker.template.TemplateModel;
-import freemarker.template.utility.NullArgumentException;
-
-abstract class OutputFormatBoundBuiltIn extends SpecialBuiltIn {
-    
-    protected OutputFormat outputFormat;
-    protected int autoEscapingPolicy;
-    
-    void bindToOutputFormat(OutputFormat outputFormat, int autoEscapingPolicy) {
-        NullArgumentException.check(outputFormat);
-        this.outputFormat = outputFormat;
-        this.autoEscapingPolicy = autoEscapingPolicy;
-    }
-    
-    @Override
-    TemplateModel _eval(Environment env) throws TemplateException {
-        if (outputFormat == null) {
-            // The parser should prevent this situation
-            throw new NullPointerException("outputFormat was null");
-        }
-        return calculateResult(env);
-    }
-
-    protected abstract TemplateModel calculateResult(Environment env)
-            throws TemplateException;
-    
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ecb4e230/src/main/java/freemarker/core/ParameterRole.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/ParameterRole.java b/src/main/java/freemarker/core/ParameterRole.java
deleted file mode 100644
index 1293d5c..0000000
--- a/src/main/java/freemarker/core/ParameterRole.java
+++ /dev/null
@@ -1,93 +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 freemarker.core;
-
-// Change this to an Enum in Java 5
-/**
- * @see TemplateObject#getParameterRole(int)
- */
-final class ParameterRole {
-    
-    private final String name;
-
-    static final ParameterRole UNKNOWN = new ParameterRole("[unknown role]");
-    
-    // When figuring out the names of these, always read them after the possible getName() values. It should sound OK.
-    // Like "`+` left hand operand", or "`#if` parameter". That is, the roles (only) have to make sense in the
-    // context of the possible TemplateObject classes.
-    static final ParameterRole LEFT_HAND_OPERAND = new ParameterRole("left-hand operand"); 
-    static final ParameterRole RIGHT_HAND_OPERAND = new ParameterRole("right-hand operand"); 
-    static final ParameterRole ENCLOSED_OPERAND = new ParameterRole("enclosed operand"); 
-    static final ParameterRole ITEM_VALUE = new ParameterRole("item value"); 
-    static final ParameterRole ITEM_KEY = new ParameterRole("item key");
-    static final ParameterRole ASSIGNMENT_TARGET = new ParameterRole("assignment target");
-    static final ParameterRole ASSIGNMENT_OPERATOR = new ParameterRole("assignment operator");
-    static final ParameterRole ASSIGNMENT_SOURCE = new ParameterRole("assignment source");
-    static final ParameterRole VARIABLE_SCOPE = new ParameterRole("variable scope");
-    static final ParameterRole NAMESPACE = new ParameterRole("namespace");
-    static final ParameterRole ERROR_HANDLER = new ParameterRole("error handler");
-    static final ParameterRole PASSED_VALUE = new ParameterRole("passed value");
-    static final ParameterRole CONDITION = new ParameterRole("condition"); 
-    static final ParameterRole VALUE = new ParameterRole("value");
-    static final ParameterRole AST_NODE_SUBTYPE = new ParameterRole("AST-node subtype");
-    static final ParameterRole PLACEHOLDER_VARIABLE = new ParameterRole("placeholder variable");
-    static final ParameterRole EXPRESSION_TEMPLATE = new ParameterRole("expression template");
-    static final ParameterRole LIST_SOURCE = new ParameterRole("list source");
-    static final ParameterRole TARGET_LOOP_VARIABLE = new ParameterRole("target loop variable");
-    static final ParameterRole TEMPLATE_NAME = new ParameterRole("template name");
-    static final ParameterRole PARSE_PARAMETER = new ParameterRole("\"parse\" parameter");
-    static final ParameterRole ENCODING_PARAMETER = new ParameterRole("\"encoding\" parameter");
-    static final ParameterRole IGNORE_MISSING_PARAMETER = new ParameterRole("\"ignore_missing\" parameter");
-    static final ParameterRole PARAMETER_NAME = new ParameterRole("parameter name");
-    static final ParameterRole PARAMETER_DEFAULT = new ParameterRole("parameter default");
-    static final ParameterRole CATCH_ALL_PARAMETER_NAME = new ParameterRole("catch-all parameter name");
-    static final ParameterRole ARGUMENT_NAME = new ParameterRole("argument name");
-    static final ParameterRole ARGUMENT_VALUE = new ParameterRole("argument value");
-    static final ParameterRole CONTENT = new ParameterRole("content");
-    static final ParameterRole EMBEDDED_TEMPLATE = new ParameterRole("embedded template");
-    static final ParameterRole VALUE_PART = new ParameterRole("value part");
-    static final ParameterRole MINIMUM_DECIMALS = new ParameterRole("minimum decimals");
-    static final ParameterRole MAXIMUM_DECIMALS = new ParameterRole("maximum decimals");
-    static final ParameterRole NODE = new ParameterRole("node");
-    static final ParameterRole CALLEE = new ParameterRole("callee");
-    static final ParameterRole MESSAGE = new ParameterRole("message");
-    
-    private ParameterRole(String name) {
-        this.name = name;
-    }
-    
-    static ParameterRole forBinaryOperatorOperand(int paramIndex) {
-        switch (paramIndex) {
-        case 0: return LEFT_HAND_OPERAND;
-        case 1: return RIGHT_HAND_OPERAND;
-        default: throw new IndexOutOfBoundsException();
-        }
-    }
-    
-    public String getName() {
-        return name;
-    }
-
-    @Override
-    public String toString() {
-        return name;
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ecb4e230/src/main/java/freemarker/core/ParentheticalExpression.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/ParentheticalExpression.java b/src/main/java/freemarker/core/ParentheticalExpression.java
deleted file mode 100644
index 42fb0eb..0000000
--- a/src/main/java/freemarker/core/ParentheticalExpression.java
+++ /dev/null
@@ -1,86 +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 freemarker.core;
-
-import freemarker.template.TemplateException;
-import freemarker.template.TemplateModel;
-
-final class ParentheticalExpression extends Expression {
-
-    private final Expression nested;
-
-    ParentheticalExpression(Expression nested) {
-        this.nested = nested;
-    }
-
-    @Override
-    boolean evalToBoolean(Environment env) throws TemplateException {
-        return nested.evalToBoolean(env);
-    }
-
-    @Override
-    public String getCanonicalForm() {
-        return "(" + nested.getCanonicalForm() + ")";
-    }
-    
-    @Override
-    String getNodeTypeSymbol() {
-        return "(...)";
-    }
-    
-    @Override
-    TemplateModel _eval(Environment env) throws TemplateException {
-        return nested.eval(env);
-    }
-    
-    @Override
-    public boolean isLiteral() {
-        return nested.isLiteral();
-    }
-    
-    Expression getNestedExpression() {
-        return nested;
-    }
-
-    @Override
-    protected Expression deepCloneWithIdentifierReplaced_inner(
-            String replacedIdentifier, Expression replacement, ReplacemenetState replacementState) {
-        return new ParentheticalExpression(
-                nested.deepCloneWithIdentifierReplaced(replacedIdentifier, replacement, replacementState));
-    }
-    
-    @Override
-    int getParameterCount() {
-        return 1;
-    }
-
-    @Override
-    Object getParameterValue(int idx) {
-        if (idx != 0) throw new IndexOutOfBoundsException();
-        return nested;
-    }
-
-    @Override
-    ParameterRole getParameterRole(int idx) {
-        if (idx != 0) throw new IndexOutOfBoundsException();
-        return ParameterRole.ENCLOSED_OPERAND;
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ecb4e230/src/main/java/freemarker/core/ParseException.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/ParseException.java b/src/main/java/freemarker/core/ParseException.java
deleted file mode 100644
index b7cacf8..0000000
--- a/src/main/java/freemarker/core/ParseException.java
+++ /dev/null
@@ -1,560 +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 freemarker.core;
-
-import java.io.IOException;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import freemarker.template.Template;
-import freemarker.template.TemplateException;
-import freemarker.template.utility.SecurityUtilities;
-import freemarker.template.utility.StringUtil;
-
-/**
- * Parsing-time exception in a template (as opposed to a runtime exception, a {@link TemplateException}). This usually
- * signals syntactical/lexical errors.
- * 
- * Note that on JavaCC-level lexical errors throw {@link TokenMgrError} instead of this, however with the API-s that
- * most users use those will be wrapped into {@link ParseException}-s. 
- *
- * This is a modified version of file generated by JavaCC from FTL.jj.
- * You can modify this class to customize the error reporting mechanisms so long as the public interface
- * remains compatible with the original.
- * 
- * @see TokenMgrError
- */
-public class ParseException extends IOException implements FMParserConstants {
-
-    /**
-     * This is the last token that has been consumed successfully.  If
-     * this object has been created due to a parse error, the token
-     * following this token will (therefore) be the first error token.
-     */
-    public Token currentToken;
-
-    private static volatile Boolean jbossToolsMode;
-
-    private boolean messageAndDescriptionRendered;
-    private String message;
-    private String description; 
-
-    public int columnNumber, lineNumber;
-    public int endColumnNumber, endLineNumber;
-
-    /**
-     * Each entry in this array is an array of integers.  Each array
-     * of integers represents a sequence of tokens (by their ordinal
-     * values) that is expected at this point of the parse.
-     */
-    public int[][] expectedTokenSequences;
-
-    /**
-     * This is a reference to the "tokenImage" array of the generated
-     * parser within which the parse error occurred.  This array is
-     * defined in the generated ...Constants interface.
-     */
-    public String[] tokenImage;
-
-    /**
-     * The end of line string for this machine.
-     */
-    protected String eol = SecurityUtilities.getSystemProperty("line.separator", "\n");
-
-    /** @deprecated Will be remove without replacement in 2.4. */
-    @Deprecated
-    protected boolean specialConstructor;  
-
-    private String templateName;
-
-    /**
-     * This constructor is used by the method "generateParseException"
-     * in the generated parser.  Calling this constructor generates
-     * a new object of this type with the fields "currentToken",
-     * "expectedTokenSequences", and "tokenImage" set.
-     * This constructor calls its super class with the empty string
-     * to force the "toString" method of parent class "Throwable" to
-     * print the error message in the form:
-     *     ParseException: &lt;result of getMessage&gt;
-     */
-    public ParseException(Token currentTokenVal,
-            int[][] expectedTokenSequencesVal,
-            String[] tokenImageVal
-            ) {
-        super("");
-        currentToken = currentTokenVal;
-        specialConstructor = true;
-        expectedTokenSequences = expectedTokenSequencesVal;
-        tokenImage = tokenImageVal;
-        lineNumber = currentToken.next.beginLine;
-        columnNumber = currentToken.next.beginColumn;
-        endLineNumber = currentToken.next.endLine;
-        endColumnNumber = currentToken.next.endColumn;
-    }
-
-    /**
-     * The following constructors are for use by you for whatever
-     * purpose you can think of.  Constructing the exception in this
-     * manner makes the exception behave in the normal way - i.e., as
-     * documented in the class "Throwable".  The fields "errorToken",
-     * "expectedTokenSequences", and "tokenImage" do not contain
-     * relevant information.  The JavaCC generated code does not use
-     * these constructors.
-     * 
-     * @deprecated Use a constructor to which you pass description, template, and positions.
-     */
-    @Deprecated
-    protected ParseException() {
-        super();
-    }
-
-    /**
-     * @deprecated Use a constructor to which you can also pass the template, and the end positions.
-     */
-    @Deprecated
-    public ParseException(String description, int lineNumber, int columnNumber) {
-        this(description, (Template) null, lineNumber, columnNumber, null);
-    }
-
-    /**
-     * @since 2.3.21
-     */
-    public ParseException(String description, Template template,
-            int lineNumber, int columnNumber, int endLineNumber, int endColumnNumber) {
-        this(description, template, lineNumber, columnNumber, endLineNumber, endColumnNumber, null);      
-    }
-
-    /**
-     * @since 2.3.21
-     */
-    public ParseException(String description, Template template,
-            int lineNumber, int columnNumber, int endLineNumber, int endColumnNumber,
-            Throwable cause) {
-        this(description,
-                template == null ? null : template.getSourceName(),
-                        lineNumber, columnNumber,
-                        endLineNumber, endColumnNumber,
-                        cause);      
-    }
-    
-    /**
-     * @deprecated Use {@link #ParseException(String, Template, int, int, int, int)} instead, as IDE-s need the end
-     * position of the error too.
-     * @since 2.3.20
-     */
-    @Deprecated
-    public ParseException(String description, Template template, int lineNumber, int columnNumber) {
-        this(description, template, lineNumber, columnNumber, null);      
-    }
-
-    /**
-     * @deprecated Use {@link #ParseException(String, Template, int, int, int, int, Throwable)} instead, as IDE-s need
-     * the end position of the error too.
-     * @since 2.3.20
-     */
-    @Deprecated
-    public ParseException(String description, Template template, int lineNumber, int columnNumber, Throwable cause) {
-        this(description,
-                template == null ? null : template.getSourceName(),
-                        lineNumber, columnNumber,
-                        0, 0,
-                        cause);      
-    }
-
-    /**
-     * @since 2.3.20
-     */
-    public ParseException(String description, Template template, Token tk) {
-        this(description, template, tk, null);
-    }
-
-    /**
-     * @since 2.3.20
-     */
-    public ParseException(String description, Template template, Token tk, Throwable cause) {
-        this(description,
-                template == null ? null : template.getSourceName(),
-                        tk.beginLine, tk.beginColumn,
-                        tk.endLine, tk.endColumn,
-                        cause);
-    }
-
-    /**
-     * @since 2.3.20
-     */
-    public ParseException(String description, TemplateObject tobj) {
-        this(description, tobj, null);
-    }
-
-    /**
-     * @since 2.3.20
-     */
-    public ParseException(String description, TemplateObject tobj, Throwable cause) {
-        this(description,
-                tobj.getTemplate() == null ? null : tobj.getTemplate().getSourceName(),
-                        tobj.beginLine, tobj.beginColumn,
-                        tobj.endLine, tobj.endColumn,
-                        cause);
-    }
-
-    private ParseException(String description, String templateName,
-            int lineNumber, int columnNumber,
-            int endLineNumber, int endColumnNumber,
-            Throwable cause) {
-        super(description);  // but we override getMessage, so it will be different
-        try {
-            this.initCause(cause);
-        } catch (Exception e) {
-            // Suppressed; we can't do more
-        }
-        this.description = description; 
-        this.templateName = templateName;
-        this.lineNumber = lineNumber;
-        this.columnNumber = columnNumber;
-        this.endLineNumber = endLineNumber;
-        this.endColumnNumber = endColumnNumber;
-    }
-
-    /**
-     * Should be used internally only; sets the name of the template that contains the error.
-     * This is needed as the constructor that JavaCC automatically calls doesn't pass in the template, so we
-     * set it somewhere later in an exception handler. 
-     */
-    public void setTemplateName(String templateName) {
-        this.templateName = templateName;
-        synchronized (this) {
-            messageAndDescriptionRendered = false;
-            message = null;
-        }
-    }
-
-    /**
-     * Returns the error location plus the error description.
-     * 
-     * @see #getDescription()
-     * @see #getTemplateName()
-     * @see #getLineNumber()
-     * @see #getColumnNumber()
-     */
-    @Override
-    public String getMessage() {
-        synchronized (this) {
-            if (messageAndDescriptionRendered) return message;
-        }
-        renderMessageAndDescription();
-        synchronized (this) {
-            return message;
-        }
-    }
-
-    private String getDescription() {
-        synchronized (this) {
-            if (messageAndDescriptionRendered) return description;
-        }
-        renderMessageAndDescription();
-        synchronized (this) {
-            return description;
-        }
-    }
-    
-    /**
-     * Returns the description of the error without error location or source quotations, or {@code null} if there's no
-     * description available. This is useful in editors (IDE-s) where the error markers and the editor window itself
-     * already carry this information, so it's redundant the repeat in the error dialog.
-     */
-    public String getEditorMessage() {
-        return getDescription();
-    }
-
-    /**
-     * Returns the name (template-root relative path) of the template whose parsing was failed.
-     * Maybe {@code null} if this is a non-stored template. 
-     * 
-     * @since 2.3.20
-     */
-    public String getTemplateName() {
-        return templateName;
-    }
-
-    /**
-     * 1-based line number of the failing section, or 0 is the information is not available.
-     */
-    public int getLineNumber() {
-        return lineNumber;
-    }
-
-    /**
-     * 1-based column number of the failing section, or 0 is the information is not available.
-     */
-    public int getColumnNumber() {
-        return columnNumber;
-    }
-
-    /**
-     * 1-based line number of the last line that contains the failing section, or 0 if the information is not available.
-     * 
-     * @since 2.3.21
-     */
-    public int getEndLineNumber() {
-        return endLineNumber;
-    }
-
-    /**
-     * 1-based column number of the last character of the failing section, or 0 if the information is not available.
-     * Note that unlike with Java string API-s, this column number is inclusive.
-     * 
-     * @since 2.3.21
-     */
-    public int getEndColumnNumber() {
-        return endColumnNumber;
-    }
-
-    private void renderMessageAndDescription() {
-        String desc = getOrRenderDescription();
-
-        String prefix;
-        if (!isInJBossToolsMode()) {
-            prefix = "Syntax error "
-                    + MessageUtil.formatLocationForSimpleParsingError(templateName, lineNumber, columnNumber)
-                    + ":\n";  
-        } else {
-            prefix = "[col. " + columnNumber + "] ";
-        }
-
-        String msg = prefix + desc;
-        desc = msg.substring(prefix.length());  // so we reuse the backing char[]
-
-        synchronized (this) {
-            message = msg;
-            description = desc;
-            messageAndDescriptionRendered = true;
-        }
-    }
-
-    private boolean isInJBossToolsMode() {
-        if (jbossToolsMode == null) {
-            try {
-                jbossToolsMode = Boolean.valueOf(
-                        ParseException.class.getClassLoader().toString().indexOf(
-                                "[org.jboss.ide.eclipse.freemarker:") != -1);
-            } catch (Throwable e) {
-                jbossToolsMode = Boolean.FALSE;
-            }
-        }
-        return jbossToolsMode.booleanValue();
-    }
-
-    /**
-     * Returns the description of the error without the error location, or {@code null} if there's no description
-     * available.
-     */
-    private String getOrRenderDescription() {
-        synchronized (this) {
-            if (description != null) return description;  // When we already have it from the constructor
-        }
-
-        String tokenErrDesc;
-        if (currentToken != null) {
-            tokenErrDesc = getCustomTokenErrorDescription();
-            if (tokenErrDesc == null) {
-                // The default JavaCC message generation stuff follows.
-                StringBuilder expected = new StringBuilder();
-                int maxSize = 0;
-                for (int i = 0; i < expectedTokenSequences.length; i++) {
-                    if (i != 0) {
-                        expected.append(eol);
-                    }
-                    expected.append("    ");
-                    if (maxSize < expectedTokenSequences[i].length) {
-                        maxSize = expectedTokenSequences[i].length;
-                    }
-                    for (int j = 0; j < expectedTokenSequences[i].length; j++) {
-                        if (j != 0) expected.append(' ');
-                        expected.append(tokenImage[expectedTokenSequences[i][j]]);
-                    }
-                }
-                tokenErrDesc = "Encountered \"";
-                Token tok = currentToken.next;
-                for (int i = 0; i < maxSize; i++) {
-                    if (i != 0) tokenErrDesc += " ";
-                    if (tok.kind == 0) {
-                        tokenErrDesc += tokenImage[0];
-                        break;
-                    }
-                    tokenErrDesc += add_escapes(tok.image);
-                    tok = tok.next;
-                }
-                tokenErrDesc += "\", but ";
-
-                if (expectedTokenSequences.length == 1) {
-                    tokenErrDesc += "was expecting:" + eol;
-                } else {
-                    tokenErrDesc += "was expecting one of:" + eol;
-                }
-                tokenErrDesc += expected;
-            }
-        } else {
-            tokenErrDesc = null;
-        }
-        return tokenErrDesc;
-    }
-
-    private String getCustomTokenErrorDescription() {
-        final Token nextToken = currentToken.next;
-        final int kind = nextToken.kind;
-        if (kind == EOF) {
-            Set/*<String>*/ endNames = new HashSet();
-            for (int i = 0; i < expectedTokenSequences.length; i++) {
-                int[] sequence = expectedTokenSequences[i];
-                for (int j = 0; j < sequence.length; j++) {
-                    switch (sequence[j]) {
-                    case END_FOREACH:
-                        endNames.add( "#foreach");
-                        break;
-                    case END_LIST:
-                        endNames.add( "#list");
-                        break;
-                    case END_SWITCH:
-                        endNames.add( "#switch");
-                        break;
-                    case END_IF:
-                        endNames.add( "#if");
-                        break;
-                    case END_COMPRESS:
-                        endNames.add( "#compress");
-                        break;
-                    case END_MACRO:
-                        endNames.add( "#macro");
-                    case END_FUNCTION:
-                        endNames.add( "#function");
-                        break;
-                    case END_TRANSFORM:
-                        endNames.add( "#transform");
-                        break;
-                    case END_ESCAPE:
-                        endNames.add( "#escape");
-                        break;
-                    case END_NOESCAPE:
-                        endNames.add( "#noescape");
-                        break;
-                    case END_ASSIGN:
-                        endNames.add( "#assign");
-                        break;
-                    case END_LOCAL:
-                        endNames.add( "#local");
-                        break;
-                    case END_GLOBAL:
-                        endNames.add( "#global");
-                        break;
-                    case END_ATTEMPT:
-                        endNames.add( "#attempt");
-                        break;
-                    case CLOSING_CURLY_BRACKET:
-                        endNames.add( "\"{\"");
-                        break;
-                    case CLOSE_BRACKET:
-                        endNames.add( "\"[\"");
-                        break;
-                    case CLOSE_PAREN:
-                        endNames.add( "\"(\"");
-                        break;
-                    case UNIFIED_CALL_END:
-                        endNames.add( "@...");
-                        break;
-                    }
-                }
-            }
-            return "Unexpected end of file reached."
-                    + (endNames.size() == 0 ? "" : " You have an unclosed " + concatWithOrs(endNames) + ".");
-        } else if (kind == ELSE) {
-            return "Unexpected directive, \"#else\". "
-                    + "Check if you have a valid #if-#elseif-#else or #list-#else structure.";
-        } else if (kind == END_IF || kind == ELSE_IF) {
-            return "Unexpected directive, "
-                    + StringUtil.jQuote(nextToken)
-                    + ". Check if you have a valid #if-#elseif-#else structure.";
-        }
-        return null;
-    }
-
-    private String concatWithOrs(Set/*<String>*/ endNames) {
-        StringBuilder sb = new StringBuilder(); 
-        for (Iterator/*<String>*/ it = endNames.iterator(); it.hasNext(); ) {
-            String endName = (String) it.next();
-            if (sb.length() != 0) {
-                sb.append(" or ");
-            }
-            sb.append(endName);
-        }
-        return sb.toString();
-    }
-
-    /**
-     * Used to convert raw characters to their escaped version
-     * when these raw version cannot be used as part of an ASCII
-     * string literal.
-     */
-    protected String add_escapes(String str) {
-        StringBuilder retval = new StringBuilder();
-        char ch;
-        for (int i = 0; i < str.length(); i++) {
-            switch (str.charAt(i))
-            {
-            case 0 :
-                continue;
-            case '\b':
-                retval.append("\\b");
-                continue;
-            case '\t':
-                retval.append("\\t");
-                continue;
-            case '\n':
-                retval.append("\\n");
-                continue;
-            case '\f':
-                retval.append("\\f");
-                continue;
-            case '\r':
-                retval.append("\\r");
-                continue;
-            case '\"':
-                retval.append("\\\"");
-                continue;
-            case '\'':
-                retval.append("\\\'");
-                continue;
-            case '\\':
-                retval.append("\\\\");
-                continue;
-            default:
-                if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
-                    String s = "0000" + Integer.toString(ch, 16);
-                    retval.append("\\u" + s.substring(s.length() - 4, s.length()));
-                } else {
-                    retval.append(ch);
-                }
-                continue;
-            }
-        }
-        return retval.toString();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ecb4e230/src/main/java/freemarker/core/ParserConfiguration.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/ParserConfiguration.java b/src/main/java/freemarker/core/ParserConfiguration.java
deleted file mode 100644
index d9c487b..0000000
--- a/src/main/java/freemarker/core/ParserConfiguration.java
+++ /dev/null
@@ -1,80 +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 freemarker.core;
-
-import freemarker.template.Configuration;
-import freemarker.template.Version;
-
-/**
- * <b>Don't implement this interface yourself</b>; use the existing implementation(s). This interface is implemented by
- * classes that hold settings that affect parsing. New parser settings can be added in new FreeMarker versions, which
- * will break your implementation.
- * 
- * @since 2.3.24
- */
-public interface ParserConfiguration {
-
-    /**
-     * See {@link Configuration#getTagSyntax()}.
-     */
-    int getTagSyntax();
-
-    /**
-     * See {@link Configuration#getNamingConvention()}.
-     */
-    int getNamingConvention();
-
-    /**
-     * See {@link Configuration#getWhitespaceStripping()}.
-     */
-    boolean getWhitespaceStripping();
-
-    /**
-     * Overlaps with {@link Configurable#getArithmeticEngine()}; the parser needs this for creating numerical literals.
-     */
-    ArithmeticEngine getArithmeticEngine();
-    
-    /**
-     * See {@link Configuration#getAutoEscapingPolicy()}.
-     */
-    int getAutoEscapingPolicy();
-    
-    /**
-     * See {@link Configuration#getOutputEncoding()}.
-     */
-    OutputFormat getOutputFormat();
-    
-    /**
-     * See {@link Configuration#getRecognizeStandardFileExtensions()}.
-     */
-    boolean getRecognizeStandardFileExtensions();
-    
-    /**
-     * See {@link Configuration#getIncompatibleImprovements()}.
-     */
-    Version getIncompatibleImprovements();
-    
-    /**
-     * See {@link Configuration#getTabSize()}.
-     * 
-     * @since 2.3.25
-     */
-    int getTabSize();
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ecb4e230/src/main/java/freemarker/core/ParsingNotSupportedException.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/ParsingNotSupportedException.java b/src/main/java/freemarker/core/ParsingNotSupportedException.java
deleted file mode 100644
index 7b6e064..0000000
--- a/src/main/java/freemarker/core/ParsingNotSupportedException.java
+++ /dev/null
@@ -1,37 +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 freemarker.core;
-
-/**
- * Thrown when the {@link TemplateValueFormat} doesn't support parsing, and parsing was invoked.
- * 
- * @since 2.3.24
- */
-public class ParsingNotSupportedException extends TemplateValueFormatException {
-
-    public ParsingNotSupportedException(String message, Throwable cause) {
-        super(message, cause);
-    }
-
-    public ParsingNotSupportedException(String message) {
-        this(message, null);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ecb4e230/src/main/java/freemarker/core/PlainTextOutputFormat.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/PlainTextOutputFormat.java b/src/main/java/freemarker/core/PlainTextOutputFormat.java
deleted file mode 100644
index 82ac31b..0000000
--- a/src/main/java/freemarker/core/PlainTextOutputFormat.java
+++ /dev/null
@@ -1,56 +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 freemarker.core;
-
-/**
- * Represents the plain text output format (MIME type "text/plain", name "plainText"). This format doesn't support
- * escaping. This format doesn't allow mixing in template output values of other output formats.
- * 
- * <p>
- * The main difference from {@link UndefinedOutputFormat} is that this format doesn't allow inserting values of another
- * output format into itself (unless they can be converted to plain text), while {@link UndefinedOutputFormat} would
- * just insert the foreign "markup" as is. Also, this format has {"text/plain"} MIME type, while
- * {@link UndefinedOutputFormat} has {@code null}.
- * 
- * @since 2.3.24
- */
-public final class PlainTextOutputFormat extends OutputFormat {
-
-    public static final PlainTextOutputFormat INSTANCE = new PlainTextOutputFormat();
-    
-    private PlainTextOutputFormat() {
-        // Only to decrease visibility
-    }
-
-    @Override
-    public boolean isOutputFormatMixingAllowed() {
-        return false;
-    }
-
-    @Override
-    public String getName() {
-        return "plainText";
-    }
-
-    @Override
-    public String getMimeType() {
-        return "text/plain";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ecb4e230/src/main/java/freemarker/core/PropertySetting.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/PropertySetting.java b/src/main/java/freemarker/core/PropertySetting.java
deleted file mode 100644
index 858a69a..0000000
--- a/src/main/java/freemarker/core/PropertySetting.java
+++ /dev/null
@@ -1,173 +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 freemarker.core;
-
-import java.util.Arrays;
-
-import freemarker.template.Configuration;
-import freemarker.template.TemplateBooleanModel;
-import freemarker.template.TemplateException;
-import freemarker.template.TemplateModel;
-import freemarker.template.TemplateNumberModel;
-import freemarker.template.TemplateScalarModel;
-import freemarker.template._TemplateAPI;
-import freemarker.template.utility.StringUtil;
-
-/**
- * An instruction that sets a property of the template rendering
- * environment.
- */
-final class PropertySetting extends TemplateElement {
-
-    private final String key;
-    private final Expression value;
-    
-    static final String[] SETTING_NAMES = new String[] {
-            // Must be sorted alphabetically!
-            Configurable.BOOLEAN_FORMAT_KEY_CAMEL_CASE,
-            Configurable.BOOLEAN_FORMAT_KEY_SNAKE_CASE,
-            Configurable.DATE_FORMAT_KEY_CAMEL_CASE,
-            Configurable.DATE_FORMAT_KEY_SNAKE_CASE,
-            Configurable.DATETIME_FORMAT_KEY_CAMEL_CASE,
-            Configurable.DATETIME_FORMAT_KEY_SNAKE_CASE,
-            Configurable.LOCALE_KEY,
-            Configurable.NUMBER_FORMAT_KEY_CAMEL_CASE,
-            Configurable.NUMBER_FORMAT_KEY_SNAKE_CASE,
-            Configurable.OUTPUT_ENCODING_KEY_CAMEL_CASE,
-            Configurable.OUTPUT_ENCODING_KEY_SNAKE_CASE,
-            Configurable.SQL_DATE_AND_TIME_TIME_ZONE_KEY_CAMEL_CASE,
-            Configurable.SQL_DATE_AND_TIME_TIME_ZONE_KEY,
-            Configurable.TIME_FORMAT_KEY_CAMEL_CASE,
-            Configurable.TIME_ZONE_KEY_CAMEL_CASE,
-            Configurable.TIME_FORMAT_KEY_SNAKE_CASE,
-            Configurable.TIME_ZONE_KEY_SNAKE_CASE,
-            Configurable.URL_ESCAPING_CHARSET_KEY_CAMEL_CASE,
-            Configurable.URL_ESCAPING_CHARSET_KEY_SNAKE_CASE
-    };
-
-    PropertySetting(Token keyTk, FMParserTokenManager tokenManager, Expression value, Configuration cfg)
-            throws ParseException {
-        String key = keyTk.image;
-        if (Arrays.binarySearch(SETTING_NAMES, key) < 0) {
-            StringBuilder sb = new StringBuilder();
-            if (_TemplateAPI.getConfigurationSettingNames(cfg, true).contains(key)
-                    || _TemplateAPI.getConfigurationSettingNames(cfg, false).contains(key)) {
-                sb.append("The setting name is recognized, but changing this setting from inside a template isn't "
-                        + "supported.");                
-            } else {
-                sb.append("Unknown setting name: ");
-                sb.append(StringUtil.jQuote(key)).append(".");
-                sb.append(" The allowed setting names are: ");
-
-                int shownNamingConvention;
-                {
-                    int namingConvention = tokenManager.namingConvention;
-                    shownNamingConvention = namingConvention != Configuration.AUTO_DETECT_NAMING_CONVENTION
-                            ? namingConvention : Configuration.LEGACY_NAMING_CONVENTION /* [2.4] CAMEL_CASE */; 
-                }
-                
-                boolean first = true;
-                for (int i = 0; i < SETTING_NAMES.length; i++) {
-                    String correctName = SETTING_NAMES[i];
-                    int correctNameNamingConvetion = _CoreStringUtils.getIdentifierNamingConvention(correctName);
-                    if (shownNamingConvention == Configuration.CAMEL_CASE_NAMING_CONVENTION 
-                            ? correctNameNamingConvetion != Configuration.LEGACY_NAMING_CONVENTION
-                            : correctNameNamingConvetion != Configuration.CAMEL_CASE_NAMING_CONVENTION) {
-                        if (first) {
-                            first = false;
-                        } else {
-                            sb.append(", ");
-                        }
-                    
-                        sb.append(SETTING_NAMES[i]);
-                    }
-                }
-            }
-            throw new ParseException(sb.toString(), null, keyTk);
-        }
-        
-        this.key = key;
-        this.value = value;
-    }
-
-    @Override
-    TemplateElement[] accept(Environment env) throws TemplateException {
-        TemplateModel mval = value.eval(env);
-        String strval;
-        if (mval instanceof TemplateScalarModel) {
-            strval = ((TemplateScalarModel) mval).getAsString();
-        } else if (mval instanceof TemplateBooleanModel) {
-            strval = ((TemplateBooleanModel) mval).getAsBoolean() ? "true" : "false";
-        } else if (mval instanceof TemplateNumberModel) {
-            strval = ((TemplateNumberModel) mval).getAsNumber().toString();
-        } else {
-            strval = value.evalAndCoerceToStringOrUnsupportedMarkup(env);
-        }
-        env.setSetting(key, strval);
-        return null;
-    }
-    
-    @Override
-    protected String dump(boolean canonical) {
-        StringBuilder sb = new StringBuilder();
-        if (canonical) sb.append('<');
-        sb.append(getNodeTypeSymbol());
-        sb.append(' ');
-        sb.append(_CoreStringUtils.toFTLTopLevelTragetIdentifier(key));
-        sb.append('=');
-        sb.append(value.getCanonicalForm());
-        if (canonical) sb.append("/>");
-        return sb.toString();
-    }
-    
-    @Override
-    String getNodeTypeSymbol() {
-        return "#setting";
-    }
-
-    @Override
-    int getParameterCount() {
-        return 2;
-    }
-
-    @Override
-    Object getParameterValue(int idx) {
-        switch (idx) {
-        case 0: return key;
-        case 1: return value;
-        default: throw new IndexOutOfBoundsException();
-        }
-    }
-
-    @Override
-    ParameterRole getParameterRole(int idx) {
-        switch (idx) {
-        case 0: return ParameterRole.ITEM_KEY;
-        case 1: return ParameterRole.ITEM_VALUE;
-        default: throw new IndexOutOfBoundsException();
-        }
-    }
-
-    @Override
-    boolean isNestedBlockRepeater() {
-        return false;
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ecb4e230/src/main/java/freemarker/core/RTFOutputFormat.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/RTFOutputFormat.java b/src/main/java/freemarker/core/RTFOutputFormat.java
deleted file mode 100644
index 9aef2a7..0000000
--- a/src/main/java/freemarker/core/RTFOutputFormat.java
+++ /dev/null
@@ -1,75 +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 freemarker.core;
-
-import java.io.IOException;
-import java.io.Writer;
-
-import freemarker.template.TemplateModelException;
-import freemarker.template.utility.StringUtil;
-
-/**
- * Represents the Rich Text Format output format (MIME type "application/rtf", name "RTF"). This format escapes by
- * default (via {@link StringUtil#RTFEnc(String)}). The {@code ?rtf} built-in silently bypasses template output values
- * of the type produced by this output format ({@link TemplateRTFOutputModel}).
- * 
- * @since 2.3.24
- */
-public final class RTFOutputFormat extends CommonMarkupOutputFormat<TemplateRTFOutputModel> {
-
-    /**
-     * The only instance (singleton) of this {@link OutputFormat}.
-     */
-    public static final RTFOutputFormat INSTANCE = new RTFOutputFormat();
-    
-    private RTFOutputFormat() {
-        // Only to decrease visibility
-    }
-    
-    @Override
-    public String getName() {
-        return "RTF";
-    }
-
-    @Override
-    public String getMimeType() {
-        return "application/rtf";
-    }
-
-    @Override
-    public void output(String textToEsc, Writer out) throws IOException, TemplateModelException {
-        StringUtil.RTFEnc(textToEsc, out);
-    }
-
-    @Override
-    public String escapePlainText(String plainTextContent) {
-        return StringUtil.RTFEnc(plainTextContent);
-    }
-
-    @Override
-    public boolean isLegacyBuiltInBypassed(String builtInName) {
-        return builtInName.equals("rtf");
-    }
-
-    @Override
-    protected TemplateRTFOutputModel newTemplateMarkupOutputModel(String plainTextContent, String markupContent) {
-        return new TemplateRTFOutputModel(plainTextContent, markupContent);
-    }
-
-}


Mime
View raw message