1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 package org.apache.directory.api.ldap.model.schema.syntaxes;
23
24 import java.io.StringReader;
25 import java.util.List;
26
27
28 import java.io.InputStream;
29 import antlr.TokenStreamException;
30 import antlr.TokenStreamIOException;
31 import antlr.TokenStreamRecognitionException;
32 import antlr.CharStreamException;
33 import antlr.CharStreamIOException;
34 import antlr.ANTLRException;
35 import java.io.Reader;
36 import java.util.Hashtable;
37 import antlr.CharScanner;
38 import antlr.InputBuffer;
39 import antlr.ByteBuffer;
40 import antlr.CharBuffer;
41 import antlr.Token;
42 import antlr.CommonToken;
43 import antlr.RecognitionException;
44 import antlr.NoViableAltForCharException;
45 import antlr.MismatchedCharException;
46 import antlr.TokenStream;
47 import antlr.ANTLRHashString;
48 import antlr.LexerSharedInputState;
49 import antlr.collections.impl.BitSet;
50 import antlr.SemanticException;
51
52
53
54
55
56
57 public class AntlrSchemaExtensionLexer extends antlr.CharScanner implements AntlrSchemaExtensionTokenTypes, TokenStream
58 {
59 public AntlrSchemaExtensionLexer(InputStream in) {
60 this(new ByteBuffer(in));
61 }
62 public AntlrSchemaExtensionLexer(Reader in) {
63 this(new CharBuffer(in));
64 }
65 public AntlrSchemaExtensionLexer(InputBuffer ib) {
66 this(new LexerSharedInputState(ib));
67 }
68 public AntlrSchemaExtensionLexer(LexerSharedInputState state) {
69 super(state);
70 caseSensitiveLiterals = true;
71 setCaseSensitive(false);
72 literals = new Hashtable();
73 }
74
75 public Token nextToken() throws TokenStreamException {
76 Token theRetToken=null;
77 tryAgain:
78 for (;;) {
79 Token _token = null;
80 int _ttype = Token.INVALID_TYPE;
81 resetText();
82 try {
83 try {
84 switch ( LA(1)) {
85 case 'x':
86 {
87 mXKEY(true);
88 theRetToken=_returnToken;
89 break;
90 }
91 case '\t': case '\n': case '\r': case ' ':
92 case '\'': case '(':
93 {
94 mXVALUES(true);
95 theRetToken=_returnToken;
96 break;
97 }
98 default:
99 {
100 if (LA(1)==EOF_CHAR) {uponEOF(); _returnToken = makeToken(Token.EOF_TYPE);}
101 else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
102 }
103 }
104 if ( _returnToken==null ) continue tryAgain;
105 _ttype = _returnToken.getType();
106 _ttype = testLiteralsTable(_ttype);
107 _returnToken.setType(_ttype);
108 return _returnToken;
109 }
110 catch (RecognitionException e) {
111 throw new TokenStreamRecognitionException(e);
112 }
113 }
114 catch (CharStreamException cse) {
115 if ( cse instanceof CharStreamIOException ) {
116 throw new TokenStreamIOException(((CharStreamIOException)cse).io);
117 }
118 else {
119 throw new TokenStreamException(cse.getMessage());
120 }
121 }
122 }
123 }
124
125 protected final void mWHSP(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
126 int _ttype; Token _token=null; int _begin=text.length();
127 _ttype = WHSP;
128 int _saveIndex;
129
130 {
131 int _cnt4=0;
132 _loop4:
133 do {
134 if ((LA(1)==' ') && (true)) {
135 match(' ');
136 }
137 else if ((LA(1)=='\t') && (true)) {
138 match('\t');
139 }
140 else if ((LA(1)=='\r') && (true)) {
141 match('\r');
142 {
143 if ((LA(1)=='\n') && (true)) {
144 match('\n');
145 }
146 else {
147 }
148
149 }
150 newline();
151 }
152 else if ((LA(1)=='\n') && (true)) {
153 match('\n');
154 newline();
155 }
156 else {
157 if ( _cnt4>=1 ) { break _loop4; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
158 }
159
160 _cnt4++;
161 } while (true);
162 }
163 _ttype = Token.SKIP;
164 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
165 _token = makeToken(_ttype);
166 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
167 }
168 _returnToken = _token;
169 }
170
171 protected final void mQUOTE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
172 int _ttype; Token _token=null; int _begin=text.length();
173 _ttype = QUOTE;
174 int _saveIndex;
175
176 match('\'');
177 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
178 _token = makeToken(_ttype);
179 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
180 }
181 _returnToken = _token;
182 }
183
184 public final void mXKEY(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
185 int _ttype; Token _token=null; int _begin=text.length();
186 _ttype = XKEY;
187 int _saveIndex;
188 Token xstring=null;
189
190 mXSTRING(true);
191 xstring=_returnToken;
192 setText(xstring.getText().trim());
193 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
194 _token = makeToken(_ttype);
195 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
196 }
197 _returnToken = _token;
198 }
199
200 protected final void mXSTRING(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
201 int _ttype; Token _token=null; int _begin=text.length();
202 _ttype = XSTRING;
203 int _saveIndex;
204
205 {
206 match("x-");
207 {
208 int _cnt11=0;
209 _loop11:
210 do {
211 switch ( LA(1)) {
212 case 'a': case 'b': case 'c': case 'd':
213 case 'e': case 'f': case 'g': case 'h':
214 case 'i': case 'j': case 'k': case 'l':
215 case 'm': case 'n': case 'o': case 'p':
216 case 'q': case 'r': case 's': case 't':
217 case 'u': case 'v': case 'w': case 'x':
218 case 'y': case 'z':
219 {
220 matchRange('a','z');
221 break;
222 }
223 case '-':
224 {
225 match('-');
226 break;
227 }
228 case '_':
229 {
230 match('_');
231 break;
232 }
233 default:
234 {
235 if ( _cnt11>=1 ) { break _loop11; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
236 }
237 }
238 _cnt11++;
239 } while (true);
240 }
241 {
242 if ((_tokenSet_0.member(LA(1)))) {
243 mWHSP(false);
244 }
245 else {
246 }
247
248 }
249 }
250 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
251 _token = makeToken(_ttype);
252 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
253 }
254 _returnToken = _token;
255 }
256
257 public final void mXVALUES(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
258 int _ttype; Token _token=null; int _begin=text.length();
259 _ttype = XVALUES;
260 int _saveIndex;
261 Token values=null;
262
263 mVALUES(true);
264 values=_returnToken;
265 setText(values.getText().trim());
266 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
267 _token = makeToken(_ttype);
268 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
269 }
270 _returnToken = _token;
271 }
272
273 protected final void mVALUES(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
274 int _ttype; Token _token=null; int _begin=text.length();
275 _ttype = VALUES;
276 int _saveIndex;
277
278 {
279 switch ( LA(1)) {
280 case '\t': case '\n': case '\r': case ' ':
281 case '\'':
282 {
283 mVALUE(false);
284 break;
285 }
286 case '(':
287 {
288 match('(');
289 mVALUE(false);
290 {
291 _loop17:
292 do {
293 if ((_tokenSet_1.member(LA(1)))) {
294 {
295 switch ( LA(1)) {
296 case '$':
297 {
298 match('$');
299 break;
300 }
301 case '\t': case '\n': case '\r': case ' ':
302 case '\'':
303 {
304 break;
305 }
306 default:
307 {
308 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
309 }
310 }
311 }
312 mVALUE(false);
313 }
314 else {
315 break _loop17;
316 }
317
318 } while (true);
319 }
320 match(')');
321 break;
322 }
323 default:
324 {
325 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
326 }
327 }
328 }
329 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
330 _token = makeToken(_ttype);
331 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
332 }
333 _returnToken = _token;
334 }
335
336 protected final void mVALUE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
337 int _ttype; Token _token=null; int _begin=text.length();
338 _ttype = VALUE;
339 int _saveIndex;
340
341 {
342 switch ( LA(1)) {
343 case '\t': case '\n': case '\r': case ' ':
344 {
345 mWHSP(false);
346 break;
347 }
348 case '\'':
349 {
350 break;
351 }
352 default:
353 {
354 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
355 }
356 }
357 }
358 {
359 mQUOTED_STRING(false);
360 }
361 {
362 if ((_tokenSet_0.member(LA(1))) && (true)) {
363 mWHSP(false);
364 }
365 else {
366 }
367
368 }
369 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
370 _token = makeToken(_ttype);
371 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
372 }
373 _returnToken = _token;
374 }
375
376 protected final void mQUOTED_STRING(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
377 int _ttype; Token _token=null; int _begin=text.length();
378 _ttype = QUOTED_STRING;
379 int _saveIndex;
380
381 {
382 mQUOTE(false);
383 {
384 _loop25:
385 do {
386 if ((_tokenSet_2.member(LA(1)))) {
387 matchNot('\'');
388 }
389 else {
390 break _loop25;
391 }
392
393 } while (true);
394 }
395 mQUOTE(false);
396 }
397 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
398 _token = makeToken(_ttype);
399 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
400 }
401 _returnToken = _token;
402 }
403
404
405 private static final long[] mk_tokenSet_0() {
406 long[] data = new long[1025];
407 data[0]=4294977024L;
408 return data;
409 }
410 public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0());
411 private static final long[] mk_tokenSet_1() {
412 long[] data = new long[1025];
413 data[0]=622770267648L;
414 return data;
415 }
416 public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1());
417 private static final long[] mk_tokenSet_2() {
418 long[] data = new long[2048];
419 data[0]=-549755813889L;
420 for (int i = 1; i<=1022; i++) { data[i]=-1L; }
421 data[1023]=9223372036854775807L;
422 return data;
423 }
424 public static final BitSet _tokenSet_2 = new BitSet(mk_tokenSet_2());
425
426 }