velocity-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From by...@apache.org
Subject svn commit: r745315 [1/3] - in /velocity/engine/branches/2.0_Exp: src/java/org/apache/velocity/ src/java/org/apache/velocity/runtime/ src/java/org/apache/velocity/runtime/defaults/ src/java/org/apache/velocity/runtime/directive/ src/java/org/apache/vel...
Date Wed, 18 Feb 2009 00:39:06 GMT
Author: byron
Date: Wed Feb 18 00:39:05 2009
New Revision: 745315

URL: http://svn.apache.org/viewvc?rev=745315&view=rev
Log:
VELOCITY-698 #stop(parse) will now stop rendering within the current parsing unit. Convert
#stop to a directive

Added:
    velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/directive/Stop.java
  (contents, props changed)
      - copied, changed from r744610, velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/parser/node/ASTStop.java
    velocity/engine/branches/2.0_Exp/test/stop/parse2.vm
Removed:
    velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/parser/node/ASTStop.java
Modified:
    velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/Template.java
    velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/RuntimeInstance.java
    velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/defaults/directive.properties
    velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/directive/Break.java
    velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/directive/Evaluate.java
    velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/directive/Parse.java
    velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/parser/Parser.java
    velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/parser/ParserConstants.java
    velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/parser/ParserTokenManager.java
    velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/parser/ParserTreeConstants.java
    velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/parser/node/ParserVisitor.java
    velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/visitor/BaseVisitor.java
    velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/visitor/NodeViewMode.java
    velocity/engine/branches/2.0_Exp/src/parser/Parser.jjt
    velocity/engine/branches/2.0_Exp/src/test/org/apache/velocity/test/GlobalTestCase.java
    velocity/engine/branches/2.0_Exp/src/test/org/apache/velocity/test/StopDirectiveTestCase.java

Modified: velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/Template.java
URL: http://svn.apache.org/viewvc/velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/Template.java?rev=745315&r1=745314&r2=745315&view=diff
==============================================================================
--- velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/Template.java (original)
+++ velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/Template.java Wed Feb 18
00:39:05 2009
@@ -34,9 +34,9 @@
 import org.apache.velocity.exception.ResourceNotFoundException;
 import org.apache.velocity.exception.TemplateInitException;
 import org.apache.velocity.exception.VelocityException;
+import org.apache.velocity.runtime.directive.Stop.StopThrowable;
 import org.apache.velocity.runtime.parser.ParseException;
 import org.apache.velocity.runtime.parser.node.SimpleNode;
-import org.apache.velocity.runtime.parser.node.ASTStop.StopThrowable;
 import org.apache.velocity.runtime.resource.Resource;
 import org.apache.velocity.runtime.resource.ResourceManager;
 
@@ -341,10 +341,10 @@
             }
             catch (StopThrowable st)
             {
-              // The stop throwable is thrown by ASTStop (the #stop directive)
+              // The stop throwable is thrown by Stop (the #stop directive)
               // The intent of the stop directive is to halt processing of the
               // the template, so we throw a Throwable that will short circuit
-              // everthing between the call to render, and ASTStop. We just needed to 
+              // everthing between the call to render, and Stop. We just needed to 
               // Catch the exception, nothing else to do.              
             }
             catch (IOException e)

Modified: velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/RuntimeInstance.java
URL: http://svn.apache.org/viewvc/velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/RuntimeInstance.java?rev=745315&r1=745314&r2=745315&view=diff
==============================================================================
--- velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/RuntimeInstance.java
(original)
+++ velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/RuntimeInstance.java
Wed Feb 18 00:39:05 2009
@@ -51,13 +51,13 @@
 import org.apache.velocity.exception.VelocityException;
 import org.apache.velocity.runtime.directive.Directive;
 import org.apache.velocity.runtime.directive.Macro;
+import org.apache.velocity.runtime.directive.Stop.StopThrowable;
 import org.apache.velocity.runtime.log.Log;
 import org.apache.velocity.runtime.log.LogManager;
 import org.apache.velocity.runtime.parser.ParseException;
 import org.apache.velocity.runtime.parser.Parser;
 import org.apache.velocity.runtime.parser.node.Node;
 import org.apache.velocity.runtime.parser.node.SimpleNode;
-import org.apache.velocity.runtime.parser.node.ASTStop.StopThrowable;
 import org.apache.velocity.runtime.resource.ContentResource;
 import org.apache.velocity.runtime.resource.ResourceManager;
 import org.apache.velocity.util.ClassUtils;

Modified: velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/defaults/directive.properties
URL: http://svn.apache.org/viewvc/velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/defaults/directive.properties?rev=745315&r1=745314&r2=745315&view=diff
==============================================================================
--- velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/defaults/directive.properties
(original)
+++ velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/defaults/directive.properties
Wed Feb 18 00:39:05 2009
@@ -21,3 +21,4 @@
 directive.5=org.apache.velocity.runtime.directive.Evaluate
 directive.6=org.apache.velocity.runtime.directive.Break
 directive.7=org.apache.velocity.runtime.directive.Define
+directive.8=org.apache.velocity.runtime.directive.Stop

Modified: velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/directive/Break.java
URL: http://svn.apache.org/viewvc/velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/directive/Break.java?rev=745315&r1=745314&r2=745315&view=diff
==============================================================================
--- velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/directive/Break.java
(original)
+++ velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/directive/Break.java
Wed Feb 18 00:39:05 2009
@@ -27,10 +27,7 @@
 import org.apache.velocity.exception.MethodInvocationException;
 import org.apache.velocity.exception.ParseErrorException;
 import org.apache.velocity.exception.ResourceNotFoundException;
-import org.apache.velocity.exception.TemplateInitException;
-import org.apache.velocity.runtime.RuntimeServices;
 import org.apache.velocity.runtime.parser.ParseException;
-import org.apache.velocity.runtime.parser.ParserTreeConstants;
 import org.apache.velocity.runtime.parser.Token;
 import org.apache.velocity.runtime.parser.node.Node;
 
@@ -62,35 +59,13 @@
     }
 
     /**
-     *  simple init - init the tree and get the elementKey from
-     *  the AST
-     * @param rs
-     * @param context
-     * @param node
-     * @throws TemplateInitException
-     */
-    public void init(RuntimeServices rs, InternalContextAdapter context, Node node)
-        throws TemplateInitException
-    {
-        super.init(rs, context, node);
-    }
-
-    /**
      * Break directive does not actually do any rendering. 
      * 
      * This directive throws a BreakException (RuntimeException) which
      * signals foreach directive to break out of the loop. Note that this
      * directive does not verify that it is being called inside a foreach
      * loop.
-     * 
-     * @param context
-     * @param writer
-     * @param node
      * @return true if the directive rendered successfully.
-     * @throws IOException
-     * @throws MethodInvocationException
-     * @throws ResourceNotFoundException
-     * @throws ParseErrorException
      */
     public boolean render(InternalContextAdapter context,
                            Writer writer, Node node)

Modified: velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/directive/Evaluate.java
URL: http://svn.apache.org/viewvc/velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/directive/Evaluate.java?rev=745315&r1=745314&r2=745315&view=diff
==============================================================================
--- velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/directive/Evaluate.java
(original)
+++ velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/directive/Evaluate.java
Wed Feb 18 00:39:05 2009
@@ -31,11 +31,11 @@
 import org.apache.velocity.exception.ResourceNotFoundException;
 import org.apache.velocity.exception.TemplateInitException;
 import org.apache.velocity.runtime.RuntimeServices;
+import org.apache.velocity.runtime.directive.Stop.StopThrowable;
 import org.apache.velocity.runtime.parser.ParseException;
 import org.apache.velocity.runtime.parser.ParserTreeConstants;
 import org.apache.velocity.runtime.parser.node.Node;
 import org.apache.velocity.runtime.parser.node.SimpleNode;
-import org.apache.velocity.runtime.parser.node.ASTStop.StopThrowable;
 import org.apache.velocity.util.introspection.Info;
 
 /**

Modified: velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/directive/Parse.java
URL: http://svn.apache.org/viewvc/velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/directive/Parse.java?rev=745315&r1=745314&r2=745315&view=diff
==============================================================================
--- velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/directive/Parse.java
(original)
+++ velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/directive/Parse.java
Wed Feb 18 00:39:05 2009
@@ -273,6 +273,12 @@
                 ((SimpleNode) t.getData()).render(vmc, writer);
             }
         }
+        catch(Stop.StopParseThrowable spt)
+        {
+           // A #stop(parse) directive call was made in the parsed template
+           // So we simply catch the throwable, and resume.  
+           // See the Stop.java directive for more info.
+        }
         /**
          * pass through application level runtime exceptions
          */

Copied: velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/directive/Stop.java
(from r744610, velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/parser/node/ASTStop.java)
URL: http://svn.apache.org/viewvc/velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/directive/Stop.java?p2=velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/directive/Stop.java&p1=velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/parser/node/ASTStop.java&r1=744610&r2=745315&rev=745315&view=diff
==============================================================================
--- velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/parser/node/ASTStop.java
(original)
+++ velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/directive/Stop.java
Wed Feb 18 00:39:05 2009
@@ -1,4 +1,4 @@
-package org.apache.velocity.runtime.parser.node;
+package org.apache.velocity.runtime.directive;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
@@ -19,78 +19,121 @@
  * under the License.    
  */
 
-import java.io.IOException;
 import java.io.Writer;
+import java.util.ArrayList;
 
 import org.apache.velocity.context.InternalContextAdapter;
-import org.apache.velocity.exception.MethodInvocationException;
-import org.apache.velocity.exception.ParseErrorException;
-import org.apache.velocity.exception.ResourceNotFoundException;
-import org.apache.velocity.runtime.parser.Parser;
+import org.apache.velocity.exception.TemplateInitException;
+import org.apache.velocity.exception.VelocityException;
+import org.apache.velocity.runtime.RuntimeServices;
+import org.apache.velocity.runtime.log.Log;
+import org.apache.velocity.runtime.parser.ParseException;
+import org.apache.velocity.runtime.parser.ParserTreeConstants;
+import org.apache.velocity.runtime.parser.Token;
+import org.apache.velocity.runtime.parser.node.Node;
 
 /**
- * This class is responsible for handling the #stop directive
- *
- * Please look at the Parser.jjt file which is
- * what controls the generation of this class.
- *
- * @author <a href="mailto:wglass@forio.com">Will Glass-Husain</a>
- * @version $Id$
- * @since 1.5
+ * This class implements the #stop directive which allows
+ * a user to stop rendering the current template.  the #stop directive
+ * with no arguments will immediately stop rendering the current template
+ * If the stop directive is called with the 'parse' argument, e.g.; #stop(parse),
+ * then rendering will end within the current parsing unit, but resume at 
+ * the #parse directive call.  If not within a parsing unit, then #stop will
+ * behave as if called with no parameters.
  */
-public class ASTStop extends SimpleNode
-{
+public class Stop extends Directive
+{  
+  
     /**
-     * @param id
+     * Set to true if called like #stop(parse)
      */
-    public ASTStop(int id)
-    {
-        super(id);
-    }
+    private boolean parseStop = false;
 
     /**
-     * @param p
-     * @param id
+     * Return name of this directive.
+     * @return The name of this directive.
      */
-    public ASTStop(Parser p, int id)
+    public String getName()
     {
-        super(p, id);
+        return "stop";
     }
-
+  
     /**
-     * @see org.apache.velocity.runtime.parser.node.SimpleNode#jjtAccept(org.apache.velocity.runtime.parser.node.ParserVisitor,
java.lang.Object)
+     * Return type of this directive.
+     * @return The type of this directive.
      */
-    public Object jjtAccept(ParserVisitor visitor, Object data)
+    public int getType()
     {
-        return visitor.visit(this, data);
+        return LINE;
     }
-
-    /**
-     * Do not output anything, just shut off the rendering.
-     * @param context
-     * @param writer
-     * @return Always true.
-     * @throws IOException
-     * @throws MethodInvocationException
-     * @throws ParseErrorException
-     * @throws ResourceNotFoundException
-     */
-    public boolean render( InternalContextAdapter context, Writer writer)
-        throws IOException, MethodInvocationException, ParseErrorException, ResourceNotFoundException
+  
+    @Override
+    public void init(RuntimeServices rs, InternalContextAdapter context,
+        Node node) throws TemplateInitException
     {
-        // The top level calls that render an AST node tree catch this Throwable.  By throwing
-        // Here we terminate rendering of this node tree.
-        throw new StopThrowable();        
+        super.init(rs, context, node);
+        if (node.jjtGetNumChildren() == 1)  // first child is "parse"
+        {  
+            String keyword = node.jjtGetChild(0).getFirstToken().image;
+            if (!keyword.equals("parse"))
+            {
+              throw new VelocityException("The #stop directive only accepts the 'parse' keyword
at "
+                 + Log.formatFileString(this));
+            }
+            
+            parseStop = true;
+        }
     }
     
+    @Override
+    public boolean render(InternalContextAdapter context, Writer writer, Node node)
+    {
+        if (parseStop)
+        {
+            // if called like #stop(parse) then throw this throwable that will be
+            // caught by the Parse.java directive.
+            throw new StopParseThrowable();            
+        }
+        else
+        {
+            // This stop directive was called without arguments, so throw a throwable
+            // that will be caught the Template.
+            throw new StopThrowable();          
+        }
+    }
+        
     /**
      * We select to overide Error here intead of RuntimeInstance because there are
-     * certain nodes that catch RuntimeException when rendering there children, and log
-     * the event to error.  But of course in the case that the template renders an ASTStop
+     * certain nodes that catch RuntimeException when rendering their children, and log
+     * the event to error.  But of course in the case that the template renders a Stop
      * node we don't want this to happen.
      */
     public static class StopThrowable extends Error
     {      
     }
+  
+    /**
+     * Exception caught by <code>Parse.java</code> parse directive so that rendering
+     * will stop within a given parsing unit.  Extend StopThrowable so that if the
+     * This is not caught by <code>Parse.java</code> then it will be caught at
the 
+     * templat level.
+     */
+    public static class StopParseThrowable extends StopThrowable
+    {      
+    }
+    
+    /**
+     * Called by the parser to validate the argument types
+     */
+    public void checkArgs(ArrayList<Integer> argtypes,  Token t, String templateName)
+      throws ParseException
+    {
+        if (argtypes.size() > 1 ||
+            (argtypes.size() == 1 && argtypes.get(0) != ParserTreeConstants.JJTWORD))
+        {
+            throw new MacroParseException("Only the 'parse' keyword allowed as an argument",
+               templateName, t);
+        }
+    }    
 }
 

Propchange: velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/directive/Stop.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/directive/Stop.java
------------------------------------------------------------------------------
    svn:keywords = Id Author Date Revision

Propchange: velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/directive/Stop.java
------------------------------------------------------------------------------
    svn:mergeinfo = 

Modified: velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/parser/Parser.java
URL: http://svn.apache.org/viewvc/velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/parser/Parser.java?rev=745315&r1=745314&r2=745315&view=diff
==============================================================================
--- velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/parser/Parser.java
(original)
+++ velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/parser/Parser.java
Wed Feb 18 00:39:05 2009
@@ -221,7 +221,6 @@
                 || dirTag.equals("set")
                 || dirTag.equals("else")
                 || dirTag.equals("elseif")
-                || dirTag.equals("stop")
             )
             {
                 bRecognizedDirective = true;
@@ -351,7 +350,6 @@
         case TEXTBLOCK:
         case STRING_LITERAL:
         case IF_DIRECTIVE:
-        case STOP_DIRECTIVE:
         case INTEGER_LITERAL:
         case FLOATING_POINT_LITERAL:
         case WORD:
@@ -404,9 +402,6 @@
     case IF_DIRECTIVE:
       IfStatement();
       break;
-    case STOP_DIRECTIVE:
-      StopStatement();
-      break;
     default:
       jj_la1[1] = jj_gen;
       if (jj_2_1(2)) {
@@ -526,7 +521,6 @@
             case ELSE_DIRECTIVE :
             case ELSEIF_DIRECTIVE :
             case END :
-            case STOP_DIRECTIVE :
                 control = true;
                 break;
         }
@@ -1007,7 +1001,6 @@
           case TEXTBLOCK:
           case STRING_LITERAL:
           case IF_DIRECTIVE:
-          case STOP_DIRECTIVE:
           case INTEGER_LITERAL:
           case FLOATING_POINT_LITERAL:
           case WORD:
@@ -1786,7 +1779,6 @@
           case TEXTBLOCK:
           case STRING_LITERAL:
           case IF_DIRECTIVE:
-          case STOP_DIRECTIVE:
           case INTEGER_LITERAL:
           case FLOATING_POINT_LITERAL:
           case WORD:
@@ -1901,7 +1893,6 @@
           case TEXTBLOCK:
           case STRING_LITERAL:
           case IF_DIRECTIVE:
-          case STOP_DIRECTIVE:
           case INTEGER_LITERAL:
           case FLOATING_POINT_LITERAL:
           case WORD:
@@ -1999,7 +1990,6 @@
           case TEXTBLOCK:
           case STRING_LITERAL:
           case IF_DIRECTIVE:
-          case STOP_DIRECTIVE:
           case INTEGER_LITERAL:
           case FLOATING_POINT_LITERAL:
           case WORD:
@@ -2251,27 +2241,6 @@
     }
   }
 
-/**
- * This method corresponds to the #stop
- * directive which just simulates and EOF
- * so that parsing stops. The #stop directive
- * is useful for end-user debugging
- * purposes.
- */
-  final public void StopStatement() throws ParseException {
-                                /*@bgen(jjtree) #Stop( 0) */
-  ASTStop jjtn000 = new ASTStop(this, JJTSTOP);
-  boolean jjtc000 = true;
-  jjtree.openNodeScope(jjtn000);
-    try {
-      jj_consume_token(STOP_DIRECTIVE);
-    } finally {
-      if (jjtc000) {
-        jjtree.closeNodeScope(jjtn000,  0);
-      }
-    }
-  }
-
 /* -----------------------------------------------------------------------
  *
  *  Expression Syntax
@@ -3015,13 +2984,32 @@
     finally { jj_save(12, xla); }
   }
 
-  final private boolean jj_3_1() {
+  final private boolean jj_3R_25() {
     if (jj_3R_24()) return true;
     return false;
   }
 
-  final private boolean jj_3R_39() {
-    if (jj_3R_42()) return true;
+  final private boolean jj_3R_80() {
+    Token xsp;
+    xsp = jj_scanpos;
+    if (jj_scan_token(33)) jj_scanpos = xsp;
+    return false;
+  }
+
+  final private boolean jj_3_6() {
+    if (jj_3R_31()) return true;
+    if (jj_scan_token(COLON)) return true;
+    if (jj_3R_31()) return true;
+    Token xsp;
+    while (true) {
+      xsp = jj_scanpos;
+      if (jj_3R_103()) { jj_scanpos = xsp; break; }
+    }
+    return false;
+  }
+
+  final private boolean jj_3_1() {
+    if (jj_3R_24()) return true;
     return false;
   }
 
@@ -3041,7 +3029,7 @@
     xsp = jj_scanpos;
     if (jj_scan_token(9)) {
     jj_scanpos = xsp;
-    if (jj_scan_token(72)) return true;
+    if (jj_scan_token(71)) return true;
     }
     return false;
   }
@@ -3051,13 +3039,13 @@
     return false;
   }
 
-  final private boolean jj_3R_52() {
-    if (jj_3R_73()) return true;
+  final private boolean jj_3R_39() {
+    if (jj_3R_42()) return true;
     return false;
   }
 
-  final private boolean jj_3R_38() {
-    if (jj_3R_24()) return true;
+  final private boolean jj_3R_52() {
+    if (jj_3R_73()) return true;
     return false;
   }
 
@@ -3097,6 +3085,11 @@
     return false;
   }
 
+  final private boolean jj_3R_38() {
+    if (jj_3R_24()) return true;
+    return false;
+  }
+
   final private boolean jj_3R_48() {
     if (jj_3R_69()) return true;
     return false;
@@ -3130,22 +3123,6 @@
     return false;
   }
 
-  final private boolean jj_3_13() {
-    if (jj_scan_token(LBRACKET)) return true;
-    Token xsp;
-    xsp = jj_scanpos;
-    if (jj_scan_token(33)) jj_scanpos = xsp;
-    xsp = jj_scanpos;
-    if (jj_3R_38()) {
-    jj_scanpos = xsp;
-    if (jj_3R_39()) return true;
-    }
-    xsp = jj_scanpos;
-    if (jj_scan_token(33)) jj_scanpos = xsp;
-    if (jj_scan_token(DOUBLEDOT)) return true;
-    return false;
-  }
-
   final private boolean jj_3R_45() {
     if (jj_3R_67()) return true;
     return false;
@@ -3195,6 +3172,32 @@
     return false;
   }
 
+  final private boolean jj_3R_67() {
+    if (jj_scan_token(WORD)) return true;
+    return false;
+  }
+
+  final private boolean jj_3_13() {
+    if (jj_scan_token(LBRACKET)) return true;
+    Token xsp;
+    xsp = jj_scanpos;
+    if (jj_scan_token(33)) jj_scanpos = xsp;
+    xsp = jj_scanpos;
+    if (jj_3R_38()) {
+    jj_scanpos = xsp;
+    if (jj_3R_39()) return true;
+    }
+    xsp = jj_scanpos;
+    if (jj_scan_token(33)) jj_scanpos = xsp;
+    if (jj_scan_token(DOUBLEDOT)) return true;
+    return false;
+  }
+
+  final private boolean jj_3R_63() {
+    if (jj_scan_token(IDENTIFIER)) return true;
+    return false;
+  }
+
   final private boolean jj_3R_91() {
     if (jj_scan_token(LPAREN)) return true;
     return false;
@@ -3210,6 +3213,11 @@
     return false;
   }
 
+  final private boolean jj_3_11() {
+    if (jj_3R_35()) return true;
+    return false;
+  }
+
   final private boolean jj_3R_88() {
     if (jj_3R_72()) return true;
     return false;
@@ -3230,13 +3238,35 @@
     return false;
   }
 
-  final private boolean jj_3R_84() {
+  final private boolean jj_3R_28() {
+    if (jj_scan_token(SINGLE_LINE_COMMENT_START)) return true;
+    Token xsp;
+    xsp = jj_scanpos;
+    if (jj_scan_token(27)) jj_scanpos = xsp;
+    return false;
+  }
+
+  final private boolean jj_3_4() {
+    Token xsp;
+    xsp = jj_scanpos;
+    if (jj_scan_token(33)) jj_scanpos = xsp;
+    xsp = jj_scanpos;
+    if (jj_3R_27()) jj_scanpos = xsp;
+    xsp = jj_scanpos;
+    if (jj_3_5()) {
+    jj_scanpos = xsp;
+    if (jj_3R_28()) return true;
+    }
+    return false;
+  }
+
+  final private boolean jj_3R_33() {
     if (jj_3R_42()) return true;
     return false;
   }
 
-  final private boolean jj_3R_67() {
-    if (jj_scan_token(WORD)) return true;
+  final private boolean jj_3R_84() {
+    if (jj_3R_42()) return true;
     return false;
   }
 
@@ -3245,13 +3275,18 @@
     return false;
   }
 
+  final private boolean jj_3_9() {
+    if (jj_3R_35()) return true;
+    return false;
+  }
+
   final private boolean jj_3R_82() {
     if (jj_3R_68()) return true;
     return false;
   }
 
-  final private boolean jj_3R_63() {
-    if (jj_scan_token(IDENTIFIER)) return true;
+  final private boolean jj_3R_77() {
+    if (jj_3R_76()) return true;
     return false;
   }
 
@@ -3291,8 +3326,24 @@
     return false;
   }
 
-  final private boolean jj_3_11() {
-    if (jj_3R_35()) return true;
+  final private boolean jj_3R_100() {
+    if (jj_scan_token(COMMA)) return true;
+    if (jj_3R_31()) return true;
+    return false;
+  }
+
+  final private boolean jj_3R_68() {
+    if (jj_scan_token(STRING_LITERAL)) return true;
+    return false;
+  }
+
+  final private boolean jj_3R_74() {
+    if (jj_scan_token(FALSE)) return true;
+    return false;
+  }
+
+  final private boolean jj_3R_66() {
+    if (jj_3R_76()) return true;
     return false;
   }
 
@@ -3320,64 +3371,6 @@
     return false;
   }
 
-  final private boolean jj_3R_28() {
-    if (jj_scan_token(SINGLE_LINE_COMMENT_START)) return true;
-    Token xsp;
-    xsp = jj_scanpos;
-    if (jj_scan_token(27)) jj_scanpos = xsp;
-    return false;
-  }
-
-  final private boolean jj_3_4() {
-    Token xsp;
-    xsp = jj_scanpos;
-    if (jj_scan_token(33)) jj_scanpos = xsp;
-    xsp = jj_scanpos;
-    if (jj_3R_27()) jj_scanpos = xsp;
-    xsp = jj_scanpos;
-    if (jj_3_5()) {
-    jj_scanpos = xsp;
-    if (jj_3R_28()) return true;
-    }
-    return false;
-  }
-
-  final private boolean jj_3R_33() {
-    if (jj_3R_42()) return true;
-    return false;
-  }
-
-  final private boolean jj_3_9() {
-    if (jj_3R_35()) return true;
-    return false;
-  }
-
-  final private boolean jj_3R_77() {
-    if (jj_3R_76()) return true;
-    return false;
-  }
-
-  final private boolean jj_3R_100() {
-    if (jj_scan_token(COMMA)) return true;
-    if (jj_3R_31()) return true;
-    return false;
-  }
-
-  final private boolean jj_3R_68() {
-    if (jj_scan_token(STRING_LITERAL)) return true;
-    return false;
-  }
-
-  final private boolean jj_3R_74() {
-    if (jj_scan_token(FALSE)) return true;
-    return false;
-  }
-
-  final private boolean jj_3R_66() {
-    if (jj_3R_76()) return true;
-    return false;
-  }
-
   final private boolean jj_3R_42() {
     if (jj_scan_token(INTEGER_LITERAL)) return true;
     return false;
@@ -3745,30 +3738,6 @@
     return false;
   }
 
-  final private boolean jj_3R_25() {
-    if (jj_3R_24()) return true;
-    return false;
-  }
-
-  final private boolean jj_3R_80() {
-    Token xsp;
-    xsp = jj_scanpos;
-    if (jj_scan_token(33)) jj_scanpos = xsp;
-    return false;
-  }
-
-  final private boolean jj_3_6() {
-    if (jj_3R_31()) return true;
-    if (jj_scan_token(COLON)) return true;
-    if (jj_3R_31()) return true;
-    Token xsp;
-    while (true) {
-      xsp = jj_scanpos;
-      if (jj_3R_103()) { jj_scanpos = xsp; break; }
-    }
-    return false;
-  }
-
   public ParserTokenManager token_source;
   public Token token, jj_nt;
   private int jj_ntk;
@@ -3790,10 +3759,10 @@
       jj_la1_0 = new int[] {0x7781ec00,0x0,0x7781ec00,0x8000000,0x30800000,0x0,0x108,0x0,0x0,0x0,0x0,0x20,0x0,0x0,0x8000000,0x800000,0x0,0x7781ec00,0x20,0x0,0x200,0x20,0x108,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x108,0x0,0x20,0x108,0x2,0x0,0x2,0x2,0x0,0x2,0x0,0x6000c00,0x0,0x7781ec00,0x0,0x0,0x0,0x7781ec00,0x0,0x7781ec00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x508,0x0,0x0,0x508,0x0,};
    }
    private static void jj_la1_1() {
-      jj_la1_1 = new int[] {0x1a400004,0x2400000,0x18000004,0x0,0x0,0x8000004,0x10000018,0x0,0x2,0x2,0x2,0x0,0x2,0x2,0x0,0x0,0x2,0x1a400004,0x0,0x2,0x0,0x0,0x1800001e,0x2,0x8000000,0x2,0x2,0x8000000,0x2,0x2,0x800001c,0x2,0x2,0x8000004,0x10000018,0x2,0x0,0x1800001e,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x18000004,0x2,0x1a400004,0x800000,0x800000,0x1000000,0x1a400004,0x2,0x1a400004,0x2,0x2,0x20,0x2,0x2,0x20,0x2,0x2,0x20,0x1000,0x800,0x60000,0x60000,0x1e000,0x1e000,0xc0,0xc0,0x700,0x700,0x2,0x1800001e,0x2,0x8000004,0x10000018,0x2,};
+      jj_la1_1 = new int[] {0x8c400004,0x400000,0x8c000004,0x0,0x0,0x84000004,0x8000018,0x80000000,0x2,0x2,0x2,0x0,0x2,0x2,0x0,0x0,0x2,0x8c400004,0x0,0x2,0x0,0x0,0xc00001e,0x2,0x4000000,0x2,0x2,0x4000000,0x2,0x2,0x400001c,0x2,0x2,0x4000004,0x8000018,0x2,0x0,0xc00001e,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc000004,0x2,0x8c400004,0x800000,0x800000,0x1000000,0x8c400004,0x2,0x8c400004,0x2,0x2,0x20,0x2,0x2,0x20,0x2,0x2,0x20,0x1000,0x800,0x60000,0x60000,0x1e000,0x1e000,0xc0,0xc0,0x700,0x700,0x2,0xc00001e,0x2,0x4000004,0x8000018,0x2,};
    }
    private static void jj_la1_2() {
-      jj_la1_2 = new int[] {0x9e3,0x0,0x9c3,0x0,0x0,0xa1,0x0,0x3,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x9e3,0x0,0x0,0x100,0x0,0xa0,0x0,0xa0,0x0,0x0,0xa0,0x0,0x0,0xa0,0x0,0x0,0x0,0xa0,0x0,0x0,0xa0,0x0,0x20,0x0,0x0,0x20,0x0,0xa0,0x9c0,0x0,0x9e3,0x0,0x0,0x0,0x9e3,0x0,0x9e3,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xa0,0x0,0xa0,0x0,0x0,};
+      jj_la1_2 = new int[] {0x4f1,0x0,0x4e1,0x0,0x0,0x50,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4f1,0x0,0x0,0x80,0x0,0x50,0x0,0x50,0x0,0x0,0x50,0x0,0x0,0x50,0x0,0x0,0x0,0x50,0x0,0x0,0x50,0x0,0x10,0x0,0x0,0x10,0x0,0x50,0x4e0,0x0,0x4f1,0x0,0x0,0x0,0x4f1,0x0,0x4f1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x50,0x0,0x50,0x0,0x0,};
    }
   final private JJCalls[] jj_2_rtns = new JJCalls[13];
   private boolean jj_rescan = false;
@@ -3944,8 +3913,8 @@
 
   public ParseException generateParseException() {
     jj_expentries.removeAllElements();
-    boolean[] la1tokens = new boolean[76];
-    for (int i = 0; i < 76; i++) {
+    boolean[] la1tokens = new boolean[75];
+    for (int i = 0; i < 75; i++) {
       la1tokens[i] = false;
     }
     if (jj_kind >= 0) {
@@ -3967,7 +3936,7 @@
         }
       }
     }
-    for (int i = 0; i < 76; i++) {
+    for (int i = 0; i < 75; i++) {
       if (la1tokens[i]) {
         jj_expentry = new int[1];
         jj_expentry[0] = i;

Modified: velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/parser/ParserConstants.java
URL: http://svn.apache.org/viewvc/velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/parser/ParserConstants.java?rev=745315&r1=745314&r2=745315&view=diff
==============================================================================
--- velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/parser/ParserConstants.java
(original)
+++ velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/parser/ParserConstants.java
Wed Feb 18 00:39:05 2009
@@ -55,25 +55,24 @@
   int IF_DIRECTIVE = 54;
   int ELSEIF_DIRECTIVE = 55;
   int ELSE_DIRECTIVE = 56;
-  int STOP_DIRECTIVE = 57;
-  int DIGIT = 58;
-  int INTEGER_LITERAL = 59;
-  int FLOATING_POINT_LITERAL = 60;
-  int EXPONENT = 61;
-  int LETTER = 62;
-  int DIRECTIVE_CHAR = 63;
-  int WORD = 64;
-  int BRACKETED_WORD = 65;
-  int ALPHA_CHAR = 66;
-  int ALPHANUM_CHAR = 67;
-  int IDENTIFIER_CHAR = 68;
-  int IDENTIFIER = 69;
-  int DOT = 70;
-  int LCURLY = 71;
-  int RCURLY = 72;
-  int REFERENCE_TERMINATOR = 73;
-  int DIRECTIVE_TERMINATOR = 74;
-  int EMPTY_INDEX = 75;
+  int DIGIT = 57;
+  int INTEGER_LITERAL = 58;
+  int FLOATING_POINT_LITERAL = 59;
+  int EXPONENT = 60;
+  int LETTER = 61;
+  int DIRECTIVE_CHAR = 62;
+  int WORD = 63;
+  int BRACKETED_WORD = 64;
+  int ALPHA_CHAR = 65;
+  int ALPHANUM_CHAR = 66;
+  int IDENTIFIER_CHAR = 67;
+  int IDENTIFIER = 68;
+  int DOT = 69;
+  int LCURLY = 70;
+  int RCURLY = 71;
+  int REFERENCE_TERMINATOR = 72;
+  int DIRECTIVE_TERMINATOR = 73;
+  int EMPTY_INDEX = 74;
 
   int REFERENCE = 0;
   int REFMODIFIER = 1;
@@ -146,7 +145,6 @@
     "<IF_DIRECTIVE>",
     "<ELSEIF_DIRECTIVE>",
     "<ELSE_DIRECTIVE>",
-    "<STOP_DIRECTIVE>",
     "<DIGIT>",
     "<INTEGER_LITERAL>",
     "<FLOATING_POINT_LITERAL>",



Mime
View raw message