geirm 01/01/02 21:25:18
Modified: src/java/org/apache/velocity/runtime/parser/node
ASTEQNode.java ASTElseIfStatement.java
ASTElseStatement.java ASTEscape.java
ASTEscapedDirective.java ASTExpression.java
Log:
No functional change. New context support in AST.
Revision Changes Path
1.2 +55 -2
jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTEQNode.java
Index: ASTEQNode.java
===================================================================
RCS file:
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTEQNode.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ASTEQNode.java 2000/10/20 19:14:02 1.1
+++ ASTEQNode.java 2001/01/03 05:25:17 1.2
@@ -1,8 +1,61 @@
/* Generated By:JJTree: Do not edit this line. ASTEQNode.java */
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2000 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact [EMAIL PROTECTED]
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.velocity.runtime.parser.node;
-import org.apache.velocity.Context;
+import org.apache.velocity.context.InternalContextAdapter;
import org.apache.velocity.runtime.parser.*;
public class ASTEQNode extends SimpleNode
@@ -23,7 +76,7 @@
return visitor.visit(this, data);
}
- public boolean evaluate(Context context)
+ public boolean evaluate( InternalContextAdapter context)
{
if (jjtGetChild(0).value(context) instanceof Boolean &&
((Boolean)jjtGetChild(0).value(context)).booleanValue() ==
1.6 +4 -4
jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTElseIfStatement.java
Index: ASTElseIfStatement.java
===================================================================
RCS file:
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTElseIfStatement.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ASTElseIfStatement.java 2000/12/19 14:41:52 1.5
+++ ASTElseIfStatement.java 2001/01/03 05:25:17 1.6
@@ -63,7 +63,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Geir Magnusson Jr.</a>
- * @version $Id: ASTElseIfStatement.java,v 1.5 2000/12/19 14:41:52 geirm Exp $
+ * @version $Id: ASTElseIfStatement.java,v 1.6 2001/01/03 05:25:17 geirm Exp $
*/
package org.apache.velocity.runtime.parser.node;
@@ -71,7 +71,7 @@
import java.io.Writer;
import java.io.IOException;
-import org.apache.velocity.Context;
+import org.apache.velocity.context.InternalContextAdapter;
import org.apache.velocity.runtime.parser.*;
public class ASTElseIfStatement extends SimpleNode
@@ -100,7 +100,7 @@
* where this node was originally asked to evaluate
* itself.
*/
- public boolean evaluate (Context context)
+ public boolean evaluate ( InternalContextAdapter context)
{
return jjtGetChild(0).evaluate(context);
}
@@ -108,7 +108,7 @@
/**
* renders the block
*/
- public boolean render(Context context, Writer writer)
+ public boolean render( InternalContextAdapter context, Writer writer)
throws IOException
{
return jjtGetChild(1).render( context, writer );
1.5 +4 -4
jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTElseStatement.java
Index: ASTElseStatement.java
===================================================================
RCS file:
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTElseStatement.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ASTElseStatement.java 2000/12/15 06:55:33 1.4
+++ ASTElseStatement.java 2001/01/03 05:25:17 1.5
@@ -63,7 +63,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Geir Magnusson Jr.</a>
- * @version $Id: ASTElseStatement.java,v 1.4 2000/12/15 06:55:33 jvanzyl Exp $
+ * @version $Id: ASTElseStatement.java,v 1.5 2001/01/03 05:25:17 geirm Exp $
*/
package org.apache.velocity.runtime.parser.node;
@@ -71,8 +71,8 @@
import java.io.Writer;
import java.io.IOException;
-import org.apache.velocity.Context;
-import org.apache.velocity.runtime.parser.*;
+import org.apache.velocity.context.InternalContextAdapter;
+import org.apache.velocity.runtime.parser.Parser;
public class ASTElseStatement extends SimpleNode
{
@@ -96,7 +96,7 @@
* An ASTElseStatement always evaluates to
* true. Basically behaves like an #if(true).
*/
- public boolean evaluate(Context context)
+ public boolean evaluate( InternalContextAdapter context)
{
return true;
}
1.3 +14 -12
jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTEscape.java
Index: ASTEscape.java
===================================================================
RCS file:
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTEscape.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ASTEscape.java 2000/12/11 04:36:03 1.2
+++ ASTEscape.java 2001/01/03 05:25:17 1.3
@@ -62,7 +62,7 @@
* what controls the generation of this class.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Geir Magnusson Jr.</a>
- * @version $Id: ASTEscape.java,v 1.2 2000/12/11 04:36:03 geirm Exp $
+ * @version $Id: ASTEscape.java,v 1.3 2001/01/03 05:25:17 geirm Exp $
*/
package org.apache.velocity.runtime.parser.node;
@@ -70,38 +70,40 @@
import java.io.Writer;
import java.io.IOException;
-import org.apache.velocity.Context;
-import org.apache.velocity.runtime.parser.*;
+import org.apache.velocity.context.InternalContextAdapter;
+import org.apache.velocity.runtime.parser.Parser;
-public class ASTEscape extends SimpleNode {
-
+public class ASTEscape extends SimpleNode
+{
private String text = "";
- public ASTEscape(int id) {
+ public ASTEscape(int id)
+ {
super(id);
}
- public ASTEscape(Parser p, int id) {
+ public ASTEscape(Parser p, int id)
+ {
super(p, id);
}
/** Accept the visitor. **/
- public Object jjtAccept(ParserVisitor visitor, Object data) {
+ public Object jjtAccept(ParserVisitor visitor, Object data)
+ {
return visitor.visit(this, data);
}
- public Object init(Context context, Object data)
+ public Object init( InternalContextAdapter context, Object data)
throws Exception
{
text = getFirstToken().image;
return data;
}
- public boolean render(Context context, Writer writer)
+ public boolean render( InternalContextAdapter context, Writer writer)
throws IOException
{
writer.write( text );
return true;
- }
-
+ }
}
1.2 +7 -6
jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTEscapedDirective.java
Index: ASTEscapedDirective.java
===================================================================
RCS file:
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTEscapedDirective.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ASTEscapedDirective.java 2000/11/11 22:42:42 1.1
+++ ASTEscapedDirective.java 2001/01/03 05:25:17 1.2
@@ -62,7 +62,7 @@
* what controls the generation of this class.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Geir Magnusson Jr.</a>
- * @version $Id: ASTEscapedDirective.java,v 1.1 2000/11/11 22:42:42 geirm Exp $
+ * @version $Id: ASTEscapedDirective.java,v 1.2 2001/01/03 05:25:17 geirm Exp $
*/
package org.apache.velocity.runtime.parser.node;
@@ -70,10 +70,11 @@
import java.io.Writer;
import java.io.IOException;
-import org.apache.velocity.Context;
-import org.apache.velocity.runtime.parser.*;
-public class ASTEscapedDirective extends SimpleNode {
-
+import org.apache.velocity.context.InternalContextAdapter;
+import org.apache.velocity.runtime.parser.Parser;
+
+public class ASTEscapedDirective extends SimpleNode
+{
public ASTEscapedDirective(int id)
{
super(id);
@@ -91,7 +92,7 @@
return visitor.visit(this, data);
}
- public boolean render(Context context, Writer writer)
+ public boolean render(InternalContextAdapter context, Writer writer)
throws IOException
{
writer.write(getFirstToken().image);
1.2 +57 -4
jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTExpression.java
Index: ASTExpression.java
===================================================================
RCS file:
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTExpression.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ASTExpression.java 2000/10/20 19:14:02 1.1
+++ ASTExpression.java 2001/01/03 05:25:18 1.2
@@ -1,9 +1,62 @@
/* Generated By:JJTree: Do not edit this line. ASTExpression.java */
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2000 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact [EMAIL PROTECTED]
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.velocity.runtime.parser.node;
-import org.apache.velocity.Context;
-import org.apache.velocity.runtime.parser.*;
+import org.apache.velocity.context.InternalContextAdapter;
+import org.apache.velocity.runtime.parser.Parser;
public class ASTExpression extends SimpleNode
{
@@ -23,12 +76,12 @@
return visitor.visit(this, data);
}
- public boolean evaluate(Context context)
+ public boolean evaluate( InternalContextAdapter context)
{
return jjtGetChild(0).evaluate(context);
}
- public Object value(Context context)
+ public Object value( InternalContextAdapter context)
{
return jjtGetChild(0).value(context);
}