[prev in list] [next in list] [prev in thread] [next in thread] 

List:       avalon-cvs
Subject:    cvs commit: jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/basic/parser BasicSQLPa
From:       froehlich () apache ! org
Date:       2001-11-29 20:21:31
[Download RAW message or body]

froehlich    01/11/29 12:21:31

  Modified:    apps/db/src/java/org/apache/avalon/db/basic/parser
                        BasicSQLParserTokenManager.java
                        BasicSQLParserConstants.java BasicSQLParser.java
  Log:
  hacking the  "where clause" again <sigh>
  
  Revision  Changes    Path
  1.2       +247 -46   \
jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/basic/parser/BasicSQLParserTokenManager.java
  
  Index: BasicSQLParserTokenManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/basic/parser/BasicSQLParserTokenManager.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BasicSQLParserTokenManager.java	2001/11/29 13:06:26	1.1
  +++ BasicSQLParserTokenManager.java	2001/11/29 20:21:31	1.2
  @@ -41,20 +41,26 @@
         case 32:
            jjmatchedKind = 1;
            return jjMoveNfa_0(5, 0);
  +      case 42:
  +         jjmatchedKind = 60;
  +         return jjMoveNfa_0(5, 0);
  +      case 44:
  +         jjmatchedKind = 61;
  +         return jjMoveNfa_0(5, 0);
         case 59:
  -         jjmatchedKind = 52;
  +         jjmatchedKind = 59;
            return jjMoveNfa_0(5, 0);
         case 60:
  -         jjmatchedKind = 45;
  -         return jjMoveStringLiteralDfa1_0(0x800000000000L);
  +         jjmatchedKind = 48;
  +         return jjMoveStringLiteralDfa1_0(0x4000000000000L);
         case 61:
  -         jjmatchedKind = 43;
  +         jjmatchedKind = 46;
            return jjMoveNfa_0(5, 0);
         case 62:
  -         jjmatchedKind = 44;
  -         return jjMoveStringLiteralDfa1_0(0x400000000000L);
  +         jjmatchedKind = 47;
  +         return jjMoveStringLiteralDfa1_0(0x2000000000000L);
         case 65:
  -         return jjMoveStringLiteralDfa1_0(0x16000000L);
  +         return jjMoveStringLiteralDfa1_0(0x80016000000L);
         case 66:
            return jjMoveStringLiteralDfa1_0(0x8000008000L);
         case 67:
  @@ -70,9 +76,11 @@
         case 73:
            return jjMoveStringLiteralDfa1_0(0x1080081000L);
         case 76:
  -         return jjMoveStringLiteralDfa1_0(0x1000000000000L);
  +         return jjMoveStringLiteralDfa1_0(0x8000000000000L);
  +      case 78:
  +         return jjMoveStringLiteralDfa1_0(0x200000000000L);
         case 79:
  -         return jjMoveStringLiteralDfa1_0(0x20000000000L);
  +         return jjMoveStringLiteralDfa1_0(0x120000000000L);
         case 82:
            return jjMoveStringLiteralDfa1_0(0x40800L);
         case 83:
  @@ -86,7 +94,7 @@
         case 87:
            return jjMoveStringLiteralDfa1_0(0x400000000L);
         case 97:
  -         return jjMoveStringLiteralDfa1_0(0x16000000L);
  +         return jjMoveStringLiteralDfa1_0(0x80016000000L);
         case 98:
            return jjMoveStringLiteralDfa1_0(0x8000008000L);
         case 99:
  @@ -102,9 +110,11 @@
         case 105:
            return jjMoveStringLiteralDfa1_0(0x1080081000L);
         case 108:
  -         return jjMoveStringLiteralDfa1_0(0x1000000000000L);
  +         return jjMoveStringLiteralDfa1_0(0x8000000000000L);
  +      case 110:
  +         return jjMoveStringLiteralDfa1_0(0x200000000000L);
         case 111:
  -         return jjMoveStringLiteralDfa1_0(0x20000000000L);
  +         return jjMoveStringLiteralDfa1_0(0x120000000000L);
         case 114:
            return jjMoveStringLiteralDfa1_0(0x40800L);
         case 115:
  @@ -130,14 +140,14 @@
      switch(curChar)
      {
         case 61:
  -         if ((active0 & 0x400000000000L) != 0L)
  +         if ((active0 & 0x2000000000000L) != 0L)
            {
  -            jjmatchedKind = 46;
  +            jjmatchedKind = 49;
               jjmatchedPos = 1;
            }
  -         else if ((active0 & 0x800000000000L) != 0L)
  +         else if ((active0 & 0x4000000000000L) != 0L)
            {
  -            jjmatchedKind = 47;
  +            jjmatchedKind = 50;
               jjmatchedPos = 1;
            }
            break;
  @@ -148,18 +158,23 @@
         case 72:
            return jjMoveStringLiteralDfa2_0(active0, 0x400000000L);
         case 73:
  -         return jjMoveStringLiteralDfa2_0(active0, 0x1040100008300L);
  +         return jjMoveStringLiteralDfa2_0(active0, 0x8040100008300L);
         case 76:
            return jjMoveStringLiteralDfa2_0(active0, 0x2000000L);
         case 77:
            return jjMoveStringLiteralDfa2_0(active0, 0x400L);
         case 78:
  -         return jjMoveStringLiteralDfa2_0(active0, 0x1080081000L);
  +         return jjMoveStringLiteralDfa2_0(active0, 0x81080081000L);
         case 79:
  -         return jjMoveStringLiteralDfa2_0(active0, 0x201040000L);
  +         return jjMoveStringLiteralDfa2_0(active0, 0x200201040000L);
         case 80:
            return jjMoveStringLiteralDfa2_0(active0, 0x10000L);
         case 82:
  +         if ((active0 & 0x100000000000L) != 0L)
  +         {
  +            jjmatchedKind = 44;
  +            jjmatchedPos = 1;
  +         }
            return jjMoveStringLiteralDfa2_0(active0, 0x30020b00000L);
         case 83:
            if ((active0 & 0x4000000L) != 0L)
  @@ -175,18 +190,23 @@
         case 104:
            return jjMoveStringLiteralDfa2_0(active0, 0x400000000L);
         case 105:
  -         return jjMoveStringLiteralDfa2_0(active0, 0x1040100008300L);
  +         return jjMoveStringLiteralDfa2_0(active0, 0x8040100008300L);
         case 108:
            return jjMoveStringLiteralDfa2_0(active0, 0x2000000L);
         case 109:
            return jjMoveStringLiteralDfa2_0(active0, 0x400L);
         case 110:
  -         return jjMoveStringLiteralDfa2_0(active0, 0x1080081000L);
  +         return jjMoveStringLiteralDfa2_0(active0, 0x81080081000L);
         case 111:
  -         return jjMoveStringLiteralDfa2_0(active0, 0x201040000L);
  +         return jjMoveStringLiteralDfa2_0(active0, 0x200201040000L);
         case 112:
            return jjMoveStringLiteralDfa2_0(active0, 0x10000L);
         case 114:
  +         if ((active0 & 0x100000000000L) != 0L)
  +         {
  +            jjmatchedKind = 44;
  +            jjmatchedPos = 1;
  +         }
            return jjMoveStringLiteralDfa2_0(active0, 0x30020b00000L);
         case 115:
            if ((active0 & 0x4000000L) != 0L)
  @@ -222,13 +242,18 @@
            }
            return jjMoveStringLiteralDfa3_0(active0, 0x2000L);
         case 68:
  +         if ((active0 & 0x80000000000L) != 0L)
  +         {
  +            jjmatchedKind = 43;
  +            jjmatchedPos = 2;
  +         }
            return jjMoveStringLiteralDfa3_0(active0, 0x21000010000L);
         case 69:
            return jjMoveStringLiteralDfa3_0(active0, 0x500800000L);
         case 71:
            return jjMoveStringLiteralDfa3_0(active0, 0x8000L);
         case 75:
  -         return jjMoveStringLiteralDfa3_0(active0, 0x1000000000000L);
  +         return jjMoveStringLiteralDfa3_0(active0, 0x8000000000000L);
         case 76:
            return jjMoveStringLiteralDfa3_0(active0, 0x2000460000L);
         case 77:
  @@ -245,6 +270,11 @@
               jjmatchedKind = 27;
               jjmatchedPos = 2;
            }
  +         else if ((active0 & 0x200000000000L) != 0L)
  +         {
  +            jjmatchedKind = 45;
  +            jjmatchedPos = 2;
  +         }
            return jjMoveStringLiteralDfa3_0(active0, 0x8082005000L);
         case 85:
            return jjMoveStringLiteralDfa3_0(active0, 0x200000000L);
  @@ -262,13 +292,18 @@
            }
            return jjMoveStringLiteralDfa3_0(active0, 0x2000L);
         case 100:
  +         if ((active0 & 0x80000000000L) != 0L)
  +         {
  +            jjmatchedKind = 43;
  +            jjmatchedPos = 2;
  +         }
            return jjMoveStringLiteralDfa3_0(active0, 0x21000010000L);
         case 101:
            return jjMoveStringLiteralDfa3_0(active0, 0x500800000L);
         case 103:
            return jjMoveStringLiteralDfa3_0(active0, 0x8000L);
         case 107:
  -         return jjMoveStringLiteralDfa3_0(active0, 0x1000000000000L);
  +         return jjMoveStringLiteralDfa3_0(active0, 0x8000000000000L);
         case 108:
            return jjMoveStringLiteralDfa3_0(active0, 0x2000460000L);
         case 109:
  @@ -285,6 +320,11 @@
               jjmatchedKind = 27;
               jjmatchedPos = 2;
            }
  +         else if ((active0 & 0x200000000000L) != 0L)
  +         {
  +            jjmatchedKind = 45;
  +            jjmatchedPos = 2;
  +         }
            return jjMoveStringLiteralDfa3_0(active0, 0x8082005000L);
         case 117:
            return jjMoveStringLiteralDfa3_0(active0, 0x200000000L);
  @@ -325,9 +365,9 @@
               jjmatchedKind = 14;
               jjmatchedPos = 3;
            }
  -         else if ((active0 & 0x1000000000000L) != 0L)
  +         else if ((active0 & 0x8000000000000L) != 0L)
            {
  -            jjmatchedKind = 48;
  +            jjmatchedKind = 51;
               jjmatchedPos = 3;
            }
            return jjMoveStringLiteralDfa4_0(active0, 0x210024a1100L);
  @@ -396,9 +436,9 @@
               jjmatchedKind = 14;
               jjmatchedPos = 3;
            }
  -         else if ((active0 & 0x1000000000000L) != 0L)
  +         else if ((active0 & 0x8000000000000L) != 0L)
            {
  -            jjmatchedKind = 48;
  +            jjmatchedKind = 51;
               jjmatchedPos = 3;
            }
            return jjMoveStringLiteralDfa4_0(active0, 0x210024a1100L);
  @@ -951,7 +991,7 @@
      curPos = 0;
      int[] nextStates;
      int startsAt = 0;
  -   jjnewStateCnt = 15;
  +   jjnewStateCnt = 42;
      int i = 1;
      jjstateSet[0] = startState;
      int j, kind = 0x7fffffff;
  @@ -967,18 +1007,28 @@
               switch(jjstateSet[--i])
               {
                  case 5:
  -                  if (curChar == 47)
  +                  if ((0x3ff000000000000L & l) != 0L)
  +                  {
  +                     if (kind > 55)
  +                        kind = 55;
  +                     jjCheckNAddStates(0, 6);
  +                  }
  +                  else if (curChar == 39)
  +                     jjCheckNAddStates(7, 9);
  +                  else if (curChar == 46)
  +                     jjCheckNAdd(16);
  +                  else if (curChar == 47)
                        jjstateSet[jjnewStateCnt++] = 6;
                     else if (curChar == 45)
                        jjstateSet[jjnewStateCnt++] = 0;
                     break;
                  case 0:
                     if (curChar == 45)
  -                     jjCheckNAddStates(0, 2);
  +                     jjCheckNAddStates(10, 12);
                     break;
                  case 1:
                     if ((0xffffffffffffdbffL & l) != 0L)
  -                     jjCheckNAddStates(0, 2);
  +                     jjCheckNAddStates(10, 12);
                     break;
                  case 2:
                     if ((0x2400L & l) != 0L && kind > 5)
  @@ -1002,7 +1052,7 @@
                     break;
                  case 8:
                     if (curChar == 42)
  -                     jjCheckNAddStates(3, 5);
  +                     jjCheckNAddStates(13, 15);
                     break;
                  case 9:
                     if ((0xffff7bffffffffffL & l) != 0L)
  @@ -1023,10 +1073,129 @@
                  case 14:
                     if ((0x3ff000000000000L & l) == 0L)
                        break;
  -                  if (kind > 49)
  -                     kind = 49;
  +                  if (kind > 52)
  +                     kind = 52;
                     jjstateSet[jjnewStateCnt++] = 14;
                     break;
  +               case 15:
  +                  if (curChar == 46)
  +                     jjCheckNAdd(16);
  +                  break;
  +               case 16:
  +                  if ((0x3ff000000000000L & l) == 0L)
  +                     break;
  +                  if (kind > 56)
  +                     kind = 56;
  +                  jjCheckNAddTwoStates(16, 17);
  +                  break;
  +               case 18:
  +                  if ((0x280000000000L & l) != 0L)
  +                     jjCheckNAdd(19);
  +                  break;
  +               case 19:
  +                  if ((0x3ff000000000000L & l) == 0L)
  +                     break;
  +                  if (kind > 56)
  +                     kind = 56;
  +                  jjCheckNAdd(19);
  +                  break;
  +               case 20:
  +                  if (curChar == 39)
  +                     jjCheckNAddStates(7, 9);
  +                  break;
  +               case 21:
  +                  if ((0xffffff7fffffffffL & l) != 0L)
  +                     jjCheckNAddStates(7, 9);
  +                  break;
  +               case 22:
  +                  if (curChar == 39)
  +                     jjCheckNAddStates(16, 18);
  +                  break;
  +               case 23:
  +                  if (curChar == 39)
  +                     jjstateSet[jjnewStateCnt++] = 22;
  +                  break;
  +               case 24:
  +                  if ((0xffffff7fffffffffL & l) != 0L)
  +                     jjCheckNAddStates(16, 18);
  +                  break;
  +               case 25:
  +                  if (curChar == 39 && kind > 58)
  +                     kind = 58;
  +                  break;
  +               case 26:
  +                  if ((0x3ff000000000000L & l) == 0L)
  +                     break;
  +                  if (kind > 55)
  +                     kind = 55;
  +                  jjCheckNAddStates(0, 6);
  +                  break;
  +               case 27:
  +                  if ((0x3ff000000000000L & l) == 0L)
  +                     break;
  +                  if (kind > 55)
  +                     kind = 55;
  +                  jjCheckNAdd(27);
  +                  break;
  +               case 28:
  +                  if ((0x3ff000000000000L & l) != 0L)
  +                     jjCheckNAddTwoStates(28, 29);
  +                  break;
  +               case 29:
  +                  if (curChar == 46)
  +                     jjCheckNAdd(30);
  +                  break;
  +               case 30:
  +                  if ((0x3ff000000000000L & l) == 0L)
  +                     break;
  +                  if (kind > 56)
  +                     kind = 56;
  +                  jjCheckNAddTwoStates(30, 31);
  +                  break;
  +               case 32:
  +                  if ((0x280000000000L & l) != 0L)
  +                     jjCheckNAdd(33);
  +                  break;
  +               case 33:
  +                  if ((0x3ff000000000000L & l) == 0L)
  +                     break;
  +                  if (kind > 56)
  +                     kind = 56;
  +                  jjCheckNAdd(33);
  +                  break;
  +               case 34:
  +                  if ((0x3ff000000000000L & l) != 0L)
  +                     jjCheckNAddTwoStates(34, 35);
  +                  break;
  +               case 36:
  +                  if ((0x280000000000L & l) != 0L)
  +                     jjCheckNAdd(37);
  +                  break;
  +               case 37:
  +                  if ((0x3ff000000000000L & l) == 0L)
  +                     break;
  +                  if (kind > 56)
  +                     kind = 56;
  +                  jjCheckNAdd(37);
  +                  break;
  +               case 38:
  +                  if ((0x3ff000000000000L & l) == 0L)
  +                     break;
  +                  if (kind > 56)
  +                     kind = 56;
  +                  jjCheckNAddTwoStates(38, 39);
  +                  break;
  +               case 40:
  +                  if ((0x280000000000L & l) != 0L)
  +                     jjCheckNAdd(41);
  +                  break;
  +               case 41:
  +                  if ((0x3ff000000000000L & l) == 0L)
  +                     break;
  +                  if (kind > 56)
  +                     kind = 56;
  +                  jjCheckNAdd(41);
  +                  break;
                  default : break;
               }
            } while(i != startsAt);
  @@ -1042,12 +1211,12 @@
                  case 14:
                     if ((0x7fffffe87fffffeL & l) == 0L)
                        break;
  -                  if (kind > 49)
  -                     kind = 49;
  +                  if (kind > 52)
  +                     kind = 52;
                     jjCheckNAdd(14);
                     break;
                  case 1:
  -                  jjAddStates(0, 2);
  +                  jjAddStates(10, 12);
                     break;
                  case 7:
                     jjCheckNAddTwoStates(7, 8);
  @@ -1056,6 +1225,28 @@
                  case 10:
                     jjCheckNAddTwoStates(10, 8);
                     break;
  +               case 17:
  +                  if ((0x2000000020L & l) != 0L)
  +                     jjAddStates(19, 20);
  +                  break;
  +               case 21:
  +                  jjCheckNAddStates(7, 9);
  +                  break;
  +               case 24:
  +                  jjCheckNAddStates(16, 18);
  +                  break;
  +               case 31:
  +                  if ((0x2000000020L & l) != 0L)
  +                     jjAddStates(21, 22);
  +                  break;
  +               case 35:
  +                  if ((0x2000000020L & l) != 0L)
  +                     jjAddStates(23, 24);
  +                  break;
  +               case 39:
  +                  if ((0x2000000020L & l) != 0L)
  +                     jjAddStates(25, 26);
  +                  break;
                  default : break;
               }
            } while(i != startsAt);
  @@ -1070,7 +1261,7 @@
               {
                  case 1:
                     if ((jjbitVec0[i2] & l2) != 0L)
  -                     jjAddStates(0, 2);
  +                     jjAddStates(10, 12);
                     break;
                  case 7:
                     if ((jjbitVec0[i2] & l2) != 0L)
  @@ -1081,6 +1272,14 @@
                     if ((jjbitVec0[i2] & l2) != 0L)
                        jjCheckNAddTwoStates(10, 8);
                     break;
  +               case 21:
  +                  if ((jjbitVec0[i2] & l2) != 0L)
  +                     jjCheckNAddStates(7, 9);
  +                  break;
  +               case 24:
  +                  if ((jjbitVec0[i2] & l2) != 0L)
  +                     jjCheckNAddStates(16, 18);
  +                  break;
                  default : break;
               }
            } while(i != startsAt);
  @@ -1092,7 +1291,7 @@
            kind = 0x7fffffff;
         }
         ++curPos;
  -      if ((i = jjnewStateCnt) == (startsAt = 15 - (jjnewStateCnt = startsAt)))
  +      if ((i = jjnewStateCnt) == (startsAt = 42 - (jjnewStateCnt = startsAt)))
            break;
         try { curChar = input_stream.readChar(); }
         catch(java.io.IOException e) { break; }
  @@ -1118,25 +1317,27 @@
      return toRet;
   }
   static final int[] jjnextStates = {
  -   1, 2, 4, 8, 9, 11, 
  +   27, 28, 29, 34, 35, 38, 39, 21, 23, 25, 1, 2, 4, 8, 9, 11, 
  +   23, 24, 25, 18, 19, 32, 33, 36, 37, 40, 41, 
   };
   public static final String[] jjstrLiteralImages = {
   "", null, null, null, null, null, null, null, null, null, null, null, null, 
   null, null, null, null, null, null, null, null, null, null, null, null, null, \
null,   null, null, null, null, null, null, null, null, null, null, null, null, null, \
                null, 
  -null, null, "\75", "\76", "\74", "\76\75", "\74\75", null, null, null, null, \
"\73", };  +null, null, null, null, null, "\75", "\76", "\74", "\76\75", "\74\75", \
null, null,   +null, null, null, null, null, null, "\73", "\52", "\54", };
   public static final String[] lexStateNames = {
      "DEFAULT", 
   };
   static final long[] jjtoToken = {
  -   0x13ffffffffff81L, 
  +   0x3d9fffffffffff81L, 
   };
   static final long[] jjtoSkip = {
      0x7eL, 
   };
   static private SimpleCharStream input_stream;
  -static private final int[] jjrounds = new int[15];
  -static private final int[] jjstateSet = new int[30];
  +static private final int[] jjrounds = new int[42];
  +static private final int[] jjstateSet = new int[84];
   static protected char curChar;
   public BasicSQLParserTokenManager(SimpleCharStream stream)
   {
  @@ -1160,7 +1361,7 @@
   {
      int i;
      jjround = 0x80000001;
  -   for (i = 15; i-- > 0;)
  +   for (i = 42; i-- > 0;)
         jjrounds[i] = 0x80000000;
   }
   static public void ReInit(SimpleCharStream stream, int lexState)
  
  
  
  1.2       +25 -9     \
jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/basic/parser/BasicSQLParserConstants.java
  
  Index: BasicSQLParserConstants.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/basic/parser/BasicSQLParserConstants.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BasicSQLParserConstants.java	2001/11/29 13:06:26	1.1
  +++ BasicSQLParserConstants.java	2001/11/29 20:21:31	1.2
  @@ -42,15 +42,22 @@
     int GROUPBY = 40;
     int ORDERBY = 41;
     int DISTINCT = 42;
  -  int EQUAL = 43;
  -  int GREATERTHAN = 44;
  -  int SMALLERTHAN = 45;
  -  int GREATERTHANOREQUAL = 46;
  -  int SMALLERTHANOREQUAL = 47;
  -  int LIKE = 48;
  -  int IDENTIFIER = 49;
  -  int LETTER = 50;
  -  int DIGIT = 51;
  +  int AND = 43;
  +  int OR = 44;
  +  int NOT = 45;
  +  int EQUAL = 46;
  +  int GREATERTHAN = 47;
  +  int SMALLERTHAN = 48;
  +  int GREATERTHANOREQUAL = 49;
  +  int SMALLERTHANOREQUAL = 50;
  +  int LIKE = 51;
  +  int IDENTIFIER = 52;
  +  int LETTER = 53;
  +  int DIGIT = 54;
  +  int INTEGER_LITERAL = 55;
  +  int FLOATING_POINT_LITERAL = 56;
  +  int EXPONENT = 57;
  +  int STRING_LITERAL = 58;
   
     int DEFAULT = 0;
   
  @@ -98,6 +105,9 @@
       "\"group by\"",
       "\"order by\"",
       "\"distinct\"",
  +    "\"and\"",
  +    "\"or\"",
  +    "\"not\"",
       "\"=\"",
       "\">\"",
       "\"<\"",
  @@ -107,7 +117,13 @@
       "<IDENTIFIER>",
       "<LETTER>",
       "<DIGIT>",
  +    "<INTEGER_LITERAL>",
  +    "<FLOATING_POINT_LITERAL>",
  +    "<EXPONENT>",
  +    "<STRING_LITERAL>",
       "\";\"",
  +    "\"*\"",
  +    "\",\"",
     };
   
   }
  
  
  
  1.3       +168 -34   \
jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/basic/parser/BasicSQLParser.java
  
  Index: BasicSQLParser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/basic/parser/BasicSQLParser.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- BasicSQLParser.java	2001/11/29 13:30:47	1.2
  +++ BasicSQLParser.java	2001/11/29 20:21:31	1.3
  @@ -47,7 +47,7 @@
    */
     static final public void Test() throws ParseException {
       parseSQLString();
  -    jj_consume_token(52);
  +    jj_consume_token(59);
     }
   
     static final public String parseSQLString() throws ParseException {
  @@ -64,7 +64,18 @@
         jj_consume_token(-1);
         throw new ParseException();
       }
  -    jj_consume_token(52);
  +    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  +    case 59:
  +      jj_consume_token(59);
  +      break;
  +    case 0:
  +      jj_consume_token(0);
  +      break;
  +    default:
  +      jj_la1[1] = jj_gen;
  +      jj_consume_token(-1);
  +      throw new ParseException();
  +    }
         {if (true) return stm;}
       throw new Error("Missing return statement in function");
     }
  @@ -72,18 +83,17 @@
     static final public String Select() throws ParseException {
       String stm;
       Token token;
  -    ArrayList columns = new ArrayList();
       jj_consume_token(SELECT);
  -    token = jj_consume_token(SELECT);
  -                           stm = token.image;
  -    getColumns(columns);
  +          stm = "SELECT";
  +    getColumns();
       jj_consume_token(FROM);
  +    getTables();
       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  -    case 0:
  +    case WHERE:
         Where();
         break;
       default:
  -      jj_la1[1] = jj_gen;
  +      jj_la1[2] = jj_gen;
         ;
       }
         {if (true) return stm;}
  @@ -94,8 +104,7 @@
        String stm;
        Token token;
       jj_consume_token(UPDATE);
  -    token = jj_consume_token(UPDATE);
  -            stm = token.image;
  +          stm = "UPDATE";
         {if (true) return stm;}
       throw new Error("Missing return statement in function");
     }
  @@ -129,23 +138,148 @@
     }
   
     static final public void Where() throws ParseException {
  -    jj_consume_token(0);
  +    jj_consume_token(WHERE);
  +            OrExpr();
     }
   
  -  static final public void getColumns(ArrayList list) throws ParseException {
  -    String col;
  -    col = getSingleColumn();
  -                              list.add(col);
  +  static final public void OrExpr() throws ParseException {
  +    AndExpr();
  +    label_1:
  +    while (true) {
  +      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  +      case OR:
  +        ;
  +        break;
  +      default:
  +        jj_la1[3] = jj_gen;
  +        break label_1;
  +      }
  +      jj_consume_token(OR);
  +      AndExpr();
  +          System.out.println("in or");
  +    }
     }
   
  -  static final public String getSingleColumn() throws ParseException {
  +  static final public void AndExpr() throws ParseException {
  +    NotExpr();
  +    label_2:
  +    while (true) {
  +      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  +      case AND:
  +        ;
  +        break;
  +      default:
  +        jj_la1[4] = jj_gen;
  +        break label_2;
  +      }
  +      jj_consume_token(AND);
  +          System.out.println("in and");
  +      NotExpr();
  +    }
  +  }
  +
  +  static final public void NotExpr() throws ParseException {
  +    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  +    case NOT:
  +      jj_consume_token(NOT);
  +              System.out.println("in not");
  +      break;
  +    default:
  +      jj_la1[5] = jj_gen;
  +      ;
  +    }
  +    CompareExpr();
  +  }
  +
  +  static final public void CompareExpr() throws ParseException {
  +    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  +    case IDENTIFIER:
  +      jj_consume_token(IDENTIFIER);
  +      jj_consume_token(EQUAL);
  +      jj_consume_token(STRING_LITERAL);
  +                                              System.out.println("EQUAL");
  +      break;
  +    case GREATERTHAN:
  +      jj_consume_token(GREATERTHAN);
  +                          System.out.println("GREATERTHAN");
  +      break;
  +    case SMALLERTHAN:
  +      jj_consume_token(SMALLERTHAN);
  +                          System.out.println("SMALLERTHAN");
  +      break;
  +    case GREATERTHANOREQUAL:
  +      jj_consume_token(GREATERTHANOREQUAL);
  +                                 System.out.println("GREATERTHANOREQUAL");
  +      break;
  +    case SMALLERTHANOREQUAL:
  +      jj_consume_token(SMALLERTHANOREQUAL);
  +                                 System.out.println("SMALLERTHANOREQUAL");
  +      break;
  +    case LIKE:
  +      jj_consume_token(LIKE);
  +                   System.out.println("LIKE");
  +      break;
  +    default:
  +      jj_la1[6] = jj_gen;
  +      jj_consume_token(-1);
  +      throw new ParseException();
  +    }
  +  }
  +
  +  static final public void getColumns() throws ParseException {
       String col;
       Token column;
  -    column = jj_consume_token(IDENTIFIER);
  -            col = column.image;
  -            System.out.println("column=" + col);
  -      {if (true) return col;}
  -    throw new Error("Missing return statement in function");
  +    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  +    case 60:
  +      jj_consume_token(60);
  +            System.out.println("all columns");
  +      break;
  +    case IDENTIFIER:
  +      column = jj_consume_token(IDENTIFIER);
  +                           System.out.println("column=" + column.image);
  +      label_3:
  +      while (true) {
  +        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  +        case 61:
  +          ;
  +          break;
  +        default:
  +          jj_la1[7] = jj_gen;
  +          break label_3;
  +        }
  +        jj_consume_token(61);
  +            System.out.println(",");
  +        column = jj_consume_token(IDENTIFIER);
  +                               System.out.println("column=" + column.image);
  +      }
  +      break;
  +    default:
  +      jj_la1[8] = jj_gen;
  +      jj_consume_token(-1);
  +      throw new ParseException();
  +    }
  +  }
  +
  +  static final public void getTables() throws ParseException {
  +    String tab;
  +    Token table;
  +    table = jj_consume_token(IDENTIFIER);
  +                          System.out.println("table=" + table.image);
  +    label_4:
  +    while (true) {
  +      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  +      case 61:
  +        ;
  +        break;
  +      default:
  +        jj_la1[9] = jj_gen;
  +        break label_4;
  +      }
  +      jj_consume_token(61);
  +            System.out.println(",");
  +      table = jj_consume_token(IDENTIFIER);
  +                              System.out.println("table=" + table.image);
  +    }
     }
   
     static private boolean jj_initialized_once = false;
  @@ -154,9 +288,9 @@
     static public Token token, jj_nt;
     static private int jj_ntk;
     static private int jj_gen;
  -  static final private int[] jj_la1 = new int[2];
  -  static final private int[] jj_la1_0 = {0x30000,0x1,};
  -  static final private int[] jj_la1_1 = {0x0,0x0,};
  +  static final private int[] jj_la1 = new int[10];
  +  static final private int[] jj_la1_0 = \
{0x30000,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,};  +  static final private int[] \
jj_la1_1 = {0x0,0x8000000,0x4,0x1000,0x800,0x2000,0x1f8000,0x20000000,0x10100000,0x20000000,};
  
     public BasicSQLParser(java.io.InputStream stream) {
       if (jj_initialized_once) {
  @@ -171,7 +305,7 @@
       token = new Token();
       jj_ntk = -1;
       jj_gen = 0;
  -    for (int i = 0; i < 2; i++) jj_la1[i] = -1;
  +    for (int i = 0; i < 10; i++) jj_la1[i] = -1;
     }
   
     static public void ReInit(java.io.InputStream stream) {
  @@ -180,7 +314,7 @@
       token = new Token();
       jj_ntk = -1;
       jj_gen = 0;
  -    for (int i = 0; i < 2; i++) jj_la1[i] = -1;
  +    for (int i = 0; i < 10; i++) jj_la1[i] = -1;
     }
   
     public BasicSQLParser(java.io.Reader stream) {
  @@ -196,7 +330,7 @@
       token = new Token();
       jj_ntk = -1;
       jj_gen = 0;
  -    for (int i = 0; i < 2; i++) jj_la1[i] = -1;
  +    for (int i = 0; i < 10; i++) jj_la1[i] = -1;
     }
   
     static public void ReInit(java.io.Reader stream) {
  @@ -205,7 +339,7 @@
       token = new Token();
       jj_ntk = -1;
       jj_gen = 0;
  -    for (int i = 0; i < 2; i++) jj_la1[i] = -1;
  +    for (int i = 0; i < 10; i++) jj_la1[i] = -1;
     }
   
     public BasicSQLParser(BasicSQLParserTokenManager tm) {
  @@ -220,7 +354,7 @@
       token = new Token();
       jj_ntk = -1;
       jj_gen = 0;
  -    for (int i = 0; i < 2; i++) jj_la1[i] = -1;
  +    for (int i = 0; i < 10; i++) jj_la1[i] = -1;
     }
   
     public void ReInit(BasicSQLParserTokenManager tm) {
  @@ -228,7 +362,7 @@
       token = new Token();
       jj_ntk = -1;
       jj_gen = 0;
  -    for (int i = 0; i < 2; i++) jj_la1[i] = -1;
  +    for (int i = 0; i < 10; i++) jj_la1[i] = -1;
     }
   
     static final private Token jj_consume_token(int kind) throws ParseException {
  @@ -275,15 +409,15 @@
   
     static final public ParseException generateParseException() {
       jj_expentries.removeAllElements();
  -    boolean[] la1tokens = new boolean[53];
  -    for (int i = 0; i < 53; i++) {
  +    boolean[] la1tokens = new boolean[62];
  +    for (int i = 0; i < 62; i++) {
         la1tokens[i] = false;
       }
       if (jj_kind >= 0) {
         la1tokens[jj_kind] = true;
         jj_kind = -1;
       }
  -    for (int i = 0; i < 2; i++) {
  +    for (int i = 0; i < 10; i++) {
         if (jj_la1[i] == jj_gen) {
           for (int j = 0; j < 32; j++) {
             if ((jj_la1_0[i] & (1<<j)) != 0) {
  @@ -295,7 +429,7 @@
           }
         }
       }
  -    for (int i = 0; i < 53; i++) {
  +    for (int i = 0; i < 62; i++) {
         if (la1tokens[i]) {
           jj_expentry = new int[1];
           jj_expentry[0] = i;
  
  
  

--
To unsubscribe, e-mail:   <mailto:avalon-cvs-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-cvs-help@jakarta.apache.org>


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic