velocity-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cbris...@apache.org
Subject svn commit: r1854737 - in /velocity/engine/trunk: src/changes/ velocity-engine-core/src/main/java/org/apache/velocity/runtime/ velocity-engine-core/src/main/parser/ velocity-engine-core/src/main/resources/org/apache/velocity/runtime/defaults/ velocity-...
Date Sun, 03 Mar 2019 17:47:33 GMT
Author: cbrisson
Date: Sun Mar  3 17:47:32 2019
New Revision: 1854737

URL: http://svn.apache.org/viewvc?rev=1854737&view=rev
Log:
[engine] Don't mix hyphens with dashes ; use '_' for word separator in corresponding property
name

Added:
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/HyphenInIdentifiersTestCase.java
      - copied, changed from r1854736, velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/DashInIdentifiersTestCase.java
Removed:
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/DashInIdentifiersTestCase.java
Modified:
    velocity/engine/trunk/src/changes/changes.xml
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeConstants.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeServices.java
    velocity/engine/trunk/velocity-engine-core/src/main/parser/Parser.jjt
    velocity/engine/trunk/velocity-engine-core/src/main/resources/org/apache/velocity/runtime/defaults/velocity.properties

Modified: velocity/engine/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/changes/changes.xml?rev=1854737&r1=1854736&r2=1854737&view=diff
==============================================================================
--- velocity/engine/trunk/src/changes/changes.xml (original)
+++ velocity/engine/trunk/src/changes/changes.xml Sun Mar  3 17:47:32 2019
@@ -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

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeConstants.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeConstants.java?rev=1854737&r1=1854736&r2=1854737&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeConstants.java
(original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeConstants.java
Sun Mar  3 17:47:32 2019
@@ -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

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java?rev=1854737&r1=1854736&r2=1854737&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java
(original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java
Sun Mar  3 17:47:32 2019
@@ -200,9 +200,9 @@ public class RuntimeInstance implements
     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
         }
 
         /* init parser behavior */
-        dashAllowedInIdentifiers = getBoolean(PARSER_DASH_ALLOWED, false);
+        hyphenAllowedInIdentifiers = getBoolean(PARSER_HYPHEN_ALLOWED, false);
     }
 
     /**
@@ -1849,11 +1849,11 @@ public class RuntimeInstance implements
     }
 
     /**
-     * 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;
     }
 }

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeServices.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeServices.java?rev=1854737&r1=1854736&r2=1854737&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeServices.java
(original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeServices.java
Sun Mar  3 17:47:32 2019
@@ -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();
 }

Modified: velocity/engine/trunk/velocity-engine-core/src/main/parser/Parser.jjt
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/parser/Parser.jjt?rev=1854737&r1=1854736&r2=1854737&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/parser/Parser.jjt (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/parser/Parser.jjt Sun Mar  3 17:47:32
2019
@@ -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]);
 

Modified: velocity/engine/trunk/velocity-engine-core/src/main/resources/org/apache/velocity/runtime/defaults/velocity.properties
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/resources/org/apache/velocity/runtime/defaults/velocity.properties?rev=1854737&r1=1854736&r2=1854737&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/resources/org/apache/velocity/runtime/defaults/velocity.properties
(original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/resources/org/apache/velocity/runtime/defaults/velocity.properties
Sun Mar  3 17:47:32 2019
@@ -250,9 +250,9 @@ introspector.restrict.classes = java.lan
 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

Copied: velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/HyphenInIdentifiersTestCase.java
(from r1854736, velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/DashInIdentifiersTestCase.java)
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/HyphenInIdentifiersTestCase.java?p2=velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/HyphenInIdentifiersTestCase.java&p1=velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/DashInIdentifiersTestCase.java&r1=1854736&r2=1854737&rev=1854737&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/DashInIdentifiersTestCase.java
(original)
+++ velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/HyphenInIdentifiersTestCase.java
Sun Mar  3 17:47:32 2019
@@ -26,19 +26,19 @@ import org.apache.velocity.app.VelocityE
  * 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");
     }



Mime
View raw message