diff options
-rw-r--r-- | src/changes/changes.xml | 2 | ||||
-rw-r--r-- | velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeConstants.java | 4 | ||||
-rw-r--r-- | velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java | 12 | ||||
-rw-r--r-- | velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeServices.java | 4 | ||||
-rw-r--r-- | velocity-engine-core/src/main/parser/Parser.jjt | 4 | ||||
-rw-r--r-- | velocity-engine-core/src/main/resources/org/apache/velocity/runtime/defaults/velocity.properties | 4 | ||||
-rw-r--r-- | velocity-engine-core/src/test/java/org/apache/velocity/test/HyphenInIdentifiersTestCase.java (renamed from velocity-engine-core/src/test/java/org/apache/velocity/test/DashInIdentifiersTestCase.java) | 8 |
7 files changed, 19 insertions, 19 deletions
diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 9b8c21c9..63757bf2 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -60,7 +60,7 @@ Fix parser regression in #macro whitespaces handling </action> <action type="add" dev="cbrisson" issue="VELOCITY-542"> - Added a new 'parser.allows.dash.in.identifiers' boolean property (false per default) to (dis)allow '-' in reference identifiers + Added a new 'parser.allow_hypen_in_identifiers' boolean property (false per default) to (dis)allow '-' in reference identifiers </action> <action type="fix" dev="cbrisson" issue="VELOCITY-896"> Fix parsing of a terminal hash or dollar sign in sing litteral and template diff --git a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeConstants.java b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeConstants.java index 3ffa3362..b5d3c0f3 100644 --- a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeConstants.java +++ b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeConstants.java @@ -305,10 +305,10 @@ public interface RuntimeConstants String PARSER_POOL_SIZE = "parser.pool.size"; /** - * Allow dash in identifiers (backward compatibility option) + * Allow hyphen in identifiers (backward compatibility option) * @since 2.1 */ - String PARSER_DASH_ALLOWED = "parser.allows.dash.in.identifiers"; + String PARSER_HYPHEN_ALLOWED = "parser.allow_hyphen_in_identifiers"; /** * Space gobbling mode diff --git a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java index 0a368ac4..180128f5 100644 --- a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java +++ b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java @@ -200,9 +200,9 @@ public class RuntimeInstance implements RuntimeConstants, RuntimeServices private SpaceGobbling spaceGobbling; /** - * Whether dash is allowed in identifiers + * Whether hyphen is allowed in identifiers */ - private boolean dashAllowedInIdentifiers; + private boolean hyphenAllowedInIdentifiers; /** * Creates a new RuntimeInstance object. @@ -360,7 +360,7 @@ public class RuntimeInstance implements RuntimeConstants, RuntimeServices } /* init parser behavior */ - dashAllowedInIdentifiers = getBoolean(PARSER_DASH_ALLOWED, false); + hyphenAllowedInIdentifiers = getBoolean(PARSER_HYPHEN_ALLOWED, false); } /** @@ -1849,11 +1849,11 @@ public class RuntimeInstance implements RuntimeConstants, RuntimeServices } /** - * get whether dashes are allowed in identifiers + * get whether hyphens are allowed in identifiers * @return configured boolean flag */ - public boolean isDashAllowedInIdentifiers() + public boolean isHyphenAllowedInIdentifiers() { - return dashAllowedInIdentifiers; + return hyphenAllowedInIdentifiers; } } diff --git a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeServices.java b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeServices.java index 7c317321..0f813220 100644 --- a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeServices.java +++ b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeServices.java @@ -469,8 +469,8 @@ public interface RuntimeServices SpaceGobbling getSpaceGobbling(); /** - * get whether dashes are allowed in identifiers + * get whether hyphens are allowed in identifiers * @return configured boolean flag */ - boolean isDashAllowedInIdentifiers(); + boolean isHyphenAllowedInIdentifiers(); } diff --git a/velocity-engine-core/src/main/parser/Parser.jjt b/velocity-engine-core/src/main/parser/Parser.jjt index cd6cc764..720643d9 100644 --- a/velocity-engine-core/src/main/parser/Parser.jjt +++ b/velocity-engine-core/src/main/parser/Parser.jjt @@ -896,7 +896,7 @@ MORE : stateStackPop(); } - int preReferenceState = parser.getRuntimeServices().isDashAllowedInIdentifiers() ? PRE_OLD_REFERENCE : PRE_REFERENCE; + int preReferenceState = parser.getRuntimeServices().isHyphenAllowedInIdentifiers() ? PRE_OLD_REFERENCE : PRE_REFERENCE; trace( " $ : going to " + lexStateNames[preReferenceState]); @@ -923,7 +923,7 @@ MORE : stateStackPop(); } - int preReferenceState = parser.getRuntimeServices().isDashAllowedInIdentifiers() ? PRE_OLD_REFERENCE : PRE_REFERENCE; + int preReferenceState = parser.getRuntimeServices().isHyphenAllowedInIdentifiers() ? PRE_OLD_REFERENCE : PRE_REFERENCE; trace( " $ : going to " + lexStateNames[preReferenceState]); diff --git a/velocity-engine-core/src/main/resources/org/apache/velocity/runtime/defaults/velocity.properties b/velocity-engine-core/src/main/resources/org/apache/velocity/runtime/defaults/velocity.properties index b29d7e66..b3b61a6e 100644 --- a/velocity-engine-core/src/main/resources/org/apache/velocity/runtime/defaults/velocity.properties +++ b/velocity-engine-core/src/main/resources/org/apache/velocity/runtime/defaults/velocity.properties @@ -250,9 +250,9 @@ introspector.restrict.classes = java.lang.ThreadLocal space.gobbling = lines # ---------------------------------------------------------------------------- -# DASH IN IDENTIFIERS +# HYPHEN IN IDENTIFIERS # ---------------------------------------------------------------------------- # Set to true to allow '-' in reference identifiers (backward compatibility option) # ---------------------------------------------------------------------------- -parser.allows.dash.in.identifiers = false +parser.allow_hyphen_in_identifiers = false diff --git a/velocity-engine-core/src/test/java/org/apache/velocity/test/DashInIdentifiersTestCase.java b/velocity-engine-core/src/test/java/org/apache/velocity/test/HyphenInIdentifiersTestCase.java index 42d0fcbc..4ab2b8b2 100644 --- a/velocity-engine-core/src/test/java/org/apache/velocity/test/DashInIdentifiersTestCase.java +++ b/velocity-engine-core/src/test/java/org/apache/velocity/test/HyphenInIdentifiersTestCase.java @@ -26,19 +26,19 @@ import org.apache.velocity.app.VelocityEngine; * This class tests passing expressions as method arguments */ -public class DashInIdentifiersTestCase extends BaseTestCase +public class HyphenInIdentifiersTestCase extends BaseTestCase { - public DashInIdentifiersTestCase(final String name) + public HyphenInIdentifiersTestCase(final String name) { super(name); } protected void setUpEngine(VelocityEngine engine) { - engine.addProperty("parser.allows.dash.in.identifiers", true); + engine.addProperty("parser.allow_hyphen_in_identifiers", true); } - public void testDash() + public void testHyphen() { assertEvalEquals("6","#set($var-1 = 7)#set($var-2 = $var-1 - 1)$var-2"); } |