You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by cf...@apache.org on 2012/05/29 17:35:15 UTC
svn commit: r1343781 [8/17] - in /incubator/flex/trunk/modules: ./
thirdparty/velocity/ thirdparty/velocity/build/
thirdparty/velocity/build/lib/ thirdparty/velocity/build/xsl/
thirdparty/velocity/src/java/org/apache/velocity/anakia/
thirdparty/velocit...
Propchange: incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/ParserTokenManager.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/ParserTreeConstants.java
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/ParserTreeConstants.java?rev=1343781&view=auto
==============================================================================
--- incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/ParserTreeConstants.java (added)
+++ incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/ParserTreeConstants.java Tue May 29 15:35:01 2012
@@ -0,0 +1,87 @@
+/* Generated By:JJTree: Do not edit this line. ParserTreeConstants.java */
+
+package org.apache.velocity.runtime.parser;
+
+public interface ParserTreeConstants
+{
+ public int JJTPROCESS = 0;
+ public int JJTVOID = 1;
+ public int JJTESCAPEDDIRECTIVE = 2;
+ public int JJTESCAPE = 3;
+ public int JJTCOMMENT = 4;
+ public int JJTNUMBERLITERAL = 5;
+ public int JJTSTRINGLITERAL = 6;
+ public int JJTIDENTIFIER = 7;
+ public int JJTWORD = 8;
+ public int JJTDIRECTIVE = 9;
+ public int JJTBLOCK = 10;
+ public int JJTOBJECTARRAY = 11;
+ public int JJTINTEGERRANGE = 12;
+ public int JJTMETHOD = 13;
+ public int JJTREFERENCE = 14;
+ public int JJTTRUE = 15;
+ public int JJTFALSE = 16;
+ public int JJTTEXT = 17;
+ public int JJTIFSTATEMENT = 18;
+ public int JJTELSESTATEMENT = 19;
+ public int JJTELSEIFSTATEMENT = 20;
+ public int JJTSETDIRECTIVE = 21;
+ public int JJTEXPRESSION = 22;
+ public int JJTASSIGNMENT = 23;
+ public int JJTORNODE = 24;
+ public int JJTANDNODE = 25;
+ public int JJTEQNODE = 26;
+ public int JJTNENODE = 27;
+ public int JJTLTNODE = 28;
+ public int JJTGTNODE = 29;
+ public int JJTLENODE = 30;
+ public int JJTGENODE = 31;
+ public int JJTADDNODE = 32;
+ public int JJTSUBTRACTNODE = 33;
+ public int JJTMULNODE = 34;
+ public int JJTDIVNODE = 35;
+ public int JJTMODNODE = 36;
+ public int JJTNOTNODE = 37;
+
+
+ public String[] jjtNodeName = {
+ "process",
+ "void",
+ "EscapedDirective",
+ "Escape",
+ "Comment",
+ "NumberLiteral",
+ "StringLiteral",
+ "Identifier",
+ "Word",
+ "Directive",
+ "Block",
+ "ObjectArray",
+ "IntegerRange",
+ "Method",
+ "Reference",
+ "True",
+ "False",
+ "Text",
+ "IfStatement",
+ "ElseStatement",
+ "ElseIfStatement",
+ "SetDirective",
+ "Expression",
+ "Assignment",
+ "OrNode",
+ "AndNode",
+ "EQNode",
+ "NENode",
+ "LTNode",
+ "GTNode",
+ "LENode",
+ "GENode",
+ "AddNode",
+ "SubtractNode",
+ "MulNode",
+ "DivNode",
+ "ModNode",
+ "NotNode",
+ };
+}
Propchange: incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/ParserTreeConstants.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/TokenMgrError.java
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/TokenMgrError.java?rev=1343781&view=auto
==============================================================================
--- incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/TokenMgrError.java (added)
+++ incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/TokenMgrError.java Tue May 29 15:35:01 2012
@@ -0,0 +1,133 @@
+/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 2.1 */
+package org.apache.velocity.runtime.parser;
+
+public class TokenMgrError extends Error
+{
+ /*
+ * Ordinals for various reasons why an Error of this type can be thrown.
+ */
+
+ /**
+ * Lexical error occured.
+ */
+ static final int LEXICAL_ERROR = 0;
+
+ /**
+ * An attempt wass made to create a second instance of a static token manager.
+ */
+ static final int STATIC_LEXER_ERROR = 1;
+
+ /**
+ * Tried to change to an invalid lexical state.
+ */
+ static final int INVALID_LEXICAL_STATE = 2;
+
+ /**
+ * Detected (and bailed out of) an infinite loop in the token manager.
+ */
+ static final int LOOP_DETECTED = 3;
+
+ /**
+ * Indicates the reason why the exception is thrown. It will have
+ * one of the above 4 values.
+ */
+ int errorCode;
+
+ /**
+ * Replaces unprintable characters by their espaced (or unicode escaped)
+ * equivalents in the given string
+ */
+ protected static final String addEscapes(String str) {
+ StringBuffer retval = new StringBuffer();
+ char ch;
+ for (int i = 0; i < str.length(); i++) {
+ switch (str.charAt(i))
+ {
+ case 0 :
+ continue;
+ case '\b':
+ retval.append("\\b");
+ continue;
+ case '\t':
+ retval.append("\\t");
+ continue;
+ case '\n':
+ retval.append("\\n");
+ continue;
+ case '\f':
+ retval.append("\\f");
+ continue;
+ case '\r':
+ retval.append("\\r");
+ continue;
+ case '\"':
+ retval.append("\\\"");
+ continue;
+ case '\'':
+ retval.append("\\\'");
+ continue;
+ case '\\':
+ retval.append("\\\\");
+ continue;
+ default:
+ if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
+ String s = "0000" + Integer.toString(ch, 16);
+ retval.append("\\u" + s.substring(s.length() - 4, s.length()));
+ } else {
+ retval.append(ch);
+ }
+ continue;
+ }
+ }
+ return retval.toString();
+ }
+
+ /**
+ * Returns a detailed message for the Error when it is thrown by the
+ * token manager to indicate a lexical error.
+ * Parameters :
+ * EOFSeen : indicates if EOF caused the lexicl error
+ * curLexState : lexical state in which this error occured
+ * errorLine : line number when the error occured
+ * errorColumn : column number when the error occured
+ * errorAfter : prefix that was seen before this error occured
+ * curchar : the offending character
+ * Note: You can customize the lexical error message by modifying this method.
+ */
+ private static final String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) {
+ return("Lexical error at line " +
+ errorLine + ", column " +
+ errorColumn + ". Encountered: " +
+ (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") +
+ "after : \"" + addEscapes(errorAfter) + "\"");
+ }
+
+ /**
+ * You can also modify the body of this method to customize your error messages.
+ * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not
+ * of end-users concern, so you can return something like :
+ *
+ * "Internal Error : Please file a bug report .... "
+ *
+ * from this method for such cases in the release version of your parser.
+ */
+ public String getMessage() {
+ return super.getMessage();
+ }
+
+ /*
+ * Constructors of various flavors follow.
+ */
+
+ public TokenMgrError() {
+ }
+
+ public TokenMgrError(String message, int reason) {
+ super(message);
+ errorCode = reason;
+ }
+
+ public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) {
+ this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);
+ }
+}
Propchange: incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/TokenMgrError.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/VelocityCharStream.java
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/VelocityCharStream.java?rev=1343781&view=auto
==============================================================================
--- incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/VelocityCharStream.java (added)
+++ incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/VelocityCharStream.java Tue May 29 15:35:01 2012
@@ -0,0 +1,395 @@
+package org.apache.velocity.runtime.parser;
+
+/**
+ * NOTE : This class was originally an ASCII_CharStream autogenerated
+ * by Javacc. It was then modified via changing class name with appropriate
+ * fixes for CTORS, and mods to readChar().
+ *
+ * This is safe because we *always* use Reader with this class, and never a
+ * InputStream. This guarantees that we have a correct stream of 16-bit
+ * chars - all encoding transformations have been done elsewhere, so we
+ * believe that there is no risk in doing this. Time will tell :)
+ */
+
+/**
+ * An implementation of interface CharStream, where the stream is assumed to
+ * contain only ASCII characters (without unicode processing).
+ */
+
+public final class VelocityCharStream
+ implements CharStream
+{
+ public static final boolean staticFlag = false;
+ int bufsize;
+ int available;
+ int tokenBegin;
+ public int bufpos = -1;
+ private int bufline[];
+ private int bufcolumn[];
+
+ private int column = 0;
+ private int line = 1;
+
+ private boolean prevCharIsCR = false;
+ private boolean prevCharIsLF = false;
+
+ private java.io.Reader inputStream;
+
+ private char[] buffer;
+ private int maxNextCharInd = 0;
+ private int inBuf = 0;
+
+ private final void ExpandBuff(boolean wrapAround)
+ {
+ char[] newbuffer = new char[bufsize + 2048];
+ int newbufline[] = new int[bufsize + 2048];
+ int newbufcolumn[] = new int[bufsize + 2048];
+
+ try
+ {
+ if (wrapAround)
+ {
+ System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
+ System.arraycopy(buffer, 0, newbuffer,
+ bufsize - tokenBegin, bufpos);
+ buffer = newbuffer;
+
+ System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
+ System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos);
+ bufline = newbufline;
+
+ System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
+ System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos);
+ bufcolumn = newbufcolumn;
+
+ maxNextCharInd = (bufpos += (bufsize - tokenBegin));
+ }
+ else
+ {
+ System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
+ buffer = newbuffer;
+
+ System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
+ bufline = newbufline;
+
+ System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
+ bufcolumn = newbufcolumn;
+
+ maxNextCharInd = (bufpos -= tokenBegin);
+ }
+ }
+ catch (Throwable t)
+ {
+ throw new Error(t.getMessage());
+ }
+
+
+ bufsize += 2048;
+ available = bufsize;
+ tokenBegin = 0;
+ }
+
+ private final void FillBuff() throws java.io.IOException
+ {
+ if (maxNextCharInd == available)
+ {
+ if (available == bufsize)
+ {
+ if (tokenBegin > 2048)
+ {
+ bufpos = maxNextCharInd = 0;
+ available = tokenBegin;
+ }
+ else if (tokenBegin < 0)
+ bufpos = maxNextCharInd = 0;
+ else
+ ExpandBuff(false);
+ }
+ else if (available > tokenBegin)
+ available = bufsize;
+ else if ((tokenBegin - available) < 2048)
+ ExpandBuff(true);
+ else
+ available = tokenBegin;
+ }
+
+ int i;
+ try {
+ if ((i = inputStream.read(buffer, maxNextCharInd,
+ available - maxNextCharInd)) == -1)
+ {
+ inputStream.close();
+ throw new java.io.IOException();
+ }
+ else
+ maxNextCharInd += i;
+ return;
+ }
+ catch(java.io.IOException e) {
+ --bufpos;
+ backup(0);
+ if (tokenBegin == -1)
+ tokenBegin = bufpos;
+ throw e;
+ }
+ }
+
+ public final char BeginToken() throws java.io.IOException
+ {
+ tokenBegin = -1;
+ char c = readChar();
+ tokenBegin = bufpos;
+
+ return c;
+ }
+
+ private final void UpdateLineColumn(char c)
+ {
+ column++;
+
+ if (prevCharIsLF)
+ {
+ prevCharIsLF = false;
+ line += (column = 1);
+ }
+ else if (prevCharIsCR)
+ {
+ prevCharIsCR = false;
+ if (c == '\n')
+ {
+ prevCharIsLF = true;
+ }
+ else
+ line += (column = 1);
+ }
+
+ switch (c)
+ {
+ case '\r' :
+ prevCharIsCR = true;
+ break;
+ case '\n' :
+ prevCharIsLF = true;
+ break;
+ case '\t' :
+ column--;
+ column += (8 - (column & 07));
+ break;
+ default :
+ break;
+ }
+
+ bufline[bufpos] = line;
+ bufcolumn[bufpos] = column;
+ }
+
+ public final char readChar() throws java.io.IOException
+ {
+ if (inBuf > 0)
+ {
+ --inBuf;
+
+ /*
+ * was : return (char)((char)0xff & buffer[(bufpos == bufsize - 1) ? (bufpos = 0) : ++bufpos]);
+ */
+ return buffer[(bufpos == bufsize - 1) ? (bufpos = 0) : ++bufpos];
+ }
+
+ if (++bufpos >= maxNextCharInd)
+ FillBuff();
+
+ /*
+ * was : char c = (char)((char)0xff & buffer[bufpos]);
+ */
+ char c = buffer[bufpos];
+
+ UpdateLineColumn(c);
+ return (c);
+ }
+
+ /**
+ * @deprecated
+ * @see #getEndColumn
+ */
+
+ public final int getColumn() {
+ return bufcolumn[bufpos];
+ }
+
+ /**
+ * @deprecated
+ * @see #getEndLine
+ */
+
+ public final int getLine() {
+ return bufline[bufpos];
+ }
+
+ public final int getEndColumn() {
+ return bufcolumn[bufpos];
+ }
+
+ public final int getEndLine() {
+ return bufline[bufpos];
+ }
+
+ public final int getBeginColumn() {
+ return bufcolumn[tokenBegin];
+ }
+
+ public final int getBeginLine() {
+ return bufline[tokenBegin];
+ }
+
+ public final void backup(int amount) {
+
+ inBuf += amount;
+ if ((bufpos -= amount) < 0)
+ bufpos += bufsize;
+ }
+
+ public VelocityCharStream(java.io.Reader dstream, int startline,
+ int startcolumn, int buffersize)
+ {
+ inputStream = dstream;
+ line = startline;
+ column = startcolumn - 1;
+
+ available = bufsize = buffersize;
+ buffer = new char[buffersize];
+ bufline = new int[buffersize];
+ bufcolumn = new int[buffersize];
+ }
+
+ public VelocityCharStream(java.io.Reader dstream, int startline,
+ int startcolumn)
+ {
+ this(dstream, startline, startcolumn, 4096);
+ }
+ public void ReInit(java.io.Reader dstream, int startline,
+ int startcolumn, int buffersize)
+ {
+ inputStream = dstream;
+ line = startline;
+ column = startcolumn - 1;
+
+ if (buffer == null || buffersize != buffer.length)
+ {
+ available = bufsize = buffersize;
+ buffer = new char[buffersize];
+ bufline = new int[buffersize];
+ bufcolumn = new int[buffersize];
+ }
+ prevCharIsLF = prevCharIsCR = false;
+ tokenBegin = inBuf = maxNextCharInd = 0;
+ bufpos = -1;
+ }
+
+ public void ReInit(java.io.Reader dstream, int startline,
+ int startcolumn)
+ {
+ ReInit(dstream, startline, startcolumn, 4096);
+ }
+ public VelocityCharStream(java.io.InputStream dstream, int startline,
+ int startcolumn, int buffersize)
+ {
+ this(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096);
+ }
+
+ public VelocityCharStream(java.io.InputStream dstream, int startline,
+ int startcolumn)
+ {
+ this(dstream, startline, startcolumn, 4096);
+ }
+
+ public void ReInit(java.io.InputStream dstream, int startline,
+ int startcolumn, int buffersize)
+ {
+ ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096);
+ }
+ public void ReInit(java.io.InputStream dstream, int startline,
+ int startcolumn)
+ {
+ ReInit(dstream, startline, startcolumn, 4096);
+ }
+ public final String GetImage()
+ {
+ if (bufpos >= tokenBegin)
+ return new String(buffer, tokenBegin, bufpos - tokenBegin + 1);
+ else
+ return new String(buffer, tokenBegin, bufsize - tokenBegin) +
+ new String(buffer, 0, bufpos + 1);
+ }
+
+ public final char[] GetSuffix(int len)
+ {
+ char[] ret = new char[len];
+
+ if ((bufpos + 1) >= len)
+ System.arraycopy(buffer, bufpos - len + 1, ret, 0, len);
+ else
+ {
+ System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0,
+ len - bufpos - 1);
+ System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1);
+ }
+
+ return ret;
+ }
+
+ public void Done()
+ {
+ buffer = null;
+ bufline = null;
+ bufcolumn = null;
+ }
+
+ /**
+ * Method to adjust line and column numbers for the start of a token.<BR>
+ */
+ public void adjustBeginLineColumn(int newLine, int newCol)
+ {
+ int start = tokenBegin;
+ int len;
+
+ if (bufpos >= tokenBegin)
+ {
+ len = bufpos - tokenBegin + inBuf + 1;
+ }
+ else
+ {
+ len = bufsize - tokenBegin + bufpos + 1 + inBuf;
+ }
+
+ int i = 0, j = 0, k = 0;
+ int nextColDiff = 0, columnDiff = 0;
+
+ while (i < len &&
+ bufline[j = start % bufsize] == bufline[k = ++start % bufsize])
+ {
+ bufline[j] = newLine;
+ nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j];
+ bufcolumn[j] = newCol + columnDiff;
+ columnDiff = nextColDiff;
+ i++;
+ }
+
+ if (i < len)
+ {
+ bufline[j] = newLine++;
+ bufcolumn[j] = newCol + columnDiff;
+
+ while (i++ < len)
+ {
+ if (bufline[j = start % bufsize] != bufline[++start % bufsize])
+ bufline[j] = newLine++;
+ else
+ bufline[j] = newLine;
+ }
+ }
+
+ line = bufline[j];
+ column = bufcolumn[j];
+ }
+
+}
Propchange: incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/VelocityCharStream.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTAddNode.java
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTAddNode.java?rev=1343781&view=auto
==============================================================================
--- incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTAddNode.java (added)
+++ incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTAddNode.java Tue May 29 15:35:01 2012
@@ -0,0 +1,107 @@
+package org.apache.velocity.runtime.parser.node;
+
+/*
+ * Copyright 2000-2001,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+/**
+ * Handles integer addition of nodes
+ *
+ * Please look at the Parser.jjt file which is
+ * what controls the generation of this class.
+ *
+ * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
+ * @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
+ * @version $Id: ASTAddNode.java,v 1.8.8.1 2004/03/03 23:22:58 geirm Exp $
+*/
+
+import org.apache.velocity.context.InternalContextAdapter;
+import org.apache.velocity.runtime.parser.Parser;
+
+import org.apache.velocity.exception.MethodInvocationException;
+
+public class ASTAddNode extends SimpleNode
+{
+ public ASTAddNode(int id)
+ {
+ super(id);
+ }
+
+ public ASTAddNode(Parser p, int id)
+ {
+ super(p, id);
+ }
+
+ /** Accept the visitor. **/
+ public Object jjtAccept(ParserVisitor visitor, Object data)
+ {
+ return visitor.visit(this, data);
+ }
+
+ /**
+ * computes the sum of the two nodes. Currently only integer operations are
+ * supported.
+ * @return Integer object with value, or null
+ */
+ public Object value( InternalContextAdapter context)
+ throws MethodInvocationException
+ {
+ /*
+ * get the two addends
+ */
+
+ Object left = jjtGetChild(0).value( context );
+ Object right = jjtGetChild(1).value( context );
+
+ /*
+ * if either is null, lets log and bail
+ */
+
+ if (left == null || right == null)
+ {
+ rsvc.error( ( left == null ? "Left" : "Right" )
+ + " side ("
+ + jjtGetChild( (left == null? 0 : 1) ).literal()
+ + ") of addition operation has null value."
+ + " Operation not possible. "
+ + context.getCurrentTemplateName() + " [line " + getLine()
+ + ", column " + getColumn() + "]");
+ return null;
+ }
+
+ /*
+ * if not an Integer, not much we can do either
+ */
+
+ if ( !( left instanceof Integer ) || !( right instanceof Integer ))
+ {
+ rsvc.error( ( !( left instanceof Integer ) ? "Left" : "Right" )
+ + " side of addition operation is not a valid type. "
+ + "Currently only integers (1,2,3...) and Integer type is supported. "
+ + context.getCurrentTemplateName() + " [line " + getLine()
+ + ", column " + getColumn() + "]");
+
+ return null;
+ }
+
+ return new Integer( ( (Integer) left ).intValue() + ( (Integer) right ).intValue() );
+ }
+
+}
+
+
+
+
Propchange: incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTAddNode.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTAndNode.java
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTAndNode.java?rev=1343781&view=auto
==============================================================================
--- incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTAndNode.java (added)
+++ incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTAndNode.java Tue May 29 15:35:01 2012
@@ -0,0 +1,100 @@
+package org.apache.velocity.runtime.parser.node;
+
+/*
+ * Copyright 2000-2001,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.velocity.context.InternalContextAdapter;
+import org.apache.velocity.runtime.parser.Parser;
+import org.apache.velocity.exception.MethodInvocationException;
+
+/**
+ * Please look at the Parser.jjt file which is
+ * what controls the generation of this class.
+ *
+ * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
+ * @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
+ * @version $Id: ASTAndNode.java,v 1.8.8.1 2004/03/03 23:22:58 geirm Exp $
+ */
+public class ASTAndNode extends SimpleNode
+{
+ public ASTAndNode(int id)
+ {
+ super(id);
+ }
+
+ public ASTAndNode(Parser p, int id)
+ {
+ super(p, id);
+ }
+
+ /** Accept the visitor. **/
+ public Object jjtAccept(ParserVisitor visitor, Object data)
+ {
+ return visitor.visit(this, data);
+ }
+
+ /**
+ * Returns the value of the expression.
+ * Since the value of the expression is simply the boolean
+ * result of evaluate(), lets return that.
+ */
+ public Object value(InternalContextAdapter context )
+ throws MethodInvocationException
+ {
+ return new Boolean( evaluate( context ) );
+ }
+
+ /**
+ * logical and :
+ * null && right = false
+ * left && null = false
+ * null && null = false
+ */
+ public boolean evaluate( InternalContextAdapter context)
+ throws MethodInvocationException
+ {
+ Node left = jjtGetChild(0);
+ Node right = jjtGetChild(1);
+
+ /*
+ * if either is null, lets log and bail
+ */
+
+ if (left == null || right == null)
+ {
+ rsvc.error( ( left == null ? "Left" : "Right" ) + " side of '&&' operation is null."
+ + " Operation not possible. "
+ + context.getCurrentTemplateName() + " [line " + getLine()
+ + ", column " + getColumn() + "]");
+ return false;
+ }
+
+ /*
+ * short circuit the test. Don't eval the RHS if the LHS is false
+ */
+
+ if( left.evaluate( context ) )
+ {
+ if ( right.evaluate( context ) )
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+}
+
Propchange: incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTAndNode.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTAssignment.java
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTAssignment.java?rev=1343781&view=auto
==============================================================================
--- incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTAssignment.java (added)
+++ incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTAssignment.java Tue May 29 15:35:01 2012
@@ -0,0 +1,39 @@
+package org.apache.velocity.runtime.parser.node;
+
+/*
+ * Copyright 2000-2001,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+import org.apache.velocity.runtime.parser.Parser;
+
+public class ASTAssignment extends SimpleNode
+{
+ public ASTAssignment(int id)
+ {
+ super(id);
+ }
+
+ public ASTAssignment(Parser p, int id)
+ {
+ super(p, id);
+ }
+
+ /** Accept the visitor. **/
+ public Object jjtAccept(ParserVisitor visitor, Object data)
+ {
+ return visitor.visit(this, data);
+ }
+}
Propchange: incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTAssignment.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTBlock.java
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTBlock.java?rev=1343781&view=auto
==============================================================================
--- incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTBlock.java (added)
+++ incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTBlock.java Tue May 29 15:35:01 2012
@@ -0,0 +1,59 @@
+package org.apache.velocity.runtime.parser.node;
+
+/*
+ * Copyright 2000-2001,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.Writer;
+import java.io.IOException;
+
+import org.apache.velocity.context.InternalContextAdapter;
+import org.apache.velocity.runtime.parser.Parser;
+
+import org.apache.velocity.exception.MethodInvocationException;
+import org.apache.velocity.exception.ParseErrorException;
+import org.apache.velocity.exception.ResourceNotFoundException;
+
+
+public class ASTBlock extends SimpleNode
+{
+ public ASTBlock(int id)
+ {
+ super(id);
+ }
+
+ public ASTBlock(Parser p, int id)
+ {
+ super(p, id);
+ }
+
+ /** Accept the visitor. **/
+ public Object jjtAccept(ParserVisitor visitor, Object data)
+ {
+ return visitor.visit(this, data);
+ }
+
+ public boolean render( InternalContextAdapter context, Writer writer)
+ throws IOException, MethodInvocationException,
+ ResourceNotFoundException, ParseErrorException
+ {
+ int i, k = jjtGetNumChildren();
+
+ for (i = 0; i < k; i++)
+ jjtGetChild(i).render(context, writer);
+
+ return true;
+ }
+}
Propchange: incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTBlock.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTDivNode.java
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTDivNode.java?rev=1343781&view=auto
==============================================================================
--- incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTDivNode.java (added)
+++ incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTDivNode.java Tue May 29 15:35:01 2012
@@ -0,0 +1,114 @@
+package org.apache.velocity.runtime.parser.node;
+
+/*
+ * Copyright 2000-2001,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.velocity.context.InternalContextAdapter;
+import org.apache.velocity.runtime.parser.Parser;
+
+import org.apache.velocity.exception.MethodInvocationException;
+
+/**
+ * Handles integer division of nodes
+ *
+ * Please look at the Parser.jjt file which is
+ * what controls the generation of this class.
+ *
+ * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
+ * @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
+ * @version $Id: ASTDivNode.java,v 1.8.8.1 2004/03/03 23:22:58 geirm Exp $
+ */
+public class ASTDivNode extends SimpleNode
+{
+ public ASTDivNode(int id)
+ {
+ super(id);
+ }
+
+ public ASTDivNode(Parser p, int id)
+ {
+ super(p, id);
+ }
+
+ /** Accept the visitor. **/
+ public Object jjtAccept(ParserVisitor visitor, Object data)
+ {
+ return visitor.visit(this, data);
+ }
+
+ /**
+ * computes the result of the division. Currently limited to
+ * Integers.
+ * @return Integer(value) or null
+ */
+ public Object value( InternalContextAdapter context)
+ throws MethodInvocationException
+ {
+ /*
+ * get the two args
+ */
+
+ Object left = jjtGetChild(0).value( context );
+ Object right = jjtGetChild(1).value( context );
+
+ /*
+ * if either is null, lets log and bail
+ */
+
+ if (left == null || right == null)
+ {
+ rsvc.error( ( left == null ? "Left" : "Right" )
+ + " side ("
+ + jjtGetChild( (left == null? 0 : 1) ).literal()
+ + ") of division operation has null value."
+ + " Operation not possible. "
+ + context.getCurrentTemplateName()
+ + " [line " + getLine()
+ + ", column " + getColumn() + "]");
+ return null;
+ }
+
+ /*
+ * if not an Integer, not much we can do either
+ */
+
+ if ( !( left instanceof Integer ) || !( right instanceof Integer ))
+ {
+ rsvc.error( ( !( left instanceof Integer ) ? "Left" : "Right" )
+ + " side of division operation is not a valid type. "
+ + "Currently only integers (1,2,3...) and Integer type is supported. "
+ + context.getCurrentTemplateName() + " [line " + getLine()
+ + ", column " + getColumn() + "]");
+
+ return null;
+ }
+
+ /*
+ * check for divide by 0
+ */
+
+ if ( ( (Integer) right).intValue() == 0 )
+ {
+ rsvc.error( "Right side of division operation is zero. Must be non-zero. "
+ + context.getCurrentTemplateName() + " [line " + getLine()
+ + ", column " + getColumn() + "]");
+
+ return null;
+ }
+
+ return new Integer( ( (Integer) left ).intValue() / ( (Integer) right ).intValue() );
+ }
+}
Propchange: incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTDivNode.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTEQNode.java
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTEQNode.java?rev=1343781&view=auto
==============================================================================
--- incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTEQNode.java (added)
+++ incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTEQNode.java Tue May 29 15:35:01 2012
@@ -0,0 +1,123 @@
+package org.apache.velocity.runtime.parser.node;
+
+/*
+ * Copyright 2000-2001,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.velocity.context.InternalContextAdapter;
+import org.apache.velocity.runtime.parser.Parser;
+
+import org.apache.velocity.exception.MethodInvocationException;
+
+/**
+ * Handles the equivalence operator
+ *
+ * <arg1> == <arg2>
+ *
+ * This operator requires that the LHS and RHS are both of the
+ * same Class.
+ *
+ * @version $Id: ASTEQNode.java,v 1.9.4.1 2004/03/03 23:22:58 geirm Exp $
+ */
+public class ASTEQNode extends SimpleNode
+{
+ public ASTEQNode(int id)
+ {
+ super(id);
+ }
+
+ public ASTEQNode(Parser p, int id)
+ {
+ super(p, id);
+ }
+
+ /** Accept the visitor. **/
+ public Object jjtAccept(ParserVisitor visitor, Object data)
+ {
+ return visitor.visit(this, data);
+ }
+
+ /**
+ * Calculates the value of the logical expression
+ *
+ * arg1 == arg2
+ *
+ * All class types are supported. Uses equals() to
+ * determine equivalence. This should work as we represent
+ * with the types we already support, and anything else that
+ * implements equals() to mean more than identical references.
+ *
+ *
+ * @param context internal context used to evaluate the LHS and RHS
+ * @return true if equivalent, false if not equivalent,
+ * false if not compatible arguments, or false
+ * if either LHS or RHS is null
+ */
+ public boolean evaluate( InternalContextAdapter context)
+ throws MethodInvocationException
+ {
+ Object left = jjtGetChild(0).value(context);
+ Object right = jjtGetChild(1).value(context);
+
+ /*
+ * they could be null if they are references and not in the context
+ */
+
+ if (left == null || right == null)
+ {
+ rsvc.error( ( left == null ? "Left" : "Right" )
+ + " side ("
+ + jjtGetChild( (left == null? 0 : 1) ).literal()
+ + ") of '==' operation "
+ + "has null value. "
+ + "If a reference, it may not be in the context."
+ + " Operation not possible. "
+ + context.getCurrentTemplateName() + " [line " + getLine()
+ + ", column " + getColumn() + "]");
+ return false;
+ }
+
+ /*
+ * check to see if they are the same class. I don't think this is slower
+ * as I don't think that getClass() results in object creation, and we can
+ * extend == to handle all classes
+ */
+
+ if (left.getClass().equals( right.getClass() ) )
+ {
+ return left.equals( right );
+ }
+ else
+ {
+ rsvc.error("Error in evaluation of == expression."
+ + " Both arguments must be of the same Class."
+ + " Currently left = " + left.getClass() + ", right = "
+ + right.getClass() + ". "
+ + context.getCurrentTemplateName() + " [line " + getLine()
+ + ", column " + getColumn() + "] (ASTEQNode)");
+ }
+
+ return false;
+ }
+
+ public Object value(InternalContextAdapter context)
+ throws MethodInvocationException
+ {
+ boolean val = evaluate(context);
+
+ return val ? Boolean.TRUE : Boolean.FALSE;
+ }
+
+}
Propchange: incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTEQNode.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTElseIfStatement.java
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTElseIfStatement.java?rev=1343781&view=auto
==============================================================================
--- incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTElseIfStatement.java (added)
+++ incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTElseIfStatement.java Tue May 29 15:35:01 2012
@@ -0,0 +1,80 @@
+package org.apache.velocity.runtime.parser.node;
+
+/*
+ * Copyright 2000-2001,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.Writer;
+import java.io.IOException;
+
+import org.apache.velocity.context.InternalContextAdapter;
+import org.apache.velocity.runtime.parser.*;
+
+import org.apache.velocity.exception.MethodInvocationException;
+import org.apache.velocity.exception.ParseErrorException;
+import org.apache.velocity.exception.ResourceNotFoundException;
+
+/**
+ * This class is responsible for handling the ElseIf VTL control statement.
+ *
+ * Please look at the Parser.jjt file which is
+ * what controls the generation of this class.
+ *
+ * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
+ * @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
+ * @version $Id: ASTElseIfStatement.java,v 1.9.8.1 2004/03/03 23:22:58 geirm Exp $
+*/
+public class ASTElseIfStatement extends SimpleNode
+{
+ public ASTElseIfStatement(int id)
+ {
+ super(id);
+ }
+
+ public ASTElseIfStatement(Parser p, int id)
+ {
+ super(p, id);
+ }
+
+ /** Accept the visitor. **/
+ public Object jjtAccept(ParserVisitor visitor, Object data)
+ {
+ return visitor.visit(this, data);
+ }
+
+ /**
+ * An ASTElseStatement is true if the expression
+ * it contains evaluates to true. Expressions know
+ * how to evaluate themselves, so we do that
+ * here and return the value back to ASTIfStatement
+ * where this node was originally asked to evaluate
+ * itself.
+ */
+ public boolean evaluate ( InternalContextAdapter context)
+ throws MethodInvocationException
+ {
+ return jjtGetChild(0).evaluate(context);
+ }
+
+ /**
+ * renders the block
+ */
+ public boolean render( InternalContextAdapter context, Writer writer)
+ throws IOException,MethodInvocationException,
+ ResourceNotFoundException, ParseErrorException
+ {
+ return jjtGetChild(1).render( context, writer );
+ }
+}
Propchange: incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTElseIfStatement.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTElseStatement.java
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTElseStatement.java?rev=1343781&view=auto
==============================================================================
--- incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTElseStatement.java (added)
+++ incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTElseStatement.java Tue May 29 15:35:01 2012
@@ -0,0 +1,59 @@
+package org.apache.velocity.runtime.parser.node;
+
+/*
+ * Copyright 2000-2001,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.velocity.context.InternalContextAdapter;
+import org.apache.velocity.runtime.parser.Parser;
+
+/**
+ * This class is responsible for handling the Else VTL control statement.
+ *
+ * Please look at the Parser.jjt file which is
+ * what controls the generation of this class.
+ *
+ * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
+ * @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
+ * @version $Id: ASTElseStatement.java,v 1.8.4.1 2004/03/03 23:22:58 geirm Exp $
+ */
+public class ASTElseStatement extends SimpleNode
+{
+ public ASTElseStatement(int id)
+ {
+ super(id);
+ }
+
+ public ASTElseStatement(Parser p, int id)
+ {
+ super(p, id);
+ }
+
+ /** Accept the visitor. **/
+ public Object jjtAccept(ParserVisitor visitor, Object data)
+ {
+ return visitor.visit(this, data);
+ }
+
+ /**
+ * An ASTElseStatement always evaluates to
+ * true. Basically behaves like an #if(true).
+ */
+ public boolean evaluate( InternalContextAdapter context)
+ {
+ return true;
+ }
+}
+
Propchange: incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTElseStatement.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTExpression.java
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTExpression.java?rev=1343781&view=auto
==============================================================================
--- incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTExpression.java (added)
+++ incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTExpression.java Tue May 29 15:35:01 2012
@@ -0,0 +1,53 @@
+package org.apache.velocity.runtime.parser.node;
+
+/*
+ * Copyright 2000-2001,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.velocity.context.InternalContextAdapter;
+import org.apache.velocity.runtime.parser.Parser;
+
+import org.apache.velocity.exception.MethodInvocationException;
+
+public class ASTExpression extends SimpleNode
+{
+ public ASTExpression(int id)
+ {
+ super(id);
+ }
+
+ public ASTExpression(Parser p, int id)
+ {
+ super(p, id);
+ }
+
+ /** Accept the visitor. **/
+ public Object jjtAccept(ParserVisitor visitor, Object data)
+ {
+ return visitor.visit(this, data);
+ }
+
+ public boolean evaluate( InternalContextAdapter context)
+ throws MethodInvocationException
+ {
+ return jjtGetChild(0).evaluate(context);
+ }
+
+ public Object value( InternalContextAdapter context)
+ throws MethodInvocationException
+ {
+ return jjtGetChild(0).value(context);
+ }
+}
Propchange: incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTExpression.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTFalse.java
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTFalse.java?rev=1343781&view=auto
==============================================================================
--- incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTFalse.java (added)
+++ incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTFalse.java Tue May 29 15:35:01 2012
@@ -0,0 +1,52 @@
+package org.apache.velocity.runtime.parser.node;
+
+/*
+ * Copyright 2000-2001,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+import org.apache.velocity.context.InternalContextAdapter;
+import org.apache.velocity.runtime.parser.Parser;
+
+public class ASTFalse extends SimpleNode
+{
+ private static Boolean value = Boolean.FALSE;
+
+ public ASTFalse(int id)
+ {
+ super(id);
+ }
+
+ public ASTFalse(Parser p, int id)
+ {
+ super(p, id);
+ }
+
+ /** Accept the visitor. **/
+ public Object jjtAccept(ParserVisitor visitor, Object data)
+ {
+ return visitor.visit(this, data);
+ }
+
+ public boolean evaluate( InternalContextAdapter context)
+ {
+ return false;
+ }
+
+ public Object value( InternalContextAdapter context)
+ {
+ return value;
+ }
+}
Propchange: incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTFalse.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTGENode.java
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTGENode.java?rev=1343781&view=auto
==============================================================================
--- incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTGENode.java (added)
+++ incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTGENode.java Tue May 29 15:35:01 2012
@@ -0,0 +1,96 @@
+package org.apache.velocity.runtime.parser.node;
+
+/*
+ * Copyright 2000-2001,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.velocity.context.InternalContextAdapter;
+import org.apache.velocity.runtime.parser.Parser;
+import org.apache.velocity.exception.MethodInvocationException;
+
+public class ASTGENode extends SimpleNode
+{
+ public ASTGENode(int id)
+ {
+ super(id);
+ }
+
+ public ASTGENode(Parser p, int id)
+ {
+ super(p, id);
+ }
+
+ /** Accept the visitor. **/
+ public Object jjtAccept(ParserVisitor visitor, Object data)
+ {
+ return visitor.visit(this, data);
+ }
+
+ public boolean evaluate( InternalContextAdapter context)
+ throws MethodInvocationException
+ {
+ /*
+ * get the two args
+ */
+
+ Object left = jjtGetChild(0).value( context );
+ Object right = jjtGetChild(1).value( context );
+
+ /*
+ * if either is null, lets log and bail
+ */
+
+ if (left == null || right == null)
+ {
+ rsvc.error( ( left == null ? "Left" : "Right" )
+ + " side ("
+ + jjtGetChild( (left == null? 0 : 1) ).literal()
+ + ") of '>=' operation has null value."
+ + " Operation not possible. "
+ + context.getCurrentTemplateName() + " [line "
+ + getLine()
+ + ", column " + getColumn() + "]");
+ return false;
+ }
+
+ /*
+ * if not an Integer, not much we can do either
+ */
+
+ if ( !( left instanceof Integer ) || !( right instanceof Integer ))
+ {
+ rsvc.error( ( !( left instanceof Integer ) ? "Left" : "Right" )
+ + " side of '>=' operation is not a valid type. "
+ + " It is a " + ( !( left instanceof Integer ) ? left.getClass() : right.getClass() )
+ + ". Currently only integers (1,2,3...) and Integer type is supported. "
+ + context.getCurrentTemplateName() + " [line " + getLine()
+ + ", column " + getColumn() + "]");
+
+ return false;
+ }
+
+ return ( (Integer) left).intValue() >= ((Integer) right).intValue();
+
+ }
+
+ public Object value(InternalContextAdapter context)
+ throws MethodInvocationException
+ {
+ boolean val = evaluate(context);
+
+ return val ? Boolean.TRUE : Boolean.FALSE;
+ }
+
+}
Propchange: incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTGENode.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTGTNode.java
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTGTNode.java?rev=1343781&view=auto
==============================================================================
--- incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTGTNode.java (added)
+++ incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTGTNode.java Tue May 29 15:35:01 2012
@@ -0,0 +1,96 @@
+package org.apache.velocity.runtime.parser.node;
+
+/*
+ * Copyright 2000-2001,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.velocity.context.InternalContextAdapter;
+import org.apache.velocity.runtime.parser.Parser;
+import org.apache.velocity.exception.MethodInvocationException;
+
+
+public class ASTGTNode extends SimpleNode
+{
+ public ASTGTNode(int id)
+ {
+ super(id);
+ }
+
+ public ASTGTNode(Parser p, int id)
+ {
+ super(p, id);
+ }
+
+ /** Accept the visitor. **/
+ public Object jjtAccept(ParserVisitor visitor, Object data)
+ {
+ return visitor.visit(this, data);
+ }
+
+ public boolean evaluate(InternalContextAdapter context)
+ throws MethodInvocationException
+ {
+ /*
+ * get the two args
+ */
+
+ Object left = jjtGetChild(0).value( context );
+ Object right = jjtGetChild(1).value( context );
+
+ /*
+ * if either is null, lets log and bail
+ */
+
+ if (left == null || right == null)
+ {
+ rsvc.error( ( left == null ? "Left" : "Right" )
+ + " side ("
+ + jjtGetChild( (left == null? 0 : 1) ).literal()
+ + ") of '>' operation has null value."
+ + " Operation not possible. "
+ + context.getCurrentTemplateName() + " [line "
+ + getLine()
+ + ", column " + getColumn() + "]");
+ return false;
+ }
+
+ /*
+ * if not an Integer, not much we can do either
+ */
+
+ if ( !( left instanceof Integer ) || !( right instanceof Integer ))
+ {
+ rsvc.error( ( !( left instanceof Integer ) ? "Left" : "Right" )
+ + " side of '>' operation is not a valid type. "
+ + " It is a " + ( !( left instanceof Integer ) ? left.getClass() : right.getClass() )
+ + ". Currently only integers (1,2,3...) and Integer type is supported. "
+ + context.getCurrentTemplateName() + " [line " + getLine()
+ + ", column " + getColumn() + "]");
+
+ return false;
+ }
+
+ return ((Integer) left).intValue() > ((Integer) right).intValue();
+ }
+
+ public Object value(InternalContextAdapter context)
+ throws MethodInvocationException
+ {
+ boolean val = evaluate(context);
+
+ return val ? Boolean.TRUE : Boolean.FALSE;
+ }
+
+}
Propchange: incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTGTNode.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTIfStatement.java
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTIfStatement.java?rev=1343781&view=auto
==============================================================================
--- incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTIfStatement.java (added)
+++ incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTIfStatement.java Tue May 29 15:35:01 2012
@@ -0,0 +1,111 @@
+package org.apache.velocity.runtime.parser.node;
+
+/*
+ * Copyright 2000-2001,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+/**
+ * Please look at the Parser.jjt file which is
+ * what controls the generation of this class.
+ *
+ * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
+ * @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
+ * @version $Id: ASTIfStatement.java,v 1.9.8.1 2004/03/03 23:22:58 geirm Exp $
+*/
+
+
+import java.io.Writer;
+import java.io.IOException;
+
+import org.apache.velocity.context.InternalContextAdapter;
+import org.apache.velocity.runtime.parser.*;
+
+import org.apache.velocity.exception.MethodInvocationException;
+import org.apache.velocity.exception.ParseErrorException;
+import org.apache.velocity.exception.ResourceNotFoundException;
+
+
+public class ASTIfStatement extends SimpleNode
+{
+ public ASTIfStatement(int id)
+ {
+ super(id);
+ }
+
+ public ASTIfStatement(Parser p, int id)
+ {
+ super(p, id);
+ }
+
+ /** Accept the visitor. **/
+ public Object jjtAccept(ParserVisitor visitor, Object data)
+ {
+ return visitor.visit(this, data);
+ }
+
+ public boolean render( InternalContextAdapter context, Writer writer)
+ throws IOException,MethodInvocationException,
+ ResourceNotFoundException, ParseErrorException
+ {
+ /*
+ * Check if the #if(expression) construct evaluates to true:
+ * if so render and leave immediately because there
+ * is nothing left to do!
+ */
+ if (jjtGetChild(0).evaluate(context))
+ {
+ jjtGetChild(1).render(context, writer);
+ return true;
+ }
+
+ int totalNodes = jjtGetNumChildren();
+
+ /*
+ * Now check the remaining nodes left in the
+ * if construct. The nodes are either elseif
+ * nodes or else nodes. Each of these node
+ * types knows how to evaluate themselves. If
+ * a node evaluates to true then the node will
+ * render itself and this method will return
+ * as there is nothing left to do.
+ */
+ for (int i = 2; i < totalNodes; i++)
+ {
+ if (jjtGetChild(i).evaluate(context))
+ {
+ jjtGetChild(i).render(context, writer);
+ return true;
+ }
+ }
+
+ /*
+ * This is reached when an ASTIfStatement
+ * consists of an if/elseif sequence where
+ * none of the nodes evaluate to true.
+ */
+ return true;
+ }
+
+ public void process( InternalContextAdapter context, ParserVisitor visitor)
+ {
+ }
+}
+
+
+
+
+
+
Propchange: incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTIfStatement.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTIncludeStatement.java
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTIncludeStatement.java?rev=1343781&view=auto
==============================================================================
--- incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTIncludeStatement.java (added)
+++ incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTIncludeStatement.java Tue May 29 15:35:01 2012
@@ -0,0 +1,24 @@
+/* Generated By:JJTree: Do not edit this line. ASTIncludeStatement.java */
+
+package org.apache.velocity.runtime.parser.node;
+
+import org.apache.velocity.runtime.parser.*;
+
+public class ASTIncludeStatement extends SimpleNode
+{
+ public ASTIncludeStatement(int id)
+ {
+ super(id);
+ }
+
+ public ASTIncludeStatement(Parser p, int id)
+ {
+ super(p, id);
+ }
+
+ /** Accept the visitor. **/
+ public Object jjtAccept(ParserVisitor visitor, Object data)
+ {
+ return visitor.visit(this, data);
+ }
+}
Propchange: incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTIncludeStatement.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTIntegerRange.java
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTIntegerRange.java?rev=1343781&view=auto
==============================================================================
--- incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTIntegerRange.java (added)
+++ incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTIntegerRange.java Tue May 29 15:35:01 2012
@@ -0,0 +1,137 @@
+package org.apache.velocity.runtime.parser.node;
+
+/*
+ * Copyright 2000-2001,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+/**
+ * handles the range 'operator' [ n .. m ]
+ *
+ * Please look at the Parser.jjt file which is
+ * what controls the generation of this class.
+ *
+ * @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
+ * @version $Id: ASTIntegerRange.java,v 1.4.10.1 2004/03/03 23:22:58 geirm Exp $
+*/
+
+import java.util.ArrayList;
+
+import org.apache.velocity.context.InternalContextAdapter;
+import org.apache.velocity.runtime.parser.Parser;
+
+import org.apache.velocity.exception.MethodInvocationException;
+
+public class ASTIntegerRange extends SimpleNode {
+
+ public ASTIntegerRange(int id)
+ {
+ super(id);
+ }
+
+ public ASTIntegerRange(Parser p, int id)
+ {
+ super(p, id);
+ }
+
+ /** Accept the visitor. **/
+ public Object jjtAccept(ParserVisitor visitor, Object data)
+ {
+ return visitor.visit(this, data);
+ }
+
+ /**
+ * does the real work. Creates an Vector of Integers with the
+ * right value range
+ *
+ * @param context app context used if Left or Right of .. is a ref
+ * @return Object array of Integers
+ */
+ public Object value( InternalContextAdapter context)
+ throws MethodInvocationException
+ {
+ /*
+ * get the two range ends
+ */
+
+ Object left = jjtGetChild(0).value( context );
+ Object right = jjtGetChild(1).value( context );
+
+ /*
+ * if either is null, lets log and bail
+ */
+
+ if (left == null || right == null)
+ {
+ rsvc.error( ( left == null ? "Left" : "Right" ) + " side of range operator [n..m] has null value."
+ + " Operation not possible. "
+ + context.getCurrentTemplateName() + " [line " + getLine()
+ + ", column " + getColumn() + "]");
+ return null;
+ }
+
+ /*
+ * if not an Integer, not much we can do either
+ */
+
+ if ( !( left instanceof Integer ) || !( right instanceof Integer ))
+ {
+ rsvc.error( ( !( left instanceof Integer ) ? "Left" : "Right" )
+ + " side of range operator is not a valid type. "
+ + "Currently only integers (1,2,3...) and Integer type is supported. "
+ + context.getCurrentTemplateName() + " [line " + getLine()
+ + ", column " + getColumn() + "]");
+
+ return null;
+ }
+
+
+ /*
+ * get the two integer values of the ends of the range
+ */
+
+ int l = ( (Integer) left ).intValue() ;
+ int r = ( (Integer) right ).intValue();
+
+ /*
+ * find out how many there are
+ */
+
+ int num = Math.abs( l - r );
+ num += 1;
+
+ /*
+ * see if your increment is Pos or Neg
+ */
+
+ int delta = ( l >= r ) ? -1 : 1;
+
+ /*
+ * make the vector and fill it
+ */
+
+ ArrayList foo = new ArrayList();
+ int val = l;
+
+ for(int i =0; i < num; i++)
+ {
+ foo.add( new Integer( val ));
+ val += delta;
+ }
+
+ return foo;
+ }
+}
+
Propchange: incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTIntegerRange.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTLENode.java
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTLENode.java?rev=1343781&view=auto
==============================================================================
--- incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTLENode.java (added)
+++ incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTLENode.java Tue May 29 15:35:01 2012
@@ -0,0 +1,96 @@
+package org.apache.velocity.runtime.parser.node;
+
+/*
+ * Copyright 2000-2001,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.velocity.context.InternalContextAdapter;
+import org.apache.velocity.runtime.parser.Parser;
+
+import org.apache.velocity.exception.MethodInvocationException;
+
+public class ASTLENode extends SimpleNode
+{
+ public ASTLENode(int id)
+ {
+ super(id);
+ }
+
+ public ASTLENode(Parser p, int id)
+ {
+ super(p, id);
+ }
+
+ /** Accept the visitor. **/
+ public Object jjtAccept(ParserVisitor visitor, Object data)
+ {
+ return visitor.visit(this, data);
+ }
+
+ public boolean evaluate( InternalContextAdapter context)
+ throws MethodInvocationException
+ {
+ /*
+ * get the two args
+ */
+
+ Object left = jjtGetChild(0).value( context );
+ Object right = jjtGetChild(1).value( context );
+
+ /*
+ * if either is null, lets log and bail
+ */
+
+ if (left == null || right == null)
+ {
+ rsvc.error( ( left == null ? "Left" : "Right" )
+ + " side ("
+ + jjtGetChild( (left == null? 0 : 1) ).literal()
+ + ") of '<=' operation has null value."
+ + " Operation not possible. "
+ + context.getCurrentTemplateName() + " [line "
+ + getLine()
+ + ", column " + getColumn() + "]");
+ return false;
+ }
+
+ /*
+ * if not an Integer, not much we can do either
+ */
+
+ if ( !( left instanceof Integer ) || !( right instanceof Integer ))
+ {
+ rsvc.error( ( !( left instanceof Integer ) ? "Left" : "Right" )
+ + " side of '<=' operation is not a valid type. "
+ + " It is a " + ( !( left instanceof Integer ) ? left.getClass() : right.getClass() )
+ + ". Currently only integers (1,2,3...) and Integer type is supported. "
+ + context.getCurrentTemplateName() + " [line " + getLine()
+ + ", column " + getColumn() + "]");
+
+ return false;
+ }
+
+ return ((Integer) left).intValue() <= ((Integer) right).intValue();
+ }
+
+ public Object value(InternalContextAdapter context)
+ throws MethodInvocationException
+ {
+ boolean val = evaluate(context);
+
+ return val ? Boolean.TRUE : Boolean.FALSE;
+ }
+
+}
Propchange: incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTLENode.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTLTNode.java
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTLTNode.java?rev=1343781&view=auto
==============================================================================
--- incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTLTNode.java (added)
+++ incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTLTNode.java Tue May 29 15:35:01 2012
@@ -0,0 +1,96 @@
+package org.apache.velocity.runtime.parser.node;
+
+/*
+ * Copyright 2000-2001,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.velocity.context.InternalContextAdapter;
+import org.apache.velocity.runtime.parser.Parser;
+
+import org.apache.velocity.exception.MethodInvocationException;
+
+public class ASTLTNode extends SimpleNode
+{
+ public ASTLTNode(int id)
+ {
+ super(id);
+ }
+
+ public ASTLTNode(Parser p, int id)
+ {
+ super(p, id);
+ }
+
+ /** Accept the visitor. **/
+ public Object jjtAccept(ParserVisitor visitor, Object data)
+ {
+ return visitor.visit(this, data);
+ }
+
+ public boolean evaluate(InternalContextAdapter context)
+ throws MethodInvocationException
+ {
+ /*
+ * get the two args
+ */
+
+ Object left = jjtGetChild(0).value( context );
+ Object right = jjtGetChild(1).value( context );
+
+ /*
+ * if either is null, lets log and bail
+ */
+
+ if (left == null || right == null)
+ {
+ rsvc.error( ( left == null ? "Left" : "Right" )
+ + " side ("
+ + jjtGetChild( (left == null? 0 : 1) ).literal()
+ + ") of '<' operation has null value."
+ + " Operation not possible. "
+ + context.getCurrentTemplateName() + " [line "
+ + getLine()
+ + ", column " + getColumn() + "]");
+ return false;
+ }
+
+ /*
+ * if not an Integer, not much we can do either
+ */
+
+ if ( !( left instanceof Integer ) || !( right instanceof Integer ))
+ {
+ rsvc.error( ( !( left instanceof Integer ) ? "Left" : "Right" )
+ + " side of '<' operation is not a valid type. "
+ + " It is a " + ( !( left instanceof Integer ) ? left.getClass() : right.getClass() )
+ + ". Currently only integers (1,2,3...) and Integer type is supported. "
+ + context.getCurrentTemplateName() + " [line " + getLine()
+ + ", column " + getColumn() + "]");
+
+ return false;
+ }
+
+ return ((Integer) left).intValue() < ((Integer) right).intValue();
+ }
+
+ public Object value(InternalContextAdapter context)
+ throws MethodInvocationException
+ {
+ boolean val = evaluate(context);
+
+ return val ? Boolean.TRUE : Boolean.FALSE;
+ }
+
+}
Propchange: incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTLTNode.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTModNode.java
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTModNode.java?rev=1343781&view=auto
==============================================================================
--- incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTModNode.java (added)
+++ incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTModNode.java Tue May 29 15:35:01 2012
@@ -0,0 +1,108 @@
+package org.apache.velocity.runtime.parser.node;
+
+/*
+ * Copyright 2000-2001,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+/**
+ * Handles integer modulus division
+ *
+ * Please look at the Parser.jjt file which is
+ * what controls the generation of this class.
+ *
+ * @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
+ * @version $Id: ASTModNode.java,v 1.6.10.1 2004/03/03 23:22:59 geirm Exp $
+*/
+import org.apache.velocity.context.InternalContextAdapter;
+import org.apache.velocity.runtime.parser.Parser;
+
+import org.apache.velocity.exception.MethodInvocationException;
+
+public class ASTModNode extends SimpleNode
+{
+ public ASTModNode(int id)
+ {
+ super(id);
+ }
+
+ public ASTModNode(Parser p, int id)
+ {
+ super(p, id);
+ }
+
+ /** Accept the visitor. **/
+ public Object jjtAccept(ParserVisitor visitor, Object data)
+ {
+ return visitor.visit(this, data);
+ }
+
+ public Object value( InternalContextAdapter context)
+ throws MethodInvocationException
+ {
+ /*
+ * get the two args
+ */
+
+ Object left = jjtGetChild(0).value( context );
+ Object right = jjtGetChild(1).value( context );
+
+ /*
+ * if either is null, lets log and bail
+ */
+
+ if (left == null || right == null)
+ {
+ rsvc.error( ( left == null ? "Left" : "Right" ) + " side ("
+ + jjtGetChild( (left == null? 0 : 1) ).literal()
+ + ") of modulus operation has null value."
+ + " Operation not possible. "
+ + context.getCurrentTemplateName() + " [line " + getLine()
+ + ", column " + getColumn() + "]");
+ return null;
+ }
+
+ /*
+ * if not an Integer, not much we can do either
+ */
+
+ if ( !( left instanceof Integer ) || !( right instanceof Integer ))
+ {
+ rsvc.error( ( !( left instanceof Integer ) ? "Left" : "Right" )
+ + " side of modulus operation is not a valid type. "
+ + "Currently only integers (1,2,3...) and Integer type is supported. "
+ + context.getCurrentTemplateName() + " [line " + getLine()
+ + ", column " + getColumn() + "]");
+
+ return null;
+ }
+
+ /*
+ * check for divide by 0
+ */
+
+ if ( ( (Integer) right).intValue() == 0 )
+ {
+ rsvc.error( "Right side of modulus operation is zero. Must be non-zero. "
+ + context.getCurrentTemplateName() + " [line " + getLine()
+ + ", column " + getColumn() + "]");
+
+ return null;
+ }
+
+ return new Integer( ( (Integer) left ).intValue() % ( (Integer) right ).intValue() );
+ }
+}
+
Propchange: incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTModNode.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTMulNode.java
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTMulNode.java?rev=1343781&view=auto
==============================================================================
--- incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTMulNode.java (added)
+++ incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTMulNode.java Tue May 29 15:35:01 2012
@@ -0,0 +1,102 @@
+package org.apache.velocity.runtime.parser.node;
+
+/*
+ * Copyright 2000-2001,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.velocity.context.InternalContextAdapter;
+import org.apache.velocity.runtime.parser.Parser;
+
+import org.apache.velocity.exception.MethodInvocationException;
+
+/**
+ * Handles integer multiplication
+ *
+ * Please look at the Parser.jjt file which is
+ * what controls the generation of this class.
+ *
+ * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
+ * @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
+ * @version $Id: ASTMulNode.java,v 1.7.8.1 2004/03/03 23:22:59 geirm Exp $
+*/
+public class ASTMulNode extends SimpleNode
+{
+ public ASTMulNode(int id)
+ {
+ super(id);
+ }
+
+ public ASTMulNode(Parser p, int id)
+ {
+ super(p, id);
+ }
+
+ /** Accept the visitor. **/
+ public Object jjtAccept(ParserVisitor visitor, Object data)
+ {
+ return visitor.visit(this, data);
+ }
+
+ /**
+ * computes the product of the two args. Returns null if either arg is null
+ * or if either arg is not an integer
+ */
+ public Object value( InternalContextAdapter context )
+ throws MethodInvocationException
+ {
+ /*
+ * get the two args
+ */
+
+ Object left = jjtGetChild(0).value( context );
+ Object right = jjtGetChild(1).value( context );
+
+ /*
+ * if either is null, lets log and bail
+ */
+
+ if (left == null || right == null)
+ {
+ rsvc.error( ( left == null ? "Left" : "Right" ) + " side ("
+ + jjtGetChild( (left == null? 0 : 1) ).literal()
+ + ") of multiplication operation has null value."
+ + " Operation not possible. "
+ + context.getCurrentTemplateName() + " [line " + getLine()
+ + ", column " + getColumn() + "]");
+ return null;
+ }
+
+ /*
+ * if not an Integer, not much we can do either
+ */
+
+ if ( !( left instanceof Integer ) || !( right instanceof Integer ))
+ {
+ rsvc.error( ( !( left instanceof Integer ) ? "Left" : "Right" )
+ + " side of multiplication operation is not a valid type. "
+ + "Currently only integers (1,2,3...) and Integer type is supported. "
+ + context.getCurrentTemplateName() + " [line " + getLine()
+ + ", column " + getColumn() + "]");
+
+ return null;
+ }
+
+ return new Integer( ( (Integer) left ).intValue() * ( (Integer) right ).intValue() );
+ }
+}
+
+
+
+
Propchange: incubator/flex/trunk/modules/thirdparty/velocity/src/java/org/apache/velocity/runtime/parser/node/ASTMulNode.java
------------------------------------------------------------------------------
svn:eol-style = native