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/jexl/src/java/org/apache/commons/jexl/parser ASTUnaryMinusNode.java ASTMethod.java Parser.java Parser.jj ParserTreeConstants.java ParserVisitor.java
Date Wed, 25 Jun 2003 11:17:01 GMT
geirm       2003/06/25 04:17:01

  Modified:    jexl/src/java/org/apache/commons/jexl/parser ASTMethod.java
                        Parser.java Parser.jj ParserTreeConstants.java
                        ParserVisitor.java
  Added:       jexl/src/java/org/apache/commons/jexl/parser
                        ASTUnaryMinusNode.java
  Log:
  Adding ASTUnaryMinus from mark to solve the - problem, fix to ASTMethod
  to allow the real exception to be thrown, and the rest are autogen goo
  
  Revision  Changes    Path
  1.4       +32 -9     jakarta-commons/jexl/src/java/org/apache/commons/jexl/parser/ASTMethod.java
  
  Index: ASTMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jexl/src/java/org/apache/commons/jexl/parser/ASTMethod.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ASTMethod.java	22 Jun 2003 19:40:40 -0000	1.3
  +++ ASTMethod.java	25 Jun 2003 11:17:00 -0000	1.4
  @@ -1,5 +1,7 @@
   package org.apache.commons.jexl.parser;
   
  +import java.lang.reflect.InvocationTargetException;
  +
   import org.apache.commons.jexl.JexlContext;
   import org.apache.commons.jexl.util.Introspector;
   import org.apache.commons.jexl.util.introspection.VelMethod;
  @@ -28,7 +30,8 @@
        *  returns the value of itself applied to the object.
        *   We assume that an identifier can be gotten via a get(String)
        */
  -    public Object execute(Object obj, JexlContext jc) throws Exception
  +    public Object execute(Object obj, JexlContext jc) 
  +        throws Exception
       {
           String methodName = ((ASTIdentifier)jjtGetChild(0)).val;
   
  @@ -40,17 +43,37 @@
   
           Object params[] = new Object[paramCount];
   
  -        for (int i=0; i<paramCount; i++)
  +        try
           {
  -            params[i] = ( (SimpleNode) jjtGetChild(i+1)).value(jc);
  +            for (int i=0; i<paramCount; i++)
  +            {
  +                params[i] = ( (SimpleNode) jjtGetChild(i+1)).value(jc);
  +            }
  +    
  +            VelMethod vm = Introspector.getUberspect().getMethod(obj, methodName,
  +                params, new Info("",1,1));
  +    
  +            if (vm == null)
  +                return null;
  +    
  +            return vm.invoke(obj, params);
           }
  +        catch(InvocationTargetException e)
  +        {
  +            Throwable t = e.getTargetException();
   
  -        VelMethod vm = Introspector.getUberspect().getMethod(obj, methodName,
  -            params, new Info("",1,1));
  -
  -        if (vm == null)
  -            return null;
  +            if (t instanceof Exception)
  +            {
  +                throw (Exception) t;
  +            }
   
  -        return vm.invoke(obj, params);
  +            throw e;
  +        }
  +        catch(Exception e)
  +        {
  +            System.out.println("ASTMethod : "+ e);
  +            e.printStackTrace();;
  +            throw e;
  +         }
       }
   }
  
  
  
  1.5       +175 -132  jakarta-commons/jexl/src/java/org/apache/commons/jexl/parser/Parser.java
  
  Index: Parser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jexl/src/java/org/apache/commons/jexl/parser/Parser.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Parser.java	25 Jun 2003 10:52:02 -0000	1.4
  +++ Parser.java	25 Jun 2003 11:17:00 -0000	1.5
  @@ -37,6 +37,7 @@
           case 11:
           case 12:
           case 14:
  +        case 36:
           case 42:
           case 43:
           case 44:
  @@ -99,6 +100,7 @@
           case 11:
           case 12:
           case 14:
  +        case 36:
           case 42:
           case 43:
           case 44:
  @@ -249,6 +251,7 @@
           case 11:
           case 12:
           case 14:
  +        case 36:
           case 42:
           case 43:
           case 44:
  @@ -1202,9 +1205,9 @@
   
     final public void UnaryExpression() throws ParseException {
       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  -    case 42:
  -      jj_consume_token(42);
  -        ASTBitwiseComplNode jjtn001 = new ASTBitwiseComplNode(this, JJTBITWISECOMPLNODE);
  +    case 36:
  +      jj_consume_token(36);
  +        ASTUnaryMinusNode jjtn001 = new ASTUnaryMinusNode(this, JJTUNARYMINUSNODE);
           boolean jjtc001 = true;
           jjtree.openNodeScope(jjtn001);
         try {
  @@ -1229,9 +1232,9 @@
           }
         }
         break;
  -    case 43:
  -      jj_consume_token(43);
  -        ASTNotNode jjtn002 = new ASTNotNode(this, JJTNOTNODE);
  +    case 42:
  +      jj_consume_token(42);
  +        ASTBitwiseComplNode jjtn002 = new ASTBitwiseComplNode(this, JJTBITWISECOMPLNODE);
           boolean jjtc002 = true;
           jjtree.openNodeScope(jjtn002);
         try {
  @@ -1256,30 +1259,57 @@
           }
         }
         break;
  +    case 43:
  +      jj_consume_token(43);
  +        ASTNotNode jjtn003 = new ASTNotNode(this, JJTNOTNODE);
  +        boolean jjtc003 = true;
  +        jjtree.openNodeScope(jjtn003);
  +      try {
  +        UnaryExpression();
  +      } catch (Throwable jjte003) {
  +        if (jjtc003) {
  +          jjtree.clearNodeScope(jjtn003);
  +          jjtc003 = false;
  +        } else {
  +          jjtree.popNode();
  +        }
  +        if (jjte003 instanceof RuntimeException) {
  +          {if (true) throw (RuntimeException)jjte003;}
  +        }
  +        if (jjte003 instanceof ParseException) {
  +          {if (true) throw (ParseException)jjte003;}
  +        }
  +        {if (true) throw (Error)jjte003;}
  +      } finally {
  +        if (jjtc003) {
  +          jjtree.closeNodeScope(jjtn003,  1);
  +        }
  +      }
  +      break;
       case 44:
         jj_consume_token(44);
  -          ASTNotNode jjtn003 = new ASTNotNode(this, JJTNOTNODE);
  -          boolean jjtc003 = true;
  -          jjtree.openNodeScope(jjtn003);
  +          ASTNotNode jjtn004 = new ASTNotNode(this, JJTNOTNODE);
  +          boolean jjtc004 = true;
  +          jjtree.openNodeScope(jjtn004);
         try {
           UnaryExpression();
  -      } catch (Throwable jjte003) {
  -          if (jjtc003) {
  -            jjtree.clearNodeScope(jjtn003);
  -            jjtc003 = false;
  +      } catch (Throwable jjte004) {
  +          if (jjtc004) {
  +            jjtree.clearNodeScope(jjtn004);
  +            jjtc004 = false;
             } else {
               jjtree.popNode();
             }
  -          if (jjte003 instanceof RuntimeException) {
  -            {if (true) throw (RuntimeException)jjte003;}
  +          if (jjte004 instanceof RuntimeException) {
  +            {if (true) throw (RuntimeException)jjte004;}
             }
  -          if (jjte003 instanceof ParseException) {
  -            {if (true) throw (ParseException)jjte003;}
  +          if (jjte004 instanceof ParseException) {
  +            {if (true) throw (ParseException)jjte004;}
             }
  -          {if (true) throw (Error)jjte003;}
  +          {if (true) throw (Error)jjte004;}
         } finally {
  -          if (jjtc003) {
  -            jjtree.closeNodeScope(jjtn003,  1);
  +          if (jjtc004) {
  +            jjtree.closeNodeScope(jjtn004,  1);
             }
         }
         break;
  @@ -1481,6 +1511,7 @@
           case 11:
           case 12:
           case 14:
  +        case 36:
           case 42:
           case 43:
           case 44:
  @@ -1717,6 +1748,7 @@
         case 11:
         case 12:
         case 14:
  +      case 36:
         case 42:
         case 43:
         case 44:
  @@ -2077,14 +2109,14 @@
       return false;
     }
   
  -  final private boolean jj_3R_36() {
  -    if (jj_3R_47()) return true;
  +  final private boolean jj_3R_62() {
  +    if (jj_scan_token(FLOAT_LITERAL)) return true;
       if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
       return false;
     }
   
  -  final private boolean jj_3R_62() {
  -    if (jj_scan_token(FLOAT_LITERAL)) return true;
  +  final private boolean jj_3R_36() {
  +    if (jj_3R_47()) return true;
       if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
       return false;
     }
  @@ -2134,18 +2166,6 @@
       return false;
     }
   
  -  final private boolean jj_3R_45() {
  -    if (jj_scan_token(14)) return true;
  -    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  -    if (jj_scan_token(12)) return true;
  -    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  -    if (jj_3R_16()) return true;
  -    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  -    if (jj_scan_token(13)) return true;
  -    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  -    return false;
  -  }
  -
     final private boolean jj_3R_63() {
       Token xsp;
       xsp = jj_scanpos;
  @@ -2163,13 +2183,19 @@
       return false;
     }
   
  -  final private boolean jj_3R_27() {
  +  final private boolean jj_3R_45() {
  +    if (jj_scan_token(14)) return true;
  +    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  +    if (jj_scan_token(12)) return true;
  +    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
       if (jj_3R_16()) return true;
       if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  +    if (jj_scan_token(13)) return true;
  +    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
       return false;
     }
   
  -  final private boolean jj_3R_55() {
  +  final private boolean jj_3R_27() {
       if (jj_3R_16()) return true;
       if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
       return false;
  @@ -2181,6 +2207,18 @@
       return false;
     }
   
  +  final private boolean jj_3R_55() {
  +    if (jj_3R_16()) return true;
  +    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  +    return false;
  +  }
  +
  +  final private boolean jj_3R_41() {
  +    if (jj_3R_37()) return true;
  +    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  +    return false;
  +  }
  +
     final private boolean jj_3R_44() {
       if (jj_scan_token(11)) return true;
       if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  @@ -2194,12 +2232,6 @@
       return false;
     }
   
  -  final private boolean jj_3R_41() {
  -    if (jj_3R_37()) return true;
  -    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  -    return false;
  -  }
  -
     final private boolean jj_3R_21() {
       if (jj_3R_16()) return true;
       if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  @@ -2364,7 +2396,7 @@
       return false;
     }
   
  -  final private boolean jj_3R_108() {
  +  final private boolean jj_3R_109() {
       if (jj_3R_15()) return true;
       if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
       return false;
  @@ -2376,7 +2408,7 @@
       return false;
     }
   
  -  final private boolean jj_3R_107() {
  +  final private boolean jj_3R_108() {
       if (jj_scan_token(44)) return true;
       if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
       if (jj_3R_101()) return true;
  @@ -2384,7 +2416,7 @@
       return false;
     }
   
  -  final private boolean jj_3R_106() {
  +  final private boolean jj_3R_107() {
       if (jj_scan_token(43)) return true;
       if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
       if (jj_3R_101()) return true;
  @@ -2392,7 +2424,7 @@
       return false;
     }
   
  -  final private boolean jj_3R_105() {
  +  final private boolean jj_3R_106() {
       if (jj_scan_token(42)) return true;
       if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
       if (jj_3R_101()) return true;
  @@ -2400,6 +2432,14 @@
       return false;
     }
   
  +  final private boolean jj_3R_105() {
  +    if (jj_scan_token(36)) return true;
  +    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  +    if (jj_3R_101()) return true;
  +    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  +    return false;
  +  }
  +
     final private boolean jj_3R_101() {
       Token xsp;
       xsp = jj_scanpos;
  @@ -2409,19 +2449,14 @@
       jj_scanpos = xsp;
       if (jj_3R_107()) {
       jj_scanpos = xsp;
  -    if (jj_3R_108()) return true;
  +    if (jj_3R_108()) {
  +    jj_scanpos = xsp;
  +    if (jj_3R_109()) 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;
  -  }
  -
  -  final private boolean jj_3R_113() {
  -    if (jj_scan_token(41)) return true;
  -    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  -    if (jj_3R_101()) 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;
     }
   
  @@ -2433,8 +2468,8 @@
       return false;
     }
   
  -  final private boolean jj_3R_112() {
  -    if (jj_scan_token(40)) return true;
  +  final private boolean jj_3R_114() {
  +    if (jj_scan_token(41)) return true;
       if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
       if (jj_3R_101()) return true;
       if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  @@ -2461,8 +2496,8 @@
       return false;
     }
   
  -  final private boolean jj_3R_111() {
  -    if (jj_scan_token(39)) return true;
  +  final private boolean jj_3R_113() {
  +    if (jj_scan_token(40)) return true;
       if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
       if (jj_3R_101()) return true;
       if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  @@ -2489,8 +2524,8 @@
       return false;
     }
   
  -  final private boolean jj_3R_110() {
  -    if (jj_scan_token(38)) return true;
  +  final private boolean jj_3R_112() {
  +    if (jj_scan_token(39)) return true;
       if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
       if (jj_3R_101()) return true;
       if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  @@ -2503,34 +2538,14 @@
       return false;
     }
   
  -  final private boolean jj_3R_109() {
  -    if (jj_scan_token(37)) return true;
  +  final private boolean jj_3R_111() {
  +    if (jj_scan_token(38)) return true;
       if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
       if (jj_3R_101()) return true;
       if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
       return false;
     }
   
  -  final private boolean jj_3R_102() {
  -    Token xsp;
  -    xsp = jj_scanpos;
  -    if (jj_3R_109()) {
  -    jj_scanpos = xsp;
  -    if (jj_3R_110()) {
  -    jj_scanpos = xsp;
  -    if (jj_3R_111()) {
  -    jj_scanpos = xsp;
  -    if (jj_3R_112()) {
  -    jj_scanpos = xsp;
  -    if (jj_3R_113()) 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;
  -    return false;
  -  }
  -
     final private boolean jj_3_5() {
       if (jj_3R_18()) return true;
       if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  @@ -2557,6 +2572,34 @@
       return false;
     }
   
  +  final private boolean jj_3R_110() {
  +    if (jj_scan_token(37)) return true;
  +    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  +    if (jj_3R_101()) return true;
  +    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  +    return false;
  +  }
  +
  +  final private boolean jj_3R_102() {
  +    Token xsp;
  +    xsp = jj_scanpos;
  +    if (jj_3R_110()) {
  +    jj_scanpos = xsp;
  +    if (jj_3R_111()) {
  +    jj_scanpos = xsp;
  +    if (jj_3R_112()) {
  +    jj_scanpos = xsp;
  +    if (jj_3R_113()) {
  +    jj_scanpos = xsp;
  +    if (jj_3R_114()) 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;
  +    return false;
  +  }
  +
     final private boolean jj_3R_23() {
       Token xsp;
       xsp = jj_scanpos;
  @@ -2574,18 +2617,6 @@
       return false;
     }
   
  -  final private boolean jj_3R_91() {
  -    if (jj_3R_101()) return true;
  -    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  -    Token xsp;
  -    while (true) {
  -      xsp = jj_scanpos;
  -      if (jj_3R_102()) { jj_scanpos = xsp; break; }
  -      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  -    }
  -    return false;
  -  }
  -
     final private boolean jj_3R_22() {
       if (jj_3R_38()) return true;
       if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  @@ -2610,23 +2641,27 @@
       return false;
     }
   
  -  final private boolean jj_3R_42() {
  -    if (jj_3R_49()) return true;
  +  final private boolean jj_3R_91() {
  +    if (jj_3R_101()) return true;
       if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
       Token xsp;
       while (true) {
         xsp = jj_scanpos;
  -      if (jj_3R_78()) { jj_scanpos = xsp; break; }
  +      if (jj_3R_102()) { jj_scanpos = xsp; break; }
         if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
       }
       return false;
     }
   
  -  final private boolean jj_3R_104() {
  -    if (jj_scan_token(36)) return true;
  -    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  -    if (jj_3R_91()) return true;
  +  final private boolean jj_3R_42() {
  +    if (jj_3R_49()) return true;
       if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  +    Token xsp;
  +    while (true) {
  +      xsp = jj_scanpos;
  +      if (jj_3R_78()) { jj_scanpos = xsp; break; }
  +      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  +    }
       return false;
     }
   
  @@ -2659,25 +2694,14 @@
       return false;
     }
   
  -  final private boolean jj_3R_103() {
  -    if (jj_scan_token(35)) return true;
  +  final private boolean jj_3R_104() {
  +    if (jj_scan_token(36)) return true;
       if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
       if (jj_3R_91()) return true;
       if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
       return false;
     }
   
  -  final private boolean jj_3R_92() {
  -    Token xsp;
  -    xsp = jj_scanpos;
  -    if (jj_3R_103()) {
  -    jj_scanpos = xsp;
  -    if (jj_3R_104()) 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;
  -  }
  -
     final private boolean jj_3R_16() {
       Token xsp;
       xsp = jj_scanpos;
  @@ -2694,6 +2718,25 @@
       return false;
     }
   
  +  final private boolean jj_3R_103() {
  +    if (jj_scan_token(35)) return true;
  +    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  +    if (jj_3R_91()) return true;
  +    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  +    return false;
  +  }
  +
  +  final private boolean jj_3R_92() {
  +    Token xsp;
  +    xsp = jj_scanpos;
  +    if (jj_3R_103()) {
  +    jj_scanpos = xsp;
  +    if (jj_3R_104()) 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;
  +  }
  +
     final private boolean jj_3R_85() {
       if (jj_3R_91()) return true;
       if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  @@ -2736,14 +2779,6 @@
       return false;
     }
   
  -  final private boolean jj_3R_98() {
  -    if (jj_scan_token(32)) return true;
  -    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  -    if (jj_3R_85()) return true;
  -    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  -    return false;
  -  }
  -
     final private boolean jj_3R_24() {
       if (jj_3R_18()) return true;
       if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  @@ -2758,6 +2793,14 @@
       return false;
     }
   
  +  final private boolean jj_3R_98() {
  +    if (jj_scan_token(32)) return true;
  +    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  +    if (jj_3R_85()) return true;
  +    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  +    return false;
  +  }
  +
     final private boolean jj_3R_97() {
       if (jj_scan_token(31)) return true;
       if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  @@ -2928,18 +2971,18 @@
       return false;
     }
   
  -  final private boolean jj_3R_80() {
  -    if (jj_scan_token(21)) return true;
  +  final private boolean jj_3_2() {
  +    if (jj_3R_16()) return true;
       if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  -    if (jj_3R_79()) return true;
  +    if (jj_scan_token(48)) return true;
       if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
       return false;
     }
   
  -  final private boolean jj_3_2() {
  -    if (jj_3R_16()) return true;
  +  final private boolean jj_3R_80() {
  +    if (jj_scan_token(21)) return true;
       if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
  -    if (jj_scan_token(48)) return true;
  +    if (jj_3R_79()) return true;
       if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
       return false;
     }
  @@ -3026,7 +3069,7 @@
     private int jj_gen;
     final private int[] jj_la1 = new int[34];
     final private int[] jj_la1_0 = {0x5b80,0x5b80,0x1000,0x5980,0x30000,0x30000,0xc0000,0xc0000,0x100000,0x200000,0x400000,0x7800000,0x7800000,0xf8000000,0xf8000000,0x0,0x0,0x0,0x0,0x5980,0x5980,0x180,0x0,0x200,0x5980,0x0,0x0,0x5980,0x80,0x0,0x0,0x4080,0x4080,0x180,};
  -  final private int[] jj_la1_1 = {0x241bfc00,0x241bfc00,0x4000000,0x2400fc00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7,0x7,0x18,0x18,0x3e0,0x3e0,0x2400fc00,0x2400e000,0x2000e000,0xc000,0x10000,0x241afc00,0x40000,0x400000,0x2400fc00,0x4000000,0x800000,0x4000000,0x4000000,0x4000000,0x2400e000,};
  +  final private int[] jj_la1_1 = {0x241bfc10,0x241bfc10,0x4000000,0x2400fc10,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7,0x7,0x18,0x18,0x3e0,0x3e0,0x2400fc10,0x2400e000,0x2000e000,0xc000,0x10000,0x241afc10,0x40000,0x400000,0x2400fc10,0x4000000,0x800000,0x4000000,0x4000000,0x4000000,0x2400e000,};
     final private JJCalls[] jj_2_rtns = new JJCalls[9];
     private boolean jj_rescan = false;
     private int jj_gc = 0;
  
  
  
  1.7       +48 -19    jakarta-commons/jexl/src/java/org/apache/commons/jexl/parser/Parser.jj
  
  Index: Parser.jj
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jexl/src/java/org/apache/commons/jexl/parser/Parser.jj,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Parser.jj	25 Jun 2003 10:52:02 -0000	1.6
  +++ Parser.jj	25 Jun 2003 11:17:01 -0000	1.7
  @@ -1171,9 +1171,9 @@
   void UnaryExpression()       :
   {}
   {
  -  "~"/*@bgen(jjtree) #BitwiseComplNode( 1) */
  +  "-"/*@bgen(jjtree) #UnaryMinusNode( 1) */
         {
  -        ASTBitwiseComplNode jjtn001 = new ASTBitwiseComplNode(this, JJTBITWISECOMPLNODE);
  +        ASTUnaryMinusNode jjtn001 = new ASTUnaryMinusNode(this, JJTUNARYMINUSNODE);
           boolean jjtc001 = true;
           jjtree.openNodeScope(jjtn001);
         }
  @@ -1200,9 +1200,9 @@
         }
   /*@egen*/
   |
  -  "!"/*@bgen(jjtree) #NotNode( 1) */
  +  "~"/*@bgen(jjtree) #BitwiseComplNode( 1) */
         {
  -        ASTNotNode jjtn002 = new ASTNotNode(this, JJTNOTNODE);
  +        ASTBitwiseComplNode jjtn002 = new ASTBitwiseComplNode(this, JJTBITWISECOMPLNODE);
           boolean jjtc002 = true;
           jjtree.openNodeScope(jjtn002);
         }
  @@ -1229,31 +1229,60 @@
         }
   /*@egen*/
   |
  +  "!"/*@bgen(jjtree) #NotNode( 1) */
  +      {
  +        ASTNotNode jjtn003 = new ASTNotNode(this, JJTNOTNODE);
  +        boolean jjtc003 = true;
  +        jjtree.openNodeScope(jjtn003);
  +      }
  +      try {
  +/*@egen*/ UnaryExpression()/*@bgen(jjtree)*/
  +      } catch (Throwable jjte003) {
  +        if (jjtc003) {
  +          jjtree.clearNodeScope(jjtn003);
  +          jjtc003 = false;
  +        } else {
  +          jjtree.popNode();
  +        }
  +        if (jjte003 instanceof RuntimeException) {
  +          throw (RuntimeException)jjte003;
  +        }
  +        if (jjte003 instanceof ParseException) {
  +          throw (ParseException)jjte003;
  +        }
  +        throw (Error)jjte003;
  +      } finally {
  +        if (jjtc003) {
  +          jjtree.closeNodeScope(jjtn003,  1);
  +        }
  +      }
  +/*@egen*/
  +|
     "not"/*@bgen(jjtree) #NotNode( 1) */
           {
  -          ASTNotNode jjtn003 = new ASTNotNode(this, JJTNOTNODE);
  -          boolean jjtc003 = true;
  -          jjtree.openNodeScope(jjtn003);
  +          ASTNotNode jjtn004 = new ASTNotNode(this, JJTNOTNODE);
  +          boolean jjtc004 = true;
  +          jjtree.openNodeScope(jjtn004);
           }
           try {
   /*@egen*/ UnaryExpression()/*@bgen(jjtree)*/
  -        } catch (Throwable jjte003) {
  -          if (jjtc003) {
  -            jjtree.clearNodeScope(jjtn003);
  -            jjtc003 = false;
  +        } catch (Throwable jjte004) {
  +          if (jjtc004) {
  +            jjtree.clearNodeScope(jjtn004);
  +            jjtc004 = false;
             } else {
               jjtree.popNode();
             }
  -          if (jjte003 instanceof RuntimeException) {
  -            throw (RuntimeException)jjte003;
  +          if (jjte004 instanceof RuntimeException) {
  +            throw (RuntimeException)jjte004;
             }
  -          if (jjte003 instanceof ParseException) {
  -            throw (ParseException)jjte003;
  +          if (jjte004 instanceof ParseException) {
  +            throw (ParseException)jjte004;
             }
  -          throw (Error)jjte003;
  +          throw (Error)jjte004;
           } finally {
  -          if (jjtc003) {
  -            jjtree.closeNodeScope(jjtn003,  1);
  +          if (jjtc004) {
  +            jjtree.closeNodeScope(jjtn004,  1);
             }
           }
   /*@egen*/
  
  
  
  1.3       +20 -18    jakarta-commons/jexl/src/java/org/apache/commons/jexl/parser/ParserTreeConstants.java
  
  Index: ParserTreeConstants.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jexl/src/java/org/apache/commons/jexl/parser/ParserTreeConstants.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ParserTreeConstants.java	25 Jun 2003 10:52:02 -0000	1.2
  +++ ParserTreeConstants.java	25 Jun 2003 11:17:01 -0000	1.3
  @@ -28,24 +28,25 @@
     public int JJTMULNODE = 21;
     public int JJTDIVNODE = 22;
     public int JJTMODNODE = 23;
  -  public int JJTBITWISECOMPLNODE = 24;
  -  public int JJTNOTNODE = 25;
  -  public int JJTNULLLITERAL = 26;
  -  public int JJTTRUENODE = 27;
  -  public int JJTFALSENODE = 28;
  -  public int JJTINTEGERLITERAL = 29;
  -  public int JJTFLOATLITERAL = 30;
  -  public int JJTSTRINGLITERAL = 31;
  -  public int JJTEXPRESSIONEXPRESSION = 32;
  -  public int JJTSTATEMENTEXPRESSION = 33;
  -  public int JJTREFERENCEEXPRESSION = 34;
  -  public int JJTIFSTATEMENT = 35;
  -  public int JJTWHILESTATEMENT = 36;
  -  public int JJTFOREACHSTATEMENT = 37;
  -  public int JJTMETHOD = 38;
  -  public int JJTARRAYACCESS = 39;
  -  public int JJTSIZEMETHOD = 40;
  -  public int JJTREFERENCE = 41;
  +  public int JJTUNARYMINUSNODE = 24;
  +  public int JJTBITWISECOMPLNODE = 25;
  +  public int JJTNOTNODE = 26;
  +  public int JJTNULLLITERAL = 27;
  +  public int JJTTRUENODE = 28;
  +  public int JJTFALSENODE = 29;
  +  public int JJTINTEGERLITERAL = 30;
  +  public int JJTFLOATLITERAL = 31;
  +  public int JJTSTRINGLITERAL = 32;
  +  public int JJTEXPRESSIONEXPRESSION = 33;
  +  public int JJTSTATEMENTEXPRESSION = 34;
  +  public int JJTREFERENCEEXPRESSION = 35;
  +  public int JJTIFSTATEMENT = 36;
  +  public int JJTWHILESTATEMENT = 37;
  +  public int JJTFOREACHSTATEMENT = 38;
  +  public int JJTMETHOD = 39;
  +  public int JJTARRAYACCESS = 40;
  +  public int JJTSIZEMETHOD = 41;
  +  public int JJTREFERENCE = 42;
   
   
     public String[] jjtNodeName = {
  @@ -73,6 +74,7 @@
       "MulNode",
       "DivNode",
       "ModNode",
  +    "UnaryMinusNode",
       "BitwiseComplNode",
       "NotNode",
       "NullLiteral",
  
  
  
  1.3       +1 -0      jakarta-commons/jexl/src/java/org/apache/commons/jexl/parser/ParserVisitor.java
  
  Index: ParserVisitor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jexl/src/java/org/apache/commons/jexl/parser/ParserVisitor.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ParserVisitor.java	25 Jun 2003 10:52:02 -0000	1.2
  +++ ParserVisitor.java	25 Jun 2003 11:17:01 -0000	1.3
  @@ -28,6 +28,7 @@
     public Object visit(ASTMulNode node, Object data);
     public Object visit(ASTDivNode node, Object data);
     public Object visit(ASTModNode node, Object data);
  +  public Object visit(ASTUnaryMinusNode node, Object data);
     public Object visit(ASTBitwiseComplNode node, Object data);
     public Object visit(ASTNotNode node, Object data);
     public Object visit(ASTNullLiteral node, Object data);
  
  
  
  1.1                  jakarta-commons/jexl/src/java/org/apache/commons/jexl/parser/ASTUnaryMinusNode.java
  
  Index: ASTUnaryMinusNode.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", "Jexl" and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.commons.jexl.parser;
  
  import org.apache.commons.jexl.JexlContext;
  
  
  /**
   *  -
   *
   *  @author <a href="mailto:mhw@kremvax.net">Mark H. Wilkinson</a>
   *  @version $Id: ASTUnaryMinusNode.java,v 1.1 2003/06/25 11:17:00 geirm Exp $
   */
  public class ASTUnaryMinusNode extends SimpleNode 
  {
      public ASTUnaryMinusNode(int id)
      {
          super(id);
      }
  
      public ASTUnaryMinusNode(Parser p, int id)
      {
          super(p, id);
      }
  
      /** Accept the visitor. **/
      public Object jjtAccept(ParserVisitor visitor, Object data)
      {
          return visitor.visit(this, data);
      }
  
      public Object value(JexlContext jc)
          throws Exception
      {
          Object val = ((SimpleNode) jjtGetChild(0)).value(jc);
  
          if (val instanceof Integer)
          {
              return new Integer(- ( ((Integer) val).intValue() ) );
          }
          else
          {
              throw new Exception("expression not integer valued");
          }
      }
  }
  
  
  
  

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


Mime
View raw message