1 // Copyright (c) 2008 Roberto Raggi <roberto.raggi@gmail.com>
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a copy
4 // of this software and associated documentation files (the "Software"), to deal
5 // in the Software without restriction, including without limitation the rights
6 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 // copies of the Software, and to permit persons to whom the Software is
8 // furnished to do so, subject to the following conditions:
9 //
10 // The above copyright notice and this permission notice shall be included in
11 // all copies or substantial portions of the Software.
12 //
13 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 // THE SOFTWARE.
20
21 #include "Lexer.h"
22 #include "Token.h"
23
24 namespace CPlusPlus {
25
26
27 // === following code is generated with cplusplus-keywordgen tool
28 // === from source file: Keywords.kwgen
29
30 // === keywords begin
31
classify2(const char * s,LanguageFeatures)32 static inline int classify2(const char *s, LanguageFeatures)
33 {
34 if (s[0] == 'd') {
35 if (s[1] == 'o') {
36 return T_DO;
37 }
38 }
39 else if (s[0] == 'i') {
40 if (s[1] == 'f') {
41 return T_IF;
42 }
43 }
44 return T_IDENTIFIER;
45 }
46
classify3(const char * s,LanguageFeatures features)47 static inline int classify3(const char *s, LanguageFeatures features)
48 {
49 if (s[0] == 'a') {
50 if (s[1] == 's') {
51 if (s[2] == 'm') {
52 return T_ASM;
53 }
54 }
55 }
56 else if (s[0] == 'f') {
57 if (s[1] == 'o') {
58 if (s[2] == 'r') {
59 return T_FOR;
60 }
61 }
62 }
63 else if (s[0] == 'i') {
64 if (s[1] == 'n') {
65 if (s[2] == 't') {
66 return T_INT;
67 }
68 }
69 }
70 else if (features.cxxEnabled && s[0] == 'n') {
71 if (s[1] == 'e') {
72 if (s[2] == 'w') {
73 return T_NEW;
74 }
75 }
76 }
77 else if (features.cxxEnabled && s[0] == 't') {
78 if (s[1] == 'r') {
79 if (s[2] == 'y') {
80 return T_TRY;
81 }
82 }
83 }
84 else if (features.qtMocRunEnabled && s[0] == 'Q') {
85 if (s[1] == '_') {
86 if (s[2] == 'D') {
87 return T_Q_D;
88 }
89 else if (s[2] == 'Q') {
90 return T_Q_Q;
91 }
92 }
93 }
94 return T_IDENTIFIER;
95 }
96
classify4(const char * s,LanguageFeatures features)97 static inline int classify4(const char *s, LanguageFeatures features)
98 {
99 if (features.cxxEnabled && s[0] == 'a') {
100 if (s[1] == 'u') {
101 if (s[2] == 't') {
102 if (s[3] == 'o') {
103 return T_AUTO;
104 }
105 }
106 }
107 }
108 else if (features.cxxEnabled && s[0] == 'b') {
109 if (s[1] == 'o') {
110 if (s[2] == 'o') {
111 if (s[3] == 'l') {
112 return T_BOOL;
113 }
114 }
115 }
116 }
117 else if (s[0] == 'c') {
118 if (s[1] == 'a') {
119 if (s[2] == 's') {
120 if (s[3] == 'e') {
121 return T_CASE;
122 }
123 }
124 }
125 else if (s[1] == 'h') {
126 if (s[2] == 'a') {
127 if (s[3] == 'r') {
128 return T_CHAR;
129 }
130 }
131 }
132 }
133 else if (s[0] == 'e') {
134 if (s[1] == 'l') {
135 if (s[2] == 's') {
136 if (s[3] == 'e') {
137 return T_ELSE;
138 }
139 }
140 }
141 else if (features.qtKeywordsEnabled && s[1] == 'm') {
142 if (s[2] == 'i') {
143 if (s[3] == 't') {
144 return T_EMIT;
145 }
146 }
147 }
148 else if (s[1] == 'n') {
149 if (s[2] == 'u') {
150 if (s[3] == 'm') {
151 return T_ENUM;
152 }
153 }
154 }
155 }
156 else if (s[0] == 'g') {
157 if (s[1] == 'o') {
158 if (s[2] == 't') {
159 if (s[3] == 'o') {
160 return T_GOTO;
161 }
162 }
163 }
164 }
165 else if (s[0] == 'l') {
166 if (s[1] == 'o') {
167 if (s[2] == 'n') {
168 if (s[3] == 'g') {
169 return T_LONG;
170 }
171 }
172 }
173 }
174 else if (features.cxxEnabled && s[0] == 't') {
175 if (s[1] == 'h') {
176 if (s[2] == 'i') {
177 if (s[3] == 's') {
178 return T_THIS;
179 }
180 }
181 }
182 else if (s[1] == 'r') {
183 if (s[2] == 'u') {
184 if (s[3] == 'e') {
185 return T_TRUE;
186 }
187 }
188 }
189 }
190 else if (s[0] == 'v') {
191 if (s[1] == 'o') {
192 if (s[2] == 'i') {
193 if (s[3] == 'd') {
194 return T_VOID;
195 }
196 }
197 }
198 }
199 else if (features.qtEnabled && s[0] == 'S') {
200 if (s[1] == 'L') {
201 if (s[2] == 'O') {
202 if (s[3] == 'T') {
203 return T_SLOT;
204 }
205 }
206 }
207 }
208 return T_IDENTIFIER;
209 }
210
classify5(const char * s,LanguageFeatures features)211 static inline int classify5(const char *s, LanguageFeatures features)
212 {
213 if (s[0] == '_') {
214 if (s[1] == '_') {
215 if (s[2] == 'a') {
216 if (s[3] == 's') {
217 if (s[4] == 'm') {
218 return T___ASM;
219 }
220 }
221 }
222 }
223 }
224 else if (s[0] == 'b') {
225 if (s[1] == 'r') {
226 if (s[2] == 'e') {
227 if (s[3] == 'a') {
228 if (s[4] == 'k') {
229 return T_BREAK;
230 }
231 }
232 }
233 }
234 }
235 else if (s[0] == 'c') {
236 if (features.cxxEnabled && s[1] == 'a') {
237 if (s[2] == 't') {
238 if (s[3] == 'c') {
239 if (s[4] == 'h') {
240 return T_CATCH;
241 }
242 }
243 }
244 }
245 else if (features.cxxEnabled && s[1] == 'l') {
246 if (s[2] == 'a') {
247 if (s[3] == 's') {
248 if (s[4] == 's') {
249 return T_CLASS;
250 }
251 }
252 }
253 }
254 else if (s[1] == 'o') {
255 if (s[2] == 'n') {
256 if (s[3] == 's') {
257 if (s[4] == 't') {
258 return T_CONST;
259 }
260 }
261 }
262 }
263 }
264 else if (s[0] == 'f') {
265 if (features.cxxEnabled && s[1] == 'a') {
266 if (s[2] == 'l') {
267 if (s[3] == 's') {
268 if (s[4] == 'e') {
269 return T_FALSE;
270 }
271 }
272 }
273 }
274 else if (s[1] == 'l') {
275 if (s[2] == 'o') {
276 if (s[3] == 'a') {
277 if (s[4] == 't') {
278 return T_FLOAT;
279 }
280 }
281 }
282 }
283 }
284 else if (s[0] == 's') {
285 if (s[1] == 'h') {
286 if (s[2] == 'o') {
287 if (s[3] == 'r') {
288 if (s[4] == 't') {
289 return T_SHORT;
290 }
291 }
292 }
293 }
294 else if (features.qtKeywordsEnabled && s[1] == 'l') {
295 if (s[2] == 'o') {
296 if (s[3] == 't') {
297 if (s[4] == 's') {
298 return T_SLOTS;
299 }
300 }
301 }
302 }
303 }
304 else if (features.cxxEnabled && s[0] == 't') {
305 if (s[1] == 'h') {
306 if (s[2] == 'r') {
307 if (s[3] == 'o') {
308 if (s[4] == 'w') {
309 return T_THROW;
310 }
311 }
312 }
313 }
314 }
315 else if (s[0] == 'u') {
316 if (s[1] == 'n') {
317 if (s[2] == 'i') {
318 if (s[3] == 'o') {
319 if (s[4] == 'n') {
320 return T_UNION;
321 }
322 }
323 }
324 }
325 else if (features.cxxEnabled && s[1] == 's') {
326 if (s[2] == 'i') {
327 if (s[3] == 'n') {
328 if (s[4] == 'g') {
329 return T_USING;
330 }
331 }
332 }
333 }
334 }
335 else if (s[0] == 'w') {
336 if (s[1] == 'h') {
337 if (s[2] == 'i') {
338 if (s[3] == 'l') {
339 if (s[4] == 'e') {
340 return T_WHILE;
341 }
342 }
343 }
344 }
345 }
346 return T_IDENTIFIER;
347 }
348
classify6(const char * s,LanguageFeatures features)349 static inline int classify6(const char *s, LanguageFeatures features)
350 {
351 if (s[0] == 'd') {
352 if (features.cxxEnabled && s[1] == 'e') {
353 if (s[2] == 'l') {
354 if (s[3] == 'e') {
355 if (s[4] == 't') {
356 if (s[5] == 'e') {
357 return T_DELETE;
358 }
359 }
360 }
361 }
362 }
363 else if (s[1] == 'o') {
364 if (s[2] == 'u') {
365 if (s[3] == 'b') {
366 if (s[4] == 'l') {
367 if (s[5] == 'e') {
368 return T_DOUBLE;
369 }
370 }
371 }
372 }
373 }
374 }
375 else if (s[0] == 'e') {
376 if (s[1] == 'x') {
377 if (features.cxxEnabled && s[2] == 'p') {
378 if (s[3] == 'o') {
379 if (s[4] == 'r') {
380 if (s[5] == 't') {
381 return T_EXPORT;
382 }
383 }
384 }
385 }
386 else if (s[2] == 't') {
387 if (s[3] == 'e') {
388 if (s[4] == 'r') {
389 if (s[5] == 'n') {
390 return T_EXTERN;
391 }
392 }
393 }
394 }
395 }
396 }
397 else if (features.cxxEnabled && s[0] == 'f') {
398 if (s[1] == 'r') {
399 if (s[2] == 'i') {
400 if (s[3] == 'e') {
401 if (s[4] == 'n') {
402 if (s[5] == 'd') {
403 return T_FRIEND;
404 }
405 }
406 }
407 }
408 }
409 }
410 else if (s[0] == 'i') {
411 if (s[1] == 'n') {
412 if (s[2] == 'l') {
413 if (s[3] == 'i') {
414 if (s[4] == 'n') {
415 if (s[5] == 'e') {
416 return T_INLINE;
417 }
418 }
419 }
420 }
421 }
422 }
423 else if (features.cxxEnabled && s[0] == 'p') {
424 if (s[1] == 'u') {
425 if (s[2] == 'b') {
426 if (s[3] == 'l') {
427 if (s[4] == 'i') {
428 if (s[5] == 'c') {
429 return T_PUBLIC;
430 }
431 }
432 }
433 }
434 }
435 }
436 else if (s[0] == 'r') {
437 if (s[1] == 'e') {
438 if (s[2] == 't') {
439 if (s[3] == 'u') {
440 if (s[4] == 'r') {
441 if (s[5] == 'n') {
442 return T_RETURN;
443 }
444 }
445 }
446 }
447 }
448 }
449 else if (s[0] == 's') {
450 if (s[1] == 'i') {
451 if (s[2] == 'g') {
452 if (s[3] == 'n') {
453 if (s[4] == 'e') {
454 if (s[5] == 'd') {
455 return T_SIGNED;
456 }
457 }
458 }
459 }
460 else if (s[2] == 'z') {
461 if (s[3] == 'e') {
462 if (s[4] == 'o') {
463 if (s[5] == 'f') {
464 return T_SIZEOF;
465 }
466 }
467 }
468 }
469 }
470 else if (s[1] == 't') {
471 if (s[2] == 'a') {
472 if (s[3] == 't') {
473 if (s[4] == 'i') {
474 if (s[5] == 'c') {
475 return T_STATIC;
476 }
477 }
478 }
479 }
480 else if (s[2] == 'r') {
481 if (s[3] == 'u') {
482 if (s[4] == 'c') {
483 if (s[5] == 't') {
484 return T_STRUCT;
485 }
486 }
487 }
488 }
489 }
490 else if (s[1] == 'w') {
491 if (s[2] == 'i') {
492 if (s[3] == 't') {
493 if (s[4] == 'c') {
494 if (s[5] == 'h') {
495 return T_SWITCH;
496 }
497 }
498 }
499 }
500 }
501 }
502 else if (s[0] == 't') {
503 if (s[1] == 'y') {
504 if (s[2] == 'p') {
505 if (s[3] == 'e') {
506 if (features.cxxEnabled && s[4] == 'i') {
507 if (s[5] == 'd') {
508 return T_TYPEID;
509 }
510 }
511 else if (s[4] == 'o') {
512 if (s[5] == 'f') {
513 return T_TYPEOF;
514 }
515 }
516 }
517 }
518 }
519 }
520 else if (features.qtKeywordsEnabled && s[0] == 'Q') {
521 if (s[1] == '_') {
522 if (s[2] == 'E') {
523 if (s[3] == 'M') {
524 if (s[4] == 'I') {
525 if (s[5] == 'T') {
526 return T_Q_EMIT;
527 }
528 }
529 }
530 }
531 else if (s[2] == 'S') {
532 if (s[3] == 'L') {
533 if (s[4] == 'O') {
534 if (s[5] == 'T') {
535 return T_Q_SLOT;
536 }
537 }
538 }
539 }
540 }
541 }
542 else if (features.qtKeywordsEnabled && s[0] == 'S') {
543 if (s[1] == 'I') {
544 if (s[2] == 'G') {
545 if (s[3] == 'N') {
546 if (s[4] == 'A') {
547 if (s[5] == 'L') {
548 return T_SIGNAL;
549 }
550 }
551 }
552 }
553 }
554 }
555 return T_IDENTIFIER;
556 }
557
classify7(const char * s,LanguageFeatures features)558 static inline int classify7(const char *s, LanguageFeatures features)
559 {
560 if (s[0] == '_') {
561 if (s[1] == '_') {
562 if (s[2] == 'a') {
563 if (s[3] == 's') {
564 if (s[4] == 'm') {
565 if (s[5] == '_') {
566 if (s[6] == '_') {
567 return T___ASM__;
568 }
569 }
570 }
571 }
572 }
573 else if (s[2] == 'c') {
574 if (s[3] == 'o') {
575 if (s[4] == 'n') {
576 if (s[5] == 's') {
577 if (s[6] == 't') {
578 return T___CONST;
579 }
580 }
581 }
582 }
583 }
584 }
585 }
586 else if (features.cxx11Enabled && s[0] == 'a') {
587 if (s[1] == 'l') {
588 if (s[2] == 'i') {
589 if (s[3] == 'g') {
590 if (s[4] == 'n') {
591 if (s[5] == 'a') {
592 if (s[6] == 's') {
593 return T_ALIGNAS;
594 }
595 }
596 else if (s[5] == 'o') {
597 if (s[6] == 'f') {
598 return T_ALIGNOF;
599 }
600 }
601 }
602 }
603 }
604 }
605 }
606 else if (s[0] == 'd') {
607 if (s[1] == 'e') {
608 if (s[2] == 'f') {
609 if (s[3] == 'a') {
610 if (s[4] == 'u') {
611 if (s[5] == 'l') {
612 if (s[6] == 't') {
613 return T_DEFAULT;
614 }
615 }
616 }
617 }
618 }
619 }
620 }
621 else if (features.qtKeywordsEnabled && s[0] == 'f') {
622 if (s[1] == 'o') {
623 if (s[2] == 'r') {
624 if (s[3] == 'e') {
625 if (s[4] == 'a') {
626 if (s[5] == 'c') {
627 if (s[6] == 'h') {
628 return T_FOREACH;
629 }
630 }
631 }
632 }
633 }
634 }
635 }
636 else if (features.cxxEnabled && s[0] == 'm') {
637 if (s[1] == 'u') {
638 if (s[2] == 't') {
639 if (s[3] == 'a') {
640 if (s[4] == 'b') {
641 if (s[5] == 'l') {
642 if (s[6] == 'e') {
643 return T_MUTABLE;
644 }
645 }
646 }
647 }
648 }
649 }
650 }
651 else if (features.cxx11Enabled && s[0] == 'n') {
652 if (s[1] == 'u') {
653 if (s[2] == 'l') {
654 if (s[3] == 'l') {
655 if (s[4] == 'p') {
656 if (s[5] == 't') {
657 if (s[6] == 'r') {
658 return T_NULLPTR;
659 }
660 }
661 }
662 }
663 }
664 }
665 }
666 else if (features.cxxEnabled && s[0] == 'p') {
667 if (s[1] == 'r') {
668 if (s[2] == 'i') {
669 if (s[3] == 'v') {
670 if (s[4] == 'a') {
671 if (s[5] == 't') {
672 if (s[6] == 'e') {
673 return T_PRIVATE;
674 }
675 }
676 }
677 }
678 }
679 }
680 }
681 else if (features.qtKeywordsEnabled && s[0] == 's') {
682 if (s[1] == 'i') {
683 if (s[2] == 'g') {
684 if (s[3] == 'n') {
685 if (s[4] == 'a') {
686 if (s[5] == 'l') {
687 if (s[6] == 's') {
688 return T_SIGNALS;
689 }
690 }
691 }
692 }
693 }
694 }
695 }
696 else if (s[0] == 't') {
697 if (s[1] == 'y') {
698 if (s[2] == 'p') {
699 if (s[3] == 'e') {
700 if (s[4] == 'd') {
701 if (s[5] == 'e') {
702 if (s[6] == 'f') {
703 return T_TYPEDEF;
704 }
705 }
706 }
707 }
708 }
709 }
710 }
711 else if (features.cxxEnabled && s[0] == 'v') {
712 if (s[1] == 'i') {
713 if (s[2] == 'r') {
714 if (s[3] == 't') {
715 if (s[4] == 'u') {
716 if (s[5] == 'a') {
717 if (s[6] == 'l') {
718 return T_VIRTUAL;
719 }
720 }
721 }
722 }
723 }
724 }
725 }
726 else if (features.cxxEnabled && s[0] == 'w') {
727 if (s[1] == 'c') {
728 if (s[2] == 'h') {
729 if (s[3] == 'a') {
730 if (s[4] == 'r') {
731 if (s[5] == '_') {
732 if (s[6] == 't') {
733 return T_WCHAR_T;
734 }
735 }
736 }
737 }
738 }
739 }
740 }
741 else if (features.qtEnabled && s[0] == 'Q') {
742 if (s[1] == '_') {
743 if (s[2] == 'E') {
744 if (s[3] == 'N') {
745 if (s[4] == 'U') {
746 if (s[5] == 'M') {
747 if (s[6] == 'S') {
748 return T_Q_ENUMS;
749 }
750 }
751 }
752 }
753 }
754 else if (s[2] == 'F') {
755 if (s[3] == 'L') {
756 if (s[4] == 'A') {
757 if (s[5] == 'G') {
758 if (s[6] == 'S') {
759 return T_Q_FLAGS;
760 }
761 }
762 }
763 }
764 }
765 else if (s[2] == 'S') {
766 if (s[3] == 'L') {
767 if (s[4] == 'O') {
768 if (s[5] == 'T') {
769 if (s[6] == 'S') {
770 return T_Q_SLOTS;
771 }
772 }
773 }
774 }
775 }
776 }
777 }
778 return T_IDENTIFIER;
779 }
780
classify8(const char * s,LanguageFeatures features)781 static inline int classify8(const char *s, LanguageFeatures features)
782 {
783 if (s[0] == '_') {
784 if (s[1] == '_') {
785 if (s[2] == 'i') {
786 if (s[3] == 'n') {
787 if (s[4] == 'l') {
788 if (s[5] == 'i') {
789 if (s[6] == 'n') {
790 if (s[7] == 'e') {
791 return T___INLINE;
792 }
793 }
794 }
795 }
796 }
797 }
798 else if (s[2] == 't') {
799 if (s[3] == 'h') {
800 if (s[4] == 'r') {
801 if (s[5] == 'e') {
802 if (s[6] == 'a') {
803 if (s[7] == 'd') {
804 return T___THREAD;
805 }
806 }
807 }
808 }
809 }
810 else if (s[3] == 'y') {
811 if (s[4] == 'p') {
812 if (s[5] == 'e') {
813 if (s[6] == 'o') {
814 if (s[7] == 'f') {
815 return T___TYPEOF;
816 }
817 }
818 }
819 }
820 }
821 }
822 }
823 }
824 else if (s[0] == 'c') {
825 if (features.cxx11Enabled && s[1] == 'h') {
826 if (s[2] == 'a') {
827 if (s[3] == 'r') {
828 if (s[4] == '1') {
829 if (s[5] == '6') {
830 if (s[6] == '_') {
831 if (s[7] == 't') {
832 return T_CHAR16_T;
833 }
834 }
835 }
836 }
837 else if (s[4] == '3') {
838 if (s[5] == '2') {
839 if (s[6] == '_') {
840 if (s[7] == 't') {
841 return T_CHAR32_T;
842 }
843 }
844 }
845 }
846 }
847 }
848 }
849 else if (s[1] == 'o') {
850 if (s[2] == 'n') {
851 if (s[3] == 't') {
852 if (s[4] == 'i') {
853 if (s[5] == 'n') {
854 if (s[6] == 'u') {
855 if (s[7] == 'e') {
856 return T_CONTINUE;
857 }
858 }
859 }
860 }
861 }
862 }
863 }
864 }
865 else if (features.cxx11Enabled && s[0] == 'd') {
866 if (s[1] == 'e') {
867 if (s[2] == 'c') {
868 if (s[3] == 'l') {
869 if (s[4] == 't') {
870 if (s[5] == 'y') {
871 if (s[6] == 'p') {
872 if (s[7] == 'e') {
873 return T_DECLTYPE;
874 }
875 }
876 }
877 }
878 }
879 }
880 }
881 }
882 else if (features.cxxEnabled && s[0] == 'e') {
883 if (s[1] == 'x') {
884 if (s[2] == 'p') {
885 if (s[3] == 'l') {
886 if (s[4] == 'i') {
887 if (s[5] == 'c') {
888 if (s[6] == 'i') {
889 if (s[7] == 't') {
890 return T_EXPLICIT;
891 }
892 }
893 }
894 }
895 }
896 }
897 }
898 }
899 else if (features.cxx11Enabled && s[0] == 'n') {
900 if (s[1] == 'o') {
901 if (s[2] == 'e') {
902 if (s[3] == 'x') {
903 if (s[4] == 'c') {
904 if (s[5] == 'e') {
905 if (s[6] == 'p') {
906 if (s[7] == 't') {
907 return T_NOEXCEPT;
908 }
909 }
910 }
911 }
912 }
913 }
914 }
915 }
916 else if (features.cxxEnabled && s[0] == 'o') {
917 if (s[1] == 'p') {
918 if (s[2] == 'e') {
919 if (s[3] == 'r') {
920 if (s[4] == 'a') {
921 if (s[5] == 't') {
922 if (s[6] == 'o') {
923 if (s[7] == 'r') {
924 return T_OPERATOR;
925 }
926 }
927 }
928 }
929 }
930 }
931 }
932 }
933 else if (s[0] == 'r') {
934 if (s[1] == 'e') {
935 if (s[2] == 'g') {
936 if (s[3] == 'i') {
937 if (s[4] == 's') {
938 if (s[5] == 't') {
939 if (s[6] == 'e') {
940 if (s[7] == 'r') {
941 return T_REGISTER;
942 }
943 }
944 }
945 }
946 }
947 }
948 }
949 }
950 else if (features.cxxEnabled && s[0] == 't') {
951 if (s[1] == 'e') {
952 if (s[2] == 'm') {
953 if (s[3] == 'p') {
954 if (s[4] == 'l') {
955 if (s[5] == 'a') {
956 if (s[6] == 't') {
957 if (s[7] == 'e') {
958 return T_TEMPLATE;
959 }
960 }
961 }
962 }
963 }
964 }
965 }
966 else if (s[1] == 'y') {
967 if (s[2] == 'p') {
968 if (s[3] == 'e') {
969 if (s[4] == 'n') {
970 if (s[5] == 'a') {
971 if (s[6] == 'm') {
972 if (s[7] == 'e') {
973 return T_TYPENAME;
974 }
975 }
976 }
977 }
978 }
979 }
980 }
981 }
982 else if (s[0] == 'u') {
983 if (s[1] == 'n') {
984 if (s[2] == 's') {
985 if (s[3] == 'i') {
986 if (s[4] == 'g') {
987 if (s[5] == 'n') {
988 if (s[6] == 'e') {
989 if (s[7] == 'd') {
990 return T_UNSIGNED;
991 }
992 }
993 }
994 }
995 }
996 }
997 }
998 }
999 else if (s[0] == 'v') {
1000 if (s[1] == 'o') {
1001 if (s[2] == 'l') {
1002 if (s[3] == 'a') {
1003 if (s[4] == 't') {
1004 if (s[5] == 'i') {
1005 if (s[6] == 'l') {
1006 if (s[7] == 'e') {
1007 return T_VOLATILE;
1008 }
1009 }
1010 }
1011 }
1012 }
1013 }
1014 }
1015 }
1016 else if (features.qtEnabled && s[0] == 'Q') {
1017 if (s[1] == '_') {
1018 if (s[2] == 'G') {
1019 if (s[3] == 'A') {
1020 if (s[4] == 'D') {
1021 if (s[5] == 'G') {
1022 if (s[6] == 'E') {
1023 if (s[7] == 'T') {
1024 return T_Q_GADGET;
1025 }
1026 }
1027 }
1028 }
1029 }
1030 }
1031 else if (s[2] == 'O') {
1032 if (s[3] == 'B') {
1033 if (s[4] == 'J') {
1034 if (s[5] == 'E') {
1035 if (s[6] == 'C') {
1036 if (s[7] == 'T') {
1037 return T_Q_OBJECT;
1038 }
1039 }
1040 }
1041 }
1042 }
1043 }
1044 else if (s[2] == 'S') {
1045 if (s[3] == 'I') {
1046 if (s[4] == 'G') {
1047 if (s[5] == 'N') {
1048 if (s[6] == 'A') {
1049 if (s[7] == 'L') {
1050 return T_Q_SIGNAL;
1051 }
1052 }
1053 }
1054 }
1055 }
1056 }
1057 }
1058 }
1059 return T_IDENTIFIER;
1060 }
1061
classify9(const char * s,LanguageFeatures features)1062 static inline int classify9(const char *s, LanguageFeatures features)
1063 {
1064 if (s[0] == '_') {
1065 if (s[1] == '_') {
1066 if (s[2] == 'c') {
1067 if (s[3] == 'o') {
1068 if (s[4] == 'n') {
1069 if (s[5] == 's') {
1070 if (s[6] == 't') {
1071 if (s[7] == '_') {
1072 if (s[8] == '_') {
1073 return T___CONST__;
1074 }
1075 }
1076 }
1077 }
1078 }
1079 }
1080 }
1081 }
1082 else if (s[1] == 'd') {
1083 if (s[2] == 'e') {
1084 if (s[3] == 'c') {
1085 if (s[4] == 'l') {
1086 if (s[5] == 's') {
1087 if (s[6] == 'p') {
1088 if (s[7] == 'e') {
1089 if (s[8] == 'c') {
1090 return T__DECLSPEC;
1091 }
1092 }
1093 }
1094 }
1095 }
1096 }
1097 }
1098 }
1099 }
1100 else if (features.cxx11Enabled && s[0] == 'c') {
1101 if (s[1] == 'o') {
1102 if (s[2] == 'n') {
1103 if (s[3] == 's') {
1104 if (s[4] == 't') {
1105 if (s[5] == 'e') {
1106 if (s[6] == 'x') {
1107 if (s[7] == 'p') {
1108 if (s[8] == 'r') {
1109 return T_CONSTEXPR;
1110 }
1111 }
1112 }
1113 }
1114 }
1115 }
1116 }
1117 }
1118 }
1119 else if (features.cxxEnabled && s[0] == 'n') {
1120 if (s[1] == 'a') {
1121 if (s[2] == 'm') {
1122 if (s[3] == 'e') {
1123 if (s[4] == 's') {
1124 if (s[5] == 'p') {
1125 if (s[6] == 'a') {
1126 if (s[7] == 'c') {
1127 if (s[8] == 'e') {
1128 return T_NAMESPACE;
1129 }
1130 }
1131 }
1132 }
1133 }
1134 }
1135 }
1136 }
1137 }
1138 else if (features.cxxEnabled && s[0] == 'p') {
1139 if (s[1] == 'r') {
1140 if (s[2] == 'o') {
1141 if (s[3] == 't') {
1142 if (s[4] == 'e') {
1143 if (s[5] == 'c') {
1144 if (s[6] == 't') {
1145 if (s[7] == 'e') {
1146 if (s[8] == 'd') {
1147 return T_PROTECTED;
1148 }
1149 }
1150 }
1151 }
1152 }
1153 }
1154 }
1155 }
1156 }
1157 else if (features.qtEnabled && s[0] == 'Q') {
1158 if (s[1] == '_') {
1159 if (s[2] == 'F') {
1160 if (s[3] == 'O') {
1161 if (s[4] == 'R') {
1162 if (s[5] == 'E') {
1163 if (s[6] == 'A') {
1164 if (s[7] == 'C') {
1165 if (s[8] == 'H') {
1166 return T_Q_FOREACH;
1167 }
1168 }
1169 }
1170 }
1171 }
1172 }
1173 }
1174 else if (s[2] == 'S') {
1175 if (s[3] == 'I') {
1176 if (s[4] == 'G') {
1177 if (s[5] == 'N') {
1178 if (s[6] == 'A') {
1179 if (s[7] == 'L') {
1180 if (s[8] == 'S') {
1181 return T_Q_SIGNALS;
1182 }
1183 }
1184 }
1185 }
1186 }
1187 }
1188 }
1189 }
1190 }
1191 return T_IDENTIFIER;
1192 }
1193
classify10(const char * s,LanguageFeatures features)1194 static inline int classify10(const char *s, LanguageFeatures features)
1195 {
1196 if (s[0] == '_') {
1197 if (s[1] == '_') {
1198 if (s[2] == 'd') {
1199 if (s[3] == 'e') {
1200 if (s[4] == 'c') {
1201 if (s[5] == 'l') {
1202 if (s[6] == 's') {
1203 if (s[7] == 'p') {
1204 if (s[8] == 'e') {
1205 if (s[9] == 'c') {
1206 return T___DECLSPEC;
1207 }
1208 }
1209 }
1210 }
1211 else if (features.cxxEnabled && s[6] == 't') {
1212 if (s[7] == 'y') {
1213 if (s[8] == 'p') {
1214 if (s[9] == 'e') {
1215 return T___DECLTYPE;
1216 }
1217 }
1218 }
1219 }
1220 }
1221 }
1222 }
1223 }
1224 else if (s[2] == 'i') {
1225 if (s[3] == 'n') {
1226 if (s[4] == 'l') {
1227 if (s[5] == 'i') {
1228 if (s[6] == 'n') {
1229 if (s[7] == 'e') {
1230 if (s[8] == '_') {
1231 if (s[9] == '_') {
1232 return T___INLINE__;
1233 }
1234 }
1235 }
1236 }
1237 }
1238 }
1239 }
1240 }
1241 else if (s[2] == 't') {
1242 if (s[3] == 'y') {
1243 if (s[4] == 'p') {
1244 if (s[5] == 'e') {
1245 if (s[6] == 'o') {
1246 if (s[7] == 'f') {
1247 if (s[8] == '_') {
1248 if (s[9] == '_') {
1249 return T___TYPEOF__;
1250 }
1251 }
1252 }
1253 }
1254 }
1255 }
1256 }
1257 }
1258 else if (s[2] == 'v') {
1259 if (s[3] == 'o') {
1260 if (s[4] == 'l') {
1261 if (s[5] == 'a') {
1262 if (s[6] == 't') {
1263 if (s[7] == 'i') {
1264 if (s[8] == 'l') {
1265 if (s[9] == 'e') {
1266 return T___VOLATILE;
1267 }
1268 }
1269 }
1270 }
1271 }
1272 }
1273 }
1274 }
1275 }
1276 }
1277 else if (features.cxxEnabled && s[0] == 'c') {
1278 if (s[1] == 'o') {
1279 if (s[2] == 'n') {
1280 if (s[3] == 's') {
1281 if (s[4] == 't') {
1282 if (s[5] == '_') {
1283 if (s[6] == 'c') {
1284 if (s[7] == 'a') {
1285 if (s[8] == 's') {
1286 if (s[9] == 't') {
1287 return T_CONST_CAST;
1288 }
1289 }
1290 }
1291 }
1292 }
1293 }
1294 }
1295 }
1296 }
1297 }
1298 else if (features.qtEnabled && s[0] == 'Q') {
1299 if (s[1] == '_') {
1300 if (s[2] == 'O') {
1301 if (s[3] == 'V') {
1302 if (s[4] == 'E') {
1303 if (s[5] == 'R') {
1304 if (s[6] == 'R') {
1305 if (s[7] == 'I') {
1306 if (s[8] == 'D') {
1307 if (s[9] == 'E') {
1308 return T_Q_OVERRIDE;
1309 }
1310 }
1311 }
1312 }
1313 }
1314 }
1315 }
1316 }
1317 else if (s[2] == 'P') {
1318 if (s[3] == 'R') {
1319 if (s[4] == 'O') {
1320 if (s[5] == 'P') {
1321 if (s[6] == 'E') {
1322 if (s[7] == 'R') {
1323 if (s[8] == 'T') {
1324 if (s[9] == 'Y') {
1325 return T_Q_PROPERTY;
1326 }
1327 }
1328 }
1329 }
1330 }
1331 }
1332 }
1333 }
1334 }
1335 }
1336 return T_IDENTIFIER;
1337 }
1338
classify11(const char * s,LanguageFeatures features)1339 static inline int classify11(const char *s, LanguageFeatures features)
1340 {
1341 if (s[0] == '_') {
1342 if (s[1] == '_') {
1343 if (s[2] == 'a') {
1344 if (s[3] == 'l') {
1345 if (s[4] == 'i') {
1346 if (s[5] == 'g') {
1347 if (s[6] == 'n') {
1348 if (s[7] == 'o') {
1349 if (s[8] == 'f') {
1350 if (s[9] == '_') {
1351 if (s[10] == '_') {
1352 return T___ALIGNOF__;
1353 }
1354 }
1355 }
1356 }
1357 }
1358 }
1359 }
1360 }
1361 else if (s[3] == 't') {
1362 if (s[4] == 't') {
1363 if (s[5] == 'r') {
1364 if (s[6] == 'i') {
1365 if (s[7] == 'b') {
1366 if (s[8] == 'u') {
1367 if (s[9] == 't') {
1368 if (s[10] == 'e') {
1369 return T___ATTRIBUTE;
1370 }
1371 }
1372 }
1373 }
1374 }
1375 }
1376 }
1377 }
1378 }
1379 }
1380 }
1381 else if (features.cxxEnabled && s[0] == 's') {
1382 if (s[1] == 't') {
1383 if (s[2] == 'a') {
1384 if (s[3] == 't') {
1385 if (s[4] == 'i') {
1386 if (s[5] == 'c') {
1387 if (s[6] == '_') {
1388 if (s[7] == 'c') {
1389 if (s[8] == 'a') {
1390 if (s[9] == 's') {
1391 if (s[10] == 't') {
1392 return T_STATIC_CAST;
1393 }
1394 }
1395 }
1396 }
1397 }
1398 }
1399 }
1400 }
1401 }
1402 }
1403 }
1404 else if (features.qtEnabled && s[0] == 'Q') {
1405 if (s[1] == '_') {
1406 if (s[2] == 'I') {
1407 if (s[3] == 'N') {
1408 if (s[4] == 'V') {
1409 if (s[5] == 'O') {
1410 if (s[6] == 'K') {
1411 if (s[7] == 'A') {
1412 if (s[8] == 'B') {
1413 if (s[9] == 'L') {
1414 if (s[10] == 'E') {
1415 return T_Q_INVOKABLE;
1416 }
1417 }
1418 }
1419 }
1420 }
1421 }
1422 }
1423 }
1424 }
1425 }
1426 }
1427 return T_IDENTIFIER;
1428 }
1429
classify12(const char * s,LanguageFeatures features)1430 static inline int classify12(const char *s, LanguageFeatures features)
1431 {
1432 if (s[0] == '_') {
1433 if (s[1] == '_') {
1434 if (s[2] == 'v') {
1435 if (s[3] == 'o') {
1436 if (s[4] == 'l') {
1437 if (s[5] == 'a') {
1438 if (s[6] == 't') {
1439 if (s[7] == 'i') {
1440 if (s[8] == 'l') {
1441 if (s[9] == 'e') {
1442 if (s[10] == '_') {
1443 if (s[11] == '_') {
1444 return T___VOLATILE__;
1445 }
1446 }
1447 }
1448 }
1449 }
1450 }
1451 }
1452 }
1453 }
1454 }
1455 }
1456 }
1457 else if (features.cxxEnabled && s[0] == 'd') {
1458 if (s[1] == 'y') {
1459 if (s[2] == 'n') {
1460 if (s[3] == 'a') {
1461 if (s[4] == 'm') {
1462 if (s[5] == 'i') {
1463 if (s[6] == 'c') {
1464 if (s[7] == '_') {
1465 if (s[8] == 'c') {
1466 if (s[9] == 'a') {
1467 if (s[10] == 's') {
1468 if (s[11] == 't') {
1469 return T_DYNAMIC_CAST;
1470 }
1471 }
1472 }
1473 }
1474 }
1475 }
1476 }
1477 }
1478 }
1479 }
1480 }
1481 }
1482 else if (features.cxx11Enabled && s[0] == 't') {
1483 if (s[1] == 'h') {
1484 if (s[2] == 'r') {
1485 if (s[3] == 'e') {
1486 if (s[4] == 'a') {
1487 if (s[5] == 'd') {
1488 if (s[6] == '_') {
1489 if (s[7] == 'l') {
1490 if (s[8] == 'o') {
1491 if (s[9] == 'c') {
1492 if (s[10] == 'a') {
1493 if (s[11] == 'l') {
1494 return T_THREAD_LOCAL;
1495 }
1496 }
1497 }
1498 }
1499 }
1500 }
1501 }
1502 }
1503 }
1504 }
1505 }
1506 }
1507 else if (features.qtEnabled && s[0] == 'Q') {
1508 if (s[1] == '_') {
1509 if (s[2] == 'I') {
1510 if (s[3] == 'N') {
1511 if (s[4] == 'T') {
1512 if (s[5] == 'E') {
1513 if (s[6] == 'R') {
1514 if (s[7] == 'F') {
1515 if (s[8] == 'A') {
1516 if (s[9] == 'C') {
1517 if (s[10] == 'E') {
1518 if (s[11] == 'S') {
1519 return T_Q_INTERFACES;
1520 }
1521 }
1522 }
1523 }
1524 }
1525 }
1526 }
1527 }
1528 }
1529 }
1530 }
1531 }
1532 return T_IDENTIFIER;
1533 }
1534
classify13(const char * s,LanguageFeatures features)1535 static inline int classify13(const char *s, LanguageFeatures features)
1536 {
1537 if (s[0] == '_') {
1538 if (s[1] == '_') {
1539 if (s[2] == 'a') {
1540 if (s[3] == 't') {
1541 if (s[4] == 't') {
1542 if (s[5] == 'r') {
1543 if (s[6] == 'i') {
1544 if (s[7] == 'b') {
1545 if (s[8] == 'u') {
1546 if (s[9] == 't') {
1547 if (s[10] == 'e') {
1548 if (s[11] == '_') {
1549 if (s[12] == '_') {
1550 return T___ATTRIBUTE__;
1551 }
1552 }
1553 }
1554 }
1555 }
1556 }
1557 }
1558 }
1559 }
1560 }
1561 }
1562 }
1563 }
1564 else if (features.cxx11Enabled && s[0] == 's') {
1565 if (s[1] == 't') {
1566 if (s[2] == 'a') {
1567 if (s[3] == 't') {
1568 if (s[4] == 'i') {
1569 if (s[5] == 'c') {
1570 if (s[6] == '_') {
1571 if (s[7] == 'a') {
1572 if (s[8] == 's') {
1573 if (s[9] == 's') {
1574 if (s[10] == 'e') {
1575 if (s[11] == 'r') {
1576 if (s[12] == 't') {
1577 return T_STATIC_ASSERT;
1578 }
1579 }
1580 }
1581 }
1582 }
1583 }
1584 }
1585 }
1586 }
1587 }
1588 }
1589 }
1590 }
1591 return T_IDENTIFIER;
1592 }
1593
classify14(const char * s,LanguageFeatures features)1594 static inline int classify14(const char *s, LanguageFeatures features)
1595 {
1596 if (features.qtEnabled && s[0] == 'Q') {
1597 if (s[1] == '_') {
1598 if (s[2] == 'P') {
1599 if (s[3] == 'R') {
1600 if (s[4] == 'I') {
1601 if (s[5] == 'V') {
1602 if (s[6] == 'A') {
1603 if (s[7] == 'T') {
1604 if (s[8] == 'E') {
1605 if (s[9] == '_') {
1606 if (s[10] == 'S') {
1607 if (s[11] == 'L') {
1608 if (s[12] == 'O') {
1609 if (s[13] == 'T') {
1610 return T_Q_PRIVATE_SLOT;
1611 }
1612 }
1613 }
1614 }
1615 }
1616 }
1617 }
1618 }
1619 }
1620 }
1621 }
1622 }
1623 }
1624 }
1625 return T_IDENTIFIER;
1626 }
1627
classify16(const char * s,LanguageFeatures features)1628 static inline int classify16(const char *s, LanguageFeatures features)
1629 {
1630 if (features.cxxEnabled && s[0] == 'r') {
1631 if (s[1] == 'e') {
1632 if (s[2] == 'i') {
1633 if (s[3] == 'n') {
1634 if (s[4] == 't') {
1635 if (s[5] == 'e') {
1636 if (s[6] == 'r') {
1637 if (s[7] == 'p') {
1638 if (s[8] == 'r') {
1639 if (s[9] == 'e') {
1640 if (s[10] == 't') {
1641 if (s[11] == '_') {
1642 if (s[12] == 'c') {
1643 if (s[13] == 'a') {
1644 if (s[14] == 's') {
1645 if (s[15] == 't') {
1646 return T_REINTERPRET_CAST;
1647 }
1648 }
1649 }
1650 }
1651 }
1652 }
1653 }
1654 }
1655 }
1656 }
1657 }
1658 }
1659 }
1660 }
1661 }
1662 }
1663 return T_IDENTIFIER;
1664 }
1665
classify18(const char * s,LanguageFeatures features)1666 static inline int classify18(const char *s, LanguageFeatures features)
1667 {
1668 if (features.qtEnabled && s[0] == 'Q') {
1669 if (s[1] == '_') {
1670 if (s[2] == 'P') {
1671 if (s[3] == 'R') {
1672 if (s[4] == 'I') {
1673 if (s[5] == 'V') {
1674 if (s[6] == 'A') {
1675 if (s[7] == 'T') {
1676 if (s[8] == 'E') {
1677 if (s[9] == '_') {
1678 if (s[10] == 'P') {
1679 if (s[11] == 'R') {
1680 if (s[12] == 'O') {
1681 if (s[13] == 'P') {
1682 if (s[14] == 'E') {
1683 if (s[15] == 'R') {
1684 if (s[16] == 'T') {
1685 if (s[17] == 'Y') {
1686 return T_Q_PRIVATE_PROPERTY;
1687 }
1688 }
1689 }
1690 }
1691 }
1692 }
1693 }
1694 }
1695 }
1696 }
1697 }
1698 }
1699 }
1700 }
1701 }
1702 }
1703 }
1704 }
1705 return T_IDENTIFIER;
1706 }
1707
classify19(const char * s,LanguageFeatures features)1708 static inline int classify19(const char *s, LanguageFeatures features)
1709 {
1710 if (features.qtEnabled && s[0] == 'Q') {
1711 if (s[1] == '_') {
1712 if (s[2] == 'D') {
1713 if (s[3] == 'E') {
1714 if (s[4] == 'C') {
1715 if (s[5] == 'L') {
1716 if (s[6] == 'A') {
1717 if (s[7] == 'R') {
1718 if (s[8] == 'E') {
1719 if (s[9] == '_') {
1720 if (s[10] == 'I') {
1721 if (s[11] == 'N') {
1722 if (s[12] == 'T') {
1723 if (s[13] == 'E') {
1724 if (s[14] == 'R') {
1725 if (s[15] == 'F') {
1726 if (s[16] == 'A') {
1727 if (s[17] == 'C') {
1728 if (s[18] == 'E') {
1729 return T_Q_DECLARE_INTERFACE;
1730 }
1731 }
1732 }
1733 }
1734 }
1735 }
1736 }
1737 }
1738 }
1739 }
1740 }
1741 }
1742 }
1743 }
1744 }
1745 }
1746 }
1747 }
1748 }
1749 return T_IDENTIFIER;
1750 }
1751
classify(const char * s,int n,LanguageFeatures features)1752 int Lexer::classify(const char *s, int n, LanguageFeatures features)
1753 {
1754 switch (n) {
1755 case 2: return classify2(s, features);
1756 case 3: return classify3(s, features);
1757 case 4: return classify4(s, features);
1758 case 5: return classify5(s, features);
1759 case 6: return classify6(s, features);
1760 case 7: return classify7(s, features);
1761 case 8: return classify8(s, features);
1762 case 9: return classify9(s, features);
1763 case 10: return classify10(s, features);
1764 case 11: return classify11(s, features);
1765 case 12: return classify12(s, features);
1766 case 13: return classify13(s, features);
1767 case 14: return classify14(s, features);
1768 case 16: return classify16(s, features);
1769 case 18: return classify18(s, features);
1770 case 19: return classify19(s, features);
1771 default: return T_IDENTIFIER;
1772 } // switch
1773 }
1774
1775 // === keywords end
1776
1777
1778 // === keywords begin
1779
classifyOperator2(const char * s)1780 static inline int classifyOperator2(const char *s)
1781 {
1782 if (s[0] == 'o') {
1783 if (s[1] == 'r') {
1784 return T_OR;
1785 }
1786 }
1787 return T_IDENTIFIER;
1788 }
1789
classifyOperator3(const char * s)1790 static inline int classifyOperator3(const char *s)
1791 {
1792 if (s[0] == 'a') {
1793 if (s[1] == 'n') {
1794 if (s[2] == 'd') {
1795 return T_AND;
1796 }
1797 }
1798 }
1799 else if (s[0] == 'n') {
1800 if (s[1] == 'o') {
1801 if (s[2] == 't') {
1802 return T_NOT;
1803 }
1804 }
1805 }
1806 else if (s[0] == 'x') {
1807 if (s[1] == 'o') {
1808 if (s[2] == 'r') {
1809 return T_XOR;
1810 }
1811 }
1812 }
1813 return T_IDENTIFIER;
1814 }
1815
classifyOperator5(const char * s)1816 static inline int classifyOperator5(const char *s)
1817 {
1818 if (s[0] == 'b') {
1819 if (s[1] == 'i') {
1820 if (s[2] == 't') {
1821 if (s[3] == 'o') {
1822 if (s[4] == 'r') {
1823 return T_BITOR;
1824 }
1825 }
1826 }
1827 }
1828 }
1829 else if (s[0] == 'c') {
1830 if (s[1] == 'o') {
1831 if (s[2] == 'm') {
1832 if (s[3] == 'p') {
1833 if (s[4] == 'l') {
1834 return T_COMPL;
1835 }
1836 }
1837 }
1838 }
1839 }
1840 else if (s[0] == 'o') {
1841 if (s[1] == 'r') {
1842 if (s[2] == '_') {
1843 if (s[3] == 'e') {
1844 if (s[4] == 'q') {
1845 return T_OR_EQ;
1846 }
1847 }
1848 }
1849 }
1850 }
1851 return T_IDENTIFIER;
1852 }
1853
classifyOperator6(const char * s)1854 static inline int classifyOperator6(const char *s)
1855 {
1856 if (s[0] == 'a') {
1857 if (s[1] == 'n') {
1858 if (s[2] == 'd') {
1859 if (s[3] == '_') {
1860 if (s[4] == 'e') {
1861 if (s[5] == 'q') {
1862 return T_AND_EQ;
1863 }
1864 }
1865 }
1866 }
1867 }
1868 }
1869 else if (s[0] == 'b') {
1870 if (s[1] == 'i') {
1871 if (s[2] == 't') {
1872 if (s[3] == 'a') {
1873 if (s[4] == 'n') {
1874 if (s[5] == 'd') {
1875 return T_BITAND;
1876 }
1877 }
1878 }
1879 }
1880 }
1881 }
1882 else if (s[0] == 'n') {
1883 if (s[1] == 'o') {
1884 if (s[2] == 't') {
1885 if (s[3] == '_') {
1886 if (s[4] == 'e') {
1887 if (s[5] == 'q') {
1888 return T_NOT_EQ;
1889 }
1890 }
1891 }
1892 }
1893 }
1894 }
1895 else if (s[0] == 'x') {
1896 if (s[1] == 'o') {
1897 if (s[2] == 'r') {
1898 if (s[3] == '_') {
1899 if (s[4] == 'e') {
1900 if (s[5] == 'q') {
1901 return T_XOR_EQ;
1902 }
1903 }
1904 }
1905 }
1906 }
1907 }
1908 return T_IDENTIFIER;
1909 }
1910
classifyOperator(const char * s,int n)1911 int Lexer::classifyOperator(const char *s, int n)
1912 {
1913 switch (n) {
1914 case 2: return classifyOperator2(s);
1915 case 3: return classifyOperator3(s);
1916 case 5: return classifyOperator5(s);
1917 case 6: return classifyOperator6(s);
1918 default: return T_IDENTIFIER;
1919 } // switch
1920 }
1921
1922 // === keywords end
1923
1924 } // namespace CPlusPlus
1925