-
-
Notifications
You must be signed in to change notification settings - Fork 37
/
mojoshader_lexer.c
1242 lines (1210 loc) · 23.7 KB
/
mojoshader_lexer.c
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
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* Generated by re2c 3.0 */
/**
* MojoShader; generate shader programs from bytecode of compiled
* Direct3D shaders.
*
* Please see the file LICENSE.txt in the source's root directory.
*
* This file written by Ryan C. Gordon.
*/
// This was originally based on examples/pp-c.re from re2c: http://re2c.org/
// re2c is public domain code.
//
// You build mojoshader_lexer.c from the .re file with re2c...
// re2c -is -o mojoshader_lexer.c mojoshader_lexer.re
//
// Changes to the lexer are done to the .re file, not the C code!
//
// Please note that this isn't a perfect C lexer, since it is used for both
// HLSL and shader assembly language, and follows the quirks of Microsoft's
// tools.
#define __MOJOSHADER_INTERNAL__ 1
#include "mojoshader_internal.h"
typedef unsigned char uchar;
#define YYMAXFILL 8
#define RET(t) return update_state(s, eoi, cursor, token, (Token) t)
#define YYCTYPE uchar
#define YYCURSOR cursor
#define YYLIMIT limit
#define YYMARKER s->lexer_marker
#define YYFILL(n) { if ((n) == 1) { cursor = sentinel; limit = cursor + YYMAXFILL; eoi = 1; } }
static uchar sentinel[YYMAXFILL];
static Token update_state(IncludeState *s, int eoi, const uchar *cur,
const uchar *tok, const Token val)
{
if (eoi)
{
s->bytes_left = 0;
s->source = (const char *) s->source_base + s->orig_length;
if ( (tok >= sentinel) && (tok < (sentinel+YYMAXFILL)) )
s->token = s->source;
else
s->token = (const char *) tok;
} // if
else
{
s->bytes_left -= (unsigned int) (cur - ((const uchar *) s->source));
s->source = (const char *) cur;
s->token = (const char *) tok;
} // else
s->tokenlen = (unsigned int) (s->source - s->token);
s->tokenval = val;
return val;
} // update_state
Token preprocessor_lexer(IncludeState *s)
{
const uchar *cursor = (const uchar *) s->source;
const uchar *token = cursor;
const uchar *matchptr;
const uchar *limit = cursor + s->bytes_left;
int eoi = 0;
// preprocessor directives are only valid at start of line.
if (s->tokenval == ((Token) '\n'))
goto ppdirective; // may jump back to scanner_loop.
scanner_loop:
if (YYLIMIT == YYCURSOR) YYFILL(1);
token = cursor;
{
YYCTYPE yych;
unsigned int yyaccept = 0;
if ((YYLIMIT - YYCURSOR) < 4) YYFILL(4);
yych = *YYCURSOR;
switch (yych) {
case 0x00: goto yy1;
case '\t':
case '\v':
case '\f':
case ' ': goto yy4;
case '\n': goto yy5;
case '\r': goto yy7;
case '!': goto yy8;
case '"': goto yy9;
case '#': goto yy10;
case '%': goto yy11;
case '&': goto yy12;
case '\'': goto yy13;
case '(': goto yy14;
case ')': goto yy15;
case '*': goto yy16;
case '+': goto yy17;
case ',': goto yy18;
case '-': goto yy19;
case '.': goto yy20;
case '/': goto yy22;
case '0': goto yy23;
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9': goto yy25;
case ':': goto yy27;
case ';': goto yy28;
case '<': goto yy29;
case '=': goto yy31;
case '>': goto yy32;
case '?': goto yy34;
case 'A':
case 'B':
case 'C':
case 'D':
case 'E':
case 'F':
case 'G':
case 'H':
case 'I':
case 'J':
case 'K':
case 'L':
case 'M':
case 'N':
case 'O':
case 'P':
case 'Q':
case 'R':
case 'S':
case 'T':
case 'U':
case 'V':
case 'W':
case 'X':
case 'Y':
case 'Z':
case '_':
case 'a':
case 'b':
case 'c':
case 'd':
case 'e':
case 'f':
case 'g':
case 'h':
case 'i':
case 'j':
case 'k':
case 'l':
case 'm':
case 'n':
case 'o':
case 'p':
case 'q':
case 'r':
case 's':
case 't':
case 'u':
case 'v':
case 'w':
case 'x':
case 'y':
case 'z': goto yy35;
case '[': goto yy37;
case '\\': goto yy38;
case ']': goto yy39;
case '^': goto yy40;
case '{': goto yy41;
case '|': goto yy42;
case '}': goto yy43;
case '~': goto yy44;
default: goto yy2;
}
yy1:
++YYCURSOR;
{ if (eoi) { RET(TOKEN_EOI); } goto bad_chars; }
yy2:
++YYCURSOR;
yy3:
{ goto bad_chars; }
yy4:
++YYCURSOR;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
if (yych <= '\n') {
if (yych == '\t') goto yy4;
} else {
if (yych <= '\f') goto yy4;
if (yych == ' ') goto yy4;
}
{ if (s->report_whitespace) RET(' '); goto scanner_loop; }
yy5:
++YYCURSOR;
yy6:
{ s->line++; RET('\n'); }
yy7:
yych = *++YYCURSOR;
if (yych == '\n') goto yy5;
goto yy6;
yy8:
yych = *++YYCURSOR;
if (yych == '=') goto yy45;
{ RET('!'); }
yy9:
yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
if (yych == '\n') goto yy3;
if (yych == '\r') goto yy3;
goto yy47;
yy10:
yych = *++YYCURSOR;
if (yych == '#') goto yy51;
{ RET(TOKEN_HASH); }
yy11:
yych = *++YYCURSOR;
if (yych == '=') goto yy52;
{ RET('%'); }
yy12:
yych = *++YYCURSOR;
if (yych == '&') goto yy53;
if (yych == '=') goto yy54;
{ RET('&'); }
yy13:
yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
if (yych == '\n') goto yy3;
if (yych == '\r') goto yy3;
goto yy56;
yy14:
++YYCURSOR;
{ RET('('); }
yy15:
++YYCURSOR;
{ RET(')'); }
yy16:
yych = *++YYCURSOR;
if (yych == '=') goto yy58;
{ RET('*'); }
yy17:
yych = *++YYCURSOR;
if (yych == '+') goto yy59;
if (yych == '=') goto yy60;
{ RET('+'); }
yy18:
++YYCURSOR;
{ RET(','); }
yy19:
yych = *++YYCURSOR;
if (yych == '-') goto yy61;
if (yych == '=') goto yy62;
{ RET('-'); }
yy20:
yych = *++YYCURSOR;
if (yych <= '/') goto yy21;
if (yych <= '9') goto yy63;
yy21:
{ RET('.'); }
yy22:
yych = *++YYCURSOR;
if (yych <= '.') {
if (yych == '*') goto yy65;
} else {
if (yych <= '/') goto yy66;
if (yych == '=') goto yy67;
}
{ RET('/'); }
yy23:
yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR);
if (yych == 'X') goto yy70;
if (yych == 'x') goto yy70;
goto yy26;
yy24:
{ RET(TOKEN_INT_LITERAL); }
yy25:
yyaccept = 1;
YYMARKER = ++YYCURSOR;
if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
yych = *YYCURSOR;
yy26:
if (yych <= 'L') {
if (yych <= '9') {
if (yych == '.') goto yy63;
if (yych <= '/') goto yy24;
goto yy25;
} else {
if (yych == 'E') goto yy68;
if (yych <= 'K') goto yy24;
goto yy69;
}
} else {
if (yych <= 'e') {
if (yych == 'U') goto yy69;
if (yych <= 'd') goto yy24;
goto yy68;
} else {
if (yych <= 'l') {
if (yych <= 'k') goto yy24;
goto yy69;
} else {
if (yych == 'u') goto yy69;
goto yy24;
}
}
}
yy27:
++YYCURSOR;
{ RET(':'); }
yy28:
++YYCURSOR;
{ if (s->asm_comments) goto singlelinecomment; RET(';'); }
yy29:
yych = *++YYCURSOR;
if (yych <= ';') goto yy30;
if (yych <= '<') goto yy71;
if (yych <= '=') goto yy72;
yy30:
{ RET('<'); }
yy31:
yych = *++YYCURSOR;
if (yych == '=') goto yy73;
{ RET('='); }
yy32:
yych = *++YYCURSOR;
if (yych <= '<') goto yy33;
if (yych <= '=') goto yy74;
if (yych <= '>') goto yy75;
yy33:
{ RET('>'); }
yy34:
++YYCURSOR;
{ RET('?'); }
yy35:
++YYCURSOR;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
if (yych <= 'Z') {
if (yych <= '/') goto yy36;
if (yych <= '9') goto yy35;
if (yych >= 'A') goto yy35;
} else {
if (yych <= '_') {
if (yych >= '_') goto yy35;
} else {
if (yych <= '`') goto yy36;
if (yych <= 'z') goto yy35;
}
}
yy36:
{ RET(TOKEN_IDENTIFIER); }
yy37:
++YYCURSOR;
{ RET('['); }
yy38:
yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
if (yych <= 0x08) goto yy3;
if (yych <= '\r') goto yy77;
if (yych == ' ') goto yy77;
goto yy3;
yy39:
++YYCURSOR;
{ RET(']'); }
yy40:
yych = *++YYCURSOR;
if (yych == '=') goto yy81;
{ RET('^'); }
yy41:
++YYCURSOR;
{ RET('{'); }
yy42:
yych = *++YYCURSOR;
if (yych == '=') goto yy82;
if (yych == '|') goto yy83;
{ RET('|'); }
yy43:
++YYCURSOR;
{ RET('}'); }
yy44:
++YYCURSOR;
{ RET('~'); }
yy45:
++YYCURSOR;
{ RET(TOKEN_NEQ); }
yy46:
++YYCURSOR;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
yy47:
if (yych <= '\r') {
if (yych == '\n') goto yy48;
if (yych <= '\f') goto yy46;
} else {
if (yych <= '"') {
if (yych <= '!') goto yy46;
goto yy49;
} else {
if (yych == '\\') goto yy50;
goto yy46;
}
}
yy48:
YYCURSOR = YYMARKER;
if (yyaccept <= 1) {
if (yyaccept == 0) {
goto yy3;
} else {
goto yy24;
}
} else {
goto yy64;
}
yy49:
++YYCURSOR;
{ RET(TOKEN_STRING_LITERAL); }
yy50:
++YYCURSOR;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
if (yych <= 'b') {
if (yych <= '7') {
if (yych <= '&') {
if (yych == '"') goto yy46;
goto yy48;
} else {
if (yych <= '\'') goto yy46;
if (yych <= '/') goto yy48;
goto yy46;
}
} else {
if (yych <= '[') {
if (yych == '?') goto yy46;
goto yy48;
} else {
if (yych <= '\\') goto yy46;
if (yych <= '`') goto yy48;
goto yy46;
}
}
} else {
if (yych <= 'r') {
if (yych <= 'm') {
if (yych == 'f') goto yy46;
goto yy48;
} else {
if (yych <= 'n') goto yy46;
if (yych <= 'q') goto yy48;
goto yy46;
}
} else {
if (yych <= 'u') {
if (yych == 't') goto yy46;
goto yy48;
} else {
if (yych <= 'v') goto yy46;
if (yych == 'x') goto yy84;
goto yy48;
}
}
}
yy51:
++YYCURSOR;
{ RET(TOKEN_HASHHASH); }
yy52:
++YYCURSOR;
{ RET(TOKEN_MODASSIGN); }
yy53:
++YYCURSOR;
{ RET(TOKEN_ANDAND); }
yy54:
++YYCURSOR;
{ RET(TOKEN_ANDASSIGN); }
yy55:
++YYCURSOR;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
yy56:
if (yych <= '\r') {
if (yych == '\n') goto yy48;
if (yych <= '\f') goto yy55;
goto yy48;
} else {
if (yych <= '\'') {
if (yych <= '&') goto yy55;
} else {
if (yych == '\\') goto yy57;
goto yy55;
}
}
++YYCURSOR;
goto yy24;
yy57:
++YYCURSOR;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
if (yych <= 'b') {
if (yych <= '7') {
if (yych <= '&') {
if (yych == '"') goto yy55;
goto yy48;
} else {
if (yych <= '\'') goto yy55;
if (yych <= '/') goto yy48;
goto yy55;
}
} else {
if (yych <= '[') {
if (yych == '?') goto yy55;
goto yy48;
} else {
if (yych <= '\\') goto yy55;
if (yych <= '`') goto yy48;
goto yy55;
}
}
} else {
if (yych <= 'r') {
if (yych <= 'm') {
if (yych == 'f') goto yy55;
goto yy48;
} else {
if (yych <= 'n') goto yy55;
if (yych <= 'q') goto yy48;
goto yy55;
}
} else {
if (yych <= 'u') {
if (yych == 't') goto yy55;
goto yy48;
} else {
if (yych <= 'v') goto yy55;
if (yych == 'x') goto yy85;
goto yy48;
}
}
}
yy58:
++YYCURSOR;
{ RET(TOKEN_MULTASSIGN); }
yy59:
++YYCURSOR;
{ RET(TOKEN_INCREMENT); }
yy60:
++YYCURSOR;
{ RET(TOKEN_ADDASSIGN); }
yy61:
++YYCURSOR;
{ RET(TOKEN_DECREMENT); }
yy62:
++YYCURSOR;
{ RET(TOKEN_SUBASSIGN); }
yy63:
yyaccept = 2;
YYMARKER = ++YYCURSOR;
if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
yych = *YYCURSOR;
if (yych <= 'G') {
if (yych <= 'D') {
if (yych <= '/') goto yy64;
if (yych <= '9') goto yy63;
} else {
if (yych <= 'E') goto yy68;
if (yych <= 'F') goto yy86;
}
} else {
if (yych <= 'e') {
if (yych <= 'H') goto yy86;
if (yych >= 'e') goto yy68;
} else {
if (yych == 'g') goto yy64;
if (yych <= 'h') goto yy86;
}
}
yy64:
{ RET(TOKEN_FLOAT_LITERAL); }
yy65:
++YYCURSOR;
{ goto multilinecomment; }
yy66:
++YYCURSOR;
{ goto singlelinecomment; }
yy67:
++YYCURSOR;
{ RET(TOKEN_DIVASSIGN); }
yy68:
yych = *++YYCURSOR;
if (yych <= ',') {
if (yych == '+') goto yy87;
goto yy48;
} else {
if (yych <= '-') goto yy87;
if (yych <= '/') goto yy48;
if (yych <= '9') goto yy88;
goto yy48;
}
yy69:
++YYCURSOR;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
if (yych <= 'U') {
if (yych == 'L') goto yy69;
if (yych <= 'T') goto yy24;
goto yy69;
} else {
if (yych <= 'l') {
if (yych <= 'k') goto yy24;
goto yy69;
} else {
if (yych == 'u') goto yy69;
goto yy24;
}
}
yy70:
yych = *++YYCURSOR;
if (yych <= '@') {
if (yych <= '/') goto yy48;
if (yych <= '9') goto yy89;
goto yy48;
} else {
if (yych <= 'F') goto yy89;
if (yych <= '`') goto yy48;
if (yych <= 'f') goto yy89;
goto yy48;
}
yy71:
yych = *++YYCURSOR;
if (yych == '=') goto yy90;
{ RET(TOKEN_LSHIFT); }
yy72:
++YYCURSOR;
{ RET(TOKEN_LEQ); }
yy73:
++YYCURSOR;
{ RET(TOKEN_EQL); }
yy74:
++YYCURSOR;
{ RET(TOKEN_GEQ); }
yy75:
yych = *++YYCURSOR;
if (yych == '=') goto yy91;
{ RET(TOKEN_RSHIFT); }
yy76:
++YYCURSOR;
if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
yy77:
if (yych <= '\f') {
if (yych <= 0x08) goto yy48;
if (yych != '\n') goto yy76;
} else {
if (yych <= '\r') goto yy80;
if (yych == ' ') goto yy76;
goto yy48;
}
yy78:
++YYCURSOR;
yy79:
{ s->line++; goto scanner_loop; }
yy80:
yych = *++YYCURSOR;
if (yych == '\n') goto yy78;
goto yy79;
yy81:
++YYCURSOR;
{ RET(TOKEN_XORASSIGN); }
yy82:
++YYCURSOR;
{ RET(TOKEN_ORASSIGN); }
yy83:
++YYCURSOR;
{ RET(TOKEN_OROR); }
yy84:
++YYCURSOR;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
if (yych <= '@') {
if (yych <= '/') goto yy48;
if (yych <= '9') goto yy46;
goto yy48;
} else {
if (yych <= 'F') goto yy46;
if (yych <= '`') goto yy48;
if (yych <= 'f') goto yy46;
goto yy48;
}
yy85:
++YYCURSOR;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
if (yych <= '@') {
if (yych <= '/') goto yy48;
if (yych <= '9') goto yy55;
goto yy48;
} else {
if (yych <= 'F') goto yy55;
if (yych <= '`') goto yy48;
if (yych <= 'f') goto yy55;
goto yy48;
}
yy86:
++YYCURSOR;
goto yy64;
yy87:
yych = *++YYCURSOR;
if (yych <= '/') goto yy48;
if (yych >= ':') goto yy48;
yy88:
++YYCURSOR;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
if (yych <= 'G') {
if (yych <= '9') {
if (yych <= '/') goto yy64;
goto yy88;
} else {
if (yych == 'F') goto yy86;
goto yy64;
}
} else {
if (yych <= 'f') {
if (yych <= 'H') goto yy86;
if (yych <= 'e') goto yy64;
goto yy86;
} else {
if (yych == 'h') goto yy86;
goto yy64;
}
}
yy89:
++YYCURSOR;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
if (yych <= 'T') {
if (yych <= '@') {
if (yych <= '/') goto yy24;
if (yych <= '9') goto yy89;
goto yy24;
} else {
if (yych <= 'F') goto yy89;
if (yych == 'L') goto yy69;
goto yy24;
}
} else {
if (yych <= 'k') {
if (yych <= 'U') goto yy69;
if (yych <= '`') goto yy24;
if (yych <= 'f') goto yy89;
goto yy24;
} else {
if (yych <= 'l') goto yy69;
if (yych == 'u') goto yy69;
goto yy24;
}
}
yy90:
++YYCURSOR;
{ RET(TOKEN_LSHIFTASSIGN); }
yy91:
++YYCURSOR;
{ RET(TOKEN_RSHIFTASSIGN); }
}
multilinecomment:
if (YYLIMIT == YYCURSOR) YYFILL(1);
matchptr = cursor;
// The "*\/" is just to avoid screwing up text editor syntax highlighting.
{
YYCTYPE yych;
if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
if (yych <= '\f') {
if (yych <= 0x00) goto yy93;
if (yych == '\n') goto yy96;
goto yy94;
} else {
if (yych <= '\r') goto yy98;
if (yych == '*') goto yy99;
goto yy94;
}
yy93:
++YYCURSOR;
{
if (eoi)
RET(TOKEN_INCOMPLETE_COMMENT);
goto multilinecomment;
}
yy94:
++YYCURSOR;
yy95:
{ goto multilinecomment; }
yy96:
++YYCURSOR;
yy97:
{
s->line++;
goto multilinecomment;
}
yy98:
yych = *++YYCURSOR;
if (yych == '\n') goto yy96;
goto yy97;
yy99:
yych = *++YYCURSOR;
if (yych != '/') goto yy95;
++YYCURSOR;
{
if (s->report_comments)
RET(TOKEN_MULTI_COMMENT);
else if (s->report_whitespace)
RET(' ');
// Microsoft's preprocessor allows multiline comments
// before a preprocessor directive, even though C/C++
// doesn't. See if we've hit this case.
#if MATCH_MICROSOFT_PREPROCESSOR
if (s->tokenval == ((Token) '\n')) // was start of line?
{
update_state(s, eoi, cursor, token, (Token) '\n');
goto ppdirective; // may jump back to scanner_loop.
}
#endif
goto scanner_loop;
}
}
singlelinecomment:
if (YYLIMIT == YYCURSOR) YYFILL(1);
matchptr = cursor;
{
YYCTYPE yych;
if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
if (yych <= '\n') {
if (yych <= 0x00) goto yy101;
if (yych <= '\t') goto yy102;
goto yy103;
} else {
if (yych == '\r') goto yy105;
goto yy102;
}
yy101:
++YYCURSOR;
{
if (eoi)
{
if (s->report_comments)
RET(TOKEN_SINGLE_COMMENT);
else
RET(TOKEN_EOI);
}
goto singlelinecomment;
}
yy102:
++YYCURSOR;
{ goto singlelinecomment; }
yy103:
++YYCURSOR;
yy104:
{
if (s->report_comments)
{
cursor = matchptr; // so we RET('\n') next.
RET(TOKEN_SINGLE_COMMENT);
}
s->line++;
token = matchptr;
RET('\n');
}
yy105:
yych = *++YYCURSOR;
if (yych == '\n') goto yy103;
goto yy104;
}
ppdirective:
if (YYLIMIT == YYCURSOR) YYFILL(1);
{
YYCTYPE yych;
unsigned int yyaccept = 0;
if ((YYLIMIT - YYCURSOR) < 8) YYFILL(8);
yych = *YYCURSOR;
if (yych <= '\f') {
if (yych == '\t') goto yy108;
if (yych >= '\v') goto yy108;
} else {
if (yych <= ' ') {
if (yych >= ' ') goto yy108;
} else {
if (yych == '#') goto yy109;
}
}
++YYCURSOR;
yy107:
{
token = cursor = (const uchar *) s->source;
limit = cursor + s->bytes_left;
goto scanner_loop;
}
yy108:
++YYCURSOR;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
if (yych <= '\n') {
if (yych == '\t') goto yy108;
} else {
if (yych <= '\f') goto yy108;
if (yych == ' ') goto yy108;
}
{ goto ppdirective; }
yy109:
yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
if (yych <= 'h') {
if (yych <= 0x1F) {
if (yych == '\t') goto yy111;
goto yy107;
} else {
if (yych <= ' ') goto yy111;
if (yych <= 'c') goto yy107;
if (yych <= 'e') goto yy111;
goto yy107;
}
} else {
if (yych <= 'o') {
if (yych <= 'i') goto yy111;
if (yych == 'l') goto yy111;
goto yy107;
} else {
if (yych <= 'p') goto yy111;
if (yych == 'u') goto yy111;
goto yy107;
}
}
yy110:
++YYCURSOR;
if ((YYLIMIT - YYCURSOR) < 7) YYFILL(7);
yych = *YYCURSOR;
yy111:
if (yych <= 'h') {
if (yych <= ' ') {
if (yych == '\t') goto yy110;
if (yych >= ' ') goto yy110;
} else {
if (yych <= 'c') goto yy112;
if (yych <= 'd') goto yy113;
if (yych <= 'e') goto yy114;
}
} else {
if (yych <= 'o') {
if (yych <= 'i') goto yy115;
if (yych == 'l') goto yy116;
} else {
if (yych <= 'p') goto yy117;
if (yych == 'u') goto yy118;
}
}
yy112:
YYCURSOR = YYMARKER;
if (yyaccept == 0) {
goto yy107;
} else {
goto yy124;
}
yy113:
yych = *++YYCURSOR;
if (yych == 'e') goto yy119;
goto yy112;
yy114:
yych = *++YYCURSOR;
if (yych <= 'm') {
if (yych == 'l') goto yy120;
goto yy112;
} else {
if (yych <= 'n') goto yy121;
if (yych == 'r') goto yy122;
goto yy112;
}
yy115:
yych = *++YYCURSOR;
if (yych == 'f') goto yy123;