KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > directory > ldapstudio > browser > core > model > schema > parser > SchemaValueParser


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied. See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  *
19  */

20
21 // $ANTLR 2.7.5 (20050128): "schemavalue.g" -> "SchemaValueParser.java"$
22
package org.apache.directory.ldapstudio.browser.core.model.schema.parser;
23
24
25 import java.util.*;
26
27 import antlr.TokenBuffer;
28 import antlr.TokenStreamException;
29 import antlr.TokenStreamIOException;
30 import antlr.ANTLRException;
31 import antlr.LLkParser;
32 import antlr.Token;
33 import antlr.TokenStream;
34 import antlr.RecognitionException;
35 import antlr.NoViableAltException;
36 import antlr.MismatchedTokenException;
37 import antlr.SemanticException;
38 import antlr.ParserSharedInputState;
39 import antlr.collections.impl.BitSet;
40
41
42 public class SchemaValueParser extends antlr.LLkParser implements SchemaValueTokenTypes
43 {
44
45     protected SchemaValueParser( TokenBuffer tokenBuf, int k )
46     {
47         super( tokenBuf, k );
48         tokenNames = _tokenNames;
49     }
50
51
52     public SchemaValueParser( TokenBuffer tokenBuf )
53     {
54         this( tokenBuf, 3 );
55     }
56
57
58     protected SchemaValueParser( TokenStream lexer, int k )
59     {
60         super( lexer, k );
61         tokenNames = _tokenNames;
62     }
63
64
65     public SchemaValueParser( TokenStream lexer )
66     {
67         this( lexer, 3 );
68     }
69
70
71     public SchemaValueParser( ParserSharedInputState state )
72     {
73         super( state, 3 );
74         tokenNames = _tokenNames;
75     }
76
77
78     public final String JavaDoc[] oids() throws RecognitionException, TokenStreamException
79     {
80         String JavaDoc[] oids;
81
82         oids = new String JavaDoc[0];
83         List oidList = new ArrayList();
84         String JavaDoc oid = null;
85
86         {
87             switch ( LA( 1 ) )
88             {
89                 case NUMERICOID:
90                 case DESCR:
91                 {
92                     {
93                         oid = oid();
94                         oidList.add( oid );
95                     }
96                     break;
97                 }
98                 case LPAR:
99                 {
100                     {
101                         match( LPAR );
102                         oid = oid();
103                         oidList.add( oid );
104                         {
105                             _loop30: do
106                             {
107                                 if ( ( LA( 1 ) == DOLLAR ) )
108                                 {
109                                     match( DOLLAR );
110                                     oid = oid();
111                                     oidList.add( oid );
112                                 }
113                                 else
114                                 {
115                                     break _loop30;
116                                 }
117
118                             }
119                             while ( true );
120                         }
121                         match( RPAR );
122                     }
123                     break;
124                 }
125                 default:
126                 {
127                     throw new NoViableAltException( LT( 1 ), getFilename() );
128                 }
129             }
130         }
131
132         oids = ( String JavaDoc[] ) oidList.toArray( new String JavaDoc[oidList.size()] );
133
134         return oids;
135     }
136
137
138     public final String JavaDoc oid() throws RecognitionException, TokenStreamException
139     {
140         String JavaDoc oid = null;
141
142         Token n = null;
143         Token d = null;
144
145         {
146             switch ( LA( 1 ) )
147             {
148                 case NUMERICOID:
149                 {
150                     n = LT( 1 );
151                     match( NUMERICOID );
152                     oid = n.getText();
153                     break;
154                 }
155                 case DESCR:
156                 {
157                     d = LT( 1 );
158                     match( DESCR );
159                     oid = d.getText();
160                     break;
161                 }
162                 default:
163                 {
164                     throw new NoViableAltException( LT( 1 ), getFilename() );
165                 }
166             }
167         }
168         return oid;
169     }
170
171
172     public final String JavaDoc[] qdescrs() throws RecognitionException, TokenStreamException
173     {
174         String JavaDoc[] qdescrs;
175
176         qdescrs = new String JavaDoc[0];
177         List qdescrList = new ArrayList();
178         String JavaDoc qdescr = null;
179
180         {
181             switch ( LA( 1 ) )
182             {
183                 case QUOTE:
184                 {
185                     {
186                         qdescr = qdescr();
187                         qdescrList.add( qdescr );
188                     }
189                     break;
190                 }
191                 case LPAR:
192                 {
193                     {
194                         match( LPAR );
195                         qdescr = qdescr();
196                         qdescrList.add( qdescr );
197                         {
198                             _loop38: do
199                             {
200                                 if ( ( LA( 1 ) == QUOTE ) )
201                                 {
202                                     qdescr = qdescr();
203                                     qdescrList.add( qdescr );
204                                 }
205                                 else
206                                 {
207                                     break _loop38;
208                                 }
209
210                             }
211                             while ( true );
212                         }
213                         match( RPAR );
214                     }
215                     break;
216                 }
217                 default:
218                 {
219                     throw new NoViableAltException( LT( 1 ), getFilename() );
220                 }
221             }
222         }
223
224         qdescrs = ( String JavaDoc[] ) qdescrList.toArray( new String JavaDoc[qdescrList.size()] );
225
226         return qdescrs;
227     }
228
229
230     public final String JavaDoc qdescr() throws RecognitionException, TokenStreamException
231     {
232         String JavaDoc qdescr = null;
233
234         Token d = null;
235
236         {
237             match( QUOTE );
238             d = LT( 1 );
239             match( DESCR );
240             qdescr = d.getText();
241             match( QUOTE );
242         }
243         return qdescr;
244     }
245
246     public static final String JavaDoc[] _tokenNames =
247         { "<0>", "EOF", "<2>", "NULL_TREE_LOOKAHEAD", "WHSP", "LPAR", "RPAR", "QUOTE", "DOLLAR", "LBRACKET",
248             "RBRACKET", "LEN", "DIGIT", "NUMERICOID", "DESCR" };
249
250 }
251
Popular Tags