File: 02_add_parser_definition.diff

package info (click to toggle)
libspring-ldap-java 1.3.1.RELEASE-4
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 2,876 kB
  • sloc: java: 12,509; xml: 4,104; jsp: 36; makefile: 31; sh: 13
file content (167 lines) | stat: -rw-r--r-- 4,702 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
Author: Miguel Landaeta <miguel@miguel.cc>
Subject: parser definition file was missing from source code

For some reason, upstream did not include this file in the sources,
so I had to fetch this from their svn repo.

diff --git a/dist/module-sources/spring-ldap-core/org/springframework/ldap/core/DnParserImpl.jj b/dist/module-sources/spring-ldap-core/org/springframework/ldap/core/DnParserImpl.jj
new file mode 100644
index 0000000..494539a
--- /dev/null
+++ b/dist/module-sources/spring-ldap-core/org/springframework/ldap/core/DnParserImpl.jj
@@ -0,0 +1,154 @@
+/*
+ * Copyright 2005-2008 the original author or authors.
+ *
+ * Licensed 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.
+ */
+
+options {
+  LOOKAHEAD = 1;
+  CHOICE_AMBIGUITY_CHECK = 3;
+  OTHER_AMBIGUITY_CHECK = 3;
+  STATIC = false;
+  DEBUG_PARSER = false;
+  DEBUG_LOOKAHEAD = false;
+  DEBUG_TOKEN_MANAGER = false;
+  ERROR_REPORTING = true;
+  JAVA_UNICODE_ESCAPE = false;
+  UNICODE_INPUT = true;
+  IGNORE_CASE = false;
+  USER_TOKEN_MANAGER = false;
+  USER_CHAR_STREAM = false;
+  BUILD_PARSER = true;
+  BUILD_TOKEN_MANAGER = true;
+  SANITY_CHECK = true;
+  FORCE_LA_CHECK = true;
+}
+
+PARSER_BEGIN(DnParserImpl)
+
+package org.springframework.ldap.core;
+
+public class DnParserImpl implements DnParser{
+
+}
+
+PARSER_END(DnParserImpl)
+
+TOKEN: { <#ALPHA: ["a"-"z", "A"-"Z"] > }
+TOKEN: { <#DIGIT: ["0"-"9"]> }
+TOKEN: { <#STRINGCHAR: ~[",","=","+","<",">","#",";","\\","\""]> }
+TOKEN: { <#STRINGENDCHAR: ~[",","=","+","<",">","#",";","\\","\""," "]> }
+TOKEN: { <#SPECIAL: [",","=","\r","+","<",">","#",";"]> }
+TOKEN: { <#HEXCHAR: ["0"-"9","a"-"f","A"-"F"]> }
+TOKEN: { <#HEXPAIR: <HEXCHAR> <HEXCHAR>> }
+TOKEN: { <#BACKSLASHCHAR: "\\"> }
+TOKEN: { <#PAIR: <BACKSLASHCHAR> (<SPECIAL> | <BACKSLASHCHAR> | <QUOTECHAR> | <HEXPAIR> )> }
+TOKEN: { <#ESCAPEDSPACE: <BACKSLASHCHAR> <SPACE>>}
+TOKEN: { <#ESCAPEDSTART: <BACKSLASHCHAR> (<HASHCHAR> | <SPACE>)> }
+TOKEN: { <#STRINGEND: (<STRINGENDCHAR> | <PAIR> | <ESCAPEDSPACE>)> }
+
+<DEFAULT> TOKEN:
+{
+	<QUOTECHAR: "\"">
+	|
+	<HASHCHAR: "#"> 
+	|
+	<ATTRIBUTE_TYPE_STRING: <ALPHA> (<ALPHA> | <DIGIT> | "-")*>
+	|
+	<LDAP_OID: (<DIGIT>)+ ("." (<DIGIT>)+ )* >
+	|
+	<SPACE: " ">
+}
+
+<ATTRVALUE_S> TOKEN:
+{
+	<ATTRVALUE: 
+		(<QUOTECHAR> (<STRINGCHAR> | <SPECIAL> | <PAIR>)+ <QUOTECHAR>
+		|
+		<HASHCHAR> (<HEXPAIR>)+
+		|
+		(<ESCAPEDSTART>)? ( <STRINGCHAR> | <PAIR> )* <STRINGEND>
+		)>
+}
+
+<SPACED_EQUALS_S> TOKEN:
+{
+	<SPACED_EQUALS: (<SPACE>)* "=" (<SPACE>)*>
+}
+
+/**
+ * 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>
+ */
+void input() :
+{
+}
+{
+	dn()
+}
+
+DistinguishedName dn(): 
+{
+DistinguishedName dn = new DistinguishedName();
+LdapRdn rdn;
+}
+{
+	( rdn = rdn() {dn.add(0, rdn);} (("," | ";") rdn = rdn() {dn.add(0, rdn);})* )
+	{return dn;}
+}
+
+LdapRdn rdn(): 
+{
+LdapRdnComponent rdnComponent;
+LdapRdn rdn = new LdapRdn();
+}
+{
+	(rdnComponent = attributeTypeAndValue() {rdn.addComponent(rdnComponent);} ("+" rdnComponent = attributeTypeAndValue() {rdn.addComponent(rdnComponent);})*)
+	{return rdn;}
+}
+
+LdapRdnComponent attributeTypeAndValue(): 
+{
+String attributeType;
+String value;
+}
+{
+	( (<SPACE>)* attributeType = AttributeType() SpacedEquals() value = AttributeValue() (<SPACE>)*)
+	{return new LdapRdnComponent(attributeType, value, true);}
+}
+
+void SpacedEquals():
+{}
+{
+	{token_source.SwitchTo(SPACED_EQUALS_S);} <SPACED_EQUALS>
+}
+
+String AttributeType(): 
+{Token t;}
+{
+	( t = <LDAP_OID> | t = <ATTRIBUTE_TYPE_STRING>) 
+	{return t.image.toString();}
+}
+
+String AttributeValue(): 
+{Token t;}
+{
+	{token_source.SwitchTo(ATTRVALUE_S);} t = <ATTRVALUE> {token_source.SwitchTo(DEFAULT);} 
+	{return t.image.toString();}
+}
\ No newline at end of file