You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by jv...@locus.apache.org on 2000/09/19 08:58:58 UTC

cvs commit: jakarta-velocity/src/java/org/apache/velocity/processor/javacc/parser/velocity Parser.java Parser.jj Parser.jjt ParserConstants.java ParserTokenManager.java

jvanzyl     00/09/18 23:58:57

  Modified:    src/java/org/apache/velocity/processor/javacc/parser/velocity
                        Parser.java Parser.jj Parser.jjt
                        ParserConstants.java ParserTokenManager.java
  Log:
  - little hack to fix a formatting problem in #foreach statements
    for the velocity syntax. the velocity syntax should now actually
    be useful :)
  
  Revision  Changes    Path
  1.2       +71 -72    jakarta-velocity/src/java/org/apache/velocity/processor/javacc/parser/velocity/Parser.java
  
  Index: Parser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/processor/javacc/parser/velocity/Parser.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Parser.java	2000/09/19 01:58:54	1.1
  +++ Parser.java	2000/09/19 06:58:53	1.2
  @@ -16,7 +16,7 @@
    * what controls the generation of this class.
    *
    * @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
  - * @version $Id: Parser.java,v 1.1 2000/09/19 01:58:54 jvanzyl Exp $ 
  + * @version $Id: Parser.java,v 1.2 2000/09/19 06:58:53 jvanzyl Exp $ 
   */
   public class Parser implements/*@bgen(jjtree)*/ ParserTreeConstants,org.apache.velocity.processor.javacc.parser.Parser, ParserConstants {/*@bgen(jjtree)*/
     protected JJTParserState jjtree = new JJTParserState();
  @@ -710,7 +710,6 @@
         Reference();
         jj_consume_token(IN);
         Reference();
  -    token_source.SwitchTo(DEFAULT);
       ASTBlock jjtn001 = new ASTBlock(this, JJTBLOCK);
       boolean jjtc001 = true;
       jjtree.openNodeScope(jjtn001);
  @@ -1544,59 +1543,8 @@
       return retval;
     }
   
  -  final private boolean jj_3R_51() {
  -    if (jj_scan_token(LOGICAL_NOT_EQUALS)) return true;
  -    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  -    if (jj_3R_46()) return true;
  -    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  -    return false;
  -  }
  -
  -  final private boolean jj_3R_46() {
  -    if (jj_3R_48()) return true;
  -    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  -    Token xsp;
  -    while (true) {
  -      xsp = jj_scanpos;
  -      if (jj_3R_49()) { jj_scanpos = xsp; break; }
  -      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  -    }
  -    return false;
  -  }
  -
  -  final private boolean jj_3R_50() {
  -    if (jj_scan_token(LOGICAL_EQUALS)) return true;
  -    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  -    if (jj_3R_46()) return true;
  -    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  -    return false;
  -  }
  -
  -  final private boolean jj_3R_47() {
  -    Token xsp;
  -    xsp = jj_scanpos;
  -    if (jj_3R_50()) {
  -    jj_scanpos = xsp;
  -    if (jj_3R_51()) return true;
  -    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  -    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  -    return false;
  -  }
  -
  -  final private boolean jj_3R_19() {
  -    if (jj_3R_24()) return true;
  -    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  -    Token xsp;
  -    while (true) {
  -      xsp = jj_scanpos;
  -      if (jj_3R_45()) { jj_scanpos = xsp; break; }
  -      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  -    }
  -    return false;
  -  }
  -
  -  final private boolean jj_3R_32() {
  -    if (jj_scan_token(DIDENTIFIER)) return true;
  +  final private boolean jj_3R_38() {
  +    if (jj_scan_token(FALSE)) return true;
       if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
       return false;
     }
  @@ -1613,12 +1561,6 @@
       return false;
     }
   
  -  final private boolean jj_3R_38() {
  -    if (jj_scan_token(FALSE)) return true;
  -    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  -    return false;
  -  }
  -
     final private boolean jj_3R_37() {
       if (jj_scan_token(TRUE)) return true;
       if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  @@ -1690,16 +1632,16 @@
       return false;
     }
   
  -  final private boolean jj_3R_44() {
  -    if (jj_scan_token(LOGICAL_AND)) return true;
  -    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  -    if (jj_3R_43()) return true;
  +  final private boolean jj_3R_18() {
  +    if (jj_scan_token(IDENTIFIER)) return true;
       if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
       return false;
     }
   
  -  final private boolean jj_3R_18() {
  -    if (jj_scan_token(IDENTIFIER)) return true;
  +  final private boolean jj_3R_44() {
  +    if (jj_scan_token(LOGICAL_AND)) return true;
  +    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  +    if (jj_3R_43()) return true;
       if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
       return false;
     }
  @@ -2042,6 +1984,63 @@
       return false;
     }
   
  +  final private boolean jj_3R_19() {
  +    if (jj_3R_24()) return true;
  +    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  +    Token xsp;
  +    while (true) {
  +      xsp = jj_scanpos;
  +      if (jj_3R_45()) { jj_scanpos = xsp; break; }
  +      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  +    }
  +    return false;
  +  }
  +
  +  final private boolean jj_3R_51() {
  +    if (jj_scan_token(LOGICAL_NOT_EQUALS)) return true;
  +    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  +    if (jj_3R_46()) return true;
  +    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  +    return false;
  +  }
  +
  +  final private boolean jj_3R_46() {
  +    if (jj_3R_48()) return true;
  +    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  +    Token xsp;
  +    while (true) {
  +      xsp = jj_scanpos;
  +      if (jj_3R_49()) { jj_scanpos = xsp; break; }
  +      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  +    }
  +    return false;
  +  }
  +
  +  final private boolean jj_3R_50() {
  +    if (jj_scan_token(LOGICAL_EQUALS)) return true;
  +    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  +    if (jj_3R_46()) return true;
  +    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  +    return false;
  +  }
  +
  +  final private boolean jj_3R_47() {
  +    Token xsp;
  +    xsp = jj_scanpos;
  +    if (jj_3R_50()) {
  +    jj_scanpos = xsp;
  +    if (jj_3R_51()) return true;
  +    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  +    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  +    return false;
  +  }
  +
  +  final private boolean jj_3R_32() {
  +    if (jj_scan_token(DIDENTIFIER)) return true;
  +    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  +    return false;
  +  }
  +
     public ParserTokenManager token_source;
     ASCII_CharStream jj_input_stream;
     public Token token, jj_nt;
  @@ -2052,8 +2051,8 @@
     private boolean jj_semLA;
     private int jj_gen;
     final private int[] jj_la1 = new int[29];
  -  final private int[] jj_la1_0 = {0xe0000000,0xe0000000,0x0,0x0,0x0,0x0,0x0,0x20000000,0xe0000000,0x0,0x0,0x0,0xe0000000,0xe0000000,0xe0000000,0x6000000,0x800002,0x10000,0x8000,0x600000,0x600000,0x1e0000,0x1e0000,0xc00,0xc00,0x7000,0x7000,0x800002,0x2,};
  -  final private int[] jj_la1_1 = {0x4e0b9,0x4e0b9,0x6100,0x10000,0x6100,0x6000,0x2000,0x48080,0x4e0b9,0x2,0x2,0x4,0x4e0b9,0x4e0b9,0x4e0b9,0x0,0x6180,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6180,0x6180,};
  +  final private int[] jj_la1_0 = {0xf0000000,0xf0000000,0x0,0x0,0x0,0x0,0x0,0x10000000,0xf0000000,0x0,0x0,0x0,0xf0000000,0xf0000000,0xf0000000,0x6000000,0x800002,0x10000,0x8000,0x600000,0x600000,0x1e0000,0x1e0000,0xc00,0xc00,0x7000,0x7000,0x800002,0x2,};
  +  final private int[] jj_la1_1 = {0x2705c,0x2705c,0x3080,0x8000,0x3080,0x3000,0x1000,0x24040,0x2705c,0x1,0x1,0x2,0x2705c,0x2705c,0x2705c,0x0,0x30c0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x30c0,0x30c0,};
     final private JJCalls[] jj_2_rtns = new JJCalls[3];
     private boolean jj_rescan = false;
     private int jj_gc = 0;
  @@ -2222,8 +2221,8 @@
   
     final public ParseException generateParseException() {
       jj_expentries.removeAllElements();
  -    boolean[] la1tokens = new boolean[51];
  -    for (int i = 0; i < 51; i++) {
  +    boolean[] la1tokens = new boolean[50];
  +    for (int i = 0; i < 50; i++) {
         la1tokens[i] = false;
       }
       if (jj_kind >= 0) {
  @@ -2242,7 +2241,7 @@
           }
         }
       }
  -    for (int i = 0; i < 51; i++) {
  +    for (int i = 0; i < 50; i++) {
         if (la1tokens[i]) {
           jj_expentry = new int[1];
           jj_expentry[0] = i;
  
  
  
  1.2       +17 -12    jakarta-velocity/src/java/org/apache/velocity/processor/javacc/parser/velocity/Parser.jj
  
  Index: Parser.jj
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/processor/javacc/parser/velocity/Parser.jj,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Parser.jj	2000/09/19 01:58:52	1.1
  +++ Parser.jj	2000/09/19 06:58:54	1.2
  @@ -99,7 +99,7 @@
    * what controls the generation of this class.
    *
    * @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
  - * @version $Id: Parser.jj,v 1.1 2000/09/19 01:58:52 jvanzyl Exp $ 
  + * @version $Id: Parser.jj,v 1.2 2000/09/19 06:58:54 jvanzyl Exp $ 
   */
   public class Parser implements/*@bgen(jjtree)*/ ParserTreeConstants, /*@egen*/ org.apache.velocity.processor.javacc.parser.Parser
   {/*@bgen(jjtree)*/
  @@ -217,7 +217,6 @@
   
   // Arithmetic operators
   
  -
   <DIRECTIVE> SKIP:
   {
       " "
  @@ -259,8 +258,12 @@
       <IN: "in" >
   |   <TRUE: "true">
   |   <FALSE: "false">
  -|   <BEGIN: "#begin"> { inDirective = false; } : DEFAULT
  -|   <END: "end"> {inDirective = false; } : DEFAULT
  +|   <END: "end"> 
  +    { 
  +        inDirective = false; 
  +        inForeach = false; 
  +    } 
  +    : DEFAULT
   |   <EQUALS: "=" >
   }
   
  @@ -277,7 +280,7 @@
   |   <IF_DIRECTIVE:      "if">
   |   <ELSEIF_DIRECTIVE:  "elseif">
   |   <ELSE_DIRECTIVE:    "else"> : DEFAULT
  -|   <FOREACH_DIRECTIVE: "foreach">
  +|   <FOREACH_DIRECTIVE: "foreach"> { inForeach = true; }
   |   <SET_DIRECTIVE:     "set" >
   |   <STOP_DIRECTIVE:    "stop">
       {
  @@ -327,7 +330,12 @@
                   inReference = false;
                   
                   if (inDirective)
  +                {
  +                    if (inForeach)
  +                        inDirective = false;
  +                        
                       SwitchTo(DIRECTIVE);
  +                }                    
                   else
                       SwitchTo(DEFAULT);
               }
  @@ -375,8 +383,8 @@
   
       public boolean inReference;
       public boolean inDirective;
  -
  -
  +    public boolean inForeach;
  +    
       Stack streams = new Stack();
       Stack states = new Stack();
       
  @@ -923,17 +931,14 @@
     <FOREACH_DIRECTIVE> 
     Reference()
     <IN>
  -  Reference()
  -  {
  -    token_source.SwitchTo(DEFAULT);
  -  }/*@bgen(jjtree) Block */
  +  Reference()/*@bgen(jjtree) Block */
     {
       ASTBlock jjtn001 = new ASTBlock(this, JJTBLOCK);
       boolean jjtc001 = true;
       jjtree.openNodeScope(jjtn001);
     }
     try {
  -/*@egen*/    
  +/*@egen*/
     ( Statement() )+/*@bgen(jjtree)*/
     } catch (Throwable jjte001) {
       if (jjtc001) {
  
  
  
  1.2       +15 -10    jakarta-velocity/src/java/org/apache/velocity/processor/javacc/parser/velocity/Parser.jjt
  
  Index: Parser.jjt
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/processor/javacc/parser/velocity/Parser.jjt,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Parser.jjt	2000/09/19 01:58:53	1.1
  +++ Parser.jjt	2000/09/19 06:58:54	1.2
  @@ -123,7 +123,7 @@
    * what controls the generation of this class.
    *
    * @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
  - * @version $Id: Parser.jjt,v 1.1 2000/09/19 01:58:53 jvanzyl Exp $ 
  + * @version $Id: Parser.jjt,v 1.2 2000/09/19 06:58:54 jvanzyl Exp $ 
   */
   public class Parser implements org.apache.velocity.processor.javacc.parser.Parser
   {
  @@ -238,7 +238,6 @@
   
   // Arithmetic operators
   
  -
   <DIRECTIVE> SKIP:
   {
       " "
  @@ -280,8 +279,12 @@
       <IN: "in" >
   |   <TRUE: "true">
   |   <FALSE: "false">
  -|   <BEGIN: "#begin"> { inDirective = false; } : DEFAULT
  -|   <END: "end"> {inDirective = false; } : DEFAULT
  +|   <END: "end"> 
  +    { 
  +        inDirective = false; 
  +        inForeach = false; 
  +    } 
  +    : DEFAULT
   |   <EQUALS: "=" >
   }
   
  @@ -298,7 +301,7 @@
   |   <IF_DIRECTIVE:      "if">
   |   <ELSEIF_DIRECTIVE:  "elseif">
   |   <ELSE_DIRECTIVE:    "else"> : DEFAULT
  -|   <FOREACH_DIRECTIVE: "foreach">
  +|   <FOREACH_DIRECTIVE: "foreach"> { inForeach = true; }
   |   <SET_DIRECTIVE:     "set" >
   |   <STOP_DIRECTIVE:    "stop">
       {
  @@ -348,7 +351,12 @@
                   inReference = false;
                   
                   if (inDirective)
  +                {
  +                    if (inForeach)
  +                        inDirective = false;
  +                        
                       SwitchTo(DIRECTIVE);
  +                }                    
                   else
                       SwitchTo(DEFAULT);
               }
  @@ -396,8 +404,8 @@
   
       public boolean inReference;
       public boolean inDirective;
  -
  -
  +    public boolean inForeach;
  +    
       Stack streams = new Stack();
       Stack states = new Stack();
       
  @@ -625,9 +633,6 @@
     Reference()
     <IN>
     Reference()
  -  {
  -    token_source.SwitchTo(DEFAULT);
  -  }    
     ( Statement() )+ #Block
     <END>
   }
  
  
  
  1.2       +23 -25    jakarta-velocity/src/java/org/apache/velocity/processor/javacc/parser/velocity/ParserConstants.java
  
  Index: ParserConstants.java
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/processor/javacc/parser/velocity/ParserConstants.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ParserConstants.java	2000/09/19 01:58:55	1.1
  +++ ParserConstants.java	2000/09/19 06:58:55	1.2
  @@ -26,30 +26,29 @@
     int IN = 24;
     int TRUE = 25;
     int FALSE = 26;
  -  int BEGIN = 27;
  -  int END = 28;
  -  int EQUALS = 29;
  -  int INCLUDE_DIRECTIVE = 30;
  -  int PARSE_DIRECTIVE = 31;
  -  int IF_DIRECTIVE = 32;
  -  int ELSEIF_DIRECTIVE = 33;
  -  int ELSE_DIRECTIVE = 34;
  -  int FOREACH_DIRECTIVE = 35;
  -  int SET_DIRECTIVE = 36;
  -  int STOP_DIRECTIVE = 37;
  -  int DIGIT = 38;
  -  int NUMBER_LITERAL = 39;
  -  int STRING_LITERAL = 40;
  -  int DT = 41;
  -  int ALPHA_CHAR = 42;
  -  int ALPHANUM_CHAR = 43;
  -  int IDENTIFIER_CHAR = 44;
  -  int IDENTIFIER = 45;
  -  int DIDENTIFIER = 46;
  -  int DOT = 47;
  -  int COMMA = 48;
  -  int REFERENCE_TERMINATOR = 49;
  -  int TEXT = 50;
  +  int END = 27;
  +  int EQUALS = 28;
  +  int INCLUDE_DIRECTIVE = 29;
  +  int PARSE_DIRECTIVE = 30;
  +  int IF_DIRECTIVE = 31;
  +  int ELSEIF_DIRECTIVE = 32;
  +  int ELSE_DIRECTIVE = 33;
  +  int FOREACH_DIRECTIVE = 34;
  +  int SET_DIRECTIVE = 35;
  +  int STOP_DIRECTIVE = 36;
  +  int DIGIT = 37;
  +  int NUMBER_LITERAL = 38;
  +  int STRING_LITERAL = 39;
  +  int DT = 40;
  +  int ALPHA_CHAR = 41;
  +  int ALPHANUM_CHAR = 42;
  +  int IDENTIFIER_CHAR = 43;
  +  int IDENTIFIER = 44;
  +  int DIDENTIFIER = 45;
  +  int DOT = 46;
  +  int COMMA = 47;
  +  int REFERENCE_TERMINATOR = 48;
  +  int TEXT = 49;
   
     int REFERENCE = 0;
     int EXPRESSION = 1;
  @@ -84,7 +83,6 @@
       "\"in\"",
       "\"true\"",
       "\"false\"",
  -    "\"#begin\"",
       "\"end\"",
       "\"=\"",
       "\"include\"",
  
  
  
  1.2       +95 -101   jakarta-velocity/src/java/org/apache/velocity/processor/javacc/parser/velocity/ParserTokenManager.java
  
  Index: ParserTokenManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/processor/javacc/parser/velocity/ParserTokenManager.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ParserTokenManager.java	2000/09/19 01:58:55	1.1
  +++ ParserTokenManager.java	2000/09/19 06:58:55	1.2
  @@ -17,8 +17,8 @@
   
       public boolean inReference;
       public boolean inDirective;
  +    public boolean inForeach;
   
  -
       Stack streams = new Stack();
       Stack states = new Stack();
   
  @@ -192,8 +192,8 @@
                  case 5:
                     if ((0xffffffe7ffffffffL & l) != 0L)
                     {
  -                     if (kind > 50)
  -                        kind = 50;
  +                     if (kind > 49)
  +                        kind = 49;
                        jjCheckNAdd(6);
                     }
                     else if (curChar == 35)
  @@ -222,8 +222,8 @@
                  case 6:
                     if ((0xffffffe7ffffffffL & l) == 0L)
                        break;
  -                  if (kind > 50)
  -                     kind = 50;
  +                  if (kind > 49)
  +                     kind = 49;
                     jjCheckNAdd(6);
                     break;
                  default : break;
  @@ -239,8 +239,8 @@
               {
                  case 5:
                  case 6:
  -                  if (kind > 50)
  -                     kind = 50;
  +                  if (kind > 49)
  +                     kind = 49;
                     jjCheckNAdd(6);
                     break;
                  case 1:
  @@ -262,8 +262,8 @@
                  case 6:
                     if ((jjbitVec0[i2] & l2) == 0L)
                        break;
  -                  if (kind > 50)
  -                     kind = 50;
  +                  if (kind > 49)
  +                     kind = 49;
                     jjCheckNAdd(6);
                     break;
                  case 1:
  @@ -384,8 +384,7 @@
      switch(curChar)
      {
         case 35:
  -         jjmatchedKind = 4;
  -         return jjMoveStringLiteralDfa1_2(0x8000000L);
  +         return jjStopAtPos(0, 4);
         case 36:
            return jjStopAtPos(0, 3);
         case 40:
  @@ -393,17 +392,17 @@
         case 41:
            return jjStopAtPos(0, 2);
         case 61:
  -         return jjStopAtPos(0, 29);
  +         return jjStopAtPos(0, 28);
         case 101:
  -         return jjMoveStringLiteralDfa1_2(0x610000000L);
  +         return jjMoveStringLiteralDfa1_2(0x308000000L);
         case 102:
  -         return jjMoveStringLiteralDfa1_2(0x804000000L);
  +         return jjMoveStringLiteralDfa1_2(0x404000000L);
         case 105:
  -         return jjMoveStringLiteralDfa1_2(0x141000000L);
  +         return jjMoveStringLiteralDfa1_2(0xa1000000L);
         case 112:
  -         return jjMoveStringLiteralDfa1_2(0x80000000L);
  +         return jjMoveStringLiteralDfa1_2(0x40000000L);
         case 115:
  -         return jjMoveStringLiteralDfa1_2(0x3000000000L);
  +         return jjMoveStringLiteralDfa1_2(0x1800000000L);
         case 116:
            return jjMoveStringLiteralDfa1_2(0x2000000L);
         default :
  @@ -420,30 +419,28 @@
      switch(curChar)
      {
         case 97:
  -         return jjMoveStringLiteralDfa2_2(active0, 0x84000000L);
  -      case 98:
  -         return jjMoveStringLiteralDfa2_2(active0, 0x8000000L);
  +         return jjMoveStringLiteralDfa2_2(active0, 0x44000000L);
         case 101:
  -         return jjMoveStringLiteralDfa2_2(active0, 0x1000000000L);
  +         return jjMoveStringLiteralDfa2_2(active0, 0x800000000L);
         case 102:
  -         if ((active0 & 0x100000000L) != 0L)
  -            return jjStopAtPos(1, 32);
  +         if ((active0 & 0x80000000L) != 0L)
  +            return jjStopAtPos(1, 31);
            break;
         case 108:
  -         return jjMoveStringLiteralDfa2_2(active0, 0x600000000L);
  +         return jjMoveStringLiteralDfa2_2(active0, 0x300000000L);
         case 110:
            if ((active0 & 0x1000000L) != 0L)
            {
               jjmatchedKind = 24;
               jjmatchedPos = 1;
            }
  -         return jjMoveStringLiteralDfa2_2(active0, 0x50000000L);
  +         return jjMoveStringLiteralDfa2_2(active0, 0x28000000L);
         case 111:
  -         return jjMoveStringLiteralDfa2_2(active0, 0x800000000L);
  +         return jjMoveStringLiteralDfa2_2(active0, 0x400000000L);
         case 114:
            return jjMoveStringLiteralDfa2_2(active0, 0x2000000L);
         case 116:
  -         return jjMoveStringLiteralDfa2_2(active0, 0x2000000000L);
  +         return jjMoveStringLiteralDfa2_2(active0, 0x1000000000L);
         default :
            break;
      }
  @@ -461,24 +458,22 @@
      switch(curChar)
      {
         case 99:
  -         return jjMoveStringLiteralDfa3_2(active0, 0x40000000L);
  +         return jjMoveStringLiteralDfa3_2(active0, 0x20000000L);
         case 100:
  -         if ((active0 & 0x10000000L) != 0L)
  -            return jjStopAtPos(2, 28);
  +         if ((active0 & 0x8000000L) != 0L)
  +            return jjStopAtPos(2, 27);
            break;
  -      case 101:
  -         return jjMoveStringLiteralDfa3_2(active0, 0x8000000L);
         case 108:
            return jjMoveStringLiteralDfa3_2(active0, 0x4000000L);
         case 111:
  -         return jjMoveStringLiteralDfa3_2(active0, 0x2000000000L);
  +         return jjMoveStringLiteralDfa3_2(active0, 0x1000000000L);
         case 114:
  -         return jjMoveStringLiteralDfa3_2(active0, 0x880000000L);
  +         return jjMoveStringLiteralDfa3_2(active0, 0x440000000L);
         case 115:
  -         return jjMoveStringLiteralDfa3_2(active0, 0x600000000L);
  +         return jjMoveStringLiteralDfa3_2(active0, 0x300000000L);
         case 116:
  -         if ((active0 & 0x1000000000L) != 0L)
  -            return jjStopAtPos(2, 36);
  +         if ((active0 & 0x800000000L) != 0L)
  +            return jjStopAtPos(2, 35);
            break;
         case 117:
            return jjMoveStringLiteralDfa3_2(active0, 0x2000000L);
  @@ -501,22 +496,20 @@
         case 101:
            if ((active0 & 0x2000000L) != 0L)
               return jjStopAtPos(3, 25);
  -         else if ((active0 & 0x400000000L) != 0L)
  +         else if ((active0 & 0x200000000L) != 0L)
            {
  -            jjmatchedKind = 34;
  +            jjmatchedKind = 33;
               jjmatchedPos = 3;
            }
  -         return jjMoveStringLiteralDfa4_2(active0, 0xa00000000L);
  -      case 103:
  -         return jjMoveStringLiteralDfa4_2(active0, 0x8000000L);
  +         return jjMoveStringLiteralDfa4_2(active0, 0x500000000L);
         case 108:
  -         return jjMoveStringLiteralDfa4_2(active0, 0x40000000L);
  +         return jjMoveStringLiteralDfa4_2(active0, 0x20000000L);
         case 112:
  -         if ((active0 & 0x2000000000L) != 0L)
  -            return jjStopAtPos(3, 37);
  +         if ((active0 & 0x1000000000L) != 0L)
  +            return jjStopAtPos(3, 36);
            break;
         case 115:
  -         return jjMoveStringLiteralDfa4_2(active0, 0x84000000L);
  +         return jjMoveStringLiteralDfa4_2(active0, 0x44000000L);
         default :
            break;
      }
  @@ -534,17 +527,17 @@
      switch(curChar)
      {
         case 97:
  -         return jjMoveStringLiteralDfa5_2(active0, 0x800000000L);
  +         return jjMoveStringLiteralDfa5_2(active0, 0x400000000L);
         case 101:
            if ((active0 & 0x4000000L) != 0L)
               return jjStopAtPos(4, 26);
  -         else if ((active0 & 0x80000000L) != 0L)
  -            return jjStopAtPos(4, 31);
  +         else if ((active0 & 0x40000000L) != 0L)
  +            return jjStopAtPos(4, 30);
            break;
         case 105:
  -         return jjMoveStringLiteralDfa5_2(active0, 0x208000000L);
  +         return jjMoveStringLiteralDfa5_2(active0, 0x100000000L);
         case 117:
  -         return jjMoveStringLiteralDfa5_2(active0, 0x40000000L);
  +         return jjMoveStringLiteralDfa5_2(active0, 0x20000000L);
         default :
            break;
      }
  @@ -562,16 +555,12 @@
      switch(curChar)
      {
         case 99:
  -         return jjMoveStringLiteralDfa6_2(active0, 0x800000000L);
  +         return jjMoveStringLiteralDfa6_2(active0, 0x400000000L);
         case 100:
  -         return jjMoveStringLiteralDfa6_2(active0, 0x40000000L);
  +         return jjMoveStringLiteralDfa6_2(active0, 0x20000000L);
         case 102:
  -         if ((active0 & 0x200000000L) != 0L)
  -            return jjStopAtPos(5, 33);
  -         break;
  -      case 110:
  -         if ((active0 & 0x8000000L) != 0L)
  -            return jjStopAtPos(5, 27);
  +         if ((active0 & 0x100000000L) != 0L)
  +            return jjStopAtPos(5, 32);
            break;
         default :
            break;
  @@ -590,12 +579,12 @@
      switch(curChar)
      {
         case 101:
  -         if ((active0 & 0x40000000L) != 0L)
  -            return jjStopAtPos(6, 30);
  +         if ((active0 & 0x20000000L) != 0L)
  +            return jjStopAtPos(6, 29);
            break;
         case 104:
  -         if ((active0 & 0x800000000L) != 0L)
  -            return jjStopAtPos(6, 35);
  +         if ((active0 & 0x400000000L) != 0L)
  +            return jjStopAtPos(6, 34);
            break;
         default :
            break;
  @@ -624,8 +613,8 @@
                  case 1:
                     if ((0x3ff000000000000L & l) != 0L)
                     {
  -                     if (kind > 39)
  -                        kind = 39;
  +                     if (kind > 38)
  +                        kind = 38;
                        jjCheckNAdd(0);
                     }
                     else if (curChar == 34)
  @@ -634,8 +623,8 @@
                  case 0:
                     if ((0x3ff000000000000L & l) == 0L)
                        break;
  -                  if (kind > 39)
  -                     kind = 39;
  +                  if (kind > 38)
  +                     kind = 38;
                     jjCheckNAdd(0);
                     break;
                  case 2:
  @@ -643,8 +632,8 @@
                        jjCheckNAddTwoStates(2, 3);
                     break;
                  case 3:
  -                  if (curChar == 34 && kind > 40)
  -                     kind = 40;
  +                  if (curChar == 34 && kind > 39)
  +                     kind = 39;
                     break;
                  default : break;
               }
  @@ -726,9 +715,9 @@
         case 41:
            return jjStopAtPos(0, 2);
         case 44:
  -         return jjStopAtPos(0, 48);
  -      case 46:
            return jjStopAtPos(0, 47);
  +      case 46:
  +         return jjStopAtPos(0, 46);
         default :
            return jjMoveNfa_0(0, 0);
      }
  @@ -759,15 +748,15 @@
                  case 1:
                     if ((0x3ff200000000000L & l) == 0L)
                        break;
  -                  if (kind > 45)
  -                     kind = 45;
  +                  if (kind > 44)
  +                     kind = 44;
                     jjstateSet[jjnewStateCnt++] = 1;
                     break;
                  case 4:
                     if ((0x3ff200000000000L & l) == 0L)
                        break;
  -                  if (kind > 46)
  -                     kind = 46;
  +                  if (kind > 45)
  +                     kind = 45;
                     jjstateSet[jjnewStateCnt++] = 4;
                     break;
                  default : break;
  @@ -784,29 +773,29 @@
                  case 0:
                     if ((0x7fffffe07fffffeL & l) == 0L)
                        break;
  -                  if (kind > 45)
  -                     kind = 45;
  +                  if (kind > 44)
  +                     kind = 44;
                     jjCheckNAdd(1);
                     break;
                  case 1:
                     if ((0x7fffffe87fffffeL & l) == 0L)
                        break;
  -                  if (kind > 45)
  -                     kind = 45;
  +                  if (kind > 44)
  +                     kind = 44;
                     jjCheckNAdd(1);
                     break;
                  case 3:
                     if ((0x7fffffe07fffffeL & l) == 0L)
                        break;
  -                  if (kind > 46)
  -                     kind = 46;
  +                  if (kind > 45)
  +                     kind = 45;
                     jjCheckNAdd(4);
                     break;
                  case 4:
                     if ((0x7fffffe87fffffeL & l) == 0L)
                        break;
  -                  if (kind > 46)
  -                     kind = 46;
  +                  if (kind > 45)
  +                     kind = 45;
                     jjCheckNAdd(4);
                     break;
                  default : break;
  @@ -846,7 +835,7 @@
   "\52", "\57", "\45", "\46\46", "\174\174", "\74", "\74\75", "\76", "\76\75", 
   "\75\75", "\41\75", "\41", null, null, null, null, null, null, null, null, null, null, 
   null, null, null, null, null, null, null, null, null, null, null, null, null, null, 
  -null, null, null, };
  +null, null, };
   public static final String[] lexStateNames = {
      "REFERENCE", 
      "EXPRESSION", 
  @@ -855,17 +844,16 @@
   };
   public static final int[] jjnewLexState = {
      -1, -1, -1, 0, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
  -   -1, -1, 3, 3, -1, -1, -1, -1, -1, 3, -1, -1, -1, -1, 3, -1, 3, -1, -1, -1, -1, -1, -1, -1, -1, 
  -   -1, 
  +   -1, -1, 3, -1, -1, -1, -1, -1, 3, -1, -1, -1, -1, 3, -1, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
   };
   static final long[] jjtoToken = {
  -   0x5e1bffffffc07L, 
  +   0x2f0dffffffc07L, 
   };
   static final long[] jjtoSkip = {
  -   0x20200000003e0L, 
  +   0x10100000003e0L, 
   };
   static final long[] jjtoSpecial = {
  -   0x2020000000020L, 
  +   0x1010000000020L, 
   };
   static final long[] jjtoMore = {
      0x18L, 
  @@ -968,9 +956,9 @@
            jjmatchedKind = 0x7fffffff;
            jjmatchedPos = 0;
            curPos = jjMoveStringLiteralDfa0_0();
  -         if (jjmatchedPos == 0 && jjmatchedKind > 49)
  +         if (jjmatchedPos == 0 && jjmatchedKind > 48)
            {
  -            jjmatchedKind = 49;
  +            jjmatchedKind = 48;
            }
            break;
          case 1:
  @@ -987,9 +975,9 @@
            jjmatchedKind = 0x7fffffff;
            jjmatchedPos = 0;
            curPos = jjMoveStringLiteralDfa0_2();
  -         if (jjmatchedPos == 0 && jjmatchedKind > 41)
  +         if (jjmatchedPos == 0 && jjmatchedKind > 40)
            {
  -            jjmatchedKind = 41;
  +            jjmatchedKind = 40;
            }
            break;
          case 3:
  @@ -1071,7 +1059,7 @@
   {
      switch(jjmatchedKind)
      {
  -      case 49 :
  +      case 48 :
            if (image == null)
               image = new StringBuffer(new String(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1))));
            else
  @@ -1085,7 +1073,12 @@
                   inReference = false;
   
                   if (inDirective)
  +                {
  +                    if (inForeach)
  +                        inDirective = false;
  +
                       SwitchTo(DIRECTIVE);
  +                }
                   else
                       SwitchTo(DEFAULT);
               }
  @@ -1156,14 +1149,15 @@
               image = new StringBuffer(new String(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1))));
            else
               image.append(new String(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1))));
  -                        inDirective = false;
  +        inDirective = false;
  +        inForeach = false;
            break;
  -      case 28 :
  +      case 29 :
           if (image == null)
               image = new StringBuffer(new String(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1))));
            else
               image.append(new String(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1))));
  -                  inDirective = false;
  +        incMode = true;
            break;
         case 30 :
           if (image == null)
  @@ -1172,14 +1166,14 @@
               image.append(new String(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1))));
           incMode = true;
            break;
  -      case 31 :
  +      case 34 :
           if (image == null)
               image = new StringBuffer(new String(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1))));
            else
               image.append(new String(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1))));
  -        incMode = true;
  +                                     inForeach = true;
            break;
  -      case 37 :
  +      case 36 :
           if (image == null)
               image = new StringBuffer(new String(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1))));
            else
  @@ -1187,7 +1181,7 @@
           matchedToken.kind = EOF;
           fileDepth = 0;
            break;
  -      case 40 :
  +      case 39 :
           if (image == null)
               image = new StringBuffer(new String(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1))));
            else