Update of /cvsroot/webmacro/webmacro/src/org/webmacro/parser
In directory sc8-pr-cvs1:/tmp/cvs-serv6730/src/org/webmacro/parser
Modified Files:
WMParser_impl.java WMParser_impl.jj
WMParser_implConstants.java WMParser_implTokenManager.java
Log Message:
Experimental parser Map support using this syntax:
#set $map = { "key" => "value", "key2" => "value2"
Index: WMParser_impl.java
===================================================================
RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/parser/WMParser_impl.java,v
retrieving revision 1.46
retrieving revision 1.47
diff -C2 -d -r1.46 -r1.47
*** WMParser_impl.java 27 Mar 2003 00:35:30 -0000 1.46
--- WMParser_impl.java 13 May 2003 05:29:17 -0000 1.47
***************
*** 964,971 ****
--- 964,1094 ----
}
+ final public MapBuilder MapArgList() throws ParseException {
+ MapBuilder map = new MapBuilder();
+ Object key, value;
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LBRACE:
+ case DOLLAR:
+ case QUOTE:
[...2436 lines suppressed...]
for (int j = 0; j < 32; j++) {
--- 3155,3159 ----
jj_kind = -1;
}
! for (int i = 0; i < 104; i++) {
if (jj_la1[i] == jj_gen) {
for (int j = 0; j < 32; j++) {
***************
*** 3026,3030 ****
}
}
! for (int i = 0; i < 58; i++) {
if (la1tokens[i]) {
jj_expentry = new int[1];
--- 3167,3171 ----
}
}
! for (int i = 0; i < 59; i++) {
if (la1tokens[i]) {
jj_expentry = new int[1];
Index: WMParser_impl.jj
===================================================================
RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/parser/WMParser_impl.jj,v
retrieving revision 1.44
retrieving revision 1.45
diff -C2 -d -r1.44 -r1.45
*** WMParser_impl.jj 15 Dec 2002 10:22:37 -0000 1.44
--- WMParser_impl.jj 13 May 2003 05:29:18 -0000 1.45
***************
*** 284,287 ****
--- 284,288 ----
| <LBRACKET: "[">
| <RBRACKET: "]">
+ | <ASSOC: "=>">
| <DOT: ".">
| <OP_LT: "<">
***************
*** 825,828 ****
--- 826,850 ----
}
+ MapBuilder MapArgList() : {
+ MapBuilder map = new MapBuilder();
+ Object key, value;
+ }
+ {
+ [ [<WS>] key=Expression() [<WS>] <ASSOC> [<WS>] value=Expression() [<WS>] { map.put(key, value); }
+ (
+ <COMMA> [<WS>] key=Expression() [<WS>] <ASSOC> [<WS>] value=Expression() [<WS>] { map.put(key, value); }
+ ) *
+ ]
+ { return map; }
+ }
+
+ MapBuilder CurlyMap() : {
+ MapBuilder map;
+ }
+ {
+ <LBRACE> map=MapArgList() {SetState(DEFAULT);} <RBRACE> {SetState(WM);}
+ { return map; }
+ }
+
ListBuilder ArgList() : {
ListBuilder list = new ListBuilder();
***************
*** 881,884 ****
--- 903,907 ----
| e=QuotedString()
| e=BracketList()
+ | e=CurlyMap()
| <NULL> { e = null; }
| <TRUE> { e = Boolean.TRUE; }
Index: WMParser_implConstants.java
===================================================================
RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/parser/WMParser_implConstants.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** WMParser_implConstants.java 11 Nov 2002 04:53:12 -0000 1.10
--- WMParser_implConstants.java 13 May 2003 05:29:18 -0000 1.11
***************
*** 39,64 ****
int LBRACKET = 34;
int RBRACKET = 35;
! int DOT = 36;
! int OP_LT = 37;
! int OP_LE = 38;
! int OP_GT = 39;
! int OP_GE = 40;
! int OP_EQ = 41;
! int OP_SET = 42;
! int OP_NE = 43;
! int OP_PLUS = 44;
! int OP_MINUS = 45;
! int OP_MULT = 46;
! int OP_DIV = 47;
! int OP_AND = 48;
! int OP_OR = 49;
! int OP_NOT = 50;
! int COMMA = 51;
! int SEMI = 52;
! int WORD = 53;
! int NUMBER = 54;
! int OTHER = 55;
! int QS_TEXT = 56;
! int SQS_TEXT = 57;
int SQS = 0;
--- 39,65 ----
int LBRACKET = 34;
int RBRACKET = 35;
! int ASSOC = 36;
! int DOT = 37;
! int OP_LT = 38;
! int OP_LE = 39;
! int OP_GT = 40;
! int OP_GE = 41;
! int OP_EQ = 42;
! int OP_SET = 43;
! int OP_NE = 44;
! int OP_PLUS = 45;
! int OP_MINUS = 46;
! int OP_MULT = 47;
! int OP_DIV = 48;
! int OP_AND = 49;
! int OP_OR = 50;
! int OP_NOT = 51;
! int COMMA = 52;
! int SEMI = 53;
! int WORD = 54;
! int NUMBER = 55;
! int OTHER = 56;
! int QS_TEXT = 57;
! int SQS_TEXT = 58;
int SQS = 0;
***************
*** 105,108 ****
--- 106,110 ----
"\"[\"",
"\"]\"",
+ "\"=>\"",
"\".\"",
"\"<\"",
Index: WMParser_implTokenManager.java
===================================================================
RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/parser/WMParser_implTokenManager.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** WMParser_implTokenManager.java 27 Mar 2003 00:35:30 -0000 1.24
--- WMParser_implTokenManager.java 13 May 2003 05:29:18 -0000 1.25
***************
*** 17,20 ****
--- 17,22 ----
// Required by SetState
void backup(int n) { input_stream.backup(n); }
+ public java.io.PrintStream debugStream = System.out;
+ public void setDebugStream(java.io.PrintStream ds) { debugStream = ds; }
private final int jjStopStringLiteralDfa_4(int pos, long active0)
{
***************
*** 390,395 ****
if ((0xffffffebffffdbffL & l) == 0L)
break;
! if (kind > 56)
! kind = 56;
jjCheckNAdd(4);
break;
--- 392,397 ----
if ((0xffffffebffffdbffL & l) == 0L)
break;
! if (kind > 57)
! kind = 57;
jjCheckNAdd(4);
break;
***************
*** 420,425 ****
if ((0xffffffffefffffffL & l) != 0L)
{
! if (kind > 56)
! kind = 56;
jjCheckNAdd(4);
}
--- 422,427 ----
if ((0xffffffffefffffffL & l) != 0L)
{
! if (kind > 57)
! kind = 57;
jjCheckNAdd(4);
}
***************
*** 430,435 ****
if ((0xffffffffefffffffL & l) == 0L)
break;
! if (kind > 56)
! kind = 56;
jjCheckNAdd(4);
break;
--- 432,437 ----
if ((0xffffffffefffffffL & l) == 0L)
break;
! if (kind > 57)
! kind = 57;
jjCheckNAdd(4);
break;
***************
*** 457,462 ****
if (!jjCanMove_0(hiByte, i1, i2, l1, l2))
break;
! if (kind > 56)
! kind = 56;
jjCheckNAdd(4);
break;
--- 459,464 ----
if (!jjCanMove_0(hiByte, i1, i2, l1, l2))
break;
! if (kind > 57)
! kind = 57;
jjCheckNAdd(4);
break;
***************
*** 572,579 ****
if ((active0 & 0x3c000000L) != 0L)
{
! jjmatchedKind = 53;
return 29;
}
! if ((active0 & 0x6000000000L) != 0L)
return 13;
return -1;
--- 574,581 ----
if ((active0 & 0x3c000000L) != 0L)
{
! jjmatchedKind = 54;
return 29;
}
! if ((active0 & 0xc000000000L) != 0L)
return 13;
return -1;
***************
*** 581,585 ****
if ((active0 & 0x3c000000L) != 0L)
{
! jjmatchedKind = 53;
jjmatchedPos = 1;
return 29;
--- 583,587 ----
if ((active0 & 0x3c000000L) != 0L)
{
! jjmatchedKind = 54;
jjmatchedPos = 1;
return 29;
***************
*** 589,593 ****
if ((active0 & 0x3c000000L) != 0L)
{
! jjmatchedKind = 53;
jjmatchedPos = 2;
return 29;
--- 591,595 ----
if ((active0 & 0x3c000000L) != 0L)
{
! jjmatchedKind = 54;
jjmatchedPos = 2;
return 29;
***************
*** 597,601 ****
if ((active0 & 0x30000000L) != 0L)
{
! jjmatchedKind = 53;
jjmatchedPos = 3;
return 29;
--- 599,603 ----
if ((active0 & 0x30000000L) != 0L)
{
! jjmatchedKind = 54;
jjmatchedPos = 3;
return 29;
***************
*** 607,611 ****
if ((active0 & 0x20000000L) != 0L)
{
! jjmatchedKind = 53;
jjmatchedPos = 4;
return 29;
--- 609,613 ----
if ((active0 & 0x20000000L) != 0L)
{
! jjmatchedKind = 54;
jjmatchedPos = 4;
return 29;
***************
*** 617,621 ****
if ((active0 & 0x20000000L) != 0L)
{
! jjmatchedKind = 53;
jjmatchedPos = 5;
return 29;
--- 619,623 ----
if ((active0 & 0x20000000L) != 0L)
{
! jjmatchedKind = 54;
jjmatchedPos = 5;
return 29;
***************
*** 625,629 ****
if ((active0 & 0x20000000L) != 0L)
{
! jjmatchedKind = 53;
jjmatchedPos = 6;
return 29;
--- 627,631 ----
if ((active0 & 0x20000000L) != 0L)
{
! jjmatchedKind = 54;
jjmatchedPos = 6;
return 29;
***************
*** 633,637 ****
if ((active0 & 0x20000000L) != 0L)
{
! jjmatchedKind = 53;
jjmatchedPos = 7;
return 29;
--- 635,639 ----
if ((active0 & 0x20000000L) != 0L)
{
! jjmatchedKind = 54;
jjmatchedPos = 7;
return 29;
***************
*** 672,697 ****
return jjStopAtPos(0, 33);
case 42:
! return jjStopAtPos(0, 46);
case 43:
! return jjStopAtPos(0, 44);
case 44:
! return jjStopAtPos(0, 51);
case 45:
! return jjStopAtPos(0, 45);
case 46:
! return jjStopAtPos(0, 36);
case 47:
! return jjStopAtPos(0, 47);
case 59:
! return jjStopAtPos(0, 52);
case 60:
! jjmatchedKind = 37;
! return jjMoveStringLiteralDfa1_3(0x4000000000L);
case 61:
! jjmatchedKind = 42;
! return jjMoveStringLiteralDfa1_3(0x20000000000L);
case 62:
! jjmatchedKind = 39;
! return jjMoveStringLiteralDfa1_3(0x10000000000L);
case 91:
return jjStopAtPos(0, 34);
--- 674,699 ----
return jjStopAtPos(0, 33);
case 42:
! return jjStopAtPos(0, 47);
case 43:
! return jjStopAtPos(0, 45);
case 44:
! return jjStopAtPos(0, 52);
case 45:
! return jjStopAtPos(0, 46);
case 46:
! return jjStopAtPos(0, 37);
case 47:
! return jjStopAtPos(0, 48);
case 59:
! return jjStopAtPos(0, 53);
case 60:
! jjmatchedKind = 38;
! return jjMoveStringLiteralDfa1_3(0x8000000000L);
case 61:
! jjmatchedKind = 43;
! return jjMoveStringLiteralDfa1_3(0x41000000000L);
case 62:
! jjmatchedKind = 40;
! return jjMoveStringLiteralDfa1_3(0x20000000000L);
case 91:
return jjStopAtPos(0, 34);
***************
*** 724,733 ****
{
case 61:
! if ((active0 & 0x4000000000L) != 0L)
! return jjStopAtPos(1, 38);
! else if ((active0 & 0x10000000000L) != 0L)
! return jjStopAtPos(1, 40);
else if ((active0 & 0x20000000000L) != 0L)
return jjStopAtPos(1, 41);
break;
case 97:
--- 726,739 ----
{
case 61:
! if ((active0 & 0x8000000000L) != 0L)
! return jjStopAtPos(1, 39);
else if ((active0 & 0x20000000000L) != 0L)
return jjStopAtPos(1, 41);
+ else if ((active0 & 0x40000000000L) != 0L)
+ return jjStopAtPos(1, 42);
+ break;
+ case 62:
+ if ((active0 & 0x1000000000L) != 0L)
+ return jjStopAtPos(1, 36);
break;
case 97:
***************
*** 931,936 ****
if ((0x3ff000000000000L & l) != 0L)
{
! if (kind > 54)
! kind = 54;
jjCheckNAdd(30);
}
--- 937,942 ----
if ((0x3ff000000000000L & l) != 0L)
{
! if (kind > 55)
! kind = 55;
jjCheckNAdd(30);
}
***************
*** 948,953 ****
else if (curChar == 33)
{
! if (kind > 50)
! kind = 50;
}
else if (curChar == 38)
--- 954,959 ----
else if (curChar == 33)
{
! if (kind > 51)
! kind = 51;
}
else if (curChar == 38)
***************
*** 1004,1009 ****
break;
case 11:
! if (curChar == 61 && kind > 43)
! kind = 43;
break;
case 12:
--- 1010,1015 ----
break;
case 11:
! if (curChar == 61 && kind > 44)
! kind = 44;
break;
case 12:
***************
*** 1012,1017 ****
break;
case 13:
! if (curChar == 62 && kind > 43)
! kind = 43;
break;
case 14:
--- 1018,1023 ----
break;
case 13:
! if (curChar == 62 && kind > 44)
! kind = 44;
break;
case 14:
***************
*** 1020,1025 ****
break;
case 15:
! if (curChar == 38 && kind > 48)
! kind = 48;
break;
case 16:
--- 1026,1031 ----
break;
case 15:
! if (curChar == 38 && kind > 49)
! kind = 49;
break;
case 16:
***************
*** 1028,1039 ****
break;
case 24:
! if (curChar == 33 && kind > 50)
! kind = 50;
break;
case 29:
if ((0x3ff000000000000L & l) == 0L)
break;
! if (kind > 53)
! kind = 53;
jjstateSet[jjnewStateCnt++] = 29;
break;
--- 1034,1045 ----
break;
case 24:
! if (curChar == 33 && kind > 51)
! kind = 51;
break;
case 29:
if ((0x3ff000000000000L & l) == 0L)
break;
! if (kind > 54)
! kind = 54;
jjstateSet[jjnewStateCnt++] = 29;
break;
***************
*** 1041,1046 ****
if ((0x3ff000000000000L & l) == 0L)
break;
! if (kind > 54)
! kind = 54;
jjCheckNAdd(30);
break;
--- 1047,1052 ----
if ((0x3ff000000000000L & l) == 0L)
break;
! if (kind > 55)
! kind = 55;
jjCheckNAdd(30);
break;
***************
*** 1063,1068 ****
if ((0x7fffffe07fffffeL & l) != 0L)
{
! if (kind > 53)
! kind = 53;
jjCheckNAdd(29);
}
--- 1069,1074 ----
if ((0x7fffffe07fffffeL & l) != 0L)
{
! if (kind > 54)
! kind = 54;
jjCheckNAdd(29);
}
***************
*** 1088,1093 ****
break;
case 17:
! if (curChar == 68 && kind > 48)
! kind = 48;
break;
case 18:
--- 1094,1099 ----
break;
case 17:
! if (curChar == 68 && kind > 49)
! kind = 49;
break;
case 18:
***************
*** 1100,1105 ****
break;
case 20:
! if (curChar == 124 && kind > 49)
! kind = 49;
break;
case 21:
--- 1106,1111 ----
break;
case 20:
! if (curChar == 124 && kind > 50)
! kind = 50;
break;
case 21:
***************
*** 1108,1113 ****
break;
case 22:
! if (curChar == 82 && kind > 49)
! kind = 49;
break;
case 23:
--- 1114,1119 ----
break;
case 22:
! if (curChar == 82 && kind > 50)
! kind = 50;
break;
case 23:
***************
*** 1116,1121 ****
break;
case 25:
! if (curChar == 84 && kind > 50)
! kind = 50;
break;
case 26:
--- 1122,1127 ----
break;
case 25:
! if (curChar == 84 && kind > 51)
! kind = 51;
break;
case 26:
***************
*** 1130,1135 ****
if ((0x7fffffe07fffffeL & l) == 0L)
break;
! if (kind > 53)
! kind = 53;
jjCheckNAdd(29);
break;
--- 1136,1141 ----
if ((0x7fffffe07fffffeL & l) == 0L)
break;
! if (kind > 54)
! kind = 54;
jjCheckNAdd(29);
break;
***************
*** 1137,1142 ****
if ((0x7fffffe87fffffeL & l) == 0L)
break;
! if (kind > 53)
! kind = 53;
jjCheckNAdd(29);
break;
--- 1143,1148 ----
if ((0x7fffffe87fffffeL & l) == 0L)
break;
! if (kind > 54)
! kind = 54;
jjCheckNAdd(29);
break;
***************
*** 1250,1255 ****
if ((0xffffff6fffffdbffL & l) == 0L)
break;
! if (kind > 57)
! kind = 57;
jjCheckNAdd(4);
break;
--- 1256,1261 ----
if ((0xffffff6fffffdbffL & l) == 0L)
break;
! if (kind > 58)
! kind = 58;
jjCheckNAdd(4);
break;
***************
*** 1280,1285 ****
if ((0xffffffffefffffffL & l) != 0L)
{
! if (kind > 57)
! kind = 57;
jjCheckNAdd(4);
}
--- 1286,1291 ----
if ((0xffffffffefffffffL & l) != 0L)
{
! if (kind > 58)
! kind = 58;
jjCheckNAdd(4);
}
***************
*** 1290,1295 ****
if ((0xffffffffefffffffL & l) == 0L)
break;
! if (kind > 57)
! kind = 57;
jjCheckNAdd(4);
break;
--- 1296,1301 ----
if ((0xffffffffefffffffL & l) == 0L)
break;
! if (kind > 58)
! kind = 58;
jjCheckNAdd(4);
break;
***************
*** 1317,1322 ****
if (!jjCanMove_0(hiByte, i1, i2, l1, l2))
break;
! if (kind > 57)
! kind = 57;
jjCheckNAdd(4);
break;
--- 1323,1328 ----
if (!jjCanMove_0(hiByte, i1, i2, l1, l2))
break;
! if (kind > 58)
! kind = 58;
jjCheckNAdd(4);
break;
***************
*** 1358,1363 ****
"\134", "\43", "\42", "\47", "\156\165\154\154", "\164\162\165\145",
"\146\141\154\163\145", "\165\156\144\145\146\151\156\145\144", null, null, "\50", "\51", "\133",
! "\135", "\56", "\74", "\74\75", "\76", "\76\75", "\75\75", "\75", null, "\53", "\55",
! "\52", "\57", null, null, null, "\54", "\73", null, null, null, null, null, };
public static final String[] lexStateNames = {
"SQS",
--- 1364,1370 ----
"\134", "\43", "\42", "\47", "\156\165\154\154", "\164\162\165\145",
"\146\141\154\163\145", "\165\156\144\145\146\151\156\145\144", null, null, "\50", "\51", "\133",
! "\135", "\75\76", "\56", "\74", "\74\75", "\76", "\76\75", "\75\75", "\75", null,
! "\53", "\55", "\52", "\57", null, null, null, "\54", "\73", null, null, null, null,
! null, };
public static final String[] lexStateNames = {
"SQS",
***************
*** 1370,1377 ****
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
! -1, -1, -1, -1, -1, -1, -1, -1,
};
static final long[] jjtoToken = {
! 0x3fffffffffef801L,
};
static final long[] jjtoSkip = {
--- 1377,1384 ----
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
! -1, -1, -1, -1, -1, -1, -1, -1, -1,
};
static final long[] jjtoToken = {
! 0x7fffffffffef801L,
};
static final long[] jjtoSkip = {
***************
*** 1504,1510 ****
jjmatchedPos = 0;
curPos = jjMoveStringLiteralDfa0_3();
! if (jjmatchedPos == 0 && jjmatchedKind > 55)
{
! jjmatchedKind = 55;
}
break;
--- 1511,1517 ----
jjmatchedPos = 0;
curPos = jjMoveStringLiteralDfa0_3();
! if (jjmatchedPos == 0 && jjmatchedKind > 56)
{
! jjmatchedKind = 56;
}
break;
|