1 /* A Bison parser, made by GNU Bison 2.7. */ 2 3 /* Bison implementation for Yacc-like parsers in C 4 5 Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc. 6 7 This program is free software: you can redistribute it and/or modify 8 it under the terms of the GNU General Public License as published by 9 the Free Software Foundation, either version 3 of the License, or 10 (at your option) any later version. 11 12 This program is distributed in the hope that it will be useful, 13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 GNU General Public License for more details. 16 17 You should have received a copy of the GNU General Public License 18 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 19 20 /* As a special exception, you may create a larger work that contains 21 part or all of the Bison parser skeleton and distribute that work 22 under terms of your choice, so long as that work isn't itself a 23 parser generator using the skeleton or a modified version thereof 24 as a parser skeleton. Alternatively, if you modify or redistribute 25 the parser skeleton itself, you may (at your option) remove this 26 special exception, which will cause the skeleton and the resulting 27 Bison output files to be licensed under the GNU General Public 28 License without this special exception. 29 30 This special exception was added by the Free Software Foundation in 31 version 2.2 of Bison. */ 32 33 /* C LALR(1) parser skeleton written by Richard Stallman, by 34 simplifying the original so-called "semantic" parser. */ 35 36 /* All symbols defined below should begin with yy or YY, to avoid 37 infringing on user name space. This should be done even for local 38 variables, as they might otherwise be expanded by user macros. 39 There are some unavoidable exceptions within include files to 40 define necessary library symbols; they are noted "INFRINGES ON 41 USER NAME SPACE" below. */ 42 43 /* Identify Bison output. */ 44 #define YYBISON 1 45 46 /* Bison version. */ 47 #define YYBISON_VERSION "2.7" 48 49 /* Skeleton name. */ 50 #define YYSKELETON_NAME "yacc.c" 51 52 /* Pure parsers. */ 53 #define YYPURE 1 54 55 /* Push parsers. */ 56 #define YYPUSH 0 57 58 /* Pull parsers. */ 59 #define YYPULL 1 60 61 62 63 64 /* Copy the first part of user declarations. */ 65 66 67 // 68 // Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved. 69 // Use of this source code is governed by a BSD-style license that can be 70 // found in the LICENSE file. 71 // 72 73 // This file is auto-generated by generate_parser.sh. DO NOT EDIT! 74 75 // Ignore errors in auto-generated code. 76 #if defined(__GNUC__) 77 #pragma GCC diagnostic ignored "-Wunused-function" 78 #pragma GCC diagnostic ignored "-Wunused-variable" 79 #pragma GCC diagnostic ignored "-Wswitch-enum" 80 #elif defined(_MSC_VER) 81 #pragma warning(disable: 4065) 82 #pragma warning(disable: 4189) 83 #pragma warning(disable: 4505) 84 #pragma warning(disable: 4701) 85 #endif 86 87 #include "compiler/SymbolTable.h" 88 #include "compiler/ParseContext.h" 89 #include "GLSLANG/ShaderLang.h" 90 91 #define YYENABLE_NLS 0 92 93 #define YYLEX_PARAM context->scanner 94 95 96 97 # ifndef YY_NULL 98 # if defined __cplusplus && 201103L <= __cplusplus 99 # define YY_NULL nullptr 100 # else 101 # define YY_NULL 0 102 # endif 103 # endif 104 105 /* Enabling verbose error messages. */ 106 #ifdef YYERROR_VERBOSE 107 # undef YYERROR_VERBOSE 108 # define YYERROR_VERBOSE 1 109 #else 110 # define YYERROR_VERBOSE 0 111 #endif 112 113 /* In a future release of Bison, this section will be replaced 114 by #include "glslang_tab.h". */ 115 #ifndef YY_YY_GLSLANG_TAB_H_INCLUDED 116 # define YY_YY_GLSLANG_TAB_H_INCLUDED 117 /* Enabling traces. */ 118 #ifndef YYDEBUG 119 # define YYDEBUG 0 120 #endif 121 #if YYDEBUG 122 extern int yydebug; 123 #endif 124 /* "%code requires" blocks. */ 125 126 127 #define YYLTYPE TSourceLoc 128 #define YYLTYPE_IS_DECLARED 1 129 #define SH_MAX_TOKEN_LENGTH 256 // WebGL spec. 130 131 132 133 134 /* Tokens. */ 135 #ifndef YYTOKENTYPE 136 # define YYTOKENTYPE 137 /* Put the tokens into the symbol table, so that GDB and other debuggers 138 know about them. */ 139 enum yytokentype { 140 INVARIANT = 258, 141 HIGH_PRECISION = 259, 142 MEDIUM_PRECISION = 260, 143 LOW_PRECISION = 261, 144 PRECISION = 262, 145 ATTRIBUTE = 263, 146 CONST_QUAL = 264, 147 BOOL_TYPE = 265, 148 FLOAT_TYPE = 266, 149 INT_TYPE = 267, 150 BREAK = 268, 151 CONTINUE = 269, 152 DO = 270, 153 ELSE = 271, 154 FOR = 272, 155 IF = 273, 156 DISCARD = 274, 157 RETURN = 275, 158 BVEC2 = 276, 159 BVEC3 = 277, 160 BVEC4 = 278, 161 IVEC2 = 279, 162 IVEC3 = 280, 163 IVEC4 = 281, 164 VEC2 = 282, 165 VEC3 = 283, 166 VEC4 = 284, 167 MATRIX2 = 285, 168 MATRIX3 = 286, 169 MATRIX4 = 287, 170 IN_QUAL = 288, 171 OUT_QUAL = 289, 172 INOUT_QUAL = 290, 173 UNIFORM = 291, 174 VARYING = 292, 175 STRUCT = 293, 176 VOID_TYPE = 294, 177 WHILE = 295, 178 SAMPLER2D = 296, 179 SAMPLERCUBE = 297, 180 SAMPLER_EXTERNAL_OES = 298, 181 SAMPLER2DRECT = 299, 182 IDENTIFIER = 300, 183 TYPE_NAME = 301, 184 FLOATCONSTANT = 302, 185 INTCONSTANT = 303, 186 BOOLCONSTANT = 304, 187 LEFT_OP = 305, 188 RIGHT_OP = 306, 189 INC_OP = 307, 190 DEC_OP = 308, 191 LE_OP = 309, 192 GE_OP = 310, 193 EQ_OP = 311, 194 NE_OP = 312, 195 AND_OP = 313, 196 OR_OP = 314, 197 XOR_OP = 315, 198 MUL_ASSIGN = 316, 199 DIV_ASSIGN = 317, 200 ADD_ASSIGN = 318, 201 MOD_ASSIGN = 319, 202 LEFT_ASSIGN = 320, 203 RIGHT_ASSIGN = 321, 204 AND_ASSIGN = 322, 205 XOR_ASSIGN = 323, 206 OR_ASSIGN = 324, 207 SUB_ASSIGN = 325, 208 LEFT_PAREN = 326, 209 RIGHT_PAREN = 327, 210 LEFT_BRACKET = 328, 211 RIGHT_BRACKET = 329, 212 LEFT_BRACE = 330, 213 RIGHT_BRACE = 331, 214 DOT = 332, 215 COMMA = 333, 216 COLON = 334, 217 EQUAL = 335, 218 SEMICOLON = 336, 219 BANG = 337, 220 DASH = 338, 221 TILDE = 339, 222 PLUS = 340, 223 STAR = 341, 224 SLASH = 342, 225 PERCENT = 343, 226 LEFT_ANGLE = 344, 227 RIGHT_ANGLE = 345, 228 VERTICAL_BAR = 346, 229 CARET = 347, 230 AMPERSAND = 348, 231 QUESTION = 349 232 }; 233 #endif 234 235 236 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED 237 typedef union YYSTYPE 238 { 239 240 241 struct { 242 union { 243 TString *string; 244 float f; 245 int i; 246 bool b; 247 }; 248 TSymbol* symbol; 249 } lex; 250 struct { 251 TOperator op; 252 union { 253 TIntermNode* intermNode; 254 TIntermNodePair nodePair; 255 TIntermTyped* intermTypedNode; 256 TIntermAggregate* intermAggregate; 257 }; 258 union { 259 TPublicType type; 260 TPrecision precision; 261 TQualifier qualifier; 262 TFunction* function; 263 TParameter param; 264 TField* field; 265 TFieldList* fieldList; 266 }; 267 } interm; 268 269 270 271 } YYSTYPE; 272 # define YYSTYPE_IS_TRIVIAL 1 273 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ 274 # define YYSTYPE_IS_DECLARED 1 275 #endif 276 277 #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED 278 typedef struct YYLTYPE 279 { 280 int first_line; 281 int first_column; 282 int last_line; 283 int last_column; 284 } YYLTYPE; 285 # define yyltype YYLTYPE /* obsolescent; will be withdrawn */ 286 # define YYLTYPE_IS_DECLARED 1 287 # define YYLTYPE_IS_TRIVIAL 1 288 #endif 289 290 291 #ifdef YYPARSE_PARAM 292 #if defined __STDC__ || defined __cplusplus 293 int yyparse (void *YYPARSE_PARAM); 294 #else 295 int yyparse (); 296 #endif 297 #else /* ! YYPARSE_PARAM */ 298 #if defined __STDC__ || defined __cplusplus 299 int yyparse (TParseContext* context); 300 #else 301 int yyparse (); 302 #endif 303 #endif /* ! YYPARSE_PARAM */ 304 305 #endif /* !YY_YY_GLSLANG_TAB_H_INCLUDED */ 306 307 /* Copy the second part of user declarations. */ 308 309 310 extern int yylex(YYSTYPE* yylval, YYLTYPE* yylloc, void* yyscanner); 311 extern void yyerror(YYLTYPE* yylloc, TParseContext* context, const char* reason); 312 313 #define YYLLOC_DEFAULT(Current, Rhs, N) \ 314 do { \ 315 if (YYID(N)) { \ 316 (Current).first_file = YYRHSLOC(Rhs, 1).first_file; \ 317 (Current).first_line = YYRHSLOC(Rhs, 1).first_line; \ 318 (Current).last_file = YYRHSLOC(Rhs, N).last_file; \ 319 (Current).last_line = YYRHSLOC(Rhs, N).last_line; \ 320 } \ 321 else { \ 322 (Current).first_file = YYRHSLOC(Rhs, 0).last_file; \ 323 (Current).first_line = YYRHSLOC(Rhs, 0).last_line; \ 324 (Current).last_file = YYRHSLOC(Rhs, 0).last_file; \ 325 (Current).last_line = YYRHSLOC(Rhs, 0).last_line; \ 326 } \ 327 } while (0) 328 329 #define VERTEX_ONLY(S, L) { \ 330 if (context->shaderType != SH_VERTEX_SHADER) { \ 331 context->error(L, " supported in vertex shaders only ", S); \ 332 context->recover(); \ 333 } \ 334 } 335 336 #define FRAG_ONLY(S, L) { \ 337 if (context->shaderType != SH_FRAGMENT_SHADER) { \ 338 context->error(L, " supported in fragment shaders only ", S); \ 339 context->recover(); \ 340 } \ 341 } 342 343 344 345 #ifdef short 346 # undef short 347 #endif 348 349 #ifdef YYTYPE_UINT8 350 typedef YYTYPE_UINT8 yytype_uint8; 351 #else 352 typedef unsigned char yytype_uint8; 353 #endif 354 355 #ifdef YYTYPE_INT8 356 typedef YYTYPE_INT8 yytype_int8; 357 #elif (defined __STDC__ || defined __C99__FUNC__ \ 358 || defined __cplusplus || defined _MSC_VER) 359 typedef signed char yytype_int8; 360 #else 361 typedef short int yytype_int8; 362 #endif 363 364 #ifdef YYTYPE_UINT16 365 typedef YYTYPE_UINT16 yytype_uint16; 366 #else 367 typedef unsigned short int yytype_uint16; 368 #endif 369 370 #ifdef YYTYPE_INT16 371 typedef YYTYPE_INT16 yytype_int16; 372 #else 373 typedef short int yytype_int16; 374 #endif 375 376 #ifndef YYSIZE_T 377 # ifdef __SIZE_TYPE__ 378 # define YYSIZE_T __SIZE_TYPE__ 379 # elif defined size_t 380 # define YYSIZE_T size_t 381 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ 382 || defined __cplusplus || defined _MSC_VER) 383 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ 384 # define YYSIZE_T size_t 385 # else 386 # define YYSIZE_T unsigned int 387 # endif 388 #endif 389 390 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) 391 392 #ifndef YY_ 393 # if defined YYENABLE_NLS && YYENABLE_NLS 394 # if ENABLE_NLS 395 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ 396 # define YY_(Msgid) dgettext ("bison-runtime", Msgid) 397 # endif 398 # endif 399 # ifndef YY_ 400 # define YY_(Msgid) Msgid 401 # endif 402 #endif 403 404 /* Suppress unused-variable warnings by "using" E. */ 405 #if ! defined lint || defined __GNUC__ 406 # define YYUSE(E) ((void) (E)) 407 #else 408 # define YYUSE(E) /* empty */ 409 #endif 410 411 /* Identity function, used to suppress warnings about constant conditions. */ 412 #ifndef lint 413 # define YYID(N) (N) 414 #else 415 #if (defined __STDC__ || defined __C99__FUNC__ \ 416 || defined __cplusplus || defined _MSC_VER) 417 static int 418 YYID (int yyi) 419 #else 420 static int 421 YYID (yyi) 422 int yyi; 423 #endif 424 { 425 return yyi; 426 } 427 #endif 428 429 #if ! defined yyoverflow || YYERROR_VERBOSE 430 431 /* The parser invokes alloca or malloc; define the necessary symbols. */ 432 433 # ifdef YYSTACK_USE_ALLOCA 434 # if YYSTACK_USE_ALLOCA 435 # ifdef __GNUC__ 436 # define YYSTACK_ALLOC __builtin_alloca 437 # elif defined __BUILTIN_VA_ARG_INCR 438 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */ 439 # elif defined _AIX 440 # define YYSTACK_ALLOC __alloca 441 # elif defined _MSC_VER 442 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */ 443 # define alloca _alloca 444 # else 445 # define YYSTACK_ALLOC alloca 446 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ 447 || defined __cplusplus || defined _MSC_VER) 448 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 449 /* Use EXIT_SUCCESS as a witness for stdlib.h. */ 450 # ifndef EXIT_SUCCESS 451 # define EXIT_SUCCESS 0 452 # endif 453 # endif 454 # endif 455 # endif 456 # endif 457 458 # ifdef YYSTACK_ALLOC 459 /* Pacify GCC's `empty if-body' warning. */ 460 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) 461 # ifndef YYSTACK_ALLOC_MAXIMUM 462 /* The OS might guarantee only one guard page at the bottom of the stack, 463 and a page size can be as small as 4096 bytes. So we cannot safely 464 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number 465 to allow for a few compiler-allocated temporary stack slots. */ 466 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ 467 # endif 468 # else 469 # define YYSTACK_ALLOC YYMALLOC 470 # define YYSTACK_FREE YYFREE 471 # ifndef YYSTACK_ALLOC_MAXIMUM 472 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM 473 # endif 474 # if (defined __cplusplus && ! defined EXIT_SUCCESS \ 475 && ! ((defined YYMALLOC || defined malloc) \ 476 && (defined YYFREE || defined free))) 477 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 478 # ifndef EXIT_SUCCESS 479 # define EXIT_SUCCESS 0 480 # endif 481 # endif 482 # ifndef YYMALLOC 483 # define YYMALLOC malloc 484 # if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ 485 || defined __cplusplus || defined _MSC_VER) 486 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ 487 # endif 488 # endif 489 # ifndef YYFREE 490 # define YYFREE free 491 # if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ 492 || defined __cplusplus || defined _MSC_VER) 493 void free (void *); /* INFRINGES ON USER NAME SPACE */ 494 # endif 495 # endif 496 # endif 497 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ 498 499 500 #if (! defined yyoverflow \ 501 && (! defined __cplusplus \ 502 || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \ 503 && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) 504 505 /* A type that is properly aligned for any stack member. */ 506 union yyalloc 507 { 508 yytype_int16 yyss_alloc; 509 YYSTYPE yyvs_alloc; 510 YYLTYPE yyls_alloc; 511 }; 512 513 /* The size of the maximum gap between one aligned stack and the next. */ 514 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) 515 516 /* The size of an array large to enough to hold all stacks, each with 517 N elements. */ 518 # define YYSTACK_BYTES(N) \ 519 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ 520 + 2 * YYSTACK_GAP_MAXIMUM) 521 522 # define YYCOPY_NEEDED 1 523 524 /* Relocate STACK from its old location to the new one. The 525 local variables YYSIZE and YYSTACKSIZE give the old and new number of 526 elements in the stack, and YYPTR gives the new location of the 527 stack. Advance YYPTR to a properly aligned location for the next 528 stack. */ 529 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ 530 do \ 531 { \ 532 YYSIZE_T yynewbytes; \ 533 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ 534 Stack = &yyptr->Stack_alloc; \ 535 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ 536 yyptr += yynewbytes / sizeof (*yyptr); \ 537 } \ 538 while (YYID (0)) 539 540 #endif 541 542 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED 543 /* Copy COUNT objects from SRC to DST. The source and destination do 544 not overlap. */ 545 # ifndef YYCOPY 546 # if defined __GNUC__ && 1 < __GNUC__ 547 # define YYCOPY(Dst, Src, Count) \ 548 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) 549 # else 550 # define YYCOPY(Dst, Src, Count) \ 551 do \ 552 { \ 553 YYSIZE_T yyi; \ 554 for (yyi = 0; yyi < (Count); yyi++) \ 555 (Dst)[yyi] = (Src)[yyi]; \ 556 } \ 557 while (YYID (0)) 558 # endif 559 # endif 560 #endif /* !YYCOPY_NEEDED */ 561 562 /* YYFINAL -- State number of the termination state. */ 563 #define YYFINAL 74 564 /* YYLAST -- Last index in YYTABLE. */ 565 #define YYLAST 1490 566 567 /* YYNTOKENS -- Number of terminals. */ 568 #define YYNTOKENS 95 569 /* YYNNTS -- Number of nonterminals. */ 570 #define YYNNTS 84 571 /* YYNRULES -- Number of rules. */ 572 #define YYNRULES 202 573 /* YYNRULES -- Number of states. */ 574 #define YYNSTATES 307 575 576 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ 577 #define YYUNDEFTOK 2 578 #define YYMAXUTOK 349 579 580 #define YYTRANSLATE(YYX) \ 581 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) 582 583 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ 584 static const yytype_uint8 yytranslate[] = 585 { 586 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 587 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 588 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 589 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 590 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 591 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 592 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 593 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 594 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 595 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 596 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 597 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 598 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 599 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 600 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 601 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 602 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 603 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 604 2, 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, 1, 2, 3, 4, 612 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 613 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 614 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 615 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 616 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 617 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 618 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 619 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 620 85, 86, 87, 88, 89, 90, 91, 92, 93, 94 621 }; 622 623 #if YYDEBUG 624 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in 625 YYRHS. */ 626 static const yytype_uint16 yyprhs[] = 627 { 628 0, 0, 3, 5, 7, 9, 11, 13, 15, 17, 629 21, 23, 28, 30, 34, 37, 40, 42, 44, 46, 630 50, 53, 56, 59, 61, 64, 68, 71, 73, 75, 631 77, 80, 83, 86, 88, 90, 92, 94, 98, 102, 632 104, 108, 112, 114, 116, 120, 124, 128, 132, 134, 633 138, 142, 144, 146, 148, 150, 154, 156, 160, 162, 634 166, 168, 174, 176, 180, 182, 184, 186, 188, 190, 635 192, 196, 198, 201, 204, 209, 212, 214, 216, 219, 636 223, 227, 230, 236, 240, 243, 247, 250, 251, 253, 637 255, 257, 259, 261, 265, 271, 278, 284, 286, 289, 638 294, 300, 305, 308, 310, 313, 315, 317, 319, 322, 639 324, 326, 329, 331, 333, 335, 337, 342, 344, 346, 640 348, 350, 352, 354, 356, 358, 360, 362, 364, 366, 641 368, 370, 372, 374, 376, 378, 380, 382, 384, 386, 642 387, 394, 395, 401, 403, 406, 410, 412, 416, 418, 643 423, 425, 427, 429, 431, 433, 435, 437, 439, 441, 644 444, 445, 446, 452, 454, 456, 457, 460, 461, 464, 645 467, 471, 473, 476, 478, 481, 487, 491, 493, 495, 646 500, 501, 508, 509, 518, 519, 527, 529, 531, 533, 647 534, 537, 541, 544, 547, 550, 554, 557, 559, 562, 648 564, 566, 567 649 }; 650 651 /* YYRHS -- A `-1'-separated list of the rules' RHS. */ 652 static const yytype_int16 yyrhs[] = 653 { 654 175, 0, -1, 45, -1, 46, -1, 45, -1, 97, 655 -1, 48, -1, 47, -1, 49, -1, 71, 124, 72, 656 -1, 98, -1, 99, 73, 100, 74, -1, 101, -1, 657 99, 77, 96, -1, 99, 52, -1, 99, 53, -1, 658 124, -1, 102, -1, 103, -1, 99, 77, 103, -1, 659 105, 72, -1, 104, 72, -1, 106, 39, -1, 106, 660 -1, 106, 122, -1, 105, 78, 122, -1, 107, 71, 661 -1, 142, -1, 45, -1, 99, -1, 52, 108, -1, 662 53, 108, -1, 109, 108, -1, 85, -1, 83, -1, 663 82, -1, 108, -1, 110, 86, 108, -1, 110, 87, 664 108, -1, 110, -1, 111, 85, 110, -1, 111, 83, 665 110, -1, 111, -1, 112, -1, 113, 89, 112, -1, 666 113, 90, 112, -1, 113, 54, 112, -1, 113, 55, 667 112, -1, 113, -1, 114, 56, 113, -1, 114, 57, 668 113, -1, 114, -1, 115, -1, 116, -1, 117, -1, 669 118, 58, 117, -1, 118, -1, 119, 60, 118, -1, 670 119, -1, 120, 59, 119, -1, 120, -1, 120, 94, 671 124, 79, 122, -1, 121, -1, 108, 123, 122, -1, 672 80, -1, 61, -1, 62, -1, 63, -1, 70, -1, 673 122, -1, 124, 78, 122, -1, 121, -1, 127, 81, 674 -1, 135, 81, -1, 7, 140, 141, 81, -1, 128, 675 72, -1, 130, -1, 129, -1, 130, 132, -1, 129, 676 78, 132, -1, 137, 45, 71, -1, 139, 96, -1, 677 139, 96, 73, 125, 74, -1, 138, 133, 131, -1, 678 133, 131, -1, 138, 133, 134, -1, 133, 134, -1, 679 -1, 33, -1, 34, -1, 35, -1, 139, -1, 136, 680 -1, 135, 78, 96, -1, 135, 78, 96, 73, 74, 681 -1, 135, 78, 96, 73, 125, 74, -1, 135, 78, 682 96, 80, 150, -1, 137, -1, 137, 96, -1, 137, 683 96, 73, 74, -1, 137, 96, 73, 125, 74, -1, 684 137, 96, 80, 150, -1, 3, 45, -1, 139, -1, 685 138, 139, -1, 9, -1, 8, -1, 37, -1, 3, 686 37, -1, 36, -1, 141, -1, 140, 141, -1, 4, 687 -1, 5, -1, 6, -1, 142, -1, 142, 73, 125, 688 74, -1, 39, -1, 11, -1, 12, -1, 10, -1, 689 27, -1, 28, -1, 29, -1, 21, -1, 22, -1, 690 23, -1, 24, -1, 25, -1, 26, -1, 30, -1, 691 31, -1, 32, -1, 41, -1, 42, -1, 43, -1, 692 44, -1, 143, -1, 46, -1, -1, 38, 96, 75, 693 144, 146, 76, -1, -1, 38, 75, 145, 146, 76, 694 -1, 147, -1, 146, 147, -1, 139, 148, 81, -1, 695 149, -1, 148, 78, 149, -1, 96, -1, 96, 73, 696 125, 74, -1, 122, -1, 126, -1, 154, -1, 153, 697 -1, 151, -1, 163, -1, 164, -1, 167, -1, 174, 698 -1, 75, 76, -1, -1, -1, 75, 155, 162, 156, 699 76, -1, 161, -1, 153, -1, -1, 159, 161, -1, 700 -1, 160, 153, -1, 75, 76, -1, 75, 162, 76, 701 -1, 152, -1, 162, 152, -1, 81, -1, 124, 81, 702 -1, 18, 71, 124, 72, 165, -1, 158, 16, 158, 703 -1, 158, -1, 124, -1, 137, 96, 80, 150, -1, 704 -1, 40, 71, 168, 166, 72, 157, -1, -1, 15, 705 169, 158, 40, 71, 124, 72, 81, -1, -1, 17, 706 71, 170, 171, 173, 72, 157, -1, 163, -1, 151, 707 -1, 166, -1, -1, 172, 81, -1, 172, 81, 124, 708 -1, 14, 81, -1, 13, 81, -1, 20, 81, -1, 709 20, 124, 81, -1, 19, 81, -1, 176, -1, 175, 710 176, -1, 177, -1, 126, -1, -1, 127, 178, 161, 711 -1 712 }; 713 714 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ 715 static const yytype_uint16 yyrline[] = 716 { 717 0, 180, 180, 181, 184, 227, 230, 243, 248, 253, 718 259, 262, 265, 268, 363, 373, 386, 394, 494, 497, 719 505, 508, 514, 518, 525, 531, 540, 548, 603, 613, 720 616, 626, 636, 657, 658, 659, 664, 665, 673, 684, 721 685, 693, 704, 708, 709, 719, 729, 739, 752, 753, 722 763, 776, 780, 784, 788, 789, 802, 803, 816, 817, 723 830, 831, 848, 849, 862, 863, 864, 865, 866, 870, 724 873, 884, 892, 919, 924, 938, 993, 996, 1003, 1011, 725 1032, 1053, 1063, 1091, 1096, 1106, 1111, 1121, 1124, 1127, 726 1130, 1136, 1143, 1146, 1168, 1186, 1210, 1233, 1237, 1255, 727 1263, 1295, 1315, 1336, 1345, 1368, 1371, 1377, 1385, 1393, 728 1401, 1411, 1418, 1421, 1424, 1430, 1433, 1448, 1452, 1456, 729 1460, 1464, 1469, 1474, 1479, 1484, 1489, 1494, 1499, 1504, 730 1509, 1514, 1519, 1524, 1528, 1532, 1540, 1548, 1552, 1565, 731 1565, 1579, 1579, 1588, 1591, 1607, 1640, 1644, 1650, 1657, 732 1672, 1676, 1680, 1681, 1687, 1688, 1689, 1690, 1691, 1695, 733 1696, 1696, 1696, 1706, 1707, 1711, 1711, 1712, 1712, 1717, 734 1720, 1730, 1733, 1739, 1740, 1744, 1752, 1756, 1766, 1771, 735 1788, 1788, 1793, 1793, 1800, 1800, 1808, 1811, 1817, 1820, 736 1826, 1830, 1837, 1844, 1851, 1858, 1869, 1878, 1882, 1889, 737 1892, 1898, 1898 738 }; 739 #endif 740 741 #if YYDEBUG || YYERROR_VERBOSE || 0 742 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. 743 First, the terminals, then, starting at YYNTOKENS, nonterminals. */ 744 static const char *const yytname[] = 745 { 746 "$end", "error", "$undefined", "INVARIANT", "HIGH_PRECISION", 747 "MEDIUM_PRECISION", "LOW_PRECISION", "PRECISION", "ATTRIBUTE", 748 "CONST_QUAL", "BOOL_TYPE", "FLOAT_TYPE", "INT_TYPE", "BREAK", "CONTINUE", 749 "DO", "ELSE", "FOR", "IF", "DISCARD", "RETURN", "BVEC2", "BVEC3", 750 "BVEC4", "IVEC2", "IVEC3", "IVEC4", "VEC2", "VEC3", "VEC4", "MATRIX2", 751 "MATRIX3", "MATRIX4", "IN_QUAL", "OUT_QUAL", "INOUT_QUAL", "UNIFORM", 752 "VARYING", "STRUCT", "VOID_TYPE", "WHILE", "SAMPLER2D", "SAMPLERCUBE", 753 "SAMPLER_EXTERNAL_OES", "SAMPLER2DRECT", "IDENTIFIER", "TYPE_NAME", 754 "FLOATCONSTANT", "INTCONSTANT", "BOOLCONSTANT", "LEFT_OP", "RIGHT_OP", 755 "INC_OP", "DEC_OP", "LE_OP", "GE_OP", "EQ_OP", "NE_OP", "AND_OP", 756 "OR_OP", "XOR_OP", "MUL_ASSIGN", "DIV_ASSIGN", "ADD_ASSIGN", 757 "MOD_ASSIGN", "LEFT_ASSIGN", "RIGHT_ASSIGN", "AND_ASSIGN", "XOR_ASSIGN", 758 "OR_ASSIGN", "SUB_ASSIGN", "LEFT_PAREN", "RIGHT_PAREN", "LEFT_BRACKET", 759 "RIGHT_BRACKET", "LEFT_BRACE", "RIGHT_BRACE", "DOT", "COMMA", "COLON", 760 "EQUAL", "SEMICOLON", "BANG", "DASH", "TILDE", "PLUS", "STAR", "SLASH", 761 "PERCENT", "LEFT_ANGLE", "RIGHT_ANGLE", "VERTICAL_BAR", "CARET", 762 "AMPERSAND", "QUESTION", "$accept", "identifier", "variable_identifier", 763 "primary_expression", "postfix_expression", "integer_expression", 764 "function_call", "function_call_or_method", "function_call_generic", 765 "function_call_header_no_parameters", 766 "function_call_header_with_parameters", "function_call_header", 767 "function_identifier", "unary_expression", "unary_operator", 768 "multiplicative_expression", "additive_expression", "shift_expression", 769 "relational_expression", "equality_expression", "and_expression", 770 "exclusive_or_expression", "inclusive_or_expression", 771 "logical_and_expression", "logical_xor_expression", 772 "logical_or_expression", "conditional_expression", 773 "assignment_expression", "assignment_operator", "expression", 774 "constant_expression", "declaration", "function_prototype", 775 "function_declarator", "function_header_with_parameters", 776 "function_header", "parameter_declarator", "parameter_declaration", 777 "parameter_qualifier", "parameter_type_specifier", 778 "init_declarator_list", "single_declaration", "fully_specified_type", 779 "type_qualifier", "type_specifier", "precision_qualifier", 780 "type_specifier_no_prec", "type_specifier_nonarray", "struct_specifier", 781 "$@1", "$@2", "struct_declaration_list", "struct_declaration", 782 "struct_declarator_list", "struct_declarator", "initializer", 783 "declaration_statement", "statement", "simple_statement", 784 "compound_statement", "$@3", "$@4", "statement_no_new_scope", 785 "statement_with_scope", "$@5", "$@6", "compound_statement_no_new_scope", 786 "statement_list", "expression_statement", "selection_statement", 787 "selection_rest_statement", "condition", "iteration_statement", "$@7", 788 "$@8", "$@9", "for_init_statement", "conditionopt", "for_rest_statement", 789 "jump_statement", "translation_unit", "external_declaration", 790 "function_definition", "$@10", YY_NULL 791 }; 792 #endif 793 794 # ifdef YYPRINT 795 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to 796 token YYLEX-NUM. */ 797 static const yytype_uint16 yytoknum[] = 798 { 799 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 800 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 801 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 802 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 803 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 804 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 805 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 806 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 807 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 808 345, 346, 347, 348, 349 809 }; 810 # endif 811 812 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ 813 static const yytype_uint8 yyr1[] = 814 { 815 0, 95, 96, 96, 97, 98, 98, 98, 98, 98, 816 99, 99, 99, 99, 99, 99, 100, 101, 102, 102, 817 103, 103, 104, 104, 105, 105, 106, 107, 107, 108, 818 108, 108, 108, 109, 109, 109, 110, 110, 110, 111, 819 111, 111, 112, 113, 113, 113, 113, 113, 114, 114, 820 114, 115, 116, 117, 118, 118, 119, 119, 120, 120, 821 121, 121, 122, 122, 123, 123, 123, 123, 123, 124, 822 124, 125, 126, 126, 126, 127, 128, 128, 129, 129, 823 130, 131, 131, 132, 132, 132, 132, 133, 133, 133, 824 133, 134, 135, 135, 135, 135, 135, 136, 136, 136, 825 136, 136, 136, 137, 137, 138, 138, 138, 138, 138, 826 139, 139, 140, 140, 140, 141, 141, 142, 142, 142, 827 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 828 142, 142, 142, 142, 142, 142, 142, 142, 142, 144, 829 143, 145, 143, 146, 146, 147, 148, 148, 149, 149, 830 150, 151, 152, 152, 153, 153, 153, 153, 153, 154, 831 155, 156, 154, 157, 157, 159, 158, 160, 158, 161, 832 161, 162, 162, 163, 163, 164, 165, 165, 166, 166, 833 168, 167, 169, 167, 170, 167, 171, 171, 172, 172, 834 173, 173, 174, 174, 174, 174, 174, 175, 175, 176, 835 176, 178, 177 836 }; 837 838 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ 839 static const yytype_uint8 yyr2[] = 840 { 841 0, 2, 1, 1, 1, 1, 1, 1, 1, 3, 842 1, 4, 1, 3, 2, 2, 1, 1, 1, 3, 843 2, 2, 2, 1, 2, 3, 2, 1, 1, 1, 844 2, 2, 2, 1, 1, 1, 1, 3, 3, 1, 845 3, 3, 1, 1, 3, 3, 3, 3, 1, 3, 846 3, 1, 1, 1, 1, 3, 1, 3, 1, 3, 847 1, 5, 1, 3, 1, 1, 1, 1, 1, 1, 848 3, 1, 2, 2, 4, 2, 1, 1, 2, 3, 849 3, 2, 5, 3, 2, 3, 2, 0, 1, 1, 850 1, 1, 1, 3, 5, 6, 5, 1, 2, 4, 851 5, 4, 2, 1, 2, 1, 1, 1, 2, 1, 852 1, 2, 1, 1, 1, 1, 4, 1, 1, 1, 853 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 854 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 855 6, 0, 5, 1, 2, 3, 1, 3, 1, 4, 856 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 857 0, 0, 5, 1, 1, 0, 2, 0, 2, 2, 858 3, 1, 2, 1, 2, 5, 3, 1, 1, 4, 859 0, 6, 0, 8, 0, 7, 1, 1, 1, 0, 860 2, 3, 2, 2, 2, 3, 2, 1, 2, 1, 861 1, 0, 3 862 }; 863 864 /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. 865 Performed when YYTABLE doesn't specify something else to do. Zero 866 means the default is an error. */ 867 static const yytype_uint8 yydefact[] = 868 { 869 0, 0, 112, 113, 114, 0, 106, 105, 120, 118, 870 119, 124, 125, 126, 127, 128, 129, 121, 122, 123, 871 130, 131, 132, 109, 107, 0, 117, 133, 134, 135, 872 136, 138, 200, 201, 0, 77, 87, 0, 92, 97, 873 0, 103, 0, 110, 115, 137, 0, 197, 199, 108, 874 102, 0, 2, 3, 141, 0, 72, 0, 75, 87, 875 0, 88, 89, 90, 78, 0, 87, 0, 73, 2, 876 98, 104, 111, 0, 1, 198, 0, 0, 139, 0, 877 202, 79, 84, 86, 91, 0, 93, 80, 0, 0, 878 4, 7, 6, 8, 0, 0, 0, 35, 34, 33, 879 5, 10, 29, 12, 17, 18, 0, 0, 23, 0, 880 36, 0, 39, 42, 43, 48, 51, 52, 53, 54, 881 56, 58, 60, 71, 0, 27, 74, 0, 0, 143, 882 0, 0, 0, 182, 0, 0, 0, 0, 0, 160, 883 169, 173, 36, 62, 69, 0, 151, 0, 115, 154, 884 171, 153, 152, 0, 155, 156, 157, 158, 81, 83, 885 85, 0, 0, 99, 0, 150, 101, 30, 31, 0, 886 14, 15, 0, 0, 21, 20, 0, 22, 24, 26, 887 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 888 0, 0, 0, 0, 0, 116, 148, 0, 146, 142, 889 144, 0, 193, 192, 167, 184, 0, 196, 194, 0, 890 180, 159, 0, 65, 66, 67, 68, 64, 0, 0, 891 174, 170, 172, 0, 94, 0, 96, 100, 9, 0, 892 16, 2, 3, 13, 19, 25, 37, 38, 41, 40, 893 46, 47, 44, 45, 49, 50, 55, 57, 59, 0, 894 0, 0, 145, 140, 0, 0, 0, 0, 0, 195, 895 0, 161, 63, 70, 0, 95, 11, 0, 0, 147, 896 0, 166, 168, 187, 186, 189, 167, 178, 0, 0, 897 0, 82, 61, 149, 0, 188, 0, 0, 177, 175, 898 0, 0, 162, 0, 190, 0, 167, 0, 164, 181, 899 163, 0, 191, 185, 176, 179, 183 900 }; 901 902 /* YYDEFGOTO[NTERM-NUM]. */ 903 static const yytype_int16 yydefgoto[] = 904 { 905 -1, 196, 100, 101, 102, 229, 103, 104, 105, 106, 906 107, 108, 109, 142, 111, 112, 113, 114, 115, 116, 907 117, 118, 119, 120, 121, 122, 143, 144, 218, 145, 908 124, 146, 147, 34, 35, 36, 82, 64, 65, 83, 909 37, 38, 39, 40, 41, 42, 43, 125, 45, 130, 910 77, 128, 129, 197, 198, 166, 149, 150, 151, 152, 911 212, 280, 299, 254, 255, 256, 300, 153, 154, 155, 912 289, 279, 156, 260, 204, 257, 275, 286, 287, 157, 913 46, 47, 48, 57 914 }; 915 916 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 917 STATE-NUM. */ 918 #define YYPACT_NINF -261 919 static const yytype_int16 yypact[] = 920 { 921 1327, -20, -261, -261, -261, 113, -261, -261, -261, -261, 922 -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, 923 -261, -261, -261, -261, -261, -19, -261, -261, -261, -261, 924 -261, -261, -261, -61, -40, -28, 75, -7, -261, 24, 925 1370, -261, 1444, -261, -11, -261, 1283, -261, -261, -261, 926 -261, 1444, -261, -261, -261, 6, -261, 54, -261, 88, 927 62, -261, -261, -261, -261, 1370, 59, 91, -261, 36, 928 -50, -261, -261, 1051, -261, -261, 63, 1370, -261, 293, 929 -261, -261, -261, -261, 91, 1370, -12, -261, 856, 1051, 930 77, -261, -261, -261, 1051, 1051, 1051, -261, -261, -261, 931 -261, -261, -14, -261, -261, -261, 84, -44, 1116, 95, 932 -261, 1051, 53, 3, -261, -36, 89, -261, -261, -261, 933 104, 107, -45, -261, 96, -261, -261, 91, 1184, -261, 934 1370, 92, 93, -261, 98, 101, 94, 921, 105, 102, 935 -261, -261, 72, -261, -261, 9, -261, -61, 42, -261, 936 -261, -261, -261, 376, -261, -261, -261, -261, 106, -261, 937 -261, 986, 1051, -261, 103, -261, -261, -261, -261, -41, 938 -261, -261, 1051, 1407, -261, -261, 1051, 110, -261, -261, 939 -261, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 940 1051, 1051, 1051, 1051, 1051, -261, 109, 23, -261, -261, 941 -261, 1227, -261, -261, 111, -261, 1051, -261, -261, 25, 942 -261, -261, 459, -261, -261, -261, -261, -261, 1051, 1051, 943 -261, -261, -261, 1051, -261, 114, -261, -261, -261, 115, 944 112, 77, 116, -261, -261, -261, -261, -261, 53, 53, 945 -261, -261, -261, -261, -36, -36, -261, 104, 107, 76, 946 1051, 91, -261, -261, 145, 54, 625, 708, -6, -261, 947 791, 459, -261, -261, 117, -261, -261, 1051, 120, -261, 948 124, -261, -261, -261, -261, 791, 111, 112, 91, 125, 949 122, -261, -261, -261, 1051, -261, 118, 128, 180, -261, 950 126, 542, -261, -5, 1051, 542, 111, 1051, -261, -261, 951 -261, 123, 112, -261, -261, -261, -261 952 }; 953 954 /* YYPGOTO[NTERM-NUM]. */ 955 static const yytype_int16 yypgoto[] = 956 { 957 -261, -24, -261, -261, -261, -261, -261, -261, 34, -261, 958 -261, -261, -261, 32, -261, -33, -261, -27, -26, -261, 959 -261, -261, 14, 16, 18, -261, -66, -87, -261, -92, 960 -85, 11, 12, -261, -261, -261, 141, 150, 161, 143, 961 -261, -261, -231, 5, -30, 224, -18, 0, -261, -261, 962 -261, 100, -119, -261, -17, -156, -25, -145, -243, -261, 963 -261, -261, -64, -260, -261, -261, -52, 21, -22, -261, 964 -261, -39, -261, -261, -261, -261, -261, -261, -261, -261, 965 -261, 191, -261, -261 966 }; 967 968 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If 969 positive, shift that token. If negative, reduce the rule which 970 number is the opposite. If YYTABLE_NINF, syntax error. */ 971 #define YYTABLE_NINF -166 972 static const yytype_int16 yytable[] = 973 { 974 44, 55, 165, 164, 169, 80, 226, 123, 222, 200, 975 71, 32, 33, 272, 193, 70, 288, 49, 185, 186, 976 56, 178, 123, 88, 72, 50, 52, 53, 175, 278, 977 89, 228, 58, 76, 176, 84, 304, 219, 170, 171, 978 44, 66, 44, 86, 278, 209, 44, 127, 298, 194, 979 59, 44, 298, 187, 188, 84, 54, 32, 33, 172, 980 158, 161, 73, 173, 66, 44, 276, 301, 162, 69, 981 53, 67, 219, 219, 68, 165, 225, 44, 60, 148, 982 230, 78, 200, 6, 7, 44, 183, 219, 184, 235, 983 220, 60, 61, 62, 63, 123, 6, 7, 127, 49, 984 127, 251, 249, 219, 252, 110, 259, 87, 61, 62, 985 63, 23, 24, -27, 258, 73, 222, 2, 3, 4, 986 110, 61, 62, 63, 23, 24, 167, 168, 44, 79, 987 44, 262, 263, 213, 214, 215, 52, 53, 264, 181, 988 182, 305, 216, 180, 126, 189, 190, -76, -28, 233, 989 238, 239, 217, 148, 219, 267, 174, 123, 240, 241, 990 242, 243, 191, 244, 245, 268, 179, 192, 277, 205, 991 195, 127, 206, 202, 203, 207, 210, 227, 211, 223, 992 282, -117, 250, 277, 123, 270, -165, -138, 265, 266, 993 219, 281, 293, 110, 283, 284, 296, 291, 292, 294, 994 295, 44, 302, 271, 306, 246, 297, 234, 247, 81, 995 165, 248, 148, 236, 237, 110, 110, 110, 110, 110, 996 110, 110, 110, 110, 110, 110, 159, 85, 160, 51, 997 201, 303, 273, 261, 269, 274, 285, 75, 0, 0, 998 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 999 0, 0, 0, 0, 290, 110, 148, 148, 0, 0, 1000 148, 148, 0, 0, 0, 0, 0, 0, 0, 0, 1001 0, 0, 0, 0, 0, 148, 0, 0, 0, 0, 1002 0, 0, 110, 0, 0, 0, 0, 0, 0, 0, 1003 0, 148, 0, 0, 0, 148, 1, 2, 3, 4, 1004 5, 6, 7, 8, 9, 10, 131, 132, 133, 0, 1005 134, 135, 136, 137, 11, 12, 13, 14, 15, 16, 1006 17, 18, 19, 20, 21, 22, 0, 0, 0, 23, 1007 24, 25, 26, 138, 27, 28, 29, 30, 90, 31, 1008 91, 92, 93, 0, 0, 94, 95, 0, 0, 0, 1009 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1010 0, 0, 0, 0, 96, 0, 0, 0, 139, 140, 1011 0, 0, 0, 0, 141, 97, 98, 0, 99, 1, 1012 2, 3, 4, 5, 6, 7, 8, 9, 10, 131, 1013 132, 133, 0, 134, 135, 136, 137, 11, 12, 13, 1014 14, 15, 16, 17, 18, 19, 20, 21, 22, 0, 1015 0, 0, 23, 24, 25, 26, 138, 27, 28, 29, 1016 30, 90, 31, 91, 92, 93, 0, 0, 94, 95, 1017 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1018 0, 0, 0, 0, 0, 0, 0, 96, 0, 0, 1019 0, 139, 221, 0, 0, 0, 0, 141, 97, 98, 1020 0, 99, 1, 2, 3, 4, 5, 6, 7, 8, 1021 9, 10, 131, 132, 133, 0, 134, 135, 136, 137, 1022 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1023 21, 22, 0, 0, 0, 23, 24, 25, 26, 138, 1024 27, 28, 29, 30, 90, 31, 91, 92, 93, 0, 1025 0, 94, 95, 0, 0, 0, 0, 0, 0, 0, 1026 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1027 96, 0, 0, 0, 139, 0, 0, 0, 0, 0, 1028 141, 97, 98, 0, 99, 1, 2, 3, 4, 5, 1029 6, 7, 8, 9, 10, 131, 132, 133, 0, 134, 1030 135, 136, 137, 11, 12, 13, 14, 15, 16, 17, 1031 18, 19, 20, 21, 22, 0, 0, 0, 23, 24, 1032 25, 26, 138, 27, 28, 29, 30, 90, 31, 91, 1033 92, 93, 0, 0, 94, 95, 0, 0, 0, 0, 1034 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1035 0, 0, 0, 96, 0, 0, 0, 79, 0, 0, 1036 0, 0, 0, 141, 97, 98, 0, 99, 1, 2, 1037 3, 4, 5, 6, 7, 8, 9, 10, 131, 132, 1038 133, 0, 134, 135, 136, 137, 11, 12, 13, 14, 1039 15, 16, 17, 18, 19, 20, 21, 22, 0, 0, 1040 0, 23, 24, 25, 26, 138, 27, 28, 29, 30, 1041 90, 31, 91, 92, 93, 0, 0, 94, 95, 0, 1042 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1043 0, 0, 0, 0, 0, 0, 96, 0, 0, 0, 1044 0, 0, 0, 0, 0, 0, 141, 97, 98, 0, 1045 99, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1046 10, 0, 0, 0, 0, 0, 0, 0, 0, 11, 1047 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 1048 22, 0, 0, 0, 23, 24, 25, 26, 0, 27, 1049 28, 29, 30, 90, 31, 91, 92, 93, 0, 0, 1050 94, 95, 0, 0, 0, 0, 0, 0, 0, 0, 1051 0, 0, 0, 0, 0, 0, 0, 0, 0, 96, 1052 0, 0, 0, 0, 0, 0, 0, 0, 0, 141, 1053 97, 98, 0, 99, 60, 2, 3, 4, 0, 6, 1054 7, 8, 9, 10, 0, 0, 0, 0, 0, 0, 1055 0, 0, 11, 12, 13, 14, 15, 16, 17, 18, 1056 19, 20, 21, 22, 0, 0, 0, 23, 24, 25, 1057 26, 0, 27, 28, 29, 30, 90, 31, 91, 92, 1058 93, 0, 0, 94, 95, 0, 0, 0, 0, 0, 1059 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1060 0, 0, 96, 0, 0, 0, 8, 9, 10, 0, 1061 0, 0, 0, 97, 98, 0, 99, 11, 12, 13, 1062 14, 15, 16, 17, 18, 19, 20, 21, 22, 0, 1063 0, 0, 0, 0, 25, 26, 0, 27, 28, 29, 1064 30, 90, 31, 91, 92, 93, 0, 0, 94, 95, 1065 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1066 0, 0, 0, 0, 0, 0, 0, 96, 0, 0, 1067 163, 8, 9, 10, 0, 0, 0, 0, 97, 98, 1068 0, 99, 11, 12, 13, 14, 15, 16, 17, 18, 1069 19, 20, 21, 22, 0, 0, 0, 0, 0, 25, 1070 26, 0, 27, 28, 29, 30, 90, 31, 91, 92, 1071 93, 0, 0, 94, 95, 0, 0, 0, 0, 0, 1072 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1073 0, 0, 96, 0, 0, 0, 8, 9, 10, 0, 1074 0, 0, 208, 97, 98, 0, 99, 11, 12, 13, 1075 14, 15, 16, 17, 18, 19, 20, 21, 22, 0, 1076 0, 0, 0, 0, 25, 26, 0, 27, 28, 29, 1077 30, 90, 31, 91, 92, 93, 0, 0, 94, 95, 1078 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1079 0, 0, 0, 0, 0, 0, 0, 96, 0, 0, 1080 224, 8, 9, 10, 0, 0, 0, 0, 97, 98, 1081 0, 99, 11, 12, 13, 14, 15, 16, 17, 18, 1082 19, 20, 21, 22, 0, 0, 0, 0, 0, 25, 1083 26, 0, 27, 28, 29, 30, 90, 31, 91, 92, 1084 93, 0, 0, 94, 95, 0, 0, 0, 0, 0, 1085 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1086 0, 0, 96, 0, 0, 0, 8, 9, 10, 0, 1087 0, 0, 0, 97, 98, 0, 99, 11, 12, 13, 1088 14, 15, 16, 17, 18, 19, 20, 21, 22, 0, 1089 0, 0, 0, 0, 25, 177, 0, 27, 28, 29, 1090 30, 90, 31, 91, 92, 93, 0, 0, 94, 95, 1091 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1092 0, 0, 0, 0, 0, 0, 0, 96, 2, 3, 1093 4, 0, 0, 0, 8, 9, 10, 0, 97, 98, 1094 0, 99, 0, 0, 0, 11, 12, 13, 14, 15, 1095 16, 17, 18, 19, 20, 21, 22, 0, 0, 0, 1096 0, 0, 25, 26, 0, 27, 28, 29, 30, 0, 1097 31, 2, 3, 4, 0, 0, 0, 8, 9, 10, 1098 0, 0, 0, 0, 0, 0, 0, 0, 11, 12, 1099 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 1100 199, 0, 0, 0, 0, 25, 26, 0, 27, 28, 1101 29, 30, 0, 31, 0, 0, 0, 0, 0, 0, 1102 0, 0, 0, 74, 0, 0, 1, 2, 3, 4, 1103 5, 6, 7, 8, 9, 10, 0, 0, 0, 0, 1104 0, 0, 0, 253, 11, 12, 13, 14, 15, 16, 1105 17, 18, 19, 20, 21, 22, 0, 0, 0, 23, 1106 24, 25, 26, 0, 27, 28, 29, 30, 0, 31, 1107 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1108 0, 0, 0, 0, 0, 0, 0, 0, 11, 12, 1109 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 1110 0, 0, 0, 23, 24, 25, 26, 0, 27, 28, 1111 29, 30, 0, 31, 2, 3, 4, 0, 0, 0, 1112 8, 9, 10, 0, 0, 0, 0, 0, 0, 0, 1113 0, 11, 12, 13, 14, 15, 16, 17, 18, 19, 1114 20, 21, 22, 0, 0, 0, 0, 0, 25, 26, 1115 0, 27, 28, 29, 30, 0, 31, 8, 9, 10, 1116 0, 0, 0, 0, 0, 0, 0, 0, 11, 12, 1117 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 1118 0, 0, 0, 0, 0, 25, 26, 0, 27, 28, 1119 29, 30, 231, 232, 8, 9, 10, 0, 0, 0, 1120 0, 0, 0, 0, 0, 11, 12, 13, 14, 15, 1121 16, 17, 18, 19, 20, 21, 22, 0, 0, 0, 1122 0, 0, 25, 26, 0, 27, 28, 29, 30, 0, 1123 31 1124 }; 1125 1126 #define yypact_value_is_default(Yystate) \ 1127 (!!((Yystate) == (-261))) 1128 1129 #define yytable_value_is_error(Yytable_value) \ 1130 YYID (0) 1131 1132 static const yytype_int16 yycheck[] = 1133 { 1134 0, 25, 89, 88, 96, 57, 162, 73, 153, 128, 1135 40, 0, 0, 256, 59, 39, 276, 37, 54, 55, 1136 81, 108, 88, 73, 42, 45, 45, 46, 72, 260, 1137 80, 72, 72, 51, 78, 65, 296, 78, 52, 53, 1138 40, 36, 42, 67, 275, 137, 46, 77, 291, 94, 1139 78, 51, 295, 89, 90, 85, 75, 46, 46, 73, 1140 84, 73, 73, 77, 59, 65, 72, 72, 80, 45, 1141 46, 78, 78, 78, 81, 162, 161, 77, 3, 79, 1142 172, 75, 201, 8, 9, 85, 83, 78, 85, 176, 1143 81, 3, 33, 34, 35, 161, 8, 9, 128, 37, 1144 130, 78, 194, 78, 81, 73, 81, 71, 33, 34, 1145 35, 36, 37, 71, 206, 73, 261, 4, 5, 6, 1146 88, 33, 34, 35, 36, 37, 94, 95, 128, 75, 1147 130, 218, 219, 61, 62, 63, 45, 46, 223, 86, 1148 87, 297, 70, 111, 81, 56, 57, 72, 71, 173, 1149 183, 184, 80, 153, 78, 79, 72, 223, 185, 186, 1150 187, 188, 58, 189, 190, 250, 71, 60, 260, 71, 1151 74, 201, 71, 81, 81, 81, 71, 74, 76, 73, 1152 267, 71, 73, 275, 250, 40, 75, 71, 74, 74, 1153 78, 74, 284, 161, 74, 71, 16, 72, 76, 81, 1154 72, 201, 294, 255, 81, 191, 80, 173, 192, 59, 1155 297, 193, 212, 181, 182, 183, 184, 185, 186, 187, 1156 188, 189, 190, 191, 192, 193, 85, 66, 85, 5, 1157 130, 295, 257, 212, 251, 257, 275, 46, -1, -1, 1158 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1159 -1, -1, -1, -1, 278, 223, 256, 257, -1, -1, 1160 260, 261, -1, -1, -1, -1, -1, -1, -1, -1, 1161 -1, -1, -1, -1, -1, 275, -1, -1, -1, -1, 1162 -1, -1, 250, -1, -1, -1, -1, -1, -1, -1, 1163 -1, 291, -1, -1, -1, 295, 3, 4, 5, 6, 1164 7, 8, 9, 10, 11, 12, 13, 14, 15, -1, 1165 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 1166 27, 28, 29, 30, 31, 32, -1, -1, -1, 36, 1167 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 1168 47, 48, 49, -1, -1, 52, 53, -1, -1, -1, 1169 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1170 -1, -1, -1, -1, 71, -1, -1, -1, 75, 76, 1171 -1, -1, -1, -1, 81, 82, 83, -1, 85, 3, 1172 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 1173 14, 15, -1, 17, 18, 19, 20, 21, 22, 23, 1174 24, 25, 26, 27, 28, 29, 30, 31, 32, -1, 1175 -1, -1, 36, 37, 38, 39, 40, 41, 42, 43, 1176 44, 45, 46, 47, 48, 49, -1, -1, 52, 53, 1177 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1178 -1, -1, -1, -1, -1, -1, -1, 71, -1, -1, 1179 -1, 75, 76, -1, -1, -1, -1, 81, 82, 83, 1180 -1, 85, 3, 4, 5, 6, 7, 8, 9, 10, 1181 11, 12, 13, 14, 15, -1, 17, 18, 19, 20, 1182 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 1183 31, 32, -1, -1, -1, 36, 37, 38, 39, 40, 1184 41, 42, 43, 44, 45, 46, 47, 48, 49, -1, 1185 -1, 52, 53, -1, -1, -1, -1, -1, -1, -1, 1186 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1187 71, -1, -1, -1, 75, -1, -1, -1, -1, -1, 1188 81, 82, 83, -1, 85, 3, 4, 5, 6, 7, 1189 8, 9, 10, 11, 12, 13, 14, 15, -1, 17, 1190 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 1191 28, 29, 30, 31, 32, -1, -1, -1, 36, 37, 1192 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 1193 48, 49, -1, -1, 52, 53, -1, -1, -1, -1, 1194 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1195 -1, -1, -1, 71, -1, -1, -1, 75, -1, -1, 1196 -1, -1, -1, 81, 82, 83, -1, 85, 3, 4, 1197 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 1198 15, -1, 17, 18, 19, 20, 21, 22, 23, 24, 1199 25, 26, 27, 28, 29, 30, 31, 32, -1, -1, 1200 -1, 36, 37, 38, 39, 40, 41, 42, 43, 44, 1201 45, 46, 47, 48, 49, -1, -1, 52, 53, -1, 1202 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1203 -1, -1, -1, -1, -1, -1, 71, -1, -1, -1, 1204 -1, -1, -1, -1, -1, -1, 81, 82, 83, -1, 1205 85, 3, 4, 5, 6, 7, 8, 9, 10, 11, 1206 12, -1, -1, -1, -1, -1, -1, -1, -1, 21, 1207 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 1208 32, -1, -1, -1, 36, 37, 38, 39, -1, 41, 1209 42, 43, 44, 45, 46, 47, 48, 49, -1, -1, 1210 52, 53, -1, -1, -1, -1, -1, -1, -1, -1, 1211 -1, -1, -1, -1, -1, -1, -1, -1, -1, 71, 1212 -1, -1, -1, -1, -1, -1, -1, -1, -1, 81, 1213 82, 83, -1, 85, 3, 4, 5, 6, -1, 8, 1214 9, 10, 11, 12, -1, -1, -1, -1, -1, -1, 1215 -1, -1, 21, 22, 23, 24, 25, 26, 27, 28, 1216 29, 30, 31, 32, -1, -1, -1, 36, 37, 38, 1217 39, -1, 41, 42, 43, 44, 45, 46, 47, 48, 1218 49, -1, -1, 52, 53, -1, -1, -1, -1, -1, 1219 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1220 -1, -1, 71, -1, -1, -1, 10, 11, 12, -1, 1221 -1, -1, -1, 82, 83, -1, 85, 21, 22, 23, 1222 24, 25, 26, 27, 28, 29, 30, 31, 32, -1, 1223 -1, -1, -1, -1, 38, 39, -1, 41, 42, 43, 1224 44, 45, 46, 47, 48, 49, -1, -1, 52, 53, 1225 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1226 -1, -1, -1, -1, -1, -1, -1, 71, -1, -1, 1227 74, 10, 11, 12, -1, -1, -1, -1, 82, 83, 1228 -1, 85, 21, 22, 23, 24, 25, 26, 27, 28, 1229 29, 30, 31, 32, -1, -1, -1, -1, -1, 38, 1230 39, -1, 41, 42, 43, 44, 45, 46, 47, 48, 1231 49, -1, -1, 52, 53, -1, -1, -1, -1, -1, 1232 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1233 -1, -1, 71, -1, -1, -1, 10, 11, 12, -1, 1234 -1, -1, 81, 82, 83, -1, 85, 21, 22, 23, 1235 24, 25, 26, 27, 28, 29, 30, 31, 32, -1, 1236 -1, -1, -1, -1, 38, 39, -1, 41, 42, 43, 1237 44, 45, 46, 47, 48, 49, -1, -1, 52, 53, 1238 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1239 -1, -1, -1, -1, -1, -1, -1, 71, -1, -1, 1240 74, 10, 11, 12, -1, -1, -1, -1, 82, 83, 1241 -1, 85, 21, 22, 23, 24, 25, 26, 27, 28, 1242 29, 30, 31, 32, -1, -1, -1, -1, -1, 38, 1243 39, -1, 41, 42, 43, 44, 45, 46, 47, 48, 1244 49, -1, -1, 52, 53, -1, -1, -1, -1, -1, 1245 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1246 -1, -1, 71, -1, -1, -1, 10, 11, 12, -1, 1247 -1, -1, -1, 82, 83, -1, 85, 21, 22, 23, 1248 24, 25, 26, 27, 28, 29, 30, 31, 32, -1, 1249 -1, -1, -1, -1, 38, 39, -1, 41, 42, 43, 1250 44, 45, 46, 47, 48, 49, -1, -1, 52, 53, 1251 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1252 -1, -1, -1, -1, -1, -1, -1, 71, 4, 5, 1253 6, -1, -1, -1, 10, 11, 12, -1, 82, 83, 1254 -1, 85, -1, -1, -1, 21, 22, 23, 24, 25, 1255 26, 27, 28, 29, 30, 31, 32, -1, -1, -1, 1256 -1, -1, 38, 39, -1, 41, 42, 43, 44, -1, 1257 46, 4, 5, 6, -1, -1, -1, 10, 11, 12, 1258 -1, -1, -1, -1, -1, -1, -1, -1, 21, 22, 1259 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 1260 76, -1, -1, -1, -1, 38, 39, -1, 41, 42, 1261 43, 44, -1, 46, -1, -1, -1, -1, -1, -1, 1262 -1, -1, -1, 0, -1, -1, 3, 4, 5, 6, 1263 7, 8, 9, 10, 11, 12, -1, -1, -1, -1, 1264 -1, -1, -1, 76, 21, 22, 23, 24, 25, 26, 1265 27, 28, 29, 30, 31, 32, -1, -1, -1, 36, 1266 37, 38, 39, -1, 41, 42, 43, 44, -1, 46, 1267 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1268 -1, -1, -1, -1, -1, -1, -1, -1, 21, 22, 1269 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 1270 -1, -1, -1, 36, 37, 38, 39, -1, 41, 42, 1271 43, 44, -1, 46, 4, 5, 6, -1, -1, -1, 1272 10, 11, 12, -1, -1, -1, -1, -1, -1, -1, 1273 -1, 21, 22, 23, 24, 25, 26, 27, 28, 29, 1274 30, 31, 32, -1, -1, -1, -1, -1, 38, 39, 1275 -1, 41, 42, 43, 44, -1, 46, 10, 11, 12, 1276 -1, -1, -1, -1, -1, -1, -1, -1, 21, 22, 1277 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 1278 -1, -1, -1, -1, -1, 38, 39, -1, 41, 42, 1279 43, 44, 45, 46, 10, 11, 12, -1, -1, -1, 1280 -1, -1, -1, -1, -1, 21, 22, 23, 24, 25, 1281 26, 27, 28, 29, 30, 31, 32, -1, -1, -1, 1282 -1, -1, 38, 39, -1, 41, 42, 43, 44, -1, 1283 46 1284 }; 1285 1286 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing 1287 symbol of state STATE-NUM. */ 1288 static const yytype_uint8 yystos[] = 1289 { 1290 0, 3, 4, 5, 6, 7, 8, 9, 10, 11, 1291 12, 21, 22, 23, 24, 25, 26, 27, 28, 29, 1292 30, 31, 32, 36, 37, 38, 39, 41, 42, 43, 1293 44, 46, 126, 127, 128, 129, 130, 135, 136, 137, 1294 138, 139, 140, 141, 142, 143, 175, 176, 177, 37, 1295 45, 140, 45, 46, 75, 96, 81, 178, 72, 78, 1296 3, 33, 34, 35, 132, 133, 138, 78, 81, 45, 1297 96, 139, 141, 73, 0, 176, 141, 145, 75, 75, 1298 161, 132, 131, 134, 139, 133, 96, 71, 73, 80, 1299 45, 47, 48, 49, 52, 53, 71, 82, 83, 85, 1300 97, 98, 99, 101, 102, 103, 104, 105, 106, 107, 1301 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 1302 118, 119, 120, 121, 125, 142, 81, 139, 146, 147, 1303 144, 13, 14, 15, 17, 18, 19, 20, 40, 75, 1304 76, 81, 108, 121, 122, 124, 126, 127, 142, 151, 1305 152, 153, 154, 162, 163, 164, 167, 174, 96, 131, 1306 134, 73, 80, 74, 125, 122, 150, 108, 108, 124, 1307 52, 53, 73, 77, 72, 72, 78, 39, 122, 71, 1308 108, 86, 87, 83, 85, 54, 55, 89, 90, 56, 1309 57, 58, 60, 59, 94, 74, 96, 148, 149, 76, 1310 147, 146, 81, 81, 169, 71, 71, 81, 81, 124, 1311 71, 76, 155, 61, 62, 63, 70, 80, 123, 78, 1312 81, 76, 152, 73, 74, 125, 150, 74, 72, 100, 1313 124, 45, 46, 96, 103, 122, 108, 108, 110, 110, 1314 112, 112, 112, 112, 113, 113, 117, 118, 119, 124, 1315 73, 78, 81, 76, 158, 159, 160, 170, 124, 81, 1316 168, 162, 122, 122, 125, 74, 74, 79, 125, 149, 1317 40, 161, 153, 151, 163, 171, 72, 124, 137, 166, 1318 156, 74, 122, 74, 71, 166, 172, 173, 158, 165, 1319 96, 72, 76, 124, 81, 72, 16, 80, 153, 157, 1320 161, 72, 124, 157, 158, 150, 81 1321 }; 1322 1323 #define yyerrok (yyerrstatus = 0) 1324 #define yyclearin (yychar = YYEMPTY) 1325 #define YYEMPTY (-2) 1326 #define YYEOF 0 1327 1328 #define YYACCEPT goto yyacceptlab 1329 #define YYABORT goto yyabortlab 1330 #define YYERROR goto yyerrorlab 1331 1332 1333 /* Like YYERROR except do call yyerror. This remains here temporarily 1334 to ease the transition to the new meaning of YYERROR, for GCC. 1335 Once GCC version 2 has supplanted version 1, this can go. However, 1336 YYFAIL appears to be in use. Nevertheless, it is formally deprecated 1337 in Bison 2.4.2's NEWS entry, where a plan to phase it out is 1338 discussed. */ 1339 1340 #define YYFAIL goto yyerrlab 1341 #if defined YYFAIL 1342 /* This is here to suppress warnings from the GCC cpp's 1343 -Wunused-macros. Normally we don't worry about that warning, but 1344 some users do, and we want to make it easy for users to remove 1345 YYFAIL uses, which will produce warnings from Bison 2.5. */ 1346 #endif 1347 1348 #define YYRECOVERING() (!!yyerrstatus) 1349 1350 #define YYBACKUP(Token, Value) \ 1351 do \ 1352 if (yychar == YYEMPTY) \ 1353 { \ 1354 yychar = (Token); \ 1355 yylval = (Value); \ 1356 YYPOPSTACK (yylen); \ 1357 yystate = *yyssp; \ 1358 goto yybackup; \ 1359 } \ 1360 else \ 1361 { \ 1362 yyerror (&yylloc, context, YY_("syntax error: cannot back up")); \ 1363 YYERROR; \ 1364 } \ 1365 while (YYID (0)) 1366 1367 /* Error token number */ 1368 #define YYTERROR 1 1369 #define YYERRCODE 256 1370 1371 1372 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. 1373 If N is 0, then set CURRENT to the empty location which ends 1374 the previous symbol: RHS[0] (always defined). */ 1375 1376 #ifndef YYLLOC_DEFAULT 1377 # define YYLLOC_DEFAULT(Current, Rhs, N) \ 1378 do \ 1379 if (YYID (N)) \ 1380 { \ 1381 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ 1382 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ 1383 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ 1384 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ 1385 } \ 1386 else \ 1387 { \ 1388 (Current).first_line = (Current).last_line = \ 1389 YYRHSLOC (Rhs, 0).last_line; \ 1390 (Current).first_column = (Current).last_column = \ 1391 YYRHSLOC (Rhs, 0).last_column; \ 1392 } \ 1393 while (YYID (0)) 1394 #endif 1395 1396 #define YYRHSLOC(Rhs, K) ((Rhs)[K]) 1397 1398 1399 /* YY_LOCATION_PRINT -- Print the location on the stream. 1400 This macro was not mandated originally: define only if we know 1401 we won't break user code: when these are the locations we know. */ 1402 1403 #ifndef YY_LOCATION_PRINT 1404 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL 1405 1406 /* Print *YYLOCP on YYO. Private, do not rely on its existence. */ 1407 1408 __attribute__((__unused__)) 1409 #if (defined __STDC__ || defined __C99__FUNC__ \ 1410 || defined __cplusplus || defined _MSC_VER) 1411 static unsigned 1412 yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp) 1413 #else 1414 static unsigned 1415 yy_location_print_ (yyo, yylocp) 1416 FILE *yyo; 1417 YYLTYPE const * const yylocp; 1418 #endif 1419 { 1420 unsigned res = 0; 1421 int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; 1422 if (0 <= yylocp->first_line) 1423 { 1424 res += fprintf (yyo, "%d", yylocp->first_line); 1425 if (0 <= yylocp->first_column) 1426 res += fprintf (yyo, ".%d", yylocp->first_column); 1427 } 1428 if (0 <= yylocp->last_line) 1429 { 1430 if (yylocp->first_line < yylocp->last_line) 1431 { 1432 res += fprintf (yyo, "-%d", yylocp->last_line); 1433 if (0 <= end_col) 1434 res += fprintf (yyo, ".%d", end_col); 1435 } 1436 else if (0 <= end_col && yylocp->first_column < end_col) 1437 res += fprintf (yyo, "-%d", end_col); 1438 } 1439 return res; 1440 } 1441 1442 # define YY_LOCATION_PRINT(File, Loc) \ 1443 yy_location_print_ (File, &(Loc)) 1444 1445 # else 1446 # define YY_LOCATION_PRINT(File, Loc) ((void) 0) 1447 # endif 1448 #endif 1449 1450 1451 /* YYLEX -- calling `yylex' with the right arguments. */ 1452 #ifdef YYLEX_PARAM 1453 # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) 1454 #else 1455 # define YYLEX yylex (&yylval, &yylloc) 1456 #endif 1457 1458 /* Enable debugging if requested. */ 1459 #if YYDEBUG 1460 1461 # ifndef YYFPRINTF 1462 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ 1463 # define YYFPRINTF fprintf 1464 # endif 1465 1466 # define YYDPRINTF(Args) \ 1467 do { \ 1468 if (yydebug) \ 1469 YYFPRINTF Args; \ 1470 } while (YYID (0)) 1471 1472 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ 1473 do { \ 1474 if (yydebug) \ 1475 { \ 1476 YYFPRINTF (stderr, "%s ", Title); \ 1477 yy_symbol_print (stderr, \ 1478 Type, Value, Location, context); \ 1479 YYFPRINTF (stderr, "\n"); \ 1480 } \ 1481 } while (YYID (0)) 1482 1483 1484 /*--------------------------------. 1485 | Print this symbol on YYOUTPUT. | 1486 `--------------------------------*/ 1487 1488 /*ARGSUSED*/ 1489 #if (defined __STDC__ || defined __C99__FUNC__ \ 1490 || defined __cplusplus || defined _MSC_VER) 1491 static void 1492 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, TParseContext* context) 1493 #else 1494 static void 1495 yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, context) 1496 FILE *yyoutput; 1497 int yytype; 1498 YYSTYPE const * const yyvaluep; 1499 YYLTYPE const * const yylocationp; 1500 TParseContext* context; 1501 #endif 1502 { 1503 FILE *yyo = yyoutput; 1504 YYUSE (yyo); 1505 if (!yyvaluep) 1506 return; 1507 YYUSE (yylocationp); 1508 YYUSE (context); 1509 # ifdef YYPRINT 1510 if (yytype < YYNTOKENS) 1511 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); 1512 # else 1513 YYUSE (yyoutput); 1514 # endif 1515 switch (yytype) 1516 { 1517 default: 1518 break; 1519 } 1520 } 1521 1522 1523 /*--------------------------------. 1524 | Print this symbol on YYOUTPUT. | 1525 `--------------------------------*/ 1526 1527 #if (defined __STDC__ || defined __C99__FUNC__ \ 1528 || defined __cplusplus || defined _MSC_VER) 1529 static void 1530 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, TParseContext* context) 1531 #else 1532 static void 1533 yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp, context) 1534 FILE *yyoutput; 1535 int yytype; 1536 YYSTYPE const * const yyvaluep; 1537 YYLTYPE const * const yylocationp; 1538 TParseContext* context; 1539 #endif 1540 { 1541 if (yytype < YYNTOKENS) 1542 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); 1543 else 1544 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); 1545 1546 YY_LOCATION_PRINT (yyoutput, *yylocationp); 1547 YYFPRINTF (yyoutput, ": "); 1548 yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, context); 1549 YYFPRINTF (yyoutput, ")"); 1550 } 1551 1552 /*------------------------------------------------------------------. 1553 | yy_stack_print -- Print the state stack from its BOTTOM up to its | 1554 | TOP (included). | 1555 `------------------------------------------------------------------*/ 1556 1557 #if (defined __STDC__ || defined __C99__FUNC__ \ 1558 || defined __cplusplus || defined _MSC_VER) 1559 static void 1560 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) 1561 #else 1562 static void 1563 yy_stack_print (yybottom, yytop) 1564 yytype_int16 *yybottom; 1565 yytype_int16 *yytop; 1566 #endif 1567 { 1568 YYFPRINTF (stderr, "Stack now"); 1569 for (; yybottom <= yytop; yybottom++) 1570 { 1571 int yybot = *yybottom; 1572 YYFPRINTF (stderr, " %d", yybot); 1573 } 1574 YYFPRINTF (stderr, "\n"); 1575 } 1576 1577 # define YY_STACK_PRINT(Bottom, Top) \ 1578 do { \ 1579 if (yydebug) \ 1580 yy_stack_print ((Bottom), (Top)); \ 1581 } while (YYID (0)) 1582 1583 1584 /*------------------------------------------------. 1585 | Report that the YYRULE is going to be reduced. | 1586 `------------------------------------------------*/ 1587 1588 #if (defined __STDC__ || defined __C99__FUNC__ \ 1589 || defined __cplusplus || defined _MSC_VER) 1590 static void 1591 yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, TParseContext* context) 1592 #else 1593 static void 1594 yy_reduce_print (yyvsp, yylsp, yyrule, context) 1595 YYSTYPE *yyvsp; 1596 YYLTYPE *yylsp; 1597 int yyrule; 1598 TParseContext* context; 1599 #endif 1600 { 1601 int yynrhs = yyr2[yyrule]; 1602 int yyi; 1603 unsigned long int yylno = yyrline[yyrule]; 1604 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", 1605 yyrule - 1, yylno); 1606 /* The symbols being reduced. */ 1607 for (yyi = 0; yyi < yynrhs; yyi++) 1608 { 1609 YYFPRINTF (stderr, " $%d = ", yyi + 1); 1610 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], 1611 &(yyvsp[(yyi + 1) - (yynrhs)]) 1612 , &(yylsp[(yyi + 1) - (yynrhs)]) , context); 1613 YYFPRINTF (stderr, "\n"); 1614 } 1615 } 1616 1617 # define YY_REDUCE_PRINT(Rule) \ 1618 do { \ 1619 if (yydebug) \ 1620 yy_reduce_print (yyvsp, yylsp, Rule, context); \ 1621 } while (YYID (0)) 1622 1623 /* Nonzero means print parse trace. It is left uninitialized so that 1624 multiple parsers can coexist. */ 1625 int yydebug; 1626 #else /* !YYDEBUG */ 1627 # define YYDPRINTF(Args) 1628 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) 1629 # define YY_STACK_PRINT(Bottom, Top) 1630 # define YY_REDUCE_PRINT(Rule) 1631 #endif /* !YYDEBUG */ 1632 1633 1634 /* YYINITDEPTH -- initial size of the parser's stacks. */ 1635 #ifndef YYINITDEPTH 1636 # define YYINITDEPTH 200 1637 #endif 1638 1639 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only 1640 if the built-in stack extension method is used). 1641 1642 Do not make this value too large; the results are undefined if 1643 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) 1644 evaluated with infinite-precision integer arithmetic. */ 1645 1646 #ifndef YYMAXDEPTH 1647 # define YYMAXDEPTH 10000 1648 #endif 1649 1650 1651 #if YYERROR_VERBOSE 1652 1653 # ifndef yystrlen 1654 # if defined __GLIBC__ && defined _STRING_H 1655 # define yystrlen strlen 1656 # else 1657 /* Return the length of YYSTR. */ 1658 #if (defined __STDC__ || defined __C99__FUNC__ \ 1659 || defined __cplusplus || defined _MSC_VER) 1660 static YYSIZE_T 1661 yystrlen (const char *yystr) 1662 #else 1663 static YYSIZE_T 1664 yystrlen (yystr) 1665 const char *yystr; 1666 #endif 1667 { 1668 YYSIZE_T yylen; 1669 for (yylen = 0; yystr[yylen]; yylen++) 1670 continue; 1671 return yylen; 1672 } 1673 # endif 1674 # endif 1675 1676 # ifndef yystpcpy 1677 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE 1678 # define yystpcpy stpcpy 1679 # else 1680 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in 1681 YYDEST. */ 1682 #if (defined __STDC__ || defined __C99__FUNC__ \ 1683 || defined __cplusplus || defined _MSC_VER) 1684 static char * 1685 yystpcpy (char *yydest, const char *yysrc) 1686 #else 1687 static char * 1688 yystpcpy (yydest, yysrc) 1689 char *yydest; 1690 const char *yysrc; 1691 #endif 1692 { 1693 char *yyd = yydest; 1694 const char *yys = yysrc; 1695 1696 while ((*yyd++ = *yys++) != '\0') 1697 continue; 1698 1699 return yyd - 1; 1700 } 1701 # endif 1702 # endif 1703 1704 # ifndef yytnamerr 1705 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary 1706 quotes and backslashes, so that it's suitable for yyerror. The 1707 heuristic is that double-quoting is unnecessary unless the string 1708 contains an apostrophe, a comma, or backslash (other than 1709 backslash-backslash). YYSTR is taken from yytname. If YYRES is 1710 null, do not copy; instead, return the length of what the result 1711 would have been. */ 1712 static YYSIZE_T 1713 yytnamerr (char *yyres, const char *yystr) 1714 { 1715 if (*yystr == '"') 1716 { 1717 YYSIZE_T yyn = 0; 1718 char const *yyp = yystr; 1719 1720 for (;;) 1721 switch (*++yyp) 1722 { 1723 case '\'': 1724 case ',': 1725 goto do_not_strip_quotes; 1726 1727 case '\\': 1728 if (*++yyp != '\\') 1729 goto do_not_strip_quotes; 1730 /* Fall through. */ 1731 default: 1732 if (yyres) 1733 yyres[yyn] = *yyp; 1734 yyn++; 1735 break; 1736 1737 case '"': 1738 if (yyres) 1739 yyres[yyn] = '\0'; 1740 return yyn; 1741 } 1742 do_not_strip_quotes: ; 1743 } 1744 1745 if (! yyres) 1746 return yystrlen (yystr); 1747 1748 return yystpcpy (yyres, yystr) - yyres; 1749 } 1750 # endif 1751 1752 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message 1753 about the unexpected token YYTOKEN for the state stack whose top is 1754 YYSSP. 1755 1756 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is 1757 not large enough to hold the message. In that case, also set 1758 *YYMSG_ALLOC to the required number of bytes. Return 2 if the 1759 required number of bytes is too large to store. */ 1760 static int 1761 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, 1762 yytype_int16 *yyssp, int yytoken) 1763 { 1764 YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]); 1765 YYSIZE_T yysize = yysize0; 1766 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; 1767 /* Internationalized format string. */ 1768 const char *yyformat = YY_NULL; 1769 /* Arguments of yyformat. */ 1770 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; 1771 /* Number of reported tokens (one for the "unexpected", one per 1772 "expected"). */ 1773 int yycount = 0; 1774 1775 /* There are many possibilities here to consider: 1776 - Assume YYFAIL is not used. It's too flawed to consider. See 1777 <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html> 1778 for details. YYERROR is fine as it does not invoke this 1779 function. 1780 - If this state is a consistent state with a default action, then 1781 the only way this function was invoked is if the default action 1782 is an error action. In that case, don't check for expected 1783 tokens because there are none. 1784 - The only way there can be no lookahead present (in yychar) is if 1785 this state is a consistent state with a default action. Thus, 1786 detecting the absence of a lookahead is sufficient to determine 1787 that there is no unexpected or expected token to report. In that 1788 case, just report a simple "syntax error". 1789 - Don't assume there isn't a lookahead just because this state is a 1790 consistent state with a default action. There might have been a 1791 previous inconsistent state, consistent state with a non-default 1792 action, or user semantic action that manipulated yychar. 1793 - Of course, the expected token list depends on states to have 1794 correct lookahead information, and it depends on the parser not 1795 to perform extra reductions after fetching a lookahead from the 1796 scanner and before detecting a syntax error. Thus, state merging 1797 (from LALR or IELR) and default reductions corrupt the expected 1798 token list. However, the list is correct for canonical LR with 1799 one exception: it will still contain any token that will not be 1800 accepted due to an error action in a later state. 1801 */ 1802 if (yytoken != YYEMPTY) 1803 { 1804 int yyn = yypact[*yyssp]; 1805 yyarg[yycount++] = yytname[yytoken]; 1806 if (!yypact_value_is_default (yyn)) 1807 { 1808 /* Start YYX at -YYN if negative to avoid negative indexes in 1809 YYCHECK. In other words, skip the first -YYN actions for 1810 this state because they are default actions. */ 1811 int yyxbegin = yyn < 0 ? -yyn : 0; 1812 /* Stay within bounds of both yycheck and yytname. */ 1813 int yychecklim = YYLAST - yyn + 1; 1814 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; 1815 int yyx; 1816 1817 for (yyx = yyxbegin; yyx < yyxend; ++yyx) 1818 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR 1819 && !yytable_value_is_error (yytable[yyx + yyn])) 1820 { 1821 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) 1822 { 1823 yycount = 1; 1824 yysize = yysize0; 1825 break; 1826 } 1827 yyarg[yycount++] = yytname[yyx]; 1828 { 1829 YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]); 1830 if (! (yysize <= yysize1 1831 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) 1832 return 2; 1833 yysize = yysize1; 1834 } 1835 } 1836 } 1837 } 1838 1839 switch (yycount) 1840 { 1841 # define YYCASE_(N, S) \ 1842 case N: \ 1843 yyformat = S; \ 1844 break 1845 YYCASE_(0, YY_("syntax error")); 1846 YYCASE_(1, YY_("syntax error, unexpected %s")); 1847 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); 1848 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); 1849 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); 1850 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); 1851 # undef YYCASE_ 1852 } 1853 1854 { 1855 YYSIZE_T yysize1 = yysize + yystrlen (yyformat); 1856 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) 1857 return 2; 1858 yysize = yysize1; 1859 } 1860 1861 if (*yymsg_alloc < yysize) 1862 { 1863 *yymsg_alloc = 2 * yysize; 1864 if (! (yysize <= *yymsg_alloc 1865 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) 1866 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; 1867 return 1; 1868 } 1869 1870 /* Avoid sprintf, as that infringes on the user's name space. 1871 Don't have undefined behavior even if the translation 1872 produced a string with the wrong number of "%s"s. */ 1873 { 1874 char *yyp = *yymsg; 1875 int yyi = 0; 1876 while ((*yyp = *yyformat) != '\0') 1877 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) 1878 { 1879 yyp += yytnamerr (yyp, yyarg[yyi++]); 1880 yyformat += 2; 1881 } 1882 else 1883 { 1884 yyp++; 1885 yyformat++; 1886 } 1887 } 1888 return 0; 1889 } 1890 #endif /* YYERROR_VERBOSE */ 1891 1892 /*-----------------------------------------------. 1893 | Release the memory associated to this symbol. | 1894 `-----------------------------------------------*/ 1895 1896 /*ARGSUSED*/ 1897 #if (defined __STDC__ || defined __C99__FUNC__ \ 1898 || defined __cplusplus || defined _MSC_VER) 1899 static void 1900 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, TParseContext* context) 1901 #else 1902 static void 1903 yydestruct (yymsg, yytype, yyvaluep, yylocationp, context) 1904 const char *yymsg; 1905 int yytype; 1906 YYSTYPE *yyvaluep; 1907 YYLTYPE *yylocationp; 1908 TParseContext* context; 1909 #endif 1910 { 1911 YYUSE (yyvaluep); 1912 YYUSE (yylocationp); 1913 YYUSE (context); 1914 1915 if (!yymsg) 1916 yymsg = "Deleting"; 1917 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); 1918 1919 switch (yytype) 1920 { 1921 1922 default: 1923 break; 1924 } 1925 } 1926 1927 1928 1929 1930 /*----------. 1931 | yyparse. | 1932 `----------*/ 1933 1934 #ifdef YYPARSE_PARAM 1935 #if (defined __STDC__ || defined __C99__FUNC__ \ 1936 || defined __cplusplus || defined _MSC_VER) 1937 int 1938 yyparse (void *YYPARSE_PARAM) 1939 #else 1940 int 1941 yyparse (YYPARSE_PARAM) 1942 void *YYPARSE_PARAM; 1943 #endif 1944 #else /* ! YYPARSE_PARAM */ 1945 #if (defined __STDC__ || defined __C99__FUNC__ \ 1946 || defined __cplusplus || defined _MSC_VER) 1947 int 1948 yyparse (TParseContext* context) 1949 #else 1950 int 1951 yyparse (context) 1952 TParseContext* context; 1953 #endif 1954 #endif 1955 { 1956 /* The lookahead symbol. */ 1957 int yychar; 1958 1959 1960 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ 1961 /* Suppress an incorrect diagnostic about yylval being uninitialized. */ 1962 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ 1963 _Pragma ("GCC diagnostic push") \ 1964 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ 1965 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") 1966 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \ 1967 _Pragma ("GCC diagnostic pop") 1968 #else 1969 /* Default value used for initialization, for pacifying older GCCs 1970 or non-GCC compilers. */ 1971 static YYSTYPE yyval_default; 1972 # define YY_INITIAL_VALUE(Value) = Value 1973 #endif 1974 static YYLTYPE yyloc_default 1975 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL 1976 = { 1, 1, 1, 1 } 1977 # endif 1978 ; 1979 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 1980 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 1981 # define YY_IGNORE_MAYBE_UNINITIALIZED_END 1982 #endif 1983 #ifndef YY_INITIAL_VALUE 1984 # define YY_INITIAL_VALUE(Value) /* Nothing. */ 1985 #endif 1986 1987 /* The semantic value of the lookahead symbol. */ 1988 YYSTYPE yylval YY_INITIAL_VALUE(yyval_default); 1989 1990 /* Location data for the lookahead symbol. */ 1991 YYLTYPE yylloc = yyloc_default; 1992 1993 1994 /* Number of syntax errors so far. */ 1995 int yynerrs; 1996 1997 int yystate; 1998 /* Number of tokens to shift before error messages enabled. */ 1999 int yyerrstatus; 2000 2001 /* The stacks and their tools: 2002 `yyss': related to states. 2003 `yyvs': related to semantic values. 2004 `yyls': related to locations. 2005 2006 Refer to the stacks through separate pointers, to allow yyoverflow 2007 to reallocate them elsewhere. */ 2008 2009 /* The state stack. */ 2010 yytype_int16 yyssa[YYINITDEPTH]; 2011 yytype_int16 *yyss; 2012 yytype_int16 *yyssp; 2013 2014 /* The semantic value stack. */ 2015 YYSTYPE yyvsa[YYINITDEPTH]; 2016 YYSTYPE *yyvs; 2017 YYSTYPE *yyvsp; 2018 2019 /* The location stack. */ 2020 YYLTYPE yylsa[YYINITDEPTH]; 2021 YYLTYPE *yyls; 2022 YYLTYPE *yylsp; 2023 2024 /* The locations where the error started and ended. */ 2025 YYLTYPE yyerror_range[3]; 2026 2027 YYSIZE_T yystacksize; 2028 2029 int yyn; 2030 int yyresult; 2031 /* Lookahead token as an internal (translated) token number. */ 2032 int yytoken = 0; 2033 /* The variables used to return semantic value and location from the 2034 action routines. */ 2035 YYSTYPE yyval; 2036 YYLTYPE yyloc; 2037 2038 #if YYERROR_VERBOSE 2039 /* Buffer for error messages, and its allocated size. */ 2040 char yymsgbuf[128]; 2041 char *yymsg = yymsgbuf; 2042 YYSIZE_T yymsg_alloc = sizeof yymsgbuf; 2043 #endif 2044 2045 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) 2046 2047 /* The number of symbols on the RHS of the reduced rule. 2048 Keep to zero when no symbol should be popped. */ 2049 int yylen = 0; 2050 2051 yyssp = yyss = yyssa; 2052 yyvsp = yyvs = yyvsa; 2053 yylsp = yyls = yylsa; 2054 yystacksize = YYINITDEPTH; 2055 2056 YYDPRINTF ((stderr, "Starting parse\n")); 2057 2058 yystate = 0; 2059 yyerrstatus = 0; 2060 yynerrs = 0; 2061 yychar = YYEMPTY; /* Cause a token to be read. */ 2062 yylsp[0] = yylloc; 2063 goto yysetstate; 2064 2065 /*------------------------------------------------------------. 2066 | yynewstate -- Push a new state, which is found in yystate. | 2067 `------------------------------------------------------------*/ 2068 yynewstate: 2069 /* In all cases, when you get here, the value and location stacks 2070 have just been pushed. So pushing a state here evens the stacks. */ 2071 yyssp++; 2072 2073 yysetstate: 2074 *yyssp = yystate; 2075 2076 if (yyss + yystacksize - 1 <= yyssp) 2077 { 2078 /* Get the current used size of the three stacks, in elements. */ 2079 YYSIZE_T yysize = yyssp - yyss + 1; 2080 2081 #ifdef yyoverflow 2082 { 2083 /* Give user a chance to reallocate the stack. Use copies of 2084 these so that the &'s don't force the real ones into 2085 memory. */ 2086 YYSTYPE *yyvs1 = yyvs; 2087 yytype_int16 *yyss1 = yyss; 2088 YYLTYPE *yyls1 = yyls; 2089 2090 /* Each stack pointer address is followed by the size of the 2091 data in use in that stack, in bytes. This used to be a 2092 conditional around just the two extra args, but that might 2093 be undefined if yyoverflow is a macro. */ 2094 yyoverflow (YY_("memory exhausted"), 2095 &yyss1, yysize * sizeof (*yyssp), 2096 &yyvs1, yysize * sizeof (*yyvsp), 2097 &yyls1, yysize * sizeof (*yylsp), 2098 &yystacksize); 2099 2100 yyls = yyls1; 2101 yyss = yyss1; 2102 yyvs = yyvs1; 2103 } 2104 #else /* no yyoverflow */ 2105 # ifndef YYSTACK_RELOCATE 2106 goto yyexhaustedlab; 2107 # else 2108 /* Extend the stack our own way. */ 2109 if (YYMAXDEPTH <= yystacksize) 2110 goto yyexhaustedlab; 2111 yystacksize *= 2; 2112 if (YYMAXDEPTH < yystacksize) 2113 yystacksize = YYMAXDEPTH; 2114 2115 { 2116 yytype_int16 *yyss1 = yyss; 2117 union yyalloc *yyptr = 2118 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); 2119 if (! yyptr) 2120 goto yyexhaustedlab; 2121 YYSTACK_RELOCATE (yyss_alloc, yyss); 2122 YYSTACK_RELOCATE (yyvs_alloc, yyvs); 2123 YYSTACK_RELOCATE (yyls_alloc, yyls); 2124 # undef YYSTACK_RELOCATE 2125 if (yyss1 != yyssa) 2126 YYSTACK_FREE (yyss1); 2127 } 2128 # endif 2129 #endif /* no yyoverflow */ 2130 2131 yyssp = yyss + yysize - 1; 2132 yyvsp = yyvs + yysize - 1; 2133 yylsp = yyls + yysize - 1; 2134 2135 YYDPRINTF ((stderr, "Stack size increased to %lu\n", 2136 (unsigned long int) yystacksize)); 2137 2138 if (yyss + yystacksize - 1 <= yyssp) 2139 YYABORT; 2140 } 2141 2142 YYDPRINTF ((stderr, "Entering state %d\n", yystate)); 2143 2144 if (yystate == YYFINAL) 2145 YYACCEPT; 2146 2147 goto yybackup; 2148 2149 /*-----------. 2150 | yybackup. | 2151 `-----------*/ 2152 yybackup: 2153 2154 /* Do appropriate processing given the current state. Read a 2155 lookahead token if we need one and don't already have one. */ 2156 2157 /* First try to decide what to do without reference to lookahead token. */ 2158 yyn = yypact[yystate]; 2159 if (yypact_value_is_default (yyn)) 2160 goto yydefault; 2161 2162 /* Not known => get a lookahead token if don't already have one. */ 2163 2164 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ 2165 if (yychar == YYEMPTY) 2166 { 2167 YYDPRINTF ((stderr, "Reading a token: ")); 2168 yychar = YYLEX; 2169 } 2170 2171 if (yychar <= YYEOF) 2172 { 2173 yychar = yytoken = YYEOF; 2174 YYDPRINTF ((stderr, "Now at end of input.\n")); 2175 } 2176 else 2177 { 2178 yytoken = YYTRANSLATE (yychar); 2179 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); 2180 } 2181 2182 /* If the proper action on seeing token YYTOKEN is to reduce or to 2183 detect an error, take that action. */ 2184 yyn += yytoken; 2185 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) 2186 goto yydefault; 2187 yyn = yytable[yyn]; 2188 if (yyn <= 0) 2189 { 2190 if (yytable_value_is_error (yyn)) 2191 goto yyerrlab; 2192 yyn = -yyn; 2193 goto yyreduce; 2194 } 2195 2196 /* Count tokens shifted since error; after three, turn off error 2197 status. */ 2198 if (yyerrstatus) 2199 yyerrstatus--; 2200 2201 /* Shift the lookahead token. */ 2202 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); 2203 2204 /* Discard the shifted token. */ 2205 yychar = YYEMPTY; 2206 2207 yystate = yyn; 2208 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 2209 *++yyvsp = yylval; 2210 YY_IGNORE_MAYBE_UNINITIALIZED_END 2211 *++yylsp = yylloc; 2212 goto yynewstate; 2213 2214 2215 /*-----------------------------------------------------------. 2216 | yydefault -- do the default action for the current state. | 2217 `-----------------------------------------------------------*/ 2218 yydefault: 2219 yyn = yydefact[yystate]; 2220 if (yyn == 0) 2221 goto yyerrlab; 2222 goto yyreduce; 2223 2224 2225 /*-----------------------------. 2226 | yyreduce -- Do a reduction. | 2227 `-----------------------------*/ 2228 yyreduce: 2229 /* yyn is the number of a rule to reduce with. */ 2230 yylen = yyr2[yyn]; 2231 2232 /* If YYLEN is nonzero, implement the default value of the action: 2233 `$$ = $1'. 2234 2235 Otherwise, the following line sets YYVAL to garbage. 2236 This behavior is undocumented and Bison 2237 users should not rely upon it. Assigning to YYVAL 2238 unconditionally makes the parser a bit smaller, and it avoids a 2239 GCC warning that YYVAL may be used uninitialized. */ 2240 yyval = yyvsp[1-yylen]; 2241 2242 /* Default location. */ 2243 YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); 2244 YY_REDUCE_PRINT (yyn); 2245 switch (yyn) 2246 { 2247 case 4: 2248 2249 { 2250 // The symbol table search was done in the lexical phase 2251 const TSymbol* symbol = (yyvsp[(1) - (1)].lex).symbol; 2252 const TVariable* variable; 2253 if (symbol == 0) { 2254 context->error((yylsp[(1) - (1)]), "undeclared identifier", (yyvsp[(1) - (1)].lex).string->c_str()); 2255 context->recover(); 2256 TType type(EbtFloat, EbpUndefined); 2257 TVariable* fakeVariable = new TVariable((yyvsp[(1) - (1)].lex).string, type); 2258 context->symbolTable.insert(*fakeVariable); 2259 variable = fakeVariable; 2260 } else { 2261 // This identifier can only be a variable type symbol 2262 if (! symbol->isVariable()) { 2263 context->error((yylsp[(1) - (1)]), "variable expected", (yyvsp[(1) - (1)].lex).string->c_str()); 2264 context->recover(); 2265 } 2266 2267 variable = static_cast<const TVariable*>(symbol); 2268 2269 if (context->symbolTable.findBuiltIn(variable->getName()) && 2270 !variable->getExtension().empty() && 2271 context->extensionErrorCheck((yylsp[(1) - (1)]), variable->getExtension())) { 2272 context->recover(); 2273 } 2274 } 2275 2276 // don't delete $1.string, it's used by error recovery, and the pool 2277 // pop will reclaim the memory 2278 2279 if (variable->getType().getQualifier() == EvqConst ) { 2280 ConstantUnion* constArray = variable->getConstPointer(); 2281 TType t(variable->getType()); 2282 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(constArray, t, (yylsp[(1) - (1)])); 2283 } else 2284 (yyval.interm.intermTypedNode) = context->intermediate.addSymbol(variable->getUniqueId(), 2285 variable->getName(), 2286 variable->getType(), 2287 (yylsp[(1) - (1)])); 2288 } 2289 break; 2290 2291 case 5: 2292 2293 { 2294 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); 2295 } 2296 break; 2297 2298 case 6: 2299 2300 { 2301 ConstantUnion *unionArray = new ConstantUnion[1]; 2302 unionArray->setIConst((yyvsp[(1) - (1)].lex).i); 2303 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yylsp[(1) - (1)])); 2304 } 2305 break; 2306 2307 case 7: 2308 2309 { 2310 ConstantUnion *unionArray = new ConstantUnion[1]; 2311 unionArray->setFConst((yyvsp[(1) - (1)].lex).f); 2312 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yylsp[(1) - (1)])); 2313 } 2314 break; 2315 2316 case 8: 2317 2318 { 2319 ConstantUnion *unionArray = new ConstantUnion[1]; 2320 unionArray->setBConst((yyvsp[(1) - (1)].lex).b); 2321 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[(1) - (1)])); 2322 } 2323 break; 2324 2325 case 9: 2326 2327 { 2328 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (3)].interm.intermTypedNode); 2329 } 2330 break; 2331 2332 case 10: 2333 2334 { 2335 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); 2336 } 2337 break; 2338 2339 case 11: 2340 2341 { 2342 (yyval.interm.intermTypedNode) = context->addIndexExpression((yyvsp[(1) - (4)].interm.intermTypedNode), (yylsp[(2) - (4)]), (yyvsp[(3) - (4)].interm.intermTypedNode)); 2343 } 2344 break; 2345 2346 case 12: 2347 2348 { 2349 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); 2350 } 2351 break; 2352 2353 case 13: 2354 2355 { 2356 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isArray()) { 2357 context->error((yylsp[(3) - (3)]), "cannot apply dot operator to an array", "."); 2358 context->recover(); 2359 } 2360 2361 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isVector()) { 2362 TVectorFields fields; 2363 if (! context->parseVectorFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yylsp[(3) - (3)]))) { 2364 fields.num = 1; 2365 fields.offsets[0] = 0; 2366 context->recover(); 2367 } 2368 2369 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) { // constant folding for vector fields 2370 (yyval.interm.intermTypedNode) = context->addConstVectorNode(fields, (yyvsp[(1) - (3)].interm.intermTypedNode), (yylsp[(3) - (3)])); 2371 if ((yyval.interm.intermTypedNode) == 0) { 2372 context->recover(); 2373 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode); 2374 } 2375 else 2376 (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())); 2377 } else { 2378 TString vectorString = *(yyvsp[(3) - (3)].lex).string; 2379 TIntermTyped* index = context->intermediate.addSwizzle(fields, (yylsp[(3) - (3)])); 2380 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpVectorSwizzle, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yylsp[(2) - (3)])); 2381 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (int) vectorString.size())); 2382 } 2383 } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isMatrix()) { 2384 TMatrixFields fields; 2385 if (! context->parseMatrixFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yylsp[(3) - (3)]))) { 2386 fields.wholeRow = false; 2387 fields.wholeCol = false; 2388 fields.row = 0; 2389 fields.col = 0; 2390 context->recover(); 2391 } 2392 2393 if (fields.wholeRow || fields.wholeCol) { 2394 context->error((yylsp[(2) - (3)]), " non-scalar fields not implemented yet", "."); 2395 context->recover(); 2396 ConstantUnion *unionArray = new ConstantUnion[1]; 2397 unionArray->setIConst(0); 2398 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yylsp[(3) - (3)])); 2399 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yylsp[(2) - (3)])); 2400 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(),EvqTemporary, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize())); 2401 } else { 2402 ConstantUnion *unionArray = new ConstantUnion[1]; 2403 unionArray->setIConst(fields.col * (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize() + fields.row); 2404 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yylsp[(3) - (3)])); 2405 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yylsp[(2) - (3)])); 2406 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision())); 2407 } 2408 } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType() == EbtStruct) { 2409 bool fieldFound = false; 2410 const TFieldList& fields = (yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getStruct()->fields(); 2411 unsigned int i; 2412 for (i = 0; i < fields.size(); ++i) { 2413 if (fields[i]->name() == *(yyvsp[(3) - (3)].lex).string) { 2414 fieldFound = true; 2415 break; 2416 } 2417 } 2418 if (fieldFound) { 2419 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) { 2420 (yyval.interm.intermTypedNode) = context->addConstStruct(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)])); 2421 if ((yyval.interm.intermTypedNode) == 0) { 2422 context->recover(); 2423 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode); 2424 } 2425 else { 2426 (yyval.interm.intermTypedNode)->setType(*fields[i]->type()); 2427 // change the qualifier of the return type, not of the structure field 2428 // as the structure definition is shared between various structures. 2429 (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConst); 2430 } 2431 } else { 2432 ConstantUnion *unionArray = new ConstantUnion[1]; 2433 unionArray->setIConst(i); 2434 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, *fields[i]->type(), (yylsp[(3) - (3)])); 2435 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirectStruct, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yylsp[(2) - (3)])); 2436 (yyval.interm.intermTypedNode)->setType(*fields[i]->type()); 2437 } 2438 } else { 2439 context->error((yylsp[(2) - (3)]), " no such field in structure", (yyvsp[(3) - (3)].lex).string->c_str()); 2440 context->recover(); 2441 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode); 2442 } 2443 } else { 2444 context->error((yylsp[(2) - (3)]), " field selection requires structure, vector, or matrix on left hand side", (yyvsp[(3) - (3)].lex).string->c_str()); 2445 context->recover(); 2446 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode); 2447 } 2448 // don't delete $3.string, it's from the pool 2449 } 2450 break; 2451 2452 case 14: 2453 2454 { 2455 if (context->lValueErrorCheck((yylsp[(2) - (2)]), "++", (yyvsp[(1) - (2)].interm.intermTypedNode))) 2456 context->recover(); 2457 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostIncrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yylsp[(2) - (2)]), context->symbolTable); 2458 if ((yyval.interm.intermTypedNode) == 0) { 2459 context->unaryOpError((yylsp[(2) - (2)]), "++", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString()); 2460 context->recover(); 2461 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode); 2462 } 2463 } 2464 break; 2465 2466 case 15: 2467 2468 { 2469 if (context->lValueErrorCheck((yylsp[(2) - (2)]), "--", (yyvsp[(1) - (2)].interm.intermTypedNode))) 2470 context->recover(); 2471 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostDecrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yylsp[(2) - (2)]), context->symbolTable); 2472 if ((yyval.interm.intermTypedNode) == 0) { 2473 context->unaryOpError((yylsp[(2) - (2)]), "--", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString()); 2474 context->recover(); 2475 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode); 2476 } 2477 } 2478 break; 2479 2480 case 16: 2481 2482 { 2483 if (context->integerErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode), "[]")) 2484 context->recover(); 2485 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); 2486 } 2487 break; 2488 2489 case 17: 2490 2491 { 2492 TFunction* fnCall = (yyvsp[(1) - (1)].interm).function; 2493 TOperator op = fnCall->getBuiltInOp(); 2494 2495 if (op != EOpNull) 2496 { 2497 // 2498 // Then this should be a constructor. 2499 // Don't go through the symbol table for constructors. 2500 // Their parameters will be verified algorithmically. 2501 // 2502 TType type(EbtVoid, EbpUndefined); // use this to get the type back 2503 if (context->constructorErrorCheck((yylsp[(1) - (1)]), (yyvsp[(1) - (1)].interm).intermNode, *fnCall, op, &type)) { 2504 (yyval.interm.intermTypedNode) = 0; 2505 } else { 2506 // 2507 // It's a constructor, of type 'type'. 2508 // 2509 (yyval.interm.intermTypedNode) = context->addConstructor((yyvsp[(1) - (1)].interm).intermNode, &type, op, fnCall, (yylsp[(1) - (1)])); 2510 } 2511 2512 if ((yyval.interm.intermTypedNode) == 0) { 2513 context->recover(); 2514 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator(0, op, (yylsp[(1) - (1)])); 2515 } 2516 (yyval.interm.intermTypedNode)->setType(type); 2517 } else { 2518 // 2519 // Not a constructor. Find it in the symbol table. 2520 // 2521 const TFunction* fnCandidate; 2522 bool builtIn; 2523 fnCandidate = context->findFunction((yylsp[(1) - (1)]), fnCall, &builtIn); 2524 if (fnCandidate) { 2525 // 2526 // A declared function. 2527 // 2528 if (builtIn && !fnCandidate->getExtension().empty() && 2529 context->extensionErrorCheck((yylsp[(1) - (1)]), fnCandidate->getExtension())) { 2530 context->recover(); 2531 } 2532 op = fnCandidate->getBuiltInOp(); 2533 if (builtIn && op != EOpNull) { 2534 // 2535 // A function call mapped to a built-in operation. 2536 // 2537 if (fnCandidate->getParamCount() == 1) { 2538 // 2539 // Treat it like a built-in unary operator. 2540 // 2541 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(op, (yyvsp[(1) - (1)].interm).intermNode, (yylsp[(1) - (1)]), context->symbolTable); 2542 if ((yyval.interm.intermTypedNode) == 0) { 2543 std::stringstream extraInfoStream; 2544 extraInfoStream << "built in unary operator function. Type: " << static_cast<TIntermTyped*>((yyvsp[(1) - (1)].interm).intermNode)->getCompleteString(); 2545 std::string extraInfo = extraInfoStream.str(); 2546 context->error((yyvsp[(1) - (1)].interm).intermNode->getLine(), " wrong operand type", "Internal Error", extraInfo.c_str()); 2547 YYERROR; 2548 } 2549 } else { 2550 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, op, (yylsp[(1) - (1)])); 2551 } 2552 } else { 2553 // This is a real function call 2554 2555 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, EOpFunctionCall, (yylsp[(1) - (1)])); 2556 (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType()); 2557 2558 // this is how we know whether the given function is a builtIn function or a user defined function 2559 // if builtIn == false, it's a userDefined -> could be an overloaded builtIn function also 2560 // if builtIn == true, it's definitely a builtIn function with EOpNull 2561 if (!builtIn) 2562 (yyval.interm.intermTypedNode)->getAsAggregate()->setUserDefined(); 2563 (yyval.interm.intermTypedNode)->getAsAggregate()->setName(fnCandidate->getMangledName()); 2564 2565 TQualifier qual; 2566 for (size_t i = 0; i < fnCandidate->getParamCount(); ++i) { 2567 qual = fnCandidate->getParam(i).type->getQualifier(); 2568 if (qual == EvqOut || qual == EvqInOut) { 2569 if (context->lValueErrorCheck((yyval.interm.intermTypedNode)->getLine(), "assign", (yyval.interm.intermTypedNode)->getAsAggregate()->getSequence()[i]->getAsTyped())) { 2570 context->error((yyvsp[(1) - (1)].interm).intermNode->getLine(), "Constant value cannot be passed for 'out' or 'inout' parameters.", "Error"); 2571 context->recover(); 2572 } 2573 } 2574 } 2575 } 2576 (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType()); 2577 } else { 2578 // error message was put out by PaFindFunction() 2579 // Put on a dummy node for error recovery 2580 ConstantUnion *unionArray = new ConstantUnion[1]; 2581 unionArray->setFConst(0.0f); 2582 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yylsp[(1) - (1)])); 2583 context->recover(); 2584 } 2585 } 2586 delete fnCall; 2587 } 2588 break; 2589 2590 case 18: 2591 2592 { 2593 (yyval.interm) = (yyvsp[(1) - (1)].interm); 2594 } 2595 break; 2596 2597 case 19: 2598 2599 { 2600 context->error((yylsp[(3) - (3)]), "methods are not supported", ""); 2601 context->recover(); 2602 (yyval.interm) = (yyvsp[(3) - (3)].interm); 2603 } 2604 break; 2605 2606 case 20: 2607 2608 { 2609 (yyval.interm) = (yyvsp[(1) - (2)].interm); 2610 } 2611 break; 2612 2613 case 21: 2614 2615 { 2616 (yyval.interm) = (yyvsp[(1) - (2)].interm); 2617 } 2618 break; 2619 2620 case 22: 2621 2622 { 2623 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function); 2624 (yyval.interm).intermNode = 0; 2625 } 2626 break; 2627 2628 case 23: 2629 2630 { 2631 (yyval.interm).function = (yyvsp[(1) - (1)].interm.function); 2632 (yyval.interm).intermNode = 0; 2633 } 2634 break; 2635 2636 case 24: 2637 2638 { 2639 TParameter param = { 0, new TType((yyvsp[(2) - (2)].interm.intermTypedNode)->getType()) }; 2640 (yyvsp[(1) - (2)].interm.function)->addParameter(param); 2641 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function); 2642 (yyval.interm).intermNode = (yyvsp[(2) - (2)].interm.intermTypedNode); 2643 } 2644 break; 2645 2646 case 25: 2647 2648 { 2649 TParameter param = { 0, new TType((yyvsp[(3) - (3)].interm.intermTypedNode)->getType()) }; 2650 (yyvsp[(1) - (3)].interm).function->addParameter(param); 2651 (yyval.interm).function = (yyvsp[(1) - (3)].interm).function; 2652 (yyval.interm).intermNode = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermNode, (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)])); 2653 } 2654 break; 2655 2656 case 26: 2657 2658 { 2659 (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function); 2660 } 2661 break; 2662 2663 case 27: 2664 2665 { 2666 // 2667 // Constructor 2668 // 2669 TOperator op = EOpNull; 2670 if ((yyvsp[(1) - (1)].interm.type).userDef) { 2671 op = EOpConstructStruct; 2672 } else { 2673 switch ((yyvsp[(1) - (1)].interm.type).type) { 2674 case EbtFloat: 2675 if ((yyvsp[(1) - (1)].interm.type).matrix) { 2676 switch((yyvsp[(1) - (1)].interm.type).size) { 2677 case 2: op = EOpConstructMat2; break; 2678 case 3: op = EOpConstructMat3; break; 2679 case 4: op = EOpConstructMat4; break; 2680 } 2681 } else { 2682 switch((yyvsp[(1) - (1)].interm.type).size) { 2683 case 1: op = EOpConstructFloat; break; 2684 case 2: op = EOpConstructVec2; break; 2685 case 3: op = EOpConstructVec3; break; 2686 case 4: op = EOpConstructVec4; break; 2687 } 2688 } 2689 break; 2690 case EbtInt: 2691 switch((yyvsp[(1) - (1)].interm.type).size) { 2692 case 1: op = EOpConstructInt; break; 2693 case 2: op = EOpConstructIVec2; break; 2694 case 3: op = EOpConstructIVec3; break; 2695 case 4: op = EOpConstructIVec4; break; 2696 } 2697 break; 2698 case EbtBool: 2699 switch((yyvsp[(1) - (1)].interm.type).size) { 2700 case 1: op = EOpConstructBool; break; 2701 case 2: op = EOpConstructBVec2; break; 2702 case 3: op = EOpConstructBVec3; break; 2703 case 4: op = EOpConstructBVec4; break; 2704 } 2705 break; 2706 default: break; 2707 } 2708 if (op == EOpNull) { 2709 context->error((yylsp[(1) - (1)]), "cannot construct this type", getBasicString((yyvsp[(1) - (1)].interm.type).type)); 2710 context->recover(); 2711 (yyvsp[(1) - (1)].interm.type).type = EbtFloat; 2712 op = EOpConstructFloat; 2713 } 2714 } 2715 TString tempString; 2716 TType type((yyvsp[(1) - (1)].interm.type)); 2717 TFunction *function = new TFunction(&tempString, type, op); 2718 (yyval.interm.function) = function; 2719 } 2720 break; 2721 2722 case 28: 2723 2724 { 2725 if (context->reservedErrorCheck((yylsp[(1) - (1)]), *(yyvsp[(1) - (1)].lex).string)) 2726 context->recover(); 2727 TType type(EbtVoid, EbpUndefined); 2728 TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type); 2729 (yyval.interm.function) = function; 2730 } 2731 break; 2732 2733 case 29: 2734 2735 { 2736 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); 2737 } 2738 break; 2739 2740 case 30: 2741 2742 { 2743 if (context->lValueErrorCheck((yylsp[(1) - (2)]), "++", (yyvsp[(2) - (2)].interm.intermTypedNode))) 2744 context->recover(); 2745 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreIncrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yylsp[(1) - (2)]), context->symbolTable); 2746 if ((yyval.interm.intermTypedNode) == 0) { 2747 context->unaryOpError((yylsp[(1) - (2)]), "++", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString()); 2748 context->recover(); 2749 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode); 2750 } 2751 } 2752 break; 2753 2754 case 31: 2755 2756 { 2757 if (context->lValueErrorCheck((yylsp[(1) - (2)]), "--", (yyvsp[(2) - (2)].interm.intermTypedNode))) 2758 context->recover(); 2759 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreDecrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yylsp[(1) - (2)]), context->symbolTable); 2760 if ((yyval.interm.intermTypedNode) == 0) { 2761 context->unaryOpError((yylsp[(1) - (2)]), "--", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString()); 2762 context->recover(); 2763 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode); 2764 } 2765 } 2766 break; 2767 2768 case 32: 2769 2770 { 2771 if ((yyvsp[(1) - (2)].interm).op != EOpNull) { 2772 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath((yyvsp[(1) - (2)].interm).op, (yyvsp[(2) - (2)].interm.intermTypedNode), (yylsp[(1) - (2)]), context->symbolTable); 2773 if ((yyval.interm.intermTypedNode) == 0) { 2774 const char* errorOp = ""; 2775 switch((yyvsp[(1) - (2)].interm).op) { 2776 case EOpNegative: errorOp = "-"; break; 2777 case EOpLogicalNot: errorOp = "!"; break; 2778 default: break; 2779 } 2780 context->unaryOpError((yylsp[(1) - (2)]), errorOp, (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString()); 2781 context->recover(); 2782 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode); 2783 } 2784 } else 2785 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode); 2786 } 2787 break; 2788 2789 case 33: 2790 2791 { (yyval.interm).op = EOpNull; } 2792 break; 2793 2794 case 34: 2795 2796 { (yyval.interm).op = EOpNegative; } 2797 break; 2798 2799 case 35: 2800 2801 { (yyval.interm).op = EOpLogicalNot; } 2802 break; 2803 2804 case 36: 2805 2806 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } 2807 break; 2808 2809 case 37: 2810 2811 { 2812 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpMul, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable); 2813 if ((yyval.interm.intermTypedNode) == 0) { 2814 context->binaryOpError((yylsp[(2) - (3)]), "*", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); 2815 context->recover(); 2816 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode); 2817 } 2818 } 2819 break; 2820 2821 case 38: 2822 2823 { 2824 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpDiv, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable); 2825 if ((yyval.interm.intermTypedNode) == 0) { 2826 context->binaryOpError((yylsp[(2) - (3)]), "/", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); 2827 context->recover(); 2828 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode); 2829 } 2830 } 2831 break; 2832 2833 case 39: 2834 2835 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } 2836 break; 2837 2838 case 40: 2839 2840 { 2841 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpAdd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable); 2842 if ((yyval.interm.intermTypedNode) == 0) { 2843 context->binaryOpError((yylsp[(2) - (3)]), "+", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); 2844 context->recover(); 2845 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode); 2846 } 2847 } 2848 break; 2849 2850 case 41: 2851 2852 { 2853 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpSub, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable); 2854 if ((yyval.interm.intermTypedNode) == 0) { 2855 context->binaryOpError((yylsp[(2) - (3)]), "-", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); 2856 context->recover(); 2857 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode); 2858 } 2859 } 2860 break; 2861 2862 case 42: 2863 2864 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } 2865 break; 2866 2867 case 43: 2868 2869 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } 2870 break; 2871 2872 case 44: 2873 2874 { 2875 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable); 2876 if ((yyval.interm.intermTypedNode) == 0) { 2877 context->binaryOpError((yylsp[(2) - (3)]), "<", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); 2878 context->recover(); 2879 ConstantUnion *unionArray = new ConstantUnion[1]; 2880 unionArray->setBConst(false); 2881 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[(2) - (3)])); 2882 } 2883 } 2884 break; 2885 2886 case 45: 2887 2888 { 2889 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable); 2890 if ((yyval.interm.intermTypedNode) == 0) { 2891 context->binaryOpError((yylsp[(2) - (3)]), ">", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); 2892 context->recover(); 2893 ConstantUnion *unionArray = new ConstantUnion[1]; 2894 unionArray->setBConst(false); 2895 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[(2) - (3)])); 2896 } 2897 } 2898 break; 2899 2900 case 46: 2901 2902 { 2903 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable); 2904 if ((yyval.interm.intermTypedNode) == 0) { 2905 context->binaryOpError((yylsp[(2) - (3)]), "<=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); 2906 context->recover(); 2907 ConstantUnion *unionArray = new ConstantUnion[1]; 2908 unionArray->setBConst(false); 2909 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[(2) - (3)])); 2910 } 2911 } 2912 break; 2913 2914 case 47: 2915 2916 { 2917 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable); 2918 if ((yyval.interm.intermTypedNode) == 0) { 2919 context->binaryOpError((yylsp[(2) - (3)]), ">=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); 2920 context->recover(); 2921 ConstantUnion *unionArray = new ConstantUnion[1]; 2922 unionArray->setBConst(false); 2923 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[(2) - (3)])); 2924 } 2925 } 2926 break; 2927 2928 case 48: 2929 2930 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } 2931 break; 2932 2933 case 49: 2934 2935 { 2936 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable); 2937 if ((yyval.interm.intermTypedNode) == 0) { 2938 context->binaryOpError((yylsp[(2) - (3)]), "==", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); 2939 context->recover(); 2940 ConstantUnion *unionArray = new ConstantUnion[1]; 2941 unionArray->setBConst(false); 2942 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[(2) - (3)])); 2943 } 2944 } 2945 break; 2946 2947 case 50: 2948 2949 { 2950 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpNotEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable); 2951 if ((yyval.interm.intermTypedNode) == 0) { 2952 context->binaryOpError((yylsp[(2) - (3)]), "!=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); 2953 context->recover(); 2954 ConstantUnion *unionArray = new ConstantUnion[1]; 2955 unionArray->setBConst(false); 2956 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[(2) - (3)])); 2957 } 2958 } 2959 break; 2960 2961 case 51: 2962 2963 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } 2964 break; 2965 2966 case 52: 2967 2968 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } 2969 break; 2970 2971 case 53: 2972 2973 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } 2974 break; 2975 2976 case 54: 2977 2978 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } 2979 break; 2980 2981 case 55: 2982 2983 { 2984 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalAnd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable); 2985 if ((yyval.interm.intermTypedNode) == 0) { 2986 context->binaryOpError((yylsp[(2) - (3)]), "&&", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); 2987 context->recover(); 2988 ConstantUnion *unionArray = new ConstantUnion[1]; 2989 unionArray->setBConst(false); 2990 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[(2) - (3)])); 2991 } 2992 } 2993 break; 2994 2995 case 56: 2996 2997 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } 2998 break; 2999 3000 case 57: 3001 3002 { 3003 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalXor, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable); 3004 if ((yyval.interm.intermTypedNode) == 0) { 3005 context->binaryOpError((yylsp[(2) - (3)]), "^^", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); 3006 context->recover(); 3007 ConstantUnion *unionArray = new ConstantUnion[1]; 3008 unionArray->setBConst(false); 3009 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[(2) - (3)])); 3010 } 3011 } 3012 break; 3013 3014 case 58: 3015 3016 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } 3017 break; 3018 3019 case 59: 3020 3021 { 3022 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalOr, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable); 3023 if ((yyval.interm.intermTypedNode) == 0) { 3024 context->binaryOpError((yylsp[(2) - (3)]), "||", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); 3025 context->recover(); 3026 ConstantUnion *unionArray = new ConstantUnion[1]; 3027 unionArray->setBConst(false); 3028 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[(2) - (3)])); 3029 } 3030 } 3031 break; 3032 3033 case 60: 3034 3035 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } 3036 break; 3037 3038 case 61: 3039 3040 { 3041 if (context->boolErrorCheck((yylsp[(2) - (5)]), (yyvsp[(1) - (5)].interm.intermTypedNode))) 3042 context->recover(); 3043 3044 (yyval.interm.intermTypedNode) = context->intermediate.addSelection((yyvsp[(1) - (5)].interm.intermTypedNode), (yyvsp[(3) - (5)].interm.intermTypedNode), (yyvsp[(5) - (5)].interm.intermTypedNode), (yylsp[(2) - (5)])); 3045 if ((yyvsp[(3) - (5)].interm.intermTypedNode)->getType() != (yyvsp[(5) - (5)].interm.intermTypedNode)->getType()) 3046 (yyval.interm.intermTypedNode) = 0; 3047 3048 if ((yyval.interm.intermTypedNode) == 0) { 3049 context->binaryOpError((yylsp[(2) - (5)]), ":", (yyvsp[(3) - (5)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(5) - (5)].interm.intermTypedNode)->getCompleteString()); 3050 context->recover(); 3051 (yyval.interm.intermTypedNode) = (yyvsp[(5) - (5)].interm.intermTypedNode); 3052 } 3053 } 3054 break; 3055 3056 case 62: 3057 3058 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } 3059 break; 3060 3061 case 63: 3062 3063 { 3064 if (context->lValueErrorCheck((yylsp[(2) - (3)]), "assign", (yyvsp[(1) - (3)].interm.intermTypedNode))) 3065 context->recover(); 3066 (yyval.interm.intermTypedNode) = context->intermediate.addAssign((yyvsp[(2) - (3)].interm).op, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)])); 3067 if ((yyval.interm.intermTypedNode) == 0) { 3068 context->assignError((yylsp[(2) - (3)]), "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); 3069 context->recover(); 3070 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode); 3071 } 3072 } 3073 break; 3074 3075 case 64: 3076 3077 { (yyval.interm).op = EOpAssign; } 3078 break; 3079 3080 case 65: 3081 3082 { (yyval.interm).op = EOpMulAssign; } 3083 break; 3084 3085 case 66: 3086 3087 { (yyval.interm).op = EOpDivAssign; } 3088 break; 3089 3090 case 67: 3091 3092 { (yyval.interm).op = EOpAddAssign; } 3093 break; 3094 3095 case 68: 3096 3097 { (yyval.interm).op = EOpSubAssign; } 3098 break; 3099 3100 case 69: 3101 3102 { 3103 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); 3104 } 3105 break; 3106 3107 case 70: 3108 3109 { 3110 (yyval.interm.intermTypedNode) = context->intermediate.addComma((yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)])); 3111 if ((yyval.interm.intermTypedNode) == 0) { 3112 context->binaryOpError((yylsp[(2) - (3)]), ",", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); 3113 context->recover(); 3114 (yyval.interm.intermTypedNode) = (yyvsp[(3) - (3)].interm.intermTypedNode); 3115 } 3116 } 3117 break; 3118 3119 case 71: 3120 3121 { 3122 if (context->constErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode))) 3123 context->recover(); 3124 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); 3125 } 3126 break; 3127 3128 case 72: 3129 3130 { 3131 TFunction &function = *((yyvsp[(1) - (2)].interm).function); 3132 3133 TIntermAggregate *prototype = new TIntermAggregate; 3134 prototype->setType(function.getReturnType()); 3135 prototype->setName(function.getName()); 3136 3137 for (size_t i = 0; i < function.getParamCount(); i++) 3138 { 3139 const TParameter ¶m = function.getParam(i); 3140 if (param.name != 0) 3141 { 3142 TVariable variable(param.name, *param.type); 3143 3144 prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(variable.getUniqueId(), variable.getName(), variable.getType(), (yylsp[(1) - (2)])), (yylsp[(1) - (2)])); 3145 } 3146 else 3147 { 3148 prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(0, "", *param.type, (yylsp[(1) - (2)])), (yylsp[(1) - (2)])); 3149 } 3150 } 3151 3152 prototype->setOp(EOpPrototype); 3153 (yyval.interm.intermNode) = prototype; 3154 3155 context->symbolTable.pop(); 3156 } 3157 break; 3158 3159 case 73: 3160 3161 { 3162 if ((yyvsp[(1) - (2)].interm).intermAggregate) 3163 (yyvsp[(1) - (2)].interm).intermAggregate->setOp(EOpDeclaration); 3164 (yyval.interm.intermNode) = (yyvsp[(1) - (2)].interm).intermAggregate; 3165 } 3166 break; 3167 3168 case 74: 3169 3170 { 3171 if (((yyvsp[(2) - (4)].interm.precision) == EbpHigh) && (context->shaderType == SH_FRAGMENT_SHADER) && !context->fragmentPrecisionHigh) { 3172 context->error((yylsp[(1) - (4)]), "precision is not supported in fragment shader", "highp"); 3173 context->recover(); 3174 } 3175 if (!context->symbolTable.setDefaultPrecision( (yyvsp[(3) - (4)].interm.type), (yyvsp[(2) - (4)].interm.precision) )) { 3176 context->error((yylsp[(1) - (4)]), "illegal type argument for default precision qualifier", getBasicString((yyvsp[(3) - (4)].interm.type).type)); 3177 context->recover(); 3178 } 3179 (yyval.interm.intermNode) = 0; 3180 } 3181 break; 3182 3183 case 75: 3184 3185 { 3186 // 3187 // Multiple declarations of the same function are allowed. 3188 // 3189 // If this is a definition, the definition production code will check for redefinitions 3190 // (we don't know at this point if it's a definition or not). 3191 // 3192 // Redeclarations are allowed. But, return types and parameter qualifiers must match. 3193 // 3194 TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find((yyvsp[(1) - (2)].interm.function)->getMangledName())); 3195 if (prevDec) { 3196 if (prevDec->getReturnType() != (yyvsp[(1) - (2)].interm.function)->getReturnType()) { 3197 context->error((yylsp[(2) - (2)]), "overloaded functions must have the same return type", (yyvsp[(1) - (2)].interm.function)->getReturnType().getBasicString()); 3198 context->recover(); 3199 } 3200 for (size_t i = 0; i < prevDec->getParamCount(); ++i) { 3201 if (prevDec->getParam(i).type->getQualifier() != (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifier()) { 3202 context->error((yylsp[(2) - (2)]), "overloaded functions must have the same parameter qualifiers", (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifierString()); 3203 context->recover(); 3204 } 3205 } 3206 } 3207 3208 // 3209 // Check for previously declared variables using the same name. 3210 // 3211 TSymbol *prevSym = context->symbolTable.find((yyvsp[(1) - (2)].interm.function)->getName()); 3212 if (prevSym) 3213 { 3214 if (!prevSym->isFunction()) 3215 { 3216 context->error((yylsp[(2) - (2)]), "redefinition", (yyvsp[(1) - (2)].interm.function)->getName().c_str(), "function"); 3217 context->recover(); 3218 } 3219 } 3220 else 3221 { 3222 // Insert the unmangled name to detect potential future redefinition as a variable. 3223 context->symbolTable.getOuterLevel()->insert((yyvsp[(1) - (2)].interm.function)->getName(), *(yyvsp[(1) - (2)].interm.function)); 3224 } 3225 3226 // 3227 // If this is a redeclaration, it could also be a definition, 3228 // in which case, we want to use the variable names from this one, and not the one that's 3229 // being redeclared. So, pass back up this declaration, not the one in the symbol table. 3230 // 3231 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function); 3232 3233 // We're at the inner scope level of the function's arguments and body statement. 3234 // Add the function prototype to the surrounding scope instead. 3235 context->symbolTable.getOuterLevel()->insert(*(yyval.interm).function); 3236 } 3237 break; 3238 3239 case 76: 3240 3241 { 3242 (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function); 3243 } 3244 break; 3245 3246 case 77: 3247 3248 { 3249 (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function); 3250 } 3251 break; 3252 3253 case 78: 3254 3255 { 3256 // Add the parameter 3257 (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function); 3258 if ((yyvsp[(2) - (2)].interm).param.type->getBasicType() != EbtVoid) 3259 (yyvsp[(1) - (2)].interm.function)->addParameter((yyvsp[(2) - (2)].interm).param); 3260 else 3261 delete (yyvsp[(2) - (2)].interm).param.type; 3262 } 3263 break; 3264 3265 case 79: 3266 3267 { 3268 // 3269 // Only first parameter of one-parameter functions can be void 3270 // The check for named parameters not being void is done in parameter_declarator 3271 // 3272 if ((yyvsp[(3) - (3)].interm).param.type->getBasicType() == EbtVoid) { 3273 // 3274 // This parameter > first is void 3275 // 3276 context->error((yylsp[(2) - (3)]), "cannot be an argument type except for '(void)'", "void"); 3277 context->recover(); 3278 delete (yyvsp[(3) - (3)].interm).param.type; 3279 } else { 3280 // Add the parameter 3281 (yyval.interm.function) = (yyvsp[(1) - (3)].interm.function); 3282 (yyvsp[(1) - (3)].interm.function)->addParameter((yyvsp[(3) - (3)].interm).param); 3283 } 3284 } 3285 break; 3286 3287 case 80: 3288 3289 { 3290 if ((yyvsp[(1) - (3)].interm.type).qualifier != EvqGlobal && (yyvsp[(1) - (3)].interm.type).qualifier != EvqTemporary) { 3291 context->error((yylsp[(2) - (3)]), "no qualifiers allowed for function return", getQualifierString((yyvsp[(1) - (3)].interm.type).qualifier)); 3292 context->recover(); 3293 } 3294 // make sure a sampler is not involved as well... 3295 if (context->structQualifierErrorCheck((yylsp[(2) - (3)]), (yyvsp[(1) - (3)].interm.type))) 3296 context->recover(); 3297 3298 // Add the function as a prototype after parsing it (we do not support recursion) 3299 TFunction *function; 3300 TType type((yyvsp[(1) - (3)].interm.type)); 3301 function = new TFunction((yyvsp[(2) - (3)].lex).string, type); 3302 (yyval.interm.function) = function; 3303 3304 context->symbolTable.push(); 3305 } 3306 break; 3307 3308 case 81: 3309 3310 { 3311 if ((yyvsp[(1) - (2)].interm.type).type == EbtVoid) { 3312 context->error((yylsp[(2) - (2)]), "illegal use of type 'void'", (yyvsp[(2) - (2)].lex).string->c_str()); 3313 context->recover(); 3314 } 3315 if (context->reservedErrorCheck((yylsp[(2) - (2)]), *(yyvsp[(2) - (2)].lex).string)) 3316 context->recover(); 3317 TParameter param = {(yyvsp[(2) - (2)].lex).string, new TType((yyvsp[(1) - (2)].interm.type))}; 3318 (yyval.interm).param = param; 3319 } 3320 break; 3321 3322 case 82: 3323 3324 { 3325 // Check that we can make an array out of this type 3326 if (context->arrayTypeErrorCheck((yylsp[(3) - (5)]), (yyvsp[(1) - (5)].interm.type))) 3327 context->recover(); 3328 3329 if (context->reservedErrorCheck((yylsp[(2) - (5)]), *(yyvsp[(2) - (5)].lex).string)) 3330 context->recover(); 3331 3332 int size; 3333 if (context->arraySizeErrorCheck((yylsp[(3) - (5)]), (yyvsp[(4) - (5)].interm.intermTypedNode), size)) 3334 context->recover(); 3335 (yyvsp[(1) - (5)].interm.type).setArray(true, size); 3336 3337 TType* type = new TType((yyvsp[(1) - (5)].interm.type)); 3338 TParameter param = { (yyvsp[(2) - (5)].lex).string, type }; 3339 (yyval.interm).param = param; 3340 } 3341 break; 3342 3343 case 83: 3344 3345 { 3346 (yyval.interm) = (yyvsp[(3) - (3)].interm); 3347 if (context->paramErrorCheck((yylsp[(3) - (3)]), (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type)) 3348 context->recover(); 3349 } 3350 break; 3351 3352 case 84: 3353 3354 { 3355 (yyval.interm) = (yyvsp[(2) - (2)].interm); 3356 if (context->parameterSamplerErrorCheck((yylsp[(2) - (2)]), (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type)) 3357 context->recover(); 3358 if (context->paramErrorCheck((yylsp[(2) - (2)]), EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type)) 3359 context->recover(); 3360 } 3361 break; 3362 3363 case 85: 3364 3365 { 3366 (yyval.interm) = (yyvsp[(3) - (3)].interm); 3367 if (context->paramErrorCheck((yylsp[(3) - (3)]), (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type)) 3368 context->recover(); 3369 } 3370 break; 3371 3372 case 86: 3373 3374 { 3375 (yyval.interm) = (yyvsp[(2) - (2)].interm); 3376 if (context->parameterSamplerErrorCheck((yylsp[(2) - (2)]), (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type)) 3377 context->recover(); 3378 if (context->paramErrorCheck((yylsp[(2) - (2)]), EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type)) 3379 context->recover(); 3380 } 3381 break; 3382 3383 case 87: 3384 3385 { 3386 (yyval.interm.qualifier) = EvqIn; 3387 } 3388 break; 3389 3390 case 88: 3391 3392 { 3393 (yyval.interm.qualifier) = EvqIn; 3394 } 3395 break; 3396 3397 case 89: 3398 3399 { 3400 (yyval.interm.qualifier) = EvqOut; 3401 } 3402 break; 3403 3404 case 90: 3405 3406 { 3407 (yyval.interm.qualifier) = EvqInOut; 3408 } 3409 break; 3410 3411 case 91: 3412 3413 { 3414 TParameter param = { 0, new TType((yyvsp[(1) - (1)].interm.type)) }; 3415 (yyval.interm).param = param; 3416 } 3417 break; 3418 3419 case 92: 3420 3421 { 3422 (yyval.interm) = (yyvsp[(1) - (1)].interm); 3423 } 3424 break; 3425 3426 case 93: 3427 3428 { 3429 if ((yyvsp[(1) - (3)].interm).type.type == EbtInvariant && !(yyvsp[(3) - (3)].lex).symbol) 3430 { 3431 context->error((yylsp[(3) - (3)]), "undeclared identifier declared as invariant", (yyvsp[(3) - (3)].lex).string->c_str()); 3432 context->recover(); 3433 } 3434 3435 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(3) - (3)].lex).string, TType((yyvsp[(1) - (3)].interm).type), (yylsp[(3) - (3)])); 3436 (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermNode, symbol, (yylsp[(3) - (3)])); 3437 3438 if (context->structQualifierErrorCheck((yylsp[(3) - (3)]), (yyval.interm).type)) 3439 context->recover(); 3440 3441 if (context->nonInitConstErrorCheck((yylsp[(3) - (3)]), *(yyvsp[(3) - (3)].lex).string, (yyval.interm).type, false)) 3442 context->recover(); 3443 3444 TVariable* variable = 0; 3445 if (context->nonInitErrorCheck((yylsp[(3) - (3)]), *(yyvsp[(3) - (3)].lex).string, (yyval.interm).type, variable)) 3446 context->recover(); 3447 if (symbol && variable) 3448 symbol->setId(variable->getUniqueId()); 3449 } 3450 break; 3451 3452 case 94: 3453 3454 { 3455 if (context->structQualifierErrorCheck((yylsp[(3) - (5)]), (yyvsp[(1) - (5)].interm).type)) 3456 context->recover(); 3457 3458 if (context->nonInitConstErrorCheck((yylsp[(3) - (5)]), *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, true)) 3459 context->recover(); 3460 3461 (yyval.interm) = (yyvsp[(1) - (5)].interm); 3462 3463 if (context->arrayTypeErrorCheck((yylsp[(4) - (5)]), (yyvsp[(1) - (5)].interm).type) || context->arrayQualifierErrorCheck((yylsp[(4) - (5)]), (yyvsp[(1) - (5)].interm).type)) 3464 context->recover(); 3465 else { 3466 (yyvsp[(1) - (5)].interm).type.setArray(true); 3467 TVariable* variable; 3468 if (context->arrayErrorCheck((yylsp[(4) - (5)]), *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, variable)) 3469 context->recover(); 3470 } 3471 } 3472 break; 3473 3474 case 95: 3475 3476 { 3477 if (context->structQualifierErrorCheck((yylsp[(3) - (6)]), (yyvsp[(1) - (6)].interm).type)) 3478 context->recover(); 3479 3480 if (context->nonInitConstErrorCheck((yylsp[(3) - (6)]), *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type, true)) 3481 context->recover(); 3482 3483 (yyval.interm) = (yyvsp[(1) - (6)].interm); 3484 3485 if (context->arrayTypeErrorCheck((yylsp[(4) - (6)]), (yyvsp[(1) - (6)].interm).type) || context->arrayQualifierErrorCheck((yylsp[(4) - (6)]), (yyvsp[(1) - (6)].interm).type)) 3486 context->recover(); 3487 else { 3488 int size; 3489 if (context->arraySizeErrorCheck((yylsp[(4) - (6)]), (yyvsp[(5) - (6)].interm.intermTypedNode), size)) 3490 context->recover(); 3491 (yyvsp[(1) - (6)].interm).type.setArray(true, size); 3492 TVariable* variable = 0; 3493 if (context->arrayErrorCheck((yylsp[(4) - (6)]), *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type, variable)) 3494 context->recover(); 3495 TType type = TType((yyvsp[(1) - (6)].interm).type); 3496 type.setArraySize(size); 3497 (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (6)].interm).intermNode, context->intermediate.addSymbol(variable ? variable->getUniqueId() : 0, *(yyvsp[(3) - (6)].lex).string, type, (yylsp[(3) - (6)])), (yylsp[(3) - (6)])); 3498 } 3499 } 3500 break; 3501 3502 case 96: 3503 3504 { 3505 if (context->structQualifierErrorCheck((yylsp[(3) - (5)]), (yyvsp[(1) - (5)].interm).type)) 3506 context->recover(); 3507 3508 (yyval.interm) = (yyvsp[(1) - (5)].interm); 3509 3510 TIntermNode* intermNode; 3511 if (!context->executeInitializer((yylsp[(3) - (5)]), *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, (yyvsp[(5) - (5)].interm.intermTypedNode), intermNode)) { 3512 // 3513 // build the intermediate representation 3514 // 3515 if (intermNode) 3516 (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (5)].interm).intermNode, intermNode, (yylsp[(4) - (5)])); 3517 else 3518 (yyval.interm).intermAggregate = (yyvsp[(1) - (5)].interm).intermAggregate; 3519 } else { 3520 context->recover(); 3521 (yyval.interm).intermAggregate = 0; 3522 } 3523 } 3524 break; 3525 3526 case 97: 3527 3528 { 3529 (yyval.interm).type = (yyvsp[(1) - (1)].interm.type); 3530 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(context->intermediate.addSymbol(0, "", TType((yyvsp[(1) - (1)].interm.type)), (yylsp[(1) - (1)])), (yylsp[(1) - (1)])); 3531 } 3532 break; 3533 3534 case 98: 3535 3536 { 3537 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyvsp[(1) - (2)].interm.type)), (yylsp[(2) - (2)])); 3538 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yylsp[(2) - (2)])); 3539 3540 if (context->structQualifierErrorCheck((yylsp[(2) - (2)]), (yyval.interm).type)) 3541 context->recover(); 3542 3543 if (context->nonInitConstErrorCheck((yylsp[(2) - (2)]), *(yyvsp[(2) - (2)].lex).string, (yyval.interm).type, false)) 3544 context->recover(); 3545 3546 (yyval.interm).type = (yyvsp[(1) - (2)].interm.type); 3547 3548 TVariable* variable = 0; 3549 if (context->nonInitErrorCheck((yylsp[(2) - (2)]), *(yyvsp[(2) - (2)].lex).string, (yyval.interm).type, variable)) 3550 context->recover(); 3551 if (variable && symbol) 3552 symbol->setId(variable->getUniqueId()); 3553 } 3554 break; 3555 3556 case 99: 3557 3558 { 3559 context->error((yylsp[(2) - (4)]), "unsized array declarations not supported", (yyvsp[(2) - (4)].lex).string->c_str()); 3560 context->recover(); 3561 3562 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (4)].lex).string, TType((yyvsp[(1) - (4)].interm.type)), (yylsp[(2) - (4)])); 3563 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yylsp[(2) - (4)])); 3564 (yyval.interm).type = (yyvsp[(1) - (4)].interm.type); 3565 } 3566 break; 3567 3568 case 100: 3569 3570 { 3571 TType type = TType((yyvsp[(1) - (5)].interm.type)); 3572 int size; 3573 if (context->arraySizeErrorCheck((yylsp[(2) - (5)]), (yyvsp[(4) - (5)].interm.intermTypedNode), size)) 3574 context->recover(); 3575 type.setArraySize(size); 3576 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (5)].lex).string, type, (yylsp[(2) - (5)])); 3577 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yylsp[(2) - (5)])); 3578 3579 if (context->structQualifierErrorCheck((yylsp[(2) - (5)]), (yyvsp[(1) - (5)].interm.type))) 3580 context->recover(); 3581 3582 if (context->nonInitConstErrorCheck((yylsp[(2) - (5)]), *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type), true)) 3583 context->recover(); 3584 3585 (yyval.interm).type = (yyvsp[(1) - (5)].interm.type); 3586 3587 if (context->arrayTypeErrorCheck((yylsp[(3) - (5)]), (yyvsp[(1) - (5)].interm.type)) || context->arrayQualifierErrorCheck((yylsp[(3) - (5)]), (yyvsp[(1) - (5)].interm.type))) 3588 context->recover(); 3589 else { 3590 int size; 3591 if (context->arraySizeErrorCheck((yylsp[(3) - (5)]), (yyvsp[(4) - (5)].interm.intermTypedNode), size)) 3592 context->recover(); 3593 3594 (yyvsp[(1) - (5)].interm.type).setArray(true, size); 3595 TVariable* variable = 0; 3596 if (context->arrayErrorCheck((yylsp[(3) - (5)]), *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type), variable)) 3597 context->recover(); 3598 if (variable && symbol) 3599 symbol->setId(variable->getUniqueId()); 3600 } 3601 } 3602 break; 3603 3604 case 101: 3605 3606 { 3607 if (context->structQualifierErrorCheck((yylsp[(2) - (4)]), (yyvsp[(1) - (4)].interm.type))) 3608 context->recover(); 3609 3610 (yyval.interm).type = (yyvsp[(1) - (4)].interm.type); 3611 3612 TIntermNode* intermNode; 3613 if (!context->executeInitializer((yylsp[(2) - (4)]), *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode)) { 3614 // 3615 // Build intermediate representation 3616 // 3617 if(intermNode) 3618 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(intermNode, (yylsp[(3) - (4)])); 3619 else 3620 (yyval.interm).intermAggregate = 0; 3621 } else { 3622 context->recover(); 3623 (yyval.interm).intermAggregate = 0; 3624 } 3625 } 3626 break; 3627 3628 case 102: 3629 3630 { 3631 VERTEX_ONLY("invariant declaration", (yylsp[(1) - (2)])); 3632 if (context->globalErrorCheck((yylsp[(1) - (2)]), context->symbolTable.atGlobalLevel(), "invariant varying")) 3633 context->recover(); 3634 (yyval.interm).type.setBasic(EbtInvariant, EvqInvariantVaryingOut, (yylsp[(2) - (2)])); 3635 if (!(yyvsp[(2) - (2)].lex).symbol) 3636 { 3637 context->error((yylsp[(2) - (2)]), "undeclared identifier declared as invariant", (yyvsp[(2) - (2)].lex).string->c_str()); 3638 context->recover(); 3639 3640 (yyval.interm).intermAggregate = 0; 3641 } 3642 else 3643 { 3644 TIntermSymbol *symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyval.interm).type), (yylsp[(2) - (2)])); 3645 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yylsp[(2) - (2)])); 3646 } 3647 } 3648 break; 3649 3650 case 103: 3651 3652 { 3653 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type); 3654 3655 if ((yyvsp[(1) - (1)].interm.type).array) { 3656 context->error((yylsp[(1) - (1)]), "not supported", "first-class array"); 3657 context->recover(); 3658 (yyvsp[(1) - (1)].interm.type).setArray(false); 3659 } 3660 } 3661 break; 3662 3663 case 104: 3664 3665 { 3666 if ((yyvsp[(2) - (2)].interm.type).array) { 3667 context->error((yylsp[(2) - (2)]), "not supported", "first-class array"); 3668 context->recover(); 3669 (yyvsp[(2) - (2)].interm.type).setArray(false); 3670 } 3671 3672 if ((yyvsp[(1) - (2)].interm.type).qualifier == EvqAttribute && 3673 ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) { 3674 context->error((yylsp[(2) - (2)]), "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier)); 3675 context->recover(); 3676 } 3677 if (((yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingIn || (yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingOut) && 3678 ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) { 3679 context->error((yylsp[(2) - (2)]), "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier)); 3680 context->recover(); 3681 } 3682 (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type); 3683 (yyval.interm.type).qualifier = (yyvsp[(1) - (2)].interm.type).qualifier; 3684 } 3685 break; 3686 3687 case 105: 3688 3689 { 3690 (yyval.interm.type).setBasic(EbtVoid, EvqConst, (yylsp[(1) - (1)])); 3691 } 3692 break; 3693 3694 case 106: 3695 3696 { 3697 VERTEX_ONLY("attribute", (yylsp[(1) - (1)])); 3698 if (context->globalErrorCheck((yylsp[(1) - (1)]), context->symbolTable.atGlobalLevel(), "attribute")) 3699 context->recover(); 3700 (yyval.interm.type).setBasic(EbtVoid, EvqAttribute, (yylsp[(1) - (1)])); 3701 } 3702 break; 3703 3704 case 107: 3705 3706 { 3707 if (context->globalErrorCheck((yylsp[(1) - (1)]), context->symbolTable.atGlobalLevel(), "varying")) 3708 context->recover(); 3709 if (context->shaderType == SH_VERTEX_SHADER) 3710 (yyval.interm.type).setBasic(EbtVoid, EvqVaryingOut, (yylsp[(1) - (1)])); 3711 else 3712 (yyval.interm.type).setBasic(EbtVoid, EvqVaryingIn, (yylsp[(1) - (1)])); 3713 } 3714 break; 3715 3716 case 108: 3717 3718 { 3719 if (context->globalErrorCheck((yylsp[(1) - (2)]), context->symbolTable.atGlobalLevel(), "invariant varying")) 3720 context->recover(); 3721 if (context->shaderType == SH_VERTEX_SHADER) 3722 (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingOut, (yylsp[(1) - (2)])); 3723 else 3724 (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingIn, (yylsp[(1) - (2)])); 3725 } 3726 break; 3727 3728 case 109: 3729 3730 { 3731 if (context->globalErrorCheck((yylsp[(1) - (1)]), context->symbolTable.atGlobalLevel(), "uniform")) 3732 context->recover(); 3733 (yyval.interm.type).setBasic(EbtVoid, EvqUniform, (yylsp[(1) - (1)])); 3734 } 3735 break; 3736 3737 case 110: 3738 3739 { 3740 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type); 3741 3742 if ((yyval.interm.type).precision == EbpUndefined) { 3743 (yyval.interm.type).precision = context->symbolTable.getDefaultPrecision((yyvsp[(1) - (1)].interm.type).type); 3744 if (context->precisionErrorCheck((yylsp[(1) - (1)]), (yyval.interm.type).precision, (yyvsp[(1) - (1)].interm.type).type)) { 3745 context->recover(); 3746 } 3747 } 3748 } 3749 break; 3750 3751 case 111: 3752 3753 { 3754 (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type); 3755 (yyval.interm.type).precision = (yyvsp[(1) - (2)].interm.precision); 3756 } 3757 break; 3758 3759 case 112: 3760 3761 { 3762 (yyval.interm.precision) = EbpHigh; 3763 } 3764 break; 3765 3766 case 113: 3767 3768 { 3769 (yyval.interm.precision) = EbpMedium; 3770 } 3771 break; 3772 3773 case 114: 3774 3775 { 3776 (yyval.interm.precision) = EbpLow; 3777 } 3778 break; 3779 3780 case 115: 3781 3782 { 3783 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type); 3784 } 3785 break; 3786 3787 case 116: 3788 3789 { 3790 (yyval.interm.type) = (yyvsp[(1) - (4)].interm.type); 3791 3792 if (context->arrayTypeErrorCheck((yylsp[(2) - (4)]), (yyvsp[(1) - (4)].interm.type))) 3793 context->recover(); 3794 else { 3795 int size; 3796 if (context->arraySizeErrorCheck((yylsp[(2) - (4)]), (yyvsp[(3) - (4)].interm.intermTypedNode), size)) 3797 context->recover(); 3798 (yyval.interm.type).setArray(true, size); 3799 } 3800 } 3801 break; 3802 3803 case 117: 3804 3805 { 3806 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; 3807 (yyval.interm.type).setBasic(EbtVoid, qual, (yylsp[(1) - (1)])); 3808 } 3809 break; 3810 3811 case 118: 3812 3813 { 3814 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; 3815 (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)])); 3816 } 3817 break; 3818 3819 case 119: 3820 3821 { 3822 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; 3823 (yyval.interm.type).setBasic(EbtInt, qual, (yylsp[(1) - (1)])); 3824 } 3825 break; 3826 3827 case 120: 3828 3829 { 3830 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; 3831 (yyval.interm.type).setBasic(EbtBool, qual, (yylsp[(1) - (1)])); 3832 } 3833 break; 3834 3835 case 121: 3836 3837 { 3838 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; 3839 (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)])); 3840 (yyval.interm.type).setAggregate(2); 3841 } 3842 break; 3843 3844 case 122: 3845 3846 { 3847 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; 3848 (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)])); 3849 (yyval.interm.type).setAggregate(3); 3850 } 3851 break; 3852 3853 case 123: 3854 3855 { 3856 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; 3857 (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)])); 3858 (yyval.interm.type).setAggregate(4); 3859 } 3860 break; 3861 3862 case 124: 3863 3864 { 3865 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; 3866 (yyval.interm.type).setBasic(EbtBool, qual, (yylsp[(1) - (1)])); 3867 (yyval.interm.type).setAggregate(2); 3868 } 3869 break; 3870 3871 case 125: 3872 3873 { 3874 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; 3875 (yyval.interm.type).setBasic(EbtBool, qual, (yylsp[(1) - (1)])); 3876 (yyval.interm.type).setAggregate(3); 3877 } 3878 break; 3879 3880 case 126: 3881 3882 { 3883 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; 3884 (yyval.interm.type).setBasic(EbtBool, qual, (yylsp[(1) - (1)])); 3885 (yyval.interm.type).setAggregate(4); 3886 } 3887 break; 3888 3889 case 127: 3890 3891 { 3892 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; 3893 (yyval.interm.type).setBasic(EbtInt, qual, (yylsp[(1) - (1)])); 3894 (yyval.interm.type).setAggregate(2); 3895 } 3896 break; 3897 3898 case 128: 3899 3900 { 3901 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; 3902 (yyval.interm.type).setBasic(EbtInt, qual, (yylsp[(1) - (1)])); 3903 (yyval.interm.type).setAggregate(3); 3904 } 3905 break; 3906 3907 case 129: 3908 3909 { 3910 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; 3911 (yyval.interm.type).setBasic(EbtInt, qual, (yylsp[(1) - (1)])); 3912 (yyval.interm.type).setAggregate(4); 3913 } 3914 break; 3915 3916 case 130: 3917 3918 { 3919 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; 3920 (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)])); 3921 (yyval.interm.type).setAggregate(2, true); 3922 } 3923 break; 3924 3925 case 131: 3926 3927 { 3928 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; 3929 (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)])); 3930 (yyval.interm.type).setAggregate(3, true); 3931 } 3932 break; 3933 3934 case 132: 3935 3936 { 3937 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; 3938 (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)])); 3939 (yyval.interm.type).setAggregate(4, true); 3940 } 3941 break; 3942 3943 case 133: 3944 3945 { 3946 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; 3947 (yyval.interm.type).setBasic(EbtSampler2D, qual, (yylsp[(1) - (1)])); 3948 } 3949 break; 3950 3951 case 134: 3952 3953 { 3954 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; 3955 (yyval.interm.type).setBasic(EbtSamplerCube, qual, (yylsp[(1) - (1)])); 3956 } 3957 break; 3958 3959 case 135: 3960 3961 { 3962 if (!context->supportsExtension("GL_OES_EGL_image_external")) { 3963 context->error((yylsp[(1) - (1)]), "unsupported type", "samplerExternalOES"); 3964 context->recover(); 3965 } 3966 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; 3967 (yyval.interm.type).setBasic(EbtSamplerExternalOES, qual, (yylsp[(1) - (1)])); 3968 } 3969 break; 3970 3971 case 136: 3972 3973 { 3974 if (!context->supportsExtension("GL_ARB_texture_rectangle")) { 3975 context->error((yylsp[(1) - (1)]), "unsupported type", "sampler2DRect"); 3976 context->recover(); 3977 } 3978 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; 3979 (yyval.interm.type).setBasic(EbtSampler2DRect, qual, (yylsp[(1) - (1)])); 3980 } 3981 break; 3982 3983 case 137: 3984 3985 { 3986 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type); 3987 (yyval.interm.type).qualifier = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; 3988 } 3989 break; 3990 3991 case 138: 3992 3993 { 3994 // 3995 // This is for user defined type names. The lexical phase looked up the 3996 // type. 3997 // 3998 TType& structure = static_cast<TVariable*>((yyvsp[(1) - (1)].lex).symbol)->getType(); 3999 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; 4000 (yyval.interm.type).setBasic(EbtStruct, qual, (yylsp[(1) - (1)])); 4001 (yyval.interm.type).userDef = &structure; 4002 } 4003 break; 4004 4005 case 139: 4006 4007 { if (context->enterStructDeclaration((yylsp[(2) - (3)]), *(yyvsp[(2) - (3)].lex).string)) context->recover(); } 4008 break; 4009 4010 case 140: 4011 4012 { 4013 if (context->reservedErrorCheck((yylsp[(2) - (6)]), *(yyvsp[(2) - (6)].lex).string)) 4014 context->recover(); 4015 4016 TType* structure = new TType(new TStructure((yyvsp[(2) - (6)].lex).string, (yyvsp[(5) - (6)].interm.fieldList))); 4017 TVariable* userTypeDef = new TVariable((yyvsp[(2) - (6)].lex).string, *structure, true); 4018 if (! context->symbolTable.insert(*userTypeDef)) { 4019 context->error((yylsp[(2) - (6)]), "redefinition", (yyvsp[(2) - (6)].lex).string->c_str(), "struct"); 4020 context->recover(); 4021 } 4022 (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yylsp[(1) - (6)])); 4023 (yyval.interm.type).userDef = structure; 4024 context->exitStructDeclaration(); 4025 } 4026 break; 4027 4028 case 141: 4029 4030 { if (context->enterStructDeclaration((yylsp[(2) - (2)]), *(yyvsp[(2) - (2)].lex).string)) context->recover(); } 4031 break; 4032 4033 case 142: 4034 4035 { 4036 TType* structure = new TType(new TStructure(NewPoolTString(""), (yyvsp[(4) - (5)].interm.fieldList))); 4037 (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yylsp[(1) - (5)])); 4038 (yyval.interm.type).userDef = structure; 4039 context->exitStructDeclaration(); 4040 } 4041 break; 4042 4043 case 143: 4044 4045 { 4046 (yyval.interm.fieldList) = (yyvsp[(1) - (1)].interm.fieldList); 4047 } 4048 break; 4049 4050 case 144: 4051 4052 { 4053 (yyval.interm.fieldList) = (yyvsp[(1) - (2)].interm.fieldList); 4054 for (size_t i = 0; i < (yyvsp[(2) - (2)].interm.fieldList)->size(); ++i) { 4055 TField* field = (*(yyvsp[(2) - (2)].interm.fieldList))[i]; 4056 for (size_t j = 0; j < (yyval.interm.fieldList)->size(); ++j) { 4057 if ((*(yyval.interm.fieldList))[j]->name() == field->name()) { 4058 context->error((yylsp[(2) - (2)]), "duplicate field name in structure:", "struct", field->name().c_str()); 4059 context->recover(); 4060 } 4061 } 4062 (yyval.interm.fieldList)->push_back(field); 4063 } 4064 } 4065 break; 4066 4067 case 145: 4068 4069 { 4070 (yyval.interm.fieldList) = (yyvsp[(2) - (3)].interm.fieldList); 4071 4072 if (context->voidErrorCheck((yylsp[(1) - (3)]), (*(yyvsp[(2) - (3)].interm.fieldList))[0]->name(), (yyvsp[(1) - (3)].interm.type))) { 4073 context->recover(); 4074 } 4075 for (unsigned int i = 0; i < (yyval.interm.fieldList)->size(); ++i) { 4076 // 4077 // Careful not to replace already known aspects of type, like array-ness 4078 // 4079 TType* type = (*(yyval.interm.fieldList))[i]->type(); 4080 type->setBasicType((yyvsp[(1) - (3)].interm.type).type); 4081 type->setNominalSize((yyvsp[(1) - (3)].interm.type).size); 4082 type->setMatrix((yyvsp[(1) - (3)].interm.type).matrix); 4083 type->setPrecision((yyvsp[(1) - (3)].interm.type).precision); 4084 4085 // don't allow arrays of arrays 4086 if (type->isArray()) { 4087 if (context->arrayTypeErrorCheck((yylsp[(1) - (3)]), (yyvsp[(1) - (3)].interm.type))) 4088 context->recover(); 4089 } 4090 if ((yyvsp[(1) - (3)].interm.type).array) 4091 type->setArraySize((yyvsp[(1) - (3)].interm.type).arraySize); 4092 if ((yyvsp[(1) - (3)].interm.type).userDef) 4093 type->setStruct((yyvsp[(1) - (3)].interm.type).userDef->getStruct()); 4094 4095 if (context->structNestingErrorCheck((yylsp[(1) - (3)]), *(*(yyval.interm.fieldList))[i])) 4096 context->recover(); 4097 } 4098 } 4099 break; 4100 4101 case 146: 4102 4103 { 4104 (yyval.interm.fieldList) = NewPoolTFieldList(); 4105 (yyval.interm.fieldList)->push_back((yyvsp[(1) - (1)].interm.field)); 4106 } 4107 break; 4108 4109 case 147: 4110 4111 { 4112 (yyval.interm.fieldList)->push_back((yyvsp[(3) - (3)].interm.field)); 4113 } 4114 break; 4115 4116 case 148: 4117 4118 { 4119 if (context->reservedErrorCheck((yylsp[(1) - (1)]), *(yyvsp[(1) - (1)].lex).string)) 4120 context->recover(); 4121 4122 TType* type = new TType(EbtVoid, EbpUndefined); 4123 (yyval.interm.field) = new TField(type, (yyvsp[(1) - (1)].lex).string); 4124 } 4125 break; 4126 4127 case 149: 4128 4129 { 4130 if (context->reservedErrorCheck((yylsp[(1) - (4)]), *(yyvsp[(1) - (4)].lex).string)) 4131 context->recover(); 4132 4133 TType* type = new TType(EbtVoid, EbpUndefined); 4134 int size = 0; 4135 if (context->arraySizeErrorCheck((yylsp[(3) - (4)]), (yyvsp[(3) - (4)].interm.intermTypedNode), size)) 4136 context->recover(); 4137 type->setArraySize(size); 4138 4139 (yyval.interm.field) = new TField(type, (yyvsp[(1) - (4)].lex).string); 4140 } 4141 break; 4142 4143 case 150: 4144 4145 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } 4146 break; 4147 4148 case 151: 4149 4150 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } 4151 break; 4152 4153 case 152: 4154 4155 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermAggregate); } 4156 break; 4157 4158 case 153: 4159 4160 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } 4161 break; 4162 4163 case 154: 4164 4165 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } 4166 break; 4167 4168 case 155: 4169 4170 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } 4171 break; 4172 4173 case 156: 4174 4175 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } 4176 break; 4177 4178 case 157: 4179 4180 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } 4181 break; 4182 4183 case 158: 4184 4185 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } 4186 break; 4187 4188 case 159: 4189 4190 { (yyval.interm.intermAggregate) = 0; } 4191 break; 4192 4193 case 160: 4194 4195 { context->symbolTable.push(); } 4196 break; 4197 4198 case 161: 4199 4200 { context->symbolTable.pop(); } 4201 break; 4202 4203 case 162: 4204 4205 { 4206 if ((yyvsp[(3) - (5)].interm.intermAggregate) != 0) { 4207 (yyvsp[(3) - (5)].interm.intermAggregate)->setOp(EOpSequence); 4208 (yyvsp[(3) - (5)].interm.intermAggregate)->setLine((yyloc)); 4209 } 4210 (yyval.interm.intermAggregate) = (yyvsp[(3) - (5)].interm.intermAggregate); 4211 } 4212 break; 4213 4214 case 163: 4215 4216 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } 4217 break; 4218 4219 case 164: 4220 4221 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } 4222 break; 4223 4224 case 165: 4225 4226 { context->symbolTable.push(); } 4227 break; 4228 4229 case 166: 4230 4231 { context->symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[(2) - (2)].interm.intermNode); } 4232 break; 4233 4234 case 167: 4235 4236 { context->symbolTable.push(); } 4237 break; 4238 4239 case 168: 4240 4241 { context->symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[(2) - (2)].interm.intermNode); } 4242 break; 4243 4244 case 169: 4245 4246 { 4247 (yyval.interm.intermNode) = 0; 4248 } 4249 break; 4250 4251 case 170: 4252 4253 { 4254 if ((yyvsp[(2) - (3)].interm.intermAggregate)) { 4255 (yyvsp[(2) - (3)].interm.intermAggregate)->setOp(EOpSequence); 4256 (yyvsp[(2) - (3)].interm.intermAggregate)->setLine((yyloc)); 4257 } 4258 (yyval.interm.intermNode) = (yyvsp[(2) - (3)].interm.intermAggregate); 4259 } 4260 break; 4261 4262 case 171: 4263 4264 { 4265 (yyval.interm.intermAggregate) = context->intermediate.makeAggregate((yyvsp[(1) - (1)].interm.intermNode), (yyloc)); 4266 } 4267 break; 4268 4269 case 172: 4270 4271 { 4272 (yyval.interm.intermAggregate) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermAggregate), (yyvsp[(2) - (2)].interm.intermNode), (yyloc)); 4273 } 4274 break; 4275 4276 case 173: 4277 4278 { (yyval.interm.intermNode) = 0; } 4279 break; 4280 4281 case 174: 4282 4283 { (yyval.interm.intermNode) = static_cast<TIntermNode*>((yyvsp[(1) - (2)].interm.intermTypedNode)); } 4284 break; 4285 4286 case 175: 4287 4288 { 4289 if (context->boolErrorCheck((yylsp[(1) - (5)]), (yyvsp[(3) - (5)].interm.intermTypedNode))) 4290 context->recover(); 4291 (yyval.interm.intermNode) = context->intermediate.addSelection((yyvsp[(3) - (5)].interm.intermTypedNode), (yyvsp[(5) - (5)].interm.nodePair), (yylsp[(1) - (5)])); 4292 } 4293 break; 4294 4295 case 176: 4296 4297 { 4298 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermNode); 4299 (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermNode); 4300 } 4301 break; 4302 4303 case 177: 4304 4305 { 4306 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (1)].interm.intermNode); 4307 (yyval.interm.nodePair).node2 = 0; 4308 } 4309 break; 4310 4311 case 178: 4312 4313 { 4314 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); 4315 if (context->boolErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)->getLine(), (yyvsp[(1) - (1)].interm.intermTypedNode))) 4316 context->recover(); 4317 } 4318 break; 4319 4320 case 179: 4321 4322 { 4323 TIntermNode* intermNode; 4324 if (context->structQualifierErrorCheck((yylsp[(2) - (4)]), (yyvsp[(1) - (4)].interm.type))) 4325 context->recover(); 4326 if (context->boolErrorCheck((yylsp[(2) - (4)]), (yyvsp[(1) - (4)].interm.type))) 4327 context->recover(); 4328 4329 if (!context->executeInitializer((yylsp[(2) - (4)]), *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode)) 4330 (yyval.interm.intermTypedNode) = (yyvsp[(4) - (4)].interm.intermTypedNode); 4331 else { 4332 context->recover(); 4333 (yyval.interm.intermTypedNode) = 0; 4334 } 4335 } 4336 break; 4337 4338 case 180: 4339 4340 { context->symbolTable.push(); ++context->loopNestingLevel; } 4341 break; 4342 4343 case 181: 4344 4345 { 4346 context->symbolTable.pop(); 4347 (yyval.interm.intermNode) = context->intermediate.addLoop(ELoopWhile, 0, (yyvsp[(4) - (6)].interm.intermTypedNode), 0, (yyvsp[(6) - (6)].interm.intermNode), (yylsp[(1) - (6)])); 4348 --context->loopNestingLevel; 4349 } 4350 break; 4351 4352 case 182: 4353 4354 { ++context->loopNestingLevel; } 4355 break; 4356 4357 case 183: 4358 4359 { 4360 if (context->boolErrorCheck((yylsp[(8) - (8)]), (yyvsp[(6) - (8)].interm.intermTypedNode))) 4361 context->recover(); 4362 4363 (yyval.interm.intermNode) = context->intermediate.addLoop(ELoopDoWhile, 0, (yyvsp[(6) - (8)].interm.intermTypedNode), 0, (yyvsp[(3) - (8)].interm.intermNode), (yylsp[(4) - (8)])); 4364 --context->loopNestingLevel; 4365 } 4366 break; 4367 4368 case 184: 4369 4370 { context->symbolTable.push(); ++context->loopNestingLevel; } 4371 break; 4372 4373 case 185: 4374 4375 { 4376 context->symbolTable.pop(); 4377 (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), (yylsp[(1) - (7)])); 4378 --context->loopNestingLevel; 4379 } 4380 break; 4381 4382 case 186: 4383 4384 { 4385 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); 4386 } 4387 break; 4388 4389 case 187: 4390 4391 { 4392 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); 4393 } 4394 break; 4395 4396 case 188: 4397 4398 { 4399 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); 4400 } 4401 break; 4402 4403 case 189: 4404 4405 { 4406 (yyval.interm.intermTypedNode) = 0; 4407 } 4408 break; 4409 4410 case 190: 4411 4412 { 4413 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (2)].interm.intermTypedNode); 4414 (yyval.interm.nodePair).node2 = 0; 4415 } 4416 break; 4417 4418 case 191: 4419 4420 { 4421 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermTypedNode); 4422 (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermTypedNode); 4423 } 4424 break; 4425 4426 case 192: 4427 4428 { 4429 if (context->loopNestingLevel <= 0) { 4430 context->error((yylsp[(1) - (2)]), "continue statement only allowed in loops", ""); 4431 context->recover(); 4432 } 4433 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpContinue, (yylsp[(1) - (2)])); 4434 } 4435 break; 4436 4437 case 193: 4438 4439 { 4440 if (context->loopNestingLevel <= 0) { 4441 context->error((yylsp[(1) - (2)]), "break statement only allowed in loops", ""); 4442 context->recover(); 4443 } 4444 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpBreak, (yylsp[(1) - (2)])); 4445 } 4446 break; 4447 4448 case 194: 4449 4450 { 4451 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yylsp[(1) - (2)])); 4452 if (context->currentFunctionType->getBasicType() != EbtVoid) { 4453 context->error((yylsp[(1) - (2)]), "non-void function must return a value", "return"); 4454 context->recover(); 4455 } 4456 } 4457 break; 4458 4459 case 195: 4460 4461 { 4462 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(2) - (3)].interm.intermTypedNode), (yylsp[(1) - (3)])); 4463 context->functionReturnsValue = true; 4464 if (context->currentFunctionType->getBasicType() == EbtVoid) { 4465 context->error((yylsp[(1) - (3)]), "void function cannot return a value", "return"); 4466 context->recover(); 4467 } else if (*(context->currentFunctionType) != (yyvsp[(2) - (3)].interm.intermTypedNode)->getType()) { 4468 context->error((yylsp[(1) - (3)]), "function return is not matching type:", "return"); 4469 context->recover(); 4470 } 4471 } 4472 break; 4473 4474 case 196: 4475 4476 { 4477 FRAG_ONLY("discard", (yylsp[(1) - (2)])); 4478 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpKill, (yylsp[(1) - (2)])); 4479 } 4480 break; 4481 4482 case 197: 4483 4484 { 4485 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); 4486 context->treeRoot = (yyval.interm.intermNode); 4487 } 4488 break; 4489 4490 case 198: 4491 4492 { 4493 (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermNode), (yyvsp[(2) - (2)].interm.intermNode), (yyloc)); 4494 context->treeRoot = (yyval.interm.intermNode); 4495 } 4496 break; 4497 4498 case 199: 4499 4500 { 4501 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); 4502 } 4503 break; 4504 4505 case 200: 4506 4507 { 4508 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); 4509 } 4510 break; 4511 4512 case 201: 4513 4514 { 4515 TFunction* function = (yyvsp[(1) - (1)].interm).function; 4516 4517 const TSymbol *builtIn = context->symbolTable.findBuiltIn(function->getMangledName()); 4518 4519 if (builtIn) 4520 { 4521 context->error((yylsp[(1) - (1)]), "built-in functions cannot be redefined", function->getName().c_str()); 4522 context->recover(); 4523 } 4524 4525 TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find(function->getMangledName())); 4526 // 4527 // Note: 'prevDec' could be 'function' if this is the first time we've seen function 4528 // as it would have just been put in the symbol table. Otherwise, we're looking up 4529 // an earlier occurance. 4530 // 4531 if (prevDec->isDefined()) { 4532 // 4533 // Then this function already has a body. 4534 // 4535 context->error((yylsp[(1) - (1)]), "function already has a body", function->getName().c_str()); 4536 context->recover(); 4537 } 4538 prevDec->setDefined(); 4539 4540 // 4541 // Raise error message if main function takes any parameters or return anything other than void 4542 // 4543 if (function->getName() == "main") { 4544 if (function->getParamCount() > 0) { 4545 context->error((yylsp[(1) - (1)]), "function cannot take any parameter(s)", function->getName().c_str()); 4546 context->recover(); 4547 } 4548 if (function->getReturnType().getBasicType() != EbtVoid) { 4549 context->error((yylsp[(1) - (1)]), "", function->getReturnType().getBasicString(), "main function cannot return a value"); 4550 context->recover(); 4551 } 4552 } 4553 4554 // 4555 // Remember the return type for later checking for RETURN statements. 4556 // 4557 context->currentFunctionType = &(prevDec->getReturnType()); 4558 context->functionReturnsValue = false; 4559 4560 // 4561 // Insert parameters into the symbol table. 4562 // If the parameter has no name, it's not an error, just don't insert it 4563 // (could be used for unused args). 4564 // 4565 // Also, accumulate the list of parameters into the HIL, so lower level code 4566 // knows where to find parameters. 4567 // 4568 TIntermAggregate* paramNodes = new TIntermAggregate; 4569 for (size_t i = 0; i < function->getParamCount(); i++) { 4570 const TParameter& param = function->getParam(i); 4571 if (param.name != 0) { 4572 TVariable *variable = new TVariable(param.name, *param.type); 4573 // 4574 // Insert the parameters with name in the symbol table. 4575 // 4576 if (! context->symbolTable.insert(*variable)) { 4577 context->error((yylsp[(1) - (1)]), "redefinition", variable->getName().c_str()); 4578 context->recover(); 4579 delete variable; 4580 } 4581 4582 // 4583 // Add the parameter to the HIL 4584 // 4585 paramNodes = context->intermediate.growAggregate( 4586 paramNodes, 4587 context->intermediate.addSymbol(variable->getUniqueId(), 4588 variable->getName(), 4589 variable->getType(), 4590 (yylsp[(1) - (1)])), 4591 (yylsp[(1) - (1)])); 4592 } else { 4593 paramNodes = context->intermediate.growAggregate(paramNodes, context->intermediate.addSymbol(0, "", *param.type, (yylsp[(1) - (1)])), (yylsp[(1) - (1)])); 4594 } 4595 } 4596 context->intermediate.setAggregateOperator(paramNodes, EOpParameters, (yylsp[(1) - (1)])); 4597 (yyvsp[(1) - (1)].interm).intermAggregate = paramNodes; 4598 context->loopNestingLevel = 0; 4599 } 4600 break; 4601 4602 case 202: 4603 4604 { 4605 //?? Check that all paths return a value if return type != void ? 4606 // May be best done as post process phase on intermediate code 4607 if (context->currentFunctionType->getBasicType() != EbtVoid && ! context->functionReturnsValue) { 4608 context->error((yylsp[(1) - (3)]), "function does not return a value:", "", (yyvsp[(1) - (3)].interm).function->getName().c_str()); 4609 context->recover(); 4610 } 4611 4612 (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermAggregate, (yyvsp[(3) - (3)].interm.intermNode), (yyloc)); 4613 context->intermediate.setAggregateOperator((yyval.interm.intermNode), EOpFunction, (yylsp[(1) - (3)])); 4614 (yyval.interm.intermNode)->getAsAggregate()->setName((yyvsp[(1) - (3)].interm).function->getMangledName().c_str()); 4615 (yyval.interm.intermNode)->getAsAggregate()->setType((yyvsp[(1) - (3)].interm).function->getReturnType()); 4616 4617 // store the pragma information for debug and optimize and other vendor specific 4618 // information. This information can be queried from the parse tree 4619 (yyval.interm.intermNode)->getAsAggregate()->setOptimize(context->pragma().optimize); 4620 (yyval.interm.intermNode)->getAsAggregate()->setDebug(context->pragma().debug); 4621 4622 context->symbolTable.pop(); 4623 } 4624 break; 4625 4626 4627 4628 default: break; 4629 } 4630 /* User semantic actions sometimes alter yychar, and that requires 4631 that yytoken be updated with the new translation. We take the 4632 approach of translating immediately before every use of yytoken. 4633 One alternative is translating here after every semantic action, 4634 but that translation would be missed if the semantic action invokes 4635 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or 4636 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an 4637 incorrect destructor might then be invoked immediately. In the 4638 case of YYERROR or YYBACKUP, subsequent parser actions might lead 4639 to an incorrect destructor call or verbose syntax error message 4640 before the lookahead is translated. */ 4641 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); 4642 4643 YYPOPSTACK (yylen); 4644 yylen = 0; 4645 YY_STACK_PRINT (yyss, yyssp); 4646 4647 *++yyvsp = yyval; 4648 *++yylsp = yyloc; 4649 4650 /* Now `shift' the result of the reduction. Determine what state 4651 that goes to, based on the state we popped back to and the rule 4652 number reduced by. */ 4653 4654 yyn = yyr1[yyn]; 4655 4656 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; 4657 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) 4658 yystate = yytable[yystate]; 4659 else 4660 yystate = yydefgoto[yyn - YYNTOKENS]; 4661 4662 goto yynewstate; 4663 4664 4665 /*------------------------------------. 4666 | yyerrlab -- here on detecting error | 4667 `------------------------------------*/ 4668 yyerrlab: 4669 /* Make sure we have latest lookahead translation. See comments at 4670 user semantic actions for why this is necessary. */ 4671 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); 4672 4673 /* If not already recovering from an error, report this error. */ 4674 if (!yyerrstatus) 4675 { 4676 ++yynerrs; 4677 #if ! YYERROR_VERBOSE 4678 yyerror (&yylloc, context, YY_("syntax error")); 4679 #else 4680 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ 4681 yyssp, yytoken) 4682 { 4683 char const *yymsgp = YY_("syntax error"); 4684 int yysyntax_error_status; 4685 yysyntax_error_status = YYSYNTAX_ERROR; 4686 if (yysyntax_error_status == 0) 4687 yymsgp = yymsg; 4688 else if (yysyntax_error_status == 1) 4689 { 4690 if (yymsg != yymsgbuf) 4691 YYSTACK_FREE (yymsg); 4692 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); 4693 if (!yymsg) 4694 { 4695 yymsg = yymsgbuf; 4696 yymsg_alloc = sizeof yymsgbuf; 4697 yysyntax_error_status = 2; 4698 } 4699 else 4700 { 4701 yysyntax_error_status = YYSYNTAX_ERROR; 4702 yymsgp = yymsg; 4703 } 4704 } 4705 yyerror (&yylloc, context, yymsgp); 4706 if (yysyntax_error_status == 2) 4707 goto yyexhaustedlab; 4708 } 4709 # undef YYSYNTAX_ERROR 4710 #endif 4711 } 4712 4713 yyerror_range[1] = yylloc; 4714 4715 if (yyerrstatus == 3) 4716 { 4717 /* If just tried and failed to reuse lookahead token after an 4718 error, discard it. */ 4719 4720 if (yychar <= YYEOF) 4721 { 4722 /* Return failure if at end of input. */ 4723 if (yychar == YYEOF) 4724 YYABORT; 4725 } 4726 else 4727 { 4728 yydestruct ("Error: discarding", 4729 yytoken, &yylval, &yylloc, context); 4730 yychar = YYEMPTY; 4731 } 4732 } 4733 4734 /* Else will try to reuse lookahead token after shifting the error 4735 token. */ 4736 goto yyerrlab1; 4737 4738 4739 /*---------------------------------------------------. 4740 | yyerrorlab -- error raised explicitly by YYERROR. | 4741 `---------------------------------------------------*/ 4742 yyerrorlab: 4743 4744 /* Pacify compilers like GCC when the user code never invokes 4745 YYERROR and the label yyerrorlab therefore never appears in user 4746 code. */ 4747 if (/*CONSTCOND*/ 0) 4748 goto yyerrorlab; 4749 4750 yyerror_range[1] = yylsp[1-yylen]; 4751 /* Do not reclaim the symbols of the rule which action triggered 4752 this YYERROR. */ 4753 YYPOPSTACK (yylen); 4754 yylen = 0; 4755 YY_STACK_PRINT (yyss, yyssp); 4756 yystate = *yyssp; 4757 goto yyerrlab1; 4758 4759 4760 /*-------------------------------------------------------------. 4761 | yyerrlab1 -- common code for both syntax error and YYERROR. | 4762 `-------------------------------------------------------------*/ 4763 yyerrlab1: 4764 yyerrstatus = 3; /* Each real token shifted decrements this. */ 4765 4766 for (;;) 4767 { 4768 yyn = yypact[yystate]; 4769 if (!yypact_value_is_default (yyn)) 4770 { 4771 yyn += YYTERROR; 4772 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) 4773 { 4774 yyn = yytable[yyn]; 4775 if (0 < yyn) 4776 break; 4777 } 4778 } 4779 4780 /* Pop the current state because it cannot handle the error token. */ 4781 if (yyssp == yyss) 4782 YYABORT; 4783 4784 yyerror_range[1] = *yylsp; 4785 yydestruct ("Error: popping", 4786 yystos[yystate], yyvsp, yylsp, context); 4787 YYPOPSTACK (1); 4788 yystate = *yyssp; 4789 YY_STACK_PRINT (yyss, yyssp); 4790 } 4791 4792 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 4793 *++yyvsp = yylval; 4794 YY_IGNORE_MAYBE_UNINITIALIZED_END 4795 4796 yyerror_range[2] = yylloc; 4797 /* Using YYLLOC is tempting, but would change the location of 4798 the lookahead. YYLOC is available though. */ 4799 YYLLOC_DEFAULT (yyloc, yyerror_range, 2); 4800 *++yylsp = yyloc; 4801 4802 /* Shift the error token. */ 4803 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); 4804 4805 yystate = yyn; 4806 goto yynewstate; 4807 4808 4809 /*-------------------------------------. 4810 | yyacceptlab -- YYACCEPT comes here. | 4811 `-------------------------------------*/ 4812 yyacceptlab: 4813 yyresult = 0; 4814 goto yyreturn; 4815 4816 /*-----------------------------------. 4817 | yyabortlab -- YYABORT comes here. | 4818 `-----------------------------------*/ 4819 yyabortlab: 4820 yyresult = 1; 4821 goto yyreturn; 4822 4823 #if !defined yyoverflow || YYERROR_VERBOSE 4824 /*-------------------------------------------------. 4825 | yyexhaustedlab -- memory exhaustion comes here. | 4826 `-------------------------------------------------*/ 4827 yyexhaustedlab: 4828 yyerror (&yylloc, context, YY_("memory exhausted")); 4829 yyresult = 2; 4830 /* Fall through. */ 4831 #endif 4832 4833 yyreturn: 4834 if (yychar != YYEMPTY) 4835 { 4836 /* Make sure we have latest lookahead translation. See comments at 4837 user semantic actions for why this is necessary. */ 4838 yytoken = YYTRANSLATE (yychar); 4839 yydestruct ("Cleanup: discarding lookahead", 4840 yytoken, &yylval, &yylloc, context); 4841 } 4842 /* Do not reclaim the symbols of the rule which action triggered 4843 this YYABORT or YYACCEPT. */ 4844 YYPOPSTACK (yylen); 4845 YY_STACK_PRINT (yyss, yyssp); 4846 while (yyssp != yyss) 4847 { 4848 yydestruct ("Cleanup: popping", 4849 yystos[*yyssp], yyvsp, yylsp, context); 4850 YYPOPSTACK (1); 4851 } 4852 #ifndef yyoverflow 4853 if (yyss != yyssa) 4854 YYSTACK_FREE (yyss); 4855 #endif 4856 #if YYERROR_VERBOSE 4857 if (yymsg != yymsgbuf) 4858 YYSTACK_FREE (yymsg); 4859 #endif 4860 /* Make sure YYID is used. */ 4861 return YYID (yyresult); 4862 } 4863 4864 4865 4866 4867 4868 int glslang_parse(TParseContext* context) { 4869 return yyparse(context); 4870 } 4871