~hudson-ubuntu/ubuntu/natty/libspring-ldap-java/hudson-fix

« back to all changes in this revision

Viewing changes to dist/module-sources/spring-ldap-core/org/springframework/ldap/core/DnParserImpl.jj

  • Committer: Bazaar Package Importer
  • Author(s): Miguel Landaeta
  • Date: 2010-04-16 20:36:56 UTC
  • Revision ID: james.westby@ubuntu.com-20100416203656-nagghgmx5q9qsqop
Tags: 1.3.0.RELEASE-1
Initial release (Closes: #576622),

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 2005-2008 the original author or authors.
 
3
 *
 
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
 
7
 *
 
8
 *      http://www.apache.org/licenses/LICENSE-2.0
 
9
 *
 
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.
 
15
 */
 
16
 
 
17
options {
 
18
  LOOKAHEAD = 1;
 
19
  CHOICE_AMBIGUITY_CHECK = 3;
 
20
  OTHER_AMBIGUITY_CHECK = 3;
 
21
  STATIC = false;
 
22
  DEBUG_PARSER = false;
 
23
  DEBUG_LOOKAHEAD = false;
 
24
  DEBUG_TOKEN_MANAGER = false;
 
25
  ERROR_REPORTING = true;
 
26
  JAVA_UNICODE_ESCAPE = false;
 
27
  UNICODE_INPUT = true;
 
28
  IGNORE_CASE = false;
 
29
  USER_TOKEN_MANAGER = false;
 
30
  USER_CHAR_STREAM = false;
 
31
  BUILD_PARSER = true;
 
32
  BUILD_TOKEN_MANAGER = true;
 
33
  SANITY_CHECK = true;
 
34
  FORCE_LA_CHECK = true;
 
35
}
 
36
 
 
37
PARSER_BEGIN(DnParserImpl)
 
38
 
 
39
package org.springframework.ldap.core;
 
40
 
 
41
public class DnParserImpl implements DnParser{
 
42
 
 
43
}
 
44
 
 
45
PARSER_END(DnParserImpl)
 
46
 
 
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>)> }
 
59
 
 
60
<DEFAULT> TOKEN:
 
61
{
 
62
        <QUOTECHAR: "\"">
 
63
        |
 
64
        <HASHCHAR: "#"> 
 
65
        |
 
66
        <ATTRIBUTE_TYPE_STRING: <ALPHA> (<ALPHA> | <DIGIT> | "-")*>
 
67
        |
 
68
        <LDAP_OID: (<DIGIT>)+ ("." (<DIGIT>)+ )* >
 
69
        |
 
70
        <SPACE: " ">
 
71
}
 
72
 
 
73
<ATTRVALUE_S> TOKEN:
 
74
{
 
75
        <ATTRVALUE: 
 
76
                (<QUOTECHAR> (<STRINGCHAR> | <SPECIAL> | <PAIR>)+ <QUOTECHAR>
 
77
                |
 
78
                <HASHCHAR> (<HEXPAIR>)+
 
79
                |
 
80
                (<ESCAPEDSTART>)? ( <STRINGCHAR> | <PAIR> )* <STRINGEND>
 
81
                )>
 
82
}
 
83
 
 
84
<SPACED_EQUALS_S> TOKEN:
 
85
{
 
86
        <SPACED_EQUALS: (<SPACE>)* "=" (<SPACE>)*>
 
87
}
 
88
 
 
89
/**
 
90
 * input -> dn
 
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>
 
98
 */
 
99
void input() :
 
100
{
 
101
}
 
102
{
 
103
        dn()
 
104
}
 
105
 
 
106
DistinguishedName dn(): 
 
107
{
 
108
DistinguishedName dn = new DistinguishedName();
 
109
LdapRdn rdn;
 
110
}
 
111
{
 
112
        ( rdn = rdn() {dn.add(0, rdn);} (("," | ";") rdn = rdn() {dn.add(0, rdn);})* )
 
113
        {return dn;}
 
114
}
 
115
 
 
116
LdapRdn rdn(): 
 
117
{
 
118
LdapRdnComponent rdnComponent;
 
119
LdapRdn rdn = new LdapRdn();
 
120
}
 
121
{
 
122
        (rdnComponent = attributeTypeAndValue() {rdn.addComponent(rdnComponent);} ("+" rdnComponent = attributeTypeAndValue() {rdn.addComponent(rdnComponent);})*)
 
123
        {return rdn;}
 
124
}
 
125
 
 
126
LdapRdnComponent attributeTypeAndValue(): 
 
127
{
 
128
String attributeType;
 
129
String value;
 
130
}
 
131
{
 
132
        ( (<SPACE>)* attributeType = AttributeType() SpacedEquals() value = AttributeValue() (<SPACE>)*)
 
133
        {return new LdapRdnComponent(attributeType, value, true);}
 
134
}
 
135
 
 
136
void SpacedEquals():
 
137
{}
 
138
{
 
139
        {token_source.SwitchTo(SPACED_EQUALS_S);} <SPACED_EQUALS>
 
140
}
 
141
 
 
142
String AttributeType(): 
 
143
{Token t;}
 
144
{
 
145
        ( t = <LDAP_OID> | t = <ATTRIBUTE_TYPE_STRING>) 
 
146
        {return t.image.toString();}
 
147
}
 
148
 
 
149
String AttributeValue(): 
 
150
{Token t;}
 
151
{
 
152
        {token_source.SwitchTo(ATTRVALUE_S);} t = <ATTRVALUE> {token_source.SwitchTo(DEFAULT);} 
 
153
        {return t.image.toString();}
 
154
}
 
 
b'\\ No newline at end of file'