froehlich    01/12/03 09:36:51

  Added:       apps/db/src/java/org/apache/avalon/db/basic/handlers/sql
                        BasicSQLSelectSimpleHandler.java
                        BasicSQLParserTokenManager.java
                        BasicSQLParserConstants.java BasicSQLParser.java
                        BasicSQLHandler.java
  Log:
  start integrating SQL parser into AvalonDB
  
  Revision  Changes    Path
  1.1                  
jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/basic/handlers/sql/BasicSQLSelectSimpleHandler.java
  
  Index: BasicSQLSelectSimpleHandler.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  package org.apache.avalon.db.basic.handlers.sql;
  
  import org.apache.avalon.db.basic.parser.BasicSQLParserManager;
  import org.apache.avalon.db.basic.actions.BasicSelectSimple;
  import org.apache.avalon.db.basic.actions.BasicCriteria;
  import org.apache.avalon.db.basic.handlers.sql.BasicSQLParser;
  import org.apache.avalon.db.services.DatabasePersistor;
  import org.apache.avalon.db.transport.Reply;
  import org.apache.avalon.db.transport.Request;
  import org.apache.avalon.db.transport.SelectRequest;
  import org.apache.avalon.db.transport.ResultSetReply;
  import org.apache.avalon.db.actions.ActionException;
  import org.apache.avalon.db.actions.Select;
  import org.apache.avalon.db.server.DBRequestContext;
  import org.apache.avalon.db.server.sql.ParseException;
  import org.apache.avalon.db.data.Column;
  import org.apache.avalon.db.data.Queryable;
  import org.apache.avalon.db.data.impl.AbstractQueryable;
  
  
  /**
   * Class BasicSQLSelectSimpleHandler
   *
   * @author Gerhard Froehlich <a href="mailto:[EMAIL PROTECTED]">[EMAIL 
PROTECTED]</a>
   * @version $Revision: 1.1 $
   */
  public class BasicSQLSelectSimpleHandler extends BasicSQLHandler {
  
      /**
       * Constructor BasicSQLSelectSimpleHandler
       *
       * @param parser
       * @param databasePersistor
       *
       */
      public BasicSQLSelectSimpleHandler(BasicSQLParserManager parser,
                                         DatabasePersistor databasePersistor) {
          super(parser, databasePersistor);
      }
  
      /**
       * Method handleRequest
       *
       *
       * @param request
       *
       * @return
       *
       * @throws ActionException
       *
       */
      public Reply handleRequest(DBRequestContext context, Request request) 
throws ActionException {
  
          System.out.println("BasicSQLSelectSimpleHandler");
          initBasicSQLPaser(((SelectRequest)request).getSql());
          try {
              BasicSQLParser.Select();
          } catch (ParseException pe) {
              getLogger().error("handleRequest(..): ParseException:",pe);
          }
          // TODO - not perfect.
  
          /*
          Select action = new BasicSelectSimple(tables,
          convertColumns(queryable, getColumns(rootElement)),
          new BasicCriteria(criteriaHelper.getCriteria()));
          
          mParser.initializeAction(action);
          action.execute();
          */
  
          //return new ResultSetReply(action.getRowSet());
          return null;
      }
  }
  
  
  
  1.1                  
jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/basic/handlers/sql/BasicSQLParserTokenManager.java
  
  Index: BasicSQLParserTokenManager.java
  ===================================================================
  /* Generated By:JavaCC: Do not edit this line. 
BasicSQLParserTokenManager.java */
  package org.apache.avalon.db.basic.handlers.sql;
  import org.apache.avalon.db.server.AbstractRequestHandler;
  import org.apache.avalon.db.server.sql.ParseException;
  import org.apache.avalon.db.server.sql.SimpleCharStream;
  import org.apache.avalon.db.server.sql.Token;
  import org.apache.avalon.db.server.sql.TokenMgrError;
  import java.util.ArrayList;
  import java.io.InputStream;
  import java.io.ByteArrayInputStream;
  
  public class BasicSQLParserTokenManager implements BasicSQLParserConstants
  {
    public static  java.io.PrintStream debugStream = System.out;
    public static  void setDebugStream(java.io.PrintStream ds) { debugStream = 
ds; }
  static private final int jjStopAtPos(int pos, int kind)
  {
     jjmatchedKind = kind;
     jjmatchedPos = pos;
     return pos + 1;
  }
  static private final int jjMoveStringLiteralDfa0_0()
  {
     switch(curChar)
     {
        case 9:
           jjmatchedKind = 4;
           return jjMoveNfa_0(5, 0);
        case 10:
           jjmatchedKind = 2;
           return jjMoveNfa_0(5, 0);
        case 13:
           jjmatchedKind = 3;
           return jjMoveNfa_0(5, 0);
        case 32:
           jjmatchedKind = 1;
           return jjMoveNfa_0(5, 0);
        case 40:
           jjmatchedKind = 61;
           return jjMoveNfa_0(5, 0);
        case 41:
           jjmatchedKind = 62;
           return jjMoveNfa_0(5, 0);
        case 42:
           jjmatchedKind = 63;
           return jjMoveNfa_0(5, 0);
        case 44:
           jjmatchedKind = 60;
           return jjMoveNfa_0(5, 0);
        case 59:
           jjmatchedKind = 59;
           return jjMoveNfa_0(5, 0);
        case 60:
           jjmatchedKind = 48;
           return jjMoveStringLiteralDfa1_0(0x4000000000000L);
        case 61:
           jjmatchedKind = 46;
           return jjMoveNfa_0(5, 0);
        case 62:
           jjmatchedKind = 47;
           return jjMoveStringLiteralDfa1_0(0x2000000000000L);
        case 65:
           return jjMoveStringLiteralDfa1_0(0x80016000000L);
        case 66:
           return jjMoveStringLiteralDfa1_0(0x8000008000L);
        case 67:
           return jjMoveStringLiteralDfa1_0(0x201800000L);
        case 68:
           return jjMoveStringLiteralDfa1_0(0x40040606000L);
        case 70:
           return jjMoveStringLiteralDfa1_0(0x20000000L);
        case 71:
           return jjMoveStringLiteralDfa1_0(0x10000100000L);
        case 72:
           return jjMoveStringLiteralDfa1_0(0x4000000000L);
        case 73:
           return jjMoveStringLiteralDfa1_0(0x1080081000L);
        case 78:
           return jjMoveStringLiteralDfa1_0(0x200000000000L);
        case 79:
           return jjMoveStringLiteralDfa1_0(0x120000000000L);
        case 82:
           return jjMoveStringLiteralDfa1_0(0x40800L);
        case 83:
           return jjMoveStringLiteralDfa1_0(0x8020400L);
        case 84:
           return jjMoveStringLiteralDfa1_0(0x800000300L);
        case 85:
           return jjMoveStringLiteralDfa1_0(0x10000L);
        case 86:
           return jjMoveStringLiteralDfa1_0(0x2100000080L);
        case 87:
           return jjMoveStringLiteralDfa1_0(0x400000000L);
        case 97:
           return jjMoveStringLiteralDfa1_0(0x80016000000L);
        case 98:
           return jjMoveStringLiteralDfa1_0(0x8000008000L);
        case 99:
           return jjMoveStringLiteralDfa1_0(0x201800000L);
        case 100:
           return jjMoveStringLiteralDfa1_0(0x40040606000L);
        case 102:
           return jjMoveStringLiteralDfa1_0(0x20000000L);
        case 103:
           return jjMoveStringLiteralDfa1_0(0x10000100000L);
        case 104:
           return jjMoveStringLiteralDfa1_0(0x4000000000L);
        case 105:
           return jjMoveStringLiteralDfa1_0(0x1080081000L);
        case 108:
           return jjMoveStringLiteralDfa1_0(0x8000000000000L);
        case 110:
           return jjMoveStringLiteralDfa1_0(0x200000000000L);
        case 111:
           return jjMoveStringLiteralDfa1_0(0x120000000000L);
        case 114:
           return jjMoveStringLiteralDfa1_0(0x40800L);
        case 115:
           return jjMoveStringLiteralDfa1_0(0x8020400L);
        case 116:
           return jjMoveStringLiteralDfa1_0(0x800000300L);
        case 117:
           return jjMoveStringLiteralDfa1_0(0x10000L);
        case 118:
           return jjMoveStringLiteralDfa1_0(0x2100000080L);
        case 119:
           return jjMoveStringLiteralDfa1_0(0x400000000L);
        default :
           return jjMoveNfa_0(5, 0);
     }
  }
  static private final int jjMoveStringLiteralDfa1_0(long active0)
  {
     try { curChar = input_stream.readChar(); }
     catch(java.io.IOException e) {
     return jjMoveNfa_0(5, 0);
     }
     switch(curChar)
     {
        case 61:
           if ((active0 & 0x2000000000000L) != 0L)
           {
              jjmatchedKind = 49;
              jjmatchedPos = 1;
           }
           else if ((active0 & 0x4000000000000L) != 0L)
           {
              jjmatchedKind = 50;
              jjmatchedPos = 1;
           }
           break;
        case 65:
           return jjMoveStringLiteralDfa2_0(active0, 0x6800004080L);
        case 69:
           return jjMoveStringLiteralDfa2_0(active0, 0x8048422800L);
        case 72:
           return jjMoveStringLiteralDfa2_0(active0, 0x400000000L);
        case 73:
           return jjMoveStringLiteralDfa2_0(active0, 0x40100008300L);
        case 76:
           return jjMoveStringLiteralDfa2_0(active0, 0x2000000L);
        case 77:
           return jjMoveStringLiteralDfa2_0(active0, 0x400L);
        case 78:
           return jjMoveStringLiteralDfa2_0(active0, 0x81080081000L);
        case 79:
           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)
           {
              jjmatchedKind = 26;
              jjmatchedPos = 1;
           }
           return jjMoveStringLiteralDfa2_0(active0, 0x10000000L);
        case 97:
           return jjMoveStringLiteralDfa2_0(active0, 0x6800004080L);
        case 101:
           return jjMoveStringLiteralDfa2_0(active0, 0x8048422800L);
        case 104:
           return jjMoveStringLiteralDfa2_0(active0, 0x400000000L);
        case 105:
           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, 0x81080081000L);
        case 111:
           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)
           {
              jjmatchedKind = 26;
              jjmatchedPos = 1;
           }
           return jjMoveStringLiteralDfa2_0(active0, 0x10000000L);
        default :
           break;
     }
     return jjMoveNfa_0(5, 1);
  }
  static private final int jjMoveStringLiteralDfa2_0(long old0, long active0)
  {
     if (((active0 &= old0)) == 0L)
        return jjMoveNfa_0(5, 1);
     try { curChar = input_stream.readChar(); }
     catch(java.io.IOException e) {
     return jjMoveNfa_0(5, 1);
     }
     switch(curChar)
     {
        case 65:
           return jjMoveStringLiteralDfa3_0(active0, 0x100c00L);
        case 66:
           return jjMoveStringLiteralDfa3_0(active0, 0x800000000L);
        case 67:
           if ((active0 & 0x10000000L) != 0L)
           {
              jjmatchedKind = 28;
              jjmatchedPos = 2;
           }
           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 76:
           return jjMoveStringLiteralDfa3_0(active0, 0x2000460000L);
        case 77:
           return jjMoveStringLiteralDfa3_0(active0, 0x1000300L);
        case 79:
           return jjMoveStringLiteralDfa3_0(active0, 0x10020200000L);
        case 82:
           return jjMoveStringLiteralDfa3_0(active0, 0x80L);
        case 83:
           return jjMoveStringLiteralDfa3_0(active0, 0x40040080000L);
        case 84:
           if ((active0 & 0x8000000L) != 0L)
           {
              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);
        case 86:
           return jjMoveStringLiteralDfa3_0(active0, 0x4000000000L);
        case 97:
           return jjMoveStringLiteralDfa3_0(active0, 0x100c00L);
        case 98:
           return jjMoveStringLiteralDfa3_0(active0, 0x800000000L);
        case 99:
           if ((active0 & 0x10000000L) != 0L)
           {
              jjmatchedKind = 28;
              jjmatchedPos = 2;
           }
           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, 0x8000000000000L);
        case 108:
           return jjMoveStringLiteralDfa3_0(active0, 0x2000460000L);
        case 109:
           return jjMoveStringLiteralDfa3_0(active0, 0x1000300L);
        case 111:
           return jjMoveStringLiteralDfa3_0(active0, 0x10020200000L);
        case 114:
           return jjMoveStringLiteralDfa3_0(active0, 0x80L);
        case 115:
           return jjMoveStringLiteralDfa3_0(active0, 0x40040080000L);
        case 116:
           if ((active0 & 0x8000000L) != 0L)
           {
              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);
        case 118:
           return jjMoveStringLiteralDfa3_0(active0, 0x4000000000L);
        default :
           break;
     }
     return jjMoveNfa_0(5, 2);
  }
  static private final int jjMoveStringLiteralDfa3_0(long old0, long active0)
  {
     if (((active0 &= old0)) == 0L)
        return jjMoveNfa_0(5, 2);
     try { curChar = input_stream.readChar(); }
     catch(java.io.IOException e) {
     return jjMoveNfa_0(5, 2);
     }
     switch(curChar)
     {
        case 65:
           return jjMoveStringLiteralDfa4_0(active0, 0x810000L);
        case 67:
           if ((active0 & 0x40000000L) != 0L)
           {
              jjmatchedKind = 30;
              jjmatchedPos = 3;
           }
           return jjMoveStringLiteralDfa4_0(active0, 0x80L);
        case 69:
           if ((active0 & 0x200L) != 0L)
           {
              jjmatchedKind = 9;
              jjmatchedPos = 3;
           }
           else if ((active0 & 0x4000L) != 0L)
           {
              jjmatchedKind = 14;
              jjmatchedPos = 3;
           }
           return jjMoveStringLiteralDfa4_0(active0, 0x210024a1100L);
        case 73:
           return jjMoveStringLiteralDfa4_0(active0, 0x400000a000L);
        case 76:
           if ((active0 & 0x800L) != 0L)
           {
              jjmatchedKind = 11;
              jjmatchedPos = 3;
           }
           return jjMoveStringLiteralDfa4_0(active0, 0x800040400L);
        case 77:
           if ((active0 & 0x20000000L) != 0L)
           {
              jjmatchedKind = 29;
              jjmatchedPos = 3;
           }
           return jjMoveStringLiteralDfa4_0(active0, 0x1000000L);
        case 78:
           return jjMoveStringLiteralDfa4_0(active0, 0x200100000L);
        case 79:
           if ((active0 & 0x80000000L) != 0L)
           {
              jjmatchedKind = 31;
              jjmatchedPos = 3;
           }
           break;
        case 80:
           if ((active0 & 0x200000L) != 0L)
           {
              jjmatchedKind = 21;
              jjmatchedPos = 3;
           }
           break;
        case 82:
           return jjMoveStringLiteralDfa4_0(active0, 0x400000000L);
        case 84:
           return jjMoveStringLiteralDfa4_0(active0, 0x40000000000L);
        case 85:
           return jjMoveStringLiteralDfa4_0(active0, 0x12000000000L);
        case 87:
           if ((active0 & 0x100000000L) != 0L)
           {
              jjmatchedKind = 32;
              jjmatchedPos = 3;
           }
           return jjMoveStringLiteralDfa4_0(active0, 0x8000000000L);
        case 97:
           return jjMoveStringLiteralDfa4_0(active0, 0x810000L);
        case 99:
           if ((active0 & 0x40000000L) != 0L)
           {
              jjmatchedKind = 30;
              jjmatchedPos = 3;
           }
           return jjMoveStringLiteralDfa4_0(active0, 0x80L);
        case 101:
           if ((active0 & 0x200L) != 0L)
           {
              jjmatchedKind = 9;
              jjmatchedPos = 3;
           }
           else if ((active0 & 0x4000L) != 0L)
           {
              jjmatchedKind = 14;
              jjmatchedPos = 3;
           }
           else if ((active0 & 0x8000000000000L) != 0L)
           {
              jjmatchedKind = 51;
              jjmatchedPos = 3;
           }
           return jjMoveStringLiteralDfa4_0(active0, 0x210024a1100L);
        case 105:
           return jjMoveStringLiteralDfa4_0(active0, 0x400000a000L);
        case 108:
           if ((active0 & 0x800L) != 0L)
           {
              jjmatchedKind = 11;
              jjmatchedPos = 3;
           }
           return jjMoveStringLiteralDfa4_0(active0, 0x800040400L);
        case 109:
           if ((active0 & 0x20000000L) != 0L)
           {
              jjmatchedKind = 29;
              jjmatchedPos = 3;
           }
           return jjMoveStringLiteralDfa4_0(active0, 0x1000000L);
        case 110:
           return jjMoveStringLiteralDfa4_0(active0, 0x200100000L);
        case 111:
           if ((active0 & 0x80000000L) != 0L)
           {
              jjmatchedKind = 31;
              jjmatchedPos = 3;
           }
           break;
        case 112:
           if ((active0 & 0x200000L) != 0L)
           {
              jjmatchedKind = 21;
              jjmatchedPos = 3;
           }
           break;
        case 114:
           return jjMoveStringLiteralDfa4_0(active0, 0x400000000L);
        case 116:
           return jjMoveStringLiteralDfa4_0(active0, 0x40000000000L);
        case 117:
           return jjMoveStringLiteralDfa4_0(active0, 0x12000000000L);
        case 119:
           if ((active0 & 0x100000000L) != 0L)
           {
              jjmatchedKind = 32;
              jjmatchedPos = 3;
           }
           return jjMoveStringLiteralDfa4_0(active0, 0x8000000000L);
        default :
           break;
     }
     return jjMoveNfa_0(5, 3);
  }
  static private final int jjMoveStringLiteralDfa4_0(long old0, long active0)
  {
     if (((active0 &= old0)) == 0L)
        return jjMoveNfa_0(5, 3);
     try { curChar = input_stream.readChar(); }
     catch(java.io.IOException e) {
     return jjMoveNfa_0(5, 3);
     }
     switch(curChar)
     {
        case 66:
           return jjMoveStringLiteralDfa5_0(active0, 0x40000L);
        case 67:
           return jjMoveStringLiteralDfa5_0(active0, 0x20000L);
        case 69:
           if ((active0 & 0x400000000L) != 0L)
           {
              jjmatchedKind = 34;
              jjmatchedPos = 4;
           }
           else if ((active0 & 0x800000000L) != 0L)
           {
              jjmatchedKind = 35;
              jjmatchedPos = 4;
           }
           return jjMoveStringLiteralDfa5_0(active0, 0xa000000000L);
        case 71:
           return jjMoveStringLiteralDfa5_0(active0, 0x1000L);
        case 72:
           return jjMoveStringLiteralDfa5_0(active0, 0x80L);
        case 73:
           return jjMoveStringLiteralDfa5_0(active0, 0x40001000000L);
        case 76:
           return jjMoveStringLiteralDfa5_0(active0, 0x400L);
        case 77:
           return jjMoveStringLiteralDfa5_0(active0, 0x2000L);
        case 78:
           return jjMoveStringLiteralDfa5_0(active0, 0x4000008000L);
        case 80:
           return jjMoveStringLiteralDfa5_0(active0, 0x10000000000L);
        case 82:
           if ((active0 & 0x2000000L) != 0L)
           {
              jjmatchedKind = 25;
              jjmatchedPos = 4;
           }
           return jjMoveStringLiteralDfa5_0(active0, 0x20000080000L);
        case 83:
           return jjMoveStringLiteralDfa5_0(active0, 0x100L);
        case 84:
           if ((active0 & 0x100000L) != 0L)
           {
              jjmatchedKind = 20;
              jjmatchedPos = 4;
           }
           else if ((active0 & 0x200000000L) != 0L)
           {
              jjmatchedKind = 33;
              jjmatchedPos = 4;
           }
           return jjMoveStringLiteralDfa5_0(active0, 0xc10000L);
        case 88:
           if ((active0 & 0x1000000000L) != 0L)
           {
              jjmatchedKind = 36;
              jjmatchedPos = 4;
           }
           break;
        case 98:
           return jjMoveStringLiteralDfa5_0(active0, 0x40000L);
        case 99:
           return jjMoveStringLiteralDfa5_0(active0, 0x20000L);
        case 101:
           if ((active0 & 0x400000000L) != 0L)
           {
              jjmatchedKind = 34;
              jjmatchedPos = 4;
           }
           else if ((active0 & 0x800000000L) != 0L)
           {
              jjmatchedKind = 35;
              jjmatchedPos = 4;
           }
           return jjMoveStringLiteralDfa5_0(active0, 0xa000000000L);
        case 103:
           return jjMoveStringLiteralDfa5_0(active0, 0x1000L);
        case 104:
           return jjMoveStringLiteralDfa5_0(active0, 0x80L);
        case 105:
           return jjMoveStringLiteralDfa5_0(active0, 0x40001000000L);
        case 108:
           return jjMoveStringLiteralDfa5_0(active0, 0x400L);
        case 109:
           return jjMoveStringLiteralDfa5_0(active0, 0x2000L);
        case 110:
           return jjMoveStringLiteralDfa5_0(active0, 0x4000008000L);
        case 112:
           return jjMoveStringLiteralDfa5_0(active0, 0x10000000000L);
        case 114:
           if ((active0 & 0x2000000L) != 0L)
           {
              jjmatchedKind = 25;
              jjmatchedPos = 4;
           }
           return jjMoveStringLiteralDfa5_0(active0, 0x20000080000L);
        case 115:
           return jjMoveStringLiteralDfa5_0(active0, 0x100L);
        case 116:
           if ((active0 & 0x100000L) != 0L)
           {
              jjmatchedKind = 20;
              jjmatchedPos = 4;
           }
           else if ((active0 & 0x200000000L) != 0L)
           {
              jjmatchedKind = 33;
              jjmatchedPos = 4;
           }
           return jjMoveStringLiteralDfa5_0(active0, 0xc10000L);
        case 120:
           if ((active0 & 0x1000000000L) != 0L)
           {
              jjmatchedKind = 36;
              jjmatchedPos = 4;
           }
           break;
        default :
           break;
     }
     return jjMoveNfa_0(5, 4);
  }
  static private final int jjMoveStringLiteralDfa5_0(long old0, long active0)
  {
     if (((active0 &= old0)) == 0L)
        return jjMoveNfa_0(5, 4);
     try { curChar = input_stream.readChar(); }
     catch(java.io.IOException e) {
     return jjMoveNfa_0(5, 4);
     }
     switch(curChar)
     {
        case 32:
           return jjMoveStringLiteralDfa6_0(active0, 0x30000000000L);
        case 65:
           return jjMoveStringLiteralDfa6_0(active0, 0x42080L);
        case 69:
           if ((active0 & 0x10000L) != 0L)
           {
              jjmatchedKind = 16;
              jjmatchedPos = 5;
           }
           else if ((active0 & 0x400000L) != 0L)
           {
              jjmatchedKind = 22;
              jjmatchedPos = 5;
           }
           else if ((active0 & 0x800000L) != 0L)
           {
              jjmatchedKind = 23;
              jjmatchedPos = 5;
           }
           return jjMoveStringLiteralDfa6_0(active0, 0x8000001000L);
        case 71:
           if ((active0 & 0x4000000000L) != 0L)
           {
              jjmatchedKind = 38;
              jjmatchedPos = 5;
           }
           break;
        case 73:
           return jjMoveStringLiteralDfa6_0(active0, 0x400L);
        case 78:
           return jjMoveStringLiteralDfa6_0(active0, 0x40000000000L);
        case 83:
           if ((active0 & 0x2000000000L) != 0L)
           {
              jjmatchedKind = 37;
              jjmatchedPos = 5;
           }
           break;
        case 84:
           if ((active0 & 0x8000L) != 0L)
           {
              jjmatchedKind = 15;
              jjmatchedPos = 5;
           }
           else if ((active0 & 0x20000L) != 0L)
           {
              jjmatchedKind = 17;
              jjmatchedPos = 5;
           }
           else if ((active0 & 0x80000L) != 0L)
           {
              jjmatchedKind = 19;
              jjmatchedPos = 5;
           }
           else if ((active0 & 0x1000000L) != 0L)
           {
              jjmatchedKind = 24;
              jjmatchedPos = 5;
           }
           return jjMoveStringLiteralDfa6_0(active0, 0x100L);
        case 97:
           return jjMoveStringLiteralDfa6_0(active0, 0x42080L);
        case 101:
           if ((active0 & 0x10000L) != 0L)
           {
              jjmatchedKind = 16;
              jjmatchedPos = 5;
           }
           else if ((active0 & 0x400000L) != 0L)
           {
              jjmatchedKind = 22;
              jjmatchedPos = 5;
           }
           else if ((active0 & 0x800000L) != 0L)
           {
              jjmatchedKind = 23;
              jjmatchedPos = 5;
           }
           return jjMoveStringLiteralDfa6_0(active0, 0x8000001000L);
        case 103:
           if ((active0 & 0x4000000000L) != 0L)
           {
              jjmatchedKind = 38;
              jjmatchedPos = 5;
           }
           break;
        case 105:
           return jjMoveStringLiteralDfa6_0(active0, 0x400L);
        case 110:
           return jjMoveStringLiteralDfa6_0(active0, 0x40000000000L);
        case 115:
           if ((active0 & 0x2000000000L) != 0L)
           {
              jjmatchedKind = 37;
              jjmatchedPos = 5;
           }
           break;
        case 116:
           if ((active0 & 0x8000L) != 0L)
           {
              jjmatchedKind = 15;
              jjmatchedPos = 5;
           }
           else if ((active0 & 0x20000L) != 0L)
           {
              jjmatchedKind = 17;
              jjmatchedPos = 5;
           }
           else if ((active0 & 0x80000L) != 0L)
           {
              jjmatchedKind = 19;
              jjmatchedPos = 5;
           }
           else if ((active0 & 0x1000000L) != 0L)
           {
              jjmatchedKind = 24;
              jjmatchedPos = 5;
           }
           return jjMoveStringLiteralDfa6_0(active0, 0x100L);
        default :
           break;
     }
     return jjMoveNfa_0(5, 5);
  }
  static private final int jjMoveStringLiteralDfa6_0(long old0, long active0)
  {
     if (((active0 &= old0)) == 0L)
        return jjMoveNfa_0(5, 5);
     try { curChar = input_stream.readChar(); }
     catch(java.io.IOException e) {
     return jjMoveNfa_0(5, 5);
     }
     switch(curChar)
     {
        case 65:
           return jjMoveStringLiteralDfa7_0(active0, 0x100L);
        case 66:
           return jjMoveStringLiteralDfa7_0(active0, 0x30000000000L);
        case 67:
           return jjMoveStringLiteralDfa7_0(active0, 0x40000040000L);
        case 76:
           if ((active0 & 0x2000L) != 0L)
           {
              jjmatchedKind = 13;
              jjmatchedPos = 6;
           }
           break;
        case 78:
           if ((active0 & 0x8000000000L) != 0L)
           {
              jjmatchedKind = 39;
              jjmatchedPos = 6;
           }
           return jjMoveStringLiteralDfa7_0(active0, 0x400L);
        case 82:
           if ((active0 & 0x80L) != 0L)
           {
              jjmatchedKind = 7;
              jjmatchedPos = 6;
           }
           else if ((active0 & 0x1000L) != 0L)
           {
              jjmatchedKind = 12;
              jjmatchedPos = 6;
           }
           break;
        case 97:
           return jjMoveStringLiteralDfa7_0(active0, 0x100L);
        case 98:
           return jjMoveStringLiteralDfa7_0(active0, 0x30000000000L);
        case 99:
           return jjMoveStringLiteralDfa7_0(active0, 0x40000040000L);
        case 108:
           if ((active0 & 0x2000L) != 0L)
           {
              jjmatchedKind = 13;
              jjmatchedPos = 6;
           }
           break;
        case 110:
           if ((active0 & 0x8000000000L) != 0L)
           {
              jjmatchedKind = 39;
              jjmatchedPos = 6;
           }
           return jjMoveStringLiteralDfa7_0(active0, 0x400L);
        case 114:
           if ((active0 & 0x80L) != 0L)
           {
              jjmatchedKind = 7;
              jjmatchedPos = 6;
           }
           else if ((active0 & 0x1000L) != 0L)
           {
              jjmatchedKind = 12;
              jjmatchedPos = 6;
           }
           break;
        default :
           break;
     }
     return jjMoveNfa_0(5, 6);
  }
  static private final int jjMoveStringLiteralDfa7_0(long old0, long active0)
  {
     if (((active0 &= old0)) == 0L)
        return jjMoveNfa_0(5, 6);
     try { curChar = input_stream.readChar(); }
     catch(java.io.IOException e) {
     return jjMoveNfa_0(5, 6);
     }
     switch(curChar)
     {
        case 75:
           if ((active0 & 0x40000L) != 0L)
           {
              jjmatchedKind = 18;
              jjmatchedPos = 7;
           }
           break;
        case 77:
           return jjMoveStringLiteralDfa8_0(active0, 0x100L);
        case 84:
           if ((active0 & 0x400L) != 0L)
           {
              jjmatchedKind = 10;
              jjmatchedPos = 7;
           }
           else if ((active0 & 0x40000000000L) != 0L)
           {
              jjmatchedKind = 42;
              jjmatchedPos = 7;
           }
           break;
        case 89:
           if ((active0 & 0x10000000000L) != 0L)
           {
              jjmatchedKind = 40;
              jjmatchedPos = 7;
           }
           else if ((active0 & 0x20000000000L) != 0L)
           {
              jjmatchedKind = 41;
              jjmatchedPos = 7;
           }
           break;
        case 107:
           if ((active0 & 0x40000L) != 0L)
           {
              jjmatchedKind = 18;
              jjmatchedPos = 7;
           }
           break;
        case 109:
           return jjMoveStringLiteralDfa8_0(active0, 0x100L);
        case 116:
           if ((active0 & 0x400L) != 0L)
           {
              jjmatchedKind = 10;
              jjmatchedPos = 7;
           }
           else if ((active0 & 0x40000000000L) != 0L)
           {
              jjmatchedKind = 42;
              jjmatchedPos = 7;
           }
           break;
        case 121:
           if ((active0 & 0x10000000000L) != 0L)
           {
              jjmatchedKind = 40;
              jjmatchedPos = 7;
           }
           else if ((active0 & 0x20000000000L) != 0L)
           {
              jjmatchedKind = 41;
              jjmatchedPos = 7;
           }
           break;
        default :
           break;
     }
     return jjMoveNfa_0(5, 7);
  }
  static private final int jjMoveStringLiteralDfa8_0(long old0, long active0)
  {
     if (((active0 &= old0)) == 0L)
        return jjMoveNfa_0(5, 7);
     try { curChar = input_stream.readChar(); }
     catch(java.io.IOException e) {
     return jjMoveNfa_0(5, 7);
     }
     switch(curChar)
     {
        case 80:
           if ((active0 & 0x100L) != 0L)
           {
              jjmatchedKind = 8;
              jjmatchedPos = 8;
           }
           break;
        case 112:
           if ((active0 & 0x100L) != 0L)
           {
              jjmatchedKind = 8;
              jjmatchedPos = 8;
           }
           break;
        default :
           break;
     }
     return jjMoveNfa_0(5, 8);
  }
  static private final void jjCheckNAdd(int state)
  {
     if (jjrounds[state] != jjround)
     {
        jjstateSet[jjnewStateCnt++] = state;
        jjrounds[state] = jjround;
     }
  }
  static private final void jjAddStates(int start, int end)
  {
     do {
        jjstateSet[jjnewStateCnt++] = jjnextStates[start];
     } while (start++ != end);
  }
  static private final void jjCheckNAddTwoStates(int state1, int state2)
  {
     jjCheckNAdd(state1);
     jjCheckNAdd(state2);
  }
  static private final void jjCheckNAddStates(int start, int end)
  {
     do {
        jjCheckNAdd(jjnextStates[start]);
     } while (start++ != end);
  }
  static private final void jjCheckNAddStates(int start)
  {
     jjCheckNAdd(jjnextStates[start]);
     jjCheckNAdd(jjnextStates[start + 1]);
  }
  static final long[] jjbitVec0 = {
     0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL
  };
  static private final int jjMoveNfa_0(int startState, int curPos)
  {
     int strKind = jjmatchedKind;
     int strPos = jjmatchedPos;
     int seenUpto;
     input_stream.backup(seenUpto = curPos + 1);
     try { curChar = input_stream.readChar(); }
     catch(java.io.IOException e) { throw new Error("Internal Error"); }
     curPos = 0;
     int[] nextStates;
     int startsAt = 0;
     jjnewStateCnt = 42;
     int i = 1;
     jjstateSet[0] = startState;
     int j, kind = 0x7fffffff;
     for (;;)
     {
        if (++jjround == 0x7fffffff)
           ReInitRounds();
        if (curChar < 64)
        {
           long l = 1L << curChar;
           MatchLoop: do
           {
              switch(jjstateSet[--i])
              {
                 case 5:
                    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(10, 12);
                    break;
                 case 1:
                    if ((0xffffffffffffdbffL & l) != 0L)
                       jjCheckNAddStates(10, 12);
                    break;
                 case 2:
                    if ((0x2400L & l) != 0L && kind > 5)
                       kind = 5;
                    break;
                 case 3:
                    if (curChar == 10 && kind > 5)
                       kind = 5;
                    break;
                 case 4:
                    if (curChar == 13)
                       jjstateSet[jjnewStateCnt++] = 3;
                    break;
                 case 6:
                    if (curChar == 42)
                       jjCheckNAddTwoStates(7, 8);
                    break;
                 case 7:
                    if ((0xfffffbffffffffffL & l) != 0L)
                       jjCheckNAddTwoStates(7, 8);
                    break;
                 case 8:
                    if (curChar == 42)
                       jjCheckNAddStates(13, 15);
                    break;
                 case 9:
                    if ((0xffff7bffffffffffL & l) != 0L)
                       jjCheckNAddTwoStates(10, 8);
                    break;
                 case 10:
                    if ((0xfffffbffffffffffL & l) != 0L)
                       jjCheckNAddTwoStates(10, 8);
                    break;
                 case 11:
                    if (curChar == 47 && kind > 6)
                       kind = 6;
                    break;
                 case 12:
                    if (curChar == 47)
                       jjstateSet[jjnewStateCnt++] = 6;
                    break;
                 case 14:
                    if ((0x3ff000000000000L & l) == 0L)
                       break;
                    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);
        }
        else if (curChar < 128)
        {
           long l = 1L << (curChar & 077);
           MatchLoop: do
           {
              switch(jjstateSet[--i])
              {
                 case 5:
                 case 14:
                    if ((0x7fffffe87fffffeL & l) == 0L)
                       break;
                    if (kind > 52)
                       kind = 52;
                    jjCheckNAdd(14);
                    break;
                 case 1:
                    jjAddStates(10, 12);
                    break;
                 case 7:
                    jjCheckNAddTwoStates(7, 8);
                    break;
                 case 9:
                 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);
        }
        else
        {
           int i2 = (curChar & 0xff) >> 6;
           long l2 = 1L << (curChar & 077);
           MatchLoop: do
           {
              switch(jjstateSet[--i])
              {
                 case 1:
                    if ((jjbitVec0[i2] & l2) != 0L)
                       jjAddStates(10, 12);
                    break;
                 case 7:
                    if ((jjbitVec0[i2] & l2) != 0L)
                       jjCheckNAddTwoStates(7, 8);
                    break;
                 case 9:
                 case 10:
                    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);
        }
        if (kind != 0x7fffffff)
        {
           jjmatchedKind = kind;
           jjmatchedPos = curPos;
           kind = 0x7fffffff;
        }
        ++curPos;
        if ((i = jjnewStateCnt) == (startsAt = 42 - (jjnewStateCnt = startsAt)))
           break;
        try { curChar = input_stream.readChar(); }
        catch(java.io.IOException e) { break; }
     }
     if (jjmatchedPos > strPos)
        return curPos;
  
     int toRet = Math.max(curPos, seenUpto);
  
     if (curPos < toRet)
        for (i = toRet - Math.min(curPos, seenUpto); i-- > 0; )
           try { curChar = input_stream.readChar(); }
           catch(java.io.IOException e) { throw new Error("Internal Error : 
Please send a bug report."); }
  
     if (jjmatchedPos < strPos)
     {
        jjmatchedKind = strKind;
        jjmatchedPos = strPos;
     }
     else if (jjmatchedPos == strPos && jjmatchedKind > strKind)
        jjmatchedKind = strKind;
  
     return toRet;
  }
  static final int[] jjnextStates = {
     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, null, null, null, "\75", "\76", "\74", "\76\75", "\74\75", 
  "\154\151\153\145", null, null, null, null, null, null, null, "\73", "\54", 
"\50", "\51", "\52", };
  public static final String[] lexStateNames = {
     "DEFAULT", 
  };
  static final long[] jjtoToken = {
     0xfd9fffffffffff81L, 0x0L, 
  };
  static final long[] jjtoSkip = {
     0x7eL, 0x0L, 
  };
  static private SimpleCharStream input_stream;
  static private final int[] jjrounds = new int[42];
  static private final int[] jjstateSet = new int[84];
  static protected char curChar;
  public BasicSQLParserTokenManager(SimpleCharStream stream)
  {
     if (input_stream != null)
        throw new TokenMgrError("ERROR: Second call to constructor of static 
lexer. You must use ReInit() to initialize the static variables.", 
TokenMgrError.STATIC_LEXER_ERROR);
     input_stream = stream;
  }
  public BasicSQLParserTokenManager(SimpleCharStream stream, int lexState)
  {
     this(stream);
     SwitchTo(lexState);
  }
  static public void ReInit(SimpleCharStream stream)
  {
     jjmatchedPos = jjnewStateCnt = 0;
     curLexState = defaultLexState;
     input_stream = stream;
     ReInitRounds();
  }
  static private final void ReInitRounds()
  {
     int i;
     jjround = 0x80000001;
     for (i = 42; i-- > 0;)
        jjrounds[i] = 0x80000000;
  }
  static public void ReInit(SimpleCharStream stream, int lexState)
  {
     ReInit(stream);
     SwitchTo(lexState);
  }
  static public void SwitchTo(int lexState)
  {
     if (lexState >= 1 || lexState < 0)
        throw new TokenMgrError("Error: Ignoring invalid lexical state : " + 
lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE);
     else
        curLexState = lexState;
  }
  
  static private final Token jjFillToken()
  {
     Token t = Token.newToken(jjmatchedKind);
     t.kind = jjmatchedKind;
     String im = jjstrLiteralImages[jjmatchedKind];
     t.image = (im == null) ? input_stream.GetImage() : im;
     t.beginLine = input_stream.getBeginLine();
     t.beginColumn = input_stream.getBeginColumn();
     t.endLine = input_stream.getEndLine();
     t.endColumn = input_stream.getEndColumn();
     return t;
  }
  
  static int curLexState = 0;
  static int defaultLexState = 0;
  static int jjnewStateCnt;
  static int jjround;
  static int jjmatchedPos;
  static int jjmatchedKind;
  
  public static final Token getNextToken() 
  {
    int kind;
    Token specialToken = null;
    Token matchedToken;
    int curPos = 0;
  
    EOFLoop :
    for (;;)
    {   
     try   
     {     
        curChar = input_stream.BeginToken();
     }     
     catch(java.io.IOException e)
     {        
        jjmatchedKind = 0;
        matchedToken = jjFillToken();
        return matchedToken;
     }
  
     jjmatchedKind = 0x7fffffff;
     jjmatchedPos = 0;
     curPos = jjMoveStringLiteralDfa0_0();
     if (jjmatchedKind != 0x7fffffff)
     {
        if (jjmatchedPos + 1 < curPos)
           input_stream.backup(curPos - jjmatchedPos - 1);
        if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 
0L)
        {
           matchedToken = jjFillToken();
           return matchedToken;
        }
        else
        {
           continue EOFLoop;
        }
     }
     int error_line = input_stream.getEndLine();
     int error_column = input_stream.getEndColumn();
     String error_after = null;
     boolean EOFSeen = false;
     try { input_stream.readChar(); input_stream.backup(1); }
     catch (java.io.IOException e1) {
        EOFSeen = true;
        error_after = curPos <= 1 ? "" : input_stream.GetImage();
        if (curChar == '\n' || curChar == '\r') {
           error_line++;
           error_column = 0;
        }
        else
           error_column++;
     }
     if (!EOFSeen) {
        input_stream.backup(1);
        error_after = curPos <= 1 ? "" : input_stream.GetImage();
     }
     throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, 
error_after, curChar, TokenMgrError.LEXICAL_ERROR);
    }
  }
  
  }
  
  
  
  1.1                  
jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/basic/handlers/sql/BasicSQLParserConstants.java
  
  Index: BasicSQLParserConstants.java
  ===================================================================
  /* Generated By:JavaCC: Do not edit this line. BasicSQLParserConstants.java */
  package org.apache.avalon.db.basic.handlers.sql;
  
  public interface BasicSQLParserConstants {
  
    int EOF = 0;
    int COMMENT_LINE = 5;
    int COMMENT_BLOCK = 6;
    int VARCHAR = 7;
    int TIMESTAMP = 8;
    int TIME = 9;
    int SMALLINT = 10;
    int REAL = 11;
    int INTEGER = 12;
    int DECIMAL = 13;
    int DATE = 14;
    int BIGINT = 15;
    int UPDATE = 16;
    int SELECT = 17;
    int ROLLBACK = 18;
    int INSERT = 19;
    int GRANT = 20;
    int DROP = 21;
    int DELETE = 22;
    int CREATE = 23;
    int COMMIT = 24;
    int ALTER = 25;
    int AS = 26;
    int SET = 27;
    int ASC = 28;
    int FROM = 29;
    int DESC = 30;
    int INTO = 31;
    int VIEW = 32;
    int COUNT = 33;
    int WHERE = 34;
    int TABLE = 35;
    int INDEX = 36;
    int VALUES = 37;
    int HAVING = 38;
    int BETWEEN = 39;
    int GROUPBY = 40;
    int ORDERBY = 41;
    int DISTINCT = 42;
    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;
  
    String[] tokenImage = {
      "<EOF>",
      "\" \"",
      "\"\\n\"",
      "\"\\r\"",
      "\"\\t\"",
      "<COMMENT_LINE>",
      "<COMMENT_BLOCK>",
      "\"varchar\"",
      "\"timestamp\"",
      "\"time\"",
      "\"smallint\"",
      "\"real\"",
      "\"integer\"",
      "\"decimal\"",
      "\"date\"",
      "\"bigint\"",
      "\"update\"",
      "\"select\"",
      "\"rollback\"",
      "\"insert\"",
      "\"grant\"",
      "\"drop\"",
      "\"delete\"",
      "\"create\"",
      "\"commit\"",
      "\"alter\"",
      "\"as\"",
      "\"set\"",
      "\"asc\"",
      "\"from\"",
      "\"desc\"",
      "\"into\"",
      "\"view\"",
      "\"count\"",
      "\"where\"",
      "\"table\"",
      "\"index\"",
      "\"values\"",
      "\"having\"",
      "\"between\"",
      "\"group by\"",
      "\"order by\"",
      "\"distinct\"",
      "\"and\"",
      "\"or\"",
      "\"not\"",
      "\"=\"",
      "\">\"",
      "\"<\"",
      "\">=\"",
      "\"<=\"",
      "\"like\"",
      "<IDENTIFIER>",
      "<LETTER>",
      "<DIGIT>",
      "<INTEGER_LITERAL>",
      "<FLOATING_POINT_LITERAL>",
      "<EXPONENT>",
      "<STRING_LITERAL>",
      "\";\"",
      "\",\"",
      "\"(\"",
      "\")\"",
      "\"*\"",
    };
  
  }
  
  
  
  1.1                  
jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/basic/handlers/sql/BasicSQLParser.java
  
  Index: BasicSQLParser.java
  ===================================================================
  /* Generated By:JavaCC: Do not edit this line. BasicSQLParser.java */
  package org.apache.avalon.db.basic.handlers.sql;
  
  import org.apache.avalon.db.server.AbstractRequestHandler;
  import org.apache.avalon.db.server.sql.ParseException;
  import org.apache.avalon.db.server.sql.SimpleCharStream;
  import org.apache.avalon.db.server.sql.Token;
  import org.apache.avalon.db.server.sql.TokenMgrError;
  
  import java.util.ArrayList;
  import java.io.InputStream;
  import java.io.ByteArrayInputStream;
  
  /**
   * This class is responsible for parsing SQL Statements
   * This class was generated by JavaCC 
   *
   * Please look at the BasicSQLParser.jj file which is
   * what controls the generation of this class.
   *
   * @author Gerhard Froehlich <a href="mailto:[EMAIL PROTECTED]">[EMAIL 
PROTECTED]</a>
   */
  public class BasicSQLParser implements BasicSQLParserConstants {
  
      public static void main(String args[]) {
          BasicSQLParser parser = new BasicSQLParser(System.in);
          try {
              parser.Test();
          } catch(ParseException pe) {
              pe.printStackTrace();
          }
      }
  
      public BasicSQLParser(String sql) {
          InputStream is = new ByteArrayInputStream(sql.getBytes());
          BasicSQLParser parser = new BasicSQLParser(is);
      }
  
  /**
   * Test Method for command line input
   */
    static final public void Test() throws ParseException {
      parseSQLString();
    }
  
    static final public String parseSQLString() throws ParseException {
      String stm;
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case SELECT:
        stm = Select();
        break;
      case UPDATE:
        stm = Update();
        break;
      case INSERT:
        stm = Insert();
        break;
      case DROP:
        stm = Drop();
        break;
      case DELETE:
        stm = Delete();
        break;
      default:
        jj_la1[0] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
      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");
    }
  
    static final public String Select() throws ParseException {
      String stm;
      jj_consume_token(SELECT);
            stm = "SELECT";
      getColumns();
      jj_consume_token(FROM);
      getTables();
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case WHERE:
        Where();
        break;
      default:
        jj_la1[2] = jj_gen;
        ;
      }
        {if (true) return stm;}
      throw new Error("Missing return statement in function");
    }
  
    static final public String Update() throws ParseException {
       String stm;
      jj_consume_token(UPDATE);
            stm = "UPDATE";
      getTables();
      jj_consume_token(SET);
      label_1:
      while (true) {
        jj_consume_token(IDENTIFIER);
        jj_consume_token(EQUAL);
        ExprValue();
        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
        case 60:
          jj_consume_token(60);
                    System.out.println(",");
          break;
        default:
          jj_la1[3] = jj_gen;
          ;
        }
        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
        case IDENTIFIER:
          ;
          break;
        default:
          jj_la1[4] = jj_gen;
          break label_1;
        }
      }
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case WHERE:
        Where();
        break;
      default:
        jj_la1[5] = jj_gen;
        ;
      }
        System.out.println("Row(s) updated ;-)");
        {if (true) return stm;}
      throw new Error("Missing return statement in function");
    }
  
    static final public void Rollback() throws ParseException {
      jj_consume_token(0);
    }
  
    static final public String Insert() throws ParseException {
      String stm;
      jj_consume_token(INSERT);
      jj_consume_token(INTO);
                       stm = "INSERT";
      jj_consume_token(IDENTIFIER);
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case 61:
        label_2:
        while (true) {
          jj_consume_token(61);
          getColumns();
          jj_consume_token(62);
          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
          case 61:
            ;
            break;
          default:
            jj_la1[6] = jj_gen;
            break label_2;
          }
        }
        break;
      default:
        jj_la1[7] = jj_gen;
        ;
      }
      label_3:
      while (true) {
        jj_consume_token(VALUES);
        jj_consume_token(61);
        getValues();
        jj_consume_token(62);
        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
        case VALUES:
          ;
          break;
        default:
          jj_la1[8] = jj_gen;
          break label_3;
        }
      }
        {if (true) return stm;}
      throw new Error("Missing return statement in function");
    }
  
    static final public void Grant() throws ParseException {
      jj_consume_token(0);
    }
  
    static final public String Drop() throws ParseException {
      String stm;
      jj_consume_token(DROP);
            stm = "DROP";
      jj_consume_token(IDENTIFIER);
        System.out.println("Table droped ;-)");
        {if (true) return stm;}
      throw new Error("Missing return statement in function");
    }
  
    static final public String Delete() throws ParseException {
      String stm;
      jj_consume_token(DELETE);
      jj_consume_token(FROM);
            stm = "DELETE";
      jj_consume_token(IDENTIFIER);
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case WHERE:
        Where();
        break;
      default:
        jj_la1[9] = jj_gen;
        ;
      }
        System.out.println("Row(s) deleted ;-)");
        {if (true) return stm;}
      throw new Error("Missing return statement in function");
    }
  
    static final public void Commit() throws ParseException {
      jj_consume_token(0);
    }
  
    static final public void Alter() throws ParseException {
      jj_consume_token(0);
    }
  
    static final public void Where() throws ParseException {
      jj_consume_token(WHERE);
            OrExpr();
    }
  
    static final public void OrExpr() throws ParseException {
      AndExpr();
      label_4:
      while (true) {
        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
        case OR:
          ;
          break;
        default:
          jj_la1[10] = jj_gen;
          break label_4;
        }
        jj_consume_token(OR);
               System.out.println("in or");
        AndExpr();
      }
    }
  
    static final public void AndExpr() throws ParseException {
      NotExpr();
      label_5:
      while (true) {
        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
        case AND:
          ;
          break;
        default:
          jj_la1[11] = jj_gen;
          break label_5;
        }
        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[12] = jj_gen;
        ;
      }
      CompareExpr();
    }
  
    static final public void CompareExpr() throws ParseException {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case IDENTIFIER:
      case INTEGER_LITERAL:
      case FLOATING_POINT_LITERAL:
      case STRING_LITERAL:
        ExprValue();
        CompareOps();
        ExprValue();
        break;
      case 61:
        Term();
        break;
      default:
        jj_la1[13] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
    }
  
    static final public void ExprValue() throws ParseException {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case IDENTIFIER:
        jj_consume_token(IDENTIFIER);
                     System.out.println("expr is <INDENTIFIER>");
        break;
      case STRING_LITERAL:
        jj_consume_token(STRING_LITERAL);
                           System.out.println("expr is <STRING_LITERAL>");
        break;
      case INTEGER_LITERAL:
        jj_consume_token(INTEGER_LITERAL);
                            System.out.println("expr is <INTEGER_LITERAL>");
        break;
      case FLOATING_POINT_LITERAL:
        jj_consume_token(FLOATING_POINT_LITERAL);
                                   System.out.println("expr is 
<FLOATING_POINT_LITERAL>");
        break;
      default:
        jj_la1[14] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
    }
  
    static final public void UpdateValue() throws ParseException {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case STRING_LITERAL:
        jj_consume_token(STRING_LITERAL);
                         System.out.println("value is <STRING_LITERAL>");
        break;
      case INTEGER_LITERAL:
        jj_consume_token(INTEGER_LITERAL);
                            System.out.println("value is <INTEGER_LITERAL>");
        break;
      case FLOATING_POINT_LITERAL:
        jj_consume_token(FLOATING_POINT_LITERAL);
                                   System.out.println("value expr is 
<FLOATING_POINT_LITERAL>");
        break;
      default:
        jj_la1[15] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
    }
  
    static final public void CompareOps() throws ParseException {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case EQUAL:
        jj_consume_token(EQUAL);
                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[16] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
    }
  
    static final public void Term() throws ParseException {
      jj_consume_token(61);
               System.out.println("(");
      OrExpr();
      jj_consume_token(62);
               System.out.println(")");
    }
  
    static final public void getColumns() throws ParseException {
      String col;
      Token column;
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case 63:
        jj_consume_token(63);
              System.out.println("all columns");
        break;
      case IDENTIFIER:
        column = jj_consume_token(IDENTIFIER);
                             System.out.println("column=" + column.image);
        label_6:
        while (true) {
          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
          case 60:
            ;
            break;
          default:
            jj_la1[17] = jj_gen;
            break label_6;
          }
          jj_consume_token(60);
              System.out.println(",");
          column = jj_consume_token(IDENTIFIER);
                                 System.out.println("column=" + column.image);
        }
        break;
      default:
        jj_la1[18] = 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_7:
      while (true) {
        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
        case 60:
          ;
          break;
        default:
          jj_la1[19] = jj_gen;
          break label_7;
        }
        jj_consume_token(60);
              System.out.println(",");
        table = jj_consume_token(IDENTIFIER);
                                System.out.println("table=" + table.image);
      }
    }
  
    static final public void getValues() throws ParseException {
      UpdateValue();
      label_8:
      while (true) {
        jj_consume_token(60);
              System.out.println(",");
        UpdateValue();
        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
        case 60:
          ;
          break;
        default:
          jj_la1[20] = jj_gen;
          break label_8;
        }
      }
    }
  
    static private boolean jj_initialized_once = false;
    static public BasicSQLParserTokenManager token_source;
    static SimpleCharStream jj_input_stream;
    static public Token token, jj_nt;
    static private int jj_ntk;
    static private int jj_gen;
    static final private int[] jj_la1 = new int[21];
    static final private int[] jj_la1_0 = 
{0x6b0000,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,};
    static final private int[] jj_la1_1 = 
{0x0,0x8000000,0x4,0x10000000,0x100000,0x4,0x20000000,0x20000000,0x20,0x4,0x1000,0x800,0x2000,0x25900000,0x5900000,0x5800000,0xfc000,0x10000000,0x80100000,0x10000000,0x10000000,};
  
    public BasicSQLParser(java.io.InputStream stream) {
      if (jj_initialized_once) {
        System.out.println("ERROR: Second call to constructor of static parser. 
 You must");
        System.out.println("       either use ReInit() or set the JavaCC option 
STATIC to false");
        System.out.println("       during parser generation.");
        throw new Error();
      }
      jj_initialized_once = true;
      jj_input_stream = new SimpleCharStream(stream, 1, 1);
      token_source = new BasicSQLParserTokenManager(jj_input_stream);
      token = new Token();
      jj_ntk = -1;
      jj_gen = 0;
      for (int i = 0; i < 21; i++) jj_la1[i] = -1;
    }
  
    static public void ReInit(java.io.InputStream stream) {
      jj_input_stream.ReInit(stream, 1, 1);
      token_source.ReInit(jj_input_stream);
      token = new Token();
      jj_ntk = -1;
      jj_gen = 0;
      for (int i = 0; i < 21; i++) jj_la1[i] = -1;
    }
  
    public BasicSQLParser(java.io.Reader stream) {
      if (jj_initialized_once) {
        System.out.println("ERROR: Second call to constructor of static parser. 
 You must");
        System.out.println("       either use ReInit() or set the JavaCC option 
STATIC to false");
        System.out.println("       during parser generation.");
        throw new Error();
      }
      jj_initialized_once = true;
      jj_input_stream = new SimpleCharStream(stream, 1, 1);
      token_source = new BasicSQLParserTokenManager(jj_input_stream);
      token = new Token();
      jj_ntk = -1;
      jj_gen = 0;
      for (int i = 0; i < 21; i++) jj_la1[i] = -1;
    }
  
    static public void ReInit(java.io.Reader stream) {
      jj_input_stream.ReInit(stream, 1, 1);
      token_source.ReInit(jj_input_stream);
      token = new Token();
      jj_ntk = -1;
      jj_gen = 0;
      for (int i = 0; i < 21; i++) jj_la1[i] = -1;
    }
  
    public BasicSQLParser(BasicSQLParserTokenManager tm) {
      if (jj_initialized_once) {
        System.out.println("ERROR: Second call to constructor of static parser. 
 You must");
        System.out.println("       either use ReInit() or set the JavaCC option 
STATIC to false");
        System.out.println("       during parser generation.");
        throw new Error();
      }
      jj_initialized_once = true;
      token_source = tm;
      token = new Token();
      jj_ntk = -1;
      jj_gen = 0;
      for (int i = 0; i < 21; i++) jj_la1[i] = -1;
    }
  
    public void ReInit(BasicSQLParserTokenManager tm) {
      token_source = tm;
      token = new Token();
      jj_ntk = -1;
      jj_gen = 0;
      for (int i = 0; i < 21; i++) jj_la1[i] = -1;
    }
  
    static final private Token jj_consume_token(int kind) throws ParseException 
{
      Token oldToken;
      if ((oldToken = token).next != null) token = token.next;
      else token = token.next = token_source.getNextToken();
      jj_ntk = -1;
      if (token.kind == kind) {
        jj_gen++;
        return token;
      }
      token = oldToken;
      jj_kind = kind;
      throw generateParseException();
    }
  
    static final public Token getNextToken() {
      if (token.next != null) token = token.next;
      else token = token.next = token_source.getNextToken();
      jj_ntk = -1;
      jj_gen++;
      return token;
    }
  
    static final public Token getToken(int index) {
      Token t = token;
      for (int i = 0; i < index; i++) {
        if (t.next != null) t = t.next;
        else t = t.next = token_source.getNextToken();
      }
      return t;
    }
  
    static final private int jj_ntk() {
      if ((jj_nt=token.next) == null)
        return (jj_ntk = (token.next=token_source.getNextToken()).kind);
      else
        return (jj_ntk = jj_nt.kind);
    }
  
    static private java.util.Vector jj_expentries = new java.util.Vector();
    static private int[] jj_expentry;
    static private int jj_kind = -1;
  
    static final public ParseException generateParseException() {
      jj_expentries.removeAllElements();
      boolean[] la1tokens = new boolean[64];
      for (int i = 0; i < 64; i++) {
        la1tokens[i] = false;
      }
      if (jj_kind >= 0) {
        la1tokens[jj_kind] = true;
        jj_kind = -1;
      }
      for (int i = 0; i < 21; i++) {
        if (jj_la1[i] == jj_gen) {
          for (int j = 0; j < 32; j++) {
            if ((jj_la1_0[i] & (1<<j)) != 0) {
              la1tokens[j] = true;
            }
            if ((jj_la1_1[i] & (1<<j)) != 0) {
              la1tokens[32+j] = true;
            }
          }
        }
      }
      for (int i = 0; i < 64; i++) {
        if (la1tokens[i]) {
          jj_expentry = new int[1];
          jj_expentry[0] = i;
          jj_expentries.addElement(jj_expentry);
        }
      }
      int[][] exptokseq = new int[jj_expentries.size()][];
      for (int i = 0; i < jj_expentries.size(); i++) {
        exptokseq[i] = (int[])jj_expentries.elementAt(i);
      }
      return new ParseException(token, exptokseq, tokenImage);
    }
  
    static final public void enable_tracing() {
    }
  
    static final public void disable_tracing() {
    }
  
  }
  
  
  
  1.1                  
jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/basic/handlers/sql/BasicSQLHandler.java
  
  Index: BasicSQLHandler.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  package org.apache.avalon.db.basic.handlers.sql;
  
  import org.apache.avalon.db.server.AbstractRequestHandler;
  import org.apache.avalon.db.basic.parser.BasicSQLParserManager;
  import org.apache.avalon.db.basic.handlers.sql.BasicSQLParser;
  import org.apache.avalon.db.services.DatabasePersistor;
  
  /**
   * Class BasicSQLHandler
   *
   *
   * @author Gerhard Froehlich <a href="mailto:[EMAIL PROTECTED]">[EMAIL 
PROTECTED]</a>
   * @version $Revision: 1.1 $
   */
  public abstract class BasicSQLHandler extends AbstractRequestHandler {
  
      protected final BasicSQLParserManager mParser;
  
      /**
       * Constructor BasicSQLHandler
       *
       * @param parser
       * @param databasePersistor
       */
      public BasicSQLHandler(BasicSQLParserManager parser, 
                             DatabasePersistor databasePersistor) {
          super(databasePersistor);
          mParser = parser;
      }
  
      public void initBasicSQLPaser(String sql) {
          BasicSQLParser parser = new BasicSQLParser(sql);
      }
  }
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to