All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.activemq.selector.mockrunner.SelectorParser Maven / Gradle / Ivy

There is a newer version: 2.0.7
Show newest version
/* Generated By:JavaCC: Do not edit this line. SelectorParser.java */
package org.activemq.selector.mockrunner;

import java.io.Serializable;
import java.io.StringReader;
import java.util.ArrayList;

import javax.jms.InvalidSelectorException;

import org.activemq.filter.mockrunner.ArithmeticExpression;
import org.activemq.filter.mockrunner.BooleanExpression;
import org.activemq.filter.mockrunner.ComparisonExpression;
import org.activemq.filter.mockrunner.ConstantExpression;
import org.activemq.filter.mockrunner.Expression;
import org.activemq.filter.mockrunner.ExpressionFilter;
import org.activemq.filter.mockrunner.Filter;
import org.activemq.filter.mockrunner.LogicExpression;
import org.activemq.filter.mockrunner.PropertyExpression;
import org.activemq.filter.mockrunner.UnaryExpression;

/** 
 * Alwin Ibba: Changed package
 * Alwin Ibba: Removed XPath cases in unaryExpr()
 * Alwin Ibba: Modification to be Java 1.3 compatible
 * 
 * JMS Selector Parser generated by JavaCC
 * 
 * Do not edit this .java file directly - it is autogenerated from SelectorParser.jj
 */
public class SelectorParser implements SelectorParserConstants, Serializable {

    public SelectorParser() {
        this(new StringReader(""));
    }

    public Filter parse(String sql) throws InvalidSelectorException {
        this.ReInit(new StringReader(sql));

        try {
            return this.JmsSelector();
        }
        catch (Throwable e) {
                throw new InvalidSelectorException("test");
        }

    }

    private BooleanExpression asBooleanExpression(Expression value) throws ParseException  {
        if (value instanceof BooleanExpression) {
            return (BooleanExpression) value;
        }
        if (value instanceof PropertyExpression) {
            return UnaryExpression.createBooleanCast( value );
        }
        throw new ParseException("Expression will not result in a boolean value: " + value);
    }

// ----------------------------------------------------------------------------
// Grammer
// ----------------------------------------------------------------------------
  final public Filter JmsSelector() throws ParseException {
    Expression left=null;
    left = orExpression();
        {if (true) return new ExpressionFilter(asBooleanExpression(left));}
    throw new Error("Missing return statement in function");
  }

  final public Expression orExpression() throws ParseException {
    Expression left;
    Expression right;
    left = andExpression();
    label_1:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case OR:
          break;
      default:
        break label_1;
      }
      jj_consume_token(OR);
      right = andExpression();
                left = LogicExpression.createOR(asBooleanExpression(left), asBooleanExpression(right));
    }
        {if (true) return left;}
    throw new Error("Missing return statement in function");
  }

  final public Expression andExpression() throws ParseException {
    Expression left;
    Expression right;
    left = equalityExpression();
    label_2:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case AND:
          break;
      default:
        break label_2;
      }
      jj_consume_token(AND);
      right = equalityExpression();
                left = LogicExpression.createAND(asBooleanExpression(left), asBooleanExpression(right));
    }
        {if (true) return left;}
    throw new Error("Missing return statement in function");
  }

  final public Expression equalityExpression() throws ParseException {
    Expression left;
    Expression right;
    left = comparisonExpression();
    label_3:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case IS:
      case 28:
      case 29:
          break;
      default:
        break label_3;
      }
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case 28:
        jj_consume_token(28);
        right = comparisonExpression();
                left = ComparisonExpression.createEqual(left, right);
        break;
      case 29:
        jj_consume_token(29);
        right = comparisonExpression();
                left = ComparisonExpression.createNotEqual(left, right);
        break;
      default:
        if (jj_2_1(2)) {
          jj_consume_token(IS);
          jj_consume_token(NULL);
                left = ComparisonExpression.createIsNull(left);
        } else {
          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
          case IS:
            jj_consume_token(IS);
            jj_consume_token(NOT);
            jj_consume_token(NULL);
                left = ComparisonExpression.createIsNotNull(left);
            break;
          default:
            jj_consume_token(-1);
            throw new ParseException();
          }
        }
      }
    }
        {if (true) return left;}
    throw new Error("Missing return statement in function");
  }

  final public Expression comparisonExpression() throws ParseException {
    Expression left;
    Expression right;
    Expression low;
    Expression high;
    String t, u;
        boolean not;
        ArrayList list;
    left = addExpression();
    label_4:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case NOT:
      case BETWEEN:
      case LIKE:
      case IN:
      case 30:
      case 31:
      case 32:
      case 33:
          break;
      default:
        break label_4;
      }
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case 30:
        jj_consume_token(30);
        right = addExpression();
                    left = ComparisonExpression.createGreaterThan(left, right);
        break;
      case 31:
        jj_consume_token(31);
        right = addExpression();
                    left = ComparisonExpression.createGreaterThanEqual(left, right);
        break;
      case 32:
        jj_consume_token(32);
        right = addExpression();
                    left = ComparisonExpression.createLessThan(left, right);
        break;
      case 33:
        jj_consume_token(33);
        right = addExpression();
                    left = ComparisonExpression.createLessThanEqual(left, right);
        break;
      case LIKE:
                                        u=null;
        jj_consume_token(LIKE);
        t = stringLitteral();
        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
        case ESCAPE:
          jj_consume_token(ESCAPE);
          u = stringLitteral();
          break;
        default:
        }
                    left = ComparisonExpression.createLike(left, t, u);
        break;
      default:
        if (jj_2_2(2)) {
                                        u=null;
          jj_consume_token(NOT);
          jj_consume_token(LIKE);
          t = stringLitteral();
          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
          case ESCAPE:
            jj_consume_token(ESCAPE);
            u = stringLitteral();
            break;
          default:
          }
                    left = ComparisonExpression.createNotLike(left, t, u);
        } else {
          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
          case BETWEEN:
            jj_consume_token(BETWEEN);
            low = addExpression();
            jj_consume_token(AND);
            high = addExpression();
                                        left = ComparisonExpression.createBetween(left, low, high);
            break;
          default:
            if (jj_2_3(2)) {
              jj_consume_token(NOT);
              jj_consume_token(BETWEEN);
              low = addExpression();
              jj_consume_token(AND);
              high = addExpression();
                                        left = ComparisonExpression.createNotBetween(left, low, high);
            } else {
              switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
              case IN:
                jj_consume_token(IN);
                jj_consume_token(34);
                t = stringLitteral();
                                    list = new ArrayList();
                                    list.add( t );
                label_5:
                while (true) {
                  switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
                  case 35:
                      break;
                  default:
                    break label_5;
                  }
                  jj_consume_token(35);
                  t = stringLitteral();
                                            list.add( t );
                }
                jj_consume_token(36);
                           left = ComparisonExpression.createInFilter(left, list);
                break;
              default:
                if (jj_2_4(2)) {
                  jj_consume_token(NOT);
                  jj_consume_token(IN);
                  jj_consume_token(34);
                  t = stringLitteral();
                                    list = new ArrayList();
                                    list.add( t );
                  label_6:
                  while (true) {
                    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
                    case 35:
                        break;
                    default:
                      break label_6;
                    }
                    jj_consume_token(35);
                    t = stringLitteral();
                                            list.add( t );
                  }
                  jj_consume_token(36);
                           left = ComparisonExpression.createNotInFilter(left, list);
                } else {
                  jj_consume_token(-1);
                  throw new ParseException();
                }
              }
            }
          }
        }
      }
    }
        {if (true) return left;}
    throw new Error("Missing return statement in function");
  }

  final public Expression addExpression() throws ParseException {
    Expression left;
    Expression right;
    left = multExpr();
    label_7:
    while (true) {
      if (jj_2_5(2147483647)) {
      } else {
        break label_7;
      }
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case 37:
        jj_consume_token(37);
        right = multExpr();
                    left = ArithmeticExpression.createPlus(left, right);
        break;
      case 38:
        jj_consume_token(38);
        right = multExpr();
                    left = ArithmeticExpression.createMinus(left, right);
        break;
      default:
        jj_consume_token(-1);
        throw new ParseException();
      }
    }
        {if (true) return left;}
    throw new Error("Missing return statement in function");
  }

  final public Expression multExpr() throws ParseException {
    Expression left;
    Expression right;
    left = unaryExpr();
    label_8:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case 39:
      case 40:
      case 41:
          break;
      default:
        break label_8;
      }
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case 39:
        jj_consume_token(39);
        right = unaryExpr();
                left = ArithmeticExpression.createMultiply(left, right);
        break;
      case 40:
        jj_consume_token(40);
        right = unaryExpr();
                left = ArithmeticExpression.createDivide(left, right);
        break;
      case 41:
        jj_consume_token(41);
        right = unaryExpr();
                left = ArithmeticExpression.createMod(left, right);
        break;
      default:
        jj_consume_token(-1);
        throw new ParseException();
      }
    }
        {if (true) return left;}
    throw new Error("Missing return statement in function");
  }

  final public Expression unaryExpr() throws ParseException {
    String s=null;
    Expression left=null;
    if (jj_2_6(2147483647)) {
      jj_consume_token(37);
      left = unaryExpr();
    } else {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case 38:
        jj_consume_token(38);
        left = unaryExpr();
                left = UnaryExpression.createNegate(left);
        break;
      case NOT:
        jj_consume_token(NOT);
        left = unaryExpr();
                    left = UnaryExpression.createNOT( asBooleanExpression(left) );
        break;
      case TRUE:
      case FALSE:
      case NULL:
      case DECIMAL_LITERAL:
      case HEX_LITERAL:
      case OCTAL_LITERAL:
      case FLOATING_POINT_LITERAL:
      case STRING_LITERAL:
      case ID:
      case 34:
        left = primaryExpr();
        break;
      default:
        jj_consume_token(-1);
        throw new ParseException();
      }
    }
        {if (true) return left;}
    throw new Error("Missing return statement in function");
  }

  final public Expression primaryExpr() throws ParseException {
    Expression left=null;
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case TRUE:
    case FALSE:
    case NULL:
    case DECIMAL_LITERAL:
    case HEX_LITERAL:
    case OCTAL_LITERAL:
    case FLOATING_POINT_LITERAL:
    case STRING_LITERAL:
      left = literal();
      break;
    case ID:
      left = variable();
      break;
    case 34:
      jj_consume_token(34);
      left = orExpression();
      jj_consume_token(36);
      break;
    default:
      jj_consume_token(-1);
      throw new ParseException();
    }
        {if (true) return left;}
    throw new Error("Missing return statement in function");
  }

  final public ConstantExpression literal() throws ParseException {
    Token t;
    String s;
    ConstantExpression left=null;
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case STRING_LITERAL:
      s = stringLitteral();
                left = new ConstantExpression(s);
      break;
    case DECIMAL_LITERAL:
      t = jj_consume_token(DECIMAL_LITERAL);
                left = ConstantExpression.createFromDecimal(t.image);
      break;
    case HEX_LITERAL:
      t = jj_consume_token(HEX_LITERAL);
                left = ConstantExpression.createFromHex(t.image);
      break;
    case OCTAL_LITERAL:
      t = jj_consume_token(OCTAL_LITERAL);
                left = ConstantExpression.createFromOctal(t.image);
      break;
    case FLOATING_POINT_LITERAL:
      t = jj_consume_token(FLOATING_POINT_LITERAL);
                left = ConstantExpression.createFloat(t.image);
      break;
    case TRUE:
      jj_consume_token(TRUE);
                left = ConstantExpression.TRUE;
      break;
    case FALSE:
      jj_consume_token(FALSE);
                left = ConstantExpression.FALSE;
      break;
    case NULL:
      jj_consume_token(NULL);
                left = ConstantExpression.NULL;
      break;
    default:
      jj_consume_token(-1);
      throw new ParseException();
    }
        {if (true) return left;}
    throw new Error("Missing return statement in function");
  }

  final public String stringLitteral() throws ParseException {
    Token t;
    StringBuilder rc = new StringBuilder();
    boolean first=true;
    t = jj_consume_token(STRING_LITERAL);
        // Decode the sting value.
        String image = t.image;
        for( int i=1; i < image.length()-1; i++ ) {
                char c = image.charAt(i);
                if( c == '\'' )
                        i++;
                        rc.append(c);
        }
            {if (true) return rc.toString();}
    throw new Error("Missing return statement in function");
  }

  final public PropertyExpression variable() throws ParseException {
    Token t;
    PropertyExpression left=null;
    t = jj_consume_token(ID);
            left = new PropertyExpression(t.image);
        {if (true) return left;}
    throw new Error("Missing return statement in function");
  }

  private boolean jj_2_1(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    return !jj_3_1();
  }

  private boolean jj_2_2(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    return !jj_3_2();
  }

  private boolean jj_2_3(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    return !jj_3_3();
  }

  private boolean jj_2_4(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    return !jj_3_4();
  }

  private boolean jj_2_5(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    return !jj_3_5();
  }

  private boolean jj_2_6(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    return !jj_3_6();
  }

  private boolean jj_3R_53() {
    if (jj_scan_token(32)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_45()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3R_29() {
    if (jj_scan_token(ID)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3R_63() {
    if (jj_scan_token(35)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_23()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3R_50() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_58()) {
    jj_scanpos = xsp;
    if (jj_3R_59()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3R_40() {
    if (jj_scan_token(OR)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_39()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3R_52() {
    if (jj_scan_token(31)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_45()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3R_27() {
    if (jj_scan_token(34)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_30()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(36)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3R_26() {
    if (jj_3R_29()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3R_51() {
    if (jj_scan_token(30)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_45()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3R_46() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_51()) {
    jj_scanpos = xsp;
    if (jj_3R_52()) {
    jj_scanpos = xsp;
    if (jj_3R_53()) {
    jj_scanpos = xsp;
    if (jj_3R_54()) {
    jj_scanpos = xsp;
    if (jj_3R_55()) {
    jj_scanpos = xsp;
    if (jj_3_2()) {
    jj_scanpos = xsp;
    if (jj_3R_56()) {
    jj_scanpos = xsp;
    if (jj_3_3()) {
    jj_scanpos = xsp;
    if (jj_3R_57()) {
    jj_scanpos = xsp;
    if (jj_3_4()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3R_25() {
    if (jj_3R_28()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3R_45() {
    if (jj_3R_11()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_50()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    return false;
  }

  private boolean jj_3R_30() {
    if (jj_3R_39()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_40()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    return false;
  }

  private boolean jj_3R_24() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_25()) {
    jj_scanpos = xsp;
    if (jj_3R_26()) {
    jj_scanpos = xsp;
    if (jj_3R_27()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3R_19() {
    if (jj_3R_24()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3R_23() {
    if (jj_scan_token(STRING_LITERAL)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3R_62() {
    if (jj_scan_token(35)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_23()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3R_18() {
    if (jj_scan_token(XQUERY)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_23()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3R_43() {
    if (jj_3R_45()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_46()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    return false;
  }

  private boolean jj_3R_61() {
    if (jj_scan_token(ESCAPE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_23()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3_4() {
    if (jj_scan_token(NOT)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(IN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(34)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_23()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_63()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    if (jj_scan_token(36)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3_6() {
    if (jj_scan_token(37)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_12()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3R_17() {
    if (jj_scan_token(XPATH)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_23()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3R_38() {
    if (jj_scan_token(NULL)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3R_16() {
    if (jj_scan_token(NOT)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_12()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3R_14() {
    if (jj_scan_token(37)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_12()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3R_57() {
    if (jj_scan_token(IN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(34)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_23()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_62()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    if (jj_scan_token(36)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3R_49() {
    if (jj_scan_token(IS)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(NOT)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(NULL)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3R_15() {
    if (jj_scan_token(38)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_12()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3R_37() {
    if (jj_scan_token(FALSE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3_1() {
    if (jj_scan_token(IS)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(NULL)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3R_12() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_14()) {
    jj_scanpos = xsp;
    if (jj_3R_15()) {
    jj_scanpos = xsp;
    if (jj_3R_16()) {
    jj_scanpos = xsp;
    if (jj_3R_17()) {
    jj_scanpos = xsp;
    if (jj_3R_18()) {
    jj_scanpos = xsp;
    if (jj_3R_19()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3R_36() {
    if (jj_scan_token(TRUE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3R_48() {
    if (jj_scan_token(29)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_43()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3_3() {
    if (jj_scan_token(NOT)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(BETWEEN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_45()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(AND)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_45()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3R_47() {
    if (jj_scan_token(28)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_43()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3R_44() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_47()) {
    jj_scanpos = xsp;
    if (jj_3R_48()) {
    jj_scanpos = xsp;
    if (jj_3_1()) {
    jj_scanpos = xsp;
    if (jj_3R_49()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3R_35() {
    if (jj_scan_token(FLOATING_POINT_LITERAL)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3R_56() {
    if (jj_scan_token(BETWEEN)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_45()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(AND)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_45()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3R_60() {
    if (jj_scan_token(ESCAPE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_23()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3R_34() {
    if (jj_scan_token(OCTAL_LITERAL)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3R_22() {
    if (jj_scan_token(41)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_12()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3R_41() {
    if (jj_3R_43()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_44()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    return false;
  }

  private boolean jj_3_2() {
    if (jj_scan_token(NOT)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_scan_token(LIKE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_23()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_61()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3R_55() {
    if (jj_scan_token(LIKE)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_23()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_60()) jj_scanpos = xsp;
    else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3R_33() {
    if (jj_scan_token(HEX_LITERAL)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3R_21() {
    if (jj_scan_token(40)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_12()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3R_13() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_20()) {
    jj_scanpos = xsp;
    if (jj_3R_21()) {
    jj_scanpos = xsp;
    if (jj_3R_22()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3R_20() {
    if (jj_scan_token(39)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_12()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3R_42() {
    if (jj_scan_token(AND)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_41()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3R_32() {
    if (jj_scan_token(DECIMAL_LITERAL)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3R_11() {
    if (jj_3R_12()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_13()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    return false;
  }

  private boolean jj_3R_10() {
    if (jj_scan_token(38)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3R_31() {
    if (jj_3R_23()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3R_9() {
    if (jj_scan_token(37)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3R_59() {
    if (jj_scan_token(38)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_11()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3R_39() {
    if (jj_3R_41()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_42()) { jj_scanpos = xsp; break; }
      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    }
    return false;
  }

  private boolean jj_3_5() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_9()) {
    jj_scanpos = xsp;
    if (jj_3R_10()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_11()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3R_28() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_31()) {
    jj_scanpos = xsp;
    if (jj_3R_32()) {
    jj_scanpos = xsp;
    if (jj_3R_33()) {
    jj_scanpos = xsp;
    if (jj_3R_34()) {
    jj_scanpos = xsp;
    if (jj_3R_35()) {
    jj_scanpos = xsp;
    if (jj_3R_36()) {
    jj_scanpos = xsp;
    if (jj_3R_37()) {
    jj_scanpos = xsp;
    if (jj_3R_38()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3R_54() {
    if (jj_scan_token(33)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_45()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  private boolean jj_3R_58() {
    if (jj_scan_token(37)) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    if (jj_3R_11()) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
    return false;
  }

  public SelectorParserTokenManager token_source;
  SimpleCharStream jj_input_stream;
  public Token token, jj_nt;
  private int jj_ntk;
  private Token jj_scanpos, jj_lastpos;
  private int jj_la;
  public boolean lookingAhead = false;
  private boolean jj_semLA;

  public SelectorParser(java.io.InputStream stream) {
    jj_input_stream = new SimpleCharStream(stream, 1, 1);
    token_source = new SelectorParserTokenManager(jj_input_stream);
    token = new Token();
    jj_ntk = -1;
  }

  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;
  }

  public SelectorParser(java.io.Reader stream) {
    jj_input_stream = new SimpleCharStream(stream, 1, 1);
    token_source = new SelectorParserTokenManager(jj_input_stream);
    token = new Token();
    jj_ntk = -1;
  }

  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;
  }

  public SelectorParser(SelectorParserTokenManager tm) {
    token_source = tm;
    token = new Token();
    jj_ntk = -1;
  }

  public void ReInit(SelectorParserTokenManager tm) {
    token_source = tm;
    token = new Token();
    jj_ntk = -1;
  }

  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) {
      return token;
    }
    token = oldToken;
    throw generateParseException();
  }

  private boolean jj_scan_token(int kind) {
    if (jj_scanpos == jj_lastpos) {
      jj_la--;
      if (jj_scanpos.next == null) {
        jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
      } else {
        jj_lastpos = jj_scanpos = jj_scanpos.next;
      }
    } else {
      jj_scanpos = jj_scanpos.next;
    }
    return (jj_scanpos.kind != kind);
  }

  final public Token getNextToken() {
    if (token.next != null) token = token.next;
    else token = token.next = token_source.getNextToken();
    jj_ntk = -1;
    return token;
  }

  final public Token getToken(int index) {
    Token t = lookingAhead ? jj_scanpos : token;
    for (int i = 0; i < index; i++) {
      if (t.next != null) t = t.next;
      else t = t.next = token_source.getNextToken();
    }
    return t;
  }

  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);
  }

  final public ParseException generateParseException() {
    Token errortok = token.next;
    int line = errortok.beginLine, column = errortok.beginColumn;
    String mess = (errortok.kind == 0) ? tokenImage[0] : errortok.image;
    return new ParseException("Parse error at line " + line + ", column " + column + ".  Encountered: " + mess);
  }

  final public void enable_tracing() {
  }

  final public void disable_tracing() {
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy