1 /* Generated by re2c */
2 #line 1 "real_world/scanner.re"
3 // re2c $INPUT -o $OUTPUT
4 /* Id: scanner.re,v 1.37 2006/02/25 12:41:41 helly Exp */
5 #include <stdlib.h>
6 #include <string.h>
7 #include <iostream>
8 #include <sstream>
9 #include "scanner.h"
10 #include "parser.h"
11 #include "y.tab.h"
12 #include "globals.h"
13 #include "dfa.h"
14
15 extern YYSTYPE yylval;
16
17 #ifndef MAX
18 #define MAX(a,b) (((a)>(b))?(a):(b))
19 #endif
20
21 #define BSIZE 8192
22
23 #define YYCTYPE char
24 #define YYCURSOR cursor
25 #define YYLIMIT lim
26 #define YYMARKER ptr
27 #define YYFILL(n) {cursor = fill(cursor);}
28
29 #define RETURN(i) {cur = cursor; return i;}
30
31 namespace re2c
32 {
33
Scanner(std::istream & i,std::ostream & o)34 Scanner::Scanner(std::istream& i, std::ostream& o)
35 : in(i)
36 , out(o)
37 , bot(NULL), tok(NULL), ptr(NULL), cur(NULL), pos(NULL), lim(NULL)
38 , top(NULL), eof(NULL), tchar(0), tline(0), cline(1), iscfg(0)
39 {
40 ;
41 }
42
fill(char * cursor)43 char *Scanner::fill(char *cursor)
44 {
45 if(!eof)
46 {
47 uint cnt = tok - bot;
48 if(cnt)
49 {
50 memcpy(bot, tok, lim - tok);
51 tok = bot;
52 ptr -= cnt;
53 cursor -= cnt;
54 pos -= cnt;
55 lim -= cnt;
56 }
57 if((top - lim) < BSIZE)
58 {
59 char *buf = new char[(lim - bot) + BSIZE];
60 memcpy(buf, tok, lim - tok);
61 tok = buf;
62 ptr = &buf[ptr - bot];
63 cursor = &buf[cursor - bot];
64 pos = &buf[pos - bot];
65 lim = &buf[lim - bot];
66 top = &lim[BSIZE];
67 delete [] bot;
68 bot = buf;
69 }
70 in.read(lim, BSIZE);
71 if ((cnt = in.gcount()) != BSIZE )
72 {
73 eof = &lim[cnt]; *eof++ = '\0';
74 }
75 lim += cnt;
76 }
77 return cursor;
78 }
79
80 #line 96 "real_world/scanner.re"
81
82
echo()83 int Scanner::echo()
84 {
85 char *cursor = cur;
86 bool ignore_eoc = false;
87
88 if (eof && cursor == eof) // Catch EOF
89 {
90 return 0;
91 }
92
93 tok = cursor;
94 echo:
95
96 #line 97 "real_world/scanner.c"
97 {
98 YYCTYPE yych;
99 if ((YYLIMIT - YYCURSOR) < 11) YYFILL(11);
100 yych = *YYCURSOR;
101 switch (yych) {
102 case 0x00: goto yy2;
103 case '\n': goto yy6;
104 case '*': goto yy8;
105 case '/': goto yy9;
106 default: goto yy4;
107 }
108 yy2:
109 ++YYCURSOR;
110 #line 136 "real_world/scanner.re"
111 {
112 out.write((const char*)(tok), (const char*)(cursor) - (const char*)(tok) - 1); // -1 so we don't write out the \0
113 if(cursor == eof) {
114 RETURN(0);
115 }
116 }
117 #line 118 "real_world/scanner.c"
118 yy4:
119 ++YYCURSOR;
120 yy5:
121 #line 142 "real_world/scanner.re"
122 {
123 goto echo;
124 }
125 #line 126 "real_world/scanner.c"
126 yy6:
127 ++YYCURSOR;
128 #line 131 "real_world/scanner.re"
129 {
130 out.write((const char*)(tok), (const char*)(cursor) - (const char*)(tok));
131 tok = pos = cursor; cline++;
132 goto echo;
133 }
134 #line 135 "real_world/scanner.c"
135 yy8:
136 yych = *++YYCURSOR;
137 switch (yych) {
138 case '/': goto yy10;
139 default: goto yy5;
140 }
141 yy9:
142 yych = *(YYMARKER = ++YYCURSOR);
143 switch (yych) {
144 case '*': goto yy12;
145 default: goto yy5;
146 }
147 yy10:
148 ++YYCURSOR;
149 #line 122 "real_world/scanner.re"
150 {
151 if (ignore_eoc) {
152 ignore_eoc = false;
153 } else {
154 out.write((const char*)(tok), (const char*)(cursor) - (const char*)(tok));
155 }
156 tok = pos = cursor;
157 goto echo;
158 }
159 #line 160 "real_world/scanner.c"
160 yy12:
161 yych = *++YYCURSOR;
162 switch (yych) {
163 case '!': goto yy14;
164 default: goto yy13;
165 }
166 yy13:
167 YYCURSOR = YYMARKER;
168 goto yy5;
169 yy14:
170 yych = *++YYCURSOR;
171 switch (yych) {
172 case 'm': goto yy15;
173 case 'r': goto yy16;
174 default: goto yy13;
175 }
176 yy15:
177 yych = *++YYCURSOR;
178 switch (yych) {
179 case 'a': goto yy17;
180 default: goto yy13;
181 }
182 yy16:
183 yych = *++YYCURSOR;
184 switch (yych) {
185 case 'e': goto yy18;
186 default: goto yy13;
187 }
188 yy17:
189 yych = *++YYCURSOR;
190 switch (yych) {
191 case 'x': goto yy19;
192 default: goto yy13;
193 }
194 yy18:
195 yych = *++YYCURSOR;
196 switch (yych) {
197 case '2': goto yy20;
198 default: goto yy13;
199 }
200 yy19:
201 yych = *++YYCURSOR;
202 switch (yych) {
203 case ':': goto yy21;
204 default: goto yy13;
205 }
206 yy20:
207 yych = *++YYCURSOR;
208 switch (yych) {
209 case 'c': goto yy22;
210 default: goto yy13;
211 }
212 yy21:
213 yych = *++YYCURSOR;
214 switch (yych) {
215 case 'r': goto yy24;
216 default: goto yy13;
217 }
218 yy22:
219 ++YYCURSOR;
220 #line 111 "real_world/scanner.re"
221 {
222 out.write((const char*)(tok), (const char*)(&cursor[-7]) - (const char*)(tok));
223 tok = cursor;
224 RETURN(1);
225 }
226 #line 227 "real_world/scanner.c"
227 yy24:
228 yych = *++YYCURSOR;
229 switch (yych) {
230 case 'e': goto yy25;
231 default: goto yy13;
232 }
233 yy25:
234 yych = *++YYCURSOR;
235 switch (yych) {
236 case '2': goto yy26;
237 default: goto yy13;
238 }
239 yy26:
240 yych = *++YYCURSOR;
241 switch (yych) {
242 case 'c': goto yy27;
243 default: goto yy13;
244 }
245 yy27:
246 ++YYCURSOR;
247 #line 116 "real_world/scanner.re"
248 {
249 out << "#define YYMAXFILL " << maxFill << std::endl;
250 tok = pos = cursor;
251 ignore_eoc = true;
252 goto echo;
253 }
254 #line 255 "real_world/scanner.c"
255 }
256 #line 145 "real_world/scanner.re"
257
258 }
259
260
scan()261 int Scanner::scan()
262 {
263 char *cursor = cur;
264 uint depth;
265
266 scan:
267 tchar = cursor - pos;
268 tline = cline;
269 tok = cursor;
270 if (iscfg == 1)
271 {
272 goto config;
273 }
274 else if (iscfg == 2)
275 {
276 goto value;
277 }
278
279 #line 280 "real_world/scanner.c"
280 {
281 YYCTYPE yych;
282 unsigned int yyaccept = 0;
283 if ((YYLIMIT - YYCURSOR) < 5) YYFILL(5);
284 yych = *YYCURSOR;
285 switch (yych) {
286 case '\t':
287 case ' ': goto yy33;
288 case '\n': goto yy36;
289 case '\r': goto yy38;
290 case '"': goto yy39;
291 case '\'': goto yy41;
292 case '(':
293 case ')':
294 case ';':
295 case '=':
296 case '\\':
297 case '|': goto yy43;
298 case '*': goto yy45;
299 case '+':
300 case '?': goto yy47;
301 case '.': goto yy48;
302 case '/': goto yy50;
303 case 'A':
304 case 'B':
305 case 'C':
306 case 'D':
307 case 'E':
308 case 'F':
309 case 'G':
310 case 'H':
311 case 'I':
312 case 'J':
313 case 'K':
314 case 'L':
315 case 'M':
316 case 'N':
317 case 'O':
318 case 'P':
319 case 'Q':
320 case 'R':
321 case 'S':
322 case 'T':
323 case 'U':
324 case 'V':
325 case 'W':
326 case 'X':
327 case 'Y':
328 case 'Z':
329 case 'a':
330 case 'b':
331 case 'c':
332 case 'd':
333 case 'e':
334 case 'f':
335 case 'g':
336 case 'h':
337 case 'i':
338 case 'j':
339 case 'k':
340 case 'l':
341 case 'm':
342 case 'n':
343 case 'o':
344 case 'p':
345 case 'q':
346 case 's':
347 case 't':
348 case 'u':
349 case 'v':
350 case 'w':
351 case 'x':
352 case 'y':
353 case 'z': goto yy51;
354 case '[': goto yy54;
355 case 'r': goto yy56;
356 case '{': goto yy57;
357 default: goto yy31;
358 }
359 yy31:
360 ++YYCURSOR;
361 yy32:
362 #line 242 "real_world/scanner.re"
363 { std::ostringstream msg;
364 msg << "unexpected character: ";
365 prtChOrHex(msg, *tok);
366 fatal(msg.str().c_str());
367 goto scan;
368 }
369 #line 370 "real_world/scanner.c"
370 yy33:
371 ++YYCURSOR;
372 if (YYLIMIT <= YYCURSOR) YYFILL(1);
373 yych = *YYCURSOR;
374 switch (yych) {
375 case '\t':
376 case ' ': goto yy33;
377 default: goto yy35;
378 }
379 yy35:
380 #line 235 "real_world/scanner.re"
381 { goto scan; }
382 #line 383 "real_world/scanner.c"
383 yy36:
384 ++YYCURSOR;
385 #line 237 "real_world/scanner.re"
386 { if(cursor == eof) RETURN(0);
387 pos = cursor; cline++;
388 goto scan;
389 }
390 #line 391 "real_world/scanner.c"
391 yy38:
392 yych = *++YYCURSOR;
393 switch (yych) {
394 case '\n': goto yy36;
395 default: goto yy32;
396 }
397 yy39:
398 yyaccept = 0;
399 yych = *(YYMARKER = ++YYCURSOR);
400 switch (yych) {
401 case '\n': goto yy40;
402 default: goto yy60;
403 }
404 yy40:
405 #line 184 "real_world/scanner.re"
406 { fatal("unterminated string constant (missing \")"); }
407 #line 408 "real_world/scanner.c"
408 yy41:
409 yyaccept = 1;
410 yych = *(YYMARKER = ++YYCURSOR);
411 switch (yych) {
412 case '\n': goto yy42;
413 default: goto yy66;
414 }
415 yy42:
416 #line 185 "real_world/scanner.re"
417 { fatal("unterminated string constant (missing ')"); }
418 #line 419 "real_world/scanner.c"
419 yy43:
420 ++YYCURSOR;
421 yy44:
422 #line 197 "real_world/scanner.re"
423 { RETURN(*tok); }
424 #line 425 "real_world/scanner.c"
425 yy45:
426 yych = *++YYCURSOR;
427 switch (yych) {
428 case '/': goto yy70;
429 default: goto yy46;
430 }
431 yy46:
432 #line 199 "real_world/scanner.re"
433 { yylval.op = *tok;
434 RETURN(CLOSE); }
435 #line 436 "real_world/scanner.c"
436 yy47:
437 ++YYCURSOR;
438 goto yy46;
439 yy48:
440 ++YYCURSOR;
441 #line 230 "real_world/scanner.re"
442 { cur = cursor;
443 yylval.regexp = mkDot();
444 return RANGE;
445 }
446 #line 447 "real_world/scanner.c"
447 yy50:
448 yych = *++YYCURSOR;
449 switch (yych) {
450 case '*': goto yy72;
451 default: goto yy44;
452 }
453 yy51:
454 ++YYCURSOR;
455 if (YYLIMIT <= YYCURSOR) YYFILL(1);
456 yych = *YYCURSOR;
457 yy52:
458 switch (yych) {
459 case '0':
460 case '1':
461 case '2':
462 case '3':
463 case '4':
464 case '5':
465 case '6':
466 case '7':
467 case '8':
468 case '9':
469 case 'A':
470 case 'B':
471 case 'C':
472 case 'D':
473 case 'E':
474 case 'F':
475 case 'G':
476 case 'H':
477 case 'I':
478 case 'J':
479 case 'K':
480 case 'L':
481 case 'M':
482 case 'N':
483 case 'O':
484 case 'P':
485 case 'Q':
486 case 'R':
487 case 'S':
488 case 'T':
489 case 'U':
490 case 'V':
491 case 'W':
492 case 'X':
493 case 'Y':
494 case 'Z':
495 case 'a':
496 case 'b':
497 case 'c':
498 case 'd':
499 case 'e':
500 case 'f':
501 case 'g':
502 case 'h':
503 case 'i':
504 case 'j':
505 case 'k':
506 case 'l':
507 case 'm':
508 case 'n':
509 case 'o':
510 case 'p':
511 case 'q':
512 case 'r':
513 case 's':
514 case 't':
515 case 'u':
516 case 'v':
517 case 'w':
518 case 'x':
519 case 'y':
520 case 'z': goto yy51;
521 default: goto yy53;
522 }
523 yy53:
524 #line 226 "real_world/scanner.re"
525 { cur = cursor;
526 yylval.symbol = Symbol::find(token());
527 return ID; }
528 #line 529 "real_world/scanner.c"
529 yy54:
530 yyaccept = 2;
531 yych = *(YYMARKER = ++YYCURSOR);
532 switch (yych) {
533 case '\n': goto yy55;
534 case '^': goto yy79;
535 default: goto yy75;
536 }
537 yy55:
538 #line 195 "real_world/scanner.re"
539 { fatal("unterminated range (missing ])"); }
540 #line 541 "real_world/scanner.c"
541 yy56:
542 yych = *++YYCURSOR;
543 switch (yych) {
544 case 'e': goto yy81;
545 default: goto yy52;
546 }
547 yy57:
548 yyaccept = 3;
549 yych = *(YYMARKER = ++YYCURSOR);
550 switch (yych) {
551 case ',': goto yy82;
552 case '0': goto yy84;
553 case '1':
554 case '2':
555 case '3':
556 case '4':
557 case '5':
558 case '6':
559 case '7':
560 case '8':
561 case '9': goto yy85;
562 default: goto yy58;
563 }
564 yy58:
565 #line 167 "real_world/scanner.re"
566 { depth = 1;
567 goto code;
568 }
569 #line 570 "real_world/scanner.c"
570 yy59:
571 ++YYCURSOR;
572 if (YYLIMIT <= YYCURSOR) YYFILL(1);
573 yych = *YYCURSOR;
574 yy60:
575 switch (yych) {
576 case '\n': goto yy61;
577 case '"': goto yy62;
578 case '\\': goto yy64;
579 default: goto yy59;
580 }
581 yy61:
582 YYCURSOR = YYMARKER;
583 switch (yyaccept) {
584 case 0:
585 goto yy40;
586 case 1:
587 goto yy42;
588 case 2:
589 goto yy55;
590 case 3:
591 goto yy58;
592 case 4:
593 goto yy83;
594 case 5:
595 goto yy53;
596 default:
597 goto yy107;
598 }
599 yy62:
600 ++YYCURSOR;
601 #line 176 "real_world/scanner.re"
602 { cur = cursor;
603 yylval.regexp = strToRE(token());
604 return STRING; }
605 #line 606 "real_world/scanner.c"
606 yy64:
607 ++YYCURSOR;
608 if (YYLIMIT <= YYCURSOR) YYFILL(1);
609 yych = *YYCURSOR;
610 switch (yych) {
611 case '\n': goto yy61;
612 default: goto yy59;
613 }
614 yy65:
615 ++YYCURSOR;
616 if (YYLIMIT <= YYCURSOR) YYFILL(1);
617 yych = *YYCURSOR;
618 yy66:
619 switch (yych) {
620 case '\n': goto yy61;
621 case '\'': goto yy67;
622 case '\\': goto yy69;
623 default: goto yy65;
624 }
625 yy67:
626 ++YYCURSOR;
627 #line 180 "real_world/scanner.re"
628 { cur = cursor;
629 yylval.regexp = strToCaseInsensitiveRE(token());
630 return STRING; }
631 #line 632 "real_world/scanner.c"
632 yy69:
633 ++YYCURSOR;
634 if (YYLIMIT <= YYCURSOR) YYFILL(1);
635 yych = *YYCURSOR;
636 switch (yych) {
637 case '\n': goto yy61;
638 default: goto yy65;
639 }
640 yy70:
641 ++YYCURSOR;
642 #line 173 "real_world/scanner.re"
643 { tok = cursor;
644 RETURN(0); }
645 #line 646 "real_world/scanner.c"
646 yy72:
647 ++YYCURSOR;
648 #line 170 "real_world/scanner.re"
649 { depth = 1;
650 goto comment; }
651 #line 652 "real_world/scanner.c"
652 yy74:
653 ++YYCURSOR;
654 if (YYLIMIT <= YYCURSOR) YYFILL(1);
655 yych = *YYCURSOR;
656 yy75:
657 switch (yych) {
658 case '\n': goto yy61;
659 case '\\': goto yy76;
660 case ']': goto yy77;
661 default: goto yy74;
662 }
663 yy76:
664 ++YYCURSOR;
665 if (YYLIMIT <= YYCURSOR) YYFILL(1);
666 yych = *YYCURSOR;
667 switch (yych) {
668 case '\n': goto yy61;
669 default: goto yy74;
670 }
671 yy77:
672 ++YYCURSOR;
673 #line 191 "real_world/scanner.re"
674 { cur = cursor;
675 yylval.regexp = ranToRE(token());
676 return RANGE; }
677 #line 678 "real_world/scanner.c"
678 yy79:
679 ++YYCURSOR;
680 if (YYLIMIT <= YYCURSOR) YYFILL(1);
681 yych = *YYCURSOR;
682 switch (yych) {
683 case '\n': goto yy61;
684 case '\\': goto yy87;
685 case ']': goto yy88;
686 default: goto yy79;
687 }
688 yy81:
689 yych = *++YYCURSOR;
690 switch (yych) {
691 case '2': goto yy90;
692 default: goto yy52;
693 }
694 yy82:
695 ++YYCURSOR;
696 yy83:
697 #line 217 "real_world/scanner.re"
698 { fatal("illegal closure form, use '{n}', '{n,}', '{n,m}' where n and m are numbers"); }
699 #line 700 "real_world/scanner.c"
700 yy84:
701 yych = *++YYCURSOR;
702 switch (yych) {
703 case ',': goto yy91;
704 default: goto yy86;
705 }
706 yy85:
707 ++YYCURSOR;
708 if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
709 yych = *YYCURSOR;
710 yy86:
711 switch (yych) {
712 case ',': goto yy94;
713 case '0':
714 case '1':
715 case '2':
716 case '3':
717 case '4':
718 case '5':
719 case '6':
720 case '7':
721 case '8':
722 case '9': goto yy85;
723 case '}': goto yy92;
724 default: goto yy61;
725 }
726 yy87:
727 ++YYCURSOR;
728 if (YYLIMIT <= YYCURSOR) YYFILL(1);
729 yych = *YYCURSOR;
730 switch (yych) {
731 case '\n': goto yy61;
732 default: goto yy79;
733 }
734 yy88:
735 ++YYCURSOR;
736 #line 187 "real_world/scanner.re"
737 { cur = cursor;
738 yylval.regexp = invToRE(token());
739 return RANGE; }
740 #line 741 "real_world/scanner.c"
741 yy90:
742 yych = *++YYCURSOR;
743 switch (yych) {
744 case 'c': goto yy95;
745 default: goto yy52;
746 }
747 yy91:
748 yyaccept = 4;
749 yych = *(YYMARKER = ++YYCURSOR);
750 switch (yych) {
751 case '0':
752 case '1':
753 case '2':
754 case '3':
755 case '4':
756 case '5':
757 case '6':
758 case '7':
759 case '8':
760 case '9': goto yy96;
761 case '}': goto yy98;
762 default: goto yy83;
763 }
764 yy92:
765 ++YYCURSOR;
766 #line 205 "real_world/scanner.re"
767 { yylval.extop.minsize = atoi((char *)tok+1);
768 yylval.extop.maxsize = atoi((char *)tok+1);
769 RETURN(CLOSESIZE); }
770 #line 771 "real_world/scanner.c"
771 yy94:
772 yyaccept = 4;
773 yych = *(YYMARKER = ++YYCURSOR);
774 switch (yych) {
775 case '0':
776 case '1':
777 case '2':
778 case '3':
779 case '4':
780 case '5':
781 case '6':
782 case '7':
783 case '8':
784 case '9': goto yy96;
785 case '}': goto yy100;
786 default: goto yy83;
787 }
788 yy95:
789 yyaccept = 5;
790 yych = *(YYMARKER = ++YYCURSOR);
791 switch (yych) {
792 case ':': goto yy102;
793 default: goto yy52;
794 }
795 yy96:
796 ++YYCURSOR;
797 if (YYLIMIT <= YYCURSOR) YYFILL(1);
798 yych = *YYCURSOR;
799 switch (yych) {
800 case '0':
801 case '1':
802 case '2':
803 case '3':
804 case '4':
805 case '5':
806 case '6':
807 case '7':
808 case '8':
809 case '9': goto yy96;
810 case '}': goto yy103;
811 default: goto yy61;
812 }
813 yy98:
814 ++YYCURSOR;
815 #line 202 "real_world/scanner.re"
816 { yylval.op = '*';
817 RETURN(CLOSE); }
818 #line 819 "real_world/scanner.c"
819 yy100:
820 ++YYCURSOR;
821 #line 213 "real_world/scanner.re"
822 { yylval.extop.minsize = atoi((char *)tok+1);
823 yylval.extop.maxsize = -1;
824 RETURN(CLOSESIZE); }
825 #line 826 "real_world/scanner.c"
826 yy102:
827 ++YYCURSOR;
828 if (YYLIMIT <= YYCURSOR) YYFILL(1);
829 yych = *YYCURSOR;
830 switch (yych) {
831 case 'A':
832 case 'B':
833 case 'C':
834 case 'D':
835 case 'E':
836 case 'F':
837 case 'G':
838 case 'H':
839 case 'I':
840 case 'J':
841 case 'K':
842 case 'L':
843 case 'M':
844 case 'N':
845 case 'O':
846 case 'P':
847 case 'Q':
848 case 'R':
849 case 'S':
850 case 'T':
851 case 'U':
852 case 'V':
853 case 'W':
854 case 'X':
855 case 'Y':
856 case 'Z':
857 case 'a':
858 case 'b':
859 case 'c':
860 case 'd':
861 case 'e':
862 case 'f':
863 case 'g':
864 case 'h':
865 case 'i':
866 case 'j':
867 case 'k':
868 case 'l':
869 case 'm':
870 case 'n':
871 case 'o':
872 case 'p':
873 case 'q':
874 case 'r':
875 case 's':
876 case 't':
877 case 'u':
878 case 'v':
879 case 'w':
880 case 'x':
881 case 'y':
882 case 'z': goto yy105;
883 default: goto yy61;
884 }
885 yy103:
886 ++YYCURSOR;
887 #line 209 "real_world/scanner.re"
888 { yylval.extop.minsize = atoi((char *)tok+1);
889 yylval.extop.maxsize = MAX(yylval.extop.minsize,atoi(strchr((char *)tok, ',')+1));
890 RETURN(CLOSESIZE); }
891 #line 892 "real_world/scanner.c"
892 yy105:
893 yyaccept = 6;
894 YYMARKER = ++YYCURSOR;
895 if (YYLIMIT <= YYCURSOR) YYFILL(1);
896 yych = *YYCURSOR;
897 switch (yych) {
898 case '0':
899 case '1':
900 case '2':
901 case '3':
902 case '4':
903 case '5':
904 case '6':
905 case '7':
906 case '8':
907 case '9':
908 case 'A':
909 case 'B':
910 case 'C':
911 case 'D':
912 case 'E':
913 case 'F':
914 case 'G':
915 case 'H':
916 case 'I':
917 case 'J':
918 case 'K':
919 case 'L':
920 case 'M':
921 case 'N':
922 case 'O':
923 case 'P':
924 case 'Q':
925 case 'R':
926 case 'S':
927 case 'T':
928 case 'U':
929 case 'V':
930 case 'W':
931 case 'X':
932 case 'Y':
933 case 'Z':
934 case '_':
935 case 'a':
936 case 'b':
937 case 'c':
938 case 'd':
939 case 'e':
940 case 'f':
941 case 'g':
942 case 'h':
943 case 'i':
944 case 'j':
945 case 'k':
946 case 'l':
947 case 'm':
948 case 'n':
949 case 'o':
950 case 'p':
951 case 'q':
952 case 'r':
953 case 's':
954 case 't':
955 case 'u':
956 case 'v':
957 case 'w':
958 case 'x':
959 case 'y':
960 case 'z': goto yy105;
961 case ':': goto yy102;
962 default: goto yy107;
963 }
964 yy107:
965 #line 219 "real_world/scanner.re"
966 { cur = cursor;
967 tok+= 5; /* skip "re2c:" */
968 iscfg = 1;
969 yylval.str = new Str(token());
970 return CONFIG;
971 }
972 #line 973 "real_world/scanner.c"
973 }
974 #line 248 "real_world/scanner.re"
975
976
977 code:
978
979 #line 980 "real_world/scanner.c"
980 {
981 YYCTYPE yych;
982 if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
983 yych = *YYCURSOR;
984 switch (yych) {
985 case '\n': goto yy112;
986 case '"': goto yy114;
987 case '\'': goto yy115;
988 case '{': goto yy116;
989 case '}': goto yy118;
990 default: goto yy110;
991 }
992 yy110:
993 ++YYCURSOR;
994 yy111:
995 #line 264 "real_world/scanner.re"
996 { goto code; }
997 #line 998 "real_world/scanner.c"
998 yy112:
999 ++YYCURSOR;
1000 #line 260 "real_world/scanner.re"
1001 { if(cursor == eof) fatal("missing '}'");
1002 pos = cursor; cline++;
1003 goto code;
1004 }
1005 #line 1006 "real_world/scanner.c"
1006 yy114:
1007 yych = *(YYMARKER = ++YYCURSOR);
1008 switch (yych) {
1009 case '\n': goto yy111;
1010 default: goto yy121;
1011 }
1012 yy115:
1013 yych = *(YYMARKER = ++YYCURSOR);
1014 switch (yych) {
1015 case '\n': goto yy111;
1016 default: goto yy125;
1017 }
1018 yy116:
1019 ++YYCURSOR;
1020 #line 258 "real_world/scanner.re"
1021 { ++depth;
1022 goto code; }
1023 #line 1024 "real_world/scanner.c"
1024 yy118:
1025 ++YYCURSOR;
1026 #line 252 "real_world/scanner.re"
1027 { if(--depth == 0){
1028 cur = cursor;
1029 yylval.token = new Token(token(), tline);
1030 return CODE;
1031 }
1032 goto code; }
1033 #line 1034 "real_world/scanner.c"
1034 yy120:
1035 ++YYCURSOR;
1036 if (YYLIMIT <= YYCURSOR) YYFILL(1);
1037 yych = *YYCURSOR;
1038 yy121:
1039 switch (yych) {
1040 case '\n': goto yy122;
1041 case '"': goto yy110;
1042 case '\\': goto yy123;
1043 default: goto yy120;
1044 }
1045 yy122:
1046 YYCURSOR = YYMARKER;
1047 goto yy111;
1048 yy123:
1049 ++YYCURSOR;
1050 if (YYLIMIT <= YYCURSOR) YYFILL(1);
1051 yych = *YYCURSOR;
1052 switch (yych) {
1053 case '\n': goto yy122;
1054 default: goto yy120;
1055 }
1056 yy124:
1057 ++YYCURSOR;
1058 if (YYLIMIT <= YYCURSOR) YYFILL(1);
1059 yych = *YYCURSOR;
1060 yy125:
1061 switch (yych) {
1062 case '\n': goto yy122;
1063 case '\'': goto yy110;
1064 case '\\': goto yy126;
1065 default: goto yy124;
1066 }
1067 yy126:
1068 ++YYCURSOR;
1069 if (YYLIMIT <= YYCURSOR) YYFILL(1);
1070 yych = *YYCURSOR;
1071 switch (yych) {
1072 case '\n': goto yy122;
1073 default: goto yy124;
1074 }
1075 }
1076 #line 265 "real_world/scanner.re"
1077
1078
1079 comment:
1080
1081 #line 1082 "real_world/scanner.c"
1082 {
1083 YYCTYPE yych;
1084 if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
1085 yych = *YYCURSOR;
1086 switch (yych) {
1087 case '\n': goto yy131;
1088 case '*': goto yy133;
1089 case '/': goto yy134;
1090 default: goto yy129;
1091 }
1092 yy129:
1093 ++YYCURSOR;
1094 yy130:
1095 #line 280 "real_world/scanner.re"
1096 { if(cursor == eof) RETURN(0);
1097 goto comment; }
1098 #line 1099 "real_world/scanner.c"
1099 yy131:
1100 ++YYCURSOR;
1101 #line 276 "real_world/scanner.re"
1102 { if(cursor == eof) RETURN(0);
1103 tok = pos = cursor; cline++;
1104 goto comment;
1105 }
1106 #line 1107 "real_world/scanner.c"
1107 yy133:
1108 yych = *++YYCURSOR;
1109 switch (yych) {
1110 case '/': goto yy135;
1111 default: goto yy130;
1112 }
1113 yy134:
1114 yych = *++YYCURSOR;
1115 switch (yych) {
1116 case '*': goto yy137;
1117 default: goto yy130;
1118 }
1119 yy135:
1120 ++YYCURSOR;
1121 #line 269 "real_world/scanner.re"
1122 { if(--depth == 0)
1123 goto scan;
1124 else
1125 goto comment; }
1126 #line 1127 "real_world/scanner.c"
1127 yy137:
1128 ++YYCURSOR;
1129 #line 273 "real_world/scanner.re"
1130 { ++depth;
1131 fatal("ambiguous /* found");
1132 goto comment; }
1133 #line 1134 "real_world/scanner.c"
1134 }
1135 #line 282 "real_world/scanner.re"
1136
1137
1138 config:
1139
1140 #line 1141 "real_world/scanner.c"
1141 {
1142 YYCTYPE yych;
1143 if (YYLIMIT <= YYCURSOR) YYFILL(1);
1144 yych = *YYCURSOR;
1145 switch (yych) {
1146 case '\t':
1147 case ' ': goto yy143;
1148 case '=': goto yy146;
1149 default: goto yy141;
1150 }
1151 yy141:
1152 ++YYCURSOR;
1153 #line 291 "real_world/scanner.re"
1154 { fatal("missing '='"); }
1155 #line 1156 "real_world/scanner.c"
1156 yy143:
1157 ++YYCURSOR;
1158 if (YYLIMIT <= YYCURSOR) YYFILL(1);
1159 yych = *YYCURSOR;
1160 switch (yych) {
1161 case '\t':
1162 case ' ': goto yy143;
1163 default: goto yy145;
1164 }
1165 yy145:
1166 #line 286 "real_world/scanner.re"
1167 { goto config; }
1168 #line 1169 "real_world/scanner.c"
1169 yy146:
1170 ++YYCURSOR;
1171 if (YYLIMIT <= YYCURSOR) YYFILL(1);
1172 yych = *YYCURSOR;
1173 switch (yych) {
1174 case '\t':
1175 case ' ': goto yy146;
1176 default: goto yy148;
1177 }
1178 yy148:
1179 #line 287 "real_world/scanner.re"
1180 { iscfg = 2;
1181 cur = cursor;
1182 RETURN('=');
1183 }
1184 #line 1185 "real_world/scanner.c"
1185 }
1186 #line 292 "real_world/scanner.re"
1187
1188
1189 value:
1190
1191 #line 1192 "real_world/scanner.c"
1192 {
1193 YYCTYPE yych;
1194 if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
1195 yych = *YYCURSOR;
1196 switch (yych) {
1197 case '\t':
1198 case '\n':
1199 case '\r':
1200 case ' ':
1201 case ';': goto yy151;
1202 case '"': goto yy154;
1203 case '\'': goto yy156;
1204 case '-': goto yy158;
1205 case '0': goto yy159;
1206 case '1':
1207 case '2':
1208 case '3':
1209 case '4':
1210 case '5':
1211 case '6':
1212 case '7':
1213 case '8':
1214 case '9': goto yy161;
1215 default: goto yy152;
1216 }
1217 yy151:
1218 #line 301 "real_world/scanner.re"
1219 { cur = cursor;
1220 yylval.str = new Str(token());
1221 iscfg = 0;
1222 return VALUE;
1223 }
1224 #line 1225 "real_world/scanner.c"
1225 yy152:
1226 ++YYCURSOR;
1227 if (YYLIMIT <= YYCURSOR) YYFILL(1);
1228 yych = *YYCURSOR;
1229 yy153:
1230 switch (yych) {
1231 case '\t':
1232 case '\n':
1233 case '\r':
1234 case ' ':
1235 case ';': goto yy151;
1236 default: goto yy152;
1237 }
1238 yy154:
1239 YYMARKER = ++YYCURSOR;
1240 if (YYLIMIT <= YYCURSOR) YYFILL(1);
1241 yych = *YYCURSOR;
1242 switch (yych) {
1243 case '\t':
1244 case '\r':
1245 case ' ':
1246 case ';': goto yy163;
1247 case '\n': goto yy151;
1248 case '"': goto yy152;
1249 case '\\': goto yy166;
1250 default: goto yy154;
1251 }
1252 yy156:
1253 YYMARKER = ++YYCURSOR;
1254 if (YYLIMIT <= YYCURSOR) YYFILL(1);
1255 yych = *YYCURSOR;
1256 switch (yych) {
1257 case '\t':
1258 case '\r':
1259 case ' ':
1260 case ';': goto yy167;
1261 case '\n': goto yy151;
1262 case '\'': goto yy152;
1263 case '\\': goto yy169;
1264 default: goto yy156;
1265 }
1266 yy158:
1267 yych = *++YYCURSOR;
1268 switch (yych) {
1269 case '1':
1270 case '2':
1271 case '3':
1272 case '4':
1273 case '5':
1274 case '6':
1275 case '7':
1276 case '8':
1277 case '9': goto yy161;
1278 default: goto yy153;
1279 }
1280 yy159:
1281 yych = *++YYCURSOR;
1282 switch (yych) {
1283 case '\t':
1284 case '\n':
1285 case '\r':
1286 case ' ':
1287 case ';': goto yy160;
1288 default: goto yy152;
1289 }
1290 yy160:
1291 #line 296 "real_world/scanner.re"
1292 { cur = cursor;
1293 yylval.number = atoi(token().to_string().c_str());
1294 iscfg = 0;
1295 return NUMBER;
1296 }
1297 #line 1298 "real_world/scanner.c"
1298 yy161:
1299 ++YYCURSOR;
1300 if (YYLIMIT <= YYCURSOR) YYFILL(1);
1301 yych = *YYCURSOR;
1302 switch (yych) {
1303 case '\t':
1304 case '\n':
1305 case '\r':
1306 case ' ':
1307 case ';': goto yy160;
1308 case '0':
1309 case '1':
1310 case '2':
1311 case '3':
1312 case '4':
1313 case '5':
1314 case '6':
1315 case '7':
1316 case '8':
1317 case '9': goto yy161;
1318 default: goto yy152;
1319 }
1320 yy163:
1321 ++YYCURSOR;
1322 if (YYLIMIT <= YYCURSOR) YYFILL(1);
1323 yych = *YYCURSOR;
1324 switch (yych) {
1325 case '\n': goto yy165;
1326 case '"': goto yy170;
1327 case '\\': goto yy171;
1328 default: goto yy163;
1329 }
1330 yy165:
1331 YYCURSOR = YYMARKER;
1332 goto yy151;
1333 yy166:
1334 YYMARKER = ++YYCURSOR;
1335 if (YYLIMIT <= YYCURSOR) YYFILL(1);
1336 yych = *YYCURSOR;
1337 switch (yych) {
1338 case '\t':
1339 case '\r':
1340 case ' ':
1341 case ';': goto yy163;
1342 case '\n': goto yy151;
1343 default: goto yy154;
1344 }
1345 yy167:
1346 ++YYCURSOR;
1347 if (YYLIMIT <= YYCURSOR) YYFILL(1);
1348 yych = *YYCURSOR;
1349 switch (yych) {
1350 case '\n': goto yy165;
1351 case '\'': goto yy170;
1352 case '\\': goto yy172;
1353 default: goto yy167;
1354 }
1355 yy169:
1356 YYMARKER = ++YYCURSOR;
1357 if (YYLIMIT <= YYCURSOR) YYFILL(1);
1358 yych = *YYCURSOR;
1359 switch (yych) {
1360 case '\t':
1361 case '\r':
1362 case ' ':
1363 case ';': goto yy167;
1364 case '\n': goto yy151;
1365 default: goto yy156;
1366 }
1367 yy170:
1368 ++YYCURSOR;
1369 goto yy151;
1370 yy171:
1371 ++YYCURSOR;
1372 if (YYLIMIT <= YYCURSOR) YYFILL(1);
1373 yych = *YYCURSOR;
1374 switch (yych) {
1375 case '\n': goto yy165;
1376 default: goto yy163;
1377 }
1378 yy172:
1379 ++YYCURSOR;
1380 if (YYLIMIT <= YYCURSOR) YYFILL(1);
1381 yych = *YYCURSOR;
1382 switch (yych) {
1383 case '\n': goto yy165;
1384 default: goto yy167;
1385 }
1386 }
1387 #line 306 "real_world/scanner.re"
1388
1389 }
1390
fatal(uint ofs,const char * msg)1391 void Scanner::fatal(uint ofs, const char *msg) const
1392 {
1393 out.flush();
1394 std::cerr << "re2c: error: "
1395 << "line " << tline << ", column " << (tchar + ofs + 1) << ": "
1396 << msg << std::endl;
1397 exit(1);
1398 }
1399
1400 } // end namespace re2c
1401
1402 real_world/scanner.re:301:8: warning: rule matches empty string [-Wmatch-empty-string]
1403