2
* Copyright 2005-2008 the original author or authors.
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
8
* http://www.apache.org/licenses/LICENSE-2.0
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
19
CHOICE_AMBIGUITY_CHECK = 3;
20
OTHER_AMBIGUITY_CHECK = 3;
23
DEBUG_LOOKAHEAD = false;
24
DEBUG_TOKEN_MANAGER = false;
25
ERROR_REPORTING = true;
26
JAVA_UNICODE_ESCAPE = false;
29
USER_TOKEN_MANAGER = false;
30
USER_CHAR_STREAM = false;
32
BUILD_TOKEN_MANAGER = true;
34
FORCE_LA_CHECK = true;
37
PARSER_BEGIN(DnParserImpl)
39
package org.springframework.ldap.core;
41
public class DnParserImpl implements DnParser{
45
PARSER_END(DnParserImpl)
47
TOKEN: { <#ALPHA: ["a"-"z", "A"-"Z"] > }
48
TOKEN: { <#DIGIT: ["0"-"9"]> }
49
TOKEN: { <#STRINGCHAR: ~[",","=","+","<",">","#",";","\\","\""]> }
50
TOKEN: { <#STRINGENDCHAR: ~[",","=","+","<",">","#",";","\\","\""," "]> }
51
TOKEN: { <#SPECIAL: [",","=","\r","+","<",">","#",";"]> }
52
TOKEN: { <#HEXCHAR: ["0"-"9","a"-"f","A"-"F"]> }
53
TOKEN: { <#HEXPAIR: <HEXCHAR> <HEXCHAR>> }
54
TOKEN: { <#BACKSLASHCHAR: "\\"> }
55
TOKEN: { <#PAIR: <BACKSLASHCHAR> (<SPECIAL> | <BACKSLASHCHAR> | <QUOTECHAR> | <HEXPAIR> )> }
56
TOKEN: { <#ESCAPEDSPACE: <BACKSLASHCHAR> <SPACE>>}
57
TOKEN: { <#ESCAPEDSTART: <BACKSLASHCHAR> (<HASHCHAR> | <SPACE>)> }
58
TOKEN: { <#STRINGEND: (<STRINGENDCHAR> | <PAIR> | <ESCAPEDSPACE>)> }
66
<ATTRIBUTE_TYPE_STRING: <ALPHA> (<ALPHA> | <DIGIT> | "-")*>
68
<LDAP_OID: (<DIGIT>)+ ("." (<DIGIT>)+ )* >
76
(<QUOTECHAR> (<STRINGCHAR> | <SPECIAL> | <PAIR>)+ <QUOTECHAR>
78
<HASHCHAR> (<HEXPAIR>)+
80
(<ESCAPEDSTART>)? ( <STRINGCHAR> | <PAIR> )* <STRINGEND>
84
<SPACED_EQUALS_S> TOKEN:
86
<SPACED_EQUALS: (<SPACE>)* "=" (<SPACE>)*>
91
* dn -> rdn ( ( "," | ";" ) rdn )*
92
* rdn -> attributeTypeAndValue ( "+" attributeTypeAndValue )*
93
* attributeTypeAndValue ->
94
* ( <SPACE> )* AttributeType SpacedEquals AttributeValue ( <SPACE> )*
95
* SpacedEquals -> <SPACED_EQUALS>
96
* AttributeType -> <LDAP_OID> | <ATTRIBUTE_TYPE_STRING>
97
* AttributeValue -> <ATTRVALUE>
106
DistinguishedName dn():
108
DistinguishedName dn = new DistinguishedName();
112
( rdn = rdn() {dn.add(0, rdn);} (("," | ";") rdn = rdn() {dn.add(0, rdn);})* )
118
LdapRdnComponent rdnComponent;
119
LdapRdn rdn = new LdapRdn();
122
(rdnComponent = attributeTypeAndValue() {rdn.addComponent(rdnComponent);} ("+" rdnComponent = attributeTypeAndValue() {rdn.addComponent(rdnComponent);})*)
126
LdapRdnComponent attributeTypeAndValue():
128
String attributeType;
132
( (<SPACE>)* attributeType = AttributeType() SpacedEquals() value = AttributeValue() (<SPACE>)*)
133
{return new LdapRdnComponent(attributeType, value, true);}
139
{token_source.SwitchTo(SPACED_EQUALS_S);} <SPACED_EQUALS>
142
String AttributeType():
145
( t = <LDAP_OID> | t = <ATTRIBUTE_TYPE_STRING>)
146
{return t.image.toString();}
149
String AttributeValue():
152
{token_source.SwitchTo(ATTRVALUE_S);} t = <ATTRVALUE> {token_source.SwitchTo(DEFAULT);}
153
{return t.image.toString();}
b'\\ No newline at end of file'