harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From le...@apache.org
Subject svn commit: r591934 [1/2] - in /harmony/enhanced/classlib/trunk/modules/jndi/src: main/java/org/apache/harmony/jndi/provider/ldap/parser/ test/java/org/apache/harmony/jndi/provider/ldap/parser/ test/resources/parser/
Date Mon, 05 Nov 2007 09:36:37 GMT
Author: leoli
Date: Mon Nov  5 01:36:36 2007
New Revision: 591934

URL: http://svn.apache.org/viewvc?rev=591934&view=rev
Log:
Apply patch for HARMONY-4974 ([classlib][ldap] Add search query string parser for ldap service provider).

Added:
    harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/ldap/parser/
    harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/ldap/parser/FilterParser.java   (with props)
    harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/ldap/parser/FilterParserConstants.java   (with props)
    harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/ldap/parser/FilterParserTokenManager.java   (with props)
    harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/ldap/parser/LdapUrlParser.java   (with props)
    harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/ldap/parser/LdapUrlParserConstants.java   (with props)
    harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/ldap/parser/LdapUrlParserTokenManager.java   (with props)
    harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/ldap/parser/ParseException.java   (with props)
    harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/ldap/parser/README   (with props)
    harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/ldap/parser/SimpleCharStream.java   (with props)
    harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/ldap/parser/Token.java   (with props)
    harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/ldap/parser/TokenMgrError.java   (with props)
    harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/ldap/parser/filter.g   (with props)
    harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/ldap/parser/url.g   (with props)
    harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/provider/ldap/parser/
    harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/provider/ldap/parser/FilterParserTest.java   (with props)
    harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/provider/ldap/parser/LdapUrlParserTest.java   (with props)
    harmony/enhanced/classlib/trunk/modules/jndi/src/test/resources/parser/
    harmony/enhanced/classlib/trunk/modules/jndi/src/test/resources/parser/parser.filter.test
    harmony/enhanced/classlib/trunk/modules/jndi/src/test/resources/parser/parser.url.test

Added: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/ldap/parser/FilterParser.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/ldap/parser/FilterParser.java?rev=591934&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/ldap/parser/FilterParser.java (added)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/ldap/parser/FilterParser.java Mon Nov  5 01:36:36 2007
@@ -0,0 +1,1377 @@
+/* 
+ *  Licensed to the Apache Software Foundation (ASF) under one or more 
+ *  contributor license agreements.  See the NOTICE file distributed with 
+ *  this work for additional information regarding copyright ownership. 
+ *  The ASF licenses this file to You under the Apache License, Version 2.0 
+ *  (the "License"); you may not use this file except in compliance with 
+ *  the License.  You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0 
+ * 
+ *  Unless required by applicable law or agreed to in writing, software 
+ *  distributed under the License is distributed on an "AS IS" BASIS, 
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ *  See the License for the specific language governing permissions and 
+ *  limitations under the License. 
+ */
+/* Generated By:JavaCC: Do not edit this line. FilterParser.java */
+
+package org.apache.harmony.jndi.provider.ldap.parser;
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.util.ArrayList;
+import java.util.List;
+import java.io.StringReader;
+import org.apache.harmony.jndi.provider.ldap.Filter;
+import org.apache.harmony.jndi.internal.parser.AttributeTypeAndValuePair;
+import org.apache.harmony.jndi.provider.ldap.Filter.MatchingRuleAssertion;
+import org.apache.harmony.jndi.provider.ldap.Filter.SubstringFilter;
+import org.apache.harmony.jndi.provider.ldap.asn1.Utils;
+
+
+/**
+ * Ldap filter parser which parse the string representation of Ldap filters to
+ * instance of org.apache.harmony.jndi.provider.ldap.filter.Filter according
+ * RFC2254. And It also support parse variables of the form {i}.
+ * 
+ * @see org.apache.harmony.jndi.provider.ldap.filter.Filter
+ * @see javax.naming.directory.DirContext#search(javax.naming.Name, String,
+ *      Object[], javax.naming.directory.SearchControls)
+ */
+public class FilterParser implements FilterParserConstants {
+
+  public static void main(String args[]) throws ParseException, FileNotFoundException {
+    FilterParser parser = new FilterParser(new FileInputStream("parser.filter.test"));
+   //  FilterParser parser = new FilterParser(System.in);
+    //System.out.println(parser.value());
+      parser.test();
+  }
+
+    private Object[] args;
+
+    private boolean isEndEOF = false;
+
+    public FilterParser(String filter) {
+        this(new StringReader(filter));
+        isEndEOF = true;
+    }
+
+    public Object[] getArgs() {
+        return args;
+    }
+
+    public void setArgs(Object[] args) {
+        this.args = args;
+    }
+
+    private String getArgAttrValue(String index) {
+        int i = Integer.valueOf(index).intValue();
+        if (args == null || args.length <= i || args[i] == null) {
+            throw new IllegalArgumentException();
+        }
+
+        return (String) args[i];
+    }
+
+    private String getArgValue(String index) {
+        int i = Integer.valueOf(index).intValue();
+        if (args == null || args.length <= i || args[i] == null) {
+            throw new IllegalArgumentException();
+        }
+        if (args[i] instanceof String) {
+            return (String) args[i];
+        }
+
+        //FIXME:
+        throw new RuntimeException("Convert value to corresponding java type.");
+    }
+
+    private String convertToUtf8Char(String s) {
+        byte[] bs = new byte[] { (byte)Integer.parseInt(s, 16) };
+        return Utils.getString(bs);
+    }
+
+    private Filter parseSubstring(String des, List list) {
+        Filter filter = null;
+        if (list.size() == 1) {
+            if (list.get(0).equals("*")) {
+                filter = new Filter(Filter.PRESENT_FILTER);
+                filter.setValue(des);
+            } else {
+                filter = new Filter(Filter.EQUALITY_MATCH_FILTER);
+                filter
+                        .setValue(new AttributeTypeAndValuePair(des, list
+                                .get(0)));
+            }
+        } else {
+            String initial = null;
+            String any = "";
+            String end = null;
+            if (list.get(0).equals("*")) {
+                any = "*";
+            } else {
+                initial = (String) list.get(0);
+            }
+
+            for (int i = 1; i < list.size(); ++i) {
+                String value = (String) list.get(i);
+                if (i == list.size() - 1 && !value.equals("*")) {
+                    end = value;
+                } else {
+                    any += value;
+                }
+            }
+            filter = new Filter(Filter.SUBSTRINGS_FILTER);
+            SubstringFilter substring = new SubstringFilter(des);
+            if (initial != null) {
+                substring.addInitial(initial);
+            }
+
+            substring.addAny(any);
+
+            if (end != null) {
+                substring.addFinal(end);
+            }
+            filter.setValue(substring);
+        }
+
+        return filter;
+    }
+
+  final public String option() throws ParseException {
+            StringBuilder value = new StringBuilder();
+            Token t;
+    t = jj_consume_token(SEMI);
+                        value.append(t.image);
+    label_1:
+    while (true) {
+      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+      case HEX_CHAR:
+        t = jj_consume_token(HEX_CHAR);
+                             value.append(t.image);
+        break;
+      case NOHEX_CHAR:
+        t = jj_consume_token(NOHEX_CHAR);
+                               value.append(t.image);
+        break;
+      case ZERO:
+        t = jj_consume_token(ZERO);
+                         value.append(t.image);
+        break;
+      case DIGIT:
+        t = jj_consume_token(DIGIT);
+                          value.append(t.image);
+        break;
+      case HYPHEN:
+        t = jj_consume_token(HYPHEN);
+                           value.append(t.image);
+        break;
+      default:
+        jj_la1[0] = jj_gen;
+        jj_consume_token(-1);
+        throw new ParseException();
+      }
+      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+      case HEX_CHAR:
+      case NOHEX_CHAR:
+      case ZERO:
+      case DIGIT:
+      case HYPHEN:
+        ;
+        break;
+      default:
+        jj_la1[1] = jj_gen;
+        break label_1;
+      }
+    }
+             {if (true) return value.toString();}
+    throw new Error("Missing return statement in function");
+  }
+
+  final public String number() throws ParseException {
+            StringBuilder value = new StringBuilder();
+            Token t;
+    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+    case ZERO:
+      t = jj_consume_token(ZERO);
+                         value.append(t.image);
+      break;
+    case DIGIT:
+      t = jj_consume_token(DIGIT);
+                            value.append(t.image);
+      label_2:
+      while (true) {
+        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+        case ZERO:
+        case DIGIT:
+          ;
+          break;
+        default:
+          jj_la1[2] = jj_gen;
+          break label_2;
+        }
+        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+        case ZERO:
+          t = jj_consume_token(ZERO);
+                            value.append(t.image);
+          break;
+        case DIGIT:
+          t = jj_consume_token(DIGIT);
+                             value.append(t.image);
+          break;
+        default:
+          jj_la1[3] = jj_gen;
+          jj_consume_token(-1);
+          throw new ParseException();
+        }
+      }
+      break;
+    default:
+      jj_la1[4] = jj_gen;
+      jj_consume_token(-1);
+      throw new ParseException();
+    }
+             {if (true) return value.toString();}
+    throw new Error("Missing return statement in function");
+  }
+
+  final public String oid() throws ParseException {
+            StringBuilder value = new StringBuilder();
+            String number = null;
+            Token t = null;
+    number = number();
+                               value.append(number);
+    label_3:
+    while (true) {
+      t = jj_consume_token(PERIOD);
+                               value.append(t.image);
+      number = number();
+                                    value.append(number);
+      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+      case PERIOD:
+        ;
+        break;
+      default:
+        jj_la1[5] = jj_gen;
+        break label_3;
+      }
+    }
+             {if (true) return value.toString();}
+    throw new Error("Missing return statement in function");
+  }
+
+  final public String matchingrule() throws ParseException {
+            String value = null;
+    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+    case ZERO:
+    case DIGIT:
+      value = oid();
+      break;
+    case HEX_CHAR:
+    case NOHEX_CHAR:
+    case LBRACE:
+      value = attrType();
+      break;
+    default:
+      jj_la1[6] = jj_gen;
+      jj_consume_token(-1);
+      throw new ParseException();
+    }
+            {if (true) return value;}
+    throw new Error("Missing return statement in function");
+  }
+
+  final public String argument() throws ParseException {
+         String num = null;
+    jj_consume_token(LBRACE);
+    num = number();
+    jj_consume_token(RBRACE);
+             {if (true) return getArgAttrValue(num);}
+    throw new Error("Missing return statement in function");
+  }
+
+  final public String attrType() throws ParseException {
+            StringBuilder value = new StringBuilder();
+            String arg;
+            Token t;
+    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+    case HEX_CHAR:
+      t = jj_consume_token(HEX_CHAR);
+                             value.append(t.image);
+      break;
+    case NOHEX_CHAR:
+      t = jj_consume_token(NOHEX_CHAR);
+                                                                        value.append(t.image);
+      break;
+    case LBRACE:
+      arg = argument();
+                                                                                                                   value.append(arg);
+      break;
+    default:
+      jj_la1[7] = jj_gen;
+      jj_consume_token(-1);
+      throw new ParseException();
+    }
+    label_4:
+    while (true) {
+      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+      case HEX_CHAR:
+      case NOHEX_CHAR:
+      case LBRACE:
+      case ZERO:
+      case DIGIT:
+      case HYPHEN:
+        ;
+        break;
+      default:
+        jj_la1[8] = jj_gen;
+        break label_4;
+      }
+      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+      case HEX_CHAR:
+      case NOHEX_CHAR:
+      case ZERO:
+      case DIGIT:
+      case HYPHEN:
+        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+        case HEX_CHAR:
+          t = jj_consume_token(HEX_CHAR);
+          break;
+        case NOHEX_CHAR:
+          t = jj_consume_token(NOHEX_CHAR);
+          break;
+        case ZERO:
+          t = jj_consume_token(ZERO);
+          break;
+        case DIGIT:
+          t = jj_consume_token(DIGIT);
+          break;
+        case HYPHEN:
+          t = jj_consume_token(HYPHEN);
+          break;
+        default:
+          jj_la1[9] = jj_gen;
+          jj_consume_token(-1);
+          throw new ParseException();
+        }
+                                                                                            value.append(t.image);
+        break;
+      case LBRACE:
+        arg = argument();
+                                                                                                                                        value.append(arg);
+        break;
+      default:
+        jj_la1[10] = jj_gen;
+        jj_consume_token(-1);
+        throw new ParseException();
+      }
+    }
+             {if (true) return value.toString();}
+    throw new Error("Missing return statement in function");
+  }
+
+  final public String attrDescr() throws ParseException {
+         String type;
+    type = attrType();
+    label_5:
+    while (true) {
+      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+      case SEMI:
+        ;
+        break;
+      default:
+        jj_la1[11] = jj_gen;
+        break label_5;
+      }
+      option();
+    }
+             {if (true) return type;}
+    throw new Error("Missing return statement in function");
+  }
+
+  final public void test() throws ParseException {
+    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+    case LPARENT:
+                /*
+                 * initial args for test, so there should not be args index larger than
+                 * 49 in test case
+                 */
+                args = new Object[20];
+                for (int i = 0; i < args.length; i++) {
+                    args[i] = "{" + i + "}";
+                }
+      parse();
+      jj_consume_token(24);
+      test();
+      break;
+    default:
+      jj_la1[12] = jj_gen;
+      if (jj_2_1(2)) {
+        jj_consume_token(24);
+      } else {
+        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+        case 24:
+          jj_consume_token(24);
+          jj_consume_token(0);
+          break;
+        case 0:
+          jj_consume_token(0);
+          break;
+        default:
+          jj_la1[13] = jj_gen;
+          jj_consume_token(-1);
+          throw new ParseException();
+        }
+      }
+    }
+  }
+
+// FIXME: get string representation of AttributeValue, then use Rdn.unescapeValue(String) to get value
+  final public String value() throws ParseException {
+            StringBuilder value = new StringBuilder();
+            String hexValue = null;
+            Token t = null;;
+            String arg = null;
+    label_6:
+    while (true) {
+      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+      case NOHEX_CHAR:
+        t = jj_consume_token(NOHEX_CHAR);
+                                value.append(t.image);
+        break;
+      case HEX_CHAR:
+        t = jj_consume_token(HEX_CHAR);
+                              value.append(t.image);
+        break;
+      case ZERO:
+        t = jj_consume_token(ZERO);
+                          value.append(t.image);
+        break;
+      case DIGIT:
+        t = jj_consume_token(DIGIT);
+                           value.append(t.image);
+        break;
+      case HYPHEN:
+        t = jj_consume_token(HYPHEN);
+                            value.append(t.image);
+        break;
+      case COLON:
+        t = jj_consume_token(COLON);
+                           value.append(t.image);
+        break;
+      case BACKSLASH:
+        hexValue = backslashValue();
+                                           value.append(hexValue);
+        break;
+      case LBRACE:
+        arg = argument();
+                                value.append(arg);
+        break;
+      case CHAR:
+        t = jj_consume_token(CHAR);
+                          value.append(t.image);
+        break;
+      default:
+        jj_la1[14] = jj_gen;
+        jj_consume_token(-1);
+        throw new ParseException();
+      }
+      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+      case HEX_CHAR:
+      case NOHEX_CHAR:
+      case LBRACE:
+      case ZERO:
+      case COLON:
+      case DIGIT:
+      case HYPHEN:
+      case BACKSLASH:
+      case CHAR:
+        ;
+        break;
+      default:
+        jj_la1[15] = jj_gen;
+        break label_6;
+      }
+    }
+             {if (true) return value.toString();}
+    throw new Error("Missing return statement in function");
+  }
+
+  final public String backslashValue() throws ParseException {
+         String value;
+    jj_consume_token(BACKSLASH);
+    value = hexDigit();
+                                            {if (true) return convertToUtf8Char(value);}
+    throw new Error("Missing return statement in function");
+  }
+
+  final public String hexDigit() throws ParseException {
+            String value;
+            Token t;
+    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+    case HEX_CHAR:
+      t = jj_consume_token(HEX_CHAR);
+      break;
+    case DIGIT:
+      t = jj_consume_token(DIGIT);
+      break;
+    case ZERO:
+      t = jj_consume_token(ZERO);
+      break;
+    default:
+      jj_la1[16] = jj_gen;
+      jj_consume_token(-1);
+      throw new ParseException();
+    }
+                                                          value = t.image;
+    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+    case HEX_CHAR:
+      t = jj_consume_token(HEX_CHAR);
+      break;
+    case DIGIT:
+      t = jj_consume_token(DIGIT);
+      break;
+    case ZERO:
+      t = jj_consume_token(ZERO);
+      break;
+    default:
+      jj_la1[17] = jj_gen;
+      jj_consume_token(-1);
+      throw new ParseException();
+    }
+                                                          value += t.image;
+             {if (true) return value;}
+    throw new Error("Missing return statement in function");
+  }
+
+  final public Filter parse() throws ParseException {
+            Filter filter = null;
+            Filter temp = null;
+    jj_consume_token(LPARENT);
+    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+    case AND:
+      jj_consume_token(AND);
+                 filter = new Filter(Filter.AND_FILTER);
+      temp = parse();
+                 filter.addChild(temp);
+      temp = parse();
+                 filter.addChild(temp);
+      label_7:
+      while (true) {
+        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+        case LPARENT:
+          ;
+          break;
+        default:
+          jj_la1[18] = jj_gen;
+          break label_7;
+        }
+        temp = parse();
+                     filter.addChild(temp);
+      }
+      break;
+    case OR:
+      jj_consume_token(OR);
+                 filter = new Filter(Filter.OR_FILTER);
+      temp = parse();
+                 filter.addChild(temp);
+      temp = parse();
+                 filter.addChild(temp);
+      label_8:
+      while (true) {
+        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+        case LPARENT:
+          ;
+          break;
+        default:
+          jj_la1[19] = jj_gen;
+          break label_8;
+        }
+        temp = parse();
+                     filter.addChild(temp);
+      }
+      break;
+    case NOT:
+      jj_consume_token(NOT);
+                 filter = new Filter(Filter.NOT_FILTER);
+      temp = parse();
+                 filter.setValue(temp);
+      break;
+    case COLON_DN:
+    case HEX_CHAR:
+    case NOHEX_CHAR:
+    case LBRACE:
+    case COLON:
+      filter = item();
+      break;
+    default:
+      jj_la1[20] = jj_gen;
+      jj_consume_token(-1);
+      throw new ParseException();
+    }
+    jj_consume_token(RPARENT);
+                {if (true) return filter;}
+    throw new Error("Missing return statement in function");
+  }
+
+  final public void eof() throws ParseException {
+    jj_consume_token(0);
+  }
+
+  final public Filter item() throws ParseException {
+            Filter filter = null;
+            String value = null;
+            String des = null;
+            String temp = null;
+            List list = new ArrayList();
+            SubstringFilter substring = null;
+            MatchingRuleAssertion rule = null;
+    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+    case HEX_CHAR:
+    case NOHEX_CHAR:
+    case LBRACE:
+      des = attrDescr();
+      if (jj_2_2(2)) {
+        jj_consume_token(APPROX);
+        jj_consume_token(EQUAL);
+        value = value();
+                    filter = new Filter(Filter.APPROX_MATCH_FILTER); filter.setValue(new AttributeTypeAndValuePair(des, value));
+      } else {
+        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+        case GREATER:
+          jj_consume_token(GREATER);
+          jj_consume_token(EQUAL);
+          value = value();
+                    filter = new Filter(Filter.GREATER_OR_EQUAL_FILTER);filter.setValue(new AttributeTypeAndValuePair(des, value));
+          break;
+        case LESS:
+          jj_consume_token(LESS);
+          jj_consume_token(EQUAL);
+          value = value();
+                    filter = new Filter(Filter.LESS_OR_EQUAL_FILTER);filter.setValue(new AttributeTypeAndValuePair(des, value));
+          break;
+        default:
+          jj_la1[22] = jj_gen;
+          if (jj_2_3(3)) {
+            jj_consume_token(EQUAL);
+            switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+            case ASTERISK:
+              asterisk_start(list);
+              break;
+            case HEX_CHAR:
+            case NOHEX_CHAR:
+            case LBRACE:
+            case ZERO:
+            case COLON:
+            case DIGIT:
+            case HYPHEN:
+            case BACKSLASH:
+            case CHAR:
+              value_start(list);
+              break;
+            default:
+              jj_la1[21] = jj_gen;
+              jj_consume_token(-1);
+              throw new ParseException();
+            }
+                                                                                   filter = parseSubstring(des, list);
+          } else {
+            switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+            case COLON_DN:
+            case COLON:
+              rule = extensible_1(des);
+                                            filter = new Filter(Filter.EXTENSIBLE_MATCH_FILTER); filter.setValue(rule);
+              break;
+            default:
+              jj_la1[23] = jj_gen;
+              jj_consume_token(-1);
+              throw new ParseException();
+            }
+          }
+        }
+      }
+      break;
+    case COLON_DN:
+    case COLON:
+      rule = extensible_2();
+                                     filter = new Filter(Filter.EXTENSIBLE_MATCH_FILTER); filter.setValue(rule);
+      break;
+    default:
+      jj_la1[24] = jj_gen;
+      jj_consume_token(-1);
+      throw new ParseException();
+    }
+             {if (true) return filter;}
+    throw new Error("Missing return statement in function");
+  }
+
+  final public void asterisk_start(List list) throws ParseException {
+    jj_consume_token(ASTERISK);
+                            list.add("*");
+    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+    case HEX_CHAR:
+    case NOHEX_CHAR:
+    case LBRACE:
+    case ZERO:
+    case COLON:
+    case DIGIT:
+    case HYPHEN:
+    case BACKSLASH:
+    case CHAR:
+      value_start(list);
+      break;
+    default:
+      jj_la1[25] = jj_gen;
+      ;
+    }
+  }
+
+  final public void value_start(List list) throws ParseException {
+                String value;
+    value = value();
+                                 list.add(value);
+    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+    case ASTERISK:
+      asterisk_start(list);
+      break;
+    default:
+      jj_la1[26] = jj_gen;
+      ;
+    }
+  }
+
+  final public String final_part() throws ParseException {
+            String value;
+    value = value();
+             {if (true) return value;}
+    throw new Error("Missing return statement in function");
+  }
+
+  final public String tail_part() throws ParseException {
+            String value;
+            String temp;
+    value = any_part();
+    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+    case HEX_CHAR:
+    case NOHEX_CHAR:
+    case LBRACE:
+    case ZERO:
+    case COLON:
+    case DIGIT:
+    case HYPHEN:
+    case BACKSLASH:
+    case CHAR:
+      temp = final_part();
+                                                     value = value + temp;
+      break;
+    default:
+      jj_la1[27] = jj_gen;
+      ;
+    }
+             {if (true) return value;}
+    throw new Error("Missing return statement in function");
+  }
+
+  final public String any_part() throws ParseException {
+            StringBuilder value = new StringBuilder();
+            Token t;
+            String temp;
+    t = jj_consume_token(ASTERISK);
+                            value.append(t.image);
+    label_9:
+    while (true) {
+      temp = value();
+                                          value.append(temp);
+      t = jj_consume_token(ASTERISK);
+                             value.append(t.image);
+      if (jj_2_4(2)) {
+        ;
+      } else {
+        break label_9;
+      }
+    }
+             {if (true) return value.toString();}
+    throw new Error("Missing return statement in function");
+  }
+
+  final public MatchingRuleAssertion extensible_1(String type) throws ParseException {
+            MatchingRuleAssertion rule = new MatchingRuleAssertion();
+            rule.setType(type);
+            String value;
+    if (jj_2_5(2)) {
+      jj_consume_token(COLON_DN);
+                                      rule.setDnAttributes(true);
+    } else {
+      ;
+    }
+    if (jj_2_6(2)) {
+      jj_consume_token(COLON);
+      value = oid();
+                                                 rule.setMatchingRule(value);
+    } else {
+      ;
+    }
+    jj_consume_token(COLON);
+    jj_consume_token(EQUAL);
+    value = value();
+                             rule.setMatchValue(value);
+             {if (true) return rule;}
+    throw new Error("Missing return statement in function");
+  }
+
+  final public MatchingRuleAssertion extensible_2() throws ParseException {
+            MatchingRuleAssertion rule = new MatchingRuleAssertion();
+            String value;
+    if (jj_2_7(2)) {
+      jj_consume_token(COLON_DN);
+    } else {
+      ;
+    }
+    jj_consume_token(COLON);
+    value = matchingrule();
+                                                                      rule.setMatchingRule(value);
+    jj_consume_token(COLON);
+    jj_consume_token(EQUAL);
+    value = value();
+                             rule.setMatchValue(value);
+             {if (true) return rule;}
+    throw new Error("Missing return statement in function");
+  }
+
+  final public void colon_oid() throws ParseException {
+    jj_consume_token(COLON);
+    oid();
+  }
+
+  final private boolean jj_2_1(int xla) {
+    jj_la = xla; jj_lastpos = jj_scanpos = token;
+    try { return !jj_3_1(); }
+    catch(LookaheadSuccess ls) { return true; }
+    finally { jj_save(0, xla); }
+  }
+
+  final private boolean jj_2_2(int xla) {
+    jj_la = xla; jj_lastpos = jj_scanpos = token;
+    try { return !jj_3_2(); }
+    catch(LookaheadSuccess ls) { return true; }
+    finally { jj_save(1, xla); }
+  }
+
+  final private boolean jj_2_3(int xla) {
+    jj_la = xla; jj_lastpos = jj_scanpos = token;
+    try { return !jj_3_3(); }
+    catch(LookaheadSuccess ls) { return true; }
+    finally { jj_save(2, xla); }
+  }
+
+  final private boolean jj_2_4(int xla) {
+    jj_la = xla; jj_lastpos = jj_scanpos = token;
+    try { return !jj_3_4(); }
+    catch(LookaheadSuccess ls) { return true; }
+    finally { jj_save(3, xla); }
+  }
+
+  final private boolean jj_2_5(int xla) {
+    jj_la = xla; jj_lastpos = jj_scanpos = token;
+    try { return !jj_3_5(); }
+    catch(LookaheadSuccess ls) { return true; }
+    finally { jj_save(4, xla); }
+  }
+
+  final private boolean jj_2_6(int xla) {
+    jj_la = xla; jj_lastpos = jj_scanpos = token;
+    try { return !jj_3_6(); }
+    catch(LookaheadSuccess ls) { return true; }
+    finally { jj_save(5, xla); }
+  }
+
+  final private boolean jj_2_7(int xla) {
+    jj_la = xla; jj_lastpos = jj_scanpos = token;
+    try { return !jj_3_7(); }
+    catch(LookaheadSuccess ls) { return true; }
+    finally { jj_save(6, xla); }
+  }
+
+  final private boolean jj_3R_12() {
+    Token xsp;
+    if (jj_3R_16()) return true;
+    while (true) {
+      xsp = jj_scanpos;
+      if (jj_3R_16()) { jj_scanpos = xsp; break; }
+    }
+    return false;
+  }
+
+  final private boolean jj_3R_15() {
+    if (jj_3R_12()) return true;
+    Token xsp;
+    xsp = jj_scanpos;
+    if (jj_3R_19()) jj_scanpos = xsp;
+    return false;
+  }
+
+  final private boolean jj_3R_32() {
+    if (jj_scan_token(LBRACE)) return true;
+    if (jj_3R_17()) return true;
+    return false;
+  }
+
+  final private boolean jj_3_6() {
+    if (jj_scan_token(COLON)) return true;
+    if (jj_3R_13()) return true;
+    return false;
+  }
+
+  final private boolean jj_3_5() {
+    if (jj_scan_token(COLON_DN)) return true;
+    return false;
+  }
+
+  final private boolean jj_3R_14() {
+    if (jj_scan_token(ASTERISK)) return true;
+    Token xsp;
+    xsp = jj_scanpos;
+    if (jj_3R_18()) jj_scanpos = xsp;
+    return false;
+  }
+
+  final private boolean jj_3R_19() {
+    if (jj_3R_14()) return true;
+    return false;
+  }
+
+  final private boolean jj_3R_33() {
+    Token xsp;
+    xsp = jj_scanpos;
+    if (jj_scan_token(2)) {
+    jj_scanpos = xsp;
+    if (jj_scan_token(18)) {
+    jj_scanpos = xsp;
+    if (jj_scan_token(11)) return true;
+    }
+    }
+    return false;
+  }
+
+  final private boolean jj_3_3() {
+    if (jj_scan_token(EQUAL)) return true;
+    Token xsp;
+    xsp = jj_scanpos;
+    if (jj_3R_10()) {
+    jj_scanpos = xsp;
+    if (jj_3R_11()) return true;
+    }
+    return false;
+  }
+
+  final private boolean jj_3R_11() {
+    if (jj_3R_15()) return true;
+    return false;
+  }
+
+  final private boolean jj_3_4() {
+    if (jj_3R_12()) return true;
+    if (jj_scan_token(ASTERISK)) return true;
+    return false;
+  }
+
+  final private boolean jj_3R_13() {
+    if (jj_3R_17()) return true;
+    return false;
+  }
+
+  final private boolean jj_3R_31() {
+    if (jj_scan_token(BACKSLASH)) return true;
+    if (jj_3R_33()) return true;
+    return false;
+  }
+
+  final private boolean jj_3R_18() {
+    if (jj_3R_15()) return true;
+    return false;
+  }
+
+  final private boolean jj_3_2() {
+    if (jj_scan_token(APPROX)) return true;
+    if (jj_scan_token(EQUAL)) return true;
+    return false;
+  }
+
+  final private boolean jj_3R_28() {
+    if (jj_scan_token(CHAR)) return true;
+    return false;
+  }
+
+  final private boolean jj_3_1() {
+    if (jj_scan_token(24)) return true;
+    return false;
+  }
+
+  final private boolean jj_3R_27() {
+    if (jj_3R_32()) return true;
+    return false;
+  }
+
+  final private boolean jj_3R_30() {
+    if (jj_scan_token(DIGIT)) return true;
+    return false;
+  }
+
+  final private boolean jj_3R_26() {
+    if (jj_3R_31()) return true;
+    return false;
+  }
+
+  final private boolean jj_3R_25() {
+    if (jj_scan_token(COLON)) return true;
+    return false;
+  }
+
+  final private boolean jj_3R_29() {
+    if (jj_scan_token(ZERO)) return true;
+    return false;
+  }
+
+  final private boolean jj_3R_24() {
+    if (jj_scan_token(HYPHEN)) return true;
+    return false;
+  }
+
+  final private boolean jj_3R_23() {
+    if (jj_scan_token(DIGIT)) return true;
+    return false;
+  }
+
+  final private boolean jj_3R_17() {
+    Token xsp;
+    xsp = jj_scanpos;
+    if (jj_3R_29()) {
+    jj_scanpos = xsp;
+    if (jj_3R_30()) return true;
+    }
+    return false;
+  }
+
+  final private boolean jj_3R_22() {
+    if (jj_scan_token(ZERO)) return true;
+    return false;
+  }
+
+  final private boolean jj_3R_21() {
+    if (jj_scan_token(HEX_CHAR)) return true;
+    return false;
+  }
+
+  final private boolean jj_3R_10() {
+    if (jj_3R_14()) return true;
+    return false;
+  }
+
+  final private boolean jj_3_7() {
+    if (jj_scan_token(COLON_DN)) return true;
+    return false;
+  }
+
+  final private boolean jj_3R_20() {
+    if (jj_scan_token(NOHEX_CHAR)) return true;
+    return false;
+  }
+
+  final private boolean jj_3R_16() {
+    Token xsp;
+    xsp = jj_scanpos;
+    if (jj_3R_20()) {
+    jj_scanpos = xsp;
+    if (jj_3R_21()) {
+    jj_scanpos = xsp;
+    if (jj_3R_22()) {
+    jj_scanpos = xsp;
+    if (jj_3R_23()) {
+    jj_scanpos = xsp;
+    if (jj_3R_24()) {
+    jj_scanpos = xsp;
+    if (jj_3R_25()) {
+    jj_scanpos = xsp;
+    if (jj_3R_26()) {
+    jj_scanpos = xsp;
+    if (jj_3R_27()) {
+    jj_scanpos = xsp;
+    if (jj_3R_28()) return true;
+    }
+    }
+    }
+    }
+    }
+    }
+    }
+    }
+    return false;
+  }
+
+  public FilterParserTokenManager 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;
+  private int jj_gen;
+  final private int[] jj_la1 = new int[28];
+  static private int[] jj_la1_0;
+  static {
+      jj_la1_0();
+   }
+   private static void jj_la1_0() {
+      jj_la1_0 = new int[] {0xc080c,0xc080c,0x40800,0x40800,0x40800,0x100000,0x4084c,0x4c,0xc084c,0xc080c,0xc084c,0x400000,0x10,0x1000001,0xac184c,0xac184c,0x40804,0x40804,0x10,0x10,0x174e,0xae184c,0xc000,0x1002,0x104e,0xac184c,0x20000,0xac184c,};
+   }
+  final private JJCalls[] jj_2_rtns = new JJCalls[7];
+  private boolean jj_rescan = false;
+  private int jj_gc = 0;
+
+  public FilterParser(java.io.InputStream stream) {
+    jj_input_stream = new SimpleCharStream(stream, 1, 1);
+    token_source = new FilterParserTokenManager(jj_input_stream);
+    token = new Token();
+    jj_ntk = -1;
+    jj_gen = 0;
+    for (int i = 0; i < 28; i++) jj_la1[i] = -1;
+    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
+  }
+
+  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;
+    jj_gen = 0;
+    for (int i = 0; i < 28; i++) jj_la1[i] = -1;
+    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
+  }
+
+  public FilterParser(java.io.Reader stream) {
+    jj_input_stream = new SimpleCharStream(stream, 1, 1);
+    token_source = new FilterParserTokenManager(jj_input_stream);
+    token = new Token();
+    jj_ntk = -1;
+    jj_gen = 0;
+    for (int i = 0; i < 28; i++) jj_la1[i] = -1;
+    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
+  }
+
+  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;
+    jj_gen = 0;
+    for (int i = 0; i < 28; i++) jj_la1[i] = -1;
+    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
+  }
+
+  public FilterParser(FilterParserTokenManager tm) {
+    token_source = tm;
+    token = new Token();
+    jj_ntk = -1;
+    jj_gen = 0;
+    for (int i = 0; i < 28; i++) jj_la1[i] = -1;
+    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
+  }
+
+  public void ReInit(FilterParserTokenManager tm) {
+    token_source = tm;
+    token = new Token();
+    jj_ntk = -1;
+    jj_gen = 0;
+    for (int i = 0; i < 28; i++) jj_la1[i] = -1;
+    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
+  }
+
+  final 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) {
+      jj_gen++;
+      if (++jj_gc > 100) {
+        jj_gc = 0;
+        for (int i = 0; i < jj_2_rtns.length; i++) {
+          JJCalls c = jj_2_rtns[i];
+          while (c != null) {
+            if (c.gen < jj_gen) c.first = null;
+            c = c.next;
+          }
+        }
+      }
+      return token;
+    }
+    token = oldToken;
+    jj_kind = kind;
+    throw generateParseException();
+  }
+
+  static private final class LookaheadSuccess extends java.lang.Error { }
+  final private LookaheadSuccess jj_ls = new LookaheadSuccess();
+  final 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;
+    }
+    if (jj_rescan) {
+      int i = 0; Token tok = token;
+      while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; }
+      if (tok != null) jj_add_error_token(kind, i);
+    }
+    if (jj_scanpos.kind != kind) return true;
+    if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls;
+    return false;
+  }
+
+  final public Token getNextToken() {
+    if (token.next != null) token = token.next;
+    else token = token.next = token_source.getNextToken();
+    jj_ntk = -1;
+    jj_gen++;
+    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;
+  }
+
+  final 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);
+  }
+
+  private java.util.Vector jj_expentries = new java.util.Vector();
+  private int[] jj_expentry;
+  private int jj_kind = -1;
+  private int[] jj_lasttokens = new int[100];
+  private int jj_endpos;
+
+  private void jj_add_error_token(int kind, int pos) {
+    if (pos >= 100) return;
+    if (pos == jj_endpos + 1) {
+      jj_lasttokens[jj_endpos++] = kind;
+    } else if (jj_endpos != 0) {
+      jj_expentry = new int[jj_endpos];
+      for (int i = 0; i < jj_endpos; i++) {
+        jj_expentry[i] = jj_lasttokens[i];
+      }
+      boolean exists = false;
+      for (java.util.Enumeration e = jj_expentries.elements(); e.hasMoreElements();) {
+        int[] oldentry = (int[])(e.nextElement());
+        if (oldentry.length == jj_expentry.length) {
+          exists = true;
+          for (int i = 0; i < jj_expentry.length; i++) {
+            if (oldentry[i] != jj_expentry[i]) {
+              exists = false;
+              break;
+            }
+          }
+          if (exists) break;
+        }
+      }
+      if (!exists) jj_expentries.addElement(jj_expentry);
+      if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind;
+    }
+  }
+
+  public ParseException generateParseException() {
+    jj_expentries.removeAllElements();
+    boolean[] la1tokens = new boolean[25];
+    for (int i = 0; i < 25; i++) {
+      la1tokens[i] = false;
+    }
+    if (jj_kind >= 0) {
+      la1tokens[jj_kind] = true;
+      jj_kind = -1;
+    }
+    for (int i = 0; i < 28; i++) {
+      if (jj_la1[i] == jj_gen) {
+        for (int j = 0; j < 32; j++) {
+          if ((jj_la1_0[i] & (1<<j)) != 0) {
+            la1tokens[j] = true;
+          }
+        }
+      }
+    }
+    for (int i = 0; i < 25; i++) {
+      if (la1tokens[i]) {
+        jj_expentry = new int[1];
+        jj_expentry[0] = i;
+        jj_expentries.addElement(jj_expentry);
+      }
+    }
+    jj_endpos = 0;
+    jj_rescan_token();
+    jj_add_error_token(0, 0);
+    int[][] exptokseq = new int[jj_expentries.size()][];
+    for (int i = 0; i < jj_expentries.size(); i++) {
+      exptokseq[i] = (int[])jj_expentries.elementAt(i);
+    }
+    return new ParseException(token, exptokseq, tokenImage);
+  }
+
+  final public void enable_tracing() {
+  }
+
+  final public void disable_tracing() {
+  }
+
+  final private void jj_rescan_token() {
+    jj_rescan = true;
+    for (int i = 0; i < 7; i++) {
+      JJCalls p = jj_2_rtns[i];
+      do {
+        if (p.gen > jj_gen) {
+          jj_la = p.arg; jj_lastpos = jj_scanpos = p.first;
+          switch (i) {
+            case 0: jj_3_1(); break;
+            case 1: jj_3_2(); break;
+            case 2: jj_3_3(); break;
+            case 3: jj_3_4(); break;
+            case 4: jj_3_5(); break;
+            case 5: jj_3_6(); break;
+            case 6: jj_3_7(); break;
+          }
+        }
+        p = p.next;
+      } while (p != null);
+    }
+    jj_rescan = false;
+  }
+
+  final private void jj_save(int index, int xla) {
+    JJCalls p = jj_2_rtns[index];
+    while (p.gen > jj_gen) {
+      if (p.next == null) { p = p.next = new JJCalls(); break; }
+      p = p.next;
+    }
+    p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla;
+  }
+
+  static final class JJCalls {
+    int gen;
+    Token first;
+    int arg;
+    JJCalls next;
+  }
+
+}

Propchange: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/ldap/parser/FilterParser.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/ldap/parser/FilterParserConstants.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/ldap/parser/FilterParserConstants.java?rev=591934&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/ldap/parser/FilterParserConstants.java (added)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/ldap/parser/FilterParserConstants.java Mon Nov  5 01:36:36 2007
@@ -0,0 +1,78 @@
+/* Generated By:JavaCC: Do not edit this line. FilterParserConstants.java */
+/* 
+ *  Licensed to the Apache Software Foundation (ASF) under one or more 
+ *  contributor license agreements.  See the NOTICE file distributed with 
+ *  this work for additional information regarding copyright ownership. 
+ *  The ASF licenses this file to You under the Apache License, Version 2.0 
+ *  (the "License"); you may not use this file except in compliance with 
+ *  the License.  You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0 
+ * 
+ *  Unless required by applicable law or agreed to in writing, software 
+ *  distributed under the License is distributed on an "AS IS" BASIS, 
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ *  See the License for the specific language governing permissions and 
+ *  limitations under the License. 
+ */
+
+package org.apache.harmony.jndi.provider.ldap.parser;
+
+public interface FilterParserConstants {
+
+  int EOF = 0;
+  int COLON_DN = 1;
+  int HEX_CHAR = 2;
+  int NOHEX_CHAR = 3;
+  int LPARENT = 4;
+  int RPARENT = 5;
+  int LBRACE = 6;
+  int RBRACE = 7;
+  int AND = 8;
+  int OR = 9;
+  int NOT = 10;
+  int ZERO = 11;
+  int COLON = 12;
+  int EQUAL = 13;
+  int LESS = 14;
+  int GREATER = 15;
+  int APPROX = 16;
+  int ASTERISK = 17;
+  int DIGIT = 18;
+  int HYPHEN = 19;
+  int PERIOD = 20;
+  int BACKSLASH = 21;
+  int SEMI = 22;
+  int CHAR = 23;
+
+  int DEFAULT = 0;
+
+  String[] tokenImage = {
+    "<EOF>",
+    "\":dn\"",
+    "<HEX_CHAR>",
+    "<NOHEX_CHAR>",
+    "\"(\"",
+    "\")\"",
+    "\"{\"",
+    "\"}\"",
+    "\"&\"",
+    "\"|\"",
+    "\"!\"",
+    "\"0\"",
+    "\":\"",
+    "\"=\"",
+    "\"<\"",
+    "\">\"",
+    "\"~\"",
+    "\"*\"",
+    "<DIGIT>",
+    "\"-\"",
+    "\".\"",
+    "\"\\\\\"",
+    "\";\"",
+    "<CHAR>",
+    "\"\\n\"",
+  };
+
+}

Propchange: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/ldap/parser/FilterParserConstants.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/ldap/parser/FilterParserTokenManager.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/ldap/parser/FilterParserTokenManager.java?rev=591934&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/ldap/parser/FilterParserTokenManager.java (added)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/ldap/parser/FilterParserTokenManager.java Mon Nov  5 01:36:36 2007
@@ -0,0 +1,410 @@
+/* 
+ *  Licensed to the Apache Software Foundation (ASF) under one or more 
+ *  contributor license agreements.  See the NOTICE file distributed with 
+ *  this work for additional information regarding copyright ownership. 
+ *  The ASF licenses this file to You under the Apache License, Version 2.0 
+ *  (the "License"); you may not use this file except in compliance with 
+ *  the License.  You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0 
+ * 
+ *  Unless required by applicable law or agreed to in writing, software 
+ *  distributed under the License is distributed on an "AS IS" BASIS, 
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ *  See the License for the specific language governing permissions and 
+ *  limitations under the License. 
+ */
+/* Generated By:JavaCC: Do not edit this line. FilterParserTokenManager.java */
+
+package org.apache.harmony.jndi.provider.ldap.parser;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.util.ArrayList;
+import java.util.List;
+import java.io.StringReader;
+import org.apache.harmony.jndi.provider.ldap.Filter;
+import org.apache.harmony.jndi.internal.parser.AttributeTypeAndValuePair;
+import org.apache.harmony.jndi.provider.ldap.Filter.MatchingRuleAssertion;
+import org.apache.harmony.jndi.provider.ldap.Filter.SubstringFilter;
+import org.apache.harmony.jndi.provider.ldap.asn1.Utils;
+
+public class FilterParserTokenManager implements FilterParserConstants
+{
+  public  java.io.PrintStream debugStream = System.out;
+  public  void setDebugStream(java.io.PrintStream ds) { debugStream = ds; }
+private final int jjStopStringLiteralDfa_0(int pos, long active0)
+{
+   switch (pos)
+   {
+      default :
+         return -1;
+   }
+}
+private final int jjStartNfa_0(int pos, long active0)
+{
+   return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1);
+}
+private final int jjStopAtPos(int pos, int kind)
+{
+   jjmatchedKind = kind;
+   jjmatchedPos = pos;
+   return pos + 1;
+}
+private final int jjStartNfaWithStates_0(int pos, int kind, int state)
+{
+   jjmatchedKind = kind;
+   jjmatchedPos = pos;
+   try { curChar = input_stream.readChar(); }
+   catch(java.io.IOException e) { return pos + 1; }
+   return jjMoveNfa_0(state, pos + 1);
+}
+private final int jjMoveStringLiteralDfa0_0()
+{
+   switch(curChar)
+   {
+      case 10:
+         return jjStopAtPos(0, 24);
+      case 33:
+         return jjStopAtPos(0, 10);
+      case 38:
+         return jjStopAtPos(0, 8);
+      case 40:
+         return jjStopAtPos(0, 4);
+      case 41:
+         return jjStopAtPos(0, 5);
+      case 42:
+         return jjStopAtPos(0, 17);
+      case 45:
+         return jjStopAtPos(0, 19);
+      case 46:
+         return jjStopAtPos(0, 20);
+      case 48:
+         return jjStopAtPos(0, 11);
+      case 58:
+         jjmatchedKind = 12;
+         return jjMoveStringLiteralDfa1_0(0x2L);
+      case 59:
+         return jjStopAtPos(0, 22);
+      case 60:
+         return jjStopAtPos(0, 14);
+      case 61:
+         return jjStopAtPos(0, 13);
+      case 62:
+         return jjStopAtPos(0, 15);
+      case 92:
+         return jjStopAtPos(0, 21);
+      case 123:
+         return jjStopAtPos(0, 6);
+      case 124:
+         return jjStopAtPos(0, 9);
+      case 125:
+         return jjStopAtPos(0, 7);
+      case 126:
+         return jjStopAtPos(0, 16);
+      default :
+         return jjMoveNfa_0(0, 0);
+   }
+}
+private final int jjMoveStringLiteralDfa1_0(long active0)
+{
+   try { curChar = input_stream.readChar(); }
+   catch(java.io.IOException e) {
+      jjStopStringLiteralDfa_0(0, active0);
+      return 1;
+   }
+   switch(curChar)
+   {
+      case 100:
+         return jjMoveStringLiteralDfa2_0(active0, 0x2L);
+      default :
+         break;
+   }
+   return jjStartNfa_0(0, active0);
+}
+private final int jjMoveStringLiteralDfa2_0(long old0, long active0)
+{
+   if (((active0 &= old0)) == 0L)
+      return jjStartNfa_0(0, old0); 
+   try { curChar = input_stream.readChar(); }
+   catch(java.io.IOException e) {
+      jjStopStringLiteralDfa_0(1, active0);
+      return 2;
+   }
+   switch(curChar)
+   {
+      case 110:
+         if ((active0 & 0x2L) != 0L)
+            return jjStopAtPos(2, 1);
+         break;
+      default :
+         break;
+   }
+   return jjStartNfa_0(1, active0);
+}
+private final void jjCheckNAdd(int state)
+{
+   if (jjrounds[state] != jjround)
+   {
+      jjstateSet[jjnewStateCnt++] = state;
+      jjrounds[state] = jjround;
+   }
+}
+private final void jjAddStates(int start, int end)
+{
+   do {
+      jjstateSet[jjnewStateCnt++] = jjnextStates[start];
+   } while (start++ != end);
+}
+private final void jjCheckNAddTwoStates(int state1, int state2)
+{
+   jjCheckNAdd(state1);
+   jjCheckNAdd(state2);
+}
+private final void jjCheckNAddStates(int start, int end)
+{
+   do {
+      jjCheckNAdd(jjnextStates[start]);
+   } while (start++ != end);
+}
+private final void jjCheckNAddStates(int start)
+{
+   jjCheckNAdd(jjnextStates[start]);
+   jjCheckNAdd(jjnextStates[start + 1]);
+}
+static final long[] jjbitVec0 = {
+   0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL
+};
+private final int jjMoveNfa_0(int startState, int curPos)
+{
+   int[] nextStates;
+   int startsAt = 0;
+   jjnewStateCnt = 4;
+   int i = 1;
+   jjstateSet[0] = startState;
+   int j, kind = 0x7fffffff;
+   for (;;)
+   {
+      if (++jjround == 0x7fffffff)
+         ReInitRounds();
+      if (curChar < 64)
+      {
+         long l = 1L << curChar;
+         MatchLoop: do
+         {
+            switch(jjstateSet[--i])
+            {
+               case 0:
+                  if ((0xfffff8fffffffbffL & l) != 0L)
+                  {
+                     if (kind > 23)
+                        kind = 23;
+                  }
+                  if ((0x3fe000000000000L & l) != 0L)
+                  {
+                     if (kind > 18)
+                        kind = 18;
+                  }
+                  break;
+               case 2:
+                  if ((0x3fe000000000000L & l) != 0L && kind > 18)
+                     kind = 18;
+                  break;
+               case 3:
+                  if ((0xfffff8fffffffbffL & l) != 0L && kind > 23)
+                     kind = 23;
+                  break;
+               default : break;
+            }
+         } while(i != startsAt);
+      }
+      else if (curChar < 128)
+      {
+         long l = 1L << (curChar & 077);
+         MatchLoop: do
+         {
+            switch(jjstateSet[--i])
+            {
+               case 0:
+                  if ((0xffffffffefffffffL & l) != 0L)
+                  {
+                     if (kind > 23)
+                        kind = 23;
+                  }
+                  if ((0x7ffff8007ffff80L & l) != 0L)
+                  {
+                     if (kind > 3)
+                        kind = 3;
+                  }
+                  else if ((0x7e0000007eL & l) != 0L)
+                  {
+                     if (kind > 2)
+                        kind = 2;
+                  }
+                  break;
+               case 1:
+                  if ((0x7ffff8007ffff80L & l) != 0L && kind > 3)
+                     kind = 3;
+                  break;
+               case 3:
+                  if ((0xffffffffefffffffL & l) != 0L && kind > 23)
+                     kind = 23;
+                  break;
+               default : break;
+            }
+         } while(i != startsAt);
+      }
+      else
+      {
+         int i2 = (curChar & 0xff) >> 6;
+         long l2 = 1L << (curChar & 077);
+         MatchLoop: do
+         {
+            switch(jjstateSet[--i])
+            {
+               case 0:
+                  if ((jjbitVec0[i2] & l2) != 0L && kind > 23)
+                     kind = 23;
+                  break;
+               default : break;
+            }
+         } while(i != startsAt);
+      }
+      if (kind != 0x7fffffff)
+      {
+         jjmatchedKind = kind;
+         jjmatchedPos = curPos;
+         kind = 0x7fffffff;
+      }
+      ++curPos;
+      if ((i = jjnewStateCnt) == (startsAt = 4 - (jjnewStateCnt = startsAt)))
+         return curPos;
+      try { curChar = input_stream.readChar(); }
+      catch(java.io.IOException e) { return curPos; }
+   }
+}
+static final int[] jjnextStates = {
+};
+public static final String[] jjstrLiteralImages = {
+"", "\72\144\156", null, null, "\50", "\51", "\173", "\175", "\46", "\174", 
+"\41", "\60", "\72", "\75", "\74", "\76", "\176", "\52", null, "\55", "\56", "\134", 
+"\73", null, "\12", };
+public static final String[] lexStateNames = {
+   "DEFAULT", 
+};
+protected SimpleCharStream input_stream;
+private final int[] jjrounds = new int[4];
+private final int[] jjstateSet = new int[8];
+protected char curChar;
+public FilterParserTokenManager(SimpleCharStream stream)
+{
+   if (SimpleCharStream.staticFlag)
+      throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer.");
+   input_stream = stream;
+}
+public FilterParserTokenManager(SimpleCharStream stream, int lexState)
+{
+   this(stream);
+   SwitchTo(lexState);
+}
+public void ReInit(SimpleCharStream stream)
+{
+   jjmatchedPos = jjnewStateCnt = 0;
+   curLexState = defaultLexState;
+   input_stream = stream;
+   ReInitRounds();
+}
+private final void ReInitRounds()
+{
+   int i;
+   jjround = 0x80000001;
+   for (i = 4; i-- > 0;)
+      jjrounds[i] = 0x80000000;
+}
+public void ReInit(SimpleCharStream stream, int lexState)
+{
+   ReInit(stream);
+   SwitchTo(lexState);
+}
+public void SwitchTo(int lexState)
+{
+   if (lexState >= 1 || lexState < 0)
+      throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE);
+   else
+      curLexState = lexState;
+}
+
+protected 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;
+}
+
+int curLexState = 0;
+int defaultLexState = 0;
+int jjnewStateCnt;
+int jjround;
+int jjmatchedPos;
+int jjmatchedKind;
+
+public Token getNextToken() 
+{
+  int kind;
+  Token specialToken = null;
+  Token matchedToken;
+  int curPos = 0;
+
+  EOFLoop :
+  for (;;)
+  {   
+   try   
+   {     
+      curChar = input_stream.BeginToken();
+   }     
+   catch(java.io.IOException e)
+   {        
+      jjmatchedKind = 0;
+      matchedToken = jjFillToken();
+      return matchedToken;
+   }
+
+   jjmatchedKind = 0x7fffffff;
+   jjmatchedPos = 0;
+   curPos = jjMoveStringLiteralDfa0_0();
+   if (jjmatchedKind != 0x7fffffff)
+   {
+      if (jjmatchedPos + 1 < curPos)
+         input_stream.backup(curPos - jjmatchedPos - 1);
+         matchedToken = jjFillToken();
+         return matchedToken;
+   }
+   int error_line = input_stream.getEndLine();
+   int error_column = input_stream.getEndColumn();
+   String error_after = null;
+   boolean EOFSeen = false;
+   try { input_stream.readChar(); input_stream.backup(1); }
+   catch (java.io.IOException e1) {
+      EOFSeen = true;
+      error_after = curPos <= 1 ? "" : input_stream.GetImage();
+      if (curChar == '\n' || curChar == '\r') {
+         error_line++;
+         error_column = 0;
+      }
+      else
+         error_column++;
+   }
+   if (!EOFSeen) {
+      input_stream.backup(1);
+      error_after = curPos <= 1 ? "" : input_stream.GetImage();
+   }
+   throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR);
+  }
+}
+
+}

Propchange: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/ldap/parser/FilterParserTokenManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/ldap/parser/LdapUrlParser.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/ldap/parser/LdapUrlParser.java?rev=591934&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/ldap/parser/LdapUrlParser.java (added)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/ldap/parser/LdapUrlParser.java Mon Nov  5 01:36:36 2007
@@ -0,0 +1,928 @@
+/* 
+ *  Licensed to the Apache Software Foundation (ASF) under one or more 
+ *  contributor license agreements.  See the NOTICE file distributed with 
+ *  this work for additional information regarding copyright ownership. 
+ *  The ASF licenses this file to You under the Apache License, Version 2.0 
+ *  (the "License"); you may not use this file except in compliance with 
+ *  the License.  You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0 
+ * 
+ *  Unless required by applicable law or agreed to in writing, software 
+ *  distributed under the License is distributed on an "AS IS" BASIS, 
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ *  See the License for the specific language governing permissions and 
+ *  limitations under the License. 
+ */
+/* Generated By:JavaCC: Do not edit this line. LdapUrlParser.java */
+
+package org.apache.harmony.jndi.provider.ldap.parser;
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.util.ArrayList;
+import java.util.List;
+import java.io.StringReader;
+import javax.naming.directory.SearchControls;
+import org.apache.harmony.jndi.provider.ldap.Filter;
+import org.apache.harmony.jndi.provider.ldap.asn1.Utils;
+
+public class LdapUrlParser implements LdapUrlParserConstants {
+    private SearchControls controls;
+
+    private Filter filter;
+
+    private String baseObject;
+
+    private String host;
+
+    private int port = -1;
+
+    private boolean isEndEOF = false;
+
+    public LdapUrlParser(String url) {
+        this(new StringReader(url));
+        isEndEOF = true;
+    }
+
+    public SearchControls getControls() {
+        return controls;
+    }
+
+    public Filter getFilter() {
+        return filter;
+    }
+
+    private String convertToUtf8Char(String s) {
+        byte[] bs = new byte[] { (byte)Integer.parseInt(s, 16) };
+        return Utils.getString(bs);
+    }
+
+    /**
+     * get the host part of the url, if host part is omitted, <code>null</code>
+     * will be return
+     * 
+     * @return host part of the url or <code>null</code> if it's omitted
+     */
+    public String getHost() {
+        return host;
+    }
+
+    /**
+     * get the port number of the url, if this part is omitted, -1 will be
+     * return
+     * 
+     * @return port number of the url or -1 if it's omitted
+     */
+    public int getPort() {
+        return port;
+    }
+
+    public String getBaseObject() {
+        return baseObject;
+    }
+
+    public static void main(String args[]) throws ParseException, FileNotFoundException {
+        LdapUrlParser parser = new LdapUrlParser(new FileInputStream("parser.url.test"));
+//        URLParser parser = new URLParser(System.in);
+        //  FilterParser parser = new FilterParser(System.in);
+        //System.out.println(parser.value());
+        parser.test();
+        //parser.value();
+    }
+
+  final public void parseURL() throws ParseException {
+    jj_consume_token(SCHEME);
+    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+    case SCHEME:
+    case PRE_XTOKEN:
+    case SCOPE:
+    case PERCENT:
+    case PERIOD:
+    case EXCLAM_MARK:
+    case EQUAL:
+    case HEX_CHAR:
+    case NOHEX_CHAR:
+    case DIGIT:
+    case ZERO:
+    case CHAR:
+      hostport();
+      break;
+    default:
+      jj_la1[0] = jj_gen;
+      ;
+    }
+    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+    case SLASH:
+      jj_consume_token(SLASH);
+      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+      case SCHEME:
+      case PRE_XTOKEN:
+      case SCOPE:
+      case PERCENT:
+      case PERIOD:
+      case EXCLAM_MARK:
+      case EQUAL:
+      case HEX_CHAR:
+      case NOHEX_CHAR:
+      case DIGIT:
+      case ZERO:
+      case CHAR:
+        dn();
+        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+        case QUESTION_MARK:
+          jj_consume_token(QUESTION_MARK);
+          attributes();
+          break;
+        default:
+          jj_la1[1] = jj_gen;
+          ;
+        }
+        break;
+      default:
+        jj_la1[2] = jj_gen;
+        ;
+      }
+      break;
+    default:
+      jj_la1[3] = jj_gen;
+      ;
+    }
+                if (isEndEOF) {
+                    eof();
+                }
+  }
+
+  final public void eof() throws ParseException {
+    jj_consume_token(0);
+  }
+
+  final public String number() throws ParseException {
+            StringBuilder value = new StringBuilder();
+            Token t;
+    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+    case ZERO:
+      t = jj_consume_token(ZERO);
+                         value.append(t.image);
+      break;
+    case DIGIT:
+      t = jj_consume_token(DIGIT);
+                            value.append(t.image);
+      label_1:
+      while (true) {
+        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+        case DIGIT:
+        case ZERO:
+          ;
+          break;
+        default:
+          jj_la1[4] = jj_gen;
+          break label_1;
+        }
+        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+        case ZERO:
+          t = jj_consume_token(ZERO);
+                            value.append(t.image);
+          break;
+        case DIGIT:
+          t = jj_consume_token(DIGIT);
+                             value.append(t.image);
+          break;
+        default:
+          jj_la1[5] = jj_gen;
+          jj_consume_token(-1);
+          throw new ParseException();
+        }
+      }
+      break;
+    default:
+      jj_la1[6] = jj_gen;
+      jj_consume_token(-1);
+      throw new ParseException();
+    }
+             {if (true) return value.toString();}
+    throw new Error("Missing return statement in function");
+  }
+
+  final public String hexDigit() throws ParseException {
+            String value;
+            Token t;
+    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+    case HEX_CHAR:
+      t = jj_consume_token(HEX_CHAR);
+      break;
+    case DIGIT:
+      t = jj_consume_token(DIGIT);
+      break;
+    case ZERO:
+      t = jj_consume_token(ZERO);
+      break;
+    default:
+      jj_la1[7] = jj_gen;
+      jj_consume_token(-1);
+      throw new ParseException();
+    }
+                                                          value = t.image;
+    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+    case HEX_CHAR:
+      t = jj_consume_token(HEX_CHAR);
+      break;
+    case DIGIT:
+      t = jj_consume_token(DIGIT);
+      break;
+    case ZERO:
+      t = jj_consume_token(ZERO);
+      break;
+    default:
+      jj_la1[8] = jj_gen;
+      jj_consume_token(-1);
+      throw new ParseException();
+    }
+                                                          value += t.image;
+             {if (true) return value;}
+    throw new Error("Missing return statement in function");
+  }
+
+  final public String value() throws ParseException {
+            StringBuilder value = new StringBuilder();
+            String ch;
+    label_2:
+    while (true) {
+      ch = ch();
+                        value.append(ch);
+      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+      case SCHEME:
+      case PRE_XTOKEN:
+      case SCOPE:
+      case PERCENT:
+      case PERIOD:
+      case EXCLAM_MARK:
+      case EQUAL:
+      case HEX_CHAR:
+      case NOHEX_CHAR:
+      case DIGIT:
+      case ZERO:
+      case CHAR:
+        ;
+        break;
+      default:
+        jj_la1[9] = jj_gen;
+        break label_2;
+      }
+    }
+             {if (true) return value.toString();}
+    throw new Error("Missing return statement in function");
+  }
+
+  final public String ch() throws ParseException {
+            Token t;
+            String value;
+            String temp;
+    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+    case CHAR:
+      t = jj_consume_token(CHAR);
+                         value = t.image;
+      break;
+    case PERCENT:
+      t = jj_consume_token(PERCENT);
+      value = hexDigit();
+                                                 value = convertToUtf8Char(value);
+      break;
+    case ZERO:
+      t = jj_consume_token(ZERO);
+                           value = t.image;
+      break;
+    case DIGIT:
+      t = jj_consume_token(DIGIT);
+                            value = t.image;
+      break;
+    case HEX_CHAR:
+      t = jj_consume_token(HEX_CHAR);
+                               value = t.image;
+      break;
+    case NOHEX_CHAR:
+      t = jj_consume_token(NOHEX_CHAR);
+                                 value = t.image;
+      break;
+    case SCHEME:
+      t = jj_consume_token(SCHEME);
+                             value = t.image;
+      break;
+    case EQUAL:
+      t = jj_consume_token(EQUAL);
+                            value = t.image;
+      break;
+    case PERIOD:
+      t = jj_consume_token(PERIOD);
+                             value = t.image;
+      break;
+    case EXCLAM_MARK:
+      t = jj_consume_token(EXCLAM_MARK);
+                                  value = t.image;
+      break;
+    case SCOPE:
+      t = jj_consume_token(SCOPE);
+                            value = t.image;
+      break;
+    case PRE_XTOKEN:
+      t = jj_consume_token(PRE_XTOKEN);
+                                 value = t.image;
+      break;
+    default:
+      jj_la1[10] = jj_gen;
+      jj_consume_token(-1);
+      throw new ParseException();
+    }
+             {if (true) return value;}
+    throw new Error("Missing return statement in function");
+  }
+
+  final public void hostport() throws ParseException {
+            String ch;
+            StringBuilder h = new StringBuilder();
+    label_3:
+    while (true) {
+      ch = ch();
+                        h.append(ch);
+      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+      case SCHEME:
+      case PRE_XTOKEN:
+      case SCOPE:
+      case PERCENT:
+      case PERIOD:
+      case EXCLAM_MARK:
+      case EQUAL:
+      case HEX_CHAR:
+      case NOHEX_CHAR:
+      case DIGIT:
+      case ZERO:
+      case CHAR:
+        ;
+        break;
+      default:
+        jj_la1[11] = jj_gen;
+        break label_3;
+      }
+    }
+                                          host = h.toString();
+    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+    case COLON:
+      jj_consume_token(COLON);
+      ch = number();
+                                    port = Integer.valueOf(ch);
+      break;
+    default:
+      jj_la1[12] = jj_gen;
+      ;
+    }
+  }
+
+  final public void dn() throws ParseException {
+            Token t;
+            String value;
+            StringBuilder dn = new StringBuilder();
+    value = value();
+                              dn.append(value);
+    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+    case COMMA:
+      label_4:
+      while (true) {
+        t = jj_consume_token(COMMA);
+                           dn.append(t.image);
+        value = value();
+                                                                 dn.append(value);
+        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+        case COMMA:
+          ;
+          break;
+        default:
+          jj_la1[13] = jj_gen;
+          break label_4;
+        }
+      }
+      break;
+    default:
+      jj_la1[14] = jj_gen;
+      ;
+    }
+                baseObject = dn.toString();
+  }
+
+  final public void attributes() throws ParseException {
+            String value;
+            List attrs = new ArrayList();
+    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+    case SCHEME:
+    case PRE_XTOKEN:
+    case SCOPE:
+    case PERCENT:
+    case PERIOD:
+    case EXCLAM_MARK:
+    case EQUAL:
+    case HEX_CHAR:
+    case NOHEX_CHAR:
+    case DIGIT:
+    case ZERO:
+    case CHAR:
+      value = value();
+                              attrs.add(value);
+      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+      case COMMA:
+        label_5:
+        while (true) {
+          jj_consume_token(COMMA);
+          value = value();
+                                        attrs.add(value);
+          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+          case COMMA:
+            ;
+            break;
+          default:
+            jj_la1[15] = jj_gen;
+            break label_5;
+          }
+        }
+        break;
+      default:
+        jj_la1[16] = jj_gen;
+        ;
+      }
+      break;
+    default:
+      jj_la1[17] = jj_gen;
+      ;
+    }
+                if (attrs.size() != 0) {
+                    if (controls == null) {
+                        // FIXME: test what default search parameter value is
+                        controls = new SearchControls(SearchControls.OBJECT_SCOPE, 0, 0, null, false, false);
+                    }
+                    controls.setReturningAttributes((String[]) attrs.toArray(new String[0]));
+                }
+    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+    case QUESTION_MARK:
+      jj_consume_token(QUESTION_MARK);
+      scope();
+      break;
+    default:
+      jj_la1[18] = jj_gen;
+      ;
+    }
+  }
+
+  final public void attrDescr() throws ParseException {
+    value();
+  }
+
+  final public void scope() throws ParseException {
+            Token t;
+            String scope;
+    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+    case SCOPE:
+      t = jj_consume_token(SCOPE);
+                    scope = t.image;
+                    if (controls == null) {
+                        // FIXME: test what default search parameter value is
+                        controls = new SearchControls(SearchControls.OBJECT_SCOPE, 0, 0, null, false, false);
+                    }
+                    if (scope.equals("base")) {
+                        controls.setSearchScope(SearchControls.OBJECT_SCOPE);
+                    } else if (scope.equals("one")) {
+                        controls.setSearchScope(SearchControls.ONELEVEL_SCOPE);
+                    } else {
+                        controls.setSearchScope(SearchControls.SUBTREE_SCOPE);
+                    }
+      break;
+    default:
+      jj_la1[19] = jj_gen;
+      ;
+    }
+    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+    case QUESTION_MARK:
+      jj_consume_token(QUESTION_MARK);
+      filter();
+      break;
+    default:
+      jj_la1[20] = jj_gen;
+      ;
+    }
+  }
+
+  final public void filter() throws ParseException {
+            String value;
+    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+    case SCHEME:
+    case PRE_XTOKEN:
+    case SCOPE:
+    case PERCENT:
+    case PERIOD:
+    case EXCLAM_MARK:
+    case EQUAL:
+    case HEX_CHAR:
+    case NOHEX_CHAR:
+    case DIGIT:
+    case ZERO:
+    case CHAR:
+      value = value();
+                    FilterParser parser = new FilterParser(new StringReader(value));
+                    filter = parser.parse();
+      break;
+    default:
+      jj_la1[21] = jj_gen;
+      ;
+    }
+    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+    case QUESTION_MARK:
+      jj_consume_token(QUESTION_MARK);
+      extensions();
+      break;
+    default:
+      jj_la1[22] = jj_gen;
+      ;
+    }
+  }
+
+  final public void extensions() throws ParseException {
+    extension();
+    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+    case COMMA:
+      label_6:
+      while (true) {
+        jj_consume_token(COMMA);
+        extension();
+        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+        case COMMA:
+          ;
+          break;
+        default:
+          jj_la1[23] = jj_gen;
+          break label_6;
+        }
+      }
+      break;
+    default:
+      jj_la1[24] = jj_gen;
+      ;
+    }
+  }
+
+  final public void extension() throws ParseException {
+    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+    case EXCLAM_MARK:
+      jj_consume_token(EXCLAM_MARK);
+      break;
+    default:
+      jj_la1[25] = jj_gen;
+      ;
+    }
+    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+    case DIGIT:
+    case ZERO:
+      oid();
+      break;
+    case PRE_XTOKEN:
+      jj_consume_token(PRE_XTOKEN);
+      oid();
+      break;
+    default:
+      jj_la1[26] = jj_gen;
+      jj_consume_token(-1);
+      throw new ParseException();
+    }
+    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+    case EQUAL:
+      jj_consume_token(EQUAL);
+      value();
+      break;
+    default:
+      jj_la1[27] = jj_gen;
+      ;
+    }
+  }
+
+  final public String oid() throws ParseException {
+            StringBuilder value = new StringBuilder();
+            String number = null;
+            Token t = null;
+    number = number();
+                               value.append(number);
+    label_7:
+    while (true) {
+      t = jj_consume_token(PERIOD);
+                               value.append(t.image);
+      number = number();
+                                    value.append(number);
+      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+      case PERIOD:
+        ;
+        break;
+      default:
+        jj_la1[28] = jj_gen;
+        break label_7;
+      }
+    }
+             {if (true) return value.toString();}
+    throw new Error("Missing return statement in function");
+  }
+
+  final public void test() throws ParseException {
+    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+    case SCHEME:
+      parseURL();
+      jj_consume_token(17);
+      test();
+      break;
+    default:
+      jj_la1[29] = jj_gen;
+      if (jj_2_1(2)) {
+        jj_consume_token(17);
+      } else {
+        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+        case 17:
+          jj_consume_token(17);
+          jj_consume_token(0);
+          break;
+        case 0:
+          jj_consume_token(0);
+          break;
+        default:
+          jj_la1[30] = jj_gen;
+          jj_consume_token(-1);
+          throw new ParseException();
+        }
+      }
+    }
+  }
+
+  final private boolean jj_2_1(int xla) {
+    jj_la = xla; jj_lastpos = jj_scanpos = token;
+    try { return !jj_3_1(); }
+    catch(LookaheadSuccess ls) { return true; }
+    finally { jj_save(0, xla); }
+  }
+
+  final private boolean jj_3_1() {
+    if (jj_scan_token(17)) return true;
+    return false;
+  }
+
+  public LdapUrlParserTokenManager 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;
+  private int jj_gen;
+  final private int[] jj_la1 = new int[31];
+  static private int[] jj_la1_0;
+  static {
+      jj_la1_0();
+   }
+   private static void jj_la1_0() {
+      jj_la1_0 = new int[] {0x1fe8e,0x20,0x1fe8e,0x40,0xc000,0xc000,0xc000,0xd000,0xd000,0x1fe8e,0x1fe8e,0x1fe8e,0x100,0x10,0x10,0x10,0x10,0x1fe8e,0x20,0x8,0x20,0x1fe8e,0x20,0x10,0x10,0x400,0xc004,0x800,0x200,0x2,0x20001,};
+   }
+  final private JJCalls[] jj_2_rtns = new JJCalls[1];
+  private boolean jj_rescan = false;
+  private int jj_gc = 0;
+
+  public LdapUrlParser(java.io.InputStream stream) {
+    jj_input_stream = new SimpleCharStream(stream, 1, 1);
+    token_source = new LdapUrlParserTokenManager(jj_input_stream);
+    token = new Token();
+    jj_ntk = -1;
+    jj_gen = 0;
+    for (int i = 0; i < 31; i++) jj_la1[i] = -1;
+    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
+  }
+
+  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;
+    jj_gen = 0;
+    for (int i = 0; i < 31; i++) jj_la1[i] = -1;
+    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
+  }
+
+  public LdapUrlParser(java.io.Reader stream) {
+    jj_input_stream = new SimpleCharStream(stream, 1, 1);
+    token_source = new LdapUrlParserTokenManager(jj_input_stream);
+    token = new Token();
+    jj_ntk = -1;
+    jj_gen = 0;
+    for (int i = 0; i < 31; i++) jj_la1[i] = -1;
+    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
+  }
+
+  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;
+    jj_gen = 0;
+    for (int i = 0; i < 31; i++) jj_la1[i] = -1;
+    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
+  }
+
+  public LdapUrlParser(LdapUrlParserTokenManager tm) {
+    token_source = tm;
+    token = new Token();
+    jj_ntk = -1;
+    jj_gen = 0;
+    for (int i = 0; i < 31; i++) jj_la1[i] = -1;
+    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
+  }
+
+  public void ReInit(LdapUrlParserTokenManager tm) {
+    token_source = tm;
+    token = new Token();
+    jj_ntk = -1;
+    jj_gen = 0;
+    for (int i = 0; i < 31; i++) jj_la1[i] = -1;
+    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
+  }
+
+  final 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) {
+      jj_gen++;
+      if (++jj_gc > 100) {
+        jj_gc = 0;
+        for (int i = 0; i < jj_2_rtns.length; i++) {
+          JJCalls c = jj_2_rtns[i];
+          while (c != null) {
+            if (c.gen < jj_gen) c.first = null;
+            c = c.next;
+          }
+        }
+      }
+      return token;
+    }
+    token = oldToken;
+    jj_kind = kind;
+    throw generateParseException();
+  }
+
+  static private final class LookaheadSuccess extends java.lang.Error { }
+  final private LookaheadSuccess jj_ls = new LookaheadSuccess();
+  final 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;
+    }
+    if (jj_rescan) {
+      int i = 0; Token tok = token;
+      while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; }
+      if (tok != null) jj_add_error_token(kind, i);
+    }
+    if (jj_scanpos.kind != kind) return true;
+    if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls;
+    return false;
+  }
+
+  final public Token getNextToken() {
+    if (token.next != null) token = token.next;
+    else token = token.next = token_source.getNextToken();
+    jj_ntk = -1;
+    jj_gen++;
+    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;
+  }
+
+  final 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);
+  }
+
+  private java.util.Vector jj_expentries = new java.util.Vector();
+  private int[] jj_expentry;
+  private int jj_kind = -1;
+  private int[] jj_lasttokens = new int[100];
+  private int jj_endpos;
+
+  private void jj_add_error_token(int kind, int pos) {
+    if (pos >= 100) return;
+    if (pos == jj_endpos + 1) {
+      jj_lasttokens[jj_endpos++] = kind;
+    } else if (jj_endpos != 0) {
+      jj_expentry = new int[jj_endpos];
+      for (int i = 0; i < jj_endpos; i++) {
+        jj_expentry[i] = jj_lasttokens[i];
+      }
+      boolean exists = false;
+      for (java.util.Enumeration e = jj_expentries.elements(); e.hasMoreElements();) {
+        int[] oldentry = (int[])(e.nextElement());
+        if (oldentry.length == jj_expentry.length) {
+          exists = true;
+          for (int i = 0; i < jj_expentry.length; i++) {
+            if (oldentry[i] != jj_expentry[i]) {
+              exists = false;
+              break;
+            }
+          }
+          if (exists) break;
+        }
+      }
+      if (!exists) jj_expentries.addElement(jj_expentry);
+      if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind;
+    }
+  }
+
+  public ParseException generateParseException() {
+    jj_expentries.removeAllElements();
+    boolean[] la1tokens = new boolean[18];
+    for (int i = 0; i < 18; i++) {
+      la1tokens[i] = false;
+    }
+    if (jj_kind >= 0) {
+      la1tokens[jj_kind] = true;
+      jj_kind = -1;
+    }
+    for (int i = 0; i < 31; i++) {
+      if (jj_la1[i] == jj_gen) {
+        for (int j = 0; j < 32; j++) {
+          if ((jj_la1_0[i] & (1<<j)) != 0) {
+            la1tokens[j] = true;
+          }
+        }
+      }
+    }
+    for (int i = 0; i < 18; i++) {
+      if (la1tokens[i]) {
+        jj_expentry = new int[1];
+        jj_expentry[0] = i;
+        jj_expentries.addElement(jj_expentry);
+      }
+    }
+    jj_endpos = 0;
+    jj_rescan_token();
+    jj_add_error_token(0, 0);
+    int[][] exptokseq = new int[jj_expentries.size()][];
+    for (int i = 0; i < jj_expentries.size(); i++) {
+      exptokseq[i] = (int[])jj_expentries.elementAt(i);
+    }
+    return new ParseException(token, exptokseq, tokenImage);
+  }
+
+  final public void enable_tracing() {
+  }
+
+  final public void disable_tracing() {
+  }
+
+  final private void jj_rescan_token() {
+    jj_rescan = true;
+    for (int i = 0; i < 1; i++) {
+      JJCalls p = jj_2_rtns[i];
+      do {
+        if (p.gen > jj_gen) {
+          jj_la = p.arg; jj_lastpos = jj_scanpos = p.first;
+          switch (i) {
+            case 0: jj_3_1(); break;
+          }
+        }
+        p = p.next;
+      } while (p != null);
+    }
+    jj_rescan = false;
+  }
+
+  final private void jj_save(int index, int xla) {
+    JJCalls p = jj_2_rtns[index];
+    while (p.gen > jj_gen) {
+      if (p.next == null) { p = p.next = new JJCalls(); break; }
+      p = p.next;
+    }
+    p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla;
+  }
+
+  static final class JJCalls {
+    int gen;
+    Token first;
+    int arg;
+    JJCalls next;
+  }
+
+}

Propchange: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/ldap/parser/LdapUrlParser.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/ldap/parser/LdapUrlParserConstants.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/ldap/parser/LdapUrlParserConstants.java?rev=591934&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/ldap/parser/LdapUrlParserConstants.java (added)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/ldap/parser/LdapUrlParserConstants.java Mon Nov  5 01:36:36 2007
@@ -0,0 +1,64 @@
+/* 
+ *  Licensed to the Apache Software Foundation (ASF) under one or more 
+ *  contributor license agreements.  See the NOTICE file distributed with 
+ *  this work for additional information regarding copyright ownership. 
+ *  The ASF licenses this file to You under the Apache License, Version 2.0 
+ *  (the "License"); you may not use this file except in compliance with 
+ *  the License.  You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0 
+ * 
+ *  Unless required by applicable law or agreed to in writing, software 
+ *  distributed under the License is distributed on an "AS IS" BASIS, 
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ *  See the License for the specific language governing permissions and 
+ *  limitations under the License. 
+ */
+/* Generated By:JavaCC: Do not edit this line. LdapUrlParserConstants.java */
+
+package org.apache.harmony.jndi.provider.ldap.parser;
+
+public interface LdapUrlParserConstants {
+
+  int EOF = 0;
+  int SCHEME = 1;
+  int PRE_XTOKEN = 2;
+  int SCOPE = 3;
+  int COMMA = 4;
+  int QUESTION_MARK = 5;
+  int SLASH = 6;
+  int PERCENT = 7;
+  int COLON = 8;
+  int PERIOD = 9;
+  int EXCLAM_MARK = 10;
+  int EQUAL = 11;
+  int HEX_CHAR = 12;
+  int NOHEX_CHAR = 13;
+  int DIGIT = 14;
+  int ZERO = 15;
+  int CHAR = 16;
+
+  int DEFAULT = 0;
+
+  String[] tokenImage = {
+    "<EOF>",
+    "<SCHEME>",
+    "<PRE_XTOKEN>",
+    "<SCOPE>",
+    "\",\"",
+    "\"?\"",
+    "\"/\"",
+    "\"%\"",
+    "\":\"",
+    "\".\"",
+    "\"!\"",
+    "\"=\"",
+    "<HEX_CHAR>",
+    "<NOHEX_CHAR>",
+    "<DIGIT>",
+    "\"0\"",
+    "<CHAR>",
+    "\"\\n\"",
+  };
+
+}

Propchange: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/ldap/parser/LdapUrlParserConstants.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message