summaryrefslogtreecommitdiff
path: root/examples/cppscan.cpp
blob: 689431161f864461fc4d2ff603b349cfb3bf668a (plain)
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908

#line 1 "cppscan.rl"
/*
 * A C++ scanner. Uses the longest match construction.
 * << <= <<= >> >= >>= are left out since angle brackets are used in templates.
 */

#include <string.h>
#include <stdlib.h>
#include <iostream>

#define TK_Dlit 256
#define TK_Slit 257
#define TK_Float 258
#define TK_Id 259
#define TK_NameSep 260
#define TK_Arrow 261
#define TK_PlusPlus 262
#define TK_MinusMinus 263
#define TK_ArrowStar 264
#define TK_DotStar 265
#define TK_ShiftLeft 266
#define TK_ShiftRight 267
#define TK_IntegerDecimal 268
#define TK_IntegerOctal 269
#define TK_IntegerHex 270
#define TK_EqualsEquals 271
#define TK_NotEquals 272
#define TK_AndAnd 273
#define TK_OrOr 274
#define TK_MultAssign 275
#define TK_DivAssign 276
#define TK_PercentAssign 277
#define TK_PlusAssign 278
#define TK_MinusAssign 279
#define TK_AmpAssign 280
#define TK_CaretAssign 281
#define TK_BarAssign 282
#define TK_DotDotDot 283
#define TK_Whitespace 284
#define TK_Comment 285

#define BUFSIZE 16384

/* EOF char used to flush out that last token. This should be a whitespace
 * token. */

#define LAST_CHAR 0

using std::cerr;
using std::cout;
using std::cin;
using std::endl;

static char buf[BUFSIZE];
static int line = 1, col = 1;
static char *ts, *te;
static int act, have = 0;
static int cs;


#line 63 "cppscan.cpp"
static const int Scanner_start = 12;
static const int Scanner_error = 0;

static const int Scanner_en_c_comment = 10;
static const int Scanner_en_main = 12;


#line 132 "cppscan.rl"


void token( int tok )
{
	char *data = ts;
	int len = te - ts;

	cout << '<' << tok << "> ";
	cout.write( data, len );
	cout << '\n';
	
	/* Count newlines and columns. This code is here mainly for having some
	 * code in the token routine when commenting out the above output during
	 * performance testing. */
	for ( int i = 0; i < len; i ++ ) {
		if ( data[i] == '\n' ) {
			line += 1;
			col = 1;
		}
		else {
			col += 1;
		}
	}
}

int main()
{
	std::ios::sync_with_stdio(false);

	
#line 102 "cppscan.cpp"
	{
	cs = Scanner_start;
	ts = 0;
	te = 0;
	act = 0;
	}

#line 162 "cppscan.rl"

	/* Do the first read. */
	bool done = false;
	while ( !done ) {
		char *p = buf + have;
		int space = BUFSIZE - have;

		if ( space == 0 ) {
			/* We filled up the buffer trying to scan a token. */
			cerr << "OUT OF BUFFER SPACE" << endl;
			exit(1);
		}

		cin.read( p, space );
		int len = cin.gcount();
		char *pe = p + len;
		char *eof = 0;

		/* If we see eof then append the EOF char. */
	 	if ( cin.eof() ) {
			eof = pe;
			done = true;
		}

		
#line 136 "cppscan.cpp"
	{
	if ( p == pe )
		goto _test_eof;
	switch ( cs )
	{
tr0:
#line 1 "NONE"
	{	switch( act ) {
	case 0:
	{{goto st0;}}
	break;
	case 3:
	{{p = ((te))-1;}token( TK_Id );}
	break;
	case 4:
	{{p = ((te))-1;}token( TK_Float );}
	break;
	case 5:
	{{p = ((te))-1;}token( TK_IntegerDecimal );}
	break;
	case 6:
	{{p = ((te))-1;}token( TK_IntegerOctal );}
	break;
	}
	}
	goto st12;
tr2:
#line 78 "cppscan.rl"
	{te = p+1;{token( TK_Dlit );}}
	goto st12;
tr5:
#line 76 "cppscan.rl"
	{te = p+1;{token( TK_Slit );}}
	goto st12;
tr7:
#line 124 "cppscan.rl"
	{{p = ((te))-1;}{token( ts[0] );}}
	goto st12;
tr8:
#line 121 "cppscan.rl"
	{te = p+1;{token( TK_DotDotDot );}}
	goto st12;
tr12:
#line 128 "cppscan.rl"
	{te = p+1;}
	goto st12;
tr13:
#line 90 "cppscan.rl"
	{{p = ((te))-1;}{token( TK_IntegerDecimal );}}
	goto st12;
tr20:
#line 124 "cppscan.rl"
	{te = p+1;{token( ts[0] );}}
	goto st12;
tr36:
#line 129 "cppscan.rl"
	{te = p;p--;}
	goto st12;
tr37:
#line 124 "cppscan.rl"
	{te = p;p--;{token( ts[0] );}}
	goto st12;
tr38:
#line 103 "cppscan.rl"
	{te = p+1;{token( TK_NotEquals );}}
	goto st12;
tr39:
#line 108 "cppscan.rl"
	{te = p+1;{token( TK_PercentAssign );}}
	goto st12;
tr40:
#line 104 "cppscan.rl"
	{te = p+1;{token( TK_AndAnd );}}
	goto st12;
tr41:
#line 111 "cppscan.rl"
	{te = p+1;{token( TK_AmpAssign );}}
	goto st12;
tr42:
#line 106 "cppscan.rl"
	{te = p+1;{token( TK_MultAssign );}}
	goto st12;
tr43:
#line 114 "cppscan.rl"
	{te = p+1;{token( TK_PlusPlus );}}
	goto st12;
tr44:
#line 109 "cppscan.rl"
	{te = p+1;{token( TK_PlusAssign );}}
	goto st12;
tr45:
#line 115 "cppscan.rl"
	{te = p+1;{token( TK_MinusMinus );}}
	goto st12;
tr46:
#line 110 "cppscan.rl"
	{te = p+1;{token( TK_MinusAssign );}}
	goto st12;
tr48:
#line 116 "cppscan.rl"
	{te = p;p--;{token( TK_Arrow );}}
	goto st12;
tr49:
#line 117 "cppscan.rl"
	{te = p+1;{token( TK_ArrowStar );}}
	goto st12;
tr50:
#line 118 "cppscan.rl"
	{te = p+1;{token( TK_DotStar );}}
	goto st12;
tr53:
#line 86 "cppscan.rl"
	{te = p;p--;{token( TK_Float );}}
	goto st12;
tr55:
#line 86 "cppscan.rl"
	{te = p+1;{token( TK_Float );}}
	goto st12;
tr56:
#line 127 "cppscan.rl"
	{te = p+1;{ {goto st10;} }}
	goto st12;
tr57:
#line 107 "cppscan.rl"
	{te = p+1;{token( TK_DivAssign );}}
	goto st12;
tr58:
#line 90 "cppscan.rl"
	{te = p;p--;{token( TK_IntegerDecimal );}}
	goto st12;
tr62:
#line 94 "cppscan.rl"
	{te = p;p--;{token( TK_IntegerOctal );}}
	goto st12;
tr64:
#line 94 "cppscan.rl"
	{te = p+1;{token( TK_IntegerOctal );}}
	goto st12;
tr66:
#line 90 "cppscan.rl"
	{te = p+1;{token( TK_IntegerDecimal );}}
	goto st12;
tr67:
#line 98 "cppscan.rl"
	{te = p;p--;{token( TK_IntegerHex );}}
	goto st12;
tr69:
#line 98 "cppscan.rl"
	{te = p+1;{token( TK_IntegerHex );}}
	goto st12;
tr70:
#line 101 "cppscan.rl"
	{te = p+1;{token( TK_NameSep );}}
	goto st12;
tr71:
#line 102 "cppscan.rl"
	{te = p+1;{token( TK_EqualsEquals );}}
	goto st12;
tr72:
#line 82 "cppscan.rl"
	{te = p;p--;{token( TK_Id );}}
	goto st12;
tr73:
#line 112 "cppscan.rl"
	{te = p+1;{token( TK_CaretAssign );}}
	goto st12;
tr74:
#line 113 "cppscan.rl"
	{te = p+1;{token( TK_BarAssign );}}
	goto st12;
tr75:
#line 105 "cppscan.rl"
	{te = p+1;{token( TK_OrOr );}}
	goto st12;
st12:
#line 1 "NONE"
	{ts = 0;}
#line 1 "NONE"
	{act = 0;}
	if ( ++p == pe )
		goto _test_eof12;
case 12:
#line 1 "NONE"
	{ts = p;}
#line 321 "cppscan.cpp"
	switch( (*p) ) {
		case 33: goto st14;
		case 34: goto st1;
		case 37: goto st15;
		case 38: goto st16;
		case 39: goto st3;
		case 42: goto st17;
		case 43: goto st18;
		case 45: goto st19;
		case 46: goto tr26;
		case 47: goto tr27;
		case 48: goto tr28;
		case 58: goto st33;
		case 61: goto st34;
		case 76: goto tr33;
		case 94: goto st37;
		case 95: goto st35;
		case 124: goto st38;
	}
	if ( (*p) < 65 ) {
		if ( (*p) < 49 ) {
			if ( 35 <= (*p) && (*p) <= 44 )
				goto tr20;
		} else if ( (*p) > 57 ) {
			if ( 59 <= (*p) && (*p) <= 64 )
				goto tr20;
		} else
			goto tr29;
	} else if ( (*p) > 90 ) {
		if ( (*p) < 97 ) {
			if ( 91 <= (*p) && (*p) <= 96 )
				goto tr20;
		} else if ( (*p) > 122 ) {
			if ( 123 <= (*p) && (*p) <= 126 )
				goto tr20;
		} else
			goto st35;
	} else
		goto st35;
	goto st13;
st13:
	if ( ++p == pe )
		goto _test_eof13;
case 13:
	if ( 33 <= (*p) && (*p) <= 126 )
		goto tr36;
	goto st13;
st14:
	if ( ++p == pe )
		goto _test_eof14;
case 14:
	if ( (*p) == 61 )
		goto tr38;
	goto tr37;
st1:
	if ( ++p == pe )
		goto _test_eof1;
case 1:
	switch( (*p) ) {
		case 10: goto tr0;
		case 34: goto tr2;
		case 92: goto st2;
	}
	goto st1;
st2:
	if ( ++p == pe )
		goto _test_eof2;
case 2:
	goto st1;
st15:
	if ( ++p == pe )
		goto _test_eof15;
case 15:
	if ( (*p) == 61 )
		goto tr39;
	goto tr37;
st16:
	if ( ++p == pe )
		goto _test_eof16;
case 16:
	switch( (*p) ) {
		case 38: goto tr40;
		case 61: goto tr41;
	}
	goto tr37;
st3:
	if ( ++p == pe )
		goto _test_eof3;
case 3:
	switch( (*p) ) {
		case 10: goto tr0;
		case 39: goto tr5;
		case 92: goto st4;
	}
	goto st3;
st4:
	if ( ++p == pe )
		goto _test_eof4;
case 4:
	goto st3;
st17:
	if ( ++p == pe )
		goto _test_eof17;
case 17:
	if ( (*p) == 61 )
		goto tr42;
	goto tr37;
st18:
	if ( ++p == pe )
		goto _test_eof18;
case 18:
	switch( (*p) ) {
		case 43: goto tr43;
		case 61: goto tr44;
	}
	goto tr37;
st19:
	if ( ++p == pe )
		goto _test_eof19;
case 19:
	switch( (*p) ) {
		case 45: goto tr45;
		case 61: goto tr46;
		case 62: goto st20;
	}
	goto tr37;
st20:
	if ( ++p == pe )
		goto _test_eof20;
case 20:
	if ( (*p) == 42 )
		goto tr49;
	goto tr48;
tr26:
#line 1 "NONE"
	{te = p+1;}
	goto st21;
st21:
	if ( ++p == pe )
		goto _test_eof21;
case 21:
#line 463 "cppscan.cpp"
	switch( (*p) ) {
		case 42: goto tr50;
		case 46: goto st5;
	}
	if ( 48 <= (*p) && (*p) <= 57 )
		goto tr52;
	goto tr37;
st5:
	if ( ++p == pe )
		goto _test_eof5;
case 5:
	if ( (*p) == 46 )
		goto tr8;
	goto tr7;
tr52:
#line 1 "NONE"
	{te = p+1;}
#line 86 "cppscan.rl"
	{act = 4;}
	goto st22;
st22:
	if ( ++p == pe )
		goto _test_eof22;
case 22:
#line 488 "cppscan.cpp"
	switch( (*p) ) {
		case 69: goto st6;
		case 70: goto tr55;
		case 76: goto tr55;
		case 101: goto st6;
		case 102: goto tr55;
		case 108: goto tr55;
	}
	if ( 48 <= (*p) && (*p) <= 57 )
		goto tr52;
	goto tr53;
st6:
	if ( ++p == pe )
		goto _test_eof6;
case 6:
	switch( (*p) ) {
		case 43: goto st7;
		case 45: goto st7;
	}
	if ( 48 <= (*p) && (*p) <= 57 )
		goto st23;
	goto tr0;
st7:
	if ( ++p == pe )
		goto _test_eof7;
case 7:
	if ( 48 <= (*p) && (*p) <= 57 )
		goto st23;
	goto tr0;
st23:
	if ( ++p == pe )
		goto _test_eof23;
case 23:
	switch( (*p) ) {
		case 70: goto tr55;
		case 76: goto tr55;
		case 102: goto tr55;
		case 108: goto tr55;
	}
	if ( 48 <= (*p) && (*p) <= 57 )
		goto st23;
	goto tr53;
tr27:
#line 1 "NONE"
	{te = p+1;}
	goto st24;
st24:
	if ( ++p == pe )
		goto _test_eof24;
case 24:
#line 539 "cppscan.cpp"
	switch( (*p) ) {
		case 42: goto tr56;
		case 47: goto st8;
		case 61: goto tr57;
	}
	goto tr37;
st8:
	if ( ++p == pe )
		goto _test_eof8;
case 8:
	if ( (*p) == 10 )
		goto tr12;
	goto st8;
tr28:
#line 1 "NONE"
	{te = p+1;}
#line 90 "cppscan.rl"
	{act = 5;}
	goto st25;
st25:
	if ( ++p == pe )
		goto _test_eof25;
case 25:
#line 563 "cppscan.cpp"
	switch( (*p) ) {
		case 46: goto tr52;
		case 69: goto st6;
		case 76: goto st28;
		case 85: goto st28;
		case 101: goto st6;
		case 108: goto st28;
		case 117: goto st28;
		case 120: goto st9;
	}
	if ( 48 <= (*p) && (*p) <= 57 )
		goto tr59;
	goto tr58;
tr59:
#line 1 "NONE"
	{te = p+1;}
#line 94 "cppscan.rl"
	{act = 6;}
	goto st26;
st26:
	if ( ++p == pe )
		goto _test_eof26;
case 26:
#line 587 "cppscan.cpp"
	switch( (*p) ) {
		case 46: goto tr52;
		case 69: goto st6;
		case 76: goto st27;
		case 85: goto st27;
		case 101: goto st6;
		case 108: goto st27;
		case 117: goto st27;
	}
	if ( 48 <= (*p) && (*p) <= 57 )
		goto tr59;
	goto tr62;
st27:
	if ( ++p == pe )
		goto _test_eof27;
case 27:
	switch( (*p) ) {
		case 76: goto tr64;
		case 85: goto tr64;
		case 108: goto tr64;
		case 117: goto tr64;
	}
	goto tr62;
st28:
	if ( ++p == pe )
		goto _test_eof28;
case 28:
	switch( (*p) ) {
		case 76: goto st29;
		case 85: goto st29;
		case 108: goto st29;
		case 117: goto st29;
	}
	goto tr58;
st29:
	if ( ++p == pe )
		goto _test_eof29;
case 29:
	switch( (*p) ) {
		case 76: goto tr66;
		case 85: goto tr66;
		case 108: goto tr66;
		case 117: goto tr66;
	}
	goto tr58;
st9:
	if ( ++p == pe )
		goto _test_eof9;
case 9:
	if ( (*p) < 65 ) {
		if ( 48 <= (*p) && (*p) <= 57 )
			goto st30;
	} else if ( (*p) > 70 ) {
		if ( 97 <= (*p) && (*p) <= 102 )
			goto st30;
	} else
		goto st30;
	goto tr13;
st30:
	if ( ++p == pe )
		goto _test_eof30;
case 30:
	switch( (*p) ) {
		case 76: goto st31;
		case 85: goto st31;
		case 108: goto st31;
		case 117: goto st31;
	}
	if ( (*p) < 65 ) {
		if ( 48 <= (*p) && (*p) <= 57 )
			goto st30;
	} else if ( (*p) > 70 ) {
		if ( 97 <= (*p) && (*p) <= 102 )
			goto st30;
	} else
		goto st30;
	goto tr67;
st31:
	if ( ++p == pe )
		goto _test_eof31;
case 31:
	switch( (*p) ) {
		case 76: goto tr69;
		case 85: goto tr69;
		case 108: goto tr69;
		case 117: goto tr69;
	}
	goto tr67;
tr29:
#line 1 "NONE"
	{te = p+1;}
#line 90 "cppscan.rl"
	{act = 5;}
	goto st32;
st32:
	if ( ++p == pe )
		goto _test_eof32;
case 32:
#line 686 "cppscan.cpp"
	switch( (*p) ) {
		case 46: goto tr52;
		case 69: goto st6;
		case 76: goto st28;
		case 85: goto st28;
		case 101: goto st6;
		case 108: goto st28;
		case 117: goto st28;
	}
	if ( 48 <= (*p) && (*p) <= 57 )
		goto tr29;
	goto tr58;
st33:
	if ( ++p == pe )
		goto _test_eof33;
case 33:
	if ( (*p) == 58 )
		goto tr70;
	goto tr37;
st34:
	if ( ++p == pe )
		goto _test_eof34;
case 34:
	if ( (*p) == 61 )
		goto tr71;
	goto tr37;
st35:
	if ( ++p == pe )
		goto _test_eof35;
case 35:
	if ( (*p) == 95 )
		goto st35;
	if ( (*p) < 65 ) {
		if ( 48 <= (*p) && (*p) <= 57 )
			goto st35;
	} else if ( (*p) > 90 ) {
		if ( 97 <= (*p) && (*p) <= 122 )
			goto st35;
	} else
		goto st35;
	goto tr72;
tr33:
#line 1 "NONE"
	{te = p+1;}
#line 82 "cppscan.rl"
	{act = 3;}
	goto st36;
st36:
	if ( ++p == pe )
		goto _test_eof36;
case 36:
#line 738 "cppscan.cpp"
	switch( (*p) ) {
		case 34: goto st1;
		case 39: goto st3;
		case 95: goto st35;
	}
	if ( (*p) < 65 ) {
		if ( 48 <= (*p) && (*p) <= 57 )
			goto st35;
	} else if ( (*p) > 90 ) {
		if ( 97 <= (*p) && (*p) <= 122 )
			goto st35;
	} else
		goto st35;
	goto tr72;
st37:
	if ( ++p == pe )
		goto _test_eof37;
case 37:
	if ( (*p) == 61 )
		goto tr73;
	goto tr37;
st38:
	if ( ++p == pe )
		goto _test_eof38;
case 38:
	switch( (*p) ) {
		case 61: goto tr74;
		case 124: goto tr75;
	}
	goto tr37;
st10:
#line 1 "NONE"
	{ts = 0;}
	if ( ++p == pe )
		goto _test_eof10;
case 10:
#line 775 "cppscan.cpp"
	if ( (*p) == 42 )
		goto st11;
	goto st10;
st11:
	if ( ++p == pe )
		goto _test_eof11;
case 11:
	switch( (*p) ) {
		case 42: goto st11;
		case 47: goto tr17;
	}
	goto st10;
tr17:
#line 70 "cppscan.rl"
	{ {goto st12;} }
	goto st39;
st39:
	if ( ++p == pe )
		goto _test_eof39;
case 39:
#line 796 "cppscan.cpp"
	goto st0;
st0:
cs = 0;
	goto _out;
	}
	_test_eof12: cs = 12; goto _test_eof; 
	_test_eof13: cs = 13; goto _test_eof; 
	_test_eof14: cs = 14; goto _test_eof; 
	_test_eof1: cs = 1; goto _test_eof; 
	_test_eof2: cs = 2; goto _test_eof; 
	_test_eof15: cs = 15; goto _test_eof; 
	_test_eof16: cs = 16; goto _test_eof; 
	_test_eof3: cs = 3; goto _test_eof; 
	_test_eof4: cs = 4; goto _test_eof; 
	_test_eof17: cs = 17; goto _test_eof; 
	_test_eof18: cs = 18; goto _test_eof; 
	_test_eof19: cs = 19; goto _test_eof; 
	_test_eof20: cs = 20; goto _test_eof; 
	_test_eof21: cs = 21; goto _test_eof; 
	_test_eof5: cs = 5; goto _test_eof; 
	_test_eof22: cs = 22; goto _test_eof; 
	_test_eof6: cs = 6; goto _test_eof; 
	_test_eof7: cs = 7; goto _test_eof; 
	_test_eof23: cs = 23; goto _test_eof; 
	_test_eof24: cs = 24; goto _test_eof; 
	_test_eof8: cs = 8; goto _test_eof; 
	_test_eof25: cs = 25; goto _test_eof; 
	_test_eof26: cs = 26; goto _test_eof; 
	_test_eof27: cs = 27; goto _test_eof; 
	_test_eof28: cs = 28; goto _test_eof; 
	_test_eof29: cs = 29; goto _test_eof; 
	_test_eof9: cs = 9; goto _test_eof; 
	_test_eof30: cs = 30; goto _test_eof; 
	_test_eof31: cs = 31; goto _test_eof; 
	_test_eof32: cs = 32; goto _test_eof; 
	_test_eof33: cs = 33; goto _test_eof; 
	_test_eof34: cs = 34; goto _test_eof; 
	_test_eof35: cs = 35; goto _test_eof; 
	_test_eof36: cs = 36; goto _test_eof; 
	_test_eof37: cs = 37; goto _test_eof; 
	_test_eof38: cs = 38; goto _test_eof; 
	_test_eof10: cs = 10; goto _test_eof; 
	_test_eof11: cs = 11; goto _test_eof; 
	_test_eof39: cs = 39; goto _test_eof; 

	_test_eof: {}
	if ( p == eof )
	{
	switch ( cs ) {
	case 13: goto tr36;
	case 14: goto tr37;
	case 1: goto tr0;
	case 2: goto tr0;
	case 15: goto tr37;
	case 16: goto tr37;
	case 3: goto tr0;
	case 4: goto tr0;
	case 17: goto tr37;
	case 18: goto tr37;
	case 19: goto tr37;
	case 20: goto tr48;
	case 21: goto tr37;
	case 5: goto tr7;
	case 22: goto tr53;
	case 6: goto tr0;
	case 7: goto tr0;
	case 23: goto tr53;
	case 24: goto tr37;
	case 8: goto tr7;
	case 25: goto tr58;
	case 26: goto tr62;
	case 27: goto tr62;
	case 28: goto tr58;
	case 29: goto tr58;
	case 9: goto tr13;
	case 30: goto tr67;
	case 31: goto tr67;
	case 32: goto tr58;
	case 33: goto tr37;
	case 34: goto tr37;
	case 35: goto tr72;
	case 36: goto tr72;
	case 37: goto tr37;
	case 38: goto tr37;
	}
	}

	_out: {}
	}

#line 187 "cppscan.rl"

		/* Check if we failed. */
		if ( cs == Scanner_error ) {
			/* Machine failed before finding a token. */
			cerr << "PARSE ERROR" << endl;
			exit(1);
		}

		/* Now set up the prefix. */
		if ( ts == 0 )
			have = 0;
		else {
			/* There is data that needs to be shifted over. */
			have = pe - ts;
			memmove( buf, ts, have );
			te -= (ts-buf);
			ts = buf;
		}
	}

	return 0;
}