1 /* A Bison parser, made by GNU Bison 2.3. */
3 /* Skeleton implementation for Bison's Yacc-like parsers in C
5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6 Free Software Foundation, Inc.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
23 /* As a special exception, you may create a larger work that contains
24 part or all of the Bison parser skeleton and distribute that work
25 under terms of your choice, so long as that work isn't itself a
26 parser generator using the skeleton or a modified version thereof
27 as a parser skeleton. Alternatively, if you modify or redistribute
28 the parser skeleton itself, you may (at your option) remove this
29 special exception, which will cause the skeleton and the resulting
30 Bison output files to be licensed under the GNU General Public
31 License without this special exception.
33 This special exception was added by the Free Software Foundation in
34 version 2.2 of Bison. */
36 /* C LALR(1) parser skeleton written by Richard Stallman, by
37 simplifying the original so-called "semantic" parser. */
39 /* All symbols defined below should begin with yy or YY, to avoid
40 infringing on user name space. This should be done even for local
41 variables, as they might otherwise be expanded by user macros.
42 There are some unavoidable exceptions within include files to
43 define necessary library symbols; they are noted "INFRINGES ON
44 USER NAME SPACE" below. */
46 /* Identify Bison output. */
50 #define YYBISON_VERSION "2.3"
53 #define YYSKELETON_NAME "yacc.c"
58 /* Using locations. */
59 #define YYLSP_NEEDED 0
66 /* Put the tokens into the symbol table, so that GDB and other debuggers
71 MEDIUM_PRECISION = 260,
114 FIELD_SELECTION = 303,
163 #define INVARIANT 258
164 #define HIGH_PRECISION 259
165 #define MEDIUM_PRECISION 260
166 #define LOW_PRECISION 261
167 #define PRECISION 262
168 #define ATTRIBUTE 263
169 #define CONST_QUAL 264
170 #define BOOL_TYPE 265
171 #define FLOAT_TYPE 266
195 #define INOUT_QUAL 290
199 #define VOID_TYPE 294
201 #define SAMPLER2D 296
202 #define SAMPLERCUBE 297
203 #define IDENTIFIER 298
204 #define TYPE_NAME 299
205 #define FLOATCONSTANT 300
206 #define INTCONSTANT 301
207 #define BOOLCONSTANT 302
208 #define FIELD_SELECTION 303
220 #define MUL_ASSIGN 315
221 #define DIV_ASSIGN 316
222 #define ADD_ASSIGN 317
223 #define MOD_ASSIGN 318
224 #define LEFT_ASSIGN 319
225 #define RIGHT_ASSIGN 320
226 #define AND_ASSIGN 321
227 #define XOR_ASSIGN 322
228 #define OR_ASSIGN 323
229 #define SUB_ASSIGN 324
230 #define LEFT_PAREN 325
231 #define RIGHT_PAREN 326
232 #define LEFT_BRACKET 327
233 #define RIGHT_BRACKET 328
234 #define LEFT_BRACE 329
235 #define RIGHT_BRACE 330
240 #define SEMICOLON 335
248 #define LEFT_ANGLE 343
249 #define RIGHT_ANGLE 344
250 #define VERTICAL_BAR 345
252 #define AMPERSAND 347
258 /* Copy the first part of user declarations. */
262 // Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
263 // Use of this source code is governed by a BSD-style license that can be
264 // found in the LICENSE file.
267 // This file is auto-generated by generate_glslang_parser.sh. DO NOT EDIT!
269 #include "compiler/SymbolTable.h"
270 #include "compiler/ParseHelper.h"
271 #include "GLSLANG/ShaderLang.h"
273 #define YYLEX_PARAM context->scanner
276 /* Enabling traces. */
281 /* Enabling verbose error messages. */
282 #ifdef YYERROR_VERBOSE
283 # undef YYERROR_VERBOSE
284 # define YYERROR_VERBOSE 1
286 # define YYERROR_VERBOSE 0
289 /* Enabling the token table. */
290 #ifndef YYTOKEN_TABLE
291 # define YYTOKEN_TABLE 0
294 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
295 typedef union YYSTYPE
312 TIntermNode* intermNode;
313 TIntermNodePair nodePair;
314 TIntermTyped* intermTypedNode;
315 TIntermAggregate* intermAggregate;
319 TPrecision precision;
320 TQualifier qualifier;
328 /* Line 193 of yacc.c. */
331 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
332 # define YYSTYPE_IS_DECLARED 1
333 # define YYSTYPE_IS_TRIVIAL 1
338 /* Copy the second part of user declarations. */
341 extern int yylex(YYSTYPE* yylval_param, void* yyscanner);
342 extern void yyerror(TParseContext* context, const char* reason);
344 #define FRAG_VERT_ONLY(S, L) { \
345 if (context->shaderType != SH_FRAGMENT_SHADER && \
346 context->shaderType != SH_VERTEX_SHADER) { \
347 context->error(L, " supported in vertex/fragment shaders only ", S, "", ""); \
348 context->recover(); \
352 #define VERTEX_ONLY(S, L) { \
353 if (context->shaderType != SH_VERTEX_SHADER) { \
354 context->error(L, " supported in vertex shaders only ", S, "", ""); \
355 context->recover(); \
359 #define FRAG_ONLY(S, L) { \
360 if (context->shaderType != SH_FRAGMENT_SHADER) { \
361 context->error(L, " supported in fragment shaders only ", S, "", ""); \
362 context->recover(); \
367 /* Line 216 of yacc.c. */
375 typedef YYTYPE_UINT8 yytype_uint8;
377 typedef unsigned char yytype_uint8;
381 typedef YYTYPE_INT8 yytype_int8;
382 #elif (defined __STDC__ || defined __C99__FUNC__ \
383 || defined __cplusplus || defined _MSC_VER)
384 typedef signed char yytype_int8;
386 typedef short int yytype_int8;
390 typedef YYTYPE_UINT16 yytype_uint16;
392 typedef unsigned short int yytype_uint16;
396 typedef YYTYPE_INT16 yytype_int16;
398 typedef short int yytype_int16;
402 # ifdef __SIZE_TYPE__
403 # define YYSIZE_T __SIZE_TYPE__
404 # elif defined size_t
405 # define YYSIZE_T size_t
406 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
407 || defined __cplusplus || defined _MSC_VER)
408 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
409 # define YYSIZE_T size_t
411 # define YYSIZE_T unsigned int
415 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
418 # if defined YYENABLE_NLS && YYENABLE_NLS
420 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
421 # define YY_(msgid) dgettext ("bison-runtime", msgid)
425 # define YY_(msgid) msgid
429 /* Suppress unused-variable warnings by "using" E. */
430 #if ! defined lint || defined __GNUC__
431 # define YYUSE(e) ((void) (e))
433 # define YYUSE(e) /* empty */
436 /* Identity function, used to suppress warnings about constant conditions. */
440 #if (defined __STDC__ || defined __C99__FUNC__ \
441 || defined __cplusplus || defined _MSC_VER)
454 #if ! defined yyoverflow || YYERROR_VERBOSE
456 /* The parser invokes alloca or malloc; define the necessary symbols. */
458 # ifdef YYSTACK_USE_ALLOCA
459 # if YYSTACK_USE_ALLOCA
461 # define YYSTACK_ALLOC __builtin_alloca
462 # elif defined __BUILTIN_VA_ARG_INCR
463 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
465 # define YYSTACK_ALLOC __alloca
466 # elif defined _MSC_VER
467 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
468 # define alloca _alloca
470 # define YYSTACK_ALLOC alloca
471 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
472 || defined __cplusplus || defined _MSC_VER)
473 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
482 # ifdef YYSTACK_ALLOC
483 /* Pacify GCC's `empty if-body' warning. */
484 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
485 # ifndef YYSTACK_ALLOC_MAXIMUM
486 /* The OS might guarantee only one guard page at the bottom of the stack,
487 and a page size can be as small as 4096 bytes. So we cannot safely
488 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
489 to allow for a few compiler-allocated temporary stack slots. */
490 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
493 # define YYSTACK_ALLOC YYMALLOC
494 # define YYSTACK_FREE YYFREE
495 # ifndef YYSTACK_ALLOC_MAXIMUM
496 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
498 # if (defined __cplusplus && ! defined _STDLIB_H \
499 && ! ((defined YYMALLOC || defined malloc) \
500 && (defined YYFREE || defined free)))
501 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
507 # define YYMALLOC malloc
508 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
509 || defined __cplusplus || defined _MSC_VER)
510 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
515 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
516 || defined __cplusplus || defined _MSC_VER)
517 void free (void *); /* INFRINGES ON USER NAME SPACE */
521 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
524 #if (! defined yyoverflow \
525 && (! defined __cplusplus \
526 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
528 /* A type that is properly aligned for any stack member. */
535 /* The size of the maximum gap between one aligned stack and the next. */
536 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
538 /* The size of an array large to enough to hold all stacks, each with
540 # define YYSTACK_BYTES(N) \
541 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
542 + YYSTACK_GAP_MAXIMUM)
544 /* Copy COUNT objects from FROM to TO. The source and destination do
547 # if defined __GNUC__ && 1 < __GNUC__
548 # define YYCOPY(To, From, Count) \
549 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
551 # define YYCOPY(To, From, Count) \
555 for (yyi = 0; yyi < (Count); yyi++) \
556 (To)[yyi] = (From)[yyi]; \
562 /* Relocate STACK from its old location to the new one. The
563 local variables YYSIZE and YYSTACKSIZE give the old and new number of
564 elements in the stack, and YYPTR gives the new location of the
565 stack. Advance YYPTR to a properly aligned location for the next
567 # define YYSTACK_RELOCATE(Stack) \
570 YYSIZE_T yynewbytes; \
571 YYCOPY (&yyptr->Stack, Stack, yysize); \
572 Stack = &yyptr->Stack; \
573 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
574 yyptr += yynewbytes / sizeof (*yyptr); \
580 /* YYFINAL -- State number of the termination state. */
582 /* YYLAST -- Last index in YYTABLE. */
585 /* YYNTOKENS -- Number of terminals. */
587 /* YYNNTS -- Number of nonterminals. */
589 /* YYNRULES -- Number of rules. */
591 /* YYNRULES -- Number of states. */
592 #define YYNSTATES 296
594 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
596 #define YYMAXUTOK 348
598 #define YYTRANSLATE(YYX) \
599 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
601 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
602 static const yytype_uint8 yytranslate[] =
604 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
605 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
606 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
607 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
608 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
609 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
610 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
611 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
612 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
613 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
614 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
615 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
616 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
617 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
618 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
619 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
620 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
621 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
622 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
623 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
624 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
625 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
626 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
627 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
628 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
629 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
630 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
631 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
632 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
633 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
634 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
635 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
636 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
637 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
638 85, 86, 87, 88, 89, 90, 91, 92, 93
642 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
644 static const yytype_uint16 yyprhs[] =
646 0, 0, 3, 5, 7, 9, 11, 13, 17, 19,
647 24, 26, 30, 33, 36, 38, 40, 42, 46, 49,
648 52, 55, 57, 60, 64, 67, 69, 71, 73, 75,
649 78, 81, 84, 86, 88, 90, 92, 96, 100, 102,
650 106, 110, 112, 114, 118, 122, 126, 130, 132, 136,
651 140, 142, 144, 146, 148, 152, 154, 158, 160, 164,
652 166, 172, 174, 178, 180, 182, 184, 186, 188, 190,
653 194, 196, 199, 202, 207, 210, 212, 214, 217, 221,
654 225, 228, 234, 238, 241, 245, 248, 249, 251, 253,
655 255, 257, 259, 263, 269, 276, 282, 284, 287, 292,
656 298, 303, 306, 308, 311, 313, 315, 317, 320, 322,
657 324, 327, 329, 331, 333, 335, 340, 342, 344, 346,
658 348, 350, 352, 354, 356, 358, 360, 362, 364, 366,
659 368, 370, 372, 374, 376, 378, 380, 386, 391, 393,
660 396, 400, 402, 406, 408, 413, 415, 417, 419, 421,
661 423, 425, 427, 429, 431, 434, 435, 436, 442, 444,
662 446, 449, 453, 455, 458, 460, 463, 469, 473, 475,
663 477, 482, 483, 490, 491, 500, 501, 509, 511, 513,
664 515, 516, 519, 523, 526, 529, 532, 536, 539, 541,
668 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
669 static const yytype_int16 yyrhs[] =
671 168, 0, -1, 43, -1, 95, -1, 46, -1, 45,
672 -1, 47, -1, 70, 122, 71, -1, 96, -1, 97,
673 72, 98, 73, -1, 99, -1, 97, 76, 48, -1,
674 97, 51, -1, 97, 52, -1, 122, -1, 100, -1,
675 101, -1, 97, 76, 101, -1, 103, 71, -1, 102,
676 71, -1, 104, 39, -1, 104, -1, 104, 120, -1,
677 103, 77, 120, -1, 105, 70, -1, 140, -1, 43,
678 -1, 48, -1, 97, -1, 51, 106, -1, 52, 106,
679 -1, 107, 106, -1, 84, -1, 82, -1, 81, -1,
680 106, -1, 108, 85, 106, -1, 108, 86, 106, -1,
681 108, -1, 109, 84, 108, -1, 109, 82, 108, -1,
682 109, -1, 110, -1, 111, 88, 110, -1, 111, 89,
683 110, -1, 111, 53, 110, -1, 111, 54, 110, -1,
684 111, -1, 112, 55, 111, -1, 112, 56, 111, -1,
685 112, -1, 113, -1, 114, -1, 115, -1, 116, 57,
686 115, -1, 116, -1, 117, 59, 116, -1, 117, -1,
687 118, 58, 117, -1, 118, -1, 118, 93, 122, 78,
688 120, -1, 119, -1, 106, 121, 120, -1, 79, -1,
689 60, -1, 61, -1, 62, -1, 69, -1, 120, -1,
690 122, 77, 120, -1, 119, -1, 125, 80, -1, 133,
691 80, -1, 7, 138, 139, 80, -1, 126, 71, -1,
692 128, -1, 127, -1, 128, 130, -1, 127, 77, 130,
693 -1, 135, 43, 70, -1, 137, 43, -1, 137, 43,
694 72, 123, 73, -1, 136, 131, 129, -1, 131, 129,
695 -1, 136, 131, 132, -1, 131, 132, -1, -1, 33,
696 -1, 34, -1, 35, -1, 137, -1, 134, -1, 133,
697 77, 43, -1, 133, 77, 43, 72, 73, -1, 133,
698 77, 43, 72, 123, 73, -1, 133, 77, 43, 79,
699 146, -1, 135, -1, 135, 43, -1, 135, 43, 72,
700 73, -1, 135, 43, 72, 123, 73, -1, 135, 43,
701 79, 146, -1, 3, 43, -1, 137, -1, 136, 137,
702 -1, 9, -1, 8, -1, 37, -1, 3, 37, -1,
703 36, -1, 139, -1, 138, 139, -1, 4, -1, 5,
704 -1, 6, -1, 140, -1, 140, 72, 123, 73, -1,
705 39, -1, 11, -1, 12, -1, 10, -1, 27, -1,
706 28, -1, 29, -1, 21, -1, 22, -1, 23, -1,
707 24, -1, 25, -1, 26, -1, 30, -1, 31, -1,
708 32, -1, 41, -1, 42, -1, 141, -1, 44, -1,
709 38, 43, 74, 142, 75, -1, 38, 74, 142, 75,
710 -1, 143, -1, 142, 143, -1, 137, 144, 80, -1,
711 145, -1, 144, 77, 145, -1, 43, -1, 43, 72,
712 123, 73, -1, 120, -1, 124, -1, 150, -1, 149,
713 -1, 147, -1, 156, -1, 157, -1, 160, -1, 167,
714 -1, 74, 75, -1, -1, -1, 74, 151, 155, 152,
715 75, -1, 154, -1, 149, -1, 74, 75, -1, 74,
716 155, 75, -1, 148, -1, 155, 148, -1, 80, -1,
717 122, 80, -1, 18, 70, 122, 71, 158, -1, 148,
718 16, 148, -1, 148, -1, 122, -1, 135, 43, 79,
719 146, -1, -1, 40, 70, 161, 159, 71, 153, -1,
720 -1, 15, 162, 148, 40, 70, 122, 71, 80, -1,
721 -1, 17, 70, 163, 164, 166, 71, 153, -1, 156,
722 -1, 147, -1, 159, -1, -1, 165, 80, -1, 165,
723 80, 122, -1, 14, 80, -1, 13, 80, -1, 20,
724 80, -1, 20, 122, 80, -1, 19, 80, -1, 169,
725 -1, 168, 169, -1, 170, -1, 124, -1, -1, 125,
729 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
730 static const yytype_uint16 yyrline[] =
732 0, 153, 153, 188, 191, 204, 209, 214, 220, 223,
733 296, 299, 408, 418, 431, 439, 538, 541, 549, 553,
734 560, 564, 571, 577, 586, 594, 649, 656, 666, 669,
735 679, 689, 710, 711, 712, 717, 718, 727, 739, 740,
736 748, 759, 763, 764, 774, 784, 794, 807, 808, 818,
737 831, 835, 839, 843, 844, 857, 858, 871, 872, 885,
738 886, 903, 904, 917, 918, 919, 920, 921, 925, 928,
739 939, 947, 972, 977, 984, 1020, 1023, 1030, 1038, 1059,
740 1078, 1089, 1118, 1123, 1133, 1138, 1148, 1151, 1154, 1157,
741 1163, 1170, 1173, 1189, 1207, 1231, 1254, 1258, 1276, 1284,
742 1316, 1336, 1412, 1421, 1444, 1447, 1453, 1461, 1469, 1477,
743 1487, 1494, 1497, 1500, 1506, 1509, 1524, 1528, 1532, 1536,
744 1545, 1550, 1555, 1560, 1565, 1570, 1575, 1580, 1585, 1590,
745 1596, 1602, 1608, 1613, 1618, 1623, 1636, 1649, 1657, 1660,
746 1675, 1707, 1711, 1717, 1725, 1741, 1745, 1749, 1750, 1756,
747 1757, 1758, 1759, 1760, 1764, 1765, 1765, 1765, 1775, 1776,
748 1781, 1784, 1794, 1797, 1803, 1804, 1808, 1816, 1820, 1830,
749 1835, 1852, 1852, 1857, 1857, 1864, 1864, 1872, 1875, 1881,
750 1884, 1890, 1894, 1901, 1908, 1915, 1922, 1933, 1942, 1946,
751 1953, 1956, 1962, 1962
755 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
756 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
757 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
758 static const char *const yytname[] =
760 "$end", "error", "$undefined", "INVARIANT", "HIGH_PRECISION",
761 "MEDIUM_PRECISION", "LOW_PRECISION", "PRECISION", "ATTRIBUTE",
762 "CONST_QUAL", "BOOL_TYPE", "FLOAT_TYPE", "INT_TYPE", "BREAK", "CONTINUE",
763 "DO", "ELSE", "FOR", "IF", "DISCARD", "RETURN", "BVEC2", "BVEC3",
764 "BVEC4", "IVEC2", "IVEC3", "IVEC4", "VEC2", "VEC3", "VEC4", "MATRIX2",
765 "MATRIX3", "MATRIX4", "IN_QUAL", "OUT_QUAL", "INOUT_QUAL", "UNIFORM",
766 "VARYING", "STRUCT", "VOID_TYPE", "WHILE", "SAMPLER2D", "SAMPLERCUBE",
767 "IDENTIFIER", "TYPE_NAME", "FLOATCONSTANT", "INTCONSTANT",
768 "BOOLCONSTANT", "FIELD_SELECTION", "LEFT_OP", "RIGHT_OP", "INC_OP",
769 "DEC_OP", "LE_OP", "GE_OP", "EQ_OP", "NE_OP", "AND_OP", "OR_OP",
770 "XOR_OP", "MUL_ASSIGN", "DIV_ASSIGN", "ADD_ASSIGN", "MOD_ASSIGN",
771 "LEFT_ASSIGN", "RIGHT_ASSIGN", "AND_ASSIGN", "XOR_ASSIGN", "OR_ASSIGN",
772 "SUB_ASSIGN", "LEFT_PAREN", "RIGHT_PAREN", "LEFT_BRACKET",
773 "RIGHT_BRACKET", "LEFT_BRACE", "RIGHT_BRACE", "DOT", "COMMA", "COLON",
774 "EQUAL", "SEMICOLON", "BANG", "DASH", "TILDE", "PLUS", "STAR", "SLASH",
775 "PERCENT", "LEFT_ANGLE", "RIGHT_ANGLE", "VERTICAL_BAR", "CARET",
776 "AMPERSAND", "QUESTION", "$accept", "variable_identifier",
777 "primary_expression", "postfix_expression", "integer_expression",
778 "function_call", "function_call_or_method", "function_call_generic",
779 "function_call_header_no_parameters",
780 "function_call_header_with_parameters", "function_call_header",
781 "function_identifier", "unary_expression", "unary_operator",
782 "multiplicative_expression", "additive_expression", "shift_expression",
783 "relational_expression", "equality_expression", "and_expression",
784 "exclusive_or_expression", "inclusive_or_expression",
785 "logical_and_expression", "logical_xor_expression",
786 "logical_or_expression", "conditional_expression",
787 "assignment_expression", "assignment_operator", "expression",
788 "constant_expression", "declaration", "function_prototype",
789 "function_declarator", "function_header_with_parameters",
790 "function_header", "parameter_declarator", "parameter_declaration",
791 "parameter_qualifier", "parameter_type_specifier",
792 "init_declarator_list", "single_declaration", "fully_specified_type",
793 "type_qualifier", "type_specifier", "precision_qualifier",
794 "type_specifier_no_prec", "type_specifier_nonarray", "struct_specifier",
795 "struct_declaration_list", "struct_declaration",
796 "struct_declarator_list", "struct_declarator", "initializer",
797 "declaration_statement", "statement", "simple_statement",
798 "compound_statement", "@1", "@2", "statement_no_new_scope",
799 "compound_statement_no_new_scope", "statement_list",
800 "expression_statement", "selection_statement",
801 "selection_rest_statement", "condition", "iteration_statement", "@3",
802 "@4", "@5", "for_init_statement", "conditionopt", "for_rest_statement",
803 "jump_statement", "translation_unit", "external_declaration",
804 "function_definition", "@6", 0
809 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
811 static const yytype_uint16 yytoknum[] =
813 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
814 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
815 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
816 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
817 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
818 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
819 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
820 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
821 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
826 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
827 static const yytype_uint8 yyr1[] =
829 0, 94, 95, 96, 96, 96, 96, 96, 97, 97,
830 97, 97, 97, 97, 98, 99, 100, 100, 101, 101,
831 102, 102, 103, 103, 104, 105, 105, 105, 106, 106,
832 106, 106, 107, 107, 107, 108, 108, 108, 109, 109,
833 109, 110, 111, 111, 111, 111, 111, 112, 112, 112,
834 113, 114, 115, 116, 116, 117, 117, 118, 118, 119,
835 119, 120, 120, 121, 121, 121, 121, 121, 122, 122,
836 123, 124, 124, 124, 125, 126, 126, 127, 127, 128,
837 129, 129, 130, 130, 130, 130, 131, 131, 131, 131,
838 132, 133, 133, 133, 133, 133, 134, 134, 134, 134,
839 134, 134, 135, 135, 136, 136, 136, 136, 136, 137,
840 137, 138, 138, 138, 139, 139, 140, 140, 140, 140,
841 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
842 140, 140, 140, 140, 140, 140, 141, 141, 142, 142,
843 143, 144, 144, 145, 145, 146, 147, 148, 148, 149,
844 149, 149, 149, 149, 150, 151, 152, 150, 153, 153,
845 154, 154, 155, 155, 156, 156, 157, 158, 158, 159,
846 159, 161, 160, 162, 160, 163, 160, 164, 164, 165,
847 165, 166, 166, 167, 167, 167, 167, 167, 168, 168,
851 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
852 static const yytype_uint8 yyr2[] =
854 0, 2, 1, 1, 1, 1, 1, 3, 1, 4,
855 1, 3, 2, 2, 1, 1, 1, 3, 2, 2,
856 2, 1, 2, 3, 2, 1, 1, 1, 1, 2,
857 2, 2, 1, 1, 1, 1, 3, 3, 1, 3,
858 3, 1, 1, 3, 3, 3, 3, 1, 3, 3,
859 1, 1, 1, 1, 3, 1, 3, 1, 3, 1,
860 5, 1, 3, 1, 1, 1, 1, 1, 1, 3,
861 1, 2, 2, 4, 2, 1, 1, 2, 3, 3,
862 2, 5, 3, 2, 3, 2, 0, 1, 1, 1,
863 1, 1, 3, 5, 6, 5, 1, 2, 4, 5,
864 4, 2, 1, 2, 1, 1, 1, 2, 1, 1,
865 2, 1, 1, 1, 1, 4, 1, 1, 1, 1,
866 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
867 1, 1, 1, 1, 1, 1, 5, 4, 1, 2,
868 3, 1, 3, 1, 4, 1, 1, 1, 1, 1,
869 1, 1, 1, 1, 2, 0, 0, 5, 1, 1,
870 2, 3, 1, 2, 1, 2, 5, 3, 1, 1,
871 4, 0, 6, 0, 8, 0, 7, 1, 1, 1,
872 0, 2, 3, 2, 2, 2, 3, 2, 1, 2,
876 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
877 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
878 means the default is an error. */
879 static const yytype_uint8 yydefact[] =
881 0, 0, 111, 112, 113, 0, 105, 104, 119, 117,
882 118, 123, 124, 125, 126, 127, 128, 120, 121, 122,
883 129, 130, 131, 108, 106, 0, 116, 132, 133, 135,
884 191, 192, 0, 76, 86, 0, 91, 96, 0, 102,
885 0, 109, 114, 134, 0, 188, 190, 107, 101, 0,
886 0, 0, 71, 0, 74, 86, 0, 87, 88, 89,
887 77, 0, 86, 0, 72, 97, 103, 110, 0, 1,
888 189, 0, 0, 0, 0, 138, 0, 193, 78, 83,
889 85, 90, 0, 92, 79, 0, 0, 2, 5, 4,
890 6, 27, 0, 0, 0, 34, 33, 32, 3, 8,
891 28, 10, 15, 16, 0, 0, 21, 0, 35, 0,
892 38, 41, 42, 47, 50, 51, 52, 53, 55, 57,
893 59, 70, 0, 25, 73, 0, 143, 0, 141, 137,
894 139, 0, 0, 173, 0, 0, 0, 0, 0, 155,
895 160, 164, 35, 61, 68, 0, 146, 0, 114, 149,
896 162, 148, 147, 0, 150, 151, 152, 153, 80, 82,
897 84, 0, 0, 98, 0, 145, 100, 29, 30, 0,
898 12, 13, 0, 0, 19, 18, 0, 20, 22, 24,
899 31, 0, 0, 0, 0, 0, 0, 0, 0, 0,
900 0, 0, 0, 0, 0, 115, 136, 0, 0, 140,
901 184, 183, 0, 175, 0, 187, 185, 0, 171, 154,
902 0, 64, 65, 66, 67, 63, 0, 0, 165, 161,
903 163, 0, 93, 0, 95, 99, 7, 0, 14, 26,
904 11, 17, 23, 36, 37, 40, 39, 45, 46, 43,
905 44, 48, 49, 54, 56, 58, 0, 0, 142, 0,
906 0, 0, 186, 0, 156, 62, 69, 0, 94, 9,
907 0, 144, 0, 178, 177, 180, 0, 169, 0, 0,
908 0, 81, 60, 0, 179, 0, 0, 168, 166, 0,
909 0, 157, 0, 181, 0, 0, 0, 159, 172, 158,
910 0, 182, 176, 167, 170, 174
913 /* YYDEFGOTO[NTERM-NUM]. */
914 static const yytype_int16 yydefgoto[] =
916 -1, 98, 99, 100, 227, 101, 102, 103, 104, 105,
917 106, 107, 142, 109, 110, 111, 112, 113, 114, 115,
918 116, 117, 118, 119, 120, 143, 144, 216, 145, 122,
919 146, 147, 32, 33, 34, 79, 60, 61, 80, 35,
920 36, 37, 38, 39, 40, 41, 123, 43, 74, 75,
921 127, 128, 166, 149, 150, 151, 152, 210, 270, 288,
922 289, 153, 154, 155, 278, 269, 156, 253, 202, 250,
923 265, 275, 276, 157, 44, 45, 46, 53
926 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
928 #define YYPACT_NINF -250
929 static const yytype_int16 yypact[] =
931 1218, -13, -250, -250, -250, 137, -250, -250, -250, -250,
932 -250, -250, -250, -250, -250, -250, -250, -250, -250, -250,
933 -250, -250, -250, -250, -250, -28, -250, -250, -250, -250,
934 -250, -55, -38, -4, 33, -20, -250, 44, 1259, -250,
935 1318, -250, 18, -250, 1176, -250, -250, -250, -250, 1318,
936 -22, 1259, -250, 29, -250, 85, 73, -250, -250, -250,
937 -250, 1259, 113, 70, -250, 13, -250, -250, 949, -250,
938 -250, 49, 1259, 90, 1080, -250, 283, -250, -250, -250,
939 -250, 101, 1259, -56, -250, 757, 949, 80, -250, -250,
940 -250, -250, 949, 949, 949, -250, -250, -250, -250, -250,
941 -33, -250, -250, -250, 81, -15, 1013, 92, -250, 949,
942 52, -75, -250, -25, 40, -250, -250, -250, 106, 105,
943 -46, -250, 93, -250, -250, 1121, 95, 9, -250, -250,
944 -250, 88, 89, -250, 100, 102, 91, 821, 104, 103,
945 -250, -250, 66, -250, -250, 20, -250, -55, 79, -250,
946 -250, -250, -250, 365, -250, -250, -250, -250, 107, -250,
947 -250, 885, 949, -250, 109, -250, -250, -250, -250, -6,
948 -250, -250, 949, 1283, -250, -250, 949, 110, -250, -250,
949 -250, 949, 949, 949, 949, 949, 949, 949, 949, 949,
950 949, 949, 949, 949, 949, -250, -250, 949, 90, -250,
951 -250, -250, 447, -250, 949, -250, -250, 34, -250, -250,
952 447, -250, -250, -250, -250, -250, 949, 949, -250, -250,
953 -250, 949, -250, 111, -250, -250, -250, 112, 99, -250,
954 116, -250, -250, -250, -250, 52, 52, -250, -250, -250,
955 -250, -25, -25, -250, 106, 105, 77, 114, -250, 125,
956 611, 4, -250, 693, 447, -250, -250, 115, -250, -250,
957 949, -250, 119, -250, -250, 693, 447, 99, 134, 122,
958 108, -250, -250, 949, -250, 117, 123, 174, -250, 120,
959 529, -250, 7, 949, 529, 447, 949, -250, -250, -250,
960 118, 99, -250, -250, -250, -250
963 /* YYPGOTO[NTERM-NUM]. */
964 static const yytype_int16 yypgoto[] =
966 -250, -250, -250, -250, -250, -250, -250, 22, -250, -250,
967 -250, -250, 31, -250, -27, -250, -79, -30, -250, -250,
968 -250, 5, 8, 12, -250, -63, -85, -250, -92, -82,
969 10, 11, -250, -250, -250, 121, 149, 144, 126, -250,
970 -250, -233, -21, -24, 202, -23, 0, -250, 139, -66,
971 -250, 27, -156, -41, -149, -249, -250, -250, -250, -58,
972 176, 17, -19, -250, -250, -35, -250, -250, -250, -250,
973 -250, -250, -250, -250, -250, 188, -250, -250
976 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
977 positive, shift that token. If negative, reduce the rule which
978 number is the opposite. If zero, do what YYDEFACT says.
979 If YYTABLE_NINF, syntax error. */
980 #define YYTABLE_NINF -117
981 static const yytype_int16 yytable[] =
983 42, 165, 169, 164, 220, 121, 224, 183, 130, 184,
984 30, 31, 193, 62, 66, 50, 161, 67, 170, 171,
985 268, 178, 121, 162, 47, 52, 71, 73, 185, 186,
986 48, 287, 268, 54, 62, 287, 56, 81, 42, 172,
987 42, 6, 7, 173, 42, 207, 51, 194, 73, 42,
988 73, 42, 72, 249, 30, 31, 175, 63, 81, 130,
989 64, 42, 176, 187, 188, 226, 57, 58, 59, 23,
990 24, 217, 42, 55, 42, 266, 148, 165, 290, 223,
991 228, 217, 42, 84, 217, 85, 198, 65, 56, 199,
992 68, 232, 86, 6, 7, 189, 190, 217, 121, 108,
993 218, 73, 246, 76, -75, 220, 237, 238, 239, 240,
994 47, 217, 251, 83, 252, 247, 108, 277, 57, 58,
995 59, 23, 24, 167, 168, 42, 211, 212, 213, 124,
996 294, 255, 256, 126, 121, 214, 293, 181, 182, 257,
997 180, 2, 3, 4, 158, 215, 57, 58, 59, -25,
998 -26, 68, 174, 148, 217, 260, 235, 236, 121, 241,
999 242, 267, 179, 191, 192, 262, 195, 197, 200, 201,
1000 203, 205, 204, 267, 208, 272, 217, 279, 209, 221,
1001 -116, 282, 225, 281, 258, 259, -27, 261, 271, 273,
1002 285, 291, 108, 280, 284, 231, 243, 283, 295, 286,
1003 244, 165, 148, 159, 78, 245, 82, 49, 160, 263,
1004 148, 125, 233, 234, 108, 108, 108, 108, 108, 108,
1005 108, 108, 108, 108, 108, 248, 292, 254, 108, 77,
1006 274, 264, 70, 0, 0, 0, 0, 0, 0, 0,
1007 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1008 148, 0, 108, 148, 148, 0, 0, 0, 0, 0,
1009 0, 0, 0, 0, 0, 148, 148, 0, 0, 0,
1010 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1011 148, 0, 0, 0, 148, 148, 1, 2, 3, 4,
1012 5, 6, 7, 8, 9, 10, 131, 132, 133, 0,
1013 134, 135, 136, 137, 11, 12, 13, 14, 15, 16,
1014 17, 18, 19, 20, 21, 22, 0, 0, 0, 23,
1015 24, 25, 26, 138, 27, 28, 87, 29, 88, 89,
1016 90, 91, 0, 0, 92, 93, 0, 0, 0, 0,
1017 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1018 0, 0, 0, 94, 0, 0, 0, 139, 140, 0,
1019 0, 0, 0, 141, 95, 96, 0, 97, 1, 2,
1020 3, 4, 5, 6, 7, 8, 9, 10, 131, 132,
1021 133, 0, 134, 135, 136, 137, 11, 12, 13, 14,
1022 15, 16, 17, 18, 19, 20, 21, 22, 0, 0,
1023 0, 23, 24, 25, 26, 138, 27, 28, 87, 29,
1024 88, 89, 90, 91, 0, 0, 92, 93, 0, 0,
1025 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1026 0, 0, 0, 0, 0, 94, 0, 0, 0, 139,
1027 219, 0, 0, 0, 0, 141, 95, 96, 0, 97,
1028 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
1029 131, 132, 133, 0, 134, 135, 136, 137, 11, 12,
1030 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
1031 0, 0, 0, 23, 24, 25, 26, 138, 27, 28,
1032 87, 29, 88, 89, 90, 91, 0, 0, 92, 93,
1033 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1034 0, 0, 0, 0, 0, 0, 0, 94, 0, 0,
1035 0, 139, 0, 0, 0, 0, 0, 141, 95, 96,
1036 0, 97, 1, 2, 3, 4, 5, 6, 7, 8,
1037 9, 10, 131, 132, 133, 0, 134, 135, 136, 137,
1038 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
1039 21, 22, 0, 0, 0, 23, 24, 25, 26, 138,
1040 27, 28, 87, 29, 88, 89, 90, 91, 0, 0,
1041 92, 93, 0, 0, 0, 0, 0, 0, 0, 0,
1042 0, 0, 0, 0, 0, 0, 0, 0, 0, 94,
1043 0, 0, 0, 76, 0, 0, 0, 0, 0, 141,
1044 95, 96, 0, 97, 1, 2, 3, 4, 5, 6,
1045 7, 8, 9, 10, 0, 0, 0, 0, 0, 0,
1046 0, 0, 11, 12, 13, 14, 15, 16, 17, 18,
1047 19, 20, 21, 22, 0, 0, 0, 23, 24, 25,
1048 26, 0, 27, 28, 87, 29, 88, 89, 90, 91,
1049 0, 0, 92, 93, 0, 0, 0, 0, 0, 0,
1050 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1051 0, 94, 0, 0, 0, 0, 0, 0, 0, 0,
1052 0, 141, 95, 96, 0, 97, 56, 2, 3, 4,
1053 0, 6, 7, 8, 9, 10, 0, 0, 0, 0,
1054 0, 0, 0, 0, 11, 12, 13, 14, 15, 16,
1055 17, 18, 19, 20, 21, 22, 0, 0, 0, 23,
1056 24, 25, 26, 0, 27, 28, 87, 29, 88, 89,
1057 90, 91, 0, 0, 92, 93, 0, 0, 0, 0,
1058 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1059 0, 0, 0, 94, 0, 0, 0, 8, 9, 10,
1060 0, 0, 0, 0, 95, 96, 0, 97, 11, 12,
1061 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
1062 0, 0, 0, 0, 0, 25, 26, 0, 27, 28,
1063 87, 29, 88, 89, 90, 91, 0, 0, 92, 93,
1064 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1065 0, 0, 0, 0, 0, 0, 0, 94, 0, 0,
1066 163, 8, 9, 10, 0, 0, 0, 0, 95, 96,
1067 0, 97, 11, 12, 13, 14, 15, 16, 17, 18,
1068 19, 20, 21, 22, 0, 0, 0, 0, 0, 25,
1069 26, 0, 27, 28, 87, 29, 88, 89, 90, 91,
1070 0, 0, 92, 93, 0, 0, 0, 0, 0, 0,
1071 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1072 0, 94, 0, 0, 0, 8, 9, 10, 0, 0,
1073 0, 206, 95, 96, 0, 97, 11, 12, 13, 14,
1074 15, 16, 17, 18, 19, 20, 21, 22, 0, 0,
1075 0, 0, 0, 25, 26, 0, 27, 28, 87, 29,
1076 88, 89, 90, 91, 0, 0, 92, 93, 0, 0,
1077 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1078 0, 0, 0, 0, 0, 94, 0, 0, 222, 8,
1079 9, 10, 0, 0, 0, 0, 95, 96, 0, 97,
1080 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
1081 21, 22, 0, 0, 0, 0, 0, 25, 26, 0,
1082 27, 28, 87, 29, 88, 89, 90, 91, 0, 0,
1083 92, 93, 0, 0, 0, 0, 0, 0, 0, 0,
1084 0, 0, 0, 0, 0, 0, 0, 0, 0, 94,
1085 0, 0, 0, 8, 9, 10, 0, 0, 0, 0,
1086 95, 96, 0, 97, 11, 12, 13, 14, 15, 16,
1087 17, 18, 19, 20, 21, 22, 0, 0, 0, 0,
1088 0, 25, 177, 0, 27, 28, 87, 29, 88, 89,
1089 90, 91, 0, 0, 92, 93, 0, 0, 0, 0,
1090 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1091 0, 0, 0, 94, 2, 3, 4, 0, 0, 0,
1092 8, 9, 10, 0, 95, 96, 0, 97, 0, 0,
1093 0, 11, 12, 13, 14, 15, 16, 17, 18, 19,
1094 20, 21, 22, 0, 0, 0, 0, 0, 25, 26,
1095 0, 27, 28, 0, 29, 2, 3, 4, 0, 0,
1096 0, 8, 9, 10, 0, 0, 0, 0, 0, 0,
1097 0, 0, 11, 12, 13, 14, 15, 16, 17, 18,
1098 19, 20, 21, 22, 0, 129, 0, 0, 0, 25,
1099 26, 0, 27, 28, 0, 29, 0, 0, 0, 0,
1100 0, 0, 0, 0, 0, 0, 69, 0, 0, 1,
1101 2, 3, 4, 5, 6, 7, 8, 9, 10, 0,
1102 0, 0, 0, 0, 0, 0, 196, 11, 12, 13,
1103 14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
1104 0, 0, 23, 24, 25, 26, 0, 27, 28, 0,
1105 29, 1, 2, 3, 4, 5, 6, 7, 8, 9,
1106 10, 0, 0, 0, 0, 0, 0, 0, 0, 11,
1107 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
1108 22, 0, 0, 0, 23, 24, 25, 26, 0, 27,
1109 28, 0, 29, 2, 3, 4, 0, 0, 0, 8,
1110 9, 10, 0, 0, 0, 0, 0, 0, 0, 0,
1111 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
1112 21, 22, 0, 8, 9, 10, 0, 25, 26, 0,
1113 27, 28, 0, 29, 11, 12, 13, 14, 15, 16,
1114 17, 18, 19, 20, 21, 22, 0, 0, 0, 0,
1115 0, 25, 26, 0, 27, 28, 229, 29, 8, 9,
1116 10, 230, 0, 0, 0, 0, 0, 0, 0, 11,
1117 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
1118 22, 0, 0, 0, 0, 0, 25, 26, 0, 27,
1122 static const yytype_int16 yycheck[] =
1124 0, 86, 94, 85, 153, 68, 162, 82, 74, 84,
1125 0, 0, 58, 34, 38, 43, 72, 40, 51, 52,
1126 253, 106, 85, 79, 37, 80, 49, 51, 53, 54,
1127 43, 280, 265, 71, 55, 284, 3, 61, 38, 72,
1128 40, 8, 9, 76, 44, 137, 74, 93, 72, 49,
1129 74, 51, 74, 202, 44, 44, 71, 77, 82, 125,
1130 80, 61, 77, 88, 89, 71, 33, 34, 35, 36,
1131 37, 77, 72, 77, 74, 71, 76, 162, 71, 161,
1132 172, 77, 82, 70, 77, 72, 77, 43, 3, 80,
1133 72, 176, 79, 8, 9, 55, 56, 77, 161, 68,
1134 80, 125, 194, 74, 71, 254, 185, 186, 187, 188,
1135 37, 77, 204, 43, 80, 197, 85, 266, 33, 34,
1136 35, 36, 37, 92, 93, 125, 60, 61, 62, 80,
1137 286, 216, 217, 43, 197, 69, 285, 85, 86, 221,
1138 109, 4, 5, 6, 43, 79, 33, 34, 35, 70,
1139 70, 72, 71, 153, 77, 78, 183, 184, 221, 189,
1140 190, 253, 70, 57, 59, 40, 73, 72, 80, 80,
1141 70, 80, 70, 265, 70, 260, 77, 43, 75, 72,
1142 70, 273, 73, 75, 73, 73, 70, 73, 73, 70,
1143 16, 283, 161, 71, 71, 173, 191, 80, 80, 79,
1144 192, 286, 202, 82, 55, 193, 62, 5, 82, 250,
1145 210, 72, 181, 182, 183, 184, 185, 186, 187, 188,
1146 189, 190, 191, 192, 193, 198, 284, 210, 197, 53,
1147 265, 250, 44, -1, -1, -1, -1, -1, -1, -1,
1148 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1149 250, -1, 221, 253, 254, -1, -1, -1, -1, -1,
1150 -1, -1, -1, -1, -1, 265, 266, -1, -1, -1,
1151 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1152 280, -1, -1, -1, 284, 285, 3, 4, 5, 6,
1153 7, 8, 9, 10, 11, 12, 13, 14, 15, -1,
1154 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
1155 27, 28, 29, 30, 31, 32, -1, -1, -1, 36,
1156 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
1157 47, 48, -1, -1, 51, 52, -1, -1, -1, -1,
1158 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1159 -1, -1, -1, 70, -1, -1, -1, 74, 75, -1,
1160 -1, -1, -1, 80, 81, 82, -1, 84, 3, 4,
1161 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1162 15, -1, 17, 18, 19, 20, 21, 22, 23, 24,
1163 25, 26, 27, 28, 29, 30, 31, 32, -1, -1,
1164 -1, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1165 45, 46, 47, 48, -1, -1, 51, 52, -1, -1,
1166 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1167 -1, -1, -1, -1, -1, 70, -1, -1, -1, 74,
1168 75, -1, -1, -1, -1, 80, 81, 82, -1, 84,
1169 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
1170 13, 14, 15, -1, 17, 18, 19, 20, 21, 22,
1171 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
1172 -1, -1, -1, 36, 37, 38, 39, 40, 41, 42,
1173 43, 44, 45, 46, 47, 48, -1, -1, 51, 52,
1174 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1175 -1, -1, -1, -1, -1, -1, -1, 70, -1, -1,
1176 -1, 74, -1, -1, -1, -1, -1, 80, 81, 82,
1177 -1, 84, 3, 4, 5, 6, 7, 8, 9, 10,
1178 11, 12, 13, 14, 15, -1, 17, 18, 19, 20,
1179 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
1180 31, 32, -1, -1, -1, 36, 37, 38, 39, 40,
1181 41, 42, 43, 44, 45, 46, 47, 48, -1, -1,
1182 51, 52, -1, -1, -1, -1, -1, -1, -1, -1,
1183 -1, -1, -1, -1, -1, -1, -1, -1, -1, 70,
1184 -1, -1, -1, 74, -1, -1, -1, -1, -1, 80,
1185 81, 82, -1, 84, 3, 4, 5, 6, 7, 8,
1186 9, 10, 11, 12, -1, -1, -1, -1, -1, -1,
1187 -1, -1, 21, 22, 23, 24, 25, 26, 27, 28,
1188 29, 30, 31, 32, -1, -1, -1, 36, 37, 38,
1189 39, -1, 41, 42, 43, 44, 45, 46, 47, 48,
1190 -1, -1, 51, 52, -1, -1, -1, -1, -1, -1,
1191 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1192 -1, 70, -1, -1, -1, -1, -1, -1, -1, -1,
1193 -1, 80, 81, 82, -1, 84, 3, 4, 5, 6,
1194 -1, 8, 9, 10, 11, 12, -1, -1, -1, -1,
1195 -1, -1, -1, -1, 21, 22, 23, 24, 25, 26,
1196 27, 28, 29, 30, 31, 32, -1, -1, -1, 36,
1197 37, 38, 39, -1, 41, 42, 43, 44, 45, 46,
1198 47, 48, -1, -1, 51, 52, -1, -1, -1, -1,
1199 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1200 -1, -1, -1, 70, -1, -1, -1, 10, 11, 12,
1201 -1, -1, -1, -1, 81, 82, -1, 84, 21, 22,
1202 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
1203 -1, -1, -1, -1, -1, 38, 39, -1, 41, 42,
1204 43, 44, 45, 46, 47, 48, -1, -1, 51, 52,
1205 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1206 -1, -1, -1, -1, -1, -1, -1, 70, -1, -1,
1207 73, 10, 11, 12, -1, -1, -1, -1, 81, 82,
1208 -1, 84, 21, 22, 23, 24, 25, 26, 27, 28,
1209 29, 30, 31, 32, -1, -1, -1, -1, -1, 38,
1210 39, -1, 41, 42, 43, 44, 45, 46, 47, 48,
1211 -1, -1, 51, 52, -1, -1, -1, -1, -1, -1,
1212 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1213 -1, 70, -1, -1, -1, 10, 11, 12, -1, -1,
1214 -1, 80, 81, 82, -1, 84, 21, 22, 23, 24,
1215 25, 26, 27, 28, 29, 30, 31, 32, -1, -1,
1216 -1, -1, -1, 38, 39, -1, 41, 42, 43, 44,
1217 45, 46, 47, 48, -1, -1, 51, 52, -1, -1,
1218 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1219 -1, -1, -1, -1, -1, 70, -1, -1, 73, 10,
1220 11, 12, -1, -1, -1, -1, 81, 82, -1, 84,
1221 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
1222 31, 32, -1, -1, -1, -1, -1, 38, 39, -1,
1223 41, 42, 43, 44, 45, 46, 47, 48, -1, -1,
1224 51, 52, -1, -1, -1, -1, -1, -1, -1, -1,
1225 -1, -1, -1, -1, -1, -1, -1, -1, -1, 70,
1226 -1, -1, -1, 10, 11, 12, -1, -1, -1, -1,
1227 81, 82, -1, 84, 21, 22, 23, 24, 25, 26,
1228 27, 28, 29, 30, 31, 32, -1, -1, -1, -1,
1229 -1, 38, 39, -1, 41, 42, 43, 44, 45, 46,
1230 47, 48, -1, -1, 51, 52, -1, -1, -1, -1,
1231 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1232 -1, -1, -1, 70, 4, 5, 6, -1, -1, -1,
1233 10, 11, 12, -1, 81, 82, -1, 84, -1, -1,
1234 -1, 21, 22, 23, 24, 25, 26, 27, 28, 29,
1235 30, 31, 32, -1, -1, -1, -1, -1, 38, 39,
1236 -1, 41, 42, -1, 44, 4, 5, 6, -1, -1,
1237 -1, 10, 11, 12, -1, -1, -1, -1, -1, -1,
1238 -1, -1, 21, 22, 23, 24, 25, 26, 27, 28,
1239 29, 30, 31, 32, -1, 75, -1, -1, -1, 38,
1240 39, -1, 41, 42, -1, 44, -1, -1, -1, -1,
1241 -1, -1, -1, -1, -1, -1, 0, -1, -1, 3,
1242 4, 5, 6, 7, 8, 9, 10, 11, 12, -1,
1243 -1, -1, -1, -1, -1, -1, 75, 21, 22, 23,
1244 24, 25, 26, 27, 28, 29, 30, 31, 32, -1,
1245 -1, -1, 36, 37, 38, 39, -1, 41, 42, -1,
1246 44, 3, 4, 5, 6, 7, 8, 9, 10, 11,
1247 12, -1, -1, -1, -1, -1, -1, -1, -1, 21,
1248 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
1249 32, -1, -1, -1, 36, 37, 38, 39, -1, 41,
1250 42, -1, 44, 4, 5, 6, -1, -1, -1, 10,
1251 11, 12, -1, -1, -1, -1, -1, -1, -1, -1,
1252 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
1253 31, 32, -1, 10, 11, 12, -1, 38, 39, -1,
1254 41, 42, -1, 44, 21, 22, 23, 24, 25, 26,
1255 27, 28, 29, 30, 31, 32, -1, -1, -1, -1,
1256 -1, 38, 39, -1, 41, 42, 43, 44, 10, 11,
1257 12, 48, -1, -1, -1, -1, -1, -1, -1, 21,
1258 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
1259 32, -1, -1, -1, -1, -1, 38, 39, -1, 41,
1263 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
1264 symbol of state STATE-NUM. */
1265 static const yytype_uint8 yystos[] =
1267 0, 3, 4, 5, 6, 7, 8, 9, 10, 11,
1268 12, 21, 22, 23, 24, 25, 26, 27, 28, 29,
1269 30, 31, 32, 36, 37, 38, 39, 41, 42, 44,
1270 124, 125, 126, 127, 128, 133, 134, 135, 136, 137,
1271 138, 139, 140, 141, 168, 169, 170, 37, 43, 138,
1272 43, 74, 80, 171, 71, 77, 3, 33, 34, 35,
1273 130, 131, 136, 77, 80, 43, 137, 139, 72, 0,
1274 169, 139, 74, 137, 142, 143, 74, 154, 130, 129,
1275 132, 137, 131, 43, 70, 72, 79, 43, 45, 46,
1276 47, 48, 51, 52, 70, 81, 82, 84, 95, 96,
1277 97, 99, 100, 101, 102, 103, 104, 105, 106, 107,
1278 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
1279 118, 119, 123, 140, 80, 142, 43, 144, 145, 75,
1280 143, 13, 14, 15, 17, 18, 19, 20, 40, 74,
1281 75, 80, 106, 119, 120, 122, 124, 125, 140, 147,
1282 148, 149, 150, 155, 156, 157, 160, 167, 43, 129,
1283 132, 72, 79, 73, 123, 120, 146, 106, 106, 122,
1284 51, 52, 72, 76, 71, 71, 77, 39, 120, 70,
1285 106, 85, 86, 82, 84, 53, 54, 88, 89, 55,
1286 56, 57, 59, 58, 93, 73, 75, 72, 77, 80,
1287 80, 80, 162, 70, 70, 80, 80, 122, 70, 75,
1288 151, 60, 61, 62, 69, 79, 121, 77, 80, 75,
1289 148, 72, 73, 123, 146, 73, 71, 98, 122, 43,
1290 48, 101, 120, 106, 106, 108, 108, 110, 110, 110,
1291 110, 111, 111, 115, 116, 117, 122, 123, 145, 148,
1292 163, 122, 80, 161, 155, 120, 120, 123, 73, 73,
1293 78, 73, 40, 147, 156, 164, 71, 122, 135, 159,
1294 152, 73, 120, 70, 159, 165, 166, 148, 158, 43,
1295 71, 75, 122, 80, 71, 16, 79, 149, 153, 154,
1296 71, 122, 153, 148, 146, 80
1299 #define yyerrok (yyerrstatus = 0)
1300 #define yyclearin (yychar = YYEMPTY)
1301 #define YYEMPTY (-2)
1304 #define YYACCEPT goto yyacceptlab
1305 #define YYABORT goto yyabortlab
1306 #define YYERROR goto yyerrorlab
1309 /* Like YYERROR except do call yyerror. This remains here temporarily
1310 to ease the transition to the new meaning of YYERROR, for GCC.
1311 Once GCC version 2 has supplanted version 1, this can go. */
1313 #define YYFAIL goto yyerrlab
1315 #define YYRECOVERING() (!!yyerrstatus)
1317 #define YYBACKUP(Token, Value) \
1319 if (yychar == YYEMPTY && yylen == 1) \
1323 yytoken = YYTRANSLATE (yychar); \
1329 yyerror (context, YY_("syntax error: cannot back up")); \
1336 #define YYERRCODE 256
1339 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
1340 If N is 0, then set CURRENT to the empty location which ends
1341 the previous symbol: RHS[0] (always defined). */
1343 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
1344 #ifndef YYLLOC_DEFAULT
1345 # define YYLLOC_DEFAULT(Current, Rhs, N) \
1349 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
1350 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
1351 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
1352 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
1356 (Current).first_line = (Current).last_line = \
1357 YYRHSLOC (Rhs, 0).last_line; \
1358 (Current).first_column = (Current).last_column = \
1359 YYRHSLOC (Rhs, 0).last_column; \
1365 /* YY_LOCATION_PRINT -- Print the location on the stream.
1366 This macro was not mandated originally: define only if we know
1367 we won't break user code: when these are the locations we know. */
1369 #ifndef YY_LOCATION_PRINT
1370 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
1371 # define YY_LOCATION_PRINT(File, Loc) \
1372 fprintf (File, "%d.%d-%d.%d", \
1373 (Loc).first_line, (Loc).first_column, \
1374 (Loc).last_line, (Loc).last_column)
1376 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1381 /* YYLEX -- calling `yylex' with the right arguments. */
1384 # define YYLEX yylex (&yylval, YYLEX_PARAM)
1386 # define YYLEX yylex (&yylval)
1389 /* Enable debugging if requested. */
1393 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1394 # define YYFPRINTF fprintf
1397 # define YYDPRINTF(Args) \
1403 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
1407 YYFPRINTF (stderr, "%s ", Title); \
1408 yy_symbol_print (stderr, \
1409 Type, Value, context); \
1410 YYFPRINTF (stderr, "\n"); \
1415 /*--------------------------------.
1416 | Print this symbol on YYOUTPUT. |
1417 `--------------------------------*/
1420 #if (defined __STDC__ || defined __C99__FUNC__ \
1421 || defined __cplusplus || defined _MSC_VER)
1423 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, TParseContext* context)
1426 yy_symbol_value_print (yyoutput, yytype, yyvaluep, context)
1429 YYSTYPE const * const yyvaluep;
1430 TParseContext* context;
1437 if (yytype < YYNTOKENS)
1438 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1450 /*--------------------------------.
1451 | Print this symbol on YYOUTPUT. |
1452 `--------------------------------*/
1454 #if (defined __STDC__ || defined __C99__FUNC__ \
1455 || defined __cplusplus || defined _MSC_VER)
1457 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, TParseContext* context)
1460 yy_symbol_print (yyoutput, yytype, yyvaluep, context)
1463 YYSTYPE const * const yyvaluep;
1464 TParseContext* context;
1467 if (yytype < YYNTOKENS)
1468 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1470 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1472 yy_symbol_value_print (yyoutput, yytype, yyvaluep, context);
1473 YYFPRINTF (yyoutput, ")");
1476 /*------------------------------------------------------------------.
1477 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1479 `------------------------------------------------------------------*/
1481 #if (defined __STDC__ || defined __C99__FUNC__ \
1482 || defined __cplusplus || defined _MSC_VER)
1484 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
1487 yy_stack_print (bottom, top)
1488 yytype_int16 *bottom;
1492 YYFPRINTF (stderr, "Stack now");
1493 for (; bottom <= top; ++bottom)
1494 YYFPRINTF (stderr, " %d", *bottom);
1495 YYFPRINTF (stderr, "\n");
1498 # define YY_STACK_PRINT(Bottom, Top) \
1501 yy_stack_print ((Bottom), (Top)); \
1505 /*------------------------------------------------.
1506 | Report that the YYRULE is going to be reduced. |
1507 `------------------------------------------------*/
1509 #if (defined __STDC__ || defined __C99__FUNC__ \
1510 || defined __cplusplus || defined _MSC_VER)
1512 yy_reduce_print (YYSTYPE *yyvsp, int yyrule, TParseContext* context)
1515 yy_reduce_print (yyvsp, yyrule, context)
1518 TParseContext* context;
1521 int yynrhs = yyr2[yyrule];
1523 unsigned long int yylno = yyrline[yyrule];
1524 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1526 /* The symbols being reduced. */
1527 for (yyi = 0; yyi < yynrhs; yyi++)
1529 fprintf (stderr, " $%d = ", yyi + 1);
1530 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1531 &(yyvsp[(yyi + 1) - (yynrhs)])
1533 fprintf (stderr, "\n");
1537 # define YY_REDUCE_PRINT(Rule) \
1540 yy_reduce_print (yyvsp, Rule, context); \
1543 /* Nonzero means print parse trace. It is left uninitialized so that
1544 multiple parsers can coexist. */
1546 #else /* !YYDEBUG */
1547 # define YYDPRINTF(Args)
1548 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1549 # define YY_STACK_PRINT(Bottom, Top)
1550 # define YY_REDUCE_PRINT(Rule)
1551 #endif /* !YYDEBUG */
1554 /* YYINITDEPTH -- initial size of the parser's stacks. */
1556 # define YYINITDEPTH 200
1559 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1560 if the built-in stack extension method is used).
1562 Do not make this value too large; the results are undefined if
1563 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1564 evaluated with infinite-precision integer arithmetic. */
1567 # define YYMAXDEPTH 10000
1575 # if defined __GLIBC__ && defined _STRING_H
1576 # define yystrlen strlen
1578 /* Return the length of YYSTR. */
1579 #if (defined __STDC__ || defined __C99__FUNC__ \
1580 || defined __cplusplus || defined _MSC_VER)
1582 yystrlen (const char *yystr)
1590 for (yylen = 0; yystr[yylen]; yylen++)
1598 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1599 # define yystpcpy stpcpy
1601 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1603 #if (defined __STDC__ || defined __C99__FUNC__ \
1604 || defined __cplusplus || defined _MSC_VER)
1606 yystpcpy (char *yydest, const char *yysrc)
1609 yystpcpy (yydest, yysrc)
1615 const char *yys = yysrc;
1617 while ((*yyd++ = *yys++) != '\0')
1626 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1627 quotes and backslashes, so that it's suitable for yyerror. The
1628 heuristic is that double-quoting is unnecessary unless the string
1629 contains an apostrophe, a comma, or backslash (other than
1630 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1631 null, do not copy; instead, return the length of what the result
1634 yytnamerr (char *yyres, const char *yystr)
1639 char const *yyp = yystr;
1646 goto do_not_strip_quotes;
1650 goto do_not_strip_quotes;
1663 do_not_strip_quotes: ;
1667 return yystrlen (yystr);
1669 return yystpcpy (yyres, yystr) - yyres;
1673 /* Copy into YYRESULT an error message about the unexpected token
1674 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1675 including the terminating null byte. If YYRESULT is null, do not
1676 copy anything; just return the number of bytes that would be
1677 copied. As a special case, return 0 if an ordinary "syntax error"
1678 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1679 size calculation. */
1681 yysyntax_error (char *yyresult, int yystate, int yychar)
1683 int yyn = yypact[yystate];
1685 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1689 int yytype = YYTRANSLATE (yychar);
1690 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1691 YYSIZE_T yysize = yysize0;
1693 int yysize_overflow = 0;
1694 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1695 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1699 /* This is so xgettext sees the translatable formats that are
1700 constructed on the fly. */
1701 YY_("syntax error, unexpected %s");
1702 YY_("syntax error, unexpected %s, expecting %s");
1703 YY_("syntax error, unexpected %s, expecting %s or %s");
1704 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1705 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1709 static char const yyunexpected[] = "syntax error, unexpected %s";
1710 static char const yyexpecting[] = ", expecting %s";
1711 static char const yyor[] = " or %s";
1712 char yyformat[sizeof yyunexpected
1713 + sizeof yyexpecting - 1
1714 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1715 * (sizeof yyor - 1))];
1716 char const *yyprefix = yyexpecting;
1718 /* Start YYX at -YYN if negative to avoid negative indexes in
1720 int yyxbegin = yyn < 0 ? -yyn : 0;
1722 /* Stay within bounds of both yycheck and yytname. */
1723 int yychecklim = YYLAST - yyn + 1;
1724 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1727 yyarg[0] = yytname[yytype];
1728 yyfmt = yystpcpy (yyformat, yyunexpected);
1730 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1731 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1733 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1737 yyformat[sizeof yyunexpected - 1] = '\0';
1740 yyarg[yycount++] = yytname[yyx];
1741 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1742 yysize_overflow |= (yysize1 < yysize);
1744 yyfmt = yystpcpy (yyfmt, yyprefix);
1748 yyf = YY_(yyformat);
1749 yysize1 = yysize + yystrlen (yyf);
1750 yysize_overflow |= (yysize1 < yysize);
1753 if (yysize_overflow)
1754 return YYSIZE_MAXIMUM;
1758 /* Avoid sprintf, as that infringes on the user's name space.
1759 Don't have undefined behavior even if the translation
1760 produced a string with the wrong number of "%s"s. */
1761 char *yyp = yyresult;
1763 while ((*yyp = *yyf) != '\0')
1765 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1767 yyp += yytnamerr (yyp, yyarg[yyi++]);
1780 #endif /* YYERROR_VERBOSE */
1783 /*-----------------------------------------------.
1784 | Release the memory associated to this symbol. |
1785 `-----------------------------------------------*/
1788 #if (defined __STDC__ || defined __C99__FUNC__ \
1789 || defined __cplusplus || defined _MSC_VER)
1791 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, TParseContext* context)
1794 yydestruct (yymsg, yytype, yyvaluep, context)
1798 TParseContext* context;
1806 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1817 /* Prevent warnings from -Wmissing-prototypes. */
1819 #ifdef YYPARSE_PARAM
1820 #if defined __STDC__ || defined __cplusplus
1821 int yyparse (void *YYPARSE_PARAM);
1825 #else /* ! YYPARSE_PARAM */
1826 #if defined __STDC__ || defined __cplusplus
1827 int yyparse (TParseContext* context);
1831 #endif /* ! YYPARSE_PARAM */
1842 #ifdef YYPARSE_PARAM
1843 #if (defined __STDC__ || defined __C99__FUNC__ \
1844 || defined __cplusplus || defined _MSC_VER)
1846 yyparse (void *YYPARSE_PARAM)
1849 yyparse (YYPARSE_PARAM)
1850 void *YYPARSE_PARAM;
1852 #else /* ! YYPARSE_PARAM */
1853 #if (defined __STDC__ || defined __C99__FUNC__ \
1854 || defined __cplusplus || defined _MSC_VER)
1856 yyparse (TParseContext* context)
1860 TParseContext* context;
1864 /* The look-ahead symbol. */
1867 /* The semantic value of the look-ahead symbol. */
1870 /* Number of syntax errors so far. */
1876 /* Number of tokens to shift before error messages enabled. */
1878 /* Look-ahead token as an internal (translated) token number. */
1881 /* Buffer for error messages, and its allocated size. */
1883 char *yymsg = yymsgbuf;
1884 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1887 /* Three stacks and their tools:
1888 `yyss': related to states,
1889 `yyvs': related to semantic values,
1890 `yyls': related to locations.
1892 Refer to the stacks thru separate pointers, to allow yyoverflow
1893 to reallocate them elsewhere. */
1895 /* The state stack. */
1896 yytype_int16 yyssa[YYINITDEPTH];
1897 yytype_int16 *yyss = yyssa;
1898 yytype_int16 *yyssp;
1900 /* The semantic value stack. */
1901 YYSTYPE yyvsa[YYINITDEPTH];
1902 YYSTYPE *yyvs = yyvsa;
1907 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1909 YYSIZE_T yystacksize = YYINITDEPTH;
1911 /* The variables used to return semantic value and location from the
1916 /* The number of symbols on the RHS of the reduced rule.
1917 Keep to zero when no symbol should be popped. */
1920 YYDPRINTF ((stderr, "Starting parse\n"));
1925 yychar = YYEMPTY; /* Cause a token to be read. */
1927 /* Initialize stack pointers.
1928 Waste one element of value and location stack
1929 so that they stay on the same level as the state stack.
1930 The wasted elements are never initialized. */
1937 /*------------------------------------------------------------.
1938 | yynewstate -- Push a new state, which is found in yystate. |
1939 `------------------------------------------------------------*/
1941 /* In all cases, when you get here, the value and location stacks
1942 have just been pushed. So pushing a state here evens the stacks. */
1948 if (yyss + yystacksize - 1 <= yyssp)
1950 /* Get the current used size of the three stacks, in elements. */
1951 YYSIZE_T yysize = yyssp - yyss + 1;
1955 /* Give user a chance to reallocate the stack. Use copies of
1956 these so that the &'s don't force the real ones into
1958 YYSTYPE *yyvs1 = yyvs;
1959 yytype_int16 *yyss1 = yyss;
1962 /* Each stack pointer address is followed by the size of the
1963 data in use in that stack, in bytes. This used to be a
1964 conditional around just the two extra args, but that might
1965 be undefined if yyoverflow is a macro. */
1966 yyoverflow (YY_("memory exhausted"),
1967 &yyss1, yysize * sizeof (*yyssp),
1968 &yyvs1, yysize * sizeof (*yyvsp),
1975 #else /* no yyoverflow */
1976 # ifndef YYSTACK_RELOCATE
1977 goto yyexhaustedlab;
1979 /* Extend the stack our own way. */
1980 if (YYMAXDEPTH <= yystacksize)
1981 goto yyexhaustedlab;
1983 if (YYMAXDEPTH < yystacksize)
1984 yystacksize = YYMAXDEPTH;
1987 yytype_int16 *yyss1 = yyss;
1988 union yyalloc *yyptr =
1989 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1991 goto yyexhaustedlab;
1992 YYSTACK_RELOCATE (yyss);
1993 YYSTACK_RELOCATE (yyvs);
1995 # undef YYSTACK_RELOCATE
1997 YYSTACK_FREE (yyss1);
2000 #endif /* no yyoverflow */
2002 yyssp = yyss + yysize - 1;
2003 yyvsp = yyvs + yysize - 1;
2006 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
2007 (unsigned long int) yystacksize));
2009 if (yyss + yystacksize - 1 <= yyssp)
2013 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
2022 /* Do appropriate processing given the current state. Read a
2023 look-ahead token if we need one and don't already have one. */
2025 /* First try to decide what to do without reference to look-ahead token. */
2026 yyn = yypact[yystate];
2027 if (yyn == YYPACT_NINF)
2030 /* Not known => get a look-ahead token if don't already have one. */
2032 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
2033 if (yychar == YYEMPTY)
2035 YYDPRINTF ((stderr, "Reading a token: "));
2039 if (yychar <= YYEOF)
2041 yychar = yytoken = YYEOF;
2042 YYDPRINTF ((stderr, "Now at end of input.\n"));
2046 yytoken = YYTRANSLATE (yychar);
2047 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
2050 /* If the proper action on seeing token YYTOKEN is to reduce or to
2051 detect an error, take that action. */
2053 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
2058 if (yyn == 0 || yyn == YYTABLE_NINF)
2067 /* Count tokens shifted since error; after three, turn off error
2072 /* Shift the look-ahead token. */
2073 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
2075 /* Discard the shifted token unless it is eof. */
2076 if (yychar != YYEOF)
2085 /*-----------------------------------------------------------.
2086 | yydefault -- do the default action for the current state. |
2087 `-----------------------------------------------------------*/
2089 yyn = yydefact[yystate];
2095 /*-----------------------------.
2096 | yyreduce -- Do a reduction. |
2097 `-----------------------------*/
2099 /* yyn is the number of a rule to reduce with. */
2102 /* If YYLEN is nonzero, implement the default value of the action:
2105 Otherwise, the following line sets YYVAL to garbage.
2106 This behavior is undocumented and Bison
2107 users should not rely upon it. Assigning to YYVAL
2108 unconditionally makes the parser a bit smaller, and it avoids a
2109 GCC warning that YYVAL may be used uninitialized. */
2110 yyval = yyvsp[1-yylen];
2113 YY_REDUCE_PRINT (yyn);
2119 // The symbol table search was done in the lexical phase
2120 const TSymbol* symbol = (yyvsp[(1) - (1)].lex).symbol;
2121 const TVariable* variable;
2123 context->error((yyvsp[(1) - (1)].lex).line, "undeclared identifier", (yyvsp[(1) - (1)].lex).string->c_str(), "");
2125 TType type(EbtFloat, EbpUndefined);
2126 TVariable* fakeVariable = new TVariable((yyvsp[(1) - (1)].lex).string, type);
2127 context->symbolTable.insert(*fakeVariable);
2128 variable = fakeVariable;
2130 // This identifier can only be a variable type symbol
2131 if (! symbol->isVariable()) {
2132 context->error((yyvsp[(1) - (1)].lex).line, "variable expected", (yyvsp[(1) - (1)].lex).string->c_str(), "");
2135 variable = static_cast<const TVariable*>(symbol);
2138 // don't delete $1.string, it's used by error recovery, and the pool
2139 // pop will reclaim the memory
2141 if (variable->getType().getQualifier() == EvqConst ) {
2142 ConstantUnion* constArray = variable->getConstPointer();
2143 TType t(variable->getType());
2144 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(constArray, t, (yyvsp[(1) - (1)].lex).line);
2146 (yyval.interm.intermTypedNode) = context->intermediate.addSymbol(variable->getUniqueId(),
2147 variable->getName(),
2148 variable->getType(), (yyvsp[(1) - (1)].lex).line);
2155 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
2163 // INT_TYPE is only 16-bit plus sign bit for vertex/fragment shaders,
2164 // check for overflow for constants
2166 if (abs((yyvsp[(1) - (1)].lex).i) >= (1 << 16)) {
2167 context->error((yyvsp[(1) - (1)].lex).line, " integer constant overflow", "", "");
2170 ConstantUnion *unionArray = new ConstantUnion[1];
2171 unionArray->setIConst((yyvsp[(1) - (1)].lex).i);
2172 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
2179 ConstantUnion *unionArray = new ConstantUnion[1];
2180 unionArray->setFConst((yyvsp[(1) - (1)].lex).f);
2181 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
2188 ConstantUnion *unionArray = new ConstantUnion[1];
2189 unionArray->setBConst((yyvsp[(1) - (1)].lex).b);
2190 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
2197 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (3)].interm.intermTypedNode);
2204 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
2211 if (!(yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isVector()) {
2212 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode())
2213 context->error((yyvsp[(2) - (4)].lex).line, " left of '[' is not of type array, matrix, or vector ", (yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode()->getSymbol().c_str(), "");
2215 context->error((yyvsp[(2) - (4)].lex).line, " left of '[' is not of type array, matrix, or vector ", "expression", "");
2218 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst && (yyvsp[(3) - (4)].interm.intermTypedNode)->getQualifier() == EvqConst) {
2219 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) { // constant folding for arrays
2220 (yyval.interm.intermTypedNode) = context->addConstArrayNode((yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2221 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector()) { // constant folding for vectors
2222 TVectorFields fields;
2224 fields.offsets[0] = (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(); // need to do it this way because v.xy sends fields integer array
2225 (yyval.interm.intermTypedNode) = context->addConstVectorNode(fields, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2226 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix()) { // constant folding for matrices
2227 (yyval.interm.intermTypedNode) = context->addConstMatrixNode((yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2230 if ((yyvsp[(3) - (4)].interm.intermTypedNode)->getQualifier() == EvqConst) {
2231 if (((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector() || (yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix()) && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getNominalSize() <= (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() ) {
2232 context->error((yyvsp[(2) - (4)].lex).line, "", "[", "field selection out of range '%d'", (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst());
2235 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) {
2236 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize() == 0) {
2237 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getMaxArraySize() <= (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst()) {
2238 if (context->arraySetMaxSize((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getTypePointer(), (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), true, (yyvsp[(2) - (4)].lex).line))
2241 if (context->arraySetMaxSize((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getTypePointer(), 0, false, (yyvsp[(2) - (4)].lex).line))
2244 } else if ( (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst() >= (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize()) {
2245 context->error((yyvsp[(2) - (4)].lex).line, "", "[", "array index out of range '%d'", (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst());
2249 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(3) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2252 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize() == 0) {
2253 context->error((yyvsp[(2) - (4)].lex).line, "", "[", "array must be redeclared with a size before being indexed with a variable");
2257 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexIndirect, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(3) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2260 if ((yyval.interm.intermTypedNode) == 0) {
2261 ConstantUnion *unionArray = new ConstantUnion[1];
2262 unionArray->setFConst(0.0f);
2263 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpHigh, EvqConst), (yyvsp[(2) - (4)].lex).line);
2264 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) {
2265 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getStruct())
2266 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getStruct(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getTypeName()));
2268 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize(), (yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix()));
2270 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst)
2271 (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConst);
2272 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst)
2273 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqConst, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize()));
2274 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix())
2275 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize()));
2276 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst)
2277 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqConst));
2278 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector())
2279 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary));
2281 (yyval.interm.intermTypedNode)->setType((yyvsp[(1) - (4)].interm.intermTypedNode)->getType());
2288 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
2295 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isArray()) {
2296 context->error((yyvsp[(3) - (3)].lex).line, "cannot apply dot operator to an array", ".", "");
2300 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isVector()) {
2301 TVectorFields fields;
2302 if (! context->parseVectorFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yyvsp[(3) - (3)].lex).line)) {
2304 fields.offsets[0] = 0;
2308 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) { // constant folding for vector fields
2309 (yyval.interm.intermTypedNode) = context->addConstVectorNode(fields, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].lex).line);
2310 if ((yyval.interm.intermTypedNode) == 0) {
2312 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2315 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(), EvqConst, (int) (*(yyvsp[(3) - (3)].lex).string).size()));
2317 if (fields.num == 1) {
2318 ConstantUnion *unionArray = new ConstantUnion[1];
2319 unionArray->setIConst(fields.offsets[0]);
2320 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line);
2321 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2322 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision()));
2324 TString vectorString = *(yyvsp[(3) - (3)].lex).string;
2325 TIntermTyped* index = context->intermediate.addSwizzle(fields, (yyvsp[(3) - (3)].lex).line);
2326 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpVectorSwizzle, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2327 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (int) vectorString.size()));
2330 } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isMatrix()) {
2331 TMatrixFields fields;
2332 if (! context->parseMatrixFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yyvsp[(3) - (3)].lex).line)) {
2333 fields.wholeRow = false;
2334 fields.wholeCol = false;
2340 if (fields.wholeRow || fields.wholeCol) {
2341 context->error((yyvsp[(2) - (3)].lex).line, " non-scalar fields not implemented yet", ".", "");
2343 ConstantUnion *unionArray = new ConstantUnion[1];
2344 unionArray->setIConst(0);
2345 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line);
2346 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2347 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(),EvqTemporary, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize()));
2349 ConstantUnion *unionArray = new ConstantUnion[1];
2350 unionArray->setIConst(fields.col * (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize() + fields.row);
2351 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line);
2352 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2353 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision()));
2355 } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType() == EbtStruct) {
2356 bool fieldFound = false;
2357 const TTypeList* fields = (yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getStruct();
2359 context->error((yyvsp[(2) - (3)].lex).line, "structure has no fields", "Internal Error", "");
2361 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2364 for (i = 0; i < fields->size(); ++i) {
2365 if ((*fields)[i].type->getFieldName() == *(yyvsp[(3) - (3)].lex).string) {
2371 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) {
2372 (yyval.interm.intermTypedNode) = context->addConstStruct(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
2373 if ((yyval.interm.intermTypedNode) == 0) {
2375 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2378 (yyval.interm.intermTypedNode)->setType(*(*fields)[i].type);
2379 // change the qualifier of the return type, not of the structure field
2380 // as the structure definition is shared between various structures.
2381 (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConst);
2384 ConstantUnion *unionArray = new ConstantUnion[1];
2385 unionArray->setIConst(i);
2386 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, *(*fields)[i].type, (yyvsp[(3) - (3)].lex).line);
2387 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirectStruct, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2388 (yyval.interm.intermTypedNode)->setType(*(*fields)[i].type);
2391 context->error((yyvsp[(2) - (3)].lex).line, " no such field in structure", (yyvsp[(3) - (3)].lex).string->c_str(), "");
2393 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2397 context->error((yyvsp[(2) - (3)].lex).line, " field selection requires structure, vector, or matrix on left hand side", (yyvsp[(3) - (3)].lex).string->c_str(), "");
2399 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2401 // don't delete $3.string, it's from the pool
2408 if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode)))
2410 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostIncrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line, context->symbolTable);
2411 if ((yyval.interm.intermTypedNode) == 0) {
2412 context->unaryOpError((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
2414 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode);
2422 if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode)))
2424 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostDecrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line, context->symbolTable);
2425 if ((yyval.interm.intermTypedNode) == 0) {
2426 context->unaryOpError((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
2428 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode);
2436 if (context->integerErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode), "[]"))
2438 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
2445 TFunction* fnCall = (yyvsp[(1) - (1)].interm).function;
2446 TOperator op = fnCall->getBuiltInOp();
2451 // Then this should be a constructor.
2452 // Don't go through the symbol table for constructors.
2453 // Their parameters will be verified algorithmically.
2455 TType type(EbtVoid, EbpUndefined); // use this to get the type back
2456 if (context->constructorErrorCheck((yyvsp[(1) - (1)].interm).line, (yyvsp[(1) - (1)].interm).intermNode, *fnCall, op, &type)) {
2457 (yyval.interm.intermTypedNode) = 0;
2460 // It's a constructor, of type 'type'.
2462 (yyval.interm.intermTypedNode) = context->addConstructor((yyvsp[(1) - (1)].interm).intermNode, &type, op, fnCall, (yyvsp[(1) - (1)].interm).line);
2465 if ((yyval.interm.intermTypedNode) == 0) {
2467 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator(0, op, (yyvsp[(1) - (1)].interm).line);
2469 (yyval.interm.intermTypedNode)->setType(type);
2472 // Not a constructor. Find it in the symbol table.
2474 const TFunction* fnCandidate;
2476 fnCandidate = context->findFunction((yyvsp[(1) - (1)].interm).line, fnCall, &builtIn);
2479 // A declared function.
2481 if (builtIn && !fnCandidate->getExtension().empty() &&
2482 context->extensionErrorCheck((yyvsp[(1) - (1)].interm).line, fnCandidate->getExtension())) {
2485 op = fnCandidate->getBuiltInOp();
2486 if (builtIn && op != EOpNull) {
2488 // A function call mapped to a built-in operation.
2490 if (fnCandidate->getParamCount() == 1) {
2492 // Treat it like a built-in unary operator.
2494 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(op, (yyvsp[(1) - (1)].interm).intermNode, 0, context->symbolTable);
2495 if ((yyval.interm.intermTypedNode) == 0) {
2496 context->error((yyvsp[(1) - (1)].interm).intermNode->getLine(), " wrong operand type", "Internal Error",
2497 "built in unary operator function. Type: %s",
2498 static_cast<TIntermTyped*>((yyvsp[(1) - (1)].interm).intermNode)->getCompleteString().c_str());
2502 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, op, (yyvsp[(1) - (1)].interm).line);
2505 // This is a real function call
2507 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, EOpFunctionCall, (yyvsp[(1) - (1)].interm).line);
2508 (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType());
2510 // this is how we know whether the given function is a builtIn function or a user defined function
2511 // if builtIn == false, it's a userDefined -> could be an overloaded builtIn function also
2512 // if builtIn == true, it's definitely a builtIn function with EOpNull
2514 (yyval.interm.intermTypedNode)->getAsAggregate()->setUserDefined();
2515 (yyval.interm.intermTypedNode)->getAsAggregate()->setName(fnCandidate->getMangledName());
2518 for (int i = 0; i < fnCandidate->getParamCount(); ++i) {
2519 qual = fnCandidate->getParam(i).type->getQualifier();
2520 if (qual == EvqOut || qual == EvqInOut) {
2521 if (context->lValueErrorCheck((yyval.interm.intermTypedNode)->getLine(), "assign", (yyval.interm.intermTypedNode)->getAsAggregate()->getSequence()[i]->getAsTyped())) {
2522 context->error((yyvsp[(1) - (1)].interm).intermNode->getLine(), "Constant value cannot be passed for 'out' or 'inout' parameters.", "Error", "");
2528 (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType());
2530 // error message was put out by PaFindFunction()
2531 // Put on a dummy node for error recovery
2532 ConstantUnion *unionArray = new ConstantUnion[1];
2533 unionArray->setFConst(0.0f);
2534 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].interm).line);
2545 (yyval.interm) = (yyvsp[(1) - (1)].interm);
2552 context->error((yyvsp[(3) - (3)].interm).line, "methods are not supported", "", "");
2554 (yyval.interm) = (yyvsp[(3) - (3)].interm);
2561 (yyval.interm) = (yyvsp[(1) - (2)].interm);
2562 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
2569 (yyval.interm) = (yyvsp[(1) - (2)].interm);
2570 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
2577 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
2578 (yyval.interm).intermNode = 0;
2585 (yyval.interm).function = (yyvsp[(1) - (1)].interm.function);
2586 (yyval.interm).intermNode = 0;
2593 TParameter param = { 0, new TType((yyvsp[(2) - (2)].interm.intermTypedNode)->getType()) };
2594 (yyvsp[(1) - (2)].interm.function)->addParameter(param);
2595 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
2596 (yyval.interm).intermNode = (yyvsp[(2) - (2)].interm.intermTypedNode);
2603 TParameter param = { 0, new TType((yyvsp[(3) - (3)].interm.intermTypedNode)->getType()) };
2604 (yyvsp[(1) - (3)].interm).function->addParameter(param);
2605 (yyval.interm).function = (yyvsp[(1) - (3)].interm).function;
2606 (yyval.interm).intermNode = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermNode, (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
2613 (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
2623 TOperator op = EOpNull;
2624 if ((yyvsp[(1) - (1)].interm.type).userDef) {
2625 op = EOpConstructStruct;
2627 switch ((yyvsp[(1) - (1)].interm.type).type) {
2629 if ((yyvsp[(1) - (1)].interm.type).matrix) {
2630 switch((yyvsp[(1) - (1)].interm.type).size) {
2631 case 2: op = EOpConstructMat2; break;
2632 case 3: op = EOpConstructMat3; break;
2633 case 4: op = EOpConstructMat4; break;
2636 switch((yyvsp[(1) - (1)].interm.type).size) {
2637 case 1: op = EOpConstructFloat; break;
2638 case 2: op = EOpConstructVec2; break;
2639 case 3: op = EOpConstructVec3; break;
2640 case 4: op = EOpConstructVec4; break;
2645 switch((yyvsp[(1) - (1)].interm.type).size) {
2646 case 1: op = EOpConstructInt; break;
2647 case 2: FRAG_VERT_ONLY("ivec2", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec2; break;
2648 case 3: FRAG_VERT_ONLY("ivec3", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec3; break;
2649 case 4: FRAG_VERT_ONLY("ivec4", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec4; break;
2653 switch((yyvsp[(1) - (1)].interm.type).size) {
2654 case 1: op = EOpConstructBool; break;
2655 case 2: FRAG_VERT_ONLY("bvec2", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec2; break;
2656 case 3: FRAG_VERT_ONLY("bvec3", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec3; break;
2657 case 4: FRAG_VERT_ONLY("bvec4", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec4; break;
2662 if (op == EOpNull) {
2663 context->error((yyvsp[(1) - (1)].interm.type).line, "cannot construct this type", getBasicString((yyvsp[(1) - (1)].interm.type).type), "");
2665 (yyvsp[(1) - (1)].interm.type).type = EbtFloat;
2666 op = EOpConstructFloat;
2670 TType type((yyvsp[(1) - (1)].interm.type));
2671 TFunction *function = new TFunction(&tempString, type, op);
2672 (yyval.interm.function) = function;
2679 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
2681 TType type(EbtVoid, EbpUndefined);
2682 TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type);
2683 (yyval.interm.function) = function;
2690 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
2692 TType type(EbtVoid, EbpUndefined);
2693 TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type);
2694 (yyval.interm.function) = function;
2701 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
2708 if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)))
2710 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreIncrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line, context->symbolTable);
2711 if ((yyval.interm.intermTypedNode) == 0) {
2712 context->unaryOpError((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2714 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2722 if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)))
2724 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreDecrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line, context->symbolTable);
2725 if ((yyval.interm.intermTypedNode) == 0) {
2726 context->unaryOpError((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2728 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2736 if ((yyvsp[(1) - (2)].interm).op != EOpNull) {
2737 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath((yyvsp[(1) - (2)].interm).op, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].interm).line, context->symbolTable);
2738 if ((yyval.interm.intermTypedNode) == 0) {
2739 const char* errorOp = "";
2740 switch((yyvsp[(1) - (2)].interm).op) {
2741 case EOpNegative: errorOp = "-"; break;
2742 case EOpLogicalNot: errorOp = "!"; break;
2745 context->unaryOpError((yyvsp[(1) - (2)].interm).line, errorOp, (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2747 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2750 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2756 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNull; ;}
2761 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNegative; ;}
2766 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpLogicalNot; ;}
2771 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
2777 FRAG_VERT_ONLY("*", (yyvsp[(2) - (3)].lex).line);
2778 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpMul, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2779 if ((yyval.interm.intermTypedNode) == 0) {
2780 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "*", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2782 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2790 FRAG_VERT_ONLY("/", (yyvsp[(2) - (3)].lex).line);
2791 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpDiv, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2792 if ((yyval.interm.intermTypedNode) == 0) {
2793 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "/", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2795 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2802 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
2808 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpAdd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2809 if ((yyval.interm.intermTypedNode) == 0) {
2810 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "+", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2812 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2820 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpSub, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2821 if ((yyval.interm.intermTypedNode) == 0) {
2822 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "-", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2824 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2831 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
2836 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
2842 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2843 if ((yyval.interm.intermTypedNode) == 0) {
2844 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2846 ConstantUnion *unionArray = new ConstantUnion[1];
2847 unionArray->setBConst(false);
2848 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2856 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2857 if ((yyval.interm.intermTypedNode) == 0) {
2858 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2860 ConstantUnion *unionArray = new ConstantUnion[1];
2861 unionArray->setBConst(false);
2862 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2870 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2871 if ((yyval.interm.intermTypedNode) == 0) {
2872 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2874 ConstantUnion *unionArray = new ConstantUnion[1];
2875 unionArray->setBConst(false);
2876 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2884 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2885 if ((yyval.interm.intermTypedNode) == 0) {
2886 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2888 ConstantUnion *unionArray = new ConstantUnion[1];
2889 unionArray->setBConst(false);
2890 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2897 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
2903 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2904 if ((yyval.interm.intermTypedNode) == 0) {
2905 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "==", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2907 ConstantUnion *unionArray = new ConstantUnion[1];
2908 unionArray->setBConst(false);
2909 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2917 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpNotEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2918 if ((yyval.interm.intermTypedNode) == 0) {
2919 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "!=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2921 ConstantUnion *unionArray = new ConstantUnion[1];
2922 unionArray->setBConst(false);
2923 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2930 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
2935 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
2940 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
2945 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
2951 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalAnd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2952 if ((yyval.interm.intermTypedNode) == 0) {
2953 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "&&", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2955 ConstantUnion *unionArray = new ConstantUnion[1];
2956 unionArray->setBConst(false);
2957 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2964 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
2970 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalXor, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2971 if ((yyval.interm.intermTypedNode) == 0) {
2972 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "^^", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2974 ConstantUnion *unionArray = new ConstantUnion[1];
2975 unionArray->setBConst(false);
2976 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2983 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
2989 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalOr, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2990 if ((yyval.interm.intermTypedNode) == 0) {
2991 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "||", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2993 ConstantUnion *unionArray = new ConstantUnion[1];
2994 unionArray->setBConst(false);
2995 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
3002 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
3008 if (context->boolErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.intermTypedNode)))
3011 (yyval.interm.intermTypedNode) = context->intermediate.addSelection((yyvsp[(1) - (5)].interm.intermTypedNode), (yyvsp[(3) - (5)].interm.intermTypedNode), (yyvsp[(5) - (5)].interm.intermTypedNode), (yyvsp[(2) - (5)].lex).line);
3012 if ((yyvsp[(3) - (5)].interm.intermTypedNode)->getType() != (yyvsp[(5) - (5)].interm.intermTypedNode)->getType())
3013 (yyval.interm.intermTypedNode) = 0;
3015 if ((yyval.interm.intermTypedNode) == 0) {
3016 context->binaryOpError((yyvsp[(2) - (5)].lex).line, ":", (yyvsp[(3) - (5)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(5) - (5)].interm.intermTypedNode)->getCompleteString());
3018 (yyval.interm.intermTypedNode) = (yyvsp[(5) - (5)].interm.intermTypedNode);
3025 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
3031 if (context->lValueErrorCheck((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)))
3033 (yyval.interm.intermTypedNode) = context->intermediate.addAssign((yyvsp[(2) - (3)].interm).op, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].interm).line);
3034 if ((yyval.interm.intermTypedNode) == 0) {
3035 context->assignError((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3037 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
3044 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAssign; ;}
3049 { FRAG_VERT_ONLY("*=", (yyvsp[(1) - (1)].lex).line); (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpMulAssign; ;}
3054 { FRAG_VERT_ONLY("/=", (yyvsp[(1) - (1)].lex).line); (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpDivAssign; ;}
3059 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAddAssign; ;}
3064 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpSubAssign; ;}
3070 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
3077 (yyval.interm.intermTypedNode) = context->intermediate.addComma((yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
3078 if ((yyval.interm.intermTypedNode) == 0) {
3079 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ",", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3081 (yyval.interm.intermTypedNode) = (yyvsp[(3) - (3)].interm.intermTypedNode);
3089 if (context->constErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)))
3091 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
3098 TFunction &function = *((yyvsp[(1) - (2)].interm).function);
3100 TIntermAggregate *prototype = new TIntermAggregate;
3101 prototype->setType(function.getReturnType());
3102 prototype->setName(function.getName());
3104 for (int i = 0; i < function.getParamCount(); i++)
3106 const TParameter ¶m = function.getParam(i);
3107 if (param.name != 0)
3109 TVariable *variable = new TVariable(param.name, *param.type);
3111 prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(variable->getUniqueId(), variable->getName(), variable->getType(), (yyvsp[(1) - (2)].interm).line), (yyvsp[(1) - (2)].interm).line);
3115 prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (2)].interm).line), (yyvsp[(1) - (2)].interm).line);
3119 prototype->setOp(EOpPrototype);
3120 (yyval.interm.intermNode) = prototype;
3127 if ((yyvsp[(1) - (2)].interm).intermAggregate)
3128 (yyvsp[(1) - (2)].interm).intermAggregate->setOp(EOpDeclaration);
3129 (yyval.interm.intermNode) = (yyvsp[(1) - (2)].interm).intermAggregate;
3136 context->symbolTable.setDefaultPrecision( (yyvsp[(3) - (4)].interm.type).type, (yyvsp[(2) - (4)].interm.precision) );
3137 (yyval.interm.intermNode) = 0;
3145 // Multiple declarations of the same function are allowed.
3147 // If this is a definition, the definition production code will check for redefinitions
3148 // (we don't know at this point if it's a definition or not).
3150 // Redeclarations are allowed. But, return types and parameter qualifiers must match.
3152 TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find((yyvsp[(1) - (2)].interm.function)->getMangledName()));
3154 if (prevDec->getReturnType() != (yyvsp[(1) - (2)].interm.function)->getReturnType()) {
3155 context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same return type", (yyvsp[(1) - (2)].interm.function)->getReturnType().getBasicString(), "");
3158 for (int i = 0; i < prevDec->getParamCount(); ++i) {
3159 if (prevDec->getParam(i).type->getQualifier() != (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifier()) {
3160 context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same parameter qualifiers", (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifierString(), "");
3167 // If this is a redeclaration, it could also be a definition,
3168 // in which case, we want to use the variable names from this one, and not the one that's
3169 // being redeclared. So, pass back up this declaration, not the one in the symbol table.
3171 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
3172 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
3174 context->symbolTable.insert(*(yyval.interm).function);
3181 (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
3188 (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
3195 // Add the parameter
3196 (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
3197 if ((yyvsp[(2) - (2)].interm).param.type->getBasicType() != EbtVoid)
3198 (yyvsp[(1) - (2)].interm.function)->addParameter((yyvsp[(2) - (2)].interm).param);
3200 delete (yyvsp[(2) - (2)].interm).param.type;
3208 // Only first parameter of one-parameter functions can be void
3209 // The check for named parameters not being void is done in parameter_declarator
3211 if ((yyvsp[(3) - (3)].interm).param.type->getBasicType() == EbtVoid) {
3213 // This parameter > first is void
3215 context->error((yyvsp[(2) - (3)].lex).line, "cannot be an argument type except for '(void)'", "void", "");
3217 delete (yyvsp[(3) - (3)].interm).param.type;
3219 // Add the parameter
3220 (yyval.interm.function) = (yyvsp[(1) - (3)].interm.function);
3221 (yyvsp[(1) - (3)].interm.function)->addParameter((yyvsp[(3) - (3)].interm).param);
3229 if ((yyvsp[(1) - (3)].interm.type).qualifier != EvqGlobal && (yyvsp[(1) - (3)].interm.type).qualifier != EvqTemporary) {
3230 context->error((yyvsp[(2) - (3)].lex).line, "no qualifiers allowed for function return", getQualifierString((yyvsp[(1) - (3)].interm.type).qualifier), "");
3233 // make sure a sampler is not involved as well...
3234 if (context->structQualifierErrorCheck((yyvsp[(2) - (3)].lex).line, (yyvsp[(1) - (3)].interm.type)))
3237 // Add the function as a prototype after parsing it (we do not support recursion)
3238 TFunction *function;
3239 TType type((yyvsp[(1) - (3)].interm.type));
3240 function = new TFunction((yyvsp[(2) - (3)].lex).string, type);
3241 (yyval.interm.function) = function;
3248 if ((yyvsp[(1) - (2)].interm.type).type == EbtVoid) {
3249 context->error((yyvsp[(2) - (2)].lex).line, "illegal use of type 'void'", (yyvsp[(2) - (2)].lex).string->c_str(), "");
3252 if (context->reservedErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string))
3254 TParameter param = {(yyvsp[(2) - (2)].lex).string, new TType((yyvsp[(1) - (2)].interm.type))};
3255 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
3256 (yyval.interm).param = param;
3263 // Check that we can make an array out of this type
3264 if (context->arrayTypeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
3267 if (context->reservedErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string))
3271 if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3273 (yyvsp[(1) - (5)].interm.type).setArray(true, size);
3275 TType* type = new TType((yyvsp[(1) - (5)].interm.type));
3276 TParameter param = { (yyvsp[(2) - (5)].lex).string, type };
3277 (yyval.interm).line = (yyvsp[(2) - (5)].lex).line;
3278 (yyval.interm).param = param;
3285 (yyval.interm) = (yyvsp[(3) - (3)].interm);
3286 if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
3294 (yyval.interm) = (yyvsp[(2) - (2)].interm);
3295 if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
3297 if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
3305 (yyval.interm) = (yyvsp[(3) - (3)].interm);
3306 if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
3314 (yyval.interm) = (yyvsp[(2) - (2)].interm);
3315 if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
3317 if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
3325 (yyval.interm.qualifier) = EvqIn;
3332 (yyval.interm.qualifier) = EvqIn;
3339 (yyval.interm.qualifier) = EvqOut;
3346 (yyval.interm.qualifier) = EvqInOut;
3353 TParameter param = { 0, new TType((yyvsp[(1) - (1)].interm.type)) };
3354 (yyval.interm).param = param;
3361 (yyval.interm) = (yyvsp[(1) - (1)].interm);
3368 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(3) - (3)].lex).string, TType((yyvsp[(1) - (3)].interm).type), (yyvsp[(3) - (3)].lex).line);
3369 (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermNode, symbol, (yyvsp[(3) - (3)].lex).line);
3371 if (context->structQualifierErrorCheck((yyvsp[(3) - (3)].lex).line, (yyval.interm).type))
3374 if (context->nonInitConstErrorCheck((yyvsp[(3) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyval.interm).type))
3377 TVariable* variable = 0;
3378 if (context->nonInitErrorCheck((yyvsp[(3) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyval.interm).type, variable))
3380 if (symbol && variable)
3381 symbol->setId(variable->getUniqueId());
3388 if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
3391 if (context->nonInitConstErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type))
3394 (yyval.interm) = (yyvsp[(1) - (5)].interm);
3396 if (context->arrayTypeErrorCheck((yyvsp[(4) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type) || context->arrayQualifierErrorCheck((yyvsp[(4) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
3399 (yyvsp[(1) - (5)].interm).type.setArray(true);
3400 TVariable* variable;
3401 if (context->arrayErrorCheck((yyvsp[(4) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, variable))
3410 if (context->structQualifierErrorCheck((yyvsp[(3) - (6)].lex).line, (yyvsp[(1) - (6)].interm).type))
3413 if (context->nonInitConstErrorCheck((yyvsp[(3) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type))
3416 (yyval.interm) = (yyvsp[(1) - (6)].interm);
3418 if (context->arrayTypeErrorCheck((yyvsp[(4) - (6)].lex).line, (yyvsp[(1) - (6)].interm).type) || context->arrayQualifierErrorCheck((yyvsp[(4) - (6)].lex).line, (yyvsp[(1) - (6)].interm).type))
3422 if (context->arraySizeErrorCheck((yyvsp[(4) - (6)].lex).line, (yyvsp[(5) - (6)].interm.intermTypedNode), size))
3424 (yyvsp[(1) - (6)].interm).type.setArray(true, size);
3425 TVariable* variable = 0;
3426 if (context->arrayErrorCheck((yyvsp[(4) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type, variable))
3428 TType type = TType((yyvsp[(1) - (6)].interm).type);
3429 type.setArraySize(size);
3430 (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (6)].interm).intermNode, context->intermediate.addSymbol(variable ? variable->getUniqueId() : 0, *(yyvsp[(3) - (6)].lex).string, type, (yyvsp[(3) - (6)].lex).line), (yyvsp[(3) - (6)].lex).line);
3438 if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
3441 (yyval.interm) = (yyvsp[(1) - (5)].interm);
3443 TIntermNode* intermNode;
3444 if (!context->executeInitializer((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, (yyvsp[(5) - (5)].interm.intermTypedNode), intermNode)) {
3446 // build the intermediate representation
3449 (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (5)].interm).intermNode, intermNode, (yyvsp[(4) - (5)].lex).line);
3451 (yyval.interm).intermAggregate = (yyvsp[(1) - (5)].interm).intermAggregate;
3454 (yyval.interm).intermAggregate = 0;
3462 (yyval.interm).type = (yyvsp[(1) - (1)].interm.type);
3463 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(context->intermediate.addSymbol(0, "", TType((yyvsp[(1) - (1)].interm.type)), (yyvsp[(1) - (1)].interm.type).line), (yyvsp[(1) - (1)].interm.type).line);
3470 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyvsp[(1) - (2)].interm.type)), (yyvsp[(2) - (2)].lex).line);
3471 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (2)].lex).line);
3473 if (context->structQualifierErrorCheck((yyvsp[(2) - (2)].lex).line, (yyval.interm).type))
3476 if (context->nonInitConstErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string, (yyval.interm).type))
3479 (yyval.interm).type = (yyvsp[(1) - (2)].interm.type);
3481 TVariable* variable = 0;
3482 if (context->nonInitErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string, (yyval.interm).type, variable))
3484 if (variable && symbol)
3485 symbol->setId(variable->getUniqueId());
3492 context->error((yyvsp[(2) - (4)].lex).line, "unsized array declarations not supported", (yyvsp[(2) - (4)].lex).string->c_str(), "");
3495 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (4)].lex).string, TType((yyvsp[(1) - (4)].interm.type)), (yyvsp[(2) - (4)].lex).line);
3496 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (4)].lex).line);
3497 (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
3504 TType type = TType((yyvsp[(1) - (5)].interm.type));
3506 if (context->arraySizeErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3508 type.setArraySize(size);
3509 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (5)].lex).string, type, (yyvsp[(2) - (5)].lex).line);
3510 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (5)].lex).line);
3512 if (context->structQualifierErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
3515 if (context->nonInitConstErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type)))
3518 (yyval.interm).type = (yyvsp[(1) - (5)].interm.type);
3520 if (context->arrayTypeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)) || context->arrayQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
3524 if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3527 (yyvsp[(1) - (5)].interm.type).setArray(true, size);
3528 TVariable* variable = 0;
3529 if (context->arrayErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type), variable))
3531 if (variable && symbol)
3532 symbol->setId(variable->getUniqueId());
3540 if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
3543 (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
3545 TIntermNode* intermNode;
3546 if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode)) {
3548 // Build intermediate representation
3551 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(intermNode, (yyvsp[(3) - (4)].lex).line);
3553 (yyval.interm).intermAggregate = 0;
3556 (yyval.interm).intermAggregate = 0;
3564 VERTEX_ONLY("invariant declaration", (yyvsp[(1) - (2)].lex).line);
3565 (yyval.interm).qualifier = EvqInvariantVaryingOut;
3566 (yyval.interm).intermAggregate = 0;
3573 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3575 if ((yyvsp[(1) - (1)].interm.type).array) {
3576 context->error((yyvsp[(1) - (1)].interm.type).line, "not supported", "first-class array", "");
3578 (yyvsp[(1) - (1)].interm.type).setArray(false);
3586 if ((yyvsp[(2) - (2)].interm.type).array) {
3587 context->error((yyvsp[(2) - (2)].interm.type).line, "not supported", "first-class array", "");
3589 (yyvsp[(2) - (2)].interm.type).setArray(false);
3592 if ((yyvsp[(1) - (2)].interm.type).qualifier == EvqAttribute &&
3593 ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
3594 context->error((yyvsp[(2) - (2)].interm.type).line, "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier), "");
3597 if (((yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingIn || (yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingOut) &&
3598 ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
3599 context->error((yyvsp[(2) - (2)].interm.type).line, "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier), "");
3602 (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
3603 (yyval.interm.type).qualifier = (yyvsp[(1) - (2)].interm.type).qualifier;
3610 (yyval.interm.type).setBasic(EbtVoid, EvqConst, (yyvsp[(1) - (1)].lex).line);
3617 VERTEX_ONLY("attribute", (yyvsp[(1) - (1)].lex).line);
3618 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "attribute"))
3620 (yyval.interm.type).setBasic(EbtVoid, EvqAttribute, (yyvsp[(1) - (1)].lex).line);
3627 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "varying"))
3629 if (context->shaderType == SH_VERTEX_SHADER)
3630 (yyval.interm.type).setBasic(EbtVoid, EvqVaryingOut, (yyvsp[(1) - (1)].lex).line);
3632 (yyval.interm.type).setBasic(EbtVoid, EvqVaryingIn, (yyvsp[(1) - (1)].lex).line);
3639 if (context->globalErrorCheck((yyvsp[(1) - (2)].lex).line, context->symbolTable.atGlobalLevel(), "invariant varying"))
3641 if (context->shaderType == SH_VERTEX_SHADER)
3642 (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingOut, (yyvsp[(1) - (2)].lex).line);
3644 (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingIn, (yyvsp[(1) - (2)].lex).line);
3651 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "uniform"))
3653 (yyval.interm.type).setBasic(EbtVoid, EvqUniform, (yyvsp[(1) - (1)].lex).line);
3660 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3662 if ((yyval.interm.type).precision == EbpUndefined) {
3663 (yyval.interm.type).precision = context->symbolTable.getDefaultPrecision((yyvsp[(1) - (1)].interm.type).type);
3664 if (context->precisionErrorCheck((yyvsp[(1) - (1)].interm.type).line, (yyval.interm.type).precision, (yyvsp[(1) - (1)].interm.type).type)) {
3674 (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
3675 (yyval.interm.type).precision = (yyvsp[(1) - (2)].interm.precision);
3682 (yyval.interm.precision) = EbpHigh;
3689 (yyval.interm.precision) = EbpMedium;
3696 (yyval.interm.precision) = EbpLow;
3703 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3710 (yyval.interm.type) = (yyvsp[(1) - (4)].interm.type);
3712 if (context->arrayTypeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
3716 if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
3718 (yyval.interm.type).setArray(true, size);
3726 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3727 (yyval.interm.type).setBasic(EbtVoid, qual, (yyvsp[(1) - (1)].lex).line);
3734 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3735 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3742 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3743 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3750 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3751 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3758 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3759 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3760 (yyval.interm.type).setAggregate(2);
3767 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3768 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3769 (yyval.interm.type).setAggregate(3);
3776 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3777 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3778 (yyval.interm.type).setAggregate(4);
3785 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3786 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3787 (yyval.interm.type).setAggregate(2);
3794 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3795 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3796 (yyval.interm.type).setAggregate(3);
3803 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3804 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3805 (yyval.interm.type).setAggregate(4);
3812 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3813 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3814 (yyval.interm.type).setAggregate(2);
3821 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3822 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3823 (yyval.interm.type).setAggregate(3);
3830 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3831 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3832 (yyval.interm.type).setAggregate(4);
3839 FRAG_VERT_ONLY("mat2", (yyvsp[(1) - (1)].lex).line);
3840 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3841 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3842 (yyval.interm.type).setAggregate(2, true);
3849 FRAG_VERT_ONLY("mat3", (yyvsp[(1) - (1)].lex).line);
3850 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3851 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3852 (yyval.interm.type).setAggregate(3, true);
3859 FRAG_VERT_ONLY("mat4", (yyvsp[(1) - (1)].lex).line);
3860 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3861 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3862 (yyval.interm.type).setAggregate(4, true);
3869 FRAG_VERT_ONLY("sampler2D", (yyvsp[(1) - (1)].lex).line);
3870 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3871 (yyval.interm.type).setBasic(EbtSampler2D, qual, (yyvsp[(1) - (1)].lex).line);
3878 FRAG_VERT_ONLY("samplerCube", (yyvsp[(1) - (1)].lex).line);
3879 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3880 (yyval.interm.type).setBasic(EbtSamplerCube, qual, (yyvsp[(1) - (1)].lex).line);
3887 FRAG_VERT_ONLY("struct", (yyvsp[(1) - (1)].interm.type).line);
3888 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3889 (yyval.interm.type).qualifier = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3897 // This is for user defined type names. The lexical phase looked up the
3900 TType& structure = static_cast<TVariable*>((yyvsp[(1) - (1)].lex).symbol)->getType();
3901 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3902 (yyval.interm.type).setBasic(EbtStruct, qual, (yyvsp[(1) - (1)].lex).line);
3903 (yyval.interm.type).userDef = &structure;
3910 if (context->reservedErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string))
3913 TType* structure = new TType((yyvsp[(4) - (5)].interm.typeList), *(yyvsp[(2) - (5)].lex).string);
3914 TVariable* userTypeDef = new TVariable((yyvsp[(2) - (5)].lex).string, *structure, true);
3915 if (! context->symbolTable.insert(*userTypeDef)) {
3916 context->error((yyvsp[(2) - (5)].lex).line, "redefinition", (yyvsp[(2) - (5)].lex).string->c_str(), "struct");
3919 (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (5)].lex).line);
3920 (yyval.interm.type).userDef = structure;
3927 TType* structure = new TType((yyvsp[(3) - (4)].interm.typeList), TString(""));
3928 (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (4)].lex).line);
3929 (yyval.interm.type).userDef = structure;
3936 (yyval.interm.typeList) = (yyvsp[(1) - (1)].interm.typeList);
3943 (yyval.interm.typeList) = (yyvsp[(1) - (2)].interm.typeList);
3944 for (unsigned int i = 0; i < (yyvsp[(2) - (2)].interm.typeList)->size(); ++i) {
3945 for (unsigned int j = 0; j < (yyval.interm.typeList)->size(); ++j) {
3946 if ((*(yyval.interm.typeList))[j].type->getFieldName() == (*(yyvsp[(2) - (2)].interm.typeList))[i].type->getFieldName()) {
3947 context->error((*(yyvsp[(2) - (2)].interm.typeList))[i].line, "duplicate field name in structure:", "struct", (*(yyvsp[(2) - (2)].interm.typeList))[i].type->getFieldName().c_str());
3951 (yyval.interm.typeList)->push_back((*(yyvsp[(2) - (2)].interm.typeList))[i]);
3959 (yyval.interm.typeList) = (yyvsp[(2) - (3)].interm.typeList);
3961 if (context->voidErrorCheck((yyvsp[(1) - (3)].interm.type).line, (*(yyvsp[(2) - (3)].interm.typeList))[0].type->getFieldName(), (yyvsp[(1) - (3)].interm.type))) {
3964 for (unsigned int i = 0; i < (yyval.interm.typeList)->size(); ++i) {
3966 // Careful not to replace already known aspects of type, like array-ness
3968 TType* type = (*(yyval.interm.typeList))[i].type;
3969 type->setBasicType((yyvsp[(1) - (3)].interm.type).type);
3970 type->setNominalSize((yyvsp[(1) - (3)].interm.type).size);
3971 type->setMatrix((yyvsp[(1) - (3)].interm.type).matrix);
3972 type->setPrecision((yyvsp[(1) - (3)].interm.type).precision);
3974 // don't allow arrays of arrays
3975 if (type->isArray()) {
3976 if (context->arrayTypeErrorCheck((yyvsp[(1) - (3)].interm.type).line, (yyvsp[(1) - (3)].interm.type)))
3979 if ((yyvsp[(1) - (3)].interm.type).array)
3980 type->setArraySize((yyvsp[(1) - (3)].interm.type).arraySize);
3981 if ((yyvsp[(1) - (3)].interm.type).userDef) {
3982 type->setStruct((yyvsp[(1) - (3)].interm.type).userDef->getStruct());
3983 type->setTypeName((yyvsp[(1) - (3)].interm.type).userDef->getTypeName());
3992 (yyval.interm.typeList) = NewPoolTTypeList();
3993 (yyval.interm.typeList)->push_back((yyvsp[(1) - (1)].interm.typeLine));
4000 (yyval.interm.typeList)->push_back((yyvsp[(3) - (3)].interm.typeLine));
4007 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
4010 (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
4011 (yyval.interm.typeLine).line = (yyvsp[(1) - (1)].lex).line;
4012 (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (1)].lex).string);
4019 if (context->reservedErrorCheck((yyvsp[(1) - (4)].lex).line, *(yyvsp[(1) - (4)].lex).string))
4022 (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
4023 (yyval.interm.typeLine).line = (yyvsp[(1) - (4)].lex).line;
4024 (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (4)].lex).string);
4027 if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
4029 (yyval.interm.typeLine).type->setArraySize(size);
4035 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
4040 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
4045 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermAggregate); ;}
4050 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
4055 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
4060 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
4065 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
4070 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
4075 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
4080 { (yyval.interm.intermAggregate) = 0; ;}
4085 { context->symbolTable.push(); ;}
4090 { context->symbolTable.pop(); ;}
4096 if ((yyvsp[(3) - (5)].interm.intermAggregate) != 0) {
4097 (yyvsp[(3) - (5)].interm.intermAggregate)->setOp(EOpSequence);
4098 (yyvsp[(3) - (5)].interm.intermAggregate)->setEndLine((yyvsp[(5) - (5)].lex).line);
4100 (yyval.interm.intermAggregate) = (yyvsp[(3) - (5)].interm.intermAggregate);
4106 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
4111 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
4117 (yyval.interm.intermNode) = 0;
4124 if ((yyvsp[(2) - (3)].interm.intermAggregate)) {
4125 (yyvsp[(2) - (3)].interm.intermAggregate)->setOp(EOpSequence);
4126 (yyvsp[(2) - (3)].interm.intermAggregate)->setEndLine((yyvsp[(3) - (3)].lex).line);
4128 (yyval.interm.intermNode) = (yyvsp[(2) - (3)].interm.intermAggregate);
4135 (yyval.interm.intermAggregate) = context->intermediate.makeAggregate((yyvsp[(1) - (1)].interm.intermNode), 0);
4142 (yyval.interm.intermAggregate) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermAggregate), (yyvsp[(2) - (2)].interm.intermNode), 0);
4148 { (yyval.interm.intermNode) = 0; ;}
4153 { (yyval.interm.intermNode) = static_cast<TIntermNode*>((yyvsp[(1) - (2)].interm.intermTypedNode)); ;}
4159 if (context->boolErrorCheck((yyvsp[(1) - (5)].lex).line, (yyvsp[(3) - (5)].interm.intermTypedNode)))
4161 (yyval.interm.intermNode) = context->intermediate.addSelection((yyvsp[(3) - (5)].interm.intermTypedNode), (yyvsp[(5) - (5)].interm.nodePair), (yyvsp[(1) - (5)].lex).line);
4168 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermNode);
4169 (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermNode);
4176 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (1)].interm.intermNode);
4177 (yyval.interm.nodePair).node2 = 0;
4184 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
4185 if (context->boolErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)->getLine(), (yyvsp[(1) - (1)].interm.intermTypedNode)))
4193 TIntermNode* intermNode;
4194 if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
4196 if (context->boolErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
4199 if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode))
4200 (yyval.interm.intermTypedNode) = (yyvsp[(4) - (4)].interm.intermTypedNode);
4203 (yyval.interm.intermTypedNode) = 0;
4210 { context->symbolTable.push(); ++context->loopNestingLevel; ;}
4216 context->symbolTable.pop();
4217 (yyval.interm.intermNode) = context->intermediate.addLoop(ELoopWhile, 0, (yyvsp[(4) - (6)].interm.intermTypedNode), 0, (yyvsp[(6) - (6)].interm.intermNode), (yyvsp[(1) - (6)].lex).line);
4218 --context->loopNestingLevel;
4224 { ++context->loopNestingLevel; ;}
4230 if (context->boolErrorCheck((yyvsp[(8) - (8)].lex).line, (yyvsp[(6) - (8)].interm.intermTypedNode)))
4233 (yyval.interm.intermNode) = context->intermediate.addLoop(ELoopDoWhile, 0, (yyvsp[(6) - (8)].interm.intermTypedNode), 0, (yyvsp[(3) - (8)].interm.intermNode), (yyvsp[(4) - (8)].lex).line);
4234 --context->loopNestingLevel;
4240 { context->symbolTable.push(); ++context->loopNestingLevel; ;}
4246 context->symbolTable.pop();
4247 (yyval.interm.intermNode) = context->intermediate.addLoop(ELoopFor, (yyvsp[(4) - (7)].interm.intermNode), reinterpret_cast<TIntermTyped*>((yyvsp[(5) - (7)].interm.nodePair).node1), reinterpret_cast<TIntermTyped*>((yyvsp[(5) - (7)].interm.nodePair).node2), (yyvsp[(7) - (7)].interm.intermNode), (yyvsp[(1) - (7)].lex).line);
4248 --context->loopNestingLevel;
4255 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
4262 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
4269 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
4276 (yyval.interm.intermTypedNode) = 0;
4283 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (2)].interm.intermTypedNode);
4284 (yyval.interm.nodePair).node2 = 0;
4291 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermTypedNode);
4292 (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermTypedNode);
4299 if (context->loopNestingLevel <= 0) {
4300 context->error((yyvsp[(1) - (2)].lex).line, "continue statement only allowed in loops", "", "");
4303 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpContinue, (yyvsp[(1) - (2)].lex).line);
4310 if (context->loopNestingLevel <= 0) {
4311 context->error((yyvsp[(1) - (2)].lex).line, "break statement only allowed in loops", "", "");
4314 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpBreak, (yyvsp[(1) - (2)].lex).line);
4321 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(1) - (2)].lex).line);
4322 if (context->currentFunctionType->getBasicType() != EbtVoid) {
4323 context->error((yyvsp[(1) - (2)].lex).line, "non-void function must return a value", "return", "");
4332 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(2) - (3)].interm.intermTypedNode), (yyvsp[(1) - (3)].lex).line);
4333 context->functionReturnsValue = true;
4334 if (context->currentFunctionType->getBasicType() == EbtVoid) {
4335 context->error((yyvsp[(1) - (3)].lex).line, "void function cannot return a value", "return", "");
4337 } else if (*(context->currentFunctionType) != (yyvsp[(2) - (3)].interm.intermTypedNode)->getType()) {
4338 context->error((yyvsp[(1) - (3)].lex).line, "function return is not matching type:", "return", "");
4347 FRAG_ONLY("discard", (yyvsp[(1) - (2)].lex).line);
4348 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpKill, (yyvsp[(1) - (2)].lex).line);
4355 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
4356 context->treeRoot = (yyval.interm.intermNode);
4363 (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermNode), (yyvsp[(2) - (2)].interm.intermNode), 0);
4364 context->treeRoot = (yyval.interm.intermNode);
4371 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
4378 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
4385 TFunction* function = (yyvsp[(1) - (1)].interm).function;
4386 TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find(function->getMangledName()));
4388 // Note: 'prevDec' could be 'function' if this is the first time we've seen function
4389 // as it would have just been put in the symbol table. Otherwise, we're looking up
4390 // an earlier occurance.
4392 if (prevDec->isDefined()) {
4394 // Then this function already has a body.
4396 context->error((yyvsp[(1) - (1)].interm).line, "function already has a body", function->getName().c_str(), "");
4399 prevDec->setDefined();
4402 // Raise error message if main function takes any parameters or return anything other than void
4404 if (function->getName() == "main") {
4405 if (function->getParamCount() > 0) {
4406 context->error((yyvsp[(1) - (1)].interm).line, "function cannot take any parameter(s)", function->getName().c_str(), "");
4409 if (function->getReturnType().getBasicType() != EbtVoid) {
4410 context->error((yyvsp[(1) - (1)].interm).line, "", function->getReturnType().getBasicString(), "main function cannot return a value");
4416 // New symbol table scope for body of function plus its arguments
4418 context->symbolTable.push();
4421 // Remember the return type for later checking for RETURN statements.
4423 context->currentFunctionType = &(prevDec->getReturnType());
4424 context->functionReturnsValue = false;
4427 // Insert parameters into the symbol table.
4428 // If the parameter has no name, it's not an error, just don't insert it
4429 // (could be used for unused args).
4431 // Also, accumulate the list of parameters into the HIL, so lower level code
4432 // knows where to find parameters.
4434 TIntermAggregate* paramNodes = new TIntermAggregate;
4435 for (int i = 0; i < function->getParamCount(); i++) {
4436 const TParameter& param = function->getParam(i);
4437 if (param.name != 0) {
4438 TVariable *variable = new TVariable(param.name, *param.type);
4440 // Insert the parameters with name in the symbol table.
4442 if (! context->symbolTable.insert(*variable)) {
4443 context->error((yyvsp[(1) - (1)].interm).line, "redefinition", variable->getName().c_str(), "");
4449 // Add the parameter to the HIL
4451 paramNodes = context->intermediate.growAggregate(
4453 context->intermediate.addSymbol(variable->getUniqueId(),
4454 variable->getName(),
4455 variable->getType(), (yyvsp[(1) - (1)].interm).line),
4456 (yyvsp[(1) - (1)].interm).line);
4458 paramNodes = context->intermediate.growAggregate(paramNodes, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (1)].interm).line), (yyvsp[(1) - (1)].interm).line);
4461 context->intermediate.setAggregateOperator(paramNodes, EOpParameters, (yyvsp[(1) - (1)].interm).line);
4462 (yyvsp[(1) - (1)].interm).intermAggregate = paramNodes;
4463 context->loopNestingLevel = 0;
4470 //?? Check that all paths return a value if return type != void ?
4471 // May be best done as post process phase on intermediate code
4472 if (context->currentFunctionType->getBasicType() != EbtVoid && ! context->functionReturnsValue) {
4473 context->error((yyvsp[(1) - (3)].interm).line, "function does not return a value:", "", (yyvsp[(1) - (3)].interm).function->getName().c_str());
4476 context->symbolTable.pop();
4477 (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermAggregate, (yyvsp[(3) - (3)].interm.intermNode), 0);
4478 context->intermediate.setAggregateOperator((yyval.interm.intermNode), EOpFunction, (yyvsp[(1) - (3)].interm).line);
4479 (yyval.interm.intermNode)->getAsAggregate()->setName((yyvsp[(1) - (3)].interm).function->getMangledName().c_str());
4480 (yyval.interm.intermNode)->getAsAggregate()->setType((yyvsp[(1) - (3)].interm).function->getReturnType());
4482 // store the pragma information for debug and optimize and other vendor specific
4483 // information. This information can be queried from the parse tree
4484 (yyval.interm.intermNode)->getAsAggregate()->setOptimize(context->contextPragma.optimize);
4485 (yyval.interm.intermNode)->getAsAggregate()->setDebug(context->contextPragma.debug);
4486 (yyval.interm.intermNode)->getAsAggregate()->addToPragmaTable(context->contextPragma.pragmaTable);
4488 if ((yyvsp[(3) - (3)].interm.intermNode) && (yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate())
4489 (yyval.interm.intermNode)->getAsAggregate()->setEndLine((yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate()->getEndLine());
4494 /* Line 1267 of yacc.c. */
4498 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
4502 YY_STACK_PRINT (yyss, yyssp);
4507 /* Now `shift' the result of the reduction. Determine what state
4508 that goes to, based on the state we popped back to and the rule
4509 number reduced by. */
4513 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
4514 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
4515 yystate = yytable[yystate];
4517 yystate = yydefgoto[yyn - YYNTOKENS];
4522 /*------------------------------------.
4523 | yyerrlab -- here on detecting error |
4524 `------------------------------------*/
4526 /* If not already recovering from an error, report this error. */
4530 #if ! YYERROR_VERBOSE
4531 yyerror (context, YY_("syntax error"));
4534 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
4535 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
4537 YYSIZE_T yyalloc = 2 * yysize;
4538 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
4539 yyalloc = YYSTACK_ALLOC_MAXIMUM;
4540 if (yymsg != yymsgbuf)
4541 YYSTACK_FREE (yymsg);
4542 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
4544 yymsg_alloc = yyalloc;
4548 yymsg_alloc = sizeof yymsgbuf;
4552 if (0 < yysize && yysize <= yymsg_alloc)
4554 (void) yysyntax_error (yymsg, yystate, yychar);
4555 yyerror (context, yymsg);
4559 yyerror (context, YY_("syntax error"));
4561 goto yyexhaustedlab;
4569 if (yyerrstatus == 3)
4571 /* If just tried and failed to reuse look-ahead token after an
4572 error, discard it. */
4574 if (yychar <= YYEOF)
4576 /* Return failure if at end of input. */
4577 if (yychar == YYEOF)
4582 yydestruct ("Error: discarding",
4583 yytoken, &yylval, context);
4588 /* Else will try to reuse look-ahead token after shifting the error
4593 /*---------------------------------------------------.
4594 | yyerrorlab -- error raised explicitly by YYERROR. |
4595 `---------------------------------------------------*/
4598 /* Pacify compilers like GCC when the user code never invokes
4599 YYERROR and the label yyerrorlab therefore never appears in user
4601 if (/*CONSTCOND*/ 0)
4604 /* Do not reclaim the symbols of the rule which action triggered
4608 YY_STACK_PRINT (yyss, yyssp);
4613 /*-------------------------------------------------------------.
4614 | yyerrlab1 -- common code for both syntax error and YYERROR. |
4615 `-------------------------------------------------------------*/
4617 yyerrstatus = 3; /* Each real token shifted decrements this. */
4621 yyn = yypact[yystate];
4622 if (yyn != YYPACT_NINF)
4625 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
4633 /* Pop the current state because it cannot handle the error token. */
4638 yydestruct ("Error: popping",
4639 yystos[yystate], yyvsp, context);
4642 YY_STACK_PRINT (yyss, yyssp);
4651 /* Shift the error token. */
4652 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
4658 /*-------------------------------------.
4659 | yyacceptlab -- YYACCEPT comes here. |
4660 `-------------------------------------*/
4665 /*-----------------------------------.
4666 | yyabortlab -- YYABORT comes here. |
4667 `-----------------------------------*/
4673 /*-------------------------------------------------.
4674 | yyexhaustedlab -- memory exhaustion comes here. |
4675 `-------------------------------------------------*/
4677 yyerror (context, YY_("memory exhausted"));
4683 if (yychar != YYEOF && yychar != YYEMPTY)
4684 yydestruct ("Cleanup: discarding lookahead",
4685 yytoken, &yylval, context);
4686 /* Do not reclaim the symbols of the rule which action triggered
4687 this YYABORT or YYACCEPT. */
4689 YY_STACK_PRINT (yyss, yyssp);
4690 while (yyssp != yyss)
4692 yydestruct ("Cleanup: popping",
4693 yystos[*yyssp], yyvsp, context);
4698 YYSTACK_FREE (yyss);
4701 if (yymsg != yymsgbuf)
4702 YYSTACK_FREE (yymsg);
4704 /* Make sure YYID is used. */
4705 return YYID (yyresult);
4712 int glslang_parse(TParseContext* context) {
4713 return yyparse(context);