Save This Page
Home » lucene-3.0.1-src » org.apache.lucene.queryParser.standard.parser » [javadoc | source]
    1   /* Generated By:JavaCC: Do not edit this line. StandardSyntaxParserTokenManager.java */
    2   package org.apache.lucene.queryParser.standard.parser;
    3   /**
    4    * Licensed to the Apache Software Foundation (ASF) under one or more
    5    * contributor license agreements.  See the NOTICE file distributed with
    6    * this work for additional information regarding copyright ownership.
    7    * The ASF licenses this file to You under the Apache License, Version 2.0
    8    * (the "License"); you may not use this file except in compliance with
    9    * the License.  You may obtain a copy of the License at
   10    *
   11    *     http://www.apache.org/licenses/LICENSE-2.0
   12    *
   13    * Unless required by applicable law or agreed to in writing, software
   14    * distributed under the License is distributed on an "AS IS" BASIS,
   15    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   16    * See the License for the specific language governing permissions and
   17    * limitations under the License.
   18    */
   19   
   20   
   21   /** Token Manager. */
   22   public class StandardSyntaxParserTokenManager implements StandardSyntaxParserConstants
   23   {
   24   
   25     /** Debug output. */
   26     public  java.io.PrintStream debugStream = System.out;
   27     /** Set debug output. */
   28     public  void setDebugStream(java.io.PrintStream ds) { debugStream = ds; }
   29   private final int jjStopStringLiteralDfa_3(int pos, long active0)
   30   {
   31      switch (pos)
   32      {
   33         default :
   34            return -1;
   35      }
   36   }
   37   private final int jjStartNfa_3(int pos, long active0)
   38   {
   39      return jjMoveNfa_3(jjStopStringLiteralDfa_3(pos, active0), pos + 1);
   40   }
   41   private int jjStopAtPos(int pos, int kind)
   42   {
   43      jjmatchedKind = kind;
   44      jjmatchedPos = pos;
   45      return pos + 1;
   46   }
   47   private int jjMoveStringLiteralDfa0_3()
   48   {
   49      switch(curChar)
   50      {
   51         case 40:
   52            return jjStopAtPos(0, 13);
   53         case 41:
   54            return jjStopAtPos(0, 14);
   55         case 43:
   56            return jjStopAtPos(0, 11);
   57         case 45:
   58            return jjStopAtPos(0, 12);
   59         case 58:
   60            return jjStopAtPos(0, 15);
   61         case 91:
   62            return jjStopAtPos(0, 20);
   63         case 94:
   64            return jjStopAtPos(0, 16);
   65         case 123:
   66            return jjStopAtPos(0, 21);
   67         default :
   68            return jjMoveNfa_3(0, 0);
   69      }
   70   }
   71   static final long[] jjbitVec0 = {
   72      0x1L, 0x0L, 0x0L, 0x0L
   73   };
   74   static final long[] jjbitVec1 = {
   75      0xfffffffffffffffeL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL
   76   };
   77   static final long[] jjbitVec3 = {
   78      0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL
   79   };
   80   static final long[] jjbitVec4 = {
   81      0xfffefffffffffffeL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL
   82   };
   83   private int jjMoveNfa_3(int startState, int curPos)
   84   {
   85      int startsAt = 0;
   86      jjnewStateCnt = 28;
   87      int i = 1;
   88      jjstateSet[0] = startState;
   89      int kind = 0x7fffffff;
   90      for (;;)
   91      {
   92         if (++jjround == 0x7fffffff)
   93            ReInitRounds();
   94         if (curChar < 64)
   95         {
   96            long l = 1L << curChar;
   97            do
   98            {
   99               switch(jjstateSet[--i])
  100               {
  101                  case 0:
  102                     if ((0xfbffd4f8ffffd9ffL & l) != 0L)
  103                     {
  104                        if (kind > 18)
  105                           kind = 18;
  106                        jjCheckNAddTwoStates(20, 21);
  107                     }
  108                     else if ((0x100002600L & l) != 0L)
  109                     {
  110                        if (kind > 7)
  111                           kind = 7;
  112                     }
  113                     else if (curChar == 34)
  114                        jjCheckNAddStates(0, 2);
  115                     else if (curChar == 33)
  116                     {
  117                        if (kind > 10)
  118                           kind = 10;
  119                     }
  120                     if (curChar == 38)
  121                        jjstateSet[jjnewStateCnt++] = 4;
  122                     break;
  123                  case 4:
  124                     if (curChar == 38 && kind > 8)
  125                        kind = 8;
  126                     break;
  127                  case 5:
  128                     if (curChar == 38)
  129                        jjstateSet[jjnewStateCnt++] = 4;
  130                     break;
  131                  case 13:
  132                     if (curChar == 33 && kind > 10)
  133                        kind = 10;
  134                     break;
  135                  case 14:
  136                     if (curChar == 34)
  137                        jjCheckNAddStates(0, 2);
  138                     break;
  139                  case 15:
  140                     if ((0xfffffffbffffffffL & l) != 0L)
  141                        jjCheckNAddStates(0, 2);
  142                     break;
  143                  case 17:
  144                     jjCheckNAddStates(0, 2);
  145                     break;
  146                  case 18:
  147                     if (curChar == 34 && kind > 17)
  148                        kind = 17;
  149                     break;
  150                  case 19:
  151                     if ((0xfbffd4f8ffffd9ffL & l) == 0L)
  152                        break;
  153                     if (kind > 18)
  154                        kind = 18;
  155                     jjCheckNAddTwoStates(20, 21);
  156                     break;
  157                  case 20:
  158                     if ((0xfbfffcf8ffffd9ffL & l) == 0L)
  159                        break;
  160                     if (kind > 18)
  161                        kind = 18;
  162                     jjCheckNAddTwoStates(20, 21);
  163                     break;
  164                  case 22:
  165                     if (kind > 18)
  166                        kind = 18;
  167                     jjCheckNAddTwoStates(20, 21);
  168                     break;
  169                  case 25:
  170                     if ((0x3ff000000000000L & l) == 0L)
  171                        break;
  172                     if (kind > 19)
  173                        kind = 19;
  174                     jjAddStates(3, 4);
  175                     break;
  176                  case 26:
  177                     if (curChar == 46)
  178                        jjCheckNAdd(27);
  179                     break;
  180                  case 27:
  181                     if ((0x3ff000000000000L & l) == 0L)
  182                        break;
  183                     if (kind > 19)
  184                        kind = 19;
  185                     jjCheckNAdd(27);
  186                     break;
  187                  default : break;
  188               }
  189            } while(i != startsAt);
  190         }
  191         else if (curChar < 128)
  192         {
  193            long l = 1L << (curChar & 077);
  194            do
  195            {
  196               switch(jjstateSet[--i])
  197               {
  198                  case 0:
  199                     if ((0x97ffffff87ffffffL & l) != 0L)
  200                     {
  201                        if (kind > 18)
  202                           kind = 18;
  203                        jjCheckNAddTwoStates(20, 21);
  204                     }
  205                     else if (curChar == 126)
  206                     {
  207                        if (kind > 19)
  208                           kind = 19;
  209                        jjstateSet[jjnewStateCnt++] = 25;
  210                     }
  211                     else if (curChar == 92)
  212                        jjCheckNAdd(22);
  213                     if (curChar == 78)
  214                        jjstateSet[jjnewStateCnt++] = 11;
  215                     else if (curChar == 124)
  216                        jjstateSet[jjnewStateCnt++] = 8;
  217                     else if (curChar == 79)
  218                        jjstateSet[jjnewStateCnt++] = 6;
  219                     else if (curChar == 65)
  220                        jjstateSet[jjnewStateCnt++] = 2;
  221                     break;
  222                  case 1:
  223                     if (curChar == 68 && kind > 8)
  224                        kind = 8;
  225                     break;
  226                  case 2:
  227                     if (curChar == 78)
  228                        jjstateSet[jjnewStateCnt++] = 1;
  229                     break;
  230                  case 3:
  231                     if (curChar == 65)
  232                        jjstateSet[jjnewStateCnt++] = 2;
  233                     break;
  234                  case 6:
  235                     if (curChar == 82 && kind > 9)
  236                        kind = 9;
  237                     break;
  238                  case 7:
  239                     if (curChar == 79)
  240                        jjstateSet[jjnewStateCnt++] = 6;
  241                     break;
  242                  case 8:
  243                     if (curChar == 124 && kind > 9)
  244                        kind = 9;
  245                     break;
  246                  case 9:
  247                     if (curChar == 124)
  248                        jjstateSet[jjnewStateCnt++] = 8;
  249                     break;
  250                  case 10:
  251                     if (curChar == 84 && kind > 10)
  252                        kind = 10;
  253                     break;
  254                  case 11:
  255                     if (curChar == 79)
  256                        jjstateSet[jjnewStateCnt++] = 10;
  257                     break;
  258                  case 12:
  259                     if (curChar == 78)
  260                        jjstateSet[jjnewStateCnt++] = 11;
  261                     break;
  262                  case 15:
  263                     if ((0xffffffffefffffffL & l) != 0L)
  264                        jjCheckNAddStates(0, 2);
  265                     break;
  266                  case 16:
  267                     if (curChar == 92)
  268                        jjstateSet[jjnewStateCnt++] = 17;
  269                     break;
  270                  case 17:
  271                     jjCheckNAddStates(0, 2);
  272                     break;
  273                  case 19:
  274                  case 20:
  275                     if ((0x97ffffff87ffffffL & l) == 0L)
  276                        break;
  277                     if (kind > 18)
  278                        kind = 18;
  279                     jjCheckNAddTwoStates(20, 21);
  280                     break;
  281                  case 21:
  282                     if (curChar == 92)
  283                        jjCheckNAddTwoStates(22, 22);
  284                     break;
  285                  case 22:
  286                     if (kind > 18)
  287                        kind = 18;
  288                     jjCheckNAddTwoStates(20, 21);
  289                     break;
  290                  case 23:
  291                     if (curChar == 92)
  292                        jjCheckNAdd(22);
  293                     break;
  294                  case 24:
  295                     if (curChar != 126)
  296                        break;
  297                     if (kind > 19)
  298                        kind = 19;
  299                     jjstateSet[jjnewStateCnt++] = 25;
  300                     break;
  301                  default : break;
  302               }
  303            } while(i != startsAt);
  304         }
  305         else
  306         {
  307            int hiByte = (int)(curChar >> 8);
  308            int i1 = hiByte >> 6;
  309            long l1 = 1L << (hiByte & 077);
  310            int i2 = (curChar & 0xff) >> 6;
  311            long l2 = 1L << (curChar & 077);
  312            do
  313            {
  314               switch(jjstateSet[--i])
  315               {
  316                  case 0:
  317                     if (jjCanMove_0(hiByte, i1, i2, l1, l2))
  318                     {
  319                        if (kind > 7)
  320                           kind = 7;
  321                     }
  322                     if (jjCanMove_2(hiByte, i1, i2, l1, l2))
  323                     {
  324                        if (kind > 18)
  325                           kind = 18;
  326                        jjCheckNAddTwoStates(20, 21);
  327                     }
  328                     break;
  329                  case 15:
  330                  case 17:
  331                     if (jjCanMove_1(hiByte, i1, i2, l1, l2))
  332                        jjCheckNAddStates(0, 2);
  333                     break;
  334                  case 19:
  335                  case 20:
  336                     if (!jjCanMove_2(hiByte, i1, i2, l1, l2))
  337                        break;
  338                     if (kind > 18)
  339                        kind = 18;
  340                     jjCheckNAddTwoStates(20, 21);
  341                     break;
  342                  case 22:
  343                     if (!jjCanMove_1(hiByte, i1, i2, l1, l2))
  344                        break;
  345                     if (kind > 18)
  346                        kind = 18;
  347                     jjCheckNAddTwoStates(20, 21);
  348                     break;
  349                  default : break;
  350               }
  351            } while(i != startsAt);
  352         }
  353         if (kind != 0x7fffffff)
  354         {
  355            jjmatchedKind = kind;
  356            jjmatchedPos = curPos;
  357            kind = 0x7fffffff;
  358         }
  359         ++curPos;
  360         if ((i = jjnewStateCnt) == (startsAt = 28 - (jjnewStateCnt = startsAt)))
  361            return curPos;
  362         try { curChar = input_stream.readChar(); }
  363         catch(java.io.IOException e) { return curPos; }
  364      }
  365   }
  366   private final int jjStopStringLiteralDfa_1(int pos, long active0)
  367   {
  368      switch (pos)
  369      {
  370         case 0:
  371            if ((active0 & 0x8000000L) != 0L)
  372            {
  373               jjmatchedKind = 30;
  374               return 6;
  375            }
  376            return -1;
  377         default :
  378            return -1;
  379      }
  380   }
  381   private final int jjStartNfa_1(int pos, long active0)
  382   {
  383      return jjMoveNfa_1(jjStopStringLiteralDfa_1(pos, active0), pos + 1);
  384   }
  385   private int jjMoveStringLiteralDfa0_1()
  386   {
  387      switch(curChar)
  388      {
  389         case 84:
  390            return jjMoveStringLiteralDfa1_1(0x8000000L);
  391         case 125:
  392            return jjStopAtPos(0, 28);
  393         default :
  394            return jjMoveNfa_1(0, 0);
  395      }
  396   }
  397   private int jjMoveStringLiteralDfa1_1(long active0)
  398   {
  399      try { curChar = input_stream.readChar(); }
  400      catch(java.io.IOException e) {
  401         jjStopStringLiteralDfa_1(0, active0);
  402         return 1;
  403      }
  404      switch(curChar)
  405      {
  406         case 79:
  407            if ((active0 & 0x8000000L) != 0L)
  408               return jjStartNfaWithStates_1(1, 27, 6);
  409            break;
  410         default :
  411            break;
  412      }
  413      return jjStartNfa_1(0, active0);
  414   }
  415   private int jjStartNfaWithStates_1(int pos, int kind, int state)
  416   {
  417      jjmatchedKind = kind;
  418      jjmatchedPos = pos;
  419      try { curChar = input_stream.readChar(); }
  420      catch(java.io.IOException e) { return pos + 1; }
  421      return jjMoveNfa_1(state, pos + 1);
  422   }
  423   private int jjMoveNfa_1(int startState, int curPos)
  424   {
  425      int startsAt = 0;
  426      jjnewStateCnt = 7;
  427      int i = 1;
  428      jjstateSet[0] = startState;
  429      int kind = 0x7fffffff;
  430      for (;;)
  431      {
  432         if (++jjround == 0x7fffffff)
  433            ReInitRounds();
  434         if (curChar < 64)
  435         {
  436            long l = 1L << curChar;
  437            do
  438            {
  439               switch(jjstateSet[--i])
  440               {
  441                  case 0:
  442                     if ((0xfffffffeffffffffL & l) != 0L)
  443                     {
  444                        if (kind > 30)
  445                           kind = 30;
  446                        jjCheckNAdd(6);
  447                     }
  448                     if ((0x100002600L & l) != 0L)
  449                     {
  450                        if (kind > 7)
  451                           kind = 7;
  452                     }
  453                     else if (curChar == 34)
  454                        jjCheckNAddTwoStates(2, 4);
  455                     break;
  456                  case 1:
  457                     if (curChar == 34)
  458                        jjCheckNAddTwoStates(2, 4);
  459                     break;
  460                  case 2:
  461                     if ((0xfffffffbffffffffL & l) != 0L)
  462                        jjCheckNAddStates(5, 7);
  463                     break;
  464                  case 3:
  465                     if (curChar == 34)
  466                        jjCheckNAddStates(5, 7);
  467                     break;
  468                  case 5:
  469                     if (curChar == 34 && kind > 29)
  470                        kind = 29;
  471                     break;
  472                  case 6:
  473                     if ((0xfffffffeffffffffL & l) == 0L)
  474                        break;
  475                     if (kind > 30)
  476                        kind = 30;
  477                     jjCheckNAdd(6);
  478                     break;
  479                  default : break;
  480               }
  481            } while(i != startsAt);
  482         }
  483         else if (curChar < 128)
  484         {
  485            long l = 1L << (curChar & 077);
  486            do
  487            {
  488               switch(jjstateSet[--i])
  489               {
  490                  case 0:
  491                  case 6:
  492                     if ((0xdfffffffffffffffL & l) == 0L)
  493                        break;
  494                     if (kind > 30)
  495                        kind = 30;
  496                     jjCheckNAdd(6);
  497                     break;
  498                  case 2:
  499                     jjAddStates(5, 7);
  500                     break;
  501                  case 4:
  502                     if (curChar == 92)
  503                        jjstateSet[jjnewStateCnt++] = 3;
  504                     break;
  505                  default : break;
  506               }
  507            } while(i != startsAt);
  508         }
  509         else
  510         {
  511            int hiByte = (int)(curChar >> 8);
  512            int i1 = hiByte >> 6;
  513            long l1 = 1L << (hiByte & 077);
  514            int i2 = (curChar & 0xff) >> 6;
  515            long l2 = 1L << (curChar & 077);
  516            do
  517            {
  518               switch(jjstateSet[--i])
  519               {
  520                  case 0:
  521                     if (jjCanMove_0(hiByte, i1, i2, l1, l2))
  522                     {
  523                        if (kind > 7)
  524                           kind = 7;
  525                     }
  526                     if (jjCanMove_1(hiByte, i1, i2, l1, l2))
  527                     {
  528                        if (kind > 30)
  529                           kind = 30;
  530                        jjCheckNAdd(6);
  531                     }
  532                     break;
  533                  case 2:
  534                     if (jjCanMove_1(hiByte, i1, i2, l1, l2))
  535                        jjAddStates(5, 7);
  536                     break;
  537                  case 6:
  538                     if (!jjCanMove_1(hiByte, i1, i2, l1, l2))
  539                        break;
  540                     if (kind > 30)
  541                        kind = 30;
  542                     jjCheckNAdd(6);
  543                     break;
  544                  default : break;
  545               }
  546            } while(i != startsAt);
  547         }
  548         if (kind != 0x7fffffff)
  549         {
  550            jjmatchedKind = kind;
  551            jjmatchedPos = curPos;
  552            kind = 0x7fffffff;
  553         }
  554         ++curPos;
  555         if ((i = jjnewStateCnt) == (startsAt = 7 - (jjnewStateCnt = startsAt)))
  556            return curPos;
  557         try { curChar = input_stream.readChar(); }
  558         catch(java.io.IOException e) { return curPos; }
  559      }
  560   }
  561   private int jjMoveStringLiteralDfa0_0()
  562   {
  563      return jjMoveNfa_0(0, 0);
  564   }
  565   private int jjMoveNfa_0(int startState, int curPos)
  566   {
  567      int startsAt = 0;
  568      jjnewStateCnt = 3;
  569      int i = 1;
  570      jjstateSet[0] = startState;
  571      int kind = 0x7fffffff;
  572      for (;;)
  573      {
  574         if (++jjround == 0x7fffffff)
  575            ReInitRounds();
  576         if (curChar < 64)
  577         {
  578            long l = 1L << curChar;
  579            do
  580            {
  581               switch(jjstateSet[--i])
  582               {
  583                  case 0:
  584                     if ((0x3ff000000000000L & l) == 0L)
  585                        break;
  586                     if (kind > 22)
  587                        kind = 22;
  588                     jjAddStates(8, 9);
  589                     break;
  590                  case 1:
  591                     if (curChar == 46)
  592                        jjCheckNAdd(2);
  593                     break;
  594                  case 2:
  595                     if ((0x3ff000000000000L & l) == 0L)
  596                        break;
  597                     if (kind > 22)
  598                        kind = 22;
  599                     jjCheckNAdd(2);
  600                     break;
  601                  default : break;
  602               }
  603            } while(i != startsAt);
  604         }
  605         else if (curChar < 128)
  606         {
  607            long l = 1L << (curChar & 077);
  608            do
  609            {
  610               switch(jjstateSet[--i])
  611               {
  612                  default : break;
  613               }
  614            } while(i != startsAt);
  615         }
  616         else
  617         {
  618            int hiByte = (int)(curChar >> 8);
  619            int i1 = hiByte >> 6;
  620            long l1 = 1L << (hiByte & 077);
  621            int i2 = (curChar & 0xff) >> 6;
  622            long l2 = 1L << (curChar & 077);
  623            do
  624            {
  625               switch(jjstateSet[--i])
  626               {
  627                  default : break;
  628               }
  629            } while(i != startsAt);
  630         }
  631         if (kind != 0x7fffffff)
  632         {
  633            jjmatchedKind = kind;
  634            jjmatchedPos = curPos;
  635            kind = 0x7fffffff;
  636         }
  637         ++curPos;
  638         if ((i = jjnewStateCnt) == (startsAt = 3 - (jjnewStateCnt = startsAt)))
  639            return curPos;
  640         try { curChar = input_stream.readChar(); }
  641         catch(java.io.IOException e) { return curPos; }
  642      }
  643   }
  644   private final int jjStopStringLiteralDfa_2(int pos, long active0)
  645   {
  646      switch (pos)
  647      {
  648         case 0:
  649            if ((active0 & 0x800000L) != 0L)
  650            {
  651               jjmatchedKind = 26;
  652               return 6;
  653            }
  654            return -1;
  655         default :
  656            return -1;
  657      }
  658   }
  659   private final int jjStartNfa_2(int pos, long active0)
  660   {
  661      return jjMoveNfa_2(jjStopStringLiteralDfa_2(pos, active0), pos + 1);
  662   }
  663   private int jjMoveStringLiteralDfa0_2()
  664   {
  665      switch(curChar)
  666      {
  667         case 84:
  668            return jjMoveStringLiteralDfa1_2(0x800000L);
  669         case 93:
  670            return jjStopAtPos(0, 24);
  671         default :
  672            return jjMoveNfa_2(0, 0);
  673      }
  674   }
  675   private int jjMoveStringLiteralDfa1_2(long active0)
  676   {
  677      try { curChar = input_stream.readChar(); }
  678      catch(java.io.IOException e) {
  679         jjStopStringLiteralDfa_2(0, active0);
  680         return 1;
  681      }
  682      switch(curChar)
  683      {
  684         case 79:
  685            if ((active0 & 0x800000L) != 0L)
  686               return jjStartNfaWithStates_2(1, 23, 6);
  687            break;
  688         default :
  689            break;
  690      }
  691      return jjStartNfa_2(0, active0);
  692   }
  693   private int jjStartNfaWithStates_2(int pos, int kind, int state)
  694   {
  695      jjmatchedKind = kind;
  696      jjmatchedPos = pos;
  697      try { curChar = input_stream.readChar(); }
  698      catch(java.io.IOException e) { return pos + 1; }
  699      return jjMoveNfa_2(state, pos + 1);
  700   }
  701   private int jjMoveNfa_2(int startState, int curPos)
  702   {
  703      int startsAt = 0;
  704      jjnewStateCnt = 7;
  705      int i = 1;
  706      jjstateSet[0] = startState;
  707      int kind = 0x7fffffff;
  708      for (;;)
  709      {
  710         if (++jjround == 0x7fffffff)
  711            ReInitRounds();
  712         if (curChar < 64)
  713         {
  714            long l = 1L << curChar;
  715            do
  716            {
  717               switch(jjstateSet[--i])
  718               {
  719                  case 0:
  720                     if ((0xfffffffeffffffffL & l) != 0L)
  721                     {
  722                        if (kind > 26)
  723                           kind = 26;
  724                        jjCheckNAdd(6);
  725                     }
  726                     if ((0x100002600L & l) != 0L)
  727                     {
  728                        if (kind > 7)
  729                           kind = 7;
  730                     }
  731                     else if (curChar == 34)
  732                        jjCheckNAddTwoStates(2, 4);
  733                     break;
  734                  case 1:
  735                     if (curChar == 34)
  736                        jjCheckNAddTwoStates(2, 4);
  737                     break;
  738                  case 2:
  739                     if ((0xfffffffbffffffffL & l) != 0L)
  740                        jjCheckNAddStates(5, 7);
  741                     break;
  742                  case 3:
  743                     if (curChar == 34)
  744                        jjCheckNAddStates(5, 7);
  745                     break;
  746                  case 5:
  747                     if (curChar == 34 && kind > 25)
  748                        kind = 25;
  749                     break;
  750                  case 6:
  751                     if ((0xfffffffeffffffffL & l) == 0L)
  752                        break;
  753                     if (kind > 26)
  754                        kind = 26;
  755                     jjCheckNAdd(6);
  756                     break;
  757                  default : break;
  758               }
  759            } while(i != startsAt);
  760         }
  761         else if (curChar < 128)
  762         {
  763            long l = 1L << (curChar & 077);
  764            do
  765            {
  766               switch(jjstateSet[--i])
  767               {
  768                  case 0:
  769                  case 6:
  770                     if ((0xffffffffdfffffffL & l) == 0L)
  771                        break;
  772                     if (kind > 26)
  773                        kind = 26;
  774                     jjCheckNAdd(6);
  775                     break;
  776                  case 2:
  777                     jjAddStates(5, 7);
  778                     break;
  779                  case 4:
  780                     if (curChar == 92)
  781                        jjstateSet[jjnewStateCnt++] = 3;
  782                     break;
  783                  default : break;
  784               }
  785            } while(i != startsAt);
  786         }
  787         else
  788         {
  789            int hiByte = (int)(curChar >> 8);
  790            int i1 = hiByte >> 6;
  791            long l1 = 1L << (hiByte & 077);
  792            int i2 = (curChar & 0xff) >> 6;
  793            long l2 = 1L << (curChar & 077);
  794            do
  795            {
  796               switch(jjstateSet[--i])
  797               {
  798                  case 0:
  799                     if (jjCanMove_0(hiByte, i1, i2, l1, l2))
  800                     {
  801                        if (kind > 7)
  802                           kind = 7;
  803                     }
  804                     if (jjCanMove_1(hiByte, i1, i2, l1, l2))
  805                     {
  806                        if (kind > 26)
  807                           kind = 26;
  808                        jjCheckNAdd(6);
  809                     }
  810                     break;
  811                  case 2:
  812                     if (jjCanMove_1(hiByte, i1, i2, l1, l2))
  813                        jjAddStates(5, 7);
  814                     break;
  815                  case 6:
  816                     if (!jjCanMove_1(hiByte, i1, i2, l1, l2))
  817                        break;
  818                     if (kind > 26)
  819                        kind = 26;
  820                     jjCheckNAdd(6);
  821                     break;
  822                  default : break;
  823               }
  824            } while(i != startsAt);
  825         }
  826         if (kind != 0x7fffffff)
  827         {
  828            jjmatchedKind = kind;
  829            jjmatchedPos = curPos;
  830            kind = 0x7fffffff;
  831         }
  832         ++curPos;
  833         if ((i = jjnewStateCnt) == (startsAt = 7 - (jjnewStateCnt = startsAt)))
  834            return curPos;
  835         try { curChar = input_stream.readChar(); }
  836         catch(java.io.IOException e) { return curPos; }
  837      }
  838   }
  839   static final int[] jjnextStates = {
  840      15, 16, 18, 25, 26, 2, 4, 5, 0, 1, 
  841   };
  842   private static final boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, long l2)
  843   {
  844      switch(hiByte)
  845      {
  846         case 48:
  847            return ((jjbitVec0[i2] & l2) != 0L);
  848         default :
  849            return false;
  850      }
  851   }
  852   private static final boolean jjCanMove_1(int hiByte, int i1, int i2, long l1, long l2)
  853   {
  854      switch(hiByte)
  855      {
  856         case 0:
  857            return ((jjbitVec3[i2] & l2) != 0L);
  858         default :
  859            if ((jjbitVec1[i1] & l1) != 0L)
  860               return true;
  861            return false;
  862      }
  863   }
  864   private static final boolean jjCanMove_2(int hiByte, int i1, int i2, long l1, long l2)
  865   {
  866      switch(hiByte)
  867      {
  868         case 0:
  869            return ((jjbitVec3[i2] & l2) != 0L);
  870         case 48:
  871            return ((jjbitVec1[i2] & l2) != 0L);
  872         default :
  873            if ((jjbitVec4[i1] & l1) != 0L)
  874               return true;
  875            return false;
  876      }
  877   }
  878   
  879   /** Token literal values. */
  880   public static final String[] jjstrLiteralImages = {
  881   "", null, null, null, null, null, null, null, null, null, null, "\53", "\55", 
  882   "\50", "\51", "\72", "\136", null, null, null, "\133", "\173", null, "\124\117", 
  883   "\135", null, null, "\124\117", "\175", null, null, };
  884   
  885   /** Lexer state names. */
  886   public static final String[] lexStateNames = {
  887      "Boost",
  888      "RangeEx",
  889      "RangeIn",
  890      "DEFAULT",
  891   };
  892   
  893   /** Lex State array. */
  894   public static final int[] jjnewLexState = {
  895      -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, 2, 1, 3, -1, 3, 
  896      -1, -1, -1, 3, -1, -1, 
  897   };
  898   static final long[] jjtoToken = {
  899      0x7fffff01L, 
  900   };
  901   static final long[] jjtoSkip = {
  902      0x80L, 
  903   };
  904   protected JavaCharStream input_stream;
  905   private final int[] jjrounds = new int[28];
  906   private final int[] jjstateSet = new int[56];
  907   protected char curChar;
  908   /** Constructor. */
  909   public StandardSyntaxParserTokenManager(JavaCharStream stream){
  910      if (JavaCharStream.staticFlag)
  911         throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer.");
  912      input_stream = stream;
  913   }
  914   
  915   /** Constructor. */
  916   public StandardSyntaxParserTokenManager(JavaCharStream stream, int lexState){
  917      this(stream);
  918      SwitchTo(lexState);
  919   }
  920   
  921   /** Reinitialise parser. */
  922   public void ReInit(JavaCharStream stream)
  923   {
  924      jjmatchedPos = jjnewStateCnt = 0;
  925      curLexState = defaultLexState;
  926      input_stream = stream;
  927      ReInitRounds();
  928   }
  929   private void ReInitRounds()
  930   {
  931      int i;
  932      jjround = 0x80000001;
  933      for (i = 28; i-- > 0;)
  934         jjrounds[i] = 0x80000000;
  935   }
  936   
  937   /** Reinitialise parser. */
  938   public void ReInit(JavaCharStream stream, int lexState)
  939   {
  940      ReInit(stream);
  941      SwitchTo(lexState);
  942   }
  943   
  944   /** Switch to specified lex state. */
  945   public void SwitchTo(int lexState)
  946   {
  947      if (lexState >= 4 || lexState < 0)
  948         throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE);
  949      else
  950         curLexState = lexState;
  951   }
  952   
  953   protected Token jjFillToken()
  954   {
  955      final Token t;
  956      final String curTokenImage;
  957      final int beginLine;
  958      final int endLine;
  959      final int beginColumn;
  960      final int endColumn;
  961      String im = jjstrLiteralImages[jjmatchedKind];
  962      curTokenImage = (im == null) ? input_stream.GetImage() : im;
  963      beginLine = input_stream.getBeginLine();
  964      beginColumn = input_stream.getBeginColumn();
  965      endLine = input_stream.getEndLine();
  966      endColumn = input_stream.getEndColumn();
  967      t = Token.newToken(jjmatchedKind, curTokenImage);
  968   
  969      t.beginLine = beginLine;
  970      t.endLine = endLine;
  971      t.beginColumn = beginColumn;
  972      t.endColumn = endColumn;
  973   
  974      return t;
  975   }
  976   
  977   int curLexState = 3;
  978   int defaultLexState = 3;
  979   int jjnewStateCnt;
  980   int jjround;
  981   int jjmatchedPos;
  982   int jjmatchedKind;
  983   
  984   /** Get the next Token. */
  985   public Token getNextToken() 
  986   {
  987     Token matchedToken;
  988     int curPos = 0;
  989   
  990     EOFLoop :
  991     for (;;)
  992     {
  993      try
  994      {
  995         curChar = input_stream.BeginToken();
  996      }
  997      catch(java.io.IOException e)
  998      {
  999         jjmatchedKind = 0;
 1000         matchedToken = jjFillToken();
 1001         return matchedToken;
 1002      }
 1003   
 1004      switch(curLexState)
 1005      {
 1006        case 0:
 1007          jjmatchedKind = 0x7fffffff;
 1008          jjmatchedPos = 0;
 1009          curPos = jjMoveStringLiteralDfa0_0();
 1010          break;
 1011        case 1:
 1012          jjmatchedKind = 0x7fffffff;
 1013          jjmatchedPos = 0;
 1014          curPos = jjMoveStringLiteralDfa0_1();
 1015          break;
 1016        case 2:
 1017          jjmatchedKind = 0x7fffffff;
 1018          jjmatchedPos = 0;
 1019          curPos = jjMoveStringLiteralDfa0_2();
 1020          break;
 1021        case 3:
 1022          jjmatchedKind = 0x7fffffff;
 1023          jjmatchedPos = 0;
 1024          curPos = jjMoveStringLiteralDfa0_3();
 1025          break;
 1026      }
 1027        if (jjmatchedKind != 0x7fffffff)
 1028        {
 1029           if (jjmatchedPos + 1 < curPos)
 1030              input_stream.backup(curPos - jjmatchedPos - 1);
 1031           if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
 1032           {
 1033              matchedToken = jjFillToken();
 1034          if (jjnewLexState[jjmatchedKind] != -1)
 1035            curLexState = jjnewLexState[jjmatchedKind];
 1036              return matchedToken;
 1037           }
 1038           else
 1039           {
 1040            if (jjnewLexState[jjmatchedKind] != -1)
 1041              curLexState = jjnewLexState[jjmatchedKind];
 1042              continue EOFLoop;
 1043           }
 1044        }
 1045        int error_line = input_stream.getEndLine();
 1046        int error_column = input_stream.getEndColumn();
 1047        String error_after = null;
 1048        boolean EOFSeen = false;
 1049        try { input_stream.readChar(); input_stream.backup(1); }
 1050        catch (java.io.IOException e1) {
 1051           EOFSeen = true;
 1052           error_after = curPos <= 1 ? "" : input_stream.GetImage();
 1053           if (curChar == '\n' || curChar == '\r') {
 1054              error_line++;
 1055              error_column = 0;
 1056           }
 1057           else
 1058              error_column++;
 1059        }
 1060        if (!EOFSeen) {
 1061           input_stream.backup(1);
 1062           error_after = curPos <= 1 ? "" : input_stream.GetImage();
 1063        }
 1064        throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR);
 1065     }
 1066   }
 1067   
 1068   private void jjCheckNAdd(int state)
 1069   {
 1070      if (jjrounds[state] != jjround)
 1071      {
 1072         jjstateSet[jjnewStateCnt++] = state;
 1073         jjrounds[state] = jjround;
 1074      }
 1075   }
 1076   private void jjAddStates(int start, int end)
 1077   {
 1078      do {
 1079         jjstateSet[jjnewStateCnt++] = jjnextStates[start];
 1080      } while (start++ != end);
 1081   }
 1082   private void jjCheckNAddTwoStates(int state1, int state2)
 1083   {
 1084      jjCheckNAdd(state1);
 1085      jjCheckNAdd(state2);
 1086   }
 1087   
 1088   private void jjCheckNAddStates(int start, int end)
 1089   {
 1090      do {
 1091         jjCheckNAdd(jjnextStates[start]);
 1092      } while (start++ != end);
 1093   }
 1094   
 1095   }

Save This Page
Home » lucene-3.0.1-src » org.apache.lucene.queryParser.standard.parser » [javadoc | source]