All Downloads are FREE. Search and download functionalities are using the official Maven repository.

mework.ldap.spring-ldap-core.3.0.3.source-code.DnParserImpl Maven / Gradle / Ivy

/* Generated By:JavaCC: Do not edit this line. DnParserImpl.java */
package org.springframework.ldap.core;

public class DnParserImpl implements DnParser, DnParserImplConstants {

/**
 * input -> dn
 * dn -> rdn ( ( "," | ";" ) rdn )*
 * rdn -> attributeTypeAndValue ( "+" attributeTypeAndValue )*
 * attributeTypeAndValue ->
 *    ( <SPACE> )* AttributeType SpacedEquals AttributeValue ( <SPACE> )*
 * SpacedEquals -> <SPACED_EQUALS>
 * AttributeType -> <LDAP_OID> | <ATTRIBUTE_TYPE_STRING>
 * AttributeValue -> <ATTRVALUE>
 */
  final public void input() throws ParseException {
    dn();
  }

  final public DistinguishedName dn() throws ParseException {
DistinguishedName dn = new DistinguishedName();
LdapRdn rdn;
    rdn = rdn();
                       dn.add(0, rdn);
    label_1:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case 19:
      case 20:
        ;
        break;
      default:
        jj_la1[0] = jj_gen;
        break label_1;
      }
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case 19:
        jj_consume_token(19);
        break;
      case 20:
        jj_consume_token(20);
        break;
      default:
        jj_la1[1] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
      rdn = rdn();
                                                                  dn.add(0, rdn);
    }
         {if (true) return dn;}
    throw new Error("Missing return statement in function");
  }

  final public LdapRdn rdn() throws ParseException {
LdapRdnComponent rdnComponent;
LdapRdn rdn = new LdapRdn();
    rdnComponent = attributeTypeAndValue();
                                                 rdn.addComponent(rdnComponent);
    label_2:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case 21:
        ;
        break;
      default:
        jj_la1[2] = jj_gen;
        break label_2;
      }
      jj_consume_token(21);
      rdnComponent = attributeTypeAndValue();
                                                                                                                               rdn.addComponent(rdnComponent);
    }
         {if (true) return rdn;}
    throw new Error("Missing return statement in function");
  }

  final public LdapRdnComponent attributeTypeAndValue() throws ParseException {
String attributeType;
String value;
    label_3:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case SPACE:
        ;
        break;
      default:
        jj_la1[3] = jj_gen;
        break label_3;
      }
      jj_consume_token(SPACE);
    }
    attributeType = AttributeType();
    SpacedEquals();
    value = AttributeValue();
    label_4:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case SPACE:
        ;
        break;
      default:
        jj_la1[4] = jj_gen;
        break label_4;
      }
      jj_consume_token(SPACE);
    }
         {if (true) return new LdapRdnComponent(attributeType, value, true);}
    throw new Error("Missing return statement in function");
  }

  final public void SpacedEquals() throws ParseException {
         token_source.SwitchTo(SPACED_EQUALS_S);
    jj_consume_token(SPACED_EQUALS);
  }

  final public String AttributeType() throws ParseException {
 Token t;
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case LDAP_OID:
      t = jj_consume_token(LDAP_OID);
      break;
    case ATTRIBUTE_TYPE_STRING:
      t = jj_consume_token(ATTRIBUTE_TYPE_STRING);
      break;
    default:
      jj_la1[5] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
         {if (true) return t.image.toString();}
    throw new Error("Missing return statement in function");
  }

  final public String AttributeValue() throws ParseException {
 Token t;
         token_source.SwitchTo(ATTRVALUE_S);
    t = jj_consume_token(ATTRVALUE);
                                                               token_source.SwitchTo(DEFAULT);
         {if (true) return t.image.toString();}
    throw new Error("Missing return statement in function");
  }

  /** Generated Token Manager. */
  public DnParserImplTokenManager token_source;
  SimpleCharStream jj_input_stream;
  /** Current token. */
  public Token token;
  /** Next token. */
  public Token jj_nt;
  private int jj_ntk;
  private int jj_gen;
  final private int[] jj_la1 = new int[6];
  static private int[] jj_la1_0;
  static {
      jj_la1_init_0();
   }
   private static void jj_la1_init_0() {
      jj_la1_0 = new int[] {0x180000,0x180000,0x200000,0x10000,0x10000,0xc000,};
   }

  /** Constructor with InputStream. */
  public DnParserImpl(java.io.InputStream stream) {
     this(stream, null);
  }
  /** Constructor with InputStream and supplied encoding */
  public DnParserImpl(java.io.InputStream stream, String encoding) {
    try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
    token_source = new DnParserImplTokenManager(jj_input_stream);
    token = new Token();
    jj_ntk = -1;
    jj_gen = 0;
    for (int i = 0; i < 6; i++) jj_la1[i] = -1;
  }

  /** Reinitialise. */
  public void ReInit(java.io.InputStream stream) {
     ReInit(stream, null);
  }
  /** Reinitialise. */
  public void ReInit(java.io.InputStream stream, String encoding) {
    try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
    token_source.ReInit(jj_input_stream);
    token = new Token();
    jj_ntk = -1;
    jj_gen = 0;
    for (int i = 0; i < 6; i++) jj_la1[i] = -1;
  }

  /** Constructor. */
  public DnParserImpl(java.io.Reader stream) {
    jj_input_stream = new SimpleCharStream(stream, 1, 1);
    token_source = new DnParserImplTokenManager(jj_input_stream);
    token = new Token();
    jj_ntk = -1;
    jj_gen = 0;
    for (int i = 0; i < 6; i++) jj_la1[i] = -1;
  }

  /** Reinitialise. */
  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 < 6; i++) jj_la1[i] = -1;
  }

  /** Constructor with generated Token Manager. */
  public DnParserImpl(DnParserImplTokenManager tm) {
    token_source = tm;
    token = new Token();
    jj_ntk = -1;
    jj_gen = 0;
    for (int i = 0; i < 6; i++) jj_la1[i] = -1;
  }

  /** Reinitialise. */
  public void ReInit(DnParserImplTokenManager tm) {
    token_source = tm;
    token = new Token();
    jj_ntk = -1;
    jj_gen = 0;
    for (int i = 0; i < 6; i++) jj_la1[i] = -1;
  }

  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++;
      return token;
    }
    token = oldToken;
    jj_kind = kind;
    throw generateParseException();
  }


/** Get the next Token. */
  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;
  }

/** Get the specific Token. */
  final public Token getToken(int index) {
    Token t = token;
    for (int i = 0; i < index; i++) {
      if (t.next != null) t = t.next;
      else t = t.next = token_source.getNextToken();
    }
    return t;
  }

  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.List jj_expentries = new java.util.ArrayList();
  private int[] jj_expentry;
  private int jj_kind = -1;

  /** Generate ParseException. */
  public ParseException generateParseException() {
    jj_expentries.clear();
    boolean[] la1tokens = new boolean[22];
    if (jj_kind >= 0) {
      la1tokens[jj_kind] = true;
      jj_kind = -1;
    }
    for (int i = 0; i < 6; i++) {
      if (jj_la1[i] == jj_gen) {
        for (int j = 0; j < 32; j++) {
          if ((jj_la1_0[i] & (1<




© 2015 - 2024 Weber Informatics LLC | Privacy Policy