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