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;
 }
 void TokenLexicalActions(Token matchedToken) {
   switch (jjmatchedKind) {
     case 16:
       if (image == null) image = new StringBuffer();
       image.append(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1)));
       matchedToken.image = image.substring(0, image.length() - 1);
       break;
     default:
       break;
   }
 }
Пример #3
0
  /** Returns the first query if splitOnWhitespace=true or otherwise the entire produced query */
  public final Query MultiTerm(String field, List<BooleanClause> clauses) throws ParseException {
    Token text, whitespace, followingText;
    Query firstQuery = null;
    text = jj_consume_token(TERM);
    if (splitOnWhitespace) {
      firstQuery = getFieldQuery(field, discardEscapeChar(text.image), false);
      addClause(clauses, CONJ_NONE, MOD_NONE, firstQuery);
    }
    if (getToken(1).kind == TERM && allowedPostMultiTerm(getToken(2).kind)) {

    } else {
      jj_consume_token(-1);
      throw new ParseException();
    }
    label_2:
    while (true) {
      followingText = jj_consume_token(TERM);
      if (splitOnWhitespace) {
        Query q = getFieldQuery(field, discardEscapeChar(followingText.image), false);
        addClause(clauses, CONJ_NONE, MOD_NONE, q);
      } else { // build up the text to send to analysis
        text.image += " " + followingText.image;
      }
      if (getToken(1).kind == TERM && allowedPostMultiTerm(getToken(2).kind)) {;
      } else {
        break label_2;
      }
    }
    if (splitOnWhitespace == false) {
      firstQuery = getFieldQuery(field, discardEscapeChar(text.image), false);
      addMultiTermClauses(clauses, firstQuery);
    }
    {
      if (true) return firstQuery;
    }
    throw new Error("Missing return statement in function");
  }
Пример #4
0
 public final Query Term(String field) throws ParseException {
   Token term, boost = null, fuzzySlop = null, goop1, goop2;
   boolean prefix = false;
   boolean wildcard = false;
   boolean fuzzy = false;
   boolean regexp = false;
   boolean startInc = false;
   boolean endInc = false;
   Query q;
   switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
     case BAREOPER:
     case STAR:
     case TERM:
     case PREFIXTERM:
     case WILDTERM:
     case REGEXPTERM:
     case NUMBER:
       switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
         case TERM:
           term = jj_consume_token(TERM);
           break;
         case STAR:
           term = jj_consume_token(STAR);
           wildcard = true;
           break;
         case PREFIXTERM:
           term = jj_consume_token(PREFIXTERM);
           prefix = true;
           break;
         case WILDTERM:
           term = jj_consume_token(WILDTERM);
           wildcard = true;
           break;
         case REGEXPTERM:
           term = jj_consume_token(REGEXPTERM);
           regexp = true;
           break;
         case NUMBER:
           term = jj_consume_token(NUMBER);
           break;
         case BAREOPER:
           term = jj_consume_token(BAREOPER);
           term.image = term.image.substring(0, 1);
           break;
         default:
           jj_la1[10] = jj_gen;
           jj_consume_token(-1);
           throw new ParseException();
       }
       switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
         case CARAT:
         case FUZZY_SLOP:
           switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
             case CARAT:
               jj_consume_token(CARAT);
               boost = jj_consume_token(NUMBER);
               switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
                 case FUZZY_SLOP:
                   fuzzySlop = jj_consume_token(FUZZY_SLOP);
                   fuzzy = true;
                   break;
                 default:
                   jj_la1[11] = jj_gen;
                   ;
               }
               break;
             case FUZZY_SLOP:
               fuzzySlop = jj_consume_token(FUZZY_SLOP);
               fuzzy = true;
               switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
                 case CARAT:
                   jj_consume_token(CARAT);
                   boost = jj_consume_token(NUMBER);
                   break;
                 default:
                   jj_la1[12] = jj_gen;
                   ;
               }
               break;
             default:
               jj_la1[13] = jj_gen;
               jj_consume_token(-1);
               throw new ParseException();
           }
           break;
         default:
           jj_la1[14] = jj_gen;
           ;
       }
       q = handleBareTokenQuery(field, term, fuzzySlop, prefix, wildcard, fuzzy, regexp);
       break;
     case RANGEIN_START:
     case RANGEEX_START:
       switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
         case RANGEIN_START:
           jj_consume_token(RANGEIN_START);
           startInc = true;
           break;
         case RANGEEX_START:
           jj_consume_token(RANGEEX_START);
           break;
         default:
           jj_la1[15] = jj_gen;
           jj_consume_token(-1);
           throw new ParseException();
       }
       switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
         case RANGE_GOOP:
           goop1 = jj_consume_token(RANGE_GOOP);
           break;
         case RANGE_QUOTED:
           goop1 = jj_consume_token(RANGE_QUOTED);
           break;
         default:
           jj_la1[16] = jj_gen;
           jj_consume_token(-1);
           throw new ParseException();
       }
       switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
         case RANGE_TO:
           jj_consume_token(RANGE_TO);
           break;
         default:
           jj_la1[17] = jj_gen;
           ;
       }
       switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
         case RANGE_GOOP:
           goop2 = jj_consume_token(RANGE_GOOP);
           break;
         case RANGE_QUOTED:
           goop2 = jj_consume_token(RANGE_QUOTED);
           break;
         default:
           jj_la1[18] = jj_gen;
           jj_consume_token(-1);
           throw new ParseException();
       }
       switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
         case RANGEIN_END:
           jj_consume_token(RANGEIN_END);
           endInc = true;
           break;
         case RANGEEX_END:
           jj_consume_token(RANGEEX_END);
           break;
         default:
           jj_la1[19] = jj_gen;
           jj_consume_token(-1);
           throw new ParseException();
       }
       switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
         case CARAT:
           jj_consume_token(CARAT);
           boost = jj_consume_token(NUMBER);
           break;
         default:
           jj_la1[20] = jj_gen;
           ;
       }
       boolean startOpen = false;
       boolean endOpen = false;
       if (goop1.kind == RANGE_QUOTED) {
         goop1.image = goop1.image.substring(1, goop1.image.length() - 1);
       } else if ("*".equals(goop1.image)) {
         startOpen = true;
       }
       if (goop2.kind == RANGE_QUOTED) {
         goop2.image = goop2.image.substring(1, goop2.image.length() - 1);
       } else if ("*".equals(goop2.image)) {
         endOpen = true;
       }
       q =
           getRangeQuery(
               field,
               startOpen ? null : discardEscapeChar(goop1.image),
               endOpen ? null : discardEscapeChar(goop2.image),
               startInc,
               endInc);
       break;
     case QUOTED:
       term = jj_consume_token(QUOTED);
       switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
         case CARAT:
         case FUZZY_SLOP:
           switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
             case CARAT:
               jj_consume_token(CARAT);
               boost = jj_consume_token(NUMBER);
               switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
                 case FUZZY_SLOP:
                   fuzzySlop = jj_consume_token(FUZZY_SLOP);
                   fuzzy = true;
                   break;
                 default:
                   jj_la1[21] = jj_gen;
                   ;
               }
               break;
             case FUZZY_SLOP:
               fuzzySlop = jj_consume_token(FUZZY_SLOP);
               fuzzy = true;
               switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
                 case CARAT:
                   jj_consume_token(CARAT);
                   boost = jj_consume_token(NUMBER);
                   break;
                 default:
                   jj_la1[22] = jj_gen;
                   ;
               }
               break;
             default:
               jj_la1[23] = jj_gen;
               jj_consume_token(-1);
               throw new ParseException();
           }
           break;
         default:
           jj_la1[24] = jj_gen;
           ;
       }
       q = handleQuotedTerm(field, term, fuzzySlop);
       break;
     default:
       jj_la1[25] = jj_gen;
       jj_consume_token(-1);
       throw new ParseException();
   }
   {
     if (true) return handleBoost(q, boost);
   }
   throw new Error("Missing return statement in function");
 }