You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by jv...@locus.apache.org on 2000/09/08 21:46:36 UTC
cvs commit: jakarta-velocity/src/java/org/apache/velocity/processor/javacc/visitor BaseVisitor.java NoCacheMode.java
jvanzyl 00/09/08 12:46:34
Modified: src/java/org/apache/velocity Utils.java
src/java/org/apache/velocity/cache Executor.java
src/java/org/apache/velocity/processor/javacc/parser
Parser.java Parser.jj Parser.jjt
ParserConstants.java ParserTokenManager.java
src/java/org/apache/velocity/processor/javacc/visitor
BaseVisitor.java NoCacheMode.java
Log:
- cleaned up parsing errors, see the example director for the
test bed, some code cleanup. Added support for $foo.Bar to
resolve to:
$foo.getBar() then
$foo.get("Bar")
Revision Changes Path
1.2 +7 -8 jakarta-velocity/src/java/org/apache/velocity/Utils.java
Index: Utils.java
===================================================================
RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/Utils.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Utils.java 2000/09/06 09:13:25 1.1
+++ Utils.java 2000/09/08 19:46:21 1.2
@@ -66,7 +66,7 @@
* string utilities class.
*
* @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
- * @version $Id: Utils.java,v 1.1 2000/09/06 09:13:25 jvanzyl Exp $
+ * @version $Id: Utils.java,v 1.2 2000/09/08 19:46:21 jvanzyl Exp $
*/
public class Utils
{
@@ -77,12 +77,12 @@
public static Object invoke(Object object, String method, Object[] args)
{
- // I have find the type of class for each elements
- // in args.
-
- Class[] paramTypes = null;
-
- if (args != null)
+ return invoke(object, method, null, null);
+ }
+
+ public static Object invoke(Object object, String method, Object[] args, Class[] paramTypes)
+ {
+ if (args != null && paramTypes == null)
{
int size = args.length;
paramTypes = new Class[size];
@@ -95,7 +95,6 @@
Class c = object.getClass();
Method m = c.getMethod(method, paramTypes);
Object o = m.invoke(object, args);
-
return (o);
}
catch (Exception e)
1.2 +12 -3 jakarta-velocity/src/java/org/apache/velocity/cache/Executor.java
Index: Executor.java
===================================================================
RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/cache/Executor.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Executor.java 2000/09/06 09:13:26 1.1
+++ Executor.java 2000/09/08 19:46:25 1.2
@@ -39,9 +39,12 @@
private Executor parent;
private Executor next;
- protected Object object;
- protected Method method;
- protected Object[] parameters;
+ // the root of introspection can't be cached, it
+ // may change all the time.
+ private Object object;
+ private Method method;
+ private Object[] parameters;
+ private Class[] parameterTypes;
// now parameters can be
// variables, executors, string literals.
@@ -51,6 +54,12 @@
public Executor()
{
}
+
+ public Executor(Method method, Class[] parameterTypes)
+ {
+ this.method = method;
+ this.parameterTypes = parameterTypes;
+ }
public void setObject(Object object)
{
1.2 +81 -39 jakarta-velocity/src/java/org/apache/velocity/processor/javacc/parser/Parser.java
Index: Parser.java
===================================================================
RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/processor/javacc/parser/Parser.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Parser.java 2000/09/06 09:13:30 1.1
+++ Parser.java 2000/09/08 19:46:27 1.2
@@ -14,7 +14,7 @@
* what controls the generation of this class.
*
* @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
- * @version $Id: Parser.java,v 1.1 2000/09/06 09:13:30 jvanzyl Exp $
+ * @version $Id: Parser.java,v 1.2 2000/09/08 19:46:27 jvanzyl Exp $
*/
public class Parser/*@bgen(jjtree)*/implements ParserTreeConstants, ParserConstants {/*@bgen(jjtree)*/
protected JJTParserState jjtree = new JJTParserState();
@@ -57,8 +57,15 @@
case QUOTE:
case HYPHEN:
case UNDERSCORE:
- case LT:
- case GT:
+ case LOGICAL_AND:
+ case LOGICAL_OR:
+ case LOGICAL_LT:
+ case LOGICAL_LE:
+ case LOGICAL_GT:
+ case LOGICAL_GE:
+ case LOGICAL_EQUALS:
+ case LOGICAL_NOT_EQUALS:
+ case LOGICAL_NOT:
case EQUALS:
case IN:
case TRUE:
@@ -129,8 +136,15 @@
case QUOTE:
case HYPHEN:
case UNDERSCORE:
- case LT:
- case GT:
+ case LOGICAL_AND:
+ case LOGICAL_OR:
+ case LOGICAL_LT:
+ case LOGICAL_LE:
+ case LOGICAL_GT:
+ case LOGICAL_GE:
+ case LOGICAL_EQUALS:
+ case LOGICAL_NOT_EQUALS:
+ case LOGICAL_NOT:
case EQUALS:
case IN:
case TRUE:
@@ -445,8 +459,15 @@
case QUOTE:
case HYPHEN:
case UNDERSCORE:
- case LT:
- case GT:
+ case LOGICAL_AND:
+ case LOGICAL_OR:
+ case LOGICAL_LT:
+ case LOGICAL_LE:
+ case LOGICAL_GT:
+ case LOGICAL_GE:
+ case LOGICAL_EQUALS:
+ case LOGICAL_NOT_EQUALS:
+ case LOGICAL_NOT:
case EQUALS:
case IN:
case TRUE:
@@ -556,12 +577,33 @@
case STRING_LITERAL:
jj_consume_token(STRING_LITERAL);
break;
- case LT:
- jj_consume_token(LT);
+ case LOGICAL_AND:
+ jj_consume_token(LOGICAL_AND);
break;
- case GT:
- jj_consume_token(GT);
+ case LOGICAL_OR:
+ jj_consume_token(LOGICAL_OR);
break;
+ case LOGICAL_LT:
+ jj_consume_token(LOGICAL_LT);
+ break;
+ case LOGICAL_LE:
+ jj_consume_token(LOGICAL_LE);
+ break;
+ case LOGICAL_GT:
+ jj_consume_token(LOGICAL_GT);
+ break;
+ case LOGICAL_GE:
+ jj_consume_token(LOGICAL_GE);
+ break;
+ case LOGICAL_EQUALS:
+ jj_consume_token(LOGICAL_EQUALS);
+ break;
+ case LOGICAL_NOT_EQUALS:
+ jj_consume_token(LOGICAL_NOT_EQUALS);
+ break;
+ case LOGICAL_NOT:
+ jj_consume_token(LOGICAL_NOT);
+ break;
default:
jj_la1[8] = jj_gen;
jj_consume_token(-1);
@@ -946,6 +988,29 @@
return retval;
}
+ final private boolean jj_3R_9() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_10()) {
+ jj_scanpos = xsp;
+ if (jj_3R_11()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_10() {
+ if (jj_3R_12()) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
+ final private boolean jj_3R_13() {
+ if (jj_scan_token(STRING_LITERAL)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
final private boolean jj_3R_12() {
if (jj_scan_token(DIDENTIFIER)) return true;
if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
@@ -1009,29 +1074,6 @@
return false;
}
- final private boolean jj_3R_9() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_10()) {
- jj_scanpos = xsp;
- if (jj_3R_11()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_10() {
- if (jj_3R_12()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_13() {
- if (jj_scan_token(STRING_LITERAL)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
public ParserTokenManager token_source;
ASCII_CharStream jj_input_stream;
public Token token, jj_nt;
@@ -1042,8 +1084,8 @@
private boolean jj_semLA;
private int jj_gen;
final private int[] jj_la1 = new int[12];
- final private int[] jj_la1_0 = {0xf7bfffc0,0xf7bfffc0,0x100000,0x400,0x100000,0x0,0xc0000,0xf7bfffc0,0x1fffc0,0x8000000,0x8000000,0x1c0000,};
- final private int[] jj_la1_1 = {0x73,0x73,0x20,0x0,0x20,0x10,0x20,0x73,0x52,0x0,0x0,0x20,};
+ final private int[] jj_la1_0 = {0xdfffffc0,0xdfffffc0,0x8000000,0x400,0x8000000,0x0,0x6000000,0xdfffffc0,0xfffffc0,0x0,0x0,0xe000000,};
+ final private int[] jj_la1_1 = {0x39fb,0x39fb,0x1000,0x0,0x1000,0x800,0x1000,0x39fb,0x2900,0x4,0x4,0x1000,};
final private JJCalls[] jj_2_rtns = new JJCalls[2];
private boolean jj_rescan = false;
private int jj_gc = 0;
@@ -1212,8 +1254,8 @@
final public ParseException generateParseException() {
jj_expentries.removeAllElements();
- boolean[] la1tokens = new boolean[40];
- for (int i = 0; i < 40; i++) {
+ boolean[] la1tokens = new boolean[47];
+ for (int i = 0; i < 47; i++) {
la1tokens[i] = false;
}
if (jj_kind >= 0) {
@@ -1232,7 +1274,7 @@
}
}
}
- for (int i = 0; i < 40; i++) {
+ for (int i = 0; i < 47; i++) {
if (la1tokens[i]) {
jj_expentry = new int[1];
jj_expentry[0] = i;
1.2 +31 -8 jakarta-velocity/src/java/org/apache/velocity/processor/javacc/parser/Parser.jj
Index: Parser.jj
===================================================================
RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/processor/javacc/parser/Parser.jj,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Parser.jj 2000/09/06 09:13:30 1.1
+++ Parser.jj 2000/09/08 19:46:28 1.2
@@ -77,6 +77,7 @@
DEBUG_PARSER=true;
DEBUG_TOKEN_MANAGER=true;
*/
+
}
PARSER_BEGIN(Parser)
@@ -96,7 +97,7 @@
* what controls the generation of this class.
*
* @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
- * @version $Id: Parser.jj,v 1.1 2000/09/06 09:13:30 jvanzyl Exp $
+ * @version $Id: Parser.jj,v 1.2 2000/09/08 19:46:28 jvanzyl Exp $
*/
public class Parser/*@bgen(jjtree)*/implements ParserTreeConstants/*@egen*/
{/*@bgen(jjtree)*/
@@ -155,10 +156,27 @@
| <QUOTE: "\"">
| <HYPHEN: "-">
| <UNDERSCORE: "_">
-| <LT: "<">
-| <GT: ">">
}
+// Logic operators.
+
+TOKEN :
+{
+ <LOGICAL_AND: "&&">
+| <LOGICAL_OR: "||">
+| <LOGICAL_LT: "<">
+| <LOGICAL_LE: "<=">
+| <LOGICAL_GT: ">">
+| <LOGICAL_GE: ">=">
+| <LOGICAL_EQUALS: "==">
+| <LOGICAL_NOT_EQUALS: "!=">
+| <LOGICAL_NOT: "!">
+}
+
+// These operators must be allowed to
+// show up as text as well.
+
+
// These are special tokens that appear
// in directives. The single character
// tokens must also be remove from
@@ -170,7 +188,7 @@
| <IN: "in" >
| <TRUE: "true">
| <FALSE: "false">
-| <STRING_LITERAL: ( "\"" ( ~["\""] )* "\"" ) >
+| <STRING_LITERAL: ( "\"" ( ~["\"","\n","\r"] )* "\"" ) >
{
if (incMode)
{
@@ -674,16 +692,21 @@
| <TRUE>
| <FALSE>
| <STRING_LITERAL>
-| <LT>
-| <GT>/*@bgen(jjtree)*/
+| <LOGICAL_AND>
+| <LOGICAL_OR>
+| <LOGICAL_LT>
+| <LOGICAL_LE>
+| <LOGICAL_GT>
+| <LOGICAL_GE>
+| <LOGICAL_EQUALS>
+| <LOGICAL_NOT_EQUALS>
+| <LOGICAL_NOT>/*@bgen(jjtree)*/
} finally {
if (jjtc000) {
jjtree.closeNodeScope(jjtn000, true);
}
}
/*@egen*/
-//| <LBRACKET>
-//| <RBRACKET>
}
/**
1.2 +31 -8 jakarta-velocity/src/java/org/apache/velocity/processor/javacc/parser/Parser.jjt
Index: Parser.jjt
===================================================================
RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/processor/javacc/parser/Parser.jjt,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Parser.jjt 2000/09/06 09:13:30 1.1
+++ Parser.jjt 2000/09/08 19:46:28 1.2
@@ -101,6 +101,7 @@
DEBUG_PARSER=true;
DEBUG_TOKEN_MANAGER=true;
*/
+
}
PARSER_BEGIN(Parser)
@@ -120,7 +121,7 @@
* what controls the generation of this class.
*
* @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
- * @version $Id: Parser.jjt,v 1.1 2000/09/06 09:13:30 jvanzyl Exp $
+ * @version $Id: Parser.jjt,v 1.2 2000/09/08 19:46:28 jvanzyl Exp $
*/
public class Parser
{
@@ -176,10 +177,27 @@
| <QUOTE: "\"">
| <HYPHEN: "-">
| <UNDERSCORE: "_">
-| <LT: "<">
-| <GT: ">">
}
+// Logic operators.
+
+TOKEN :
+{
+ <LOGICAL_AND: "&&">
+| <LOGICAL_OR: "||">
+| <LOGICAL_LT: "<">
+| <LOGICAL_LE: "<=">
+| <LOGICAL_GT: ">">
+| <LOGICAL_GE: ">=">
+| <LOGICAL_EQUALS: "==">
+| <LOGICAL_NOT_EQUALS: "!=">
+| <LOGICAL_NOT: "!">
+}
+
+// These operators must be allowed to
+// show up as text as well.
+
+
// These are special tokens that appear
// in directives. The single character
// tokens must also be remove from
@@ -191,7 +209,7 @@
| <IN: "in" >
| <TRUE: "true">
| <FALSE: "false">
-| <STRING_LITERAL: ( "\"" ( ~["\""] )* "\"" ) >
+| <STRING_LITERAL: ( "\"" ( ~["\"","\n","\r"] )* "\"" ) >
{
if (incMode)
{
@@ -506,10 +524,15 @@
| <TRUE>
| <FALSE>
| <STRING_LITERAL>
-| <LT>
-| <GT>
-//| <LBRACKET>
-//| <RBRACKET>
+| <LOGICAL_AND>
+| <LOGICAL_OR>
+| <LOGICAL_LT>
+| <LOGICAL_LE>
+| <LOGICAL_GT>
+| <LOGICAL_GE>
+| <LOGICAL_EQUALS>
+| <LOGICAL_NOT_EQUALS>
+| <LOGICAL_NOT>
}
/**
1.2 +40 -26 jakarta-velocity/src/java/org/apache/velocity/processor/javacc/parser/ParserConstants.java
Index: ParserConstants.java
===================================================================
RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/processor/javacc/parser/ParserConstants.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ParserConstants.java 2000/09/06 09:13:30 1.1
+++ ParserConstants.java 2000/09/08 19:46:29 1.2
@@ -12,32 +12,39 @@
int QUOTE = 11;
int HYPHEN = 12;
int UNDERSCORE = 13;
- int LT = 14;
- int GT = 15;
- int EQUALS = 16;
- int IN = 17;
- int TRUE = 18;
- int FALSE = 19;
- int STRING_LITERAL = 20;
- int BEGIN = 21;
- int END = 22;
- int INCLUDE_DIRECTIVE = 23;
- int PARSE_DIRECTIVE = 24;
- int IF_DIRECTIVE = 25;
- int ELSEIF_DIRECTIVE = 26;
- int ELSE_DIRECTIVE = 27;
- int FOREACH_DIRECTIVE = 28;
- int SET_DIRECTIVE = 29;
- int PARAM_DIRECTIVE = 30;
- int USE_DIRECTIVE = 31;
- int STOP_DIRECTIVE = 32;
- int ALPHA_CHAR = 33;
- int ALPHANUM_CHAR = 34;
- int IDENTIFIER_CHAR = 35;
- int IDENTIFIER = 36;
- int DIDENTIFIER = 37;
- int TEXT = 38;
- int SINGLE_LINE_COMMENT = 39;
+ int LOGICAL_AND = 14;
+ int LOGICAL_OR = 15;
+ int LOGICAL_LT = 16;
+ int LOGICAL_LE = 17;
+ int LOGICAL_GT = 18;
+ int LOGICAL_GE = 19;
+ int LOGICAL_EQUALS = 20;
+ int LOGICAL_NOT_EQUALS = 21;
+ int LOGICAL_NOT = 22;
+ int EQUALS = 23;
+ int IN = 24;
+ int TRUE = 25;
+ int FALSE = 26;
+ int STRING_LITERAL = 27;
+ int BEGIN = 28;
+ int END = 29;
+ int INCLUDE_DIRECTIVE = 30;
+ int PARSE_DIRECTIVE = 31;
+ int IF_DIRECTIVE = 32;
+ int ELSEIF_DIRECTIVE = 33;
+ int ELSE_DIRECTIVE = 34;
+ int FOREACH_DIRECTIVE = 35;
+ int SET_DIRECTIVE = 36;
+ int PARAM_DIRECTIVE = 37;
+ int USE_DIRECTIVE = 38;
+ int STOP_DIRECTIVE = 39;
+ int ALPHA_CHAR = 40;
+ int ALPHANUM_CHAR = 41;
+ int IDENTIFIER_CHAR = 42;
+ int IDENTIFIER = 43;
+ int DIDENTIFIER = 44;
+ int TEXT = 45;
+ int SINGLE_LINE_COMMENT = 46;
int DEFAULT = 0;
@@ -56,8 +63,15 @@
"\"\\\"\"",
"\"-\"",
"\"_\"",
+ "\"&&\"",
+ "\"||\"",
"\"<\"",
+ "\"<=\"",
"\">\"",
+ "\">=\"",
+ "\"==\"",
+ "\"!=\"",
+ "\"!\"",
"\"=\"",
"\"in\"",
"\"true\"",
1.2 +244 -209 jakarta-velocity/src/java/org/apache/velocity/processor/javacc/parser/ParserTokenManager.java
Index: ParserTokenManager.java
===================================================================
RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/processor/javacc/parser/ParserTokenManager.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ParserTokenManager.java 2000/09/06 09:13:30 1.1
+++ ParserTokenManager.java 2000/09/08 19:46:29 1.2
@@ -91,107 +91,114 @@
switch (pos)
{
case 0:
+ if ((active0 & 0xc000L) != 0L)
+ {
+ jjmatchedKind = 45;
+ return 8;
+ }
+ if ((active0 & 0x7000000L) != 0L)
+ {
+ jjmatchedKind = 40;
+ return 17;
+ }
if ((active0 & 0x40L) != 0L)
return 6;
- if ((active0 & 0x10020L) != 0L)
+ if ((active0 & 0xf00020L) != 0L)
return 8;
- if ((active0 & 0x1ffe00000L) != 0L)
+ if ((active0 & 0xfff0000000L) != 0L)
{
- jjmatchedKind = 38;
+ jjmatchedKind = 45;
return 9;
}
- if ((active0 & 0xe0000L) != 0L)
- {
- jjmatchedKind = 33;
- return 17;
- }
if ((active0 & 0x800L) != 0L)
return 18;
return -1;
case 1:
- if ((active0 & 0xc0000L) != 0L)
+ if ((active0 & 0xfff0000000L) != 0L)
{
- jjmatchedKind = 36;
+ jjmatchedKind = 45;
jjmatchedPos = 1;
- return 17;
+ return 8;
}
- if ((active0 & 0x20000L) != 0L)
+ if ((active0 & 0x30c000L) != 0L)
+ return 8;
+ if ((active0 & 0x1000000L) != 0L)
return 17;
- if ((active0 & 0x1ffe00000L) != 0L)
+ if ((active0 & 0x6000000L) != 0L)
{
- jjmatchedKind = 38;
+ jjmatchedKind = 43;
jjmatchedPos = 1;
- return 8;
+ return 17;
}
return -1;
case 2:
- if ((active0 & 0xc0000L) != 0L)
+ if ((active0 & 0xfef0000000L) != 0L)
{
- jjmatchedKind = 36;
+ jjmatchedKind = 45;
jjmatchedPos = 2;
- return 17;
+ return 8;
}
- if ((active0 & 0x2000000L) != 0L)
+ if ((active0 & 0x100000000L) != 0L)
return 8;
- if ((active0 & 0x1fde00000L) != 0L)
+ if ((active0 & 0x6000000L) != 0L)
{
- jjmatchedKind = 38;
+ jjmatchedKind = 43;
jjmatchedPos = 2;
- return 8;
+ return 17;
}
return -1;
case 3:
- if ((active0 & 0x15da00000L) != 0L)
+ if ((active0 & 0xaed0000000L) != 0L)
{
- jjmatchedKind = 38;
+ jjmatchedKind = 45;
jjmatchedPos = 3;
return 8;
}
- if ((active0 & 0x80000L) != 0L)
+ if ((active0 & 0x5020000000L) != 0L)
+ return 8;
+ if ((active0 & 0x2000000L) != 0L)
+ return 17;
+ if ((active0 & 0x4000000L) != 0L)
{
- jjmatchedKind = 36;
+ jjmatchedKind = 43;
jjmatchedPos = 3;
return 17;
}
- if ((active0 & 0xa0400000L) != 0L)
- return 8;
- if ((active0 & 0x40000L) != 0L)
- return 17;
return -1;
case 4:
- if ((active0 & 0x51a00000L) != 0L)
+ if ((active0 & 0x28d0000000L) != 0L)
{
if (jjmatchedPos != 4)
{
- jjmatchedKind = 38;
+ jjmatchedKind = 45;
jjmatchedPos = 4;
}
return 8;
}
- if ((active0 & 0x10c000000L) != 0L)
+ if ((active0 & 0x8600000000L) != 0L)
return 8;
- if ((active0 & 0x80000L) != 0L)
+ if ((active0 & 0x4000000L) != 0L)
return 17;
return -1;
case 5:
- if ((active0 & 0x14800000L) != 0L)
+ if ((active0 & 0xa40000000L) != 0L)
{
- jjmatchedKind = 38;
+ jjmatchedKind = 45;
jjmatchedPos = 5;
return 8;
}
- if ((active0 & 0x41200000L) != 0L)
+ if ((active0 & 0x2090000000L) != 0L)
return 8;
return -1;
case 6:
- if ((active0 & 0x10800000L) != 0L)
+ if ((active0 & 0x200000000L) != 0L)
+ return 8;
+ if ((active0 & 0x840000000L) != 0L)
{
- jjmatchedKind = 38;
+ jjmatchedKind = 45;
jjmatchedPos = 6;
return 8;
}
- if ((active0 & 0x4000000L) != 0L)
- return 8;
return -1;
default :
return -1;
@@ -221,12 +228,17 @@
{
case 12:
return jjStartNfaWithStates_0(0, 5, 8);
+ case 33:
+ jjmatchedKind = 22;
+ return jjMoveStringLiteralDfa1_0(0x200000L);
case 34:
return jjStartNfaWithStates_0(0, 11, 18);
case 35:
- return jjMoveStringLiteralDfa1_0(0x1ffe00000L);
+ return jjMoveStringLiteralDfa1_0(0xfff0000000L);
case 36:
return jjStartNfaWithStates_0(0, 6, 6);
+ case 38:
+ return jjMoveStringLiteralDfa1_0(0x4000L);
case 40:
return jjStopAtPos(0, 8);
case 41:
@@ -238,19 +250,24 @@
case 46:
return jjStopAtPos(0, 7);
case 60:
- return jjStopAtPos(0, 14);
+ jjmatchedKind = 16;
+ return jjMoveStringLiteralDfa1_0(0x20000L);
case 61:
- return jjStartNfaWithStates_0(0, 16, 8);
+ jjmatchedKind = 23;
+ return jjMoveStringLiteralDfa1_0(0x100000L);
case 62:
- return jjStopAtPos(0, 15);
+ jjmatchedKind = 18;
+ return jjMoveStringLiteralDfa1_0(0x80000L);
case 95:
return jjStopAtPos(0, 13);
case 102:
- return jjMoveStringLiteralDfa1_0(0x80000L);
+ return jjMoveStringLiteralDfa1_0(0x4000000L);
case 105:
- return jjMoveStringLiteralDfa1_0(0x20000L);
+ return jjMoveStringLiteralDfa1_0(0x1000000L);
case 116:
- return jjMoveStringLiteralDfa1_0(0x40000L);
+ return jjMoveStringLiteralDfa1_0(0x2000000L);
+ case 124:
+ return jjMoveStringLiteralDfa1_0(0x8000L);
default :
return jjMoveNfa_0(0, 0);
}
@@ -264,28 +281,46 @@
}
switch(curChar)
{
+ case 38:
+ if ((active0 & 0x4000L) != 0L)
+ return jjStartNfaWithStates_0(1, 14, 8);
+ break;
+ case 61:
+ if ((active0 & 0x20000L) != 0L)
+ return jjStopAtPos(1, 17);
+ else if ((active0 & 0x80000L) != 0L)
+ return jjStopAtPos(1, 19);
+ else if ((active0 & 0x100000L) != 0L)
+ return jjStartNfaWithStates_0(1, 20, 8);
+ else if ((active0 & 0x200000L) != 0L)
+ return jjStartNfaWithStates_0(1, 21, 8);
+ break;
case 97:
- return jjMoveStringLiteralDfa2_0(active0, 0x80000L);
+ return jjMoveStringLiteralDfa2_0(active0, 0x4000000L);
case 98:
- return jjMoveStringLiteralDfa2_0(active0, 0x200000L);
+ return jjMoveStringLiteralDfa2_0(active0, 0x10000000L);
case 101:
- return jjMoveStringLiteralDfa2_0(active0, 0xc400000L);
+ return jjMoveStringLiteralDfa2_0(active0, 0x620000000L);
case 102:
- return jjMoveStringLiteralDfa2_0(active0, 0x10000000L);
+ return jjMoveStringLiteralDfa2_0(active0, 0x800000000L);
case 105:
- return jjMoveStringLiteralDfa2_0(active0, 0x2800000L);
+ return jjMoveStringLiteralDfa2_0(active0, 0x140000000L);
case 110:
- if ((active0 & 0x20000L) != 0L)
- return jjStartNfaWithStates_0(1, 17, 17);
+ if ((active0 & 0x1000000L) != 0L)
+ return jjStartNfaWithStates_0(1, 24, 17);
break;
case 112:
- return jjMoveStringLiteralDfa2_0(active0, 0x41000000L);
+ return jjMoveStringLiteralDfa2_0(active0, 0x2080000000L);
case 114:
- return jjMoveStringLiteralDfa2_0(active0, 0x40000L);
+ return jjMoveStringLiteralDfa2_0(active0, 0x2000000L);
case 115:
- return jjMoveStringLiteralDfa2_0(active0, 0x120000000L);
+ return jjMoveStringLiteralDfa2_0(active0, 0x9000000000L);
case 117:
- return jjMoveStringLiteralDfa2_0(active0, 0x80000000L);
+ return jjMoveStringLiteralDfa2_0(active0, 0x4000000000L);
+ case 124:
+ if ((active0 & 0x8000L) != 0L)
+ return jjStartNfaWithStates_0(1, 15, 8);
+ break;
default :
break;
}
@@ -303,25 +338,25 @@
switch(curChar)
{
case 97:
- return jjMoveStringLiteralDfa3_0(active0, 0x41000000L);
+ return jjMoveStringLiteralDfa3_0(active0, 0x2080000000L);
case 101:
- return jjMoveStringLiteralDfa3_0(active0, 0x20200000L);
+ return jjMoveStringLiteralDfa3_0(active0, 0x1010000000L);
case 102:
- if ((active0 & 0x2000000L) != 0L)
- return jjStartNfaWithStates_0(2, 25, 8);
+ if ((active0 & 0x100000000L) != 0L)
+ return jjStartNfaWithStates_0(2, 32, 8);
break;
case 108:
- return jjMoveStringLiteralDfa3_0(active0, 0xc080000L);
+ return jjMoveStringLiteralDfa3_0(active0, 0x604000000L);
case 110:
- return jjMoveStringLiteralDfa3_0(active0, 0xc00000L);
+ return jjMoveStringLiteralDfa3_0(active0, 0x60000000L);
case 111:
- return jjMoveStringLiteralDfa3_0(active0, 0x10000000L);
+ return jjMoveStringLiteralDfa3_0(active0, 0x800000000L);
case 115:
- return jjMoveStringLiteralDfa3_0(active0, 0x80000000L);
+ return jjMoveStringLiteralDfa3_0(active0, 0x4000000000L);
case 116:
- return jjMoveStringLiteralDfa3_0(active0, 0x100000000L);
+ return jjMoveStringLiteralDfa3_0(active0, 0x8000000000L);
case 117:
- return jjMoveStringLiteralDfa3_0(active0, 0x40000L);
+ return jjMoveStringLiteralDfa3_0(active0, 0x2000000L);
default :
break;
}
@@ -339,28 +374,28 @@
switch(curChar)
{
case 99:
- return jjMoveStringLiteralDfa4_0(active0, 0x800000L);
+ return jjMoveStringLiteralDfa4_0(active0, 0x40000000L);
case 100:
- if ((active0 & 0x400000L) != 0L)
- return jjStartNfaWithStates_0(3, 22, 8);
+ if ((active0 & 0x20000000L) != 0L)
+ return jjStartNfaWithStates_0(3, 29, 8);
break;
case 101:
- if ((active0 & 0x40000L) != 0L)
- return jjStartNfaWithStates_0(3, 18, 17);
- else if ((active0 & 0x80000000L) != 0L)
- return jjStartNfaWithStates_0(3, 31, 8);
+ if ((active0 & 0x2000000L) != 0L)
+ return jjStartNfaWithStates_0(3, 25, 17);
+ else if ((active0 & 0x4000000000L) != 0L)
+ return jjStartNfaWithStates_0(3, 38, 8);
break;
case 103:
- return jjMoveStringLiteralDfa4_0(active0, 0x200000L);
+ return jjMoveStringLiteralDfa4_0(active0, 0x10000000L);
case 111:
- return jjMoveStringLiteralDfa4_0(active0, 0x100000000L);
+ return jjMoveStringLiteralDfa4_0(active0, 0x8000000000L);
case 114:
- return jjMoveStringLiteralDfa4_0(active0, 0x51000000L);
+ return jjMoveStringLiteralDfa4_0(active0, 0x2880000000L);
case 115:
- return jjMoveStringLiteralDfa4_0(active0, 0xc080000L);
+ return jjMoveStringLiteralDfa4_0(active0, 0x604000000L);
case 116:
- if ((active0 & 0x20000000L) != 0L)
- return jjStartNfaWithStates_0(3, 29, 8);
+ if ((active0 & 0x1000000000L) != 0L)
+ return jjStartNfaWithStates_0(3, 36, 8);
break;
default :
break;
@@ -379,26 +414,26 @@
switch(curChar)
{
case 97:
- return jjMoveStringLiteralDfa5_0(active0, 0x40000000L);
+ return jjMoveStringLiteralDfa5_0(active0, 0x2000000000L);
case 101:
- if ((active0 & 0x80000L) != 0L)
- return jjStartNfaWithStates_0(4, 19, 17);
- else if ((active0 & 0x8000000L) != 0L)
+ if ((active0 & 0x4000000L) != 0L)
+ return jjStartNfaWithStates_0(4, 26, 17);
+ else if ((active0 & 0x400000000L) != 0L)
{
- jjmatchedKind = 27;
+ jjmatchedKind = 34;
jjmatchedPos = 4;
}
- return jjMoveStringLiteralDfa5_0(active0, 0x14000000L);
+ return jjMoveStringLiteralDfa5_0(active0, 0xa00000000L);
case 105:
- return jjMoveStringLiteralDfa5_0(active0, 0x200000L);
+ return jjMoveStringLiteralDfa5_0(active0, 0x10000000L);
case 108:
- return jjMoveStringLiteralDfa5_0(active0, 0x800000L);
+ return jjMoveStringLiteralDfa5_0(active0, 0x40000000L);
case 112:
- if ((active0 & 0x100000000L) != 0L)
- return jjStartNfaWithStates_0(4, 32, 8);
+ if ((active0 & 0x8000000000L) != 0L)
+ return jjStartNfaWithStates_0(4, 39, 8);
break;
case 115:
- return jjMoveStringLiteralDfa5_0(active0, 0x1000000L);
+ return jjMoveStringLiteralDfa5_0(active0, 0x80000000L);
default :
break;
}
@@ -416,23 +451,23 @@
switch(curChar)
{
case 97:
- return jjMoveStringLiteralDfa6_0(active0, 0x10000000L);
+ return jjMoveStringLiteralDfa6_0(active0, 0x800000000L);
case 101:
- if ((active0 & 0x1000000L) != 0L)
- return jjStartNfaWithStates_0(5, 24, 8);
+ if ((active0 & 0x80000000L) != 0L)
+ return jjStartNfaWithStates_0(5, 31, 8);
break;
case 105:
- return jjMoveStringLiteralDfa6_0(active0, 0x4000000L);
+ return jjMoveStringLiteralDfa6_0(active0, 0x200000000L);
case 109:
- if ((active0 & 0x40000000L) != 0L)
- return jjStartNfaWithStates_0(5, 30, 8);
+ if ((active0 & 0x2000000000L) != 0L)
+ return jjStartNfaWithStates_0(5, 37, 8);
break;
case 110:
- if ((active0 & 0x200000L) != 0L)
- return jjStartNfaWithStates_0(5, 21, 8);
+ if ((active0 & 0x10000000L) != 0L)
+ return jjStartNfaWithStates_0(5, 28, 8);
break;
case 117:
- return jjMoveStringLiteralDfa6_0(active0, 0x800000L);
+ return jjMoveStringLiteralDfa6_0(active0, 0x40000000L);
default :
break;
}
@@ -450,12 +485,12 @@
switch(curChar)
{
case 99:
- return jjMoveStringLiteralDfa7_0(active0, 0x10000000L);
+ return jjMoveStringLiteralDfa7_0(active0, 0x800000000L);
case 100:
- return jjMoveStringLiteralDfa7_0(active0, 0x800000L);
+ return jjMoveStringLiteralDfa7_0(active0, 0x40000000L);
case 102:
- if ((active0 & 0x4000000L) != 0L)
- return jjStartNfaWithStates_0(6, 26, 8);
+ if ((active0 & 0x200000000L) != 0L)
+ return jjStartNfaWithStates_0(6, 33, 8);
break;
default :
break;
@@ -474,12 +509,12 @@
switch(curChar)
{
case 101:
- if ((active0 & 0x800000L) != 0L)
- return jjStartNfaWithStates_0(7, 23, 8);
+ if ((active0 & 0x40000000L) != 0L)
+ return jjStartNfaWithStates_0(7, 30, 8);
break;
case 104:
- if ((active0 & 0x10000000L) != 0L)
- return jjStartNfaWithStates_0(7, 28, 8);
+ if ((active0 & 0x800000000L) != 0L)
+ return jjStartNfaWithStates_0(7, 35, 8);
break;
default :
break;
@@ -538,44 +573,44 @@
{
switch(jjstateSet[--i])
{
- case 17:
+ case 9:
if ((0xafff8ceaffffd9ffL & l) != 0L)
{
- if (kind > 38)
- kind = 38;
+ if (kind > 45)
+ kind = 45;
jjCheckNAdd(8);
- }
- if ((0x23ff200000000000L & l) != 0L)
- {
- if (kind > 36)
- kind = 36;
- jjCheckNAdd(16);
}
+ if (curChar == 35)
+ jjCheckNAddStates(0, 2);
break;
- case 9:
+ case 17:
if ((0xafff8ceaffffd9ffL & l) != 0L)
{
- if (kind > 38)
- kind = 38;
+ if (kind > 45)
+ kind = 45;
jjCheckNAdd(8);
}
- if (curChar == 35)
- jjCheckNAddStates(0, 2);
+ if ((0x23ff200000000000L & l) != 0L)
+ {
+ if (kind > 43)
+ kind = 43;
+ jjCheckNAdd(16);
+ }
break;
case 18:
- if ((0xfffffffbffffffffL & l) != 0L)
+ if ((0xfffffffbffffdbffL & l) != 0L)
jjCheckNAddTwoStates(1, 2);
else if (curChar == 34)
{
- if (kind > 20)
- kind = 20;
+ if (kind > 27)
+ kind = 27;
}
break;
case 0:
if ((0xafff8ceaffffd9ffL & l) != 0L)
{
- if (kind > 38)
- kind = 38;
+ if (kind > 45)
+ kind = 45;
jjCheckNAdd(8);
}
else if (curChar == 36)
@@ -584,32 +619,32 @@
jjCheckNAddTwoStates(1, 2);
if ((0x23ff200000000000L & l) != 0L)
{
- if (kind > 35)
- kind = 35;
+ if (kind > 42)
+ kind = 42;
}
else if (curChar == 35)
jjstateSet[jjnewStateCnt++] = 9;
if ((0x3ff000000000000L & l) != 0L)
{
- if (kind > 34)
- kind = 34;
+ if (kind > 41)
+ kind = 41;
}
break;
case 1:
- if ((0xfffffffbffffffffL & l) != 0L)
+ if ((0xfffffffbffffdbffL & l) != 0L)
jjCheckNAddTwoStates(1, 2);
break;
case 2:
- if (curChar == 34 && kind > 20)
- kind = 20;
+ if (curChar == 34 && kind > 27)
+ kind = 27;
break;
case 3:
- if ((0x3ff000000000000L & l) != 0L && kind > 34)
- kind = 34;
+ if ((0x3ff000000000000L & l) != 0L && kind > 41)
+ kind = 41;
break;
case 4:
- if ((0x23ff200000000000L & l) != 0L && kind > 35)
- kind = 35;
+ if ((0x23ff200000000000L & l) != 0L && kind > 42)
+ kind = 42;
break;
case 5:
if (curChar == 36)
@@ -618,15 +653,15 @@
case 7:
if ((0x23ff200000000000L & l) == 0L)
break;
- if (kind > 37)
- kind = 37;
+ if (kind > 44)
+ kind = 44;
jjstateSet[jjnewStateCnt++] = 7;
break;
case 8:
if ((0xafff8ceaffffd9ffL & l) == 0L)
break;
- if (kind > 38)
- kind = 38;
+ if (kind > 45)
+ kind = 45;
jjCheckNAdd(8);
break;
case 10:
@@ -634,12 +669,12 @@
jjCheckNAddStates(0, 2);
break;
case 11:
- if ((0x2400L & l) != 0L && kind > 39)
- kind = 39;
+ if ((0x2400L & l) != 0L && kind > 46)
+ kind = 46;
break;
case 12:
- if (curChar == 10 && kind > 39)
- kind = 39;
+ if (curChar == 10 && kind > 46)
+ kind = 46;
break;
case 13:
if (curChar == 13)
@@ -652,8 +687,8 @@
case 16:
if ((0x23ff200000000000L & l) == 0L)
break;
- if (kind > 36)
- kind = 36;
+ if (kind > 43)
+ kind = 43;
jjCheckNAdd(16);
break;
default : break;
@@ -667,28 +702,28 @@
{
switch(jjstateSet[--i])
{
+ case 9:
+ case 8:
+ if ((0xffffffff7fffffffL & l) == 0L)
+ break;
+ if (kind > 45)
+ kind = 45;
+ jjCheckNAdd(8);
+ break;
case 17:
if ((0xffffffff7fffffffL & l) != 0L)
{
- if (kind > 38)
- kind = 38;
+ if (kind > 45)
+ kind = 45;
jjCheckNAdd(8);
}
if ((0x7fffffe87fffffeL & l) != 0L)
{
- if (kind > 36)
- kind = 36;
+ if (kind > 43)
+ kind = 43;
jjCheckNAdd(16);
}
break;
- case 9:
- case 8:
- if ((0xffffffff7fffffffL & l) == 0L)
- break;
- if (kind > 38)
- kind = 38;
- jjCheckNAdd(8);
- break;
case 18:
case 1:
jjCheckNAddTwoStates(1, 2);
@@ -696,47 +731,47 @@
case 0:
if ((0xffffffff7fffffffL & l) != 0L)
{
- if (kind > 38)
- kind = 38;
+ if (kind > 45)
+ kind = 45;
jjCheckNAdd(8);
}
if ((0x7fffffe87fffffeL & l) != 0L)
{
- if (kind > 35)
- kind = 35;
+ if (kind > 42)
+ kind = 42;
}
if ((0x7fffffe07fffffeL & l) != 0L)
{
- if (kind > 33)
- kind = 33;
+ if (kind > 40)
+ kind = 40;
jjCheckNAdd(16);
}
if ((0x7fffffe07fffffeL & l) != 0L)
{
- if (kind > 34)
- kind = 34;
+ if (kind > 41)
+ kind = 41;
}
break;
case 3:
- if ((0x7fffffe07fffffeL & l) != 0L && kind > 34)
- kind = 34;
+ if ((0x7fffffe07fffffeL & l) != 0L && kind > 41)
+ kind = 41;
break;
case 4:
- if ((0x7fffffe87fffffeL & l) != 0L && kind > 35)
- kind = 35;
+ if ((0x7fffffe87fffffeL & l) != 0L && kind > 42)
+ kind = 42;
break;
case 6:
if ((0x7fffffe07fffffeL & l) == 0L)
break;
- if (kind > 37)
- kind = 37;
+ if (kind > 44)
+ kind = 44;
jjCheckNAdd(7);
break;
case 7:
if ((0x7fffffe87fffffeL & l) == 0L)
break;
- if (kind > 37)
- kind = 37;
+ if (kind > 44)
+ kind = 44;
jjCheckNAdd(7);
break;
case 10:
@@ -745,15 +780,15 @@
case 15:
if ((0x7fffffe07fffffeL & l) == 0L)
break;
- if (kind > 33)
- kind = 33;
+ if (kind > 40)
+ kind = 40;
jjCheckNAdd(16);
break;
case 16:
if ((0x7fffffe87fffffeL & l) == 0L)
break;
- if (kind > 36)
- kind = 36;
+ if (kind > 43)
+ kind = 43;
jjCheckNAdd(16);
break;
default : break;
@@ -768,19 +803,19 @@
{
switch(jjstateSet[--i])
{
- case 17:
+ case 9:
case 8:
if ((jjbitVec0[i2] & l2) == 0L)
break;
- if (kind > 38)
- kind = 38;
+ if (kind > 45)
+ kind = 45;
jjCheckNAdd(8);
break;
- case 9:
+ case 17:
if ((jjbitVec0[i2] & l2) == 0L)
break;
- if (kind > 38)
- kind = 38;
+ if (kind > 45)
+ kind = 45;
jjCheckNAdd(8);
break;
case 18:
@@ -791,8 +826,8 @@
case 0:
if ((jjbitVec0[i2] & l2) == 0L)
break;
- if (kind > 38)
- kind = 38;
+ if (kind > 45)
+ kind = 45;
jjCheckNAdd(8);
break;
case 10:
@@ -821,23 +856,23 @@
};
public static final String[] jjstrLiteralImages = {
"", null, null, null, null, null, "\44", "\56", "\50", "\51", "\54", "\42",
-"\55", "\137", "\74", "\76", "\75", "\151\156", "\164\162\165\145",
-"\146\141\154\163\145", null, "\43\142\145\147\151\156", "\43\145\156\144",
-"\43\151\156\143\154\165\144\145", "\43\160\141\162\163\145", "\43\151\146", "\43\145\154\163\145\151\146",
-"\43\145\154\163\145", "\43\146\157\162\145\141\143\150", "\43\163\145\164",
-"\43\160\141\162\141\155", "\43\165\163\145", "\43\163\164\157\160", null, null, null, null, null, null,
-null, };
+"\55", "\137", "\46\46", "\174\174", "\74", "\74\75", "\76", "\76\75", "\75\75",
+"\41\75", "\41", "\75", "\151\156", "\164\162\165\145", "\146\141\154\163\145", null,
+"\43\142\145\147\151\156", "\43\145\156\144", "\43\151\156\143\154\165\144\145",
+"\43\160\141\162\163\145", "\43\151\146", "\43\145\154\163\145\151\146", "\43\145\154\163\145",
+"\43\146\157\162\145\141\143\150", "\43\163\145\164", "\43\160\141\162\141\155", "\43\165\163\145",
+"\43\163\164\157\160", null, null, null, null, null, null, null, };
public static final String[] lexStateNames = {
"DEFAULT",
};
static final long[] jjtoToken = {
- 0x7fffffffc1L,
+ 0x3fffffffffc1L,
};
static final long[] jjtoSkip = {
- 0x800000003eL,
+ 0x40000000003eL,
};
static final long[] jjtoSpecial = {
- 0x8000000000L,
+ 0x400000000000L,
};
private ASCII_CharStream input_stream;
private final int[] jjrounds = new int[17];
@@ -992,7 +1027,7 @@
{
switch(jjmatchedKind)
{
- case 20 :
+ case 27 :
if (image == null)
image = new StringBuffer(new String(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1))));
else
@@ -1004,25 +1039,25 @@
}
incMode = false;
break;
- case 23 :
+ case 30 :
if (image == null)
- image = new StringBuffer(jjstrLiteralImages[23]);
+ image = new StringBuffer(jjstrLiteralImages[30]);
else
- image.append(jjstrLiteralImages[23]);
+ image.append(jjstrLiteralImages[30]);
incMode = true;
break;
- case 24 :
+ case 31 :
if (image == null)
- image = new StringBuffer(jjstrLiteralImages[24]);
+ image = new StringBuffer(jjstrLiteralImages[31]);
else
- image.append(jjstrLiteralImages[24]);
+ image.append(jjstrLiteralImages[31]);
incMode = true;
break;
- case 32 :
+ case 39 :
if (image == null)
- image = new StringBuffer(jjstrLiteralImages[32]);
+ image = new StringBuffer(jjstrLiteralImages[39]);
else
- image.append(jjstrLiteralImages[32]);
+ image.append(jjstrLiteralImages[39]);
matchedToken.kind = EOF;
fileDepth = 0;
break;
1.2 +82 -29 jakarta-velocity/src/java/org/apache/velocity/processor/javacc/visitor/BaseVisitor.java
Index: BaseVisitor.java
===================================================================
RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/processor/javacc/visitor/BaseVisitor.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- BaseVisitor.java 2000/09/06 09:13:31 1.1
+++ BaseVisitor.java 2000/09/08 19:46:32 1.2
@@ -3,6 +3,8 @@
import java.io.Writer;
import java.io.IOException;
+import java.util.Map;
+
import org.apache.velocity.Utils;
import org.apache.velocity.Context;
@@ -14,7 +16,8 @@
{
protected Context context;
protected Writer writer;
-
+ protected String property;
+
public void reset()
{
}
@@ -34,8 +37,13 @@
return null;
}
+ protected Object getReferenceValue(ASTReference node)
+ {
+ return getReferenceValue(node, 0);
+ }
+
// Put this in the base visitor.
- protected Object getReferenceValue(ASTReference node)
+ protected Object getReferenceValue(ASTReference node, int tailChildrenToIgnore)
{
// The rootOfIntrospection is the object we will
// retrieve from the Context. This is the base
@@ -43,53 +51,98 @@
String rootOfIntrospection = node.getFirstToken().image;
Object result = getVariableValue(rootOfIntrospection);
+ Object newResult;
+ String method;
+ String identifier;
// How many child nodes do we have?
int children = node.jjtGetNumChildren();
- for (int i = 0; i < children; i++)
+ for (int i = 0; i < children - tailChildrenToIgnore; i++)
{
Node n = node.jjtGetChild(i);
// Change this to use polymorphism!
-
- if (n.getType() == ParserTreeConstants.JJTIDENTIFIER)
- {
- String method = "get" + n.getFirstToken().image;
- result = Utils.invoke(result, method);
- }
- else if (n.getType() == ParserTreeConstants.JJTMETHOD)
+ switch(n.getType())
{
- // node 1: method name
- // The rest of the nodes are parameters
- // to the method. They may be references
- // or string literals. If they are
- // references then we just use a little
- // recursion.
+ case ParserTreeConstants.JJTIDENTIFIER:
+ identifier = n.getFirstToken().image;
+ method = "get" + identifier;
+
+ newResult = Utils.invoke(result, method);
+ if (newResult == null)
+ {
+ method = "get";
+ Object[] args = { identifier };
+ Class[] ptypes = null;
+
+ // Have to make sure class types are
+ // correct for a proper signature match.
+
+ if (result instanceof Map)
+ {
+ ptypes = new Class[1];
+ ptypes[0] = new Object().getClass();
+ }
+
+ result = Utils.invoke(result, method, args, ptypes);
+ }
+ else
+ result = newResult;
+
+ break;
+
+ case ParserTreeConstants.JJTMETHOD:
- String method = n.jjtGetChild(0).getFirstToken().image;
- int parameters = n.jjtGetNumChildren() - 1;
+ // node 1: method name
+ // The rest of the nodes are parameters
+ // to the method. They may be references
+ // or string literals. If they are
+ // references then we just use a little
+ // recursion.
+
+ method = n.jjtGetChild(0).getFirstToken().image;
+ int parameters = n.jjtGetNumChildren() - 1;
- Object[] params = new Object[parameters];
+ Object[] params = new Object[parameters];
- for (int j = 0; j < parameters; j++)
- {
- Node p = n.jjtGetChild(j + 1);
+ for (int j = 0; j < parameters; j++)
+ {
+ Node p = n.jjtGetChild(j + 1);
- // Again use polymorphism. Wait until
- // the nodes settle down.
+ // Again use polymorphism. Wait until
+ // the nodes settle down.
+
+ switch(p.getType())
+ {
+ case ParserTreeConstants.JJTREFERENCE:
+ params[j] = getReferenceValue((ASTReference)p);
+ break;
+
+ case ParserTreeConstants.JJTSTRINGLITERAL:
+ params[j] = getStringLiteralValue(p.getFirstToken().image);
+ break;
+ }
+ }
- if (p.getType() == ParserTreeConstants.JJTREFERENCE)
- params[j] = getReferenceValue((ASTReference)p);
- else if (p.getType() == ParserTreeConstants.JJTSTRINGLITERAL)
- params[j] = getStringLiteralValue(p.getFirstToken().image);
- }
result = Utils.invoke(result, method, params);
+ break;
}
}
+ if (tailChildrenToIgnore == 1)
+ property = node.jjtGetChild(children - 1).getFirstToken().image;
+
return result;
+ }
+
+ // Put this in the base visitor.
+ protected void setReferenceValue(ASTReference node, Object value)
+ {
+ Object result = getReferenceValue(node, 1);
+ Object[] args = { value };
+ Utils.invoke(result, "set" + property, args);
}
/**
1.2 +32 -16 jakarta-velocity/src/java/org/apache/velocity/processor/javacc/visitor/NoCacheMode.java
Index: NoCacheMode.java
===================================================================
RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/processor/javacc/visitor/NoCacheMode.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- NoCacheMode.java 2000/09/06 09:13:31 1.1
+++ NoCacheMode.java 2000/09/08 19:46:33 1.2
@@ -78,7 +78,7 @@
* Look at the InjectorVisitor for that.
*
* @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
- * @version $Id: NoCacheMode.java,v 1.1 2000/09/06 09:13:31 jvanzyl Exp $
+ * @version $Id: NoCacheMode.java,v 1.2 2000/09/08 19:46:33 jvanzyl Exp $
*/
public class NoCacheMode extends BaseVisitor
{
@@ -252,7 +252,6 @@
else
print(content , t.beginColumn, t.beginLine, t.image.length() - content.length());
- //data = node.childrenAccept(this, data);
return data;
}
@@ -318,8 +317,31 @@
public Object visit(ASTElseIfStatement node, Object data)
{
+ int lines;
+
if (ifExpression)
+ {
+ // For the #elseif
+ lineAdjustment--;
+
+ lines = node.jjtGetChild(1).getLastToken().beginLine -
+ node.jjtGetChild(1).getFirstToken().beginLine + 2;
+
+ lineAdjustment -= lines;
+
+ if (node.jjtGetNumChildren() == 3)
+ {
+ // For the #else
+ lineAdjustment--;
+
+ lines = node.jjtGetChild(2).jjtGetChild(0).getLastToken().beginLine -
+ node.jjtGetChild(2).jjtGetChild(0).getFirstToken().beginLine;// + 2;
+
+ lineAdjustment -= lines;
+ }
+
return data;
+ }
// token 3
Node expression = node.jjtGetChild(0).jjtGetChild(0);
@@ -341,8 +363,8 @@
// occupied so that we can remove it. We'll
// remove the space the actual #if directive
// took up here as well.
- int lines = node.jjtGetChild(1).getLastToken().beginLine -
- node.jjtGetChild(1).getFirstToken().beginLine + 2;
+ lines = node.jjtGetChild(1).getLastToken().beginLine -
+ node.jjtGetChild(1).getFirstToken().beginLine + 2;
lineAdjustment -= lines;
@@ -503,15 +525,12 @@
{
// tokens 2,4
Object value = null;;
- Token leftHand = node.getFirstToken().next;
- Token rightHand = leftHand.next.next;
-
Node right = node.jjtGetChild(1);
switch(right.getType())
{
case ParserTreeConstants.JJTSTRINGLITERAL:
- value = getStringLiteralValue(rightHand.image);
+ value = getStringLiteralValue(right.getFirstToken().image);
break;
case ParserTreeConstants.JJTREFERENCE:
@@ -527,14 +546,11 @@
break;
}
- if (leftHand.image.indexOf(".") < 0)
- {
- context.put(leftHand.image.substring(1), value);
- }
- else
- {
- setPropertyValue(leftHand.image, value);
- }
+ Node left = node.jjtGetChild(0);
+ if (left.jjtGetNumChildren() == 0)
+ context.put(left.getFirstToken().image.substring(1), value);
+ else
+ setReferenceValue((ASTReference) left, value);
// Remove the space that the actual directive
// takes up so that it takes up no space in the