velocity-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nbu...@apache.org
Subject svn commit: r736681 [1/3] - in /velocity/engine/trunk/src: changes/ java/org/apache/velocity/runtime/parser/ parser/ test/org/apache/velocity/test/
Date Thu, 22 Jan 2009 15:49:13 GMT
Author: nbubna
Date: Thu Jan 22 07:49:12 2009
New Revision: 736681

URL: http://svn.apache.org/viewvc?rev=736681&view=rev
Log:
VELOCITY-676 fix StringIndexOutOfBoundsException from #[[##x]]# (thx to Jarkko Viinamaki)

Modified:
    velocity/engine/trunk/src/changes/changes.xml
    velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/Parser.java
    velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/ParserConstants.java
    velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/ParserTokenManager.java
    velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/ParserTreeConstants.java
    velocity/engine/trunk/src/parser/Parser.jjt
    velocity/engine/trunk/src/test/org/apache/velocity/test/IndexTestCase.java
    velocity/engine/trunk/src/test/org/apache/velocity/test/TextblockTestCase.java

Modified: velocity/engine/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/changes/changes.xml?rev=736681&r1=736680&r2=736681&view=diff
==============================================================================
--- velocity/engine/trunk/src/changes/changes.xml (original)
+++ velocity/engine/trunk/src/changes/changes.xml Thu Jan 22 07:49:12 2009
@@ -27,6 +27,11 @@
   <body>
     <release version="1.7" date="In Subversion">
 
+      <action type="fix" dev="nbubna" issue="VELOCITY-676" due-to="Jarkko Viinamäki">
+        Fix StringIndexOutOfBoundsException caused by #[[##x]]# (line comment on
+        same line as end of textblock).
+      </action>
+
       <action type="fix" dev="nbubna" issue="VELOCITY-675" due-to="Jarkko Viinamäki">
         Fix NPE caused by #@foo (w/o #end) in template.
       </action>

Modified: velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/Parser.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/Parser.java?rev=736681&r1=736680&r2=736681&view=diff
==============================================================================
--- velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/Parser.java (original)
+++ velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/Parser.java Thu Jan
22 07:49:12 2009
@@ -44,7 +44,7 @@
     public String currentTemplateName = "";
 
     /**
-     * Set to true if the property 
+     * Set to true if the property
      * RuntimeConstants.RUNTIME_REFERENCES_STRICT_ESCAPE is set to true
      */
     public boolean strictEscape = false;
@@ -2701,268 +2701,91 @@
     }
   }
 
-  final private boolean jj_2_1(int xla) {
+  private boolean jj_2_1(int xla) {
     jj_la = xla; jj_lastpos = jj_scanpos = token;
     try { return !jj_3_1(); }
     catch(LookaheadSuccess ls) { return true; }
     finally { jj_save(0, xla); }
   }
 
-  final private boolean jj_2_2(int xla) {
+  private boolean jj_2_2(int xla) {
     jj_la = xla; jj_lastpos = jj_scanpos = token;
     try { return !jj_3_2(); }
     catch(LookaheadSuccess ls) { return true; }
     finally { jj_save(1, xla); }
   }
 
-  final private boolean jj_2_3(int xla) {
+  private boolean jj_2_3(int xla) {
     jj_la = xla; jj_lastpos = jj_scanpos = token;
     try { return !jj_3_3(); }
     catch(LookaheadSuccess ls) { return true; }
     finally { jj_save(2, xla); }
   }
 
-  final private boolean jj_2_4(int xla) {
+  private boolean jj_2_4(int xla) {
     jj_la = xla; jj_lastpos = jj_scanpos = token;
     try { return !jj_3_4(); }
     catch(LookaheadSuccess ls) { return true; }
     finally { jj_save(3, xla); }
   }
 
-  final private boolean jj_2_5(int xla) {
+  private boolean jj_2_5(int xla) {
     jj_la = xla; jj_lastpos = jj_scanpos = token;
     try { return !jj_3_5(); }
     catch(LookaheadSuccess ls) { return true; }
     finally { jj_save(4, xla); }
   }
 
-  final private boolean jj_2_6(int xla) {
+  private boolean jj_2_6(int xla) {
     jj_la = xla; jj_lastpos = jj_scanpos = token;
     try { return !jj_3_6(); }
     catch(LookaheadSuccess ls) { return true; }
     finally { jj_save(5, xla); }
   }
 
-  final private boolean jj_2_7(int xla) {
+  private boolean jj_2_7(int xla) {
     jj_la = xla; jj_lastpos = jj_scanpos = token;
     try { return !jj_3_7(); }
     catch(LookaheadSuccess ls) { return true; }
     finally { jj_save(6, xla); }
   }
 
-  final private boolean jj_2_8(int xla) {
+  private boolean jj_2_8(int xla) {
     jj_la = xla; jj_lastpos = jj_scanpos = token;
     try { return !jj_3_8(); }
     catch(LookaheadSuccess ls) { return true; }
     finally { jj_save(7, xla); }
   }
 
-  final private boolean jj_2_9(int xla) {
+  private boolean jj_2_9(int xla) {
     jj_la = xla; jj_lastpos = jj_scanpos = token;
     try { return !jj_3_9(); }
     catch(LookaheadSuccess ls) { return true; }
     finally { jj_save(8, xla); }
   }
 
-  final private boolean jj_2_10(int xla) {
+  private boolean jj_2_10(int xla) {
     jj_la = xla; jj_lastpos = jj_scanpos = token;
     try { return !jj_3_10(); }
     catch(LookaheadSuccess ls) { return true; }
     finally { jj_save(9, xla); }
   }
 
-  final private boolean jj_2_11(int xla) {
+  private boolean jj_2_11(int xla) {
     jj_la = xla; jj_lastpos = jj_scanpos = token;
     try { return !jj_3_11(); }
     catch(LookaheadSuccess ls) { return true; }
     finally { jj_save(10, xla); }
   }
 
-  final private boolean jj_2_12(int xla) {
+  private boolean jj_2_12(int xla) {
     jj_la = xla; jj_lastpos = jj_scanpos = token;
     try { return !jj_3_12(); }
     catch(LookaheadSuccess ls) { return true; }
     finally { jj_save(11, xla); }
   }
 
-  final private boolean jj_3R_84() {
-    if (jj_3R_68()) return true;
-    return false;
-  }
-
-  final private boolean jj_3R_83() {
-    if (jj_3R_67()) return true;
-    return false;
-  }
-
-  final private boolean jj_3R_82() {
-    if (jj_3R_66()) return true;
-    return false;
-  }
-
-  final private boolean jj_3R_65() {
-    if (jj_scan_token(STRING_LITERAL)) return true;
-    return false;
-  }
-
-  final private boolean jj_3R_81() {
-    if (jj_3R_40()) return true;
-    return false;
-  }
-
-  final private boolean jj_3_7() {
-    if (jj_scan_token(DOT)) return true;
-    Token xsp;
-    xsp = jj_scanpos;
-    if (jj_3_8()) {
-    jj_scanpos = xsp;
-    if (jj_3R_32()) return true;
-    }
-    while (true) {
-      xsp = jj_scanpos;
-      if (jj_3R_89()) { jj_scanpos = xsp; break; }
-    }
-    return false;
-  }
-
-  final private boolean jj_3R_61() {
-    if (jj_3R_29()) return true;
-    Token xsp;
-    while (true) {
-      xsp = jj_scanpos;
-      if (jj_3R_97()) { jj_scanpos = xsp; break; }
-    }
-    return false;
-  }
-
-  final private boolean jj_3R_80() {
-    if (jj_3R_24()) return true;
-    return false;
-  }
-
-  final private boolean jj_3R_39() {
-    if (jj_scan_token(LCURLY)) return true;
-    if (jj_scan_token(IDENTIFIER)) return true;
-    Token xsp;
-    while (true) {
-      xsp = jj_scanpos;
-      if (jj_3R_74()) { jj_scanpos = xsp; break; }
-    }
-    while (true) {
-      xsp = jj_scanpos;
-      if (jj_3_9()) { jj_scanpos = xsp; break; }
-    }
-    if (jj_scan_token(RCURLY)) return true;
-    return false;
-  }
-
-  final private boolean jj_3R_79() {
-    if (jj_3R_65()) return true;
-    return false;
-  }
-
-  final private boolean jj_3R_40() {
-    if (jj_scan_token(INTEGER_LITERAL)) return true;
-    return false;
-  }
-
-  final private boolean jj_3R_72() {
-    Token xsp;
-    xsp = jj_scanpos;
-    if (jj_scan_token(31)) jj_scanpos = xsp;
-    xsp = jj_scanpos;
-    if (jj_3R_79()) {
-    jj_scanpos = xsp;
-    if (jj_3R_80()) {
-    jj_scanpos = xsp;
-    if (jj_3R_81()) {
-    jj_scanpos = xsp;
-    if (jj_3R_82()) {
-    jj_scanpos = xsp;
-    if (jj_3R_83()) {
-    jj_scanpos = xsp;
-    if (jj_3R_84()) {
-    jj_scanpos = xsp;
-    if (jj_3R_85()) {
-    jj_scanpos = xsp;
-    if (jj_3R_86()) {
-    jj_scanpos = xsp;
-    if (jj_3R_87()) {
-    jj_scanpos = xsp;
-    if (jj_3R_88()) return true;
-    }
-    }
-    }
-    }
-    }
-    }
-    }
-    }
-    }
-    return false;
-  }
-
-  final private boolean jj_3R_38() {
-    if (jj_scan_token(IDENTIFIER)) return true;
-    Token xsp;
-    while (true) {
-      xsp = jj_scanpos;
-      if (jj_3R_63()) { jj_scanpos = xsp; break; }
-    }
-    while (true) {
-      xsp = jj_scanpos;
-      if (jj_3_7()) { jj_scanpos = xsp; break; }
-    }
-    return false;
-  }
-
-  final private boolean jj_3R_67() {
-    if (jj_scan_token(FLOATING_POINT_LITERAL)) return true;
-    return false;
-  }
-
-  final private boolean jj_3R_24() {
-    Token xsp;
-    xsp = jj_scanpos;
-    if (jj_3R_38()) {
-    jj_scanpos = xsp;
-    if (jj_3R_39()) return true;
-    }
-    return false;
-  }
-
-  final private boolean jj_3R_35() {
-    Token xsp;
-    xsp = jj_scanpos;
-    if (jj_3_11()) {
-    jj_scanpos = xsp;
-    if (jj_3R_62()) return true;
-    }
-    return false;
-  }
-
-  final private boolean jj_3_11() {
-    Token xsp;
-    xsp = jj_scanpos;
-    if (jj_scan_token(31)) jj_scanpos = xsp;
-    if (jj_scan_token(LOGICAL_NOT)) return true;
-    if (jj_3R_35()) return true;
-    return false;
-  }
-
-  final private boolean jj_3R_62() {
-    if (jj_3R_72()) return true;
-    return false;
-  }
-
-  final private boolean jj_3R_73() {
-    if (jj_scan_token(INDEX_LBRACKET)) return true;
-    if (jj_3R_91()) return true;
-    if (jj_scan_token(INDEX_RBRACKET)) return true;
-    return false;
-  }
-
-  final private boolean jj_3_6() {
+  private boolean jj_3_6() {
     if (jj_scan_token(LBRACKET)) return true;
     Token xsp;
     xsp = jj_scanpos;
@@ -2978,7 +2801,7 @@
     return false;
   }
 
-  final private boolean jj_3R_33() {
+  private boolean jj_3R_33() {
     if (jj_3R_60()) return true;
     if (jj_scan_token(LPAREN)) return true;
     Token xsp;
@@ -2988,52 +2811,52 @@
     return false;
   }
 
-  final private boolean jj_3R_59() {
+  private boolean jj_3R_59() {
     if (jj_3R_67()) return true;
     return false;
   }
 
-  final private boolean jj_3R_58() {
+  private boolean jj_3R_58() {
     if (jj_3R_24()) return true;
     return false;
   }
 
-  final private boolean jj_3R_57() {
+  private boolean jj_3R_57() {
     if (jj_3R_71()) return true;
     return false;
   }
 
-  final private boolean jj_3R_56() {
+  private boolean jj_3R_56() {
     if (jj_3R_70()) return true;
     return false;
   }
 
-  final private boolean jj_3R_55() {
+  private boolean jj_3R_55() {
     if (jj_3R_69()) return true;
     return false;
   }
 
-  final private boolean jj_3R_54() {
+  private boolean jj_3R_54() {
     if (jj_3R_68()) return true;
     return false;
   }
 
-  final private boolean jj_3R_53() {
+  private boolean jj_3R_53() {
     if (jj_3R_66()) return true;
     return false;
   }
 
-  final private boolean jj_3R_52() {
+  private boolean jj_3R_52() {
     if (jj_3R_40()) return true;
     return false;
   }
 
-  final private boolean jj_3R_51() {
+  private boolean jj_3R_51() {
     if (jj_3R_65()) return true;
     return false;
   }
 
-  final private boolean jj_3R_29() {
+  private boolean jj_3R_29() {
     Token xsp;
     xsp = jj_scanpos;
     if (jj_scan_token(31)) jj_scanpos = xsp;
@@ -3068,7 +2891,7 @@
     return false;
   }
 
-  final private boolean jj_3R_100() {
+  private boolean jj_3R_100() {
     if (jj_scan_token(COMMA)) return true;
     if (jj_3R_29()) return true;
     if (jj_scan_token(COLON)) return true;
@@ -3076,53 +2899,53 @@
     return false;
   }
 
-  final private boolean jj_3R_96() {
+  private boolean jj_3R_96() {
     if (jj_3R_24()) return true;
     return false;
   }
 
-  final private boolean jj_3R_95() {
+  private boolean jj_3R_95() {
     if (jj_3R_71()) return true;
     return false;
   }
 
-  final private boolean jj_3R_94() {
+  private boolean jj_3R_94() {
     if (jj_3R_70()) return true;
     return false;
   }
 
-  final private boolean jj_3R_93() {
+  private boolean jj_3R_93() {
     if (jj_3R_40()) return true;
     return false;
   }
 
-  final private boolean jj_3R_92() {
+  private boolean jj_3R_92() {
     if (jj_3R_65()) return true;
     return false;
   }
 
-  final private boolean jj_3R_99() {
+  private boolean jj_3R_99() {
     if (jj_3R_40()) return true;
     return false;
   }
 
-  final private boolean jj_3R_76() {
+  private boolean jj_3R_76() {
     if (jj_3R_40()) return true;
     return false;
   }
 
-  final private boolean jj_3R_101() {
+  private boolean jj_3R_101() {
     if (jj_scan_token(COMMA)) return true;
     if (jj_3R_29()) return true;
     return false;
   }
 
-  final private boolean jj_3_2() {
+  private boolean jj_3_2() {
     if (jj_scan_token(DOUBLE_ESCAPE)) return true;
     return false;
   }
 
-  final private boolean jj_3R_91() {
+  private boolean jj_3R_91() {
     Token xsp;
     xsp = jj_scanpos;
     if (jj_scan_token(31)) jj_scanpos = xsp;
@@ -3145,17 +2968,17 @@
     return false;
   }
 
-  final private boolean jj_3R_98() {
+  private boolean jj_3R_98() {
     if (jj_3R_24()) return true;
     return false;
   }
 
-  final private boolean jj_3R_75() {
+  private boolean jj_3R_75() {
     if (jj_3R_24()) return true;
     return false;
   }
 
-  final private boolean jj_3R_78() {
+  private boolean jj_3R_78() {
     if (jj_3R_29()) return true;
     Token xsp;
     while (true) {
@@ -3165,7 +2988,7 @@
     return false;
   }
 
-  final private boolean jj_3R_66() {
+  private boolean jj_3R_66() {
     if (jj_scan_token(LBRACKET)) return true;
     Token xsp;
     xsp = jj_scanpos;
@@ -3191,12 +3014,12 @@
     return false;
   }
 
-  final private boolean jj_3R_26() {
+  private boolean jj_3R_26() {
     if (jj_3R_40()) return true;
     return false;
   }
 
-  final private boolean jj_3R_69() {
+  private boolean jj_3R_69() {
     if (jj_scan_token(LBRACKET)) return true;
     Token xsp;
     xsp = jj_scanpos;
@@ -3205,14 +3028,14 @@
     return false;
   }
 
-  final private boolean jj_3R_77() {
+  private boolean jj_3R_77() {
     Token xsp;
     xsp = jj_scanpos;
     if (jj_scan_token(31)) jj_scanpos = xsp;
     return false;
   }
 
-  final private boolean jj_3_5() {
+  private boolean jj_3_5() {
     if (jj_3R_29()) return true;
     if (jj_scan_token(COLON)) return true;
     if (jj_3R_29()) return true;
@@ -3224,12 +3047,12 @@
     return false;
   }
 
-  final private boolean jj_3R_25() {
+  private boolean jj_3R_25() {
     if (jj_3R_24()) return true;
     return false;
   }
 
-  final private boolean jj_3R_68() {
+  private boolean jj_3R_68() {
     if (jj_scan_token(LEFT_CURLEY)) return true;
     Token xsp;
     xsp = jj_scanpos;
@@ -3245,27 +3068,27 @@
     return false;
   }
 
-  final private boolean jj_3_1() {
+  private boolean jj_3_1() {
     if (jj_3R_24()) return true;
     return false;
   }
 
-  final private boolean jj_3R_50() {
+  private boolean jj_3R_50() {
     if (jj_3R_71()) return true;
     return false;
   }
 
-  final private boolean jj_3R_90() {
+  private boolean jj_3R_90() {
     if (jj_3R_73()) return true;
     return false;
   }
 
-  final private boolean jj_3R_49() {
+  private boolean jj_3R_49() {
     if (jj_3R_70()) return true;
     return false;
   }
 
-  final private boolean jj_3_3() {
+  private boolean jj_3_3() {
     if (jj_scan_token(LBRACKET)) return true;
     Token xsp;
     xsp = jj_scanpos;
@@ -3281,57 +3104,57 @@
     return false;
   }
 
-  final private boolean jj_3R_48() {
+  private boolean jj_3R_48() {
     if (jj_3R_69()) return true;
     return false;
   }
 
-  final private boolean jj_3R_89() {
+  private boolean jj_3R_89() {
     if (jj_3R_73()) return true;
     return false;
   }
 
-  final private boolean jj_3R_37() {
+  private boolean jj_3R_37() {
     if (jj_3R_40()) return true;
     return false;
   }
 
-  final private boolean jj_3R_47() {
+  private boolean jj_3R_47() {
     if (jj_3R_68()) return true;
     return false;
   }
 
-  final private boolean jj_3R_46() {
+  private boolean jj_3R_46() {
     if (jj_3R_67()) return true;
     return false;
   }
 
-  final private boolean jj_3R_45() {
+  private boolean jj_3R_45() {
     if (jj_3R_66()) return true;
     return false;
   }
 
-  final private boolean jj_3R_34() {
+  private boolean jj_3R_34() {
     if (jj_3R_60()) return true;
     return false;
   }
 
-  final private boolean jj_3R_36() {
+  private boolean jj_3R_36() {
     if (jj_3R_24()) return true;
     return false;
   }
 
-  final private boolean jj_3R_32() {
+  private boolean jj_3R_32() {
     if (jj_3R_60()) return true;
     return false;
   }
 
-  final private boolean jj_3R_44() {
+  private boolean jj_3R_44() {
     if (jj_3R_40()) return true;
     return false;
   }
 
-  final private boolean jj_3R_27() {
+  private boolean jj_3R_27() {
     if (jj_scan_token(COMMA)) return true;
     Token xsp;
     xsp = jj_scanpos;
@@ -3339,22 +3162,22 @@
     return false;
   }
 
-  final private boolean jj_3R_43() {
+  private boolean jj_3R_43() {
     if (jj_3R_65()) return true;
     return false;
   }
 
-  final private boolean jj_3R_42() {
+  private boolean jj_3R_42() {
     if (jj_3R_64()) return true;
     return false;
   }
 
-  final private boolean jj_3R_41() {
+  private boolean jj_3R_41() {
     if (jj_3R_24()) return true;
     return false;
   }
 
-  final private boolean jj_3R_28() {
+  private boolean jj_3R_28() {
     Token xsp;
     xsp = jj_scanpos;
     if (jj_3R_41()) {
@@ -3388,43 +3211,43 @@
     return false;
   }
 
-  final private boolean jj_3_10() {
+  private boolean jj_3_10() {
     if (jj_3R_33()) return true;
     return false;
   }
 
-  final private boolean jj_3R_64() {
+  private boolean jj_3R_64() {
     if (jj_scan_token(WORD)) return true;
     return false;
   }
 
-  final private boolean jj_3R_31() {
+  private boolean jj_3R_31() {
     if (jj_3R_40()) return true;
     return false;
   }
 
-  final private boolean jj_3_8() {
+  private boolean jj_3_8() {
     if (jj_3R_33()) return true;
     return false;
   }
 
-  final private boolean jj_3R_74() {
+  private boolean jj_3R_74() {
     if (jj_3R_73()) return true;
     return false;
   }
 
-  final private boolean jj_3R_60() {
+  private boolean jj_3R_60() {
     if (jj_scan_token(IDENTIFIER)) return true;
     return false;
   }
 
-  final private boolean jj_3R_97() {
+  private boolean jj_3R_97() {
     if (jj_scan_token(COMMA)) return true;
     if (jj_3R_29()) return true;
     return false;
   }
 
-  final private boolean jj_3_12() {
+  private boolean jj_3_12() {
     if (jj_scan_token(LBRACKET)) return true;
     Token xsp;
     xsp = jj_scanpos;
@@ -3440,12 +3263,12 @@
     return false;
   }
 
-  final private boolean jj_3R_71() {
+  private boolean jj_3R_71() {
     if (jj_scan_token(FALSE)) return true;
     return false;
   }
 
-  final private boolean jj_3_4() {
+  private boolean jj_3_4() {
     Token xsp;
     xsp = jj_scanpos;
     if (jj_scan_token(31)) jj_scanpos = xsp;
@@ -3455,37 +3278,37 @@
     return false;
   }
 
-  final private boolean jj_3R_63() {
+  private boolean jj_3R_63() {
     if (jj_3R_73()) return true;
     return false;
   }
 
-  final private boolean jj_3R_88() {
+  private boolean jj_3R_88() {
     if (jj_scan_token(LPAREN)) return true;
     return false;
   }
 
-  final private boolean jj_3R_30() {
+  private boolean jj_3R_30() {
     if (jj_3R_24()) return true;
     return false;
   }
 
-  final private boolean jj_3R_87() {
+  private boolean jj_3R_87() {
     if (jj_3R_71()) return true;
     return false;
   }
 
-  final private boolean jj_3R_70() {
+  private boolean jj_3R_70() {
     if (jj_scan_token(TRUE)) return true;
     return false;
   }
 
-  final private boolean jj_3R_86() {
+  private boolean jj_3R_86() {
     if (jj_3R_70()) return true;
     return false;
   }
 
-  final private boolean jj_3_9() {
+  private boolean jj_3_9() {
     if (jj_scan_token(DOT)) return true;
     Token xsp;
     xsp = jj_scanpos;
@@ -3500,41 +3323,221 @@
     return false;
   }
 
-  final private boolean jj_3R_85() {
+  private boolean jj_3R_85() {
     if (jj_3R_69()) return true;
     return false;
   }
 
+  private boolean jj_3R_84() {
+    if (jj_3R_68()) return true;
+    return false;
+  }
+
+  private boolean jj_3R_83() {
+    if (jj_3R_67()) return true;
+    return false;
+  }
+
+  private boolean jj_3R_82() {
+    if (jj_3R_66()) return true;
+    return false;
+  }
+
+  private boolean jj_3R_65() {
+    if (jj_scan_token(STRING_LITERAL)) return true;
+    return false;
+  }
+
+  private boolean jj_3R_81() {
+    if (jj_3R_40()) return true;
+    return false;
+  }
+
+  private boolean jj_3_7() {
+    if (jj_scan_token(DOT)) return true;
+    Token xsp;
+    xsp = jj_scanpos;
+    if (jj_3_8()) {
+    jj_scanpos = xsp;
+    if (jj_3R_32()) return true;
+    }
+    while (true) {
+      xsp = jj_scanpos;
+      if (jj_3R_89()) { jj_scanpos = xsp; break; }
+    }
+    return false;
+  }
+
+  private boolean jj_3R_61() {
+    if (jj_3R_29()) return true;
+    Token xsp;
+    while (true) {
+      xsp = jj_scanpos;
+      if (jj_3R_97()) { jj_scanpos = xsp; break; }
+    }
+    return false;
+  }
+
+  private boolean jj_3R_80() {
+    if (jj_3R_24()) return true;
+    return false;
+  }
+
+  private boolean jj_3R_39() {
+    if (jj_scan_token(LCURLY)) return true;
+    if (jj_scan_token(IDENTIFIER)) return true;
+    Token xsp;
+    while (true) {
+      xsp = jj_scanpos;
+      if (jj_3R_74()) { jj_scanpos = xsp; break; }
+    }
+    while (true) {
+      xsp = jj_scanpos;
+      if (jj_3_9()) { jj_scanpos = xsp; break; }
+    }
+    if (jj_scan_token(RCURLY)) return true;
+    return false;
+  }
+
+  private boolean jj_3R_79() {
+    if (jj_3R_65()) return true;
+    return false;
+  }
+
+  private boolean jj_3R_40() {
+    if (jj_scan_token(INTEGER_LITERAL)) return true;
+    return false;
+  }
+
+  private boolean jj_3R_72() {
+    Token xsp;
+    xsp = jj_scanpos;
+    if (jj_scan_token(31)) jj_scanpos = xsp;
+    xsp = jj_scanpos;
+    if (jj_3R_79()) {
+    jj_scanpos = xsp;
+    if (jj_3R_80()) {
+    jj_scanpos = xsp;
+    if (jj_3R_81()) {
+    jj_scanpos = xsp;
+    if (jj_3R_82()) {
+    jj_scanpos = xsp;
+    if (jj_3R_83()) {
+    jj_scanpos = xsp;
+    if (jj_3R_84()) {
+    jj_scanpos = xsp;
+    if (jj_3R_85()) {
+    jj_scanpos = xsp;
+    if (jj_3R_86()) {
+    jj_scanpos = xsp;
+    if (jj_3R_87()) {
+    jj_scanpos = xsp;
+    if (jj_3R_88()) return true;
+    }
+    }
+    }
+    }
+    }
+    }
+    }
+    }
+    }
+    return false;
+  }
+
+  private boolean jj_3R_38() {
+    if (jj_scan_token(IDENTIFIER)) return true;
+    Token xsp;
+    while (true) {
+      xsp = jj_scanpos;
+      if (jj_3R_63()) { jj_scanpos = xsp; break; }
+    }
+    while (true) {
+      xsp = jj_scanpos;
+      if (jj_3_7()) { jj_scanpos = xsp; break; }
+    }
+    return false;
+  }
+
+  private boolean jj_3R_67() {
+    if (jj_scan_token(FLOATING_POINT_LITERAL)) return true;
+    return false;
+  }
+
+  private boolean jj_3R_24() {
+    Token xsp;
+    xsp = jj_scanpos;
+    if (jj_3R_38()) {
+    jj_scanpos = xsp;
+    if (jj_3R_39()) return true;
+    }
+    return false;
+  }
+
+  private boolean jj_3R_35() {
+    Token xsp;
+    xsp = jj_scanpos;
+    if (jj_3_11()) {
+    jj_scanpos = xsp;
+    if (jj_3R_62()) return true;
+    }
+    return false;
+  }
+
+  private boolean jj_3_11() {
+    Token xsp;
+    xsp = jj_scanpos;
+    if (jj_scan_token(31)) jj_scanpos = xsp;
+    if (jj_scan_token(LOGICAL_NOT)) return true;
+    if (jj_3R_35()) return true;
+    return false;
+  }
+
+  private boolean jj_3R_62() {
+    if (jj_3R_72()) return true;
+    return false;
+  }
+
+  private boolean jj_3R_73() {
+    if (jj_scan_token(INDEX_LBRACKET)) return true;
+    if (jj_3R_91()) return true;
+    if (jj_scan_token(INDEX_RBRACKET)) return true;
+    return false;
+  }
+
+  /** Generated Token Manager. */
   public ParserTokenManager token_source;
-  public Token token, jj_nt;
+  /** Current token. */
+  public Token token;
+  /** Next token. */
+  public Token jj_nt;
   private int jj_ntk;
   private Token jj_scanpos, jj_lastpos;
   private int jj_la;
-  public boolean lookingAhead = false;
-  private boolean jj_semLA;
   private int jj_gen;
   final private int[] jj_la1 = new int[69];
   static private int[] jj_la1_0;
   static private int[] jj_la1_1;
   static private int[] jj_la1_2;
   static {
-      jj_la1_0();
-      jj_la1_1();
-      jj_la1_2();
+      jj_la1_init_0();
+      jj_la1_init_1();
+      jj_la1_init_2();
    }
-   private static void jj_la1_0() {
+   private static void jj_la1_init_0() {
       jj_la1_0 = new int[] {0x1de06c00,0x0,0x1de06c00,0x2000000,0xc200000,0x0,0x108,0x0,0x80000000,0x80000000,0x80000000,0x20,0x80000000,0x1de06c00,0x20,0x80000000,0x200,0x20,0x80000108,0x80000000,0x0,0x80000000,0x80000000,0x0,0x80000000,0x80000000,0x0,0x80000000,0x80000000,0x0,0x108,0x80000000,0x20,0x80000108,0x2,0x0,0x2,0x2,0x0,0x2,0x0,0x1800c00,0x80000000,0x1de06c00,0x0,0x0,0x0,0x1de06c00,0x80000000,0x1de06c00,0x80000000,0x80000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80000000,0x80000508,0x80000000,0x0,0x508,0x80000000,};
    }
-   private static void jj_la1_1() {
+   private static void jj_la1_init_1() {
       jj_la1_1 = new int[] {0xc6900001,0x900000,0xc6000001,0x0,0x0,0x42000001,0x4000006,0xc0000000,0x0,0x0,0x0,0x0,0x0,0xc6900001,0x0,0x0,0x0,0x0,0x6000007,0x0,0x2000000,0x0,0x0,0x2000000,0x0,0x0,0x2000007,0x0,0x0,0x2000001,0x4000006,0x0,0x0,0x6000007,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6000001,0x0,0xc6900001,0x200000,0x200000,0x400000,0xc6900001,0x0,0xc6900001,0x0,0x0,0x8,0x400,0x200,0x18000,0x18000,0x7800,0x7800,0x30,0x30,0x1c0,0x1c0,0x0,0x6000007,0x0,0x2000001,0x4000006,0x0,};
    }
-   private static void jj_la1_2() {
+   private static void jj_la1_init_2() {
       jj_la1_2 = new int[] {0x278,0x0,0x270,0x0,0x0,0x28,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x278,0x0,0x0,0x40,0x0,0x28,0x0,0x28,0x0,0x0,0x28,0x0,0x0,0x28,0x0,0x0,0x0,0x28,0x0,0x0,0x28,0x0,0x8,0x0,0x0,0x8,0x0,0x28,0x270,0x0,0x278,0x0,0x0,0x0,0x278,0x0,0x278,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x28,0x0,0x28,0x0,0x0,};
    }
   final private JJCalls[] jj_2_rtns = new JJCalls[12];
   private boolean jj_rescan = false;
   private int jj_gc = 0;
 
+  /** Constructor with user supplied CharStream. */
   public Parser(CharStream stream) {
     token_source = new ParserTokenManager(stream);
     token = new Token();
@@ -3544,6 +3547,7 @@
     for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
   }
 
+  /** Reinitialise. */
   public void ReInit(CharStream stream) {
     token_source.ReInit(stream);
     token = new Token();
@@ -3554,6 +3558,7 @@
     for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
   }
 
+  /** Constructor with generated Token Manager. */
   public Parser(ParserTokenManager tm) {
     token_source = tm;
     token = new Token();
@@ -3563,6 +3568,7 @@
     for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
   }
 
+  /** Reinitialise. */
   public void ReInit(ParserTokenManager tm) {
     token_source = tm;
     token = new Token();
@@ -3573,7 +3579,7 @@
     for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
   }
 
-  final private Token jj_consume_token(int kind) throws ParseException {
+  private Token jj_consume_token(int kind) throws ParseException {
     Token oldToken;
     if ((oldToken = token).next != null) token = token.next;
     else token = token.next = token_source.getNextToken();
@@ -3599,7 +3605,7 @@
 
   static private final class LookaheadSuccess extends java.lang.Error { }
   final private LookaheadSuccess jj_ls = new LookaheadSuccess();
-  final private boolean jj_scan_token(int kind) {
+  private boolean jj_scan_token(int kind) {
     if (jj_scanpos == jj_lastpos) {
       jj_la--;
       if (jj_scanpos.next == null) {
@@ -3620,6 +3626,8 @@
     return false;
   }
 
+
+/** Get the next Token. */
   final public Token getNextToken() {
     if (token.next != null) token = token.next;
     else token = token.next = token_source.getNextToken();
@@ -3628,8 +3636,9 @@
     return token;
   }
 
+/** Get the specific Token. */
   final public Token getToken(int index) {
-    Token t = lookingAhead ? jj_scanpos : token;
+    Token t = token;
     for (int i = 0; i < index; i++) {
       if (t.next != null) t = t.next;
       else t = t.next = token_source.getNextToken();
@@ -3637,14 +3646,14 @@
     return t;
   }
 
-  final private int jj_ntk() {
+  private int jj_ntk() {
     if ((jj_nt=token.next) == null)
       return (jj_ntk = (token.next=token_source.getNextToken()).kind);
     else
       return (jj_ntk = jj_nt.kind);
   }
 
-  private java.util.Vector jj_expentries = new java.util.Vector();
+  private java.util.List jj_expentries = new java.util.ArrayList();
   private int[] jj_expentry;
   private int jj_kind = -1;
   private int[] jj_lasttokens = new int[100];
@@ -3659,31 +3668,26 @@
       for (int i = 0; i < jj_endpos; i++) {
         jj_expentry[i] = jj_lasttokens[i];
       }
-      boolean exists = false;
-      for (java.util.Enumeration e = jj_expentries.elements(); e.hasMoreElements();) {
-        int[] oldentry = (int[])(e.nextElement());
+      jj_entries_loop: for (java.util.Iterator it = jj_expentries.iterator(); it.hasNext();)
{
+        int[] oldentry = (int[])(it.next());
         if (oldentry.length == jj_expentry.length) {
-          exists = true;
           for (int i = 0; i < jj_expentry.length; i++) {
             if (oldentry[i] != jj_expentry[i]) {
-              exists = false;
-              break;
+              continue jj_entries_loop;
             }
           }
-          if (exists) break;
+          jj_expentries.add(jj_expentry);
+          break jj_entries_loop;
         }
       }
-      if (!exists) jj_expentries.addElement(jj_expentry);
       if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind;
     }
   }
 
+  /** Generate ParseException. */
   public ParseException generateParseException() {
-    jj_expentries.removeAllElements();
+    jj_expentries.clear();
     boolean[] la1tokens = new boolean[74];
-    for (int i = 0; i < 74; i++) {
-      la1tokens[i] = false;
-    }
     if (jj_kind >= 0) {
       la1tokens[jj_kind] = true;
       jj_kind = -1;
@@ -3707,7 +3711,7 @@
       if (la1tokens[i]) {
         jj_expentry = new int[1];
         jj_expentry[0] = i;
-        jj_expentries.addElement(jj_expentry);
+        jj_expentries.add(jj_expentry);
       }
     }
     jj_endpos = 0;
@@ -3715,20 +3719,23 @@
     jj_add_error_token(0, 0);
     int[][] exptokseq = new int[jj_expentries.size()][];
     for (int i = 0; i < jj_expentries.size(); i++) {
-      exptokseq[i] = (int[])jj_expentries.elementAt(i);
+      exptokseq[i] = (int[])jj_expentries.get(i);
     }
     return new ParseException(token, exptokseq, tokenImage);
   }
 
+  /** Enable tracing. */
   final public void enable_tracing() {
   }
 
+  /** Disable tracing. */
   final public void disable_tracing() {
   }
 
-  final private void jj_rescan_token() {
+  private void jj_rescan_token() {
     jj_rescan = true;
     for (int i = 0; i < 12; i++) {
+    try {
       JJCalls p = jj_2_rtns[i];
       do {
         if (p.gen > jj_gen) {
@@ -3750,11 +3757,12 @@
         }
         p = p.next;
       } while (p != null);
+      } catch(LookaheadSuccess ls) { }
     }
     jj_rescan = false;
   }
 
-  final private void jj_save(int index, int xla) {
+  private void jj_save(int index, int xla) {
     JJCalls p = jj_2_rtns[index];
     while (p.gen > jj_gen) {
       if (p.next == null) { p = p.next = new JJCalls(); break; }

Modified: velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/ParserConstants.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/ParserConstants.java?rev=736681&r1=736680&r2=736681&view=diff
==============================================================================
--- velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/ParserConstants.java
(original)
+++ velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/ParserConstants.java
Thu Jan 22 07:49:12 2009
@@ -1,91 +1,178 @@
 /* Generated By:JJTree&JavaCC: Do not edit this line. ParserConstants.java */
 package org.apache.velocity.runtime.parser;
 
+
+/**
+ * Token literal values and constants.
+ * Generated by org.javacc.parser.OtherFilesGen#start()
+ */
 public interface ParserConstants {
 
+  /** End of File. */
   int EOF = 0;
+  /** RegularExpression Id. */
   int INDEX_LBRACKET = 1;
+  /** RegularExpression Id. */
   int INDEX_RBRACKET = 2;
+  /** RegularExpression Id. */
   int LBRACKET = 3;
+  /** RegularExpression Id. */
   int RBRACKET = 4;
+  /** RegularExpression Id. */
   int COMMA = 5;
+  /** RegularExpression Id. */
   int DOUBLEDOT = 6;
+  /** RegularExpression Id. */
   int COLON = 7;
+  /** RegularExpression Id. */
   int LEFT_CURLEY = 8;
+  /** RegularExpression Id. */
   int RIGHT_CURLEY = 9;
+  /** RegularExpression Id. */
   int LPAREN = 10;
+  /** RegularExpression Id. */
   int RPAREN = 11;
+  /** RegularExpression Id. */
   int REFMOD2_RPAREN = 12;
+  /** RegularExpression Id. */
   int ESCAPE_DIRECTIVE = 13;
+  /** RegularExpression Id. */
   int SET_DIRECTIVE = 14;
+  /** RegularExpression Id. */
   int DOLLAR = 15;
+  /** RegularExpression Id. */
   int DOLLARBANG = 16;
+  /** RegularExpression Id. */
   int HASH = 20;
+  /** RegularExpression Id. */
   int SINGLE_LINE_COMMENT_START = 21;
+  /** RegularExpression Id. */
   int DOUBLE_ESCAPE = 22;
+  /** RegularExpression Id. */
   int ESCAPE = 23;
+  /** RegularExpression Id. */
   int TEXT = 24;
+  /** RegularExpression Id. */
   int SINGLE_LINE_COMMENT = 25;
+  /** RegularExpression Id. */
   int FORMAL_COMMENT = 26;
+  /** RegularExpression Id. */
   int MULTI_LINE_COMMENT = 27;
+  /** RegularExpression Id. */
   int TEXTBLOCK = 28;
+  /** RegularExpression Id. */
   int WHITESPACE = 31;
+  /** RegularExpression Id. */
   int STRING_LITERAL = 32;
+  /** RegularExpression Id. */
   int TRUE = 33;
+  /** RegularExpression Id. */
   int FALSE = 34;
+  /** RegularExpression Id. */
   int NEWLINE = 35;
+  /** RegularExpression Id. */
   int MINUS = 36;
+  /** RegularExpression Id. */
   int PLUS = 37;
+  /** RegularExpression Id. */
   int MULTIPLY = 38;
+  /** RegularExpression Id. */
   int DIVIDE = 39;
+  /** RegularExpression Id. */
   int MODULUS = 40;
+  /** RegularExpression Id. */
   int LOGICAL_AND = 41;
+  /** RegularExpression Id. */
   int LOGICAL_OR = 42;
+  /** RegularExpression Id. */
   int LOGICAL_LT = 43;
+  /** RegularExpression Id. */
   int LOGICAL_LE = 44;
+  /** RegularExpression Id. */
   int LOGICAL_GT = 45;
+  /** RegularExpression Id. */
   int LOGICAL_GE = 46;
+  /** RegularExpression Id. */
   int LOGICAL_EQUALS = 47;
+  /** RegularExpression Id. */
   int LOGICAL_NOT_EQUALS = 48;
+  /** RegularExpression Id. */
   int LOGICAL_NOT = 49;
+  /** RegularExpression Id. */
   int EQUALS = 50;
+  /** RegularExpression Id. */
   int END = 51;
+  /** RegularExpression Id. */
   int IF_DIRECTIVE = 52;
+  /** RegularExpression Id. */
   int ELSEIF_DIRECTIVE = 53;
+  /** RegularExpression Id. */
   int ELSE_DIRECTIVE = 54;
+  /** RegularExpression Id. */
   int STOP_DIRECTIVE = 55;
+  /** RegularExpression Id. */
   int DIGIT = 56;
+  /** RegularExpression Id. */
   int INTEGER_LITERAL = 57;
+  /** RegularExpression Id. */
   int FLOATING_POINT_LITERAL = 58;
+  /** RegularExpression Id. */
   int EXPONENT = 59;
+  /** RegularExpression Id. */
   int LETTER = 60;
+  /** RegularExpression Id. */
   int DIRECTIVE_CHAR = 61;
+  /** RegularExpression Id. */
   int WORD = 62;
+  /** RegularExpression Id. */
   int BRACKETED_WORD = 63;
+  /** RegularExpression Id. */
   int ALPHA_CHAR = 64;
+  /** RegularExpression Id. */
   int ALPHANUM_CHAR = 65;
+  /** RegularExpression Id. */
   int IDENTIFIER_CHAR = 66;
+  /** RegularExpression Id. */
   int IDENTIFIER = 67;
+  /** RegularExpression Id. */
   int DOT = 68;
+  /** RegularExpression Id. */
   int LCURLY = 69;
+  /** RegularExpression Id. */
   int RCURLY = 70;
+  /** RegularExpression Id. */
   int REFERENCE_TERMINATOR = 71;
+  /** RegularExpression Id. */
   int DIRECTIVE_TERMINATOR = 72;
+  /** RegularExpression Id. */
   int EMPTY_INDEX = 73;
 
+  /** Lexical state. */
   int REFERENCE = 0;
+  /** Lexical state. */
   int REFMODIFIER = 1;
+  /** Lexical state. */
   int REFINDEX = 2;
+  /** Lexical state. */
   int DIRECTIVE = 3;
+  /** Lexical state. */
   int REFMOD2 = 4;
+  /** Lexical state. */
   int DEFAULT = 5;
+  /** Lexical state. */
   int REFMOD = 6;
-  int PRE_DIRECTIVE = 7;
-  int IN_TEXTBLOCK = 8;
-  int IN_MULTI_LINE_COMMENT = 9;
-  int IN_FORMAL_COMMENT = 10;
-  int IN_SINGLE_LINE_COMMENT = 11;
+  /** Lexical state. */
+  int IN_TEXTBLOCK = 7;
+  /** Lexical state. */
+  int IN_MULTI_LINE_COMMENT = 8;
+  /** Lexical state. */
+  int IN_FORMAL_COMMENT = 9;
+  /** Lexical state. */
+  int IN_SINGLE_LINE_COMMENT = 10;
+  /** Lexical state. */
+  int PRE_DIRECTIVE = 11;
 
+  /** Literal token values. */
   String[] tokenImage = {
     "<EOF>",
     "\"[\"",



Mime
View raw message