commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ge...@apache.org
Subject cvs commit: jakarta-commons-sandbox/jexl/src/java/org/apache/commons/jexl/parser Parser.jj Parser.jjt ParserTokenManager.java
Date Fri, 07 Jun 2002 03:02:56 GMT
geirm       2002/06/06 20:02:56

  Modified:    jexl/src/java/org/apache/commons/jexl/parser Parser.jj
                        Parser.jjt ParserTokenManager.java
  Log:
  support 'foo' for string literals as well as "foo"
  
  Revision  Changes    Path
  1.3       +8 -2      jakarta-commons-sandbox/jexl/src/java/org/apache/commons/jexl/parser/Parser.jj
  
  Index: Parser.jj
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jexl/src/java/org/apache/commons/jexl/parser/Parser.jj,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Parser.jj	25 May 2002 18:40:11 -0000	1.2
  +++ Parser.jj	7 Jun 2002 03:02:55 -0000	1.3
  @@ -57,7 +57,7 @@
    *  Jexl : Java Expression Language
    *
    *  @author <a href="mailto:geirm@apache.org">Geir Magnusson Jr.</a>
  - *  @version $Id: Parser.jj,v 1.2 2002/05/25 18:40:11 geirm Exp $
  + *  @version $Id: Parser.jj,v 1.3 2002/06/07 03:02:55 geirm Exp $
    */
   
   options
  @@ -1756,5 +1756,11 @@
   
   TOKEN :
   {
  -    <STRING_LITERAL: ( "\"" ( ~["\"","\n","\r"] )* "\"" ) >
  +//    <STRING_LITERAL: ( "\"" ( ~["\"","\n","\r"] )* "\"" ) >
  +
  +    <STRING_LITERAL :
  +        ("\"" ( ~["\"","\n","\r"] )* "\"" )
  +     |
  +        ("\'" ( ~["\'","\n","\r"] )* "\'" )
  +    >
   }
  
  
  
  1.3       +8 -2      jakarta-commons-sandbox/jexl/src/java/org/apache/commons/jexl/parser/Parser.jjt
  
  Index: Parser.jjt
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jexl/src/java/org/apache/commons/jexl/parser/Parser.jjt,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Parser.jjt	25 May 2002 18:38:44 -0000	1.2
  +++ Parser.jjt	7 Jun 2002 03:02:55 -0000	1.3
  @@ -56,7 +56,7 @@
    *  Jexl : Java Expression Language
    *
    *  @author <a href="mailto:geirm@apache.org">Geir Magnusson Jr.</a>
  - *  @version $Id: Parser.jjt,v 1.2 2002/05/25 18:38:44 geirm Exp $
  + *  @version $Id: Parser.jjt,v 1.3 2002/06/07 03:02:55 geirm Exp $
    */
   
   options
  @@ -471,5 +471,11 @@
   
   TOKEN :
   {
  -    <STRING_LITERAL: ( "\"" ( ~["\"","\n","\r"] )* "\"" ) >
  +//    <STRING_LITERAL: ( "\"" ( ~["\"","\n","\r"] )* "\"" ) >
  +
  +    <STRING_LITERAL :
  +        ("\"" ( ~["\"","\n","\r"] )* "\"" )
  +     |
  +        ("\'" ( ~["\'","\n","\r"] )* "\'" )
  +    >
   }
  
  
  
  1.3       +35 -14    jakarta-commons-sandbox/jexl/src/java/org/apache/commons/jexl/parser/ParserTokenManager.java
  
  Index: ParserTokenManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jexl/src/java/org/apache/commons/jexl/parser/ParserTokenManager.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ParserTokenManager.java	25 May 2002 18:40:11 -0000	1.2
  +++ ParserTokenManager.java	7 Jun 2002 03:02:55 -0000	1.3
  @@ -427,7 +427,7 @@
   {
      int[] nextStates;
      int startsAt = 0;
  -   jjnewStateCnt = 14;
  +   jjnewStateCnt = 17;
      int i = 1;
      jjstateSet[0] = startState;
      int j, kind = 0x7fffffff;
  @@ -449,6 +449,8 @@
                           kind = 7;
                        jjCheckNAddStates(0, 2);
                     }
  +                  else if (curChar == 39)
  +                     jjCheckNAddTwoStates(10, 11);
                     else if (curChar == 34)
                        jjCheckNAddTwoStates(7, 8);
                     else if (curChar == 36)
  @@ -499,33 +501,45 @@
                        kind = 61;
                     break;
                  case 9:
  +                  if (curChar == 39)
  +                     jjCheckNAddTwoStates(10, 11);
  +                  break;
  +               case 10:
  +                  if ((0xffffff7fffffdbffL & l) != 0L)
  +                     jjCheckNAddTwoStates(10, 11);
  +                  break;
  +               case 11:
  +                  if (curChar == 39 && kind > 61)
  +                     kind = 61;
  +                  break;
  +               case 12:
                     if ((0x3ff000000000000L & l) == 0L)
                        break;
                     if (kind > 7)
                        kind = 7;
                     jjCheckNAddStates(0, 2);
                     break;
  -               case 10:
  +               case 13:
                     if ((0x3ff000000000000L & l) == 0L)
                        break;
                     if (kind > 7)
                        kind = 7;
  -                  jjCheckNAdd(10);
  +                  jjCheckNAdd(13);
                     break;
  -               case 11:
  +               case 14:
                     if ((0x3ff000000000000L & l) != 0L)
  -                     jjCheckNAddTwoStates(11, 12);
  +                     jjCheckNAddTwoStates(14, 15);
                     break;
  -               case 12:
  +               case 15:
                     if (curChar == 46)
  -                     jjCheckNAdd(13);
  +                     jjCheckNAdd(16);
                     break;
  -               case 13:
  +               case 16:
                     if ((0x3ff000000000000L & l) == 0L)
                        break;
                     if (kind > 8)
                        kind = 8;
  -                  jjCheckNAdd(13);
  +                  jjCheckNAdd(16);
                     break;
                  default : break;
               }
  @@ -552,6 +566,9 @@
                  case 7:
                     jjAddStates(5, 6);
                     break;
  +               case 10:
  +                  jjAddStates(7, 8);
  +                  break;
                  default : break;
               }
            } while(i != startsAt);
  @@ -572,6 +589,10 @@
                     if ((jjbitVec0[i2] & l2) != 0L)
                        jjAddStates(5, 6);
                     break;
  +               case 10:
  +                  if ((jjbitVec0[i2] & l2) != 0L)
  +                     jjAddStates(7, 8);
  +                  break;
                  default : break;
               }
            } while(i != startsAt);
  @@ -583,14 +604,14 @@
            kind = 0x7fffffff;
         }
         ++curPos;
  -      if ((i = jjnewStateCnt) == (startsAt = 14 - (jjnewStateCnt = startsAt)))
  +      if ((i = jjnewStateCnt) == (startsAt = 17 - (jjnewStateCnt = startsAt)))
            return curPos;
         try { curChar = input_stream.readChar(); }
         catch(java.io.IOException e) { return curPos; }
      }
   }
   static final int[] jjnextStates = {
  -   10, 11, 12, 1, 2, 7, 8, 
  +   13, 14, 15, 1, 2, 7, 8, 10, 11, 
   };
   public static final String[] jjstrLiteralImages = {
   "", null, null, null, null, null, null, null, null, "\173", "\175", 
  @@ -611,8 +632,8 @@
      0x7eL, 
   };
   private SimpleCharStream input_stream;
  -private final int[] jjrounds = new int[14];
  -private final int[] jjstateSet = new int[28];
  +private final int[] jjrounds = new int[17];
  +private final int[] jjstateSet = new int[34];
   protected char curChar;
   public ParserTokenManager(SimpleCharStream stream)
   {
  @@ -636,7 +657,7 @@
   {
      int i;
      jjround = 0x80000001;
  -   for (i = 14; i-- > 0;)
  +   for (i = 17; i-- > 0;)
         jjrounds[i] = 0x80000000;
   }
   public void ReInit(SimpleCharStream stream, int lexState)
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message