1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 package org.springmodules.validation.commons.validwhen;
24
25 import java.io.InputStream;
26 import java.io.Reader;
27 import java.util.Hashtable;
28
29 import antlr.*;
30 import antlr.collections.impl.BitSet;
31
32 public class ValidWhenLexer extends antlr.CharScanner implements ValidWhenParserTokenTypes, TokenStream {
33
34 public ValidWhenLexer(InputStream in) {
35 this(new ByteBuffer(in));
36 }
37
38 public ValidWhenLexer(Reader in) {
39 this(new CharBuffer(in));
40 }
41
42 public ValidWhenLexer(InputBuffer ib) {
43 this(new LexerSharedInputState(ib));
44 }
45
46 public ValidWhenLexer(LexerSharedInputState state) {
47 super(state);
48 caseSensitiveLiterals = true;
49 setCaseSensitive(false);
50 literals = new Hashtable();
51 literals.put(new ANTLRHashString("null", this), new Integer(10));
52 literals.put(new ANTLRHashString("or", this), new Integer(15));
53 literals.put(new ANTLRHashString("and", this), new Integer(14));
54 }
55
56 public Token nextToken() throws TokenStreamException {
57 Token theRetToken = null;
58 tryAgain:
59 for (; ;) {
60 Token _token = null;
61 int _ttype = Token.INVALID_TYPE;
62 resetText();
63 try {
64 try {
65 switch (LA(1)) {
66 case '\t':
67 case '\n':
68 case '\r':
69 case ' ': {
70 mWS(true);
71 theRetToken = _returnToken;
72 break;
73 }
74 case '"':
75 case '\'': {
76 mSTRING_LITERAL(true);
77 theRetToken = _returnToken;
78 break;
79 }
80 case '[': {
81 mLBRACKET(true);
82 theRetToken = _returnToken;
83 break;
84 }
85 case ']': {
86 mRBRACKET(true);
87 theRetToken = _returnToken;
88 break;
89 }
90 case '(': {
91 mLPAREN(true);
92 theRetToken = _returnToken;
93 break;
94 }
95 case ')': {
96 mRPAREN(true);
97 theRetToken = _returnToken;
98 break;
99 }
100 case '*': {
101 mTHIS(true);
102 theRetToken = _returnToken;
103 break;
104 }
105 case '.':
106 case '_':
107 case 'a':
108 case 'b':
109 case 'c':
110 case 'd':
111 case 'e':
112 case 'f':
113 case 'g':
114 case 'h':
115 case 'i':
116 case 'j':
117 case 'k':
118 case 'l':
119 case 'm':
120 case 'n':
121 case 'o':
122 case 'p':
123 case 'q':
124 case 'r':
125 case 's':
126 case 't':
127 case 'u':
128 case 'v':
129 case 'w':
130 case 'x':
131 case 'y':
132 case 'z': {
133 mIDENTIFIER(true);
134 theRetToken = _returnToken;
135 break;
136 }
137 case '=': {
138 mEQUALSIGN(true);
139 theRetToken = _returnToken;
140 break;
141 }
142 case '!': {
143 mNOTEQUALSIGN(true);
144 theRetToken = _returnToken;
145 break;
146 }
147 default:
148 if ((LA(1) == '0') && (LA(2) == 'x')) {
149 mHEX_LITERAL(true);
150 theRetToken = _returnToken;
151 } else if ((LA(1) == '<') && (LA(2) == '=')) {
152 mLESSEQUALSIGN(true);
153 theRetToken = _returnToken;
154 } else if ((LA(1) == '>') && (LA(2) == '=')) {
155 mGREATEREQUALSIGN(true);
156 theRetToken = _returnToken;
157 } else if ((_tokenSet_0.member(LA(1))) && (true)) {
158 mDECIMAL_LITERAL(true);
159 theRetToken = _returnToken;
160 } else if ((LA(1) == '<') && (true)) {
161 mLESSTHANSIGN(true);
162 theRetToken = _returnToken;
163 } else if ((LA(1) == '>') && (true)) {
164 mGREATERTHANSIGN(true);
165 theRetToken = _returnToken;
166 } else {
167 if (LA(1) == EOF_CHAR) {
168 uponEOF();
169 _returnToken = makeToken(Token.EOF_TYPE);
170 } else {
171 throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn());
172 }
173 }
174 }
175 if (_returnToken == null) continue tryAgain;
176 _ttype = _returnToken.getType();
177 _ttype = testLiteralsTable(_ttype);
178 _returnToken.setType(_ttype);
179 return _returnToken;
180 }
181 catch (RecognitionException e) {
182 throw new TokenStreamRecognitionException(e);
183 }
184 }
185 catch (CharStreamException cse) {
186 if (cse instanceof CharStreamIOException) {
187 throw new TokenStreamIOException(((CharStreamIOException) cse).io);
188 } else {
189 throw new TokenStreamException(cse.getMessage());
190 }
191 }
192 }
193 }
194
195 public final void mWS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
196 int _ttype;
197 Token _token = null;
198 int _begin = text.length();
199 _ttype = WS;
200 int _saveIndex;
201
202 {
203 int _cnt15 = 0;
204 _loop15:
205 do {
206 switch (LA(1)) {
207 case ' ': {
208 match(' ');
209 break;
210 }
211 case '\t': {
212 match('\t');
213 break;
214 }
215 case '\n': {
216 match('\n');
217 break;
218 }
219 case '\r': {
220 match('\r');
221 break;
222 }
223 default: {
224 if (_cnt15 >= 1) {
225 break _loop15;
226 } else {
227 throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn());
228 }
229 }
230 }
231 _cnt15++;
232 } while (true);
233 }
234 _ttype = Token.SKIP;
235 if (_createToken && _token == null && _ttype != Token.SKIP) {
236 _token = makeToken(_ttype);
237 _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
238 }
239 _returnToken = _token;
240 }
241
242 public final void mDECIMAL_LITERAL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
243 int _ttype;
244 Token _token = null;
245 int _begin = text.length();
246 _ttype = DECIMAL_LITERAL;
247 int _saveIndex;
248
249 {
250 switch (LA(1)) {
251 case '-': {
252 match('-');
253 break;
254 }
255 case '0':
256 case '1':
257 case '2':
258 case '3':
259 case '4':
260 case '5':
261 case '6':
262 case '7':
263 case '8':
264 case '9': {
265 break;
266 }
267 default: {
268 throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn());
269 }
270 }
271 }
272 {
273 switch (LA(1)) {
274 case '1':
275 case '2':
276 case '3':
277 case '4':
278 case '5':
279 case '6':
280 case '7':
281 case '8':
282 case '9': {
283 {
284 {
285 matchRange('1', '9');
286 }
287 {
288 _loop22:
289 do {
290 if (((LA(1) >= '0' && LA(1) <= '9'))) {
291 matchRange('0', '9');
292 } else {
293 break _loop22;
294 }
295
296 } while (true);
297 }
298 }
299 {
300 if ((LA(1) == '.')) {
301 match('.');
302 {
303 int _cnt25 = 0;
304 _loop25:
305 do {
306 if (((LA(1) >= '0' && LA(1) <= '9'))) {
307 matchRange('0', '9');
308 } else {
309 if (_cnt25 >= 1) {
310 break _loop25;
311 } else {
312 throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn());
313 }
314 }
315
316 _cnt25++;
317 } while (true);
318 }
319 } else {
320 }
321
322 }
323 break;
324 }
325 case '0': {
326 {
327 match('0');
328 match('.');
329 {
330 int _cnt28 = 0;
331 _loop28:
332 do {
333 if (((LA(1) >= '0' && LA(1) <= '9'))) {
334 matchRange('0', '9');
335 } else {
336 if (_cnt28 >= 1) {
337 break _loop28;
338 } else {
339 throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn());
340 }
341 }
342
343 _cnt28++;
344 } while (true);
345 }
346 }
347 break;
348 }
349 default: {
350 throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn());
351 }
352 }
353 }
354 if (_createToken && _token == null && _ttype != Token.SKIP) {
355 _token = makeToken(_ttype);
356 _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
357 }
358 _returnToken = _token;
359 }
360
361 public final void mHEX_LITERAL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
362 int _ttype;
363 Token _token = null;
364 int _begin = text.length();
365 _ttype = HEX_LITERAL;
366 int _saveIndex;
367
368 match('0');
369 match('x');
370 {
371 int _cnt31 = 0;
372 _loop31:
373 do {
374 switch (LA(1)) {
375 case '0':
376 case '1':
377 case '2':
378 case '3':
379 case '4':
380 case '5':
381 case '6':
382 case '7':
383 case '8':
384 case '9': {
385 matchRange('0', '9');
386 break;
387 }
388 case 'a':
389 case 'b':
390 case 'c':
391 case 'd':
392 case 'e':
393 case 'f': {
394 matchRange('a', 'f');
395 break;
396 }
397 default: {
398 if (_cnt31 >= 1) {
399 break _loop31;
400 } else {
401 throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn());
402 }
403 }
404 }
405 _cnt31++;
406 } while (true);
407 }
408 if (_createToken && _token == null && _ttype != Token.SKIP) {
409 _token = makeToken(_ttype);
410 _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
411 }
412 _returnToken = _token;
413 }
414
415 public final void mSTRING_LITERAL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
416 int _ttype;
417 Token _token = null;
418 int _begin = text.length();
419 _ttype = STRING_LITERAL;
420 int _saveIndex;
421
422 switch (LA(1)) {
423 case '\'': {
424 {
425 match('\'');
426 {
427 int _cnt35 = 0;
428 _loop35:
429 do {
430 if ((_tokenSet_1.member(LA(1)))) {
431 matchNot('\'');
432 } else {
433 if (_cnt35 >= 1) {
434 break _loop35;
435 } else {
436 throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn());
437 }
438 }
439
440 _cnt35++;
441 } while (true);
442 }
443 match('\'');
444 }
445 break;
446 }
447 case '"': {
448 {
449 match('\"');
450 {
451 int _cnt38 = 0;
452 _loop38:
453 do {
454 if ((_tokenSet_2.member(LA(1)))) {
455 matchNot('\"');
456 } else {
457 if (_cnt38 >= 1) {
458 break _loop38;
459 } else {
460 throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn());
461 }
462 }
463
464 _cnt38++;
465 } while (true);
466 }
467 match('\"');
468 }
469 break;
470 }
471 default: {
472 throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn());
473 }
474 }
475 if (_createToken && _token == null && _ttype != Token.SKIP) {
476 _token = makeToken(_ttype);
477 _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
478 }
479 _returnToken = _token;
480 }
481
482 public final void mLBRACKET(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
483 int _ttype;
484 Token _token = null;
485 int _begin = text.length();
486 _ttype = LBRACKET;
487 int _saveIndex;
488
489 match('[');
490 if (_createToken && _token == null && _ttype != Token.SKIP) {
491 _token = makeToken(_ttype);
492 _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
493 }
494 _returnToken = _token;
495 }
496
497 public final void mRBRACKET(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
498 int _ttype;
499 Token _token = null;
500 int _begin = text.length();
501 _ttype = RBRACKET;
502 int _saveIndex;
503
504 match(']');
505 if (_createToken && _token == null && _ttype != Token.SKIP) {
506 _token = makeToken(_ttype);
507 _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
508 }
509 _returnToken = _token;
510 }
511
512 public final void mLPAREN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
513 int _ttype;
514 Token _token = null;
515 int _begin = text.length();
516 _ttype = LPAREN;
517 int _saveIndex;
518
519 match('(');
520 if (_createToken && _token == null && _ttype != Token.SKIP) {
521 _token = makeToken(_ttype);
522 _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
523 }
524 _returnToken = _token;
525 }
526
527 public final void mRPAREN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
528 int _ttype;
529 Token _token = null;
530 int _begin = text.length();
531 _ttype = RPAREN;
532 int _saveIndex;
533
534 match(')');
535 if (_createToken && _token == null && _ttype != Token.SKIP) {
536 _token = makeToken(_ttype);
537 _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
538 }
539 _returnToken = _token;
540 }
541
542 public final void mTHIS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
543 int _ttype;
544 Token _token = null;
545 int _begin = text.length();
546 _ttype = THIS;
547 int _saveIndex;
548
549 match("*this*");
550 if (_createToken && _token == null && _ttype != Token.SKIP) {
551 _token = makeToken(_ttype);
552 _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
553 }
554 _returnToken = _token;
555 }
556
557 public final void mIDENTIFIER(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
558 int _ttype;
559 Token _token = null;
560 int _begin = text.length();
561 _ttype = IDENTIFIER;
562 int _saveIndex;
563
564 {
565 switch (LA(1)) {
566 case 'a':
567 case 'b':
568 case 'c':
569 case 'd':
570 case 'e':
571 case 'f':
572 case 'g':
573 case 'h':
574 case 'i':
575 case 'j':
576 case 'k':
577 case 'l':
578 case 'm':
579 case 'n':
580 case 'o':
581 case 'p':
582 case 'q':
583 case 'r':
584 case 's':
585 case 't':
586 case 'u':
587 case 'v':
588 case 'w':
589 case 'x':
590 case 'y':
591 case 'z': {
592 matchRange('a', 'z');
593 break;
594 }
595 case '.': {
596 match('.');
597 break;
598 }
599 case '_': {
600 match('_');
601 break;
602 }
603 default: {
604 throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn());
605 }
606 }
607 }
608 {
609 int _cnt47 = 0;
610 _loop47:
611 do {
612 switch (LA(1)) {
613 case 'a':
614 case 'b':
615 case 'c':
616 case 'd':
617 case 'e':
618 case 'f':
619 case 'g':
620 case 'h':
621 case 'i':
622 case 'j':
623 case 'k':
624 case 'l':
625 case 'm':
626 case 'n':
627 case 'o':
628 case 'p':
629 case 'q':
630 case 'r':
631 case 's':
632 case 't':
633 case 'u':
634 case 'v':
635 case 'w':
636 case 'x':
637 case 'y':
638 case 'z': {
639 matchRange('a', 'z');
640 break;
641 }
642 case '0':
643 case '1':
644 case '2':
645 case '3':
646 case '4':
647 case '5':
648 case '6':
649 case '7':
650 case '8':
651 case '9': {
652 matchRange('0', '9');
653 break;
654 }
655 case '.': {
656 match('.');
657 break;
658 }
659 case '_': {
660 match('_');
661 break;
662 }
663 default: {
664 if (_cnt47 >= 1) {
665 break _loop47;
666 } else {
667 throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn());
668 }
669 }
670 }
671 _cnt47++;
672 } while (true);
673 }
674 if (_createToken && _token == null && _ttype != Token.SKIP) {
675 _token = makeToken(_ttype);
676 _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
677 }
678 _returnToken = _token;
679 }
680
681 public final void mEQUALSIGN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
682 int _ttype;
683 Token _token = null;
684 int _begin = text.length();
685 _ttype = EQUALSIGN;
686 int _saveIndex;
687
688 match('=');
689 match('=');
690 if (_createToken && _token == null && _ttype != Token.SKIP) {
691 _token = makeToken(_ttype);
692 _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
693 }
694 _returnToken = _token;
695 }
696
697 public final void mNOTEQUALSIGN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
698 int _ttype;
699 Token _token = null;
700 int _begin = text.length();
701 _ttype = NOTEQUALSIGN;
702 int _saveIndex;
703
704 match('!');
705 match('=');
706 if (_createToken && _token == null && _ttype != Token.SKIP) {
707 _token = makeToken(_ttype);
708 _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
709 }
710 _returnToken = _token;
711 }
712
713 public final void mLESSTHANSIGN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
714 int _ttype;
715 Token _token = null;
716 int _begin = text.length();
717 _ttype = LESSTHANSIGN;
718 int _saveIndex;
719
720 match('<');
721 if (_createToken && _token == null && _ttype != Token.SKIP) {
722 _token = makeToken(_ttype);
723 _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
724 }
725 _returnToken = _token;
726 }
727
728 public final void mGREATERTHANSIGN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
729 int _ttype;
730 Token _token = null;
731 int _begin = text.length();
732 _ttype = GREATERTHANSIGN;
733 int _saveIndex;
734
735 match('>');
736 if (_createToken && _token == null && _ttype != Token.SKIP) {
737 _token = makeToken(_ttype);
738 _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
739 }
740 _returnToken = _token;
741 }
742
743 public final void mLESSEQUALSIGN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
744 int _ttype;
745 Token _token = null;
746 int _begin = text.length();
747 _ttype = LESSEQUALSIGN;
748 int _saveIndex;
749
750 match('<');
751 match('=');
752 if (_createToken && _token == null && _ttype != Token.SKIP) {
753 _token = makeToken(_ttype);
754 _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
755 }
756 _returnToken = _token;
757 }
758
759 public final void mGREATEREQUALSIGN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
760 int _ttype;
761 Token _token = null;
762 int _begin = text.length();
763 _ttype = GREATEREQUALSIGN;
764 int _saveIndex;
765
766 match('>');
767 match('=');
768 if (_createToken && _token == null && _ttype != Token.SKIP) {
769 _token = makeToken(_ttype);
770 _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
771 }
772 _returnToken = _token;
773 }
774
775
776 private static final long[] mk_tokenSet_0() {
777 long[] data = {287984085547089920L, 0L, 0L};
778 return data;
779 }
780
781 public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0());
782
783 private static final long[] mk_tokenSet_1() {
784 long[] data = {-549755813889L, -1L, 0L, 0L};
785 return data;
786 }
787
788 public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1());
789
790 private static final long[] mk_tokenSet_2() {
791 long[] data = {-17179869185L, -1L, 0L, 0L};
792 return data;
793 }
794
795 public static final BitSet _tokenSet_2 = new BitSet(mk_tokenSet_2());
796
797 }