Added support for new provisional range operator to parallel the 'Object Array' operator.

Syntax in VTL :
  [n..m]
where
  n = integer | reference
  m = integer | reference

will produce object array containing the integers n .. m

Can be used in two places :

  #set($foo = [1..3])
or
  #foreach($i in [$a..3])


PR:
Obtained from:
Submitted by:
Reviewed by:


git-svn-id: https://svn.apache.org/repos/asf/jakarta/velocity/trunk@74053 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/java/org/apache/velocity/runtime/parser/Parser.jjt b/src/java/org/apache/velocity/runtime/parser/Parser.jjt
index 2d8f3a7..652d745 100644
--- a/src/java/org/apache/velocity/runtime/parser/Parser.jjt
+++ b/src/java/org/apache/velocity/runtime/parser/Parser.jjt
@@ -120,7 +120,7 @@
  *
  * @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
  * @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
- * @version $Id: Parser.jjt,v 1.49 2000/12/27 23:48:41 geirm Exp $ 
+ * @version $Id: Parser.jjt,v 1.50 2000/12/28 16:21:17 geirm Exp $ 
 */
 public class Parser
 {
@@ -443,6 +443,7 @@
 { 
     <LBRACKET: "[">
 |   <RBRACKET: "]">
+|   <COMMA:",">
 }
 
 <DIRECTIVE>
@@ -451,11 +452,6 @@
   <DOUBLEDOT : ".." >
 }
 
-<DIRECTIVE,REFMOD2>
-TOKEN:
-{
-    <COMMA:",">
-}
 
 <DIRECTIVE,REFMODIFIER>
 TOKEN:
@@ -1070,6 +1066,7 @@
 |   Word()  
 |   StringLiteral()
 |   NumberLiteral()
+|   LOOKAHEAD(4) IntegerRange()
 |   ObjectArray()
 |   True()
 |   False()
@@ -1183,6 +1180,21 @@
 }
 
 /**
+ *  supports the [n..m] vector generator for use in
+ *  the #foreach() to generate measured ranges w/o 
+ *  needing explicit support from the app/servlet
+ */
+void IntegerRange() : {}
+{
+    <LBRACKET> [<WHITESPACE>] 
+    ( Reference() | NumberLiteral()) 
+    [<WHITESPACE>] <DOUBLEDOT> [<WHITESPACE>] 
+    (Reference() | NumberLiteral()) 
+    [<WHITESPACE>] <RBRACKET>
+}
+
+
+/**
  * This method has yet to be fully implemented
  * but will allow arbitrarily nested method
  * calls
@@ -1382,6 +1394,7 @@
     StringLiteral()
   | NumberLiteral()    
   | Reference()
+  | LOOKAHEAD(4) IntegerRange()
   | ObjectArray()
   | True()
   | False()