1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#include "glsllexer_p.h"
5#include "glslparser_p.h"
6
7QT_BEGIN_NAMESPACE
8
9using namespace GLSL;
10
11static inline int classify2(const char *s) {
12 if (s[0] == 'd') {
13 if (s[1] == 'o') {
14 return Parser::T_DO;
15 }
16 }
17 else if (s[0] == 'i') {
18 if (s[1] == 'f') {
19 return Parser::T_IF;
20 }
21 else if (s[1] == 'n') {
22 return Parser::T_IN;
23 }
24 }
25 return Parser::T_IDENTIFIER;
26}
27
28static inline int classify3(const char *s) {
29 if (s[0] == 'f') {
30 if (s[1] == 'o') {
31 if (s[2] == 'r') {
32 return Parser::T_FOR;
33 }
34 }
35 }
36 else if (s[0] == 'i') {
37 if (s[1] == 'n') {
38 if (s[2] == 't') {
39 return Parser::T_INT;
40 }
41 }
42 }
43 else if (s[0] == 'o') {
44 if (s[1] == 'u') {
45 if (s[2] == 't') {
46 return Parser::T_OUT;
47 }
48 }
49 }
50 return Parser::T_IDENTIFIER;
51}
52
53static inline int classify4(const char *s) {
54 if (s[0] == 'b') {
55 if (s[1] == 'o') {
56 if (s[2] == 'o') {
57 if (s[3] == 'l') {
58 return Parser::T_BOOL;
59 }
60 }
61 }
62 }
63 else if (s[0] == 'c') {
64 if (s[1] == 'a') {
65 if (s[2] == 's') {
66 if (s[3] == 'e') {
67 return Parser::T_CASE | Lexer::Variant_GLSL_150;
68 }
69 }
70 }
71 }
72 else if (s[0] == 'e') {
73 if (s[1] == 'l') {
74 if (s[2] == 's') {
75 if (s[3] == 'e') {
76 return Parser::T_ELSE;
77 }
78 }
79 }
80 }
81 else if (s[0] == 'f') {
82 if (s[1] == 'l') {
83 if (s[2] == 'a') {
84 if (s[3] == 't') {
85 return Parser::T_FLAT | Lexer::Variant_GLSL_150;
86 }
87 }
88 }
89 }
90 else if (s[0] == 'l') {
91 if (s[1] == 'o') {
92 if (s[2] == 'w') {
93 if (s[3] == 'p') {
94 return Parser::T_LOWP | Lexer::Variant_GLSL_ES_100 | Lexer::Variant_GLSL_400;
95 }
96 }
97 }
98 }
99 else if (s[0] == 'm') {
100 if (s[1] == 'a') {
101 if (s[2] == 't') {
102 if (s[3] == '2') {
103 return Parser::T_MAT2;
104 }
105 else if (s[3] == '3') {
106 return Parser::T_MAT3;
107 }
108 else if (s[3] == '4') {
109 return Parser::T_MAT4;
110 }
111 }
112 }
113 }
114 else if (s[0] == 't') {
115 if (s[1] == 'r') {
116 if (s[2] == 'u') {
117 if (s[3] == 'e') {
118 return Parser::T_TRUE;
119 }
120 }
121 }
122 }
123 else if (s[0] == 'u') {
124 if (s[1] == 'i') {
125 if (s[2] == 'n') {
126 if (s[3] == 't') {
127 return Parser::T_UINT | Lexer::Variant_GLSL_150;
128 }
129 }
130 }
131 }
132 else if (s[0] == 'v') {
133 if (s[1] == 'e') {
134 if (s[2] == 'c') {
135 if (s[3] == '2') {
136 return Parser::T_VEC2;
137 }
138 else if (s[3] == '3') {
139 return Parser::T_VEC3;
140 }
141 else if (s[3] == '4') {
142 return Parser::T_VEC4;
143 }
144 }
145 }
146 else if (s[1] == 'o') {
147 if (s[2] == 'i') {
148 if (s[3] == 'd') {
149 return Parser::T_VOID;
150 }
151 }
152 }
153 }
154 return Parser::T_IDENTIFIER;
155}
156
157static inline int classify5(const char *s) {
158 if (s[0] == 'b') {
159 if (s[1] == 'r') {
160 if (s[2] == 'e') {
161 if (s[3] == 'a') {
162 if (s[4] == 'k') {
163 return Parser::T_BREAK;
164 }
165 }
166 }
167 }
168 else if (s[1] == 'v') {
169 if (s[2] == 'e') {
170 if (s[3] == 'c') {
171 if (s[4] == '2') {
172 return Parser::T_BVEC2;
173 }
174 else if (s[4] == '3') {
175 return Parser::T_BVEC3;
176 }
177 else if (s[4] == '4') {
178 return Parser::T_BVEC4;
179 }
180 }
181 }
182 }
183 }
184 else if (s[0] == 'c') {
185 if (s[1] == 'o') {
186 if (s[2] == 'n') {
187 if (s[3] == 's') {
188 if (s[4] == 't') {
189 return Parser::T_CONST;
190 }
191 }
192 }
193 }
194 }
195 else if (s[0] == 'd') {
196 if (s[1] == 'm') {
197 if (s[2] == 'a') {
198 if (s[3] == 't') {
199 if (s[4] == '2') {
200 return Parser::T_DMAT2 | Lexer::Variant_GLSL_400;
201 }
202 else if (s[4] == '3') {
203 return Parser::T_DMAT3 | Lexer::Variant_GLSL_400;
204 }
205 else if (s[4] == '4') {
206 return Parser::T_DMAT4 | Lexer::Variant_GLSL_400;
207 }
208 }
209 }
210 }
211 else if (s[1] == 'v') {
212 if (s[2] == 'e') {
213 if (s[3] == 'c') {
214 if (s[4] == '2') {
215 return Parser::T_DVEC2 | Lexer::Variant_GLSL_400;
216 }
217 else if (s[4] == '3') {
218 return Parser::T_DVEC3 | Lexer::Variant_GLSL_400;
219 }
220 else if (s[4] == '4') {
221 return Parser::T_DVEC4 | Lexer::Variant_GLSL_400;
222 }
223 }
224 }
225 }
226 }
227 else if (s[0] == 'f') {
228 if (s[1] == 'a') {
229 if (s[2] == 'l') {
230 if (s[3] == 's') {
231 if (s[4] == 'e') {
232 return Parser::T_FALSE;
233 }
234 }
235 }
236 }
237 else if (s[1] == 'l') {
238 if (s[2] == 'o') {
239 if (s[3] == 'a') {
240 if (s[4] == 't') {
241 return Parser::T_FLOAT;
242 }
243 }
244 }
245 }
246 }
247 else if (s[0] == 'h') {
248 if (s[1] == 'i') {
249 if (s[2] == 'g') {
250 if (s[3] == 'h') {
251 if (s[4] == 'p') {
252 return Parser::T_HIGHP | Lexer::Variant_GLSL_ES_100 | Lexer::Variant_GLSL_400;
253 }
254 }
255 }
256 }
257 }
258 else if (s[0] == 'i') {
259 if (s[1] == 'n') {
260 if (s[2] == 'o') {
261 if (s[3] == 'u') {
262 if (s[4] == 't') {
263 return Parser::T_INOUT;
264 }
265 }
266 }
267 }
268 else if (s[1] == 'v') {
269 if (s[2] == 'e') {
270 if (s[3] == 'c') {
271 if (s[4] == '2') {
272 return Parser::T_IVEC2;
273 }
274 else if (s[4] == '3') {
275 return Parser::T_IVEC3;
276 }
277 else if (s[4] == '4') {
278 return Parser::T_IVEC4;
279 }
280 }
281 }
282 }
283 }
284 else if (s[0] == 'p') {
285 if (s[1] == 'a') {
286 if (s[2] == 't') {
287 if (s[3] == 'c') {
288 if (s[4] == 'h') {
289 return Parser::T_PATCH | Lexer::Variant_GLSL_400;
290 }
291 }
292 }
293 }
294 }
295 else if (s[0] == 'u') {
296 if (s[1] == 'v') {
297 if (s[2] == 'e') {
298 if (s[3] == 'c') {
299 if (s[4] == '2') {
300 return Parser::T_UVEC2 | Lexer::Variant_GLSL_150;
301 }
302 else if (s[4] == '3') {
303 return Parser::T_UVEC3 | Lexer::Variant_GLSL_150;
304 }
305 else if (s[4] == '4') {
306 return Parser::T_UVEC4 | Lexer::Variant_GLSL_150;
307 }
308 }
309 }
310 }
311 }
312 else if (s[0] == 'w') {
313 if (s[1] == 'h') {
314 if (s[2] == 'i') {
315 if (s[3] == 'l') {
316 if (s[4] == 'e') {
317 return Parser::T_WHILE;
318 }
319 }
320 }
321 }
322 }
323 return Parser::T_IDENTIFIER;
324}
325
326static inline int classify6(const char *s) {
327 if (s[0] == 'd') {
328 if (s[1] == 'o') {
329 if (s[2] == 'u') {
330 if (s[3] == 'b') {
331 if (s[4] == 'l') {
332 if (s[5] == 'e') {
333 return Parser::T_DOUBLE | Lexer::Variant_GLSL_400;
334 }
335 }
336 }
337 }
338 }
339 }
340 else if (s[0] == 'l') {
341 if (s[1] == 'a') {
342 if (s[2] == 'y') {
343 if (s[3] == 'o') {
344 if (s[4] == 'u') {
345 if (s[5] == 't') {
346 return Parser::T_LAYOUT | Lexer::Variant_GLSL_150;
347 }
348 }
349 }
350 }
351 }
352 }
353 else if (s[0] == 'm') {
354 if (s[1] == 'a') {
355 if (s[2] == 't') {
356 if (s[3] == '2') {
357 if (s[4] == 'x') {
358 if (s[5] == '2') {
359 return Parser::T_MAT2X2 | Lexer::Variant_GLSL_120;
360 }
361 else if (s[5] == '3') {
362 return Parser::T_MAT2X3 | Lexer::Variant_GLSL_120;
363 }
364 else if (s[5] == '4') {
365 return Parser::T_MAT2X4 | Lexer::Variant_GLSL_120;
366 }
367 }
368 }
369 else if (s[3] == '3') {
370 if (s[4] == 'x') {
371 if (s[5] == '2') {
372 return Parser::T_MAT3X2 | Lexer::Variant_GLSL_120;
373 }
374 else if (s[5] == '3') {
375 return Parser::T_MAT3X3 | Lexer::Variant_GLSL_120;
376 }
377 else if (s[5] == '4') {
378 return Parser::T_MAT3X4 | Lexer::Variant_GLSL_120;
379 }
380 }
381 }
382 else if (s[3] == '4') {
383 if (s[4] == 'x') {
384 if (s[5] == '2') {
385 return Parser::T_MAT4X2 | Lexer::Variant_GLSL_120;
386 }
387 else if (s[5] == '3') {
388 return Parser::T_MAT4X3 | Lexer::Variant_GLSL_120;
389 }
390 else if (s[5] == '4') {
391 return Parser::T_MAT4X4 | Lexer::Variant_GLSL_120;
392 }
393 }
394 }
395 }
396 }
397 }
398 else if (s[0] == 'r') {
399 if (s[1] == 'e') {
400 if (s[2] == 't') {
401 if (s[3] == 'u') {
402 if (s[4] == 'r') {
403 if (s[5] == 'n') {
404 return Parser::T_RETURN;
405 }
406 }
407 }
408 }
409 }
410 }
411 else if (s[0] == 's') {
412 if (s[1] == 'a') {
413 if (s[2] == 'm') {
414 if (s[3] == 'p') {
415 if (s[4] == 'l') {
416 if (s[5] == 'e') {
417 return Parser::T_SAMPLE | Lexer::Variant_Reserved;
418 }
419 }
420 }
421 }
422 }
423 else if (s[1] == 'm') {
424 if (s[2] == 'o') {
425 if (s[3] == 'o') {
426 if (s[4] == 't') {
427 if (s[5] == 'h') {
428 return Parser::T_SMOOTH | Lexer::Variant_GLSL_150;
429 }
430 }
431 }
432 }
433 }
434 else if (s[1] == 't') {
435 if (s[2] == 'r') {
436 if (s[3] == 'u') {
437 if (s[4] == 'c') {
438 if (s[5] == 't') {
439 return Parser::T_STRUCT;
440 }
441 }
442 }
443 }
444 }
445 else if (s[1] == 'w') {
446 if (s[2] == 'i') {
447 if (s[3] == 't') {
448 if (s[4] == 'c') {
449 if (s[5] == 'h') {
450 return Parser::T_SWITCH | Lexer::Variant_GLSL_150;
451 }
452 }
453 }
454 }
455 }
456 }
457 return Parser::T_IDENTIFIER;
458}
459
460static inline int classify7(const char *s) {
461 if (s[0] == 'd') {
462 if (s[1] == 'e') {
463 if (s[2] == 'f') {
464 if (s[3] == 'a') {
465 if (s[4] == 'u') {
466 if (s[5] == 'l') {
467 if (s[6] == 't') {
468 return Parser::T_DEFAULT | Lexer::Variant_GLSL_150;
469 }
470 }
471 }
472 }
473 }
474 }
475 else if (s[1] == 'i') {
476 if (s[2] == 's') {
477 if (s[3] == 'c') {
478 if (s[4] == 'a') {
479 if (s[5] == 'r') {
480 if (s[6] == 'd') {
481 return Parser::T_DISCARD | Lexer::Variant_FragmentShader;
482 }
483 }
484 }
485 }
486 }
487 }
488 else if (s[1] == 'm') {
489 if (s[2] == 'a') {
490 if (s[3] == 't') {
491 if (s[4] == '2') {
492 if (s[5] == 'x') {
493 if (s[6] == '2') {
494 return Parser::T_DMAT2X2 | Lexer::Variant_GLSL_400;
495 }
496 else if (s[6] == '3') {
497 return Parser::T_DMAT2X3 | Lexer::Variant_GLSL_400;
498 }
499 else if (s[6] == '4') {
500 return Parser::T_DMAT2X4 | Lexer::Variant_GLSL_400;
501 }
502 }
503 }
504 else if (s[4] == '3') {
505 if (s[5] == 'x') {
506 if (s[6] == '2') {
507 return Parser::T_DMAT3X2 | Lexer::Variant_GLSL_400;
508 }
509 else if (s[6] == '3') {
510 return Parser::T_DMAT3X3 | Lexer::Variant_GLSL_400;
511 }
512 else if (s[6] == '4') {
513 return Parser::T_DMAT3X4 | Lexer::Variant_GLSL_400;
514 }
515 }
516 }
517 else if (s[4] == '4') {
518 if (s[5] == 'x') {
519 if (s[6] == '2') {
520 return Parser::T_DMAT4X2 | Lexer::Variant_GLSL_400;
521 }
522 else if (s[6] == '3') {
523 return Parser::T_DMAT4X3 | Lexer::Variant_GLSL_400;
524 }
525 else if (s[6] == '4') {
526 return Parser::T_DMAT4X4 | Lexer::Variant_GLSL_400;
527 }
528 }
529 }
530 }
531 }
532 }
533 }
534 else if (s[0] == 'm') {
535 if (s[1] == 'e') {
536 if (s[2] == 'd') {
537 if (s[3] == 'i') {
538 if (s[4] == 'u') {
539 if (s[5] == 'm') {
540 if (s[6] == 'p') {
541 return Parser::T_MEDIUMP | Lexer::Variant_GLSL_ES_100 | Lexer::Variant_GLSL_400;
542 }
543 }
544 }
545 }
546 }
547 }
548 }
549 else if (s[0] == 'u') {
550 if (s[1] == 'n') {
551 if (s[2] == 'i') {
552 if (s[3] == 'f') {
553 if (s[4] == 'o') {
554 if (s[5] == 'r') {
555 if (s[6] == 'm') {
556 return Parser::T_UNIFORM;
557 }
558 }
559 }
560 }
561 }
562 }
563 }
564 else if (s[0] == 'v') {
565 if (s[1] == 'a') {
566 if (s[2] == 'r') {
567 if (s[3] == 'y') {
568 if (s[4] == 'i') {
569 if (s[5] == 'n') {
570 if (s[6] == 'g') {
571 return Parser::T_VARYING;
572 }
573 }
574 }
575 }
576 }
577 }
578 }
579 return Parser::T_IDENTIFIER;
580}
581
582static inline int classify8(const char *s) {
583 if (s[0] == 'c') {
584 if (s[1] == 'e') {
585 if (s[2] == 'n') {
586 if (s[3] == 't') {
587 if (s[4] == 'r') {
588 if (s[5] == 'o') {
589 if (s[6] == 'i') {
590 if (s[7] == 'd') {
591 return Parser::T_CENTROID | Lexer::Variant_GLSL_120;
592 }
593 }
594 }
595 }
596 }
597 }
598 }
599 else if (s[1] == 'o') {
600 if (s[2] == 'n') {
601 if (s[3] == 't') {
602 if (s[4] == 'i') {
603 if (s[5] == 'n') {
604 if (s[6] == 'u') {
605 if (s[7] == 'e') {
606 return Parser::T_CONTINUE;
607 }
608 }
609 }
610 }
611 }
612 }
613 }
614 }
615 return Parser::T_IDENTIFIER;
616}
617
618static inline int classify9(const char *s) {
619 if (s[0] == 'a') {
620 if (s[1] == 't') {
621 if (s[2] == 't') {
622 if (s[3] == 'r') {
623 if (s[4] == 'i') {
624 if (s[5] == 'b') {
625 if (s[6] == 'u') {
626 if (s[7] == 't') {
627 if (s[8] == 'e') {
628 return Parser::T_ATTRIBUTE | Lexer::Variant_VertexShader;
629 }
630 }
631 }
632 }
633 }
634 }
635 }
636 }
637 }
638 else if (s[0] == 'i') {
639 if (s[1] == 'n') {
640 if (s[2] == 'v') {
641 if (s[3] == 'a') {
642 if (s[4] == 'r') {
643 if (s[5] == 'i') {
644 if (s[6] == 'a') {
645 if (s[7] == 'n') {
646 if (s[8] == 't') {
647 return Parser::T_INVARIANT;
648 }
649 }
650 }
651 }
652 }
653 }
654 }
655 }
656 }
657 else if (s[0] == 'p') {
658 if (s[1] == 'r') {
659 if (s[2] == 'e') {
660 if (s[3] == 'c') {
661 if (s[4] == 'i') {
662 if (s[5] == 's') {
663 if (s[6] == 'i') {
664 if (s[7] == 'o') {
665 if (s[8] == 'n') {
666 return Parser::T_PRECISION | Lexer::Variant_GLSL_ES_100;
667 }
668 }
669 }
670 }
671 }
672 }
673 }
674 }
675 }
676 else if (s[0] == 's') {
677 if (s[1] == 'a') {
678 if (s[2] == 'm') {
679 if (s[3] == 'p') {
680 if (s[4] == 'l') {
681 if (s[5] == 'e') {
682 if (s[6] == 'r') {
683 if (s[7] == '1') {
684 if (s[8] == 'D') {
685 return Parser::T_SAMPLER1D | Lexer::Variant_GLSL_120;
686 }
687 }
688 else if (s[7] == '2') {
689 if (s[8] == 'D') {
690 return Parser::T_SAMPLER2D;
691 }
692 }
693 else if (s[7] == '3') {
694 if (s[8] == 'D') {
695 return Parser::T_SAMPLER3D | Lexer::Variant_GLSL_120;
696 }
697 }
698 }
699 }
700 }
701 }
702 }
703 }
704 }
705 return Parser::T_IDENTIFIER;
706}
707
708static inline int classify10(const char *s) {
709 if (s[0] == 'i') {
710 if (s[1] == 's') {
711 if (s[2] == 'a') {
712 if (s[3] == 'm') {
713 if (s[4] == 'p') {
714 if (s[5] == 'l') {
715 if (s[6] == 'e') {
716 if (s[7] == 'r') {
717 if (s[8] == '1') {
718 if (s[9] == 'D') {
719 return Parser::T_ISAMPLER1D | Lexer::Variant_GLSL_150;
720 }
721 }
722 else if (s[8] == '2') {
723 if (s[9] == 'D') {
724 return Parser::T_ISAMPLER2D | Lexer::Variant_GLSL_150;
725 }
726 }
727 else if (s[8] == '3') {
728 if (s[9] == 'D') {
729 return Parser::T_ISAMPLER3D | Lexer::Variant_GLSL_150;
730 }
731 }
732 }
733 }
734 }
735 }
736 }
737 }
738 }
739 }
740 else if (s[0] == 's') {
741 if (s[1] == 'u') {
742 if (s[2] == 'b') {
743 if (s[3] == 'r') {
744 if (s[4] == 'o') {
745 if (s[5] == 'u') {
746 if (s[6] == 't') {
747 if (s[7] == 'i') {
748 if (s[8] == 'n') {
749 if (s[9] == 'e') {
750 return Parser::T_SUBROUTINE | Lexer::Variant_GLSL_400;
751 }
752 }
753 }
754 }
755 }
756 }
757 }
758 }
759 }
760 }
761 else if (s[0] == 'u') {
762 if (s[1] == 's') {
763 if (s[2] == 'a') {
764 if (s[3] == 'm') {
765 if (s[4] == 'p') {
766 if (s[5] == 'l') {
767 if (s[6] == 'e') {
768 if (s[7] == 'r') {
769 if (s[8] == '1') {
770 if (s[9] == 'D') {
771 return Parser::T_USAMPLER1D | Lexer::Variant_GLSL_150;
772 }
773 }
774 else if (s[8] == '2') {
775 if (s[9] == 'D') {
776 return Parser::T_USAMPLER2D | Lexer::Variant_GLSL_150;
777 }
778 }
779 else if (s[8] == '3') {
780 if (s[9] == 'D') {
781 return Parser::T_USAMPLER3D | Lexer::Variant_GLSL_150;
782 }
783 }
784 }
785 }
786 }
787 }
788 }
789 }
790 }
791 }
792 return Parser::T_IDENTIFIER;
793}
794
795static inline int classify11(const char *s) {
796 if (s[0] == 's') {
797 if (s[1] == 'a') {
798 if (s[2] == 'm') {
799 if (s[3] == 'p') {
800 if (s[4] == 'l') {
801 if (s[5] == 'e') {
802 if (s[6] == 'r') {
803 if (s[7] == '2') {
804 if (s[8] == 'D') {
805 if (s[9] == 'M') {
806 if (s[10] == 'S') {
807 return Parser::T_SAMPLER2DMS | Lexer::Variant_GLSL_150;
808 }
809 }
810 }
811 }
812 else if (s[7] == 'C') {
813 if (s[8] == 'u') {
814 if (s[9] == 'b') {
815 if (s[10] == 'e') {
816 return Parser::T_SAMPLERCUBE;
817 }
818 }
819 }
820 }
821 }
822 }
823 }
824 }
825 }
826 }
827 }
828 return Parser::T_IDENTIFIER;
829}
830
831static inline int classify12(const char *s) {
832 if (s[0] == 'i') {
833 if (s[1] == 's') {
834 if (s[2] == 'a') {
835 if (s[3] == 'm') {
836 if (s[4] == 'p') {
837 if (s[5] == 'l') {
838 if (s[6] == 'e') {
839 if (s[7] == 'r') {
840 if (s[8] == '2') {
841 if (s[9] == 'D') {
842 if (s[10] == 'M') {
843 if (s[11] == 'S') {
844 return Parser::T_ISAMPLER2DMS | Lexer::Variant_GLSL_150;
845 }
846 }
847 }
848 }
849 else if (s[8] == 'C') {
850 if (s[9] == 'u') {
851 if (s[10] == 'b') {
852 if (s[11] == 'e') {
853 return Parser::T_ISAMPLERCUBE | Lexer::Variant_GLSL_150;
854 }
855 }
856 }
857 }
858 }
859 }
860 }
861 }
862 }
863 }
864 }
865 }
866 else if (s[0] == 'u') {
867 if (s[1] == 's') {
868 if (s[2] == 'a') {
869 if (s[3] == 'm') {
870 if (s[4] == 'p') {
871 if (s[5] == 'l') {
872 if (s[6] == 'e') {
873 if (s[7] == 'r') {
874 if (s[8] == '2') {
875 if (s[9] == 'D') {
876 if (s[10] == 'M') {
877 if (s[11] == 'S') {
878 return Parser::T_USAMPLER2DMS | Lexer::Variant_GLSL_150;
879 }
880 }
881 }
882 }
883 else if (s[8] == 'C') {
884 if (s[9] == 'u') {
885 if (s[10] == 'b') {
886 if (s[11] == 'e') {
887 return Parser::T_USAMPLERCUBE | Lexer::Variant_GLSL_150;
888 }
889 }
890 }
891 }
892 }
893 }
894 }
895 }
896 }
897 }
898 }
899 }
900 return Parser::T_IDENTIFIER;
901}
902
903static inline int classify13(const char *s) {
904 if (s[0] == 'n') {
905 if (s[1] == 'o') {
906 if (s[2] == 'p') {
907 if (s[3] == 'e') {
908 if (s[4] == 'r') {
909 if (s[5] == 's') {
910 if (s[6] == 'p') {
911 if (s[7] == 'e') {
912 if (s[8] == 'c') {
913 if (s[9] == 't') {
914 if (s[10] == 'i') {
915 if (s[11] == 'v') {
916 if (s[12] == 'e') {
917 return Parser::T_NOPERSPECTIVE | Lexer::Variant_GLSL_150;
918 }
919 }
920 }
921 }
922 }
923 }
924 }
925 }
926 }
927 }
928 }
929 }
930 }
931 else if (s[0] == 's') {
932 if (s[1] == 'a') {
933 if (s[2] == 'm') {
934 if (s[3] == 'p') {
935 if (s[4] == 'l') {
936 if (s[5] == 'e') {
937 if (s[6] == 'r') {
938 if (s[7] == '2') {
939 if (s[8] == 'D') {
940 if (s[9] == 'R') {
941 if (s[10] == 'e') {
942 if (s[11] == 'c') {
943 if (s[12] == 't') {
944 return Parser::T_SAMPLER2DRECT;
945 }
946 }
947 }
948 }
949 }
950 }
951 else if (s[7] == 'B') {
952 if (s[8] == 'u') {
953 if (s[9] == 'f') {
954 if (s[10] == 'f') {
955 if (s[11] == 'e') {
956 if (s[12] == 'r') {
957 return Parser::T_SAMPLERBUFFER | Lexer::Variant_GLSL_150;
958 }
959 }
960 }
961 }
962 }
963 }
964 }
965 }
966 }
967 }
968 }
969 }
970 }
971 return Parser::T_IDENTIFIER;
972}
973
974static inline int classify14(const char *s) {
975 if (s[0] == 'i') {
976 if (s[1] == 's') {
977 if (s[2] == 'a') {
978 if (s[3] == 'm') {
979 if (s[4] == 'p') {
980 if (s[5] == 'l') {
981 if (s[6] == 'e') {
982 if (s[7] == 'r') {
983 if (s[8] == '2') {
984 if (s[9] == 'D') {
985 if (s[10] == 'R') {
986 if (s[11] == 'e') {
987 if (s[12] == 'c') {
988 if (s[13] == 't') {
989 return Parser::T_ISAMPLER2DRECT | Lexer::Variant_GLSL_150;
990 }
991 }
992 }
993 }
994 }
995 }
996 else if (s[8] == 'B') {
997 if (s[9] == 'u') {
998 if (s[10] == 'f') {
999 if (s[11] == 'f') {
1000 if (s[12] == 'e') {
1001 if (s[13] == 'r') {
1002 return Parser::T_ISAMPLERBUFFER | Lexer::Variant_GLSL_150;
1003 }
1004 }
1005 }
1006 }
1007 }
1008 }
1009 }
1010 }
1011 }
1012 }
1013 }
1014 }
1015 }
1016 }
1017 else if (s[0] == 's') {
1018 if (s[1] == 'a') {
1019 if (s[2] == 'm') {
1020 if (s[3] == 'p') {
1021 if (s[4] == 'l') {
1022 if (s[5] == 'e') {
1023 if (s[6] == 'r') {
1024 if (s[7] == '1') {
1025 if (s[8] == 'D') {
1026 if (s[9] == 'A') {
1027 if (s[10] == 'r') {
1028 if (s[11] == 'r') {
1029 if (s[12] == 'a') {
1030 if (s[13] == 'y') {
1031 return Parser::T_SAMPLER1DARRAY | Lexer::Variant_GLSL_150;
1032 }
1033 }
1034 }
1035 }
1036 }
1037 }
1038 }
1039 else if (s[7] == '2') {
1040 if (s[8] == 'D') {
1041 if (s[9] == 'A') {
1042 if (s[10] == 'r') {
1043 if (s[11] == 'r') {
1044 if (s[12] == 'a') {
1045 if (s[13] == 'y') {
1046 return Parser::T_SAMPLER2DARRAY | Lexer::Variant_GLSL_150;
1047 }
1048 }
1049 }
1050 }
1051 }
1052 }
1053 }
1054 }
1055 }
1056 }
1057 }
1058 }
1059 }
1060 }
1061 else if (s[0] == 'u') {
1062 if (s[1] == 's') {
1063 if (s[2] == 'a') {
1064 if (s[3] == 'm') {
1065 if (s[4] == 'p') {
1066 if (s[5] == 'l') {
1067 if (s[6] == 'e') {
1068 if (s[7] == 'r') {
1069 if (s[8] == '2') {
1070 if (s[9] == 'D') {
1071 if (s[10] == 'R') {
1072 if (s[11] == 'e') {
1073 if (s[12] == 'c') {
1074 if (s[13] == 't') {
1075 return Parser::T_USAMPLER2DRECT | Lexer::Variant_GLSL_150;
1076 }
1077 }
1078 }
1079 }
1080 }
1081 }
1082 else if (s[8] == 'B') {
1083 if (s[9] == 'u') {
1084 if (s[10] == 'f') {
1085 if (s[11] == 'f') {
1086 if (s[12] == 'e') {
1087 if (s[13] == 'r') {
1088 return Parser::T_USAMPLERBUFFER | Lexer::Variant_GLSL_150;
1089 }
1090 }
1091 }
1092 }
1093 }
1094 }
1095 }
1096 }
1097 }
1098 }
1099 }
1100 }
1101 }
1102 }
1103 return Parser::T_IDENTIFIER;
1104}
1105
1106static inline int classify15(const char *s) {
1107 if (s[0] == 'i') {
1108 if (s[1] == 's') {
1109 if (s[2] == 'a') {
1110 if (s[3] == 'm') {
1111 if (s[4] == 'p') {
1112 if (s[5] == 'l') {
1113 if (s[6] == 'e') {
1114 if (s[7] == 'r') {
1115 if (s[8] == '1') {
1116 if (s[9] == 'D') {
1117 if (s[10] == 'A') {
1118 if (s[11] == 'r') {
1119 if (s[12] == 'r') {
1120 if (s[13] == 'a') {
1121 if (s[14] == 'y') {
1122 return Parser::T_ISAMPLER1DARRAY | Lexer::Variant_GLSL_150;
1123 }
1124 }
1125 }
1126 }
1127 }
1128 }
1129 }
1130 else if (s[8] == '2') {
1131 if (s[9] == 'D') {
1132 if (s[10] == 'A') {
1133 if (s[11] == 'r') {
1134 if (s[12] == 'r') {
1135 if (s[13] == 'a') {
1136 if (s[14] == 'y') {
1137 return Parser::T_ISAMPLER2DARRAY | Lexer::Variant_GLSL_150;
1138 }
1139 }
1140 }
1141 }
1142 }
1143 }
1144 }
1145 }
1146 }
1147 }
1148 }
1149 }
1150 }
1151 }
1152 }
1153 else if (s[0] == 's') {
1154 if (s[1] == 'a') {
1155 if (s[2] == 'm') {
1156 if (s[3] == 'p') {
1157 if (s[4] == 'l') {
1158 if (s[5] == 'e') {
1159 if (s[6] == 'r') {
1160 if (s[7] == '1') {
1161 if (s[8] == 'D') {
1162 if (s[9] == 'S') {
1163 if (s[10] == 'h') {
1164 if (s[11] == 'a') {
1165 if (s[12] == 'd') {
1166 if (s[13] == 'o') {
1167 if (s[14] == 'w') {
1168 return Parser::T_SAMPLER1DSHADOW | Lexer::Variant_GLSL_120;
1169 }
1170 }
1171 }
1172 }
1173 }
1174 }
1175 }
1176 }
1177 else if (s[7] == '2') {
1178 if (s[8] == 'D') {
1179 if (s[9] == 'S') {
1180 if (s[10] == 'h') {
1181 if (s[11] == 'a') {
1182 if (s[12] == 'd') {
1183 if (s[13] == 'o') {
1184 if (s[14] == 'w') {
1185 return Parser::T_SAMPLER2DSHADOW | Lexer::Variant_GLSL_120;
1186 }
1187 }
1188 }
1189 }
1190 }
1191 }
1192 }
1193 }
1194 }
1195 }
1196 }
1197 }
1198 }
1199 }
1200 }
1201 else if (s[0] == 'u') {
1202 if (s[1] == 's') {
1203 if (s[2] == 'a') {
1204 if (s[3] == 'm') {
1205 if (s[4] == 'p') {
1206 if (s[5] == 'l') {
1207 if (s[6] == 'e') {
1208 if (s[7] == 'r') {
1209 if (s[8] == '1') {
1210 if (s[9] == 'D') {
1211 if (s[10] == 'A') {
1212 if (s[11] == 'r') {
1213 if (s[12] == 'r') {
1214 if (s[13] == 'a') {
1215 if (s[14] == 'y') {
1216 return Parser::T_USAMPLER1DARRAY | Lexer::Variant_GLSL_150;
1217 }
1218 }
1219 }
1220 }
1221 }
1222 }
1223 }
1224 else if (s[8] == '2') {
1225 if (s[9] == 'D') {
1226 if (s[10] == 'A') {
1227 if (s[11] == 'r') {
1228 if (s[12] == 'r') {
1229 if (s[13] == 'a') {
1230 if (s[14] == 'y') {
1231 return Parser::T_USAMPLER2DARRAY | Lexer::Variant_GLSL_150;
1232 }
1233 }
1234 }
1235 }
1236 }
1237 }
1238 }
1239 }
1240 }
1241 }
1242 }
1243 }
1244 }
1245 }
1246 }
1247 return Parser::T_IDENTIFIER;
1248}
1249
1250static inline int classify16(const char *s) {
1251 if (s[0] == 's') {
1252 if (s[1] == 'a') {
1253 if (s[2] == 'm') {
1254 if (s[3] == 'p') {
1255 if (s[4] == 'l') {
1256 if (s[5] == 'e') {
1257 if (s[6] == 'r') {
1258 if (s[7] == '2') {
1259 if (s[8] == 'D') {
1260 if (s[9] == 'M') {
1261 if (s[10] == 'S') {
1262 if (s[11] == 'A') {
1263 if (s[12] == 'r') {
1264 if (s[13] == 'r') {
1265 if (s[14] == 'a') {
1266 if (s[15] == 'y') {
1267 return Parser::T_SAMPLER2DMSARRAY | Lexer::Variant_GLSL_150;
1268 }
1269 }
1270 }
1271 }
1272 }
1273 }
1274 }
1275 }
1276 }
1277 else if (s[7] == 'C') {
1278 if (s[8] == 'u') {
1279 if (s[9] == 'b') {
1280 if (s[10] == 'e') {
1281 if (s[11] == 'A') {
1282 if (s[12] == 'r') {
1283 if (s[13] == 'r') {
1284 if (s[14] == 'a') {
1285 if (s[15] == 'y') {
1286 return Parser::T_SAMPLERCUBEARRAY | Lexer::Variant_GLSL_400;
1287 }
1288 }
1289 }
1290 }
1291 }
1292 }
1293 }
1294 }
1295 }
1296 }
1297 }
1298 }
1299 }
1300 }
1301 }
1302 }
1303 return Parser::T_IDENTIFIER;
1304}
1305
1306static inline int classify17(const char *s) {
1307 if (s[0] == 'i') {
1308 if (s[1] == 's') {
1309 if (s[2] == 'a') {
1310 if (s[3] == 'm') {
1311 if (s[4] == 'p') {
1312 if (s[5] == 'l') {
1313 if (s[6] == 'e') {
1314 if (s[7] == 'r') {
1315 if (s[8] == '2') {
1316 if (s[9] == 'D') {
1317 if (s[10] == 'M') {
1318 if (s[11] == 'S') {
1319 if (s[12] == 'A') {
1320 if (s[13] == 'r') {
1321 if (s[14] == 'r') {
1322 if (s[15] == 'a') {
1323 if (s[16] == 'y') {
1324 return Parser::T_ISAMPLER2DMSARRAY | Lexer::Variant_GLSL_150;
1325 }
1326 }
1327 }
1328 }
1329 }
1330 }
1331 }
1332 }
1333 }
1334 else if (s[8] == 'C') {
1335 if (s[9] == 'u') {
1336 if (s[10] == 'b') {
1337 if (s[11] == 'e') {
1338 if (s[12] == 'A') {
1339 if (s[13] == 'r') {
1340 if (s[14] == 'r') {
1341 if (s[15] == 'a') {
1342 if (s[16] == 'y') {
1343 return Parser::T_ISAMPLERCUBEARRAY | Lexer::Variant_GLSL_400;
1344 }
1345 }
1346 }
1347 }
1348 }
1349 }
1350 }
1351 }
1352 }
1353 }
1354 }
1355 }
1356 }
1357 }
1358 }
1359 }
1360 }
1361 else if (s[0] == 's') {
1362 if (s[1] == 'a') {
1363 if (s[2] == 'm') {
1364 if (s[3] == 'p') {
1365 if (s[4] == 'l') {
1366 if (s[5] == 'e') {
1367 if (s[6] == 'r') {
1368 if (s[7] == 'C') {
1369 if (s[8] == 'u') {
1370 if (s[9] == 'b') {
1371 if (s[10] == 'e') {
1372 if (s[11] == 'S') {
1373 if (s[12] == 'h') {
1374 if (s[13] == 'a') {
1375 if (s[14] == 'd') {
1376 if (s[15] == 'o') {
1377 if (s[16] == 'w') {
1378 return Parser::T_SAMPLERCUBESHADOW | Lexer::Variant_GLSL_400;
1379 }
1380 }
1381 }
1382 }
1383 }
1384 }
1385 }
1386 }
1387 }
1388 }
1389 }
1390 }
1391 }
1392 }
1393 }
1394 }
1395 }
1396 else if (s[0] == 'u') {
1397 if (s[1] == 's') {
1398 if (s[2] == 'a') {
1399 if (s[3] == 'm') {
1400 if (s[4] == 'p') {
1401 if (s[5] == 'l') {
1402 if (s[6] == 'e') {
1403 if (s[7] == 'r') {
1404 if (s[8] == '2') {
1405 if (s[9] == 'D') {
1406 if (s[10] == 'M') {
1407 if (s[11] == 'S') {
1408 if (s[12] == 'a') {
1409 if (s[13] == 'r') {
1410 if (s[14] == 'r') {
1411 if (s[15] == 'a') {
1412 if (s[16] == 'y') {
1413 return Parser::T_USAMPLER2DMSARRAY | Lexer::Variant_GLSL_150;
1414 }
1415 }
1416 }
1417 }
1418 }
1419 }
1420 }
1421 }
1422 }
1423 else if (s[8] == 'C') {
1424 if (s[9] == 'u') {
1425 if (s[10] == 'b') {
1426 if (s[11] == 'e') {
1427 if (s[12] == 'A') {
1428 if (s[13] == 'r') {
1429 if (s[14] == 'r') {
1430 if (s[15] == 'a') {
1431 if (s[16] == 'y') {
1432 return Parser::T_USAMPLERCUBEARRAY | Lexer::Variant_GLSL_400;
1433 }
1434 }
1435 }
1436 }
1437 }
1438 }
1439 }
1440 }
1441 }
1442 }
1443 }
1444 }
1445 }
1446 }
1447 }
1448 }
1449 }
1450 return Parser::T_IDENTIFIER;
1451}
1452
1453static inline int classify19(const char *s) {
1454 if (s[0] == 's') {
1455 if (s[1] == 'a') {
1456 if (s[2] == 'm') {
1457 if (s[3] == 'p') {
1458 if (s[4] == 'l') {
1459 if (s[5] == 'e') {
1460 if (s[6] == 'r') {
1461 if (s[7] == '2') {
1462 if (s[8] == 'D') {
1463 if (s[9] == 'R') {
1464 if (s[10] == 'e') {
1465 if (s[11] == 'c') {
1466 if (s[12] == 't') {
1467 if (s[13] == 'S') {
1468 if (s[14] == 'h') {
1469 if (s[15] == 'a') {
1470 if (s[16] == 'd') {
1471 if (s[17] == 'o') {
1472 if (s[18] == 'w') {
1473 return Parser::T_SAMPLER2DRECTSHADOW;
1474 }
1475 }
1476 }
1477 }
1478 }
1479 }
1480 }
1481 }
1482 }
1483 }
1484 }
1485 }
1486 }
1487 }
1488 }
1489 }
1490 }
1491 }
1492 }
1493 return Parser::T_IDENTIFIER;
1494}
1495
1496static inline int classify20(const char *s) {
1497 if (s[0] == 's') {
1498 if (s[1] == 'a') {
1499 if (s[2] == 'm') {
1500 if (s[3] == 'p') {
1501 if (s[4] == 'l') {
1502 if (s[5] == 'e') {
1503 if (s[6] == 'r') {
1504 if (s[7] == '1') {
1505 if (s[8] == 'D') {
1506 if (s[9] == 'A') {
1507 if (s[10] == 'r') {
1508 if (s[11] == 'r') {
1509 if (s[12] == 'a') {
1510 if (s[13] == 'y') {
1511 if (s[14] == 'S') {
1512 if (s[15] == 'h') {
1513 if (s[16] == 'a') {
1514 if (s[17] == 'd') {
1515 if (s[18] == 'o') {
1516 if (s[19] == 'w') {
1517 return Parser::T_SAMPLER1DARRAYSHADOW | Lexer::Variant_GLSL_150;
1518 }
1519 }
1520 }
1521 }
1522 }
1523 }
1524 }
1525 }
1526 }
1527 }
1528 }
1529 }
1530 }
1531 else if (s[7] == '2') {
1532 if (s[8] == 'D') {
1533 if (s[9] == 'A') {
1534 if (s[10] == 'r') {
1535 if (s[11] == 'r') {
1536 if (s[12] == 'a') {
1537 if (s[13] == 'y') {
1538 if (s[14] == 'S') {
1539 if (s[15] == 'h') {
1540 if (s[16] == 'a') {
1541 if (s[17] == 'd') {
1542 if (s[18] == 'o') {
1543 if (s[19] == 'w') {
1544 return Parser::T_SAMPLER2DARRAYSHADOW | Lexer::Variant_GLSL_150;
1545 }
1546 }
1547 }
1548 }
1549 }
1550 }
1551 }
1552 }
1553 }
1554 }
1555 }
1556 }
1557 }
1558 }
1559 }
1560 }
1561 }
1562 }
1563 }
1564 }
1565 return Parser::T_IDENTIFIER;
1566}
1567
1568static inline int classify22(const char *s) {
1569 if (s[0] == 's') {
1570 if (s[1] == 'a') {
1571 if (s[2] == 'm') {
1572 if (s[3] == 'p') {
1573 if (s[4] == 'l') {
1574 if (s[5] == 'e') {
1575 if (s[6] == 'r') {
1576 if (s[7] == 'C') {
1577 if (s[8] == 'u') {
1578 if (s[9] == 'b') {
1579 if (s[10] == 'e') {
1580 if (s[11] == 'A') {
1581 if (s[12] == 'r') {
1582 if (s[13] == 'r') {
1583 if (s[14] == 'a') {
1584 if (s[15] == 'y') {
1585 if (s[16] == 'S') {
1586 if (s[17] == 'h') {
1587 if (s[18] == 'a') {
1588 if (s[19] == 'd') {
1589 if (s[20] == 'o') {
1590 if (s[21] == 'w') {
1591 return Parser::T_SAMPLERCUBEARRAYSHADOW | Lexer::Variant_GLSL_400;
1592 }
1593 }
1594 }
1595 }
1596 }
1597 }
1598 }
1599 }
1600 }
1601 }
1602 }
1603 }
1604 }
1605 }
1606 }
1607 }
1608 }
1609 }
1610 }
1611 }
1612 }
1613 }
1614 return Parser::T_IDENTIFIER;
1615}
1616
1617int Lexer::classify(const char *s, int n) {
1618 switch (n) {
1619 case 2: return classify2(s);
1620 case 3: return classify3(s);
1621 case 4: return classify4(s);
1622 case 5: return classify5(s);
1623 case 6: return classify6(s);
1624 case 7: return classify7(s);
1625 case 8: return classify8(s);
1626 case 9: return classify9(s);
1627 case 10: return classify10(s);
1628 case 11: return classify11(s);
1629 case 12: return classify12(s);
1630 case 13: return classify13(s);
1631 case 14: return classify14(s);
1632 case 15: return classify15(s);
1633 case 16: return classify16(s);
1634 case 17: return classify17(s);
1635 case 19: return classify19(s);
1636 case 20: return classify20(s);
1637 case 22: return classify22(s);
1638 default: return Parser::T_IDENTIFIER;
1639 } // switch
1640}
1641
1642QStringList Lexer::keywords(int variant) {
1643 QStringList list;
1644 list += QLatin1String("do");
1645 list += QLatin1String("if");
1646 list += QLatin1String("in");
1647 list += QLatin1String("for");
1648 list += QLatin1String("int");
1649 list += QLatin1String("out");
1650 list += QLatin1String("bool");
1651 if (variant & (Lexer::Variant_GLSL_150))
1652 list += QLatin1String("case");
1653 list += QLatin1String("else");
1654 if (variant & (Lexer::Variant_GLSL_150))
1655 list += QLatin1String("flat");
1656 if (variant & (Lexer::Variant_GLSL_ES_100 | Lexer::Variant_GLSL_400))
1657 list += QLatin1String("lowp");
1658 list += QLatin1String("mat2");
1659 list += QLatin1String("mat3");
1660 list += QLatin1String("mat4");
1661 if (variant & (Lexer::Variant_GLSL_150))
1662 list += QLatin1String("uint");
1663 list += QLatin1String("vec2");
1664 list += QLatin1String("vec3");
1665 list += QLatin1String("vec4");
1666 list += QLatin1String("void");
1667 list += QLatin1String("true");
1668 list += QLatin1String("break");
1669 list += QLatin1String("bvec2");
1670 list += QLatin1String("bvec3");
1671 list += QLatin1String("bvec4");
1672 list += QLatin1String("const");
1673 if (variant & (Lexer::Variant_GLSL_400))
1674 list += QLatin1String("dmat2");
1675 if (variant & (Lexer::Variant_GLSL_400))
1676 list += QLatin1String("dmat3");
1677 if (variant & (Lexer::Variant_GLSL_400))
1678 list += QLatin1String("dmat4");
1679 if (variant & (Lexer::Variant_GLSL_400))
1680 list += QLatin1String("dvec2");
1681 if (variant & (Lexer::Variant_GLSL_400))
1682 list += QLatin1String("dvec3");
1683 if (variant & (Lexer::Variant_GLSL_400))
1684 list += QLatin1String("dvec4");
1685 list += QLatin1String("float");
1686 if (variant & (Lexer::Variant_GLSL_ES_100 | Lexer::Variant_GLSL_400))
1687 list += QLatin1String("highp");
1688 list += QLatin1String("inout");
1689 list += QLatin1String("ivec2");
1690 list += QLatin1String("ivec3");
1691 list += QLatin1String("ivec4");
1692 if (variant & (Lexer::Variant_GLSL_400))
1693 list += QLatin1String("patch");
1694 if (variant & (Lexer::Variant_GLSL_150))
1695 list += QLatin1String("uvec2");
1696 if (variant & (Lexer::Variant_GLSL_150))
1697 list += QLatin1String("uvec3");
1698 if (variant & (Lexer::Variant_GLSL_150))
1699 list += QLatin1String("uvec4");
1700 list += QLatin1String("while");
1701 list += QLatin1String("false");
1702 if (variant & (Lexer::Variant_GLSL_400))
1703 list += QLatin1String("double");
1704 if (variant & (Lexer::Variant_GLSL_150))
1705 list += QLatin1String("layout");
1706 if (variant & (Lexer::Variant_GLSL_120))
1707 list += QLatin1String("mat2x2");
1708 if (variant & (Lexer::Variant_GLSL_120))
1709 list += QLatin1String("mat2x3");
1710 if (variant & (Lexer::Variant_GLSL_120))
1711 list += QLatin1String("mat2x4");
1712 if (variant & (Lexer::Variant_GLSL_120))
1713 list += QLatin1String("mat3x2");
1714 if (variant & (Lexer::Variant_GLSL_120))
1715 list += QLatin1String("mat3x3");
1716 if (variant & (Lexer::Variant_GLSL_120))
1717 list += QLatin1String("mat3x4");
1718 if (variant & (Lexer::Variant_GLSL_120))
1719 list += QLatin1String("mat4x2");
1720 if (variant & (Lexer::Variant_GLSL_120))
1721 list += QLatin1String("mat4x3");
1722 if (variant & (Lexer::Variant_GLSL_120))
1723 list += QLatin1String("mat4x4");
1724 list += QLatin1String("return");
1725 if (variant & (Lexer::Variant_Reserved))
1726 list += QLatin1String("sample");
1727 if (variant & (Lexer::Variant_GLSL_150))
1728 list += QLatin1String("smooth");
1729 list += QLatin1String("struct");
1730 if (variant & (Lexer::Variant_GLSL_150))
1731 list += QLatin1String("switch");
1732 if (variant & (Lexer::Variant_GLSL_150))
1733 list += QLatin1String("default");
1734 if (variant & (Lexer::Variant_FragmentShader))
1735 list += QLatin1String("discard");
1736 if (variant & (Lexer::Variant_GLSL_400))
1737 list += QLatin1String("dmat2x2");
1738 if (variant & (Lexer::Variant_GLSL_400))
1739 list += QLatin1String("dmat2x3");
1740 if (variant & (Lexer::Variant_GLSL_400))
1741 list += QLatin1String("dmat2x4");
1742 if (variant & (Lexer::Variant_GLSL_400))
1743 list += QLatin1String("dmat3x2");
1744 if (variant & (Lexer::Variant_GLSL_400))
1745 list += QLatin1String("dmat3x3");
1746 if (variant & (Lexer::Variant_GLSL_400))
1747 list += QLatin1String("dmat3x4");
1748 if (variant & (Lexer::Variant_GLSL_400))
1749 list += QLatin1String("dmat4x2");
1750 if (variant & (Lexer::Variant_GLSL_400))
1751 list += QLatin1String("dmat4x3");
1752 if (variant & (Lexer::Variant_GLSL_400))
1753 list += QLatin1String("dmat4x4");
1754 if (variant & (Lexer::Variant_GLSL_ES_100 | Lexer::Variant_GLSL_400))
1755 list += QLatin1String("mediump");
1756 list += QLatin1String("uniform");
1757 list += QLatin1String("varying");
1758 if (variant & (Lexer::Variant_GLSL_120))
1759 list += QLatin1String("centroid");
1760 list += QLatin1String("continue");
1761 if (variant & (Lexer::Variant_VertexShader))
1762 list += QLatin1String("attribute");
1763 list += QLatin1String("invariant");
1764 if (variant & (Lexer::Variant_GLSL_ES_100))
1765 list += QLatin1String("precision");
1766 if (variant & (Lexer::Variant_GLSL_120))
1767 list += QLatin1String("sampler1D");
1768 list += QLatin1String("sampler2D");
1769 if (variant & (Lexer::Variant_GLSL_120))
1770 list += QLatin1String("sampler3D");
1771 if (variant & (Lexer::Variant_GLSL_150))
1772 list += QLatin1String("isampler1D");
1773 if (variant & (Lexer::Variant_GLSL_150))
1774 list += QLatin1String("isampler2D");
1775 if (variant & (Lexer::Variant_GLSL_150))
1776 list += QLatin1String("isampler3D");
1777 if (variant & (Lexer::Variant_GLSL_400))
1778 list += QLatin1String("subroutine");
1779 if (variant & (Lexer::Variant_GLSL_150))
1780 list += QLatin1String("usampler1D");
1781 if (variant & (Lexer::Variant_GLSL_150))
1782 list += QLatin1String("usampler2D");
1783 if (variant & (Lexer::Variant_GLSL_150))
1784 list += QLatin1String("usampler3D");
1785 if (variant & (Lexer::Variant_GLSL_150))
1786 list += QLatin1String("sampler2DMS");
1787 list += QLatin1String("samplerCube");
1788 if (variant & (Lexer::Variant_GLSL_150))
1789 list += QLatin1String("isampler2DMS");
1790 if (variant & (Lexer::Variant_GLSL_150))
1791 list += QLatin1String("isamplerCube");
1792 if (variant & (Lexer::Variant_GLSL_150))
1793 list += QLatin1String("usampler2DMS");
1794 if (variant & (Lexer::Variant_GLSL_150))
1795 list += QLatin1String("usamplerCube");
1796 if (variant & (Lexer::Variant_GLSL_150))
1797 list += QLatin1String("noperspective");
1798 list += QLatin1String("sampler2DRect");
1799 if (variant & (Lexer::Variant_GLSL_150))
1800 list += QLatin1String("samplerBuffer");
1801 if (variant & (Lexer::Variant_GLSL_150))
1802 list += QLatin1String("isampler2DRect");
1803 if (variant & (Lexer::Variant_GLSL_150))
1804 list += QLatin1String("isamplerBuffer");
1805 if (variant & (Lexer::Variant_GLSL_150))
1806 list += QLatin1String("sampler1DArray");
1807 if (variant & (Lexer::Variant_GLSL_150))
1808 list += QLatin1String("sampler2DArray");
1809 if (variant & (Lexer::Variant_GLSL_150))
1810 list += QLatin1String("usampler2DRect");
1811 if (variant & (Lexer::Variant_GLSL_150))
1812 list += QLatin1String("usamplerBuffer");
1813 if (variant & (Lexer::Variant_GLSL_150))
1814 list += QLatin1String("isampler1DArray");
1815 if (variant & (Lexer::Variant_GLSL_150))
1816 list += QLatin1String("isampler2DArray");
1817 if (variant & (Lexer::Variant_GLSL_120))
1818 list += QLatin1String("sampler1DShadow");
1819 if (variant & (Lexer::Variant_GLSL_120))
1820 list += QLatin1String("sampler2DShadow");
1821 if (variant & (Lexer::Variant_GLSL_150))
1822 list += QLatin1String("usampler1DArray");
1823 if (variant & (Lexer::Variant_GLSL_150))
1824 list += QLatin1String("usampler2DArray");
1825 if (variant & (Lexer::Variant_GLSL_150))
1826 list += QLatin1String("sampler2DMSArray");
1827 if (variant & (Lexer::Variant_GLSL_400))
1828 list += QLatin1String("samplerCubeArray");
1829 if (variant & (Lexer::Variant_GLSL_150))
1830 list += QLatin1String("isampler2DMSArray");
1831 if (variant & (Lexer::Variant_GLSL_400))
1832 list += QLatin1String("isamplerCubeArray");
1833 if (variant & (Lexer::Variant_GLSL_400))
1834 list += QLatin1String("samplerCubeShadow");
1835 if (variant & (Lexer::Variant_GLSL_150))
1836 list += QLatin1String("usampler2DMSarray");
1837 if (variant & (Lexer::Variant_GLSL_400))
1838 list += QLatin1String("usamplerCubeArray");
1839 list += QLatin1String("sampler2DRectShadow");
1840 if (variant & (Lexer::Variant_GLSL_150))
1841 list += QLatin1String("sampler1DArrayShadow");
1842 if (variant & (Lexer::Variant_GLSL_150))
1843 list += QLatin1String("sampler2DArrayShadow");
1844 if (variant & (Lexer::Variant_GLSL_400))
1845 list += QLatin1String("samplerCubeArrayShadow");
1846 return list;
1847}
1848
1849QT_END_NAMESPACE
1850

source code of qtquick3d/src/glslparser/glslkeywords.cpp