⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 josqlparser.java

📁 JoSQL 1.5的源代码。JoSQL(SQL for Java Objects)为Java开发者提供运用SQL语句来操作Java对象集的能力.利用JoSQL可以像操作数据库中的数据一样对任何Java
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
      case K_DESC:
      case K_NULL:
      case K_LIKE:
      case K_INLIKE:
      case K_FROM:
      case K_WHERE:
      case K_GROUP:
      case K_LIMIT:
      case K_ORDER:
      case K_SELECT:
      case K_HAVING:
      case K_BETWEEN:
      case K_DISTINCT:
      case K_USE:
      case K_TRUE:
      case K_FALSE:
      case K_EXECUTE:
      case K_RESULTS:
      case K_WHERE_RESULTS:
      case K_HAVING_RESULTS:
      case K_GROUP_BY_RESULTS:
      case K_NEW:
      case S_IDENTIFIER:
      case S_CHAR_LITERAL:
      case S_CHAR_LITERAL2:
      case S_DOUBLE:
      case S_INTEGER:
      case 49:
      case 50:
      case 51:
      case 53:
      case 59:
      case 71:
      case 72:
        exp = OrExpression();
                           oe.setExpression (exp);
        break;
      default:
        jj_la1[29] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
    }
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case K_ASC:
    case K_DESC:
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case K_ASC:
        jj_consume_token(K_ASC);
               oe.setType (OrderBy.ASC);
        break;
      case K_DESC:
        jj_consume_token(K_DESC);
                                                        oe.setType (OrderBy.DESC);
        break;
      default:
        jj_la1[30] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
      break;
    default:
      jj_la1[31] = jj_gen;
      ;
    }
      {if (true) return oe;}
    throw new Error("Missing return statement in function");
  }

  final public Limit Limit() throws ParseException {
        Limit limit = new Limit ();
        Token token = null;
        Expression start = null;
        Expression rows = null;
    jj_consume_token(K_LIMIT);
    if (jj_2_9(2)) {
      start = SimpleExpression();
      jj_consume_token(55);
    } else {
      ;
    }
    rows = SimpleExpression();
      if ((start != null)
          &&
          (!(start instanceof ValueExpression))
         )
      {

         {if (true) throw new ParseException ("Only expressions that return a numeric value are supported as the start value for the LIMIT part of the query.");}

      }

      if (!(rows instanceof ValueExpression))
      {

         {if (true) throw new ParseException ("Only expressions that return a numeric value are supported as the rows value for the LIMIT part of the query.");}

      }

      limit.setStart ((ValueExpression) start);
      limit.setRowsCount ((ValueExpression) rows);

      {if (true) return limit;}
    throw new Error("Missing return statement in function");
  }

  final public Limit GroupLimit() throws ParseException {
        Limit limit = new Limit ();
        Token token = null;
        Expression start = null;
        Expression rows = null;
    jj_consume_token(K_GROUP);
    jj_consume_token(K_BY);
    jj_consume_token(K_LIMIT);
    if (jj_2_10(2)) {
      start = SimpleExpression();
      jj_consume_token(55);
    } else {
      ;
    }
    rows = SimpleExpression();
      if ((start != null)
          &&
          (!(start instanceof ValueExpression))
         )
      {

         {if (true) throw new ParseException ("Only expressions that return a numeric value are supported as the start value for the LIMIT part of the query.");}

      }

      if (!(rows instanceof ValueExpression))
      {

         {if (true) throw new ParseException ("Only expressions that return a numeric value are supported as the rows value for the LIMIT part of the query.");}

      }

      limit.setStart ((ValueExpression) start);
      limit.setRowsCount ((ValueExpression) rows);

      {if (true) return limit;}
    throw new Error("Missing return statement in function");
  }

  final public ColumnReference ColumnReference() throws ParseException {
        ColumnReference retval = new ColumnReference ();
        String name = null;
        int index = -1;
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case K_AS:
    case K_BY:
    case K_IS:
    case K_IN:
    case K_OR:
    case K_ON:
    case K_ALL:
    case K_AND:
    case K_NOT:
    case K_ASC:
    case K_DESC:
    case K_LIKE:
    case K_INLIKE:
    case K_FROM:
    case K_WHERE:
    case K_GROUP:
    case K_LIMIT:
    case K_ORDER:
    case K_SELECT:
    case K_HAVING:
    case K_BETWEEN:
    case K_DISTINCT:
    case K_USE:
    case K_TRUE:
    case K_FALSE:
    case K_EXECUTE:
    case K_RESULTS:
    case K_WHERE_RESULTS:
    case K_HAVING_RESULTS:
    case K_GROUP_BY_RESULTS:
    case K_NEW:
    case S_IDENTIFIER:
      name = Name();
                         retval.setName (name);
      break;
    case S_INTEGER:
      index = ColumnIndex();
                                   retval.setIndex (index);
      break;
    default:
      jj_la1[32] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
          {if (true) return retval;}
    throw new Error("Missing return statement in function");
  }

  final public int ColumnIndex() throws ParseException {
   Token index = null;
    index = jj_consume_token(S_INTEGER);
           {if (true) return Integer.parseInt(index.image);}
    throw new Error("Missing return statement in function");
  }

  final public Expression OrExpression() throws ParseException {
        Expression left;
        Expression right;
        Expression result;
    left = AndExpression();
                                  result = left;
    label_9:
    while (true) {
      if (jj_2_11(2147483647)) {
        ;
      } else {
        break label_9;
      }
      jj_consume_token(K_OR);
      right = OrExpression();
                                result = new AndOrExpression ();
                                BinaryExpression be = (BinaryExpression) result;
                                be.setLeft (left);
                                be.setRight (right);
    }
                {if (true) return result;}
    throw new Error("Missing return statement in function");
  }

  final public Expression AndExpression() throws ParseException {
        Expression left;
        Expression right;
        Expression result;
    left = Condition();
                             result = left;
    label_10:
    while (true) {
      if (jj_2_12(2147483647)) {
        ;
      } else {
        break label_10;
      }
      jj_consume_token(K_AND);
      right = OrExpression();
                        result = new AndOrExpression ();

                        AndOrExpression aoe = (AndOrExpression) result;
                        aoe.setLeft (left);
                        aoe.setRight (right);
                        aoe.setAnd (true);
    }
          {if (true) return result;}
    throw new Error("Missing return statement in function");
  }

  final public Expression Condition() throws ParseException {
        Expression result;
    if (jj_2_13(2147483647)) {
      result = SQLCondition();
    } else {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case K_AS:
      case K_BY:
      case K_IS:
      case K_IN:
      case K_OR:
      case K_ON:
      case K_ALL:
      case K_AND:
      case K_NOT:
      case K_ASC:
      case K_DESC:
      case K_NULL:
      case K_LIKE:
      case K_INLIKE:
      case K_FROM:
      case K_WHERE:
      case K_GROUP:
      case K_LIMIT:
      case K_ORDER:
      case K_SELECT:
      case K_HAVING:
      case K_BETWEEN:
      case K_DISTINCT:
      case K_USE:
      case K_TRUE:
      case K_FALSE:
      case K_EXECUTE:
      case K_RESULTS:
      case K_WHERE_RESULTS:
      case K_HAVING_RESULTS:
      case K_GROUP_BY_RESULTS:
      case K_NEW:
      case S_IDENTIFIER:
      case S_CHAR_LITERAL:
      case S_CHAR_LITERAL2:
      case S_DOUBLE:
      case S_INTEGER:
      case 49:
      case 50:
      case 51:
      case 53:
      case 59:
      case 71:
      case 72:
        result = RegularCondition();
        break;
      default:
        jj_la1[33] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
    }
          {if (true) return result;}
    throw new Error("Missing return statement in function");
  }

  final public Expression RegularCondition() throws ParseException {
        Expression result = null;
        Expression left = null;
        Expression right = null;
        boolean ignoreCase = false;
    left = SimpleExpression();
                                    result = left;
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case 63:
    case 64:
    case 65:
    case 66:
    case 67:
    case 68:
    case 69:
    case 70:
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case 63:
        jj_consume_token(63);
                 ignoreCase = true;
        break;
      default:
        jj_la1[34] = jj_gen;
        ;
      }
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case 64:
        jj_consume_token(64);
                 result = new GTLTExpression (); GTLTExpression lt = (GTLTExpression) result; lt.setIgnoreCase (ignoreCase); lt.setType (Utilities.GT);
        break;
      case 65:
        jj_consume_token(65);
                   result = new GTLTExpression (); lt = (GTLTExpression) result; lt.setIgnoreCase (ignoreCase); lt.setType (Utilities.LT);
        break;
      case 66:
        jj_consume_token(66);
                   result = new EqualsExpression (); EqualsExpression ee = (EqualsExpression) result; ee.setIgnoreCase (ignoreCase);
        break;
      case 67:
        jj_consume_token(67);
                    result = new GTLTExpression (); lt = (GTLTExpression) result; lt.setIgnoreCase (ignoreCase); lt.setType (Utilities.GTE);
        break;
      case 68:
        jj_consume_token(68);
                    result = new GTLTExpression (); lt = (GTLTExpression) result; lt.setIgnoreCase (ignoreCase); lt.setType (Utilities.LTE);
        break;
      case 69:
      case 70:
        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
        case 69:
          jj_consume_token(69);
          break;
        case 70:
          jj_consume_token(70);
          break;
        default:
          jj_la1[35] = jj_gen;
          jj_consume_token(-1);
          throw new ParseException();
        }
                             result = new EqualsExpression (); ee = (EqualsExpression) result; ee.setNot (true); ee.setIgnoreCase (ignoreCase);
        break;
      default:
        jj_la1[36] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
      right = SimpleExpression();
          BinaryExpression be = (BinaryExpression) result;
          be.setLeft (left);
          be.setRight (right);
      break;
    default:
      jj_la1[37] = jj_gen;
      ;
    }
       {if (true) return result;}
    throw new Error("Missing return statement in function");
  }

  final public Expression SQLCondition() throws ParseException {
        Expression result;
    if (jj_2_14(2147483647)) {
      result = InExpression();
    } else if (jj_2_15(2147483647)) {
      result = BetweenExpression();
    } else if (jj_2_16(2147483647)) {
      result = IsNullExpression();
    } else {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case K_AS:
      case K_BY:
      case K_IS:
      case K_IN:
      case K_OR:
      case K_ON:
      case K_ALL:
      case K_AND:
      case K_NOT:
      case K_ASC:
      case K_DESC:
      case K_NULL:
      case K_LIKE:
      case K_INLIKE:
      case K_FROM:
      case K_WHERE:
      case K_GROUP:
      case K_LIMIT:
      case K_ORDER:
      case K_SELECT:
      case K_HAVING:
      case K_BETWEEN:
      case K_DISTINCT:
      case K_USE:
      case K_TRUE:
      case K_FALSE:
      case K_EXECUTE:
      case K_RESULTS:
      case K_WHERE_RESULTS:
      case K_HAVING_RESULTS:
      case K_GROUP_BY_RESULTS:
      case K_NEW:
      case S_IDENTIFIER:
      case S_CHAR_LITERAL:
      case S_CHAR_LITERAL2:
      case S_DOUBLE:
      case S_INTEGER:
      case 49:
      case 50:
      case 51:
      case 53:
      case 59:
      case 71:
      case 72:
        result = LikeExpression();
        break;
      default:

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -