|
1 #!/usr/bin/env python |
|
2 # |
|
3 # Copyright 2007 Google Inc. |
|
4 # |
|
5 # Licensed under the Apache License, Version 2.0 (the "License"); |
|
6 # you may not use this file except in compliance with the License. |
|
7 # You may obtain a copy of the License at |
|
8 # |
|
9 # http://www.apache.org/licenses/LICENSE-2.0 |
|
10 # |
|
11 # Unless required by applicable law or agreed to in writing, software |
|
12 # distributed under the License is distributed on an "AS IS" BASIS, |
|
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
14 # See the License for the specific language governing permissions and |
|
15 # limitations under the License. |
|
16 # |
|
17 |
|
18 import sys |
|
19 from antlr3 import * |
|
20 from antlr3.compat import set, frozenset |
|
21 |
|
22 |
|
23 HIDDEN = BaseRecognizer.HIDDEN |
|
24 |
|
25 THIRD=12 |
|
26 SEPTEMBER=34 |
|
27 FOURTH=13 |
|
28 SECOND=11 |
|
29 WEDNESDAY=20 |
|
30 NOVEMBER=36 |
|
31 SATURDAY=23 |
|
32 JULY=32 |
|
33 APRIL=29 |
|
34 DIGITS=8 |
|
35 OCTOBER=35 |
|
36 MAY=30 |
|
37 EVERY=6 |
|
38 FEBRUARY=27 |
|
39 MONDAY=18 |
|
40 SUNDAY=24 |
|
41 JUNE=31 |
|
42 OF=4 |
|
43 MARCH=28 |
|
44 EOF=-1 |
|
45 JANUARY=26 |
|
46 MONTH=25 |
|
47 FRIDAY=22 |
|
48 MINUTES=17 |
|
49 FIFTH=14 |
|
50 TIME=5 |
|
51 WS=39 |
|
52 QUARTER=38 |
|
53 THURSDAY=21 |
|
54 COMMA=9 |
|
55 DECEMBER=37 |
|
56 AUGUST=33 |
|
57 DIGIT=7 |
|
58 TUESDAY=19 |
|
59 HOURS=16 |
|
60 FOURTH_OR_FIFTH=15 |
|
61 FIRST=10 |
|
62 |
|
63 |
|
64 class GrocLexer(Lexer): |
|
65 |
|
66 grammarFileName = "Groc.g" |
|
67 antlr_version = version_str_to_tuple("3.1.1") |
|
68 antlr_version_str = "3.1.1" |
|
69 |
|
70 def __init__(self, input=None, state=None): |
|
71 if state is None: |
|
72 state = RecognizerSharedState() |
|
73 Lexer.__init__(self, input, state) |
|
74 |
|
75 self.dfa25 = self.DFA25( |
|
76 self, 25, |
|
77 eot = self.DFA25_eot, |
|
78 eof = self.DFA25_eof, |
|
79 min = self.DFA25_min, |
|
80 max = self.DFA25_max, |
|
81 accept = self.DFA25_accept, |
|
82 special = self.DFA25_special, |
|
83 transition = self.DFA25_transition |
|
84 ) |
|
85 |
|
86 |
|
87 |
|
88 |
|
89 |
|
90 |
|
91 def mTIME(self, ): |
|
92 |
|
93 try: |
|
94 _type = TIME |
|
95 _channel = DEFAULT_CHANNEL |
|
96 |
|
97 pass |
|
98 alt1 = 4 |
|
99 LA1 = self.input.LA(1) |
|
100 if LA1 == 48: |
|
101 LA1_1 = self.input.LA(2) |
|
102 |
|
103 if ((48 <= LA1_1 <= 57)) : |
|
104 alt1 = 2 |
|
105 elif (LA1_1 == 58) : |
|
106 alt1 = 1 |
|
107 else: |
|
108 nvae = NoViableAltException("", 1, 1, self.input) |
|
109 |
|
110 raise nvae |
|
111 |
|
112 elif LA1 == 49: |
|
113 LA1_2 = self.input.LA(2) |
|
114 |
|
115 if ((48 <= LA1_2 <= 57)) : |
|
116 alt1 = 3 |
|
117 elif (LA1_2 == 58) : |
|
118 alt1 = 1 |
|
119 else: |
|
120 nvae = NoViableAltException("", 1, 2, self.input) |
|
121 |
|
122 raise nvae |
|
123 |
|
124 elif LA1 == 50: |
|
125 LA1_3 = self.input.LA(2) |
|
126 |
|
127 if ((48 <= LA1_3 <= 52)) : |
|
128 alt1 = 4 |
|
129 elif (LA1_3 == 58) : |
|
130 alt1 = 1 |
|
131 else: |
|
132 nvae = NoViableAltException("", 1, 3, self.input) |
|
133 |
|
134 raise nvae |
|
135 |
|
136 elif LA1 == 51 or LA1 == 52 or LA1 == 53 or LA1 == 54 or LA1 == 55 or LA1 == 56 or LA1 == 57: |
|
137 alt1 = 1 |
|
138 else: |
|
139 nvae = NoViableAltException("", 1, 0, self.input) |
|
140 |
|
141 raise nvae |
|
142 |
|
143 if alt1 == 1: |
|
144 pass |
|
145 self.mDIGIT() |
|
146 |
|
147 |
|
148 elif alt1 == 2: |
|
149 pass |
|
150 pass |
|
151 self.match(48) |
|
152 self.mDIGIT() |
|
153 |
|
154 |
|
155 |
|
156 |
|
157 |
|
158 elif alt1 == 3: |
|
159 pass |
|
160 pass |
|
161 self.match(49) |
|
162 self.mDIGIT() |
|
163 |
|
164 |
|
165 |
|
166 |
|
167 |
|
168 elif alt1 == 4: |
|
169 pass |
|
170 pass |
|
171 self.match(50) |
|
172 self.matchRange(48, 52) |
|
173 |
|
174 |
|
175 |
|
176 |
|
177 |
|
178 |
|
179 self.match(58) |
|
180 pass |
|
181 self.matchRange(48, 53) |
|
182 self.mDIGIT() |
|
183 |
|
184 |
|
185 |
|
186 |
|
187 |
|
188 |
|
189 self._state.type = _type |
|
190 self._state.channel = _channel |
|
191 |
|
192 finally: |
|
193 |
|
194 pass |
|
195 |
|
196 |
|
197 |
|
198 |
|
199 def mFIRST(self, ): |
|
200 |
|
201 try: |
|
202 _type = FIRST |
|
203 _channel = DEFAULT_CHANNEL |
|
204 |
|
205 pass |
|
206 alt2 = 2 |
|
207 LA2_0 = self.input.LA(1) |
|
208 |
|
209 if (LA2_0 == 49) : |
|
210 alt2 = 1 |
|
211 elif (LA2_0 == 102) : |
|
212 alt2 = 2 |
|
213 else: |
|
214 nvae = NoViableAltException("", 2, 0, self.input) |
|
215 |
|
216 raise nvae |
|
217 |
|
218 if alt2 == 1: |
|
219 pass |
|
220 self.match("1st") |
|
221 |
|
222 |
|
223 elif alt2 == 2: |
|
224 pass |
|
225 self.match("first") |
|
226 |
|
227 |
|
228 |
|
229 |
|
230 |
|
231 |
|
232 self._state.type = _type |
|
233 self._state.channel = _channel |
|
234 |
|
235 finally: |
|
236 |
|
237 pass |
|
238 |
|
239 |
|
240 |
|
241 |
|
242 def mSECOND(self, ): |
|
243 |
|
244 try: |
|
245 _type = SECOND |
|
246 _channel = DEFAULT_CHANNEL |
|
247 |
|
248 pass |
|
249 alt3 = 2 |
|
250 LA3_0 = self.input.LA(1) |
|
251 |
|
252 if (LA3_0 == 50) : |
|
253 alt3 = 1 |
|
254 elif (LA3_0 == 115) : |
|
255 alt3 = 2 |
|
256 else: |
|
257 nvae = NoViableAltException("", 3, 0, self.input) |
|
258 |
|
259 raise nvae |
|
260 |
|
261 if alt3 == 1: |
|
262 pass |
|
263 self.match("2nd") |
|
264 |
|
265 |
|
266 elif alt3 == 2: |
|
267 pass |
|
268 self.match("second") |
|
269 |
|
270 |
|
271 |
|
272 |
|
273 |
|
274 |
|
275 self._state.type = _type |
|
276 self._state.channel = _channel |
|
277 |
|
278 finally: |
|
279 |
|
280 pass |
|
281 |
|
282 |
|
283 |
|
284 |
|
285 def mTHIRD(self, ): |
|
286 |
|
287 try: |
|
288 _type = THIRD |
|
289 _channel = DEFAULT_CHANNEL |
|
290 |
|
291 pass |
|
292 alt4 = 2 |
|
293 LA4_0 = self.input.LA(1) |
|
294 |
|
295 if (LA4_0 == 51) : |
|
296 alt4 = 1 |
|
297 elif (LA4_0 == 116) : |
|
298 alt4 = 2 |
|
299 else: |
|
300 nvae = NoViableAltException("", 4, 0, self.input) |
|
301 |
|
302 raise nvae |
|
303 |
|
304 if alt4 == 1: |
|
305 pass |
|
306 self.match("3rd") |
|
307 |
|
308 |
|
309 elif alt4 == 2: |
|
310 pass |
|
311 self.match("third") |
|
312 |
|
313 |
|
314 |
|
315 |
|
316 |
|
317 |
|
318 self._state.type = _type |
|
319 self._state.channel = _channel |
|
320 |
|
321 finally: |
|
322 |
|
323 pass |
|
324 |
|
325 |
|
326 |
|
327 |
|
328 def mFOURTH(self, ): |
|
329 |
|
330 try: |
|
331 _type = FOURTH |
|
332 _channel = DEFAULT_CHANNEL |
|
333 |
|
334 pass |
|
335 pass |
|
336 self.match("4th") |
|
337 |
|
338 |
|
339 |
|
340 |
|
341 |
|
342 |
|
343 self._state.type = _type |
|
344 self._state.channel = _channel |
|
345 |
|
346 finally: |
|
347 |
|
348 pass |
|
349 |
|
350 |
|
351 |
|
352 |
|
353 def mFIFTH(self, ): |
|
354 |
|
355 try: |
|
356 _type = FIFTH |
|
357 _channel = DEFAULT_CHANNEL |
|
358 |
|
359 pass |
|
360 pass |
|
361 self.match("5th") |
|
362 |
|
363 |
|
364 |
|
365 |
|
366 |
|
367 |
|
368 self._state.type = _type |
|
369 self._state.channel = _channel |
|
370 |
|
371 finally: |
|
372 |
|
373 pass |
|
374 |
|
375 |
|
376 |
|
377 |
|
378 def mFOURTH_OR_FIFTH(self, ): |
|
379 |
|
380 try: |
|
381 _type = FOURTH_OR_FIFTH |
|
382 _channel = DEFAULT_CHANNEL |
|
383 |
|
384 pass |
|
385 alt5 = 2 |
|
386 LA5_0 = self.input.LA(1) |
|
387 |
|
388 if (LA5_0 == 102) : |
|
389 LA5_1 = self.input.LA(2) |
|
390 |
|
391 if (LA5_1 == 111) : |
|
392 alt5 = 1 |
|
393 elif (LA5_1 == 105) : |
|
394 alt5 = 2 |
|
395 else: |
|
396 nvae = NoViableAltException("", 5, 1, self.input) |
|
397 |
|
398 raise nvae |
|
399 |
|
400 else: |
|
401 nvae = NoViableAltException("", 5, 0, self.input) |
|
402 |
|
403 raise nvae |
|
404 |
|
405 if alt5 == 1: |
|
406 pass |
|
407 pass |
|
408 self.match("fourth") |
|
409 _type = FOURTH; |
|
410 |
|
411 |
|
412 |
|
413 |
|
414 |
|
415 elif alt5 == 2: |
|
416 pass |
|
417 pass |
|
418 self.match("fifth") |
|
419 _type = FIFTH; |
|
420 |
|
421 |
|
422 |
|
423 |
|
424 |
|
425 |
|
426 |
|
427 |
|
428 |
|
429 self._state.type = _type |
|
430 self._state.channel = _channel |
|
431 |
|
432 finally: |
|
433 |
|
434 pass |
|
435 |
|
436 |
|
437 |
|
438 |
|
439 def mMONDAY(self, ): |
|
440 |
|
441 try: |
|
442 _type = MONDAY |
|
443 _channel = DEFAULT_CHANNEL |
|
444 |
|
445 pass |
|
446 self.match("mon") |
|
447 alt6 = 2 |
|
448 LA6_0 = self.input.LA(1) |
|
449 |
|
450 if (LA6_0 == 100) : |
|
451 alt6 = 1 |
|
452 if alt6 == 1: |
|
453 pass |
|
454 self.match("day") |
|
455 |
|
456 |
|
457 |
|
458 |
|
459 |
|
460 |
|
461 self._state.type = _type |
|
462 self._state.channel = _channel |
|
463 |
|
464 finally: |
|
465 |
|
466 pass |
|
467 |
|
468 |
|
469 |
|
470 |
|
471 def mTUESDAY(self, ): |
|
472 |
|
473 try: |
|
474 _type = TUESDAY |
|
475 _channel = DEFAULT_CHANNEL |
|
476 |
|
477 pass |
|
478 self.match("tue") |
|
479 alt7 = 2 |
|
480 LA7_0 = self.input.LA(1) |
|
481 |
|
482 if (LA7_0 == 115) : |
|
483 alt7 = 1 |
|
484 if alt7 == 1: |
|
485 pass |
|
486 self.match("sday") |
|
487 |
|
488 |
|
489 |
|
490 |
|
491 |
|
492 |
|
493 self._state.type = _type |
|
494 self._state.channel = _channel |
|
495 |
|
496 finally: |
|
497 |
|
498 pass |
|
499 |
|
500 |
|
501 |
|
502 |
|
503 def mWEDNESDAY(self, ): |
|
504 |
|
505 try: |
|
506 _type = WEDNESDAY |
|
507 _channel = DEFAULT_CHANNEL |
|
508 |
|
509 pass |
|
510 self.match("wed") |
|
511 alt8 = 2 |
|
512 LA8_0 = self.input.LA(1) |
|
513 |
|
514 if (LA8_0 == 110) : |
|
515 alt8 = 1 |
|
516 if alt8 == 1: |
|
517 pass |
|
518 self.match("nesday") |
|
519 |
|
520 |
|
521 |
|
522 |
|
523 |
|
524 |
|
525 self._state.type = _type |
|
526 self._state.channel = _channel |
|
527 |
|
528 finally: |
|
529 |
|
530 pass |
|
531 |
|
532 |
|
533 |
|
534 |
|
535 def mTHURSDAY(self, ): |
|
536 |
|
537 try: |
|
538 _type = THURSDAY |
|
539 _channel = DEFAULT_CHANNEL |
|
540 |
|
541 pass |
|
542 self.match("thu") |
|
543 alt9 = 2 |
|
544 LA9_0 = self.input.LA(1) |
|
545 |
|
546 if (LA9_0 == 114) : |
|
547 alt9 = 1 |
|
548 if alt9 == 1: |
|
549 pass |
|
550 self.match("rsday") |
|
551 |
|
552 |
|
553 |
|
554 |
|
555 |
|
556 |
|
557 self._state.type = _type |
|
558 self._state.channel = _channel |
|
559 |
|
560 finally: |
|
561 |
|
562 pass |
|
563 |
|
564 |
|
565 |
|
566 |
|
567 def mFRIDAY(self, ): |
|
568 |
|
569 try: |
|
570 _type = FRIDAY |
|
571 _channel = DEFAULT_CHANNEL |
|
572 |
|
573 pass |
|
574 self.match("fri") |
|
575 alt10 = 2 |
|
576 LA10_0 = self.input.LA(1) |
|
577 |
|
578 if (LA10_0 == 100) : |
|
579 alt10 = 1 |
|
580 if alt10 == 1: |
|
581 pass |
|
582 self.match("day") |
|
583 |
|
584 |
|
585 |
|
586 |
|
587 |
|
588 |
|
589 self._state.type = _type |
|
590 self._state.channel = _channel |
|
591 |
|
592 finally: |
|
593 |
|
594 pass |
|
595 |
|
596 |
|
597 |
|
598 |
|
599 def mSATURDAY(self, ): |
|
600 |
|
601 try: |
|
602 _type = SATURDAY |
|
603 _channel = DEFAULT_CHANNEL |
|
604 |
|
605 pass |
|
606 self.match("sat") |
|
607 alt11 = 2 |
|
608 LA11_0 = self.input.LA(1) |
|
609 |
|
610 if (LA11_0 == 117) : |
|
611 alt11 = 1 |
|
612 if alt11 == 1: |
|
613 pass |
|
614 self.match("urday") |
|
615 |
|
616 |
|
617 |
|
618 |
|
619 |
|
620 |
|
621 self._state.type = _type |
|
622 self._state.channel = _channel |
|
623 |
|
624 finally: |
|
625 |
|
626 pass |
|
627 |
|
628 |
|
629 |
|
630 |
|
631 def mSUNDAY(self, ): |
|
632 |
|
633 try: |
|
634 _type = SUNDAY |
|
635 _channel = DEFAULT_CHANNEL |
|
636 |
|
637 pass |
|
638 self.match("sun") |
|
639 alt12 = 2 |
|
640 LA12_0 = self.input.LA(1) |
|
641 |
|
642 if (LA12_0 == 100) : |
|
643 alt12 = 1 |
|
644 if alt12 == 1: |
|
645 pass |
|
646 self.match("day") |
|
647 |
|
648 |
|
649 |
|
650 |
|
651 |
|
652 |
|
653 self._state.type = _type |
|
654 self._state.channel = _channel |
|
655 |
|
656 finally: |
|
657 |
|
658 pass |
|
659 |
|
660 |
|
661 |
|
662 |
|
663 def mJANUARY(self, ): |
|
664 |
|
665 try: |
|
666 _type = JANUARY |
|
667 _channel = DEFAULT_CHANNEL |
|
668 |
|
669 pass |
|
670 self.match("jan") |
|
671 alt13 = 2 |
|
672 LA13_0 = self.input.LA(1) |
|
673 |
|
674 if (LA13_0 == 117) : |
|
675 alt13 = 1 |
|
676 if alt13 == 1: |
|
677 pass |
|
678 self.match("uary") |
|
679 |
|
680 |
|
681 |
|
682 |
|
683 |
|
684 |
|
685 self._state.type = _type |
|
686 self._state.channel = _channel |
|
687 |
|
688 finally: |
|
689 |
|
690 pass |
|
691 |
|
692 |
|
693 |
|
694 |
|
695 def mFEBRUARY(self, ): |
|
696 |
|
697 try: |
|
698 _type = FEBRUARY |
|
699 _channel = DEFAULT_CHANNEL |
|
700 |
|
701 pass |
|
702 self.match("feb") |
|
703 alt14 = 2 |
|
704 LA14_0 = self.input.LA(1) |
|
705 |
|
706 if (LA14_0 == 114) : |
|
707 alt14 = 1 |
|
708 if alt14 == 1: |
|
709 pass |
|
710 self.match("ruary") |
|
711 |
|
712 |
|
713 |
|
714 |
|
715 |
|
716 |
|
717 self._state.type = _type |
|
718 self._state.channel = _channel |
|
719 |
|
720 finally: |
|
721 |
|
722 pass |
|
723 |
|
724 |
|
725 |
|
726 |
|
727 def mMARCH(self, ): |
|
728 |
|
729 try: |
|
730 _type = MARCH |
|
731 _channel = DEFAULT_CHANNEL |
|
732 |
|
733 pass |
|
734 self.match("mar") |
|
735 alt15 = 2 |
|
736 LA15_0 = self.input.LA(1) |
|
737 |
|
738 if (LA15_0 == 99) : |
|
739 alt15 = 1 |
|
740 if alt15 == 1: |
|
741 pass |
|
742 self.match("ch") |
|
743 |
|
744 |
|
745 |
|
746 |
|
747 |
|
748 |
|
749 self._state.type = _type |
|
750 self._state.channel = _channel |
|
751 |
|
752 finally: |
|
753 |
|
754 pass |
|
755 |
|
756 |
|
757 |
|
758 |
|
759 def mAPRIL(self, ): |
|
760 |
|
761 try: |
|
762 _type = APRIL |
|
763 _channel = DEFAULT_CHANNEL |
|
764 |
|
765 pass |
|
766 self.match("apr") |
|
767 alt16 = 2 |
|
768 LA16_0 = self.input.LA(1) |
|
769 |
|
770 if (LA16_0 == 105) : |
|
771 alt16 = 1 |
|
772 if alt16 == 1: |
|
773 pass |
|
774 self.match("il") |
|
775 |
|
776 |
|
777 |
|
778 |
|
779 |
|
780 |
|
781 self._state.type = _type |
|
782 self._state.channel = _channel |
|
783 |
|
784 finally: |
|
785 |
|
786 pass |
|
787 |
|
788 |
|
789 |
|
790 |
|
791 def mMAY(self, ): |
|
792 |
|
793 try: |
|
794 _type = MAY |
|
795 _channel = DEFAULT_CHANNEL |
|
796 |
|
797 pass |
|
798 self.match("may") |
|
799 |
|
800 |
|
801 |
|
802 self._state.type = _type |
|
803 self._state.channel = _channel |
|
804 |
|
805 finally: |
|
806 |
|
807 pass |
|
808 |
|
809 |
|
810 |
|
811 |
|
812 def mJUNE(self, ): |
|
813 |
|
814 try: |
|
815 _type = JUNE |
|
816 _channel = DEFAULT_CHANNEL |
|
817 |
|
818 pass |
|
819 self.match("jun") |
|
820 alt17 = 2 |
|
821 LA17_0 = self.input.LA(1) |
|
822 |
|
823 if (LA17_0 == 101) : |
|
824 alt17 = 1 |
|
825 if alt17 == 1: |
|
826 pass |
|
827 self.match(101) |
|
828 |
|
829 |
|
830 |
|
831 |
|
832 |
|
833 |
|
834 self._state.type = _type |
|
835 self._state.channel = _channel |
|
836 |
|
837 finally: |
|
838 |
|
839 pass |
|
840 |
|
841 |
|
842 |
|
843 |
|
844 def mJULY(self, ): |
|
845 |
|
846 try: |
|
847 _type = JULY |
|
848 _channel = DEFAULT_CHANNEL |
|
849 |
|
850 pass |
|
851 self.match("jul") |
|
852 alt18 = 2 |
|
853 LA18_0 = self.input.LA(1) |
|
854 |
|
855 if (LA18_0 == 121) : |
|
856 alt18 = 1 |
|
857 if alt18 == 1: |
|
858 pass |
|
859 self.match(121) |
|
860 |
|
861 |
|
862 |
|
863 |
|
864 |
|
865 |
|
866 self._state.type = _type |
|
867 self._state.channel = _channel |
|
868 |
|
869 finally: |
|
870 |
|
871 pass |
|
872 |
|
873 |
|
874 |
|
875 |
|
876 def mAUGUST(self, ): |
|
877 |
|
878 try: |
|
879 _type = AUGUST |
|
880 _channel = DEFAULT_CHANNEL |
|
881 |
|
882 pass |
|
883 self.match("aug") |
|
884 alt19 = 2 |
|
885 LA19_0 = self.input.LA(1) |
|
886 |
|
887 if (LA19_0 == 117) : |
|
888 alt19 = 1 |
|
889 if alt19 == 1: |
|
890 pass |
|
891 self.match("ust") |
|
892 |
|
893 |
|
894 |
|
895 |
|
896 |
|
897 |
|
898 self._state.type = _type |
|
899 self._state.channel = _channel |
|
900 |
|
901 finally: |
|
902 |
|
903 pass |
|
904 |
|
905 |
|
906 |
|
907 |
|
908 def mSEPTEMBER(self, ): |
|
909 |
|
910 try: |
|
911 _type = SEPTEMBER |
|
912 _channel = DEFAULT_CHANNEL |
|
913 |
|
914 pass |
|
915 self.match("sep") |
|
916 alt20 = 2 |
|
917 LA20_0 = self.input.LA(1) |
|
918 |
|
919 if (LA20_0 == 116) : |
|
920 alt20 = 1 |
|
921 if alt20 == 1: |
|
922 pass |
|
923 self.match("tember") |
|
924 |
|
925 |
|
926 |
|
927 |
|
928 |
|
929 |
|
930 self._state.type = _type |
|
931 self._state.channel = _channel |
|
932 |
|
933 finally: |
|
934 |
|
935 pass |
|
936 |
|
937 |
|
938 |
|
939 |
|
940 def mOCTOBER(self, ): |
|
941 |
|
942 try: |
|
943 _type = OCTOBER |
|
944 _channel = DEFAULT_CHANNEL |
|
945 |
|
946 pass |
|
947 self.match("oct") |
|
948 alt21 = 2 |
|
949 LA21_0 = self.input.LA(1) |
|
950 |
|
951 if (LA21_0 == 111) : |
|
952 alt21 = 1 |
|
953 if alt21 == 1: |
|
954 pass |
|
955 self.match("ober") |
|
956 |
|
957 |
|
958 |
|
959 |
|
960 |
|
961 |
|
962 self._state.type = _type |
|
963 self._state.channel = _channel |
|
964 |
|
965 finally: |
|
966 |
|
967 pass |
|
968 |
|
969 |
|
970 |
|
971 |
|
972 def mNOVEMBER(self, ): |
|
973 |
|
974 try: |
|
975 _type = NOVEMBER |
|
976 _channel = DEFAULT_CHANNEL |
|
977 |
|
978 pass |
|
979 self.match("nov") |
|
980 alt22 = 2 |
|
981 LA22_0 = self.input.LA(1) |
|
982 |
|
983 if (LA22_0 == 101) : |
|
984 alt22 = 1 |
|
985 if alt22 == 1: |
|
986 pass |
|
987 self.match("ember") |
|
988 |
|
989 |
|
990 |
|
991 |
|
992 |
|
993 |
|
994 self._state.type = _type |
|
995 self._state.channel = _channel |
|
996 |
|
997 finally: |
|
998 |
|
999 pass |
|
1000 |
|
1001 |
|
1002 |
|
1003 |
|
1004 def mDECEMBER(self, ): |
|
1005 |
|
1006 try: |
|
1007 _type = DECEMBER |
|
1008 _channel = DEFAULT_CHANNEL |
|
1009 |
|
1010 pass |
|
1011 self.match("dec") |
|
1012 alt23 = 2 |
|
1013 LA23_0 = self.input.LA(1) |
|
1014 |
|
1015 if (LA23_0 == 101) : |
|
1016 alt23 = 1 |
|
1017 if alt23 == 1: |
|
1018 pass |
|
1019 self.match("ember") |
|
1020 |
|
1021 |
|
1022 |
|
1023 |
|
1024 |
|
1025 |
|
1026 self._state.type = _type |
|
1027 self._state.channel = _channel |
|
1028 |
|
1029 finally: |
|
1030 |
|
1031 pass |
|
1032 |
|
1033 |
|
1034 |
|
1035 |
|
1036 def mMONTH(self, ): |
|
1037 |
|
1038 try: |
|
1039 _type = MONTH |
|
1040 _channel = DEFAULT_CHANNEL |
|
1041 |
|
1042 pass |
|
1043 pass |
|
1044 self.match("month") |
|
1045 |
|
1046 |
|
1047 |
|
1048 |
|
1049 |
|
1050 |
|
1051 self._state.type = _type |
|
1052 self._state.channel = _channel |
|
1053 |
|
1054 finally: |
|
1055 |
|
1056 pass |
|
1057 |
|
1058 |
|
1059 |
|
1060 |
|
1061 def mQUARTER(self, ): |
|
1062 |
|
1063 try: |
|
1064 _type = QUARTER |
|
1065 _channel = DEFAULT_CHANNEL |
|
1066 |
|
1067 pass |
|
1068 pass |
|
1069 self.match("quarter") |
|
1070 |
|
1071 |
|
1072 |
|
1073 |
|
1074 |
|
1075 |
|
1076 self._state.type = _type |
|
1077 self._state.channel = _channel |
|
1078 |
|
1079 finally: |
|
1080 |
|
1081 pass |
|
1082 |
|
1083 |
|
1084 |
|
1085 |
|
1086 def mEVERY(self, ): |
|
1087 |
|
1088 try: |
|
1089 _type = EVERY |
|
1090 _channel = DEFAULT_CHANNEL |
|
1091 |
|
1092 pass |
|
1093 pass |
|
1094 self.match("every") |
|
1095 |
|
1096 |
|
1097 |
|
1098 |
|
1099 |
|
1100 |
|
1101 self._state.type = _type |
|
1102 self._state.channel = _channel |
|
1103 |
|
1104 finally: |
|
1105 |
|
1106 pass |
|
1107 |
|
1108 |
|
1109 |
|
1110 |
|
1111 def mHOURS(self, ): |
|
1112 |
|
1113 try: |
|
1114 _type = HOURS |
|
1115 _channel = DEFAULT_CHANNEL |
|
1116 |
|
1117 pass |
|
1118 pass |
|
1119 self.match("hours") |
|
1120 |
|
1121 |
|
1122 |
|
1123 |
|
1124 |
|
1125 |
|
1126 self._state.type = _type |
|
1127 self._state.channel = _channel |
|
1128 |
|
1129 finally: |
|
1130 |
|
1131 pass |
|
1132 |
|
1133 |
|
1134 |
|
1135 |
|
1136 def mMINUTES(self, ): |
|
1137 |
|
1138 try: |
|
1139 _type = MINUTES |
|
1140 _channel = DEFAULT_CHANNEL |
|
1141 |
|
1142 pass |
|
1143 alt24 = 2 |
|
1144 LA24_0 = self.input.LA(1) |
|
1145 |
|
1146 if (LA24_0 == 109) : |
|
1147 LA24_1 = self.input.LA(2) |
|
1148 |
|
1149 if (LA24_1 == 105) : |
|
1150 LA24_2 = self.input.LA(3) |
|
1151 |
|
1152 if (LA24_2 == 110) : |
|
1153 LA24_3 = self.input.LA(4) |
|
1154 |
|
1155 if (LA24_3 == 115) : |
|
1156 alt24 = 1 |
|
1157 elif (LA24_3 == 117) : |
|
1158 alt24 = 2 |
|
1159 else: |
|
1160 nvae = NoViableAltException("", 24, 3, self.input) |
|
1161 |
|
1162 raise nvae |
|
1163 |
|
1164 else: |
|
1165 nvae = NoViableAltException("", 24, 2, self.input) |
|
1166 |
|
1167 raise nvae |
|
1168 |
|
1169 else: |
|
1170 nvae = NoViableAltException("", 24, 1, self.input) |
|
1171 |
|
1172 raise nvae |
|
1173 |
|
1174 else: |
|
1175 nvae = NoViableAltException("", 24, 0, self.input) |
|
1176 |
|
1177 raise nvae |
|
1178 |
|
1179 if alt24 == 1: |
|
1180 pass |
|
1181 self.match("mins") |
|
1182 |
|
1183 |
|
1184 elif alt24 == 2: |
|
1185 pass |
|
1186 self.match("minutes") |
|
1187 |
|
1188 |
|
1189 |
|
1190 |
|
1191 |
|
1192 |
|
1193 self._state.type = _type |
|
1194 self._state.channel = _channel |
|
1195 |
|
1196 finally: |
|
1197 |
|
1198 pass |
|
1199 |
|
1200 |
|
1201 |
|
1202 |
|
1203 def mCOMMA(self, ): |
|
1204 |
|
1205 try: |
|
1206 _type = COMMA |
|
1207 _channel = DEFAULT_CHANNEL |
|
1208 |
|
1209 pass |
|
1210 pass |
|
1211 self.match(44) |
|
1212 |
|
1213 |
|
1214 |
|
1215 |
|
1216 |
|
1217 |
|
1218 self._state.type = _type |
|
1219 self._state.channel = _channel |
|
1220 |
|
1221 finally: |
|
1222 |
|
1223 pass |
|
1224 |
|
1225 |
|
1226 |
|
1227 |
|
1228 def mOF(self, ): |
|
1229 |
|
1230 try: |
|
1231 _type = OF |
|
1232 _channel = DEFAULT_CHANNEL |
|
1233 |
|
1234 pass |
|
1235 pass |
|
1236 self.match("of") |
|
1237 |
|
1238 |
|
1239 |
|
1240 |
|
1241 |
|
1242 |
|
1243 self._state.type = _type |
|
1244 self._state.channel = _channel |
|
1245 |
|
1246 finally: |
|
1247 |
|
1248 pass |
|
1249 |
|
1250 |
|
1251 |
|
1252 |
|
1253 def mWS(self, ): |
|
1254 |
|
1255 try: |
|
1256 _type = WS |
|
1257 _channel = DEFAULT_CHANNEL |
|
1258 |
|
1259 pass |
|
1260 if (9 <= self.input.LA(1) <= 10) or self.input.LA(1) == 13 or self.input.LA(1) == 32: |
|
1261 self.input.consume() |
|
1262 else: |
|
1263 mse = MismatchedSetException(None, self.input) |
|
1264 self.recover(mse) |
|
1265 raise mse |
|
1266 |
|
1267 _channel=HIDDEN; |
|
1268 |
|
1269 |
|
1270 |
|
1271 self._state.type = _type |
|
1272 self._state.channel = _channel |
|
1273 |
|
1274 finally: |
|
1275 |
|
1276 pass |
|
1277 |
|
1278 |
|
1279 |
|
1280 |
|
1281 def mDIGIT(self, ): |
|
1282 |
|
1283 try: |
|
1284 _type = DIGIT |
|
1285 _channel = DEFAULT_CHANNEL |
|
1286 |
|
1287 pass |
|
1288 pass |
|
1289 self.matchRange(48, 57) |
|
1290 |
|
1291 |
|
1292 |
|
1293 |
|
1294 |
|
1295 |
|
1296 self._state.type = _type |
|
1297 self._state.channel = _channel |
|
1298 |
|
1299 finally: |
|
1300 |
|
1301 pass |
|
1302 |
|
1303 |
|
1304 |
|
1305 |
|
1306 def mDIGITS(self, ): |
|
1307 |
|
1308 try: |
|
1309 _type = DIGITS |
|
1310 _channel = DEFAULT_CHANNEL |
|
1311 |
|
1312 pass |
|
1313 pass |
|
1314 self.mDIGIT() |
|
1315 self.mDIGIT() |
|
1316 |
|
1317 |
|
1318 |
|
1319 |
|
1320 |
|
1321 |
|
1322 self._state.type = _type |
|
1323 self._state.channel = _channel |
|
1324 |
|
1325 finally: |
|
1326 |
|
1327 pass |
|
1328 |
|
1329 |
|
1330 |
|
1331 |
|
1332 def mTokens(self): |
|
1333 alt25 = 36 |
|
1334 alt25 = self.dfa25.predict(self.input) |
|
1335 if alt25 == 1: |
|
1336 pass |
|
1337 self.mTIME() |
|
1338 |
|
1339 |
|
1340 elif alt25 == 2: |
|
1341 pass |
|
1342 self.mFIRST() |
|
1343 |
|
1344 |
|
1345 elif alt25 == 3: |
|
1346 pass |
|
1347 self.mSECOND() |
|
1348 |
|
1349 |
|
1350 elif alt25 == 4: |
|
1351 pass |
|
1352 self.mTHIRD() |
|
1353 |
|
1354 |
|
1355 elif alt25 == 5: |
|
1356 pass |
|
1357 self.mFOURTH() |
|
1358 |
|
1359 |
|
1360 elif alt25 == 6: |
|
1361 pass |
|
1362 self.mFIFTH() |
|
1363 |
|
1364 |
|
1365 elif alt25 == 7: |
|
1366 pass |
|
1367 self.mFOURTH_OR_FIFTH() |
|
1368 |
|
1369 |
|
1370 elif alt25 == 8: |
|
1371 pass |
|
1372 self.mMONDAY() |
|
1373 |
|
1374 |
|
1375 elif alt25 == 9: |
|
1376 pass |
|
1377 self.mTUESDAY() |
|
1378 |
|
1379 |
|
1380 elif alt25 == 10: |
|
1381 pass |
|
1382 self.mWEDNESDAY() |
|
1383 |
|
1384 |
|
1385 elif alt25 == 11: |
|
1386 pass |
|
1387 self.mTHURSDAY() |
|
1388 |
|
1389 |
|
1390 elif alt25 == 12: |
|
1391 pass |
|
1392 self.mFRIDAY() |
|
1393 |
|
1394 |
|
1395 elif alt25 == 13: |
|
1396 pass |
|
1397 self.mSATURDAY() |
|
1398 |
|
1399 |
|
1400 elif alt25 == 14: |
|
1401 pass |
|
1402 self.mSUNDAY() |
|
1403 |
|
1404 |
|
1405 elif alt25 == 15: |
|
1406 pass |
|
1407 self.mJANUARY() |
|
1408 |
|
1409 |
|
1410 elif alt25 == 16: |
|
1411 pass |
|
1412 self.mFEBRUARY() |
|
1413 |
|
1414 |
|
1415 elif alt25 == 17: |
|
1416 pass |
|
1417 self.mMARCH() |
|
1418 |
|
1419 |
|
1420 elif alt25 == 18: |
|
1421 pass |
|
1422 self.mAPRIL() |
|
1423 |
|
1424 |
|
1425 elif alt25 == 19: |
|
1426 pass |
|
1427 self.mMAY() |
|
1428 |
|
1429 |
|
1430 elif alt25 == 20: |
|
1431 pass |
|
1432 self.mJUNE() |
|
1433 |
|
1434 |
|
1435 elif alt25 == 21: |
|
1436 pass |
|
1437 self.mJULY() |
|
1438 |
|
1439 |
|
1440 elif alt25 == 22: |
|
1441 pass |
|
1442 self.mAUGUST() |
|
1443 |
|
1444 |
|
1445 elif alt25 == 23: |
|
1446 pass |
|
1447 self.mSEPTEMBER() |
|
1448 |
|
1449 |
|
1450 elif alt25 == 24: |
|
1451 pass |
|
1452 self.mOCTOBER() |
|
1453 |
|
1454 |
|
1455 elif alt25 == 25: |
|
1456 pass |
|
1457 self.mNOVEMBER() |
|
1458 |
|
1459 |
|
1460 elif alt25 == 26: |
|
1461 pass |
|
1462 self.mDECEMBER() |
|
1463 |
|
1464 |
|
1465 elif alt25 == 27: |
|
1466 pass |
|
1467 self.mMONTH() |
|
1468 |
|
1469 |
|
1470 elif alt25 == 28: |
|
1471 pass |
|
1472 self.mQUARTER() |
|
1473 |
|
1474 |
|
1475 elif alt25 == 29: |
|
1476 pass |
|
1477 self.mEVERY() |
|
1478 |
|
1479 |
|
1480 elif alt25 == 30: |
|
1481 pass |
|
1482 self.mHOURS() |
|
1483 |
|
1484 |
|
1485 elif alt25 == 31: |
|
1486 pass |
|
1487 self.mMINUTES() |
|
1488 |
|
1489 |
|
1490 elif alt25 == 32: |
|
1491 pass |
|
1492 self.mCOMMA() |
|
1493 |
|
1494 |
|
1495 elif alt25 == 33: |
|
1496 pass |
|
1497 self.mOF() |
|
1498 |
|
1499 |
|
1500 elif alt25 == 34: |
|
1501 pass |
|
1502 self.mWS() |
|
1503 |
|
1504 |
|
1505 elif alt25 == 35: |
|
1506 pass |
|
1507 self.mDIGIT() |
|
1508 |
|
1509 |
|
1510 elif alt25 == 36: |
|
1511 pass |
|
1512 self.mDIGITS() |
|
1513 |
|
1514 |
|
1515 |
|
1516 |
|
1517 |
|
1518 |
|
1519 |
|
1520 |
|
1521 DFA25_eot = DFA.unpack( |
|
1522 u"\1\uffff\4\27\2\uffff\1\27\1\uffff\2\27\16\uffff\1\36\1\uffff\2" |
|
1523 u"\36\31\uffff\1\74\6\uffff" |
|
1524 ) |
|
1525 |
|
1526 DFA25_eof = DFA.unpack( |
|
1527 u"\75\uffff" |
|
1528 ) |
|
1529 |
|
1530 DFA25_min = DFA.unpack( |
|
1531 u"\1\11\4\60\1\145\1\141\1\60\1\150\2\60\1\141\1\uffff\1\141\1\160" |
|
1532 u"\1\143\11\uffff\1\72\1\uffff\2\72\3\uffff\1\146\3\uffff\1\143\3" |
|
1533 u"\uffff\1\151\2\uffff\1\156\1\162\2\uffff\1\154\6\uffff\1\164\6" |
|
1534 u"\uffff" |
|
1535 ) |
|
1536 |
|
1537 DFA25_max = DFA.unpack( |
|
1538 u"\1\167\1\72\1\163\1\156\2\162\1\165\1\164\1\165\1\164\1\72\1\157" |
|
1539 u"\1\uffff\2\165\1\146\11\uffff\1\72\1\uffff\2\72\3\uffff\1\162\3" |
|
1540 u"\uffff\1\160\3\uffff\1\165\2\uffff\1\156\1\171\2\uffff\1\156\6" |
|
1541 u"\uffff\1\164\6\uffff" |
|
1542 ) |
|
1543 |
|
1544 DFA25_accept = DFA.unpack( |
|
1545 u"\14\uffff\1\12\3\uffff\1\31\1\32\1\34\1\35\1\36\1\40\1\42\1\43" |
|
1546 u"\1\1\1\uffff\1\2\2\uffff\1\3\1\44\1\4\1\uffff\1\7\1\14\1\20\1\uffff" |
|
1547 u"\1\15\1\16\1\5\1\uffff\1\11\1\6\2\uffff\1\37\1\17\1\uffff\1\22" |
|
1548 u"\1\26\1\30\1\41\1\27\1\13\1\uffff\1\21\1\23\1\24\1\25\1\33\1\10" |
|
1549 ) |
|
1550 |
|
1551 DFA25_special = DFA.unpack( |
|
1552 u"\75\uffff" |
|
1553 ) |
|
1554 |
|
1555 |
|
1556 DFA25_transition = [ |
|
1557 DFA.unpack(u"\2\26\2\uffff\1\26\22\uffff\1\26\13\uffff\1\25\3\uffff" |
|
1558 u"\1\1\1\2\1\3\1\4\1\7\1\11\4\12\47\uffff\1\16\2\uffff\1\21\1\23" |
|
1559 u"\1\5\1\uffff\1\24\1\uffff\1\15\2\uffff\1\13\1\20\1\17\1\uffff\1" |
|
1560 u"\22\1\uffff\1\6\1\10\2\uffff\1\14"), |
|
1561 DFA.unpack(u"\12\31\1\30"), |
|
1562 DFA.unpack(u"\12\33\1\30\70\uffff\1\32"), |
|
1563 DFA.unpack(u"\5\34\5\36\1\30\63\uffff\1\35"), |
|
1564 DFA.unpack(u"\12\36\1\30\67\uffff\1\37"), |
|
1565 DFA.unpack(u"\1\43\3\uffff\1\40\5\uffff\1\41\2\uffff\1\42"), |
|
1566 DFA.unpack(u"\1\45\3\uffff\1\44\17\uffff\1\46"), |
|
1567 DFA.unpack(u"\12\36\1\30\71\uffff\1\47"), |
|
1568 DFA.unpack(u"\1\50\14\uffff\1\51"), |
|
1569 DFA.unpack(u"\12\36\1\30\71\uffff\1\52"), |
|
1570 DFA.unpack(u"\12\36\1\30"), |
|
1571 DFA.unpack(u"\1\54\7\uffff\1\55\5\uffff\1\53"), |
|
1572 DFA.unpack(u""), |
|
1573 DFA.unpack(u"\1\56\23\uffff\1\57"), |
|
1574 DFA.unpack(u"\1\60\4\uffff\1\61"), |
|
1575 DFA.unpack(u"\1\62\2\uffff\1\63"), |
|
1576 DFA.unpack(u""), |
|
1577 DFA.unpack(u""), |
|
1578 DFA.unpack(u""), |
|
1579 DFA.unpack(u""), |
|
1580 DFA.unpack(u""), |
|
1581 DFA.unpack(u""), |
|
1582 DFA.unpack(u""), |
|
1583 DFA.unpack(u""), |
|
1584 DFA.unpack(u""), |
|
1585 DFA.unpack(u"\1\30"), |
|
1586 DFA.unpack(u""), |
|
1587 DFA.unpack(u"\1\30"), |
|
1588 DFA.unpack(u"\1\30"), |
|
1589 DFA.unpack(u""), |
|
1590 DFA.unpack(u""), |
|
1591 DFA.unpack(u""), |
|
1592 DFA.unpack(u"\1\41\13\uffff\1\32"), |
|
1593 DFA.unpack(u""), |
|
1594 DFA.unpack(u""), |
|
1595 DFA.unpack(u""), |
|
1596 DFA.unpack(u"\1\35\14\uffff\1\64"), |
|
1597 DFA.unpack(u""), |
|
1598 DFA.unpack(u""), |
|
1599 DFA.unpack(u""), |
|
1600 DFA.unpack(u"\1\37\13\uffff\1\65"), |
|
1601 DFA.unpack(u""), |
|
1602 DFA.unpack(u""), |
|
1603 DFA.unpack(u"\1\66"), |
|
1604 DFA.unpack(u"\1\67\6\uffff\1\70"), |
|
1605 DFA.unpack(u""), |
|
1606 DFA.unpack(u""), |
|
1607 DFA.unpack(u"\1\72\1\uffff\1\71"), |
|
1608 DFA.unpack(u""), |
|
1609 DFA.unpack(u""), |
|
1610 DFA.unpack(u""), |
|
1611 DFA.unpack(u""), |
|
1612 DFA.unpack(u""), |
|
1613 DFA.unpack(u""), |
|
1614 DFA.unpack(u"\1\73"), |
|
1615 DFA.unpack(u""), |
|
1616 DFA.unpack(u""), |
|
1617 DFA.unpack(u""), |
|
1618 DFA.unpack(u""), |
|
1619 DFA.unpack(u""), |
|
1620 DFA.unpack(u"") |
|
1621 ] |
|
1622 |
|
1623 |
|
1624 DFA25 = DFA |
|
1625 |
|
1626 |
|
1627 |
|
1628 |
|
1629 def main(argv, stdin=sys.stdin, stdout=sys.stdout, stderr=sys.stderr): |
|
1630 from antlr3.main import LexerMain |
|
1631 main = LexerMain(GrocLexer) |
|
1632 main.stdin = stdin |
|
1633 main.stdout = stdout |
|
1634 main.stderr = stderr |
|
1635 main.execute(argv) |
|
1636 |
|
1637 |
|
1638 if __name__ == '__main__': |
|
1639 main(sys.argv) |