This project has retired. For details please refer to its
Attic page.
TextSearchLexer xref
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 package org.apache.chemistry.opencmis.server.support.query;
27
28
29 import org.antlr.runtime.*;
30 import java.util.Stack;
31 import java.util.List;
32 import java.util.ArrayList;
33
34 public class TextSearchLexer extends Lexer {
35 public static final int EOF=-1;
36 public static final int TEXT_AND=4;
37 public static final int TEXT_OR=5;
38 public static final int TEXT_MINUS=6;
39 public static final int AND=7;
40 public static final int OR=8;
41 public static final int QUOTE=9;
42 public static final int BACKSL=10;
43 public static final int ESC=11;
44 public static final int WS=12;
45 public static final int TEXT_SEARCH_PHRASE_STRING=13;
46 public static final int TEXT_SEARCH_PHRASE_STRING_LIT=14;
47 public static final int TEXT_SEARCH_WORD_LIT=15;
48
49 public void reportError(RecognitionException e) {
50 super.reportError(e);
51 throw new RuntimeException(e);
52 }
53
54
55
56
57
58 public TextSearchLexer() {;}
59 public TextSearchLexer(CharStream input) {
60 this(input, new RecognizerSharedState());
61 }
62 public TextSearchLexer(CharStream input, RecognizerSharedState state) {
63 super(input,state);
64
65 }
66 public String getGrammarFileName() { return "org/apache/chemistry/opencmis/server/support/query/TextSearch.g"; }
67
68
69 public final void mAND() throws RecognitionException {
70 try {
71 int _type = AND;
72 int _channel = DEFAULT_TOKEN_CHANNEL;
73
74
75 {
76 if ( input.LA(1)=='A'||input.LA(1)=='a' ) {
77 input.consume();
78
79 }
80 else {
81 MismatchedSetException mse = new MismatchedSetException(null,input);
82 recover(mse);
83 throw mse;}
84
85 if ( input.LA(1)=='N'||input.LA(1)=='n' ) {
86 input.consume();
87
88 }
89 else {
90 MismatchedSetException mse = new MismatchedSetException(null,input);
91 recover(mse);
92 throw mse;}
93
94 if ( input.LA(1)=='D'||input.LA(1)=='d' ) {
95 input.consume();
96
97 }
98 else {
99 MismatchedSetException mse = new MismatchedSetException(null,input);
100 recover(mse);
101 throw mse;}
102
103
104 }
105
106 state.type = _type;
107 state.channel = _channel;
108 }
109 finally {
110 }
111 }
112
113
114
115 public final void mOR() throws RecognitionException {
116 try {
117 int _type = OR;
118 int _channel = DEFAULT_TOKEN_CHANNEL;
119
120
121 {
122 if ( input.LA(1)=='O'||input.LA(1)=='o' ) {
123 input.consume();
124
125 }
126 else {
127 MismatchedSetException mse = new MismatchedSetException(null,input);
128 recover(mse);
129 throw mse;}
130
131 if ( input.LA(1)=='R'||input.LA(1)=='r' ) {
132 input.consume();
133
134 }
135 else {
136 MismatchedSetException mse = new MismatchedSetException(null,input);
137 recover(mse);
138 throw mse;}
139
140
141 }
142
143 state.type = _type;
144 state.channel = _channel;
145 }
146 finally {
147 }
148 }
149
150
151
152 public final void mTEXT_MINUS() throws RecognitionException {
153 try {
154 int _type = TEXT_MINUS;
155 int _channel = DEFAULT_TOKEN_CHANNEL;
156
157
158 {
159 match('-');
160
161 }
162
163 state.type = _type;
164 state.channel = _channel;
165 }
166 finally {
167 }
168 }
169
170
171
172 public final void mQUOTE() throws RecognitionException {
173 try {
174
175
176 {
177 match('\'');
178
179 }
180
181 }
182 finally {
183 }
184 }
185
186
187
188 public final void mBACKSL() throws RecognitionException {
189 try {
190
191
192 {
193 match('\\');
194
195 }
196
197 }
198 finally {
199 }
200 }
201
202
203
204 public final void mESC() throws RecognitionException {
205 try {
206
207
208 {
209 mBACKSL();
210 if ( input.LA(1)=='\''||input.LA(1)=='-'||input.LA(1)=='\\' ) {
211 input.consume();
212
213 }
214 else {
215 MismatchedSetException mse = new MismatchedSetException(null,input);
216 recover(mse);
217 throw mse;}
218
219
220 }
221
222 }
223 finally {
224 }
225 }
226
227
228
229 public final void mWS() throws RecognitionException {
230 try {
231 int _type = WS;
232 int _channel = DEFAULT_TOKEN_CHANNEL;
233
234
235 {
236
237 int cnt2=0;
238 loop2:
239 do {
240 int alt2=4;
241 switch ( input.LA(1) ) {
242 case ' ':
243 {
244 alt2=1;
245 }
246 break;
247 case '\t':
248 {
249 alt2=2;
250 }
251 break;
252 case '\n':
253 case '\r':
254 {
255 alt2=3;
256 }
257 break;
258
259 }
260
261 switch (alt2) {
262 case 1 :
263
264 {
265 match(' ');
266
267 }
268 break;
269 case 2 :
270
271 {
272 match('\t');
273
274 }
275 break;
276 case 3 :
277
278 {
279
280 int alt1=2;
281 switch ( input.LA(1) ) {
282 case '\r':
283 {
284 alt1=1;
285 }
286 break;
287 }
288
289 switch (alt1) {
290 case 1 :
291
292 {
293 match('\r');
294
295 }
296 break;
297
298 }
299
300 match('\n');
301
302 }
303 break;
304
305 default :
306 if ( cnt2 >= 1 ) break loop2;
307 EarlyExitException eee =
308 new EarlyExitException(2, input);
309 throw eee;
310 }
311 cnt2++;
312 } while (true);
313
314 _channel=HIDDEN;
315
316 }
317
318 state.type = _type;
319 state.channel = _channel;
320 }
321 finally {
322 }
323 }
324
325
326
327 public final void mTEXT_SEARCH_PHRASE_STRING() throws RecognitionException {
328 try {
329
330
331 {
332
333 int cnt3=0;
334 loop3:
335 do {
336 int alt3=3;
337 int LA3_0 = input.LA(1);
338
339 if ( (LA3_0=='\\') ) {
340 alt3=1;
341 }
342 else if ( ((LA3_0>='\u0000' && LA3_0<='&')||(LA3_0>='(' && LA3_0<='[')||(LA3_0>=']' && LA3_0<='\uFFFF')) ) {
343 alt3=2;
344 }
345
346
347 switch (alt3) {
348 case 1 :
349
350 {
351 mESC();
352
353 }
354 break;
355 case 2 :
356
357 {
358 if ( (input.LA(1)>='\u0000' && input.LA(1)<='&')||(input.LA(1)>='(' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFF') ) {
359 input.consume();
360
361 }
362 else {
363 MismatchedSetException mse = new MismatchedSetException(null,input);
364 recover(mse);
365 throw mse;}
366
367
368 }
369 break;
370
371 default :
372 if ( cnt3 >= 1 ) break loop3;
373 EarlyExitException eee =
374 new EarlyExitException(3, input);
375 throw eee;
376 }
377 cnt3++;
378 } while (true);
379
380
381 }
382
383 }
384 finally {
385 }
386 }
387
388
389
390 public final void mTEXT_SEARCH_PHRASE_STRING_LIT() throws RecognitionException {
391 try {
392 int _type = TEXT_SEARCH_PHRASE_STRING_LIT;
393 int _channel = DEFAULT_TOKEN_CHANNEL;
394
395
396 {
397 mQUOTE();
398 mTEXT_SEARCH_PHRASE_STRING();
399 mQUOTE();
400
401 }
402
403 state.type = _type;
404 state.channel = _channel;
405 }
406 finally {
407 }
408 }
409
410
411
412 public final void mTEXT_SEARCH_WORD_LIT() throws RecognitionException {
413 try {
414 int _type = TEXT_SEARCH_WORD_LIT;
415 int _channel = DEFAULT_TOKEN_CHANNEL;
416
417
418 {
419
420 int cnt4=0;
421 loop4:
422 do {
423 int alt4=3;
424 int LA4_0 = input.LA(1);
425
426 if ( (LA4_0=='\\') ) {
427 alt4=1;
428 }
429 else if ( ((LA4_0>='\u0000' && LA4_0<='\b')||(LA4_0>='\u000B' && LA4_0<='\f')||(LA4_0>='\u000E' && LA4_0<='\u001F')||(LA4_0>='!' && LA4_0<='&')||(LA4_0>='(' && LA4_0<=',')||(LA4_0>='.' && LA4_0<='[')||(LA4_0>=']' && LA4_0<='\uFFFF')) ) {
430 alt4=2;
431 }
432
433
434 switch (alt4) {
435 case 1 :
436
437 {
438 mESC();
439
440 }
441 break;
442 case 2 :
443
444 {
445 if ( (input.LA(1)>='\u0000' && input.LA(1)<='\b')||(input.LA(1)>='\u000B' && input.LA(1)<='\f')||(input.LA(1)>='\u000E' && input.LA(1)<='\u001F')||(input.LA(1)>='!' && input.LA(1)<='&')||(input.LA(1)>='(' && input.LA(1)<=',')||(input.LA(1)>='.' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFF') ) {
446 input.consume();
447
448 }
449 else {
450 MismatchedSetException mse = new MismatchedSetException(null,input);
451 recover(mse);
452 throw mse;}
453
454
455 }
456 break;
457
458 default :
459 if ( cnt4 >= 1 ) break loop4;
460 EarlyExitException eee =
461 new EarlyExitException(4, input);
462 throw eee;
463 }
464 cnt4++;
465 } while (true);
466
467
468 }
469
470 state.type = _type;
471 state.channel = _channel;
472 }
473 finally {
474 }
475 }
476
477
478 public void mTokens() throws RecognitionException {
479
480 int alt5=6;
481 alt5 = dfa5.predict(input);
482 switch (alt5) {
483 case 1 :
484
485 {
486 mAND();
487
488 }
489 break;
490 case 2 :
491
492 {
493 mOR();
494
495 }
496 break;
497 case 3 :
498
499 {
500 mTEXT_MINUS();
501
502 }
503 break;
504 case 4 :
505
506 {
507 mWS();
508
509 }
510 break;
511 case 5 :
512
513 {
514 mTEXT_SEARCH_PHRASE_STRING_LIT();
515
516 }
517 break;
518 case 6 :
519
520 {
521 mTEXT_SEARCH_WORD_LIT();
522
523 }
524 break;
525
526 }
527
528 }
529
530
531 protected DFA5 dfa5 = new DFA5(this);
532 static final String DFA5_eotS =
533 "\1\uffff\2\6\4\uffff\1\6\1\12\1\13\2\uffff";
534 static final String DFA5_eofS =
535 "\14\uffff";
536 static final String DFA5_minS =
537 "\1\0\1\116\1\122\4\uffff\1\104\2\0\2\uffff";
538 static final String DFA5_maxS =
539 "\1\uffff\1\156\1\162\4\uffff\1\144\2\uffff\2\uffff";
540 static final String DFA5_acceptS =
541 "\3\uffff\1\3\1\4\1\5\1\6\3\uffff\1\2\1\1";
542 static final String DFA5_specialS =
543 "\1\0\7\uffff\1\2\1\1\2\uffff}>";
544 static final String[] DFA5_transitionS = {
545 "\11\6\2\4\2\6\1\4\22\6\1\4\6\6\1\5\5\6\1\3\23\6\1\1\15\6\1\2"+
546 "\21\6\1\1\15\6\1\2\uff90\6",
547 "\1\7\37\uffff\1\7",
548 "\1\10\37\uffff\1\10",
549 "",
550 "",
551 "",
552 "",
553 "\1\11\37\uffff\1\11",
554 "\11\6\2\uffff\2\6\1\uffff\22\6\1\uffff\6\6\1\uffff\5\6\1\uffff"+
555 "\uffd2\6",
556 "\11\6\2\uffff\2\6\1\uffff\22\6\1\uffff\6\6\1\uffff\5\6\1\uffff"+
557 "\uffd2\6",
558 "",
559 ""
560 };
561
562 static final short[] DFA5_eot = DFA.unpackEncodedString(DFA5_eotS);
563 static final short[] DFA5_eof = DFA.unpackEncodedString(DFA5_eofS);
564 static final char[] DFA5_min = DFA.unpackEncodedStringToUnsignedChars(DFA5_minS);
565 static final char[] DFA5_max = DFA.unpackEncodedStringToUnsignedChars(DFA5_maxS);
566 static final short[] DFA5_accept = DFA.unpackEncodedString(DFA5_acceptS);
567 static final short[] DFA5_special = DFA.unpackEncodedString(DFA5_specialS);
568 static final short[][] DFA5_transition;
569
570 static {
571 int numStates = DFA5_transitionS.length;
572 DFA5_transition = new short[numStates][];
573 for (int i=0; i<numStates; i++) {
574 DFA5_transition[i] = DFA.unpackEncodedString(DFA5_transitionS[i]);
575 }
576 }
577
578 class DFA5 extends DFA {
579
580 public DFA5(BaseRecognizer recognizer) {
581 this.recognizer = recognizer;
582 this.decisionNumber = 5;
583 this.eot = DFA5_eot;
584 this.eof = DFA5_eof;
585 this.min = DFA5_min;
586 this.max = DFA5_max;
587 this.accept = DFA5_accept;
588 this.special = DFA5_special;
589 this.transition = DFA5_transition;
590 }
591 public String getDescription() {
592 return "1:1: Tokens : ( AND | OR | TEXT_MINUS | WS | TEXT_SEARCH_PHRASE_STRING_LIT | TEXT_SEARCH_WORD_LIT );";
593 }
594 public int specialStateTransition(int s, IntStream _input) throws NoViableAltException {
595 IntStream input = _input;
596 int _s = s;
597 switch ( s ) {
598 case 0 :
599 int LA5_0 = input.LA(1);
600
601 s = -1;
602 if ( (LA5_0=='A'||LA5_0=='a') ) {s = 1;}
603
604 else if ( (LA5_0=='O'||LA5_0=='o') ) {s = 2;}
605
606 else if ( (LA5_0=='-') ) {s = 3;}
607
608 else if ( ((LA5_0>='\t' && LA5_0<='\n')||LA5_0=='\r'||LA5_0==' ') ) {s = 4;}
609
610 else if ( (LA5_0=='\'') ) {s = 5;}
611
612 else if ( ((LA5_0>='\u0000' && LA5_0<='\b')||(LA5_0>='\u000B' && LA5_0<='\f')||(LA5_0>='\u000E' && LA5_0<='\u001F')||(LA5_0>='!' && LA5_0<='&')||(LA5_0>='(' && LA5_0<=',')||(LA5_0>='.' && LA5_0<='@')||(LA5_0>='B' && LA5_0<='N')||(LA5_0>='P' && LA5_0<='`')||(LA5_0>='b' && LA5_0<='n')||(LA5_0>='p' && LA5_0<='\uFFFF')) ) {s = 6;}
613
614 if ( s>=0 ) return s;
615 break;
616 case 1 :
617 int LA5_9 = input.LA(1);
618
619 s = -1;
620 if ( ((LA5_9>='\u0000' && LA5_9<='\b')||(LA5_9>='\u000B' && LA5_9<='\f')||(LA5_9>='\u000E' && LA5_9<='\u001F')||(LA5_9>='!' && LA5_9<='&')||(LA5_9>='(' && LA5_9<=',')||(LA5_9>='.' && LA5_9<='\uFFFF')) ) {s = 6;}
621
622 else s = 11;
623
624 if ( s>=0 ) return s;
625 break;
626 case 2 :
627 int LA5_8 = input.LA(1);
628
629 s = -1;
630 if ( ((LA5_8>='\u0000' && LA5_8<='\b')||(LA5_8>='\u000B' && LA5_8<='\f')||(LA5_8>='\u000E' && LA5_8<='\u001F')||(LA5_8>='!' && LA5_8<='&')||(LA5_8>='(' && LA5_8<=',')||(LA5_8>='.' && LA5_8<='\uFFFF')) ) {s = 6;}
631
632 else s = 10;
633
634 if ( s>=0 ) return s;
635 break;
636 }
637 NoViableAltException nvae =
638 new NoViableAltException(getDescription(), 5, _s, input);
639 error(nvae);
640 throw nvae;
641 }
642 }
643
644
645 }