alokp@chromium.org | 044a5cf | 2010-11-12 15:42:16 +0000 | [diff] [blame] | 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 | } |
zmo@google.com | fd747b8 | 2011-04-23 01:30:07 +0000 | [diff] [blame] | 328 | /* Line 193 of yacc.c. */ |
alokp@chromium.org | 044a5cf | 2010-11-12 15:42:16 +0000 | [diff] [blame] | 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_ |
zmo@google.com | fd747b8 | 2011-04-23 01:30:07 +0000 | [diff] [blame] | 418 | # if defined YYENABLE_NLS && YYENABLE_NLS |
alokp@chromium.org | 044a5cf | 2010-11-12 15:42:16 +0000 | [diff] [blame] | 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, |
kbr@chromium.org | 04277b8 | 2011-06-02 18:41:26 +0000 | [diff] [blame^] | 741 | 1170, 1177, 1187, 1203, 1221, 1245, 1268, 1272, 1290, 1298, |
| 742 | 1330, 1350, 1426, 1435, 1458, 1461, 1467, 1475, 1483, 1491, |
| 743 | 1494, 1501, 1504, 1507, 1513, 1516, 1531, 1535, 1539, 1543, |
| 744 | 1552, 1557, 1562, 1567, 1572, 1577, 1582, 1587, 1592, 1597, |
| 745 | 1603, 1609, 1615, 1620, 1625, 1630, 1643, 1656, 1664, 1667, |
| 746 | 1682, 1713, 1717, 1723, 1731, 1747, 1751, 1755, 1756, 1762, |
| 747 | 1763, 1764, 1765, 1766, 1770, 1771, 1771, 1771, 1781, 1782, |
| 748 | 1787, 1790, 1800, 1803, 1809, 1810, 1814, 1822, 1826, 1836, |
| 749 | 1841, 1858, 1858, 1863, 1863, 1870, 1870, 1878, 1881, 1887, |
| 750 | 1890, 1896, 1900, 1907, 1914, 1921, 1928, 1939, 1948, 1952, |
| 751 | 1959, 1962, 1968, 1968 |
alokp@chromium.org | 044a5cf | 2010-11-12 15:42:16 +0000 | [diff] [blame] | 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 |
zmo@google.com | fd747b8 | 2011-04-23 01:30:07 +0000 | [diff] [blame] | 1364 | # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL |
alokp@chromium.org | 044a5cf | 2010-11-12 15:42:16 +0000 | [diff] [blame] | 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 | |
| 1566 | #if YYERROR_VERBOSE |
| 1567 | |
| 1568 | # ifndef yystrlen |
| 1569 | # if defined __GLIBC__ && defined _STRING_H |
| 1570 | # define yystrlen strlen |
| 1571 | # else |
| 1572 | /* Return the length of YYSTR. */ |
| 1573 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 1574 | || defined __cplusplus || defined _MSC_VER) |
| 1575 | static YYSIZE_T |
| 1576 | yystrlen (const char *yystr) |
| 1577 | #else |
| 1578 | static YYSIZE_T |
| 1579 | yystrlen (yystr) |
| 1580 | const char *yystr; |
| 1581 | #endif |
| 1582 | { |
| 1583 | YYSIZE_T yylen; |
| 1584 | for (yylen = 0; yystr[yylen]; yylen++) |
| 1585 | continue; |
| 1586 | return yylen; |
| 1587 | } |
| 1588 | # endif |
| 1589 | # endif |
| 1590 | |
| 1591 | # ifndef yystpcpy |
| 1592 | # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE |
| 1593 | # define yystpcpy stpcpy |
| 1594 | # else |
| 1595 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in |
| 1596 | YYDEST. */ |
| 1597 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 1598 | || defined __cplusplus || defined _MSC_VER) |
| 1599 | static char * |
| 1600 | yystpcpy (char *yydest, const char *yysrc) |
| 1601 | #else |
| 1602 | static char * |
| 1603 | yystpcpy (yydest, yysrc) |
| 1604 | char *yydest; |
| 1605 | const char *yysrc; |
| 1606 | #endif |
| 1607 | { |
| 1608 | char *yyd = yydest; |
| 1609 | const char *yys = yysrc; |
| 1610 | |
| 1611 | while ((*yyd++ = *yys++) != '\0') |
| 1612 | continue; |
| 1613 | |
| 1614 | return yyd - 1; |
| 1615 | } |
| 1616 | # endif |
| 1617 | # endif |
| 1618 | |
| 1619 | # ifndef yytnamerr |
| 1620 | /* Copy to YYRES the contents of YYSTR after stripping away unnecessary |
| 1621 | quotes and backslashes, so that it's suitable for yyerror. The |
| 1622 | heuristic is that double-quoting is unnecessary unless the string |
| 1623 | contains an apostrophe, a comma, or backslash (other than |
| 1624 | backslash-backslash). YYSTR is taken from yytname. If YYRES is |
| 1625 | null, do not copy; instead, return the length of what the result |
| 1626 | would have been. */ |
| 1627 | static YYSIZE_T |
| 1628 | yytnamerr (char *yyres, const char *yystr) |
| 1629 | { |
| 1630 | if (*yystr == '"') |
| 1631 | { |
| 1632 | YYSIZE_T yyn = 0; |
| 1633 | char const *yyp = yystr; |
| 1634 | |
| 1635 | for (;;) |
| 1636 | switch (*++yyp) |
| 1637 | { |
| 1638 | case '\'': |
| 1639 | case ',': |
| 1640 | goto do_not_strip_quotes; |
| 1641 | |
| 1642 | case '\\': |
| 1643 | if (*++yyp != '\\') |
| 1644 | goto do_not_strip_quotes; |
| 1645 | /* Fall through. */ |
| 1646 | default: |
| 1647 | if (yyres) |
| 1648 | yyres[yyn] = *yyp; |
| 1649 | yyn++; |
| 1650 | break; |
| 1651 | |
| 1652 | case '"': |
| 1653 | if (yyres) |
| 1654 | yyres[yyn] = '\0'; |
| 1655 | return yyn; |
| 1656 | } |
| 1657 | do_not_strip_quotes: ; |
| 1658 | } |
| 1659 | |
| 1660 | if (! yyres) |
| 1661 | return yystrlen (yystr); |
| 1662 | |
| 1663 | return yystpcpy (yyres, yystr) - yyres; |
| 1664 | } |
| 1665 | # endif |
| 1666 | |
| 1667 | /* Copy into YYRESULT an error message about the unexpected token |
| 1668 | YYCHAR while in state YYSTATE. Return the number of bytes copied, |
| 1669 | including the terminating null byte. If YYRESULT is null, do not |
| 1670 | copy anything; just return the number of bytes that would be |
| 1671 | copied. As a special case, return 0 if an ordinary "syntax error" |
| 1672 | message will do. Return YYSIZE_MAXIMUM if overflow occurs during |
| 1673 | size calculation. */ |
| 1674 | static YYSIZE_T |
| 1675 | yysyntax_error (char *yyresult, int yystate, int yychar) |
| 1676 | { |
| 1677 | int yyn = yypact[yystate]; |
| 1678 | |
| 1679 | if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) |
| 1680 | return 0; |
| 1681 | else |
| 1682 | { |
| 1683 | int yytype = YYTRANSLATE (yychar); |
| 1684 | YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); |
| 1685 | YYSIZE_T yysize = yysize0; |
| 1686 | YYSIZE_T yysize1; |
| 1687 | int yysize_overflow = 0; |
| 1688 | enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; |
| 1689 | char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; |
| 1690 | int yyx; |
| 1691 | |
| 1692 | # if 0 |
| 1693 | /* This is so xgettext sees the translatable formats that are |
| 1694 | constructed on the fly. */ |
| 1695 | YY_("syntax error, unexpected %s"); |
| 1696 | YY_("syntax error, unexpected %s, expecting %s"); |
| 1697 | YY_("syntax error, unexpected %s, expecting %s or %s"); |
| 1698 | YY_("syntax error, unexpected %s, expecting %s or %s or %s"); |
| 1699 | YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); |
| 1700 | # endif |
| 1701 | char *yyfmt; |
| 1702 | char const *yyf; |
| 1703 | static char const yyunexpected[] = "syntax error, unexpected %s"; |
| 1704 | static char const yyexpecting[] = ", expecting %s"; |
| 1705 | static char const yyor[] = " or %s"; |
| 1706 | char yyformat[sizeof yyunexpected |
| 1707 | + sizeof yyexpecting - 1 |
| 1708 | + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) |
| 1709 | * (sizeof yyor - 1))]; |
| 1710 | char const *yyprefix = yyexpecting; |
| 1711 | |
| 1712 | /* Start YYX at -YYN if negative to avoid negative indexes in |
| 1713 | YYCHECK. */ |
| 1714 | int yyxbegin = yyn < 0 ? -yyn : 0; |
| 1715 | |
| 1716 | /* Stay within bounds of both yycheck and yytname. */ |
| 1717 | int yychecklim = YYLAST - yyn + 1; |
| 1718 | int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; |
| 1719 | int yycount = 1; |
| 1720 | |
| 1721 | yyarg[0] = yytname[yytype]; |
| 1722 | yyfmt = yystpcpy (yyformat, yyunexpected); |
| 1723 | |
| 1724 | for (yyx = yyxbegin; yyx < yyxend; ++yyx) |
| 1725 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) |
| 1726 | { |
| 1727 | if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) |
| 1728 | { |
| 1729 | yycount = 1; |
| 1730 | yysize = yysize0; |
| 1731 | yyformat[sizeof yyunexpected - 1] = '\0'; |
| 1732 | break; |
| 1733 | } |
| 1734 | yyarg[yycount++] = yytname[yyx]; |
| 1735 | yysize1 = yysize + yytnamerr (0, yytname[yyx]); |
| 1736 | yysize_overflow |= (yysize1 < yysize); |
| 1737 | yysize = yysize1; |
| 1738 | yyfmt = yystpcpy (yyfmt, yyprefix); |
| 1739 | yyprefix = yyor; |
| 1740 | } |
| 1741 | |
| 1742 | yyf = YY_(yyformat); |
| 1743 | yysize1 = yysize + yystrlen (yyf); |
| 1744 | yysize_overflow |= (yysize1 < yysize); |
| 1745 | yysize = yysize1; |
| 1746 | |
| 1747 | if (yysize_overflow) |
| 1748 | return YYSIZE_MAXIMUM; |
| 1749 | |
| 1750 | if (yyresult) |
| 1751 | { |
| 1752 | /* Avoid sprintf, as that infringes on the user's name space. |
| 1753 | Don't have undefined behavior even if the translation |
| 1754 | produced a string with the wrong number of "%s"s. */ |
| 1755 | char *yyp = yyresult; |
| 1756 | int yyi = 0; |
| 1757 | while ((*yyp = *yyf) != '\0') |
| 1758 | { |
| 1759 | if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) |
| 1760 | { |
| 1761 | yyp += yytnamerr (yyp, yyarg[yyi++]); |
| 1762 | yyf += 2; |
| 1763 | } |
| 1764 | else |
| 1765 | { |
| 1766 | yyp++; |
| 1767 | yyf++; |
| 1768 | } |
| 1769 | } |
| 1770 | } |
| 1771 | return yysize; |
| 1772 | } |
| 1773 | } |
| 1774 | #endif /* YYERROR_VERBOSE */ |
| 1775 | |
| 1776 | |
| 1777 | /*-----------------------------------------------. |
| 1778 | | Release the memory associated to this symbol. | |
| 1779 | `-----------------------------------------------*/ |
| 1780 | |
| 1781 | /*ARGSUSED*/ |
| 1782 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 1783 | || defined __cplusplus || defined _MSC_VER) |
| 1784 | static void |
| 1785 | yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, TParseContext* context) |
| 1786 | #else |
| 1787 | static void |
| 1788 | yydestruct (yymsg, yytype, yyvaluep, context) |
| 1789 | const char *yymsg; |
| 1790 | int yytype; |
| 1791 | YYSTYPE *yyvaluep; |
| 1792 | TParseContext* context; |
| 1793 | #endif |
| 1794 | { |
| 1795 | YYUSE (yyvaluep); |
| 1796 | YYUSE (context); |
| 1797 | |
| 1798 | if (!yymsg) |
| 1799 | yymsg = "Deleting"; |
| 1800 | YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); |
| 1801 | |
| 1802 | switch (yytype) |
| 1803 | { |
| 1804 | |
| 1805 | default: |
| 1806 | break; |
| 1807 | } |
| 1808 | } |
| 1809 | |
| 1810 | |
| 1811 | /* Prevent warnings from -Wmissing-prototypes. */ |
| 1812 | |
| 1813 | #ifdef YYPARSE_PARAM |
| 1814 | #if defined __STDC__ || defined __cplusplus |
| 1815 | int yyparse (void *YYPARSE_PARAM); |
| 1816 | #else |
| 1817 | int yyparse (); |
| 1818 | #endif |
| 1819 | #else /* ! YYPARSE_PARAM */ |
| 1820 | #if defined __STDC__ || defined __cplusplus |
| 1821 | int yyparse (TParseContext* context); |
| 1822 | #else |
| 1823 | int yyparse (); |
| 1824 | #endif |
| 1825 | #endif /* ! YYPARSE_PARAM */ |
| 1826 | |
| 1827 | |
| 1828 | |
| 1829 | |
| 1830 | |
| 1831 | |
| 1832 | /*----------. |
| 1833 | | yyparse. | |
| 1834 | `----------*/ |
| 1835 | |
| 1836 | #ifdef YYPARSE_PARAM |
| 1837 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 1838 | || defined __cplusplus || defined _MSC_VER) |
| 1839 | int |
| 1840 | yyparse (void *YYPARSE_PARAM) |
| 1841 | #else |
| 1842 | int |
| 1843 | yyparse (YYPARSE_PARAM) |
| 1844 | void *YYPARSE_PARAM; |
| 1845 | #endif |
| 1846 | #else /* ! YYPARSE_PARAM */ |
| 1847 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 1848 | || defined __cplusplus || defined _MSC_VER) |
| 1849 | int |
| 1850 | yyparse (TParseContext* context) |
| 1851 | #else |
| 1852 | int |
| 1853 | yyparse (context) |
| 1854 | TParseContext* context; |
| 1855 | #endif |
| 1856 | #endif |
| 1857 | { |
| 1858 | /* The look-ahead symbol. */ |
| 1859 | int yychar; |
| 1860 | |
| 1861 | /* The semantic value of the look-ahead symbol. */ |
| 1862 | YYSTYPE yylval; |
| 1863 | |
| 1864 | /* Number of syntax errors so far. */ |
| 1865 | int yynerrs; |
| 1866 | |
| 1867 | int yystate; |
| 1868 | int yyn; |
| 1869 | int yyresult; |
| 1870 | /* Number of tokens to shift before error messages enabled. */ |
| 1871 | int yyerrstatus; |
| 1872 | /* Look-ahead token as an internal (translated) token number. */ |
| 1873 | int yytoken = 0; |
| 1874 | #if YYERROR_VERBOSE |
| 1875 | /* Buffer for error messages, and its allocated size. */ |
| 1876 | char yymsgbuf[128]; |
| 1877 | char *yymsg = yymsgbuf; |
| 1878 | YYSIZE_T yymsg_alloc = sizeof yymsgbuf; |
| 1879 | #endif |
| 1880 | |
| 1881 | /* Three stacks and their tools: |
| 1882 | `yyss': related to states, |
| 1883 | `yyvs': related to semantic values, |
| 1884 | `yyls': related to locations. |
| 1885 | |
| 1886 | Refer to the stacks thru separate pointers, to allow yyoverflow |
| 1887 | to reallocate them elsewhere. */ |
| 1888 | |
| 1889 | /* The state stack. */ |
| 1890 | yytype_int16 yyssa[YYINITDEPTH]; |
| 1891 | yytype_int16 *yyss = yyssa; |
| 1892 | yytype_int16 *yyssp; |
| 1893 | |
| 1894 | /* The semantic value stack. */ |
| 1895 | YYSTYPE yyvsa[YYINITDEPTH]; |
| 1896 | YYSTYPE *yyvs = yyvsa; |
| 1897 | YYSTYPE *yyvsp; |
| 1898 | |
| 1899 | |
| 1900 | |
| 1901 | #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) |
| 1902 | |
| 1903 | YYSIZE_T yystacksize = YYINITDEPTH; |
| 1904 | |
| 1905 | /* The variables used to return semantic value and location from the |
| 1906 | action routines. */ |
| 1907 | YYSTYPE yyval; |
| 1908 | |
| 1909 | |
| 1910 | /* The number of symbols on the RHS of the reduced rule. |
| 1911 | Keep to zero when no symbol should be popped. */ |
| 1912 | int yylen = 0; |
| 1913 | |
| 1914 | YYDPRINTF ((stderr, "Starting parse\n")); |
| 1915 | |
| 1916 | yystate = 0; |
| 1917 | yyerrstatus = 0; |
| 1918 | yynerrs = 0; |
| 1919 | yychar = YYEMPTY; /* Cause a token to be read. */ |
| 1920 | |
| 1921 | /* Initialize stack pointers. |
| 1922 | Waste one element of value and location stack |
| 1923 | so that they stay on the same level as the state stack. |
| 1924 | The wasted elements are never initialized. */ |
| 1925 | |
| 1926 | yyssp = yyss; |
| 1927 | yyvsp = yyvs; |
| 1928 | |
| 1929 | goto yysetstate; |
| 1930 | |
| 1931 | /*------------------------------------------------------------. |
| 1932 | | yynewstate -- Push a new state, which is found in yystate. | |
| 1933 | `------------------------------------------------------------*/ |
| 1934 | yynewstate: |
| 1935 | /* In all cases, when you get here, the value and location stacks |
| 1936 | have just been pushed. So pushing a state here evens the stacks. */ |
| 1937 | yyssp++; |
| 1938 | |
| 1939 | yysetstate: |
| 1940 | *yyssp = yystate; |
| 1941 | |
| 1942 | if (yyss + yystacksize - 1 <= yyssp) |
| 1943 | { |
| 1944 | /* Get the current used size of the three stacks, in elements. */ |
| 1945 | YYSIZE_T yysize = yyssp - yyss + 1; |
| 1946 | |
| 1947 | #ifdef yyoverflow |
| 1948 | { |
| 1949 | /* Give user a chance to reallocate the stack. Use copies of |
| 1950 | these so that the &'s don't force the real ones into |
| 1951 | memory. */ |
| 1952 | YYSTYPE *yyvs1 = yyvs; |
| 1953 | yytype_int16 *yyss1 = yyss; |
| 1954 | |
| 1955 | |
| 1956 | /* Each stack pointer address is followed by the size of the |
| 1957 | data in use in that stack, in bytes. This used to be a |
| 1958 | conditional around just the two extra args, but that might |
| 1959 | be undefined if yyoverflow is a macro. */ |
| 1960 | yyoverflow (YY_("memory exhausted"), |
| 1961 | &yyss1, yysize * sizeof (*yyssp), |
| 1962 | &yyvs1, yysize * sizeof (*yyvsp), |
| 1963 | |
| 1964 | &yystacksize); |
| 1965 | |
| 1966 | yyss = yyss1; |
| 1967 | yyvs = yyvs1; |
| 1968 | } |
| 1969 | #else /* no yyoverflow */ |
| 1970 | # ifndef YYSTACK_RELOCATE |
| 1971 | goto yyexhaustedlab; |
| 1972 | # else |
| 1973 | /* Extend the stack our own way. */ |
| 1974 | if (YYMAXDEPTH <= yystacksize) |
| 1975 | goto yyexhaustedlab; |
| 1976 | yystacksize *= 2; |
| 1977 | if (YYMAXDEPTH < yystacksize) |
| 1978 | yystacksize = YYMAXDEPTH; |
| 1979 | |
| 1980 | { |
| 1981 | yytype_int16 *yyss1 = yyss; |
| 1982 | union yyalloc *yyptr = |
| 1983 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); |
| 1984 | if (! yyptr) |
| 1985 | goto yyexhaustedlab; |
| 1986 | YYSTACK_RELOCATE (yyss); |
| 1987 | YYSTACK_RELOCATE (yyvs); |
| 1988 | |
| 1989 | # undef YYSTACK_RELOCATE |
| 1990 | if (yyss1 != yyssa) |
| 1991 | YYSTACK_FREE (yyss1); |
| 1992 | } |
| 1993 | # endif |
| 1994 | #endif /* no yyoverflow */ |
| 1995 | |
| 1996 | yyssp = yyss + yysize - 1; |
| 1997 | yyvsp = yyvs + yysize - 1; |
| 1998 | |
| 1999 | |
| 2000 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", |
| 2001 | (unsigned long int) yystacksize)); |
| 2002 | |
| 2003 | if (yyss + yystacksize - 1 <= yyssp) |
| 2004 | YYABORT; |
| 2005 | } |
| 2006 | |
| 2007 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); |
| 2008 | |
| 2009 | goto yybackup; |
| 2010 | |
| 2011 | /*-----------. |
| 2012 | | yybackup. | |
| 2013 | `-----------*/ |
| 2014 | yybackup: |
| 2015 | |
| 2016 | /* Do appropriate processing given the current state. Read a |
| 2017 | look-ahead token if we need one and don't already have one. */ |
| 2018 | |
| 2019 | /* First try to decide what to do without reference to look-ahead token. */ |
| 2020 | yyn = yypact[yystate]; |
| 2021 | if (yyn == YYPACT_NINF) |
| 2022 | goto yydefault; |
| 2023 | |
| 2024 | /* Not known => get a look-ahead token if don't already have one. */ |
| 2025 | |
| 2026 | /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ |
| 2027 | if (yychar == YYEMPTY) |
| 2028 | { |
| 2029 | YYDPRINTF ((stderr, "Reading a token: ")); |
| 2030 | yychar = YYLEX; |
| 2031 | } |
| 2032 | |
| 2033 | if (yychar <= YYEOF) |
| 2034 | { |
| 2035 | yychar = yytoken = YYEOF; |
| 2036 | YYDPRINTF ((stderr, "Now at end of input.\n")); |
| 2037 | } |
| 2038 | else |
| 2039 | { |
| 2040 | yytoken = YYTRANSLATE (yychar); |
| 2041 | YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); |
| 2042 | } |
| 2043 | |
| 2044 | /* If the proper action on seeing token YYTOKEN is to reduce or to |
| 2045 | detect an error, take that action. */ |
| 2046 | yyn += yytoken; |
| 2047 | if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) |
| 2048 | goto yydefault; |
| 2049 | yyn = yytable[yyn]; |
| 2050 | if (yyn <= 0) |
| 2051 | { |
| 2052 | if (yyn == 0 || yyn == YYTABLE_NINF) |
| 2053 | goto yyerrlab; |
| 2054 | yyn = -yyn; |
| 2055 | goto yyreduce; |
| 2056 | } |
| 2057 | |
| 2058 | if (yyn == YYFINAL) |
| 2059 | YYACCEPT; |
| 2060 | |
| 2061 | /* Count tokens shifted since error; after three, turn off error |
| 2062 | status. */ |
| 2063 | if (yyerrstatus) |
| 2064 | yyerrstatus--; |
| 2065 | |
| 2066 | /* Shift the look-ahead token. */ |
| 2067 | YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); |
| 2068 | |
| 2069 | /* Discard the shifted token unless it is eof. */ |
| 2070 | if (yychar != YYEOF) |
| 2071 | yychar = YYEMPTY; |
| 2072 | |
| 2073 | yystate = yyn; |
| 2074 | *++yyvsp = yylval; |
| 2075 | |
| 2076 | goto yynewstate; |
| 2077 | |
| 2078 | |
| 2079 | /*-----------------------------------------------------------. |
| 2080 | | yydefault -- do the default action for the current state. | |
| 2081 | `-----------------------------------------------------------*/ |
| 2082 | yydefault: |
| 2083 | yyn = yydefact[yystate]; |
| 2084 | if (yyn == 0) |
| 2085 | goto yyerrlab; |
| 2086 | goto yyreduce; |
| 2087 | |
| 2088 | |
| 2089 | /*-----------------------------. |
| 2090 | | yyreduce -- Do a reduction. | |
| 2091 | `-----------------------------*/ |
| 2092 | yyreduce: |
| 2093 | /* yyn is the number of a rule to reduce with. */ |
| 2094 | yylen = yyr2[yyn]; |
| 2095 | |
| 2096 | /* If YYLEN is nonzero, implement the default value of the action: |
| 2097 | `$$ = $1'. |
| 2098 | |
| 2099 | Otherwise, the following line sets YYVAL to garbage. |
| 2100 | This behavior is undocumented and Bison |
| 2101 | users should not rely upon it. Assigning to YYVAL |
| 2102 | unconditionally makes the parser a bit smaller, and it avoids a |
| 2103 | GCC warning that YYVAL may be used uninitialized. */ |
| 2104 | yyval = yyvsp[1-yylen]; |
| 2105 | |
| 2106 | |
| 2107 | YY_REDUCE_PRINT (yyn); |
| 2108 | switch (yyn) |
| 2109 | { |
| 2110 | case 2: |
| 2111 | |
| 2112 | { |
| 2113 | // The symbol table search was done in the lexical phase |
| 2114 | const TSymbol* symbol = (yyvsp[(1) - (1)].lex).symbol; |
| 2115 | const TVariable* variable; |
| 2116 | if (symbol == 0) { |
| 2117 | context->error((yyvsp[(1) - (1)].lex).line, "undeclared identifier", (yyvsp[(1) - (1)].lex).string->c_str(), ""); |
| 2118 | context->recover(); |
| 2119 | TType type(EbtFloat, EbpUndefined); |
| 2120 | TVariable* fakeVariable = new TVariable((yyvsp[(1) - (1)].lex).string, type); |
| 2121 | context->symbolTable.insert(*fakeVariable); |
| 2122 | variable = fakeVariable; |
| 2123 | } else { |
| 2124 | // This identifier can only be a variable type symbol |
| 2125 | if (! symbol->isVariable()) { |
| 2126 | context->error((yyvsp[(1) - (1)].lex).line, "variable expected", (yyvsp[(1) - (1)].lex).string->c_str(), ""); |
| 2127 | context->recover(); |
| 2128 | } |
| 2129 | variable = static_cast<const TVariable*>(symbol); |
| 2130 | } |
| 2131 | |
| 2132 | // don't delete $1.string, it's used by error recovery, and the pool |
| 2133 | // pop will reclaim the memory |
| 2134 | |
| 2135 | if (variable->getType().getQualifier() == EvqConst ) { |
| 2136 | ConstantUnion* constArray = variable->getConstPointer(); |
| 2137 | TType t(variable->getType()); |
| 2138 | (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(constArray, t, (yyvsp[(1) - (1)].lex).line); |
| 2139 | } else |
| 2140 | (yyval.interm.intermTypedNode) = context->intermediate.addSymbol(variable->getUniqueId(), |
| 2141 | variable->getName(), |
| 2142 | variable->getType(), (yyvsp[(1) - (1)].lex).line); |
| 2143 | ;} |
| 2144 | break; |
| 2145 | |
| 2146 | case 3: |
| 2147 | |
| 2148 | { |
| 2149 | (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); |
| 2150 | ;} |
| 2151 | break; |
| 2152 | |
| 2153 | case 4: |
| 2154 | |
| 2155 | { |
| 2156 | // |
| 2157 | // INT_TYPE is only 16-bit plus sign bit for vertex/fragment shaders, |
| 2158 | // check for overflow for constants |
| 2159 | // |
| 2160 | if (abs((yyvsp[(1) - (1)].lex).i) >= (1 << 16)) { |
| 2161 | context->error((yyvsp[(1) - (1)].lex).line, " integer constant overflow", "", ""); |
| 2162 | context->recover(); |
| 2163 | } |
| 2164 | ConstantUnion *unionArray = new ConstantUnion[1]; |
| 2165 | unionArray->setIConst((yyvsp[(1) - (1)].lex).i); |
| 2166 | (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line); |
| 2167 | ;} |
| 2168 | break; |
| 2169 | |
| 2170 | case 5: |
| 2171 | |
| 2172 | { |
| 2173 | ConstantUnion *unionArray = new ConstantUnion[1]; |
| 2174 | unionArray->setFConst((yyvsp[(1) - (1)].lex).f); |
| 2175 | (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line); |
| 2176 | ;} |
| 2177 | break; |
| 2178 | |
| 2179 | case 6: |
| 2180 | |
| 2181 | { |
| 2182 | ConstantUnion *unionArray = new ConstantUnion[1]; |
| 2183 | unionArray->setBConst((yyvsp[(1) - (1)].lex).b); |
| 2184 | (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line); |
| 2185 | ;} |
| 2186 | break; |
| 2187 | |
| 2188 | case 7: |
| 2189 | |
| 2190 | { |
| 2191 | (yyval.interm.intermTypedNode) = (yyvsp[(2) - (3)].interm.intermTypedNode); |
| 2192 | ;} |
| 2193 | break; |
| 2194 | |
| 2195 | case 8: |
| 2196 | |
| 2197 | { |
| 2198 | (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); |
| 2199 | ;} |
| 2200 | break; |
| 2201 | |
| 2202 | case 9: |
| 2203 | |
| 2204 | { |
| 2205 | if (!(yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isVector()) { |
| 2206 | if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode()) |
| 2207 | 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(), ""); |
| 2208 | else |
| 2209 | context->error((yyvsp[(2) - (4)].lex).line, " left of '[' is not of type array, matrix, or vector ", "expression", ""); |
| 2210 | context->recover(); |
| 2211 | } |
| 2212 | if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst && (yyvsp[(3) - (4)].interm.intermTypedNode)->getQualifier() == EvqConst) { |
| 2213 | if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) { // constant folding for arrays |
| 2214 | (yyval.interm.intermTypedNode) = context->addConstArrayNode((yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line); |
| 2215 | } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector()) { // constant folding for vectors |
| 2216 | TVectorFields fields; |
| 2217 | fields.num = 1; |
| 2218 | fields.offsets[0] = (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(); // need to do it this way because v.xy sends fields integer array |
| 2219 | (yyval.interm.intermTypedNode) = context->addConstVectorNode(fields, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line); |
| 2220 | } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix()) { // constant folding for matrices |
| 2221 | (yyval.interm.intermTypedNode) = context->addConstMatrixNode((yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line); |
| 2222 | } |
| 2223 | } else { |
| 2224 | if ((yyvsp[(3) - (4)].interm.intermTypedNode)->getQualifier() == EvqConst) { |
| 2225 | 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() ) { |
| 2226 | context->error((yyvsp[(2) - (4)].lex).line, "", "[", "field selection out of range '%d'", (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst()); |
| 2227 | context->recover(); |
| 2228 | } else { |
| 2229 | if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) { |
| 2230 | if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize() == 0) { |
| 2231 | if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getMaxArraySize() <= (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst()) { |
| 2232 | 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)) |
| 2233 | context->recover(); |
| 2234 | } else { |
| 2235 | if (context->arraySetMaxSize((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getTypePointer(), 0, false, (yyvsp[(2) - (4)].lex).line)) |
| 2236 | context->recover(); |
| 2237 | } |
| 2238 | } else if ( (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst() >= (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize()) { |
| 2239 | context->error((yyvsp[(2) - (4)].lex).line, "", "[", "array index out of range '%d'", (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst()); |
| 2240 | context->recover(); |
| 2241 | } |
| 2242 | } |
| 2243 | (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(3) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line); |
| 2244 | } |
| 2245 | } else { |
| 2246 | if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize() == 0) { |
| 2247 | context->error((yyvsp[(2) - (4)].lex).line, "", "[", "array must be redeclared with a size before being indexed with a variable"); |
| 2248 | context->recover(); |
| 2249 | } |
| 2250 | |
| 2251 | (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexIndirect, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(3) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line); |
| 2252 | } |
| 2253 | } |
| 2254 | if ((yyval.interm.intermTypedNode) == 0) { |
| 2255 | ConstantUnion *unionArray = new ConstantUnion[1]; |
| 2256 | unionArray->setFConst(0.0f); |
| 2257 | (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpHigh, EvqConst), (yyvsp[(2) - (4)].lex).line); |
| 2258 | } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) { |
| 2259 | if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getStruct()) |
| 2260 | (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getStruct(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getTypeName())); |
| 2261 | else |
| 2262 | (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())); |
| 2263 | |
| 2264 | if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) |
| 2265 | (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConst); |
| 2266 | } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) |
| 2267 | (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqConst, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize())); |
| 2268 | else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix()) |
| 2269 | (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize())); |
| 2270 | else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) |
| 2271 | (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqConst)); |
| 2272 | else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector()) |
| 2273 | (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary)); |
| 2274 | else |
| 2275 | (yyval.interm.intermTypedNode)->setType((yyvsp[(1) - (4)].interm.intermTypedNode)->getType()); |
| 2276 | ;} |
| 2277 | break; |
| 2278 | |
| 2279 | case 10: |
| 2280 | |
| 2281 | { |
| 2282 | (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); |
| 2283 | ;} |
| 2284 | break; |
| 2285 | |
| 2286 | case 11: |
| 2287 | |
| 2288 | { |
| 2289 | if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isArray()) { |
| 2290 | context->error((yyvsp[(3) - (3)].lex).line, "cannot apply dot operator to an array", ".", ""); |
| 2291 | context->recover(); |
| 2292 | } |
| 2293 | |
| 2294 | if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isVector()) { |
| 2295 | TVectorFields fields; |
| 2296 | if (! context->parseVectorFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yyvsp[(3) - (3)].lex).line)) { |
| 2297 | fields.num = 1; |
| 2298 | fields.offsets[0] = 0; |
| 2299 | context->recover(); |
| 2300 | } |
| 2301 | |
| 2302 | if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) { // constant folding for vector fields |
| 2303 | (yyval.interm.intermTypedNode) = context->addConstVectorNode(fields, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].lex).line); |
| 2304 | if ((yyval.interm.intermTypedNode) == 0) { |
| 2305 | context->recover(); |
| 2306 | (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode); |
| 2307 | } |
| 2308 | else |
| 2309 | (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())); |
| 2310 | } else { |
| 2311 | if (fields.num == 1) { |
| 2312 | ConstantUnion *unionArray = new ConstantUnion[1]; |
| 2313 | unionArray->setIConst(fields.offsets[0]); |
| 2314 | TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line); |
| 2315 | (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line); |
| 2316 | (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision())); |
| 2317 | } else { |
| 2318 | TString vectorString = *(yyvsp[(3) - (3)].lex).string; |
| 2319 | TIntermTyped* index = context->intermediate.addSwizzle(fields, (yyvsp[(3) - (3)].lex).line); |
| 2320 | (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpVectorSwizzle, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line); |
| 2321 | (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (int) vectorString.size())); |
| 2322 | } |
| 2323 | } |
| 2324 | } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isMatrix()) { |
| 2325 | TMatrixFields fields; |
| 2326 | if (! context->parseMatrixFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yyvsp[(3) - (3)].lex).line)) { |
| 2327 | fields.wholeRow = false; |
| 2328 | fields.wholeCol = false; |
| 2329 | fields.row = 0; |
| 2330 | fields.col = 0; |
| 2331 | context->recover(); |
| 2332 | } |
| 2333 | |
| 2334 | if (fields.wholeRow || fields.wholeCol) { |
| 2335 | context->error((yyvsp[(2) - (3)].lex).line, " non-scalar fields not implemented yet", ".", ""); |
| 2336 | context->recover(); |
| 2337 | ConstantUnion *unionArray = new ConstantUnion[1]; |
| 2338 | unionArray->setIConst(0); |
| 2339 | TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line); |
| 2340 | (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line); |
| 2341 | (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(),EvqTemporary, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize())); |
| 2342 | } else { |
| 2343 | ConstantUnion *unionArray = new ConstantUnion[1]; |
| 2344 | unionArray->setIConst(fields.col * (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize() + fields.row); |
| 2345 | TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line); |
| 2346 | (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line); |
| 2347 | (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision())); |
| 2348 | } |
| 2349 | } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType() == EbtStruct) { |
| 2350 | bool fieldFound = false; |
| 2351 | const TTypeList* fields = (yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getStruct(); |
| 2352 | if (fields == 0) { |
| 2353 | context->error((yyvsp[(2) - (3)].lex).line, "structure has no fields", "Internal Error", ""); |
| 2354 | context->recover(); |
| 2355 | (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode); |
| 2356 | } else { |
| 2357 | unsigned int i; |
| 2358 | for (i = 0; i < fields->size(); ++i) { |
| 2359 | if ((*fields)[i].type->getFieldName() == *(yyvsp[(3) - (3)].lex).string) { |
| 2360 | fieldFound = true; |
| 2361 | break; |
| 2362 | } |
| 2363 | } |
| 2364 | if (fieldFound) { |
| 2365 | if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) { |
| 2366 | (yyval.interm.intermTypedNode) = context->addConstStruct(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line); |
| 2367 | if ((yyval.interm.intermTypedNode) == 0) { |
| 2368 | context->recover(); |
| 2369 | (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode); |
| 2370 | } |
| 2371 | else { |
| 2372 | (yyval.interm.intermTypedNode)->setType(*(*fields)[i].type); |
| 2373 | // change the qualifier of the return type, not of the structure field |
| 2374 | // as the structure definition is shared between various structures. |
| 2375 | (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConst); |
| 2376 | } |
| 2377 | } else { |
| 2378 | ConstantUnion *unionArray = new ConstantUnion[1]; |
| 2379 | unionArray->setIConst(i); |
| 2380 | TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, *(*fields)[i].type, (yyvsp[(3) - (3)].lex).line); |
| 2381 | (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirectStruct, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line); |
| 2382 | (yyval.interm.intermTypedNode)->setType(*(*fields)[i].type); |
| 2383 | } |
| 2384 | } else { |
| 2385 | context->error((yyvsp[(2) - (3)].lex).line, " no such field in structure", (yyvsp[(3) - (3)].lex).string->c_str(), ""); |
| 2386 | context->recover(); |
| 2387 | (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode); |
| 2388 | } |
| 2389 | } |
| 2390 | } else { |
| 2391 | 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(), ""); |
| 2392 | context->recover(); |
| 2393 | (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode); |
| 2394 | } |
| 2395 | // don't delete $3.string, it's from the pool |
| 2396 | ;} |
| 2397 | break; |
| 2398 | |
| 2399 | case 12: |
| 2400 | |
| 2401 | { |
| 2402 | if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode))) |
| 2403 | context->recover(); |
| 2404 | (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostIncrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line, context->symbolTable); |
| 2405 | if ((yyval.interm.intermTypedNode) == 0) { |
| 2406 | context->unaryOpError((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString()); |
| 2407 | context->recover(); |
| 2408 | (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode); |
| 2409 | } |
| 2410 | ;} |
| 2411 | break; |
| 2412 | |
| 2413 | case 13: |
| 2414 | |
| 2415 | { |
| 2416 | if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode))) |
| 2417 | context->recover(); |
| 2418 | (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostDecrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line, context->symbolTable); |
| 2419 | if ((yyval.interm.intermTypedNode) == 0) { |
| 2420 | context->unaryOpError((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString()); |
| 2421 | context->recover(); |
| 2422 | (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode); |
| 2423 | } |
| 2424 | ;} |
| 2425 | break; |
| 2426 | |
| 2427 | case 14: |
| 2428 | |
| 2429 | { |
| 2430 | if (context->integerErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode), "[]")) |
| 2431 | context->recover(); |
| 2432 | (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); |
| 2433 | ;} |
| 2434 | break; |
| 2435 | |
| 2436 | case 15: |
| 2437 | |
| 2438 | { |
| 2439 | TFunction* fnCall = (yyvsp[(1) - (1)].interm).function; |
| 2440 | TOperator op = fnCall->getBuiltInOp(); |
| 2441 | |
| 2442 | if (op != EOpNull) |
| 2443 | { |
| 2444 | // |
| 2445 | // Then this should be a constructor. |
| 2446 | // Don't go through the symbol table for constructors. |
| 2447 | // Their parameters will be verified algorithmically. |
| 2448 | // |
| 2449 | TType type(EbtVoid, EbpUndefined); // use this to get the type back |
| 2450 | if (context->constructorErrorCheck((yyvsp[(1) - (1)].interm).line, (yyvsp[(1) - (1)].interm).intermNode, *fnCall, op, &type)) { |
| 2451 | (yyval.interm.intermTypedNode) = 0; |
| 2452 | } else { |
| 2453 | // |
| 2454 | // It's a constructor, of type 'type'. |
| 2455 | // |
| 2456 | (yyval.interm.intermTypedNode) = context->addConstructor((yyvsp[(1) - (1)].interm).intermNode, &type, op, fnCall, (yyvsp[(1) - (1)].interm).line); |
| 2457 | } |
| 2458 | |
| 2459 | if ((yyval.interm.intermTypedNode) == 0) { |
| 2460 | context->recover(); |
| 2461 | (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator(0, op, (yyvsp[(1) - (1)].interm).line); |
| 2462 | } |
| 2463 | (yyval.interm.intermTypedNode)->setType(type); |
| 2464 | } else { |
| 2465 | // |
| 2466 | // Not a constructor. Find it in the symbol table. |
| 2467 | // |
| 2468 | const TFunction* fnCandidate; |
| 2469 | bool builtIn; |
| 2470 | fnCandidate = context->findFunction((yyvsp[(1) - (1)].interm).line, fnCall, &builtIn); |
| 2471 | if (fnCandidate) { |
| 2472 | // |
| 2473 | // A declared function. |
| 2474 | // |
| 2475 | if (builtIn && !fnCandidate->getExtension().empty() && |
| 2476 | context->extensionErrorCheck((yyvsp[(1) - (1)].interm).line, fnCandidate->getExtension())) { |
| 2477 | context->recover(); |
| 2478 | } |
| 2479 | op = fnCandidate->getBuiltInOp(); |
| 2480 | if (builtIn && op != EOpNull) { |
| 2481 | // |
| 2482 | // A function call mapped to a built-in operation. |
| 2483 | // |
| 2484 | if (fnCandidate->getParamCount() == 1) { |
| 2485 | // |
| 2486 | // Treat it like a built-in unary operator. |
| 2487 | // |
| 2488 | (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(op, (yyvsp[(1) - (1)].interm).intermNode, 0, context->symbolTable); |
| 2489 | if ((yyval.interm.intermTypedNode) == 0) { |
| 2490 | context->error((yyvsp[(1) - (1)].interm).intermNode->getLine(), " wrong operand type", "Internal Error", |
| 2491 | "built in unary operator function. Type: %s", |
| 2492 | static_cast<TIntermTyped*>((yyvsp[(1) - (1)].interm).intermNode)->getCompleteString().c_str()); |
| 2493 | YYERROR; |
| 2494 | } |
| 2495 | } else { |
| 2496 | (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, op, (yyvsp[(1) - (1)].interm).line); |
| 2497 | } |
| 2498 | } else { |
| 2499 | // This is a real function call |
| 2500 | |
| 2501 | (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, EOpFunctionCall, (yyvsp[(1) - (1)].interm).line); |
| 2502 | (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType()); |
| 2503 | |
| 2504 | // this is how we know whether the given function is a builtIn function or a user defined function |
| 2505 | // if builtIn == false, it's a userDefined -> could be an overloaded builtIn function also |
| 2506 | // if builtIn == true, it's definitely a builtIn function with EOpNull |
| 2507 | if (!builtIn) |
| 2508 | (yyval.interm.intermTypedNode)->getAsAggregate()->setUserDefined(); |
| 2509 | (yyval.interm.intermTypedNode)->getAsAggregate()->setName(fnCandidate->getMangledName()); |
| 2510 | |
| 2511 | TQualifier qual; |
| 2512 | for (int i = 0; i < fnCandidate->getParamCount(); ++i) { |
| 2513 | qual = fnCandidate->getParam(i).type->getQualifier(); |
| 2514 | if (qual == EvqOut || qual == EvqInOut) { |
| 2515 | if (context->lValueErrorCheck((yyval.interm.intermTypedNode)->getLine(), "assign", (yyval.interm.intermTypedNode)->getAsAggregate()->getSequence()[i]->getAsTyped())) { |
| 2516 | context->error((yyvsp[(1) - (1)].interm).intermNode->getLine(), "Constant value cannot be passed for 'out' or 'inout' parameters.", "Error", ""); |
| 2517 | context->recover(); |
| 2518 | } |
| 2519 | } |
| 2520 | } |
| 2521 | } |
| 2522 | (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType()); |
| 2523 | } else { |
| 2524 | // error message was put out by PaFindFunction() |
| 2525 | // Put on a dummy node for error recovery |
| 2526 | ConstantUnion *unionArray = new ConstantUnion[1]; |
| 2527 | unionArray->setFConst(0.0f); |
| 2528 | (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].interm).line); |
| 2529 | context->recover(); |
| 2530 | } |
| 2531 | } |
| 2532 | delete fnCall; |
| 2533 | ;} |
| 2534 | break; |
| 2535 | |
| 2536 | case 16: |
| 2537 | |
| 2538 | { |
| 2539 | (yyval.interm) = (yyvsp[(1) - (1)].interm); |
| 2540 | ;} |
| 2541 | break; |
| 2542 | |
| 2543 | case 17: |
| 2544 | |
| 2545 | { |
| 2546 | context->error((yyvsp[(3) - (3)].interm).line, "methods are not supported", "", ""); |
| 2547 | context->recover(); |
| 2548 | (yyval.interm) = (yyvsp[(3) - (3)].interm); |
| 2549 | ;} |
| 2550 | break; |
| 2551 | |
| 2552 | case 18: |
| 2553 | |
| 2554 | { |
| 2555 | (yyval.interm) = (yyvsp[(1) - (2)].interm); |
| 2556 | (yyval.interm).line = (yyvsp[(2) - (2)].lex).line; |
| 2557 | ;} |
| 2558 | break; |
| 2559 | |
| 2560 | case 19: |
| 2561 | |
| 2562 | { |
| 2563 | (yyval.interm) = (yyvsp[(1) - (2)].interm); |
| 2564 | (yyval.interm).line = (yyvsp[(2) - (2)].lex).line; |
| 2565 | ;} |
| 2566 | break; |
| 2567 | |
| 2568 | case 20: |
| 2569 | |
| 2570 | { |
| 2571 | (yyval.interm).function = (yyvsp[(1) - (2)].interm.function); |
| 2572 | (yyval.interm).intermNode = 0; |
| 2573 | ;} |
| 2574 | break; |
| 2575 | |
| 2576 | case 21: |
| 2577 | |
| 2578 | { |
| 2579 | (yyval.interm).function = (yyvsp[(1) - (1)].interm.function); |
| 2580 | (yyval.interm).intermNode = 0; |
| 2581 | ;} |
| 2582 | break; |
| 2583 | |
| 2584 | case 22: |
| 2585 | |
| 2586 | { |
| 2587 | TParameter param = { 0, new TType((yyvsp[(2) - (2)].interm.intermTypedNode)->getType()) }; |
| 2588 | (yyvsp[(1) - (2)].interm.function)->addParameter(param); |
| 2589 | (yyval.interm).function = (yyvsp[(1) - (2)].interm.function); |
| 2590 | (yyval.interm).intermNode = (yyvsp[(2) - (2)].interm.intermTypedNode); |
| 2591 | ;} |
| 2592 | break; |
| 2593 | |
| 2594 | case 23: |
| 2595 | |
| 2596 | { |
| 2597 | TParameter param = { 0, new TType((yyvsp[(3) - (3)].interm.intermTypedNode)->getType()) }; |
| 2598 | (yyvsp[(1) - (3)].interm).function->addParameter(param); |
| 2599 | (yyval.interm).function = (yyvsp[(1) - (3)].interm).function; |
| 2600 | (yyval.interm).intermNode = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermNode, (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line); |
| 2601 | ;} |
| 2602 | break; |
| 2603 | |
| 2604 | case 24: |
| 2605 | |
| 2606 | { |
| 2607 | (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function); |
| 2608 | ;} |
| 2609 | break; |
| 2610 | |
| 2611 | case 25: |
| 2612 | |
| 2613 | { |
| 2614 | // |
| 2615 | // Constructor |
| 2616 | // |
| 2617 | if ((yyvsp[(1) - (1)].interm.type).array) { |
| 2618 | // Constructors for arrays are not allowed. |
| 2619 | context->error((yyvsp[(1) - (1)].interm.type).line, "cannot construct this type", "array", ""); |
| 2620 | context->recover(); |
| 2621 | (yyvsp[(1) - (1)].interm.type).setArray(false); |
| 2622 | } |
| 2623 | |
| 2624 | TOperator op = EOpNull; |
| 2625 | if ((yyvsp[(1) - (1)].interm.type).userDef) { |
| 2626 | op = EOpConstructStruct; |
| 2627 | } else { |
| 2628 | switch ((yyvsp[(1) - (1)].interm.type).type) { |
| 2629 | case EbtFloat: |
| 2630 | if ((yyvsp[(1) - (1)].interm.type).matrix) { |
| 2631 | switch((yyvsp[(1) - (1)].interm.type).size) { |
| 2632 | case 2: op = EOpConstructMat2; break; |
| 2633 | case 3: op = EOpConstructMat3; break; |
| 2634 | case 4: op = EOpConstructMat4; break; |
| 2635 | } |
| 2636 | } else { |
| 2637 | switch((yyvsp[(1) - (1)].interm.type).size) { |
| 2638 | case 1: op = EOpConstructFloat; break; |
| 2639 | case 2: op = EOpConstructVec2; break; |
| 2640 | case 3: op = EOpConstructVec3; break; |
| 2641 | case 4: op = EOpConstructVec4; break; |
| 2642 | } |
| 2643 | } |
| 2644 | break; |
| 2645 | case EbtInt: |
| 2646 | switch((yyvsp[(1) - (1)].interm.type).size) { |
| 2647 | case 1: op = EOpConstructInt; break; |
| 2648 | case 2: FRAG_VERT_ONLY("ivec2", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec2; break; |
| 2649 | case 3: FRAG_VERT_ONLY("ivec3", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec3; break; |
| 2650 | case 4: FRAG_VERT_ONLY("ivec4", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec4; break; |
| 2651 | } |
| 2652 | break; |
| 2653 | case EbtBool: |
| 2654 | switch((yyvsp[(1) - (1)].interm.type).size) { |
| 2655 | case 1: op = EOpConstructBool; break; |
| 2656 | case 2: FRAG_VERT_ONLY("bvec2", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec2; break; |
| 2657 | case 3: FRAG_VERT_ONLY("bvec3", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec3; break; |
| 2658 | case 4: FRAG_VERT_ONLY("bvec4", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec4; break; |
| 2659 | } |
| 2660 | break; |
| 2661 | default: break; |
| 2662 | } |
| 2663 | if (op == EOpNull) { |
| 2664 | context->error((yyvsp[(1) - (1)].interm.type).line, "cannot construct this type", getBasicString((yyvsp[(1) - (1)].interm.type).type), ""); |
| 2665 | context->recover(); |
| 2666 | (yyvsp[(1) - (1)].interm.type).type = EbtFloat; |
| 2667 | op = EOpConstructFloat; |
| 2668 | } |
| 2669 | } |
| 2670 | TString tempString; |
| 2671 | TType type((yyvsp[(1) - (1)].interm.type)); |
| 2672 | TFunction *function = new TFunction(&tempString, type, op); |
| 2673 | (yyval.interm.function) = function; |
| 2674 | ;} |
| 2675 | break; |
| 2676 | |
| 2677 | case 26: |
| 2678 | |
| 2679 | { |
| 2680 | if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string)) |
| 2681 | context->recover(); |
| 2682 | TType type(EbtVoid, EbpUndefined); |
| 2683 | TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type); |
| 2684 | (yyval.interm.function) = function; |
| 2685 | ;} |
| 2686 | break; |
| 2687 | |
| 2688 | case 27: |
| 2689 | |
| 2690 | { |
| 2691 | if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string)) |
| 2692 | context->recover(); |
| 2693 | TType type(EbtVoid, EbpUndefined); |
| 2694 | TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type); |
| 2695 | (yyval.interm.function) = function; |
| 2696 | ;} |
| 2697 | break; |
| 2698 | |
| 2699 | case 28: |
| 2700 | |
| 2701 | { |
| 2702 | (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); |
| 2703 | ;} |
| 2704 | break; |
| 2705 | |
| 2706 | case 29: |
| 2707 | |
| 2708 | { |
| 2709 | if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode))) |
| 2710 | context->recover(); |
| 2711 | (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreIncrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line, context->symbolTable); |
| 2712 | if ((yyval.interm.intermTypedNode) == 0) { |
| 2713 | context->unaryOpError((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString()); |
| 2714 | context->recover(); |
| 2715 | (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode); |
| 2716 | } |
| 2717 | ;} |
| 2718 | break; |
| 2719 | |
| 2720 | case 30: |
| 2721 | |
| 2722 | { |
| 2723 | if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode))) |
| 2724 | context->recover(); |
| 2725 | (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreDecrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line, context->symbolTable); |
| 2726 | if ((yyval.interm.intermTypedNode) == 0) { |
| 2727 | context->unaryOpError((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString()); |
| 2728 | context->recover(); |
| 2729 | (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode); |
| 2730 | } |
| 2731 | ;} |
| 2732 | break; |
| 2733 | |
| 2734 | case 31: |
| 2735 | |
| 2736 | { |
| 2737 | if ((yyvsp[(1) - (2)].interm).op != EOpNull) { |
| 2738 | (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath((yyvsp[(1) - (2)].interm).op, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].interm).line, context->symbolTable); |
| 2739 | if ((yyval.interm.intermTypedNode) == 0) { |
| 2740 | const char* errorOp = ""; |
| 2741 | switch((yyvsp[(1) - (2)].interm).op) { |
| 2742 | case EOpNegative: errorOp = "-"; break; |
| 2743 | case EOpLogicalNot: errorOp = "!"; break; |
| 2744 | default: break; |
| 2745 | } |
| 2746 | context->unaryOpError((yyvsp[(1) - (2)].interm).line, errorOp, (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString()); |
| 2747 | context->recover(); |
| 2748 | (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode); |
| 2749 | } |
| 2750 | } else |
| 2751 | (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode); |
| 2752 | ;} |
| 2753 | break; |
| 2754 | |
| 2755 | case 32: |
| 2756 | |
| 2757 | { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNull; ;} |
| 2758 | break; |
| 2759 | |
| 2760 | case 33: |
| 2761 | |
| 2762 | { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNegative; ;} |
| 2763 | break; |
| 2764 | |
| 2765 | case 34: |
| 2766 | |
| 2767 | { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpLogicalNot; ;} |
| 2768 | break; |
| 2769 | |
| 2770 | case 35: |
| 2771 | |
| 2772 | { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;} |
| 2773 | break; |
| 2774 | |
| 2775 | case 36: |
| 2776 | |
| 2777 | { |
| 2778 | FRAG_VERT_ONLY("*", (yyvsp[(2) - (3)].lex).line); |
| 2779 | (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpMul, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable); |
| 2780 | if ((yyval.interm.intermTypedNode) == 0) { |
| 2781 | context->binaryOpError((yyvsp[(2) - (3)].lex).line, "*", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); |
| 2782 | context->recover(); |
| 2783 | (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode); |
| 2784 | } |
| 2785 | ;} |
| 2786 | break; |
| 2787 | |
| 2788 | case 37: |
| 2789 | |
| 2790 | { |
| 2791 | FRAG_VERT_ONLY("/", (yyvsp[(2) - (3)].lex).line); |
| 2792 | (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpDiv, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable); |
| 2793 | if ((yyval.interm.intermTypedNode) == 0) { |
| 2794 | context->binaryOpError((yyvsp[(2) - (3)].lex).line, "/", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); |
| 2795 | context->recover(); |
| 2796 | (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode); |
| 2797 | } |
| 2798 | ;} |
| 2799 | break; |
| 2800 | |
| 2801 | case 38: |
| 2802 | |
| 2803 | { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;} |
| 2804 | break; |
| 2805 | |
| 2806 | case 39: |
| 2807 | |
| 2808 | { |
| 2809 | (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpAdd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable); |
| 2810 | if ((yyval.interm.intermTypedNode) == 0) { |
| 2811 | context->binaryOpError((yyvsp[(2) - (3)].lex).line, "+", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); |
| 2812 | context->recover(); |
| 2813 | (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode); |
| 2814 | } |
| 2815 | ;} |
| 2816 | break; |
| 2817 | |
| 2818 | case 40: |
| 2819 | |
| 2820 | { |
| 2821 | (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpSub, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable); |
| 2822 | if ((yyval.interm.intermTypedNode) == 0) { |
| 2823 | context->binaryOpError((yyvsp[(2) - (3)].lex).line, "-", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); |
| 2824 | context->recover(); |
| 2825 | (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode); |
| 2826 | } |
| 2827 | ;} |
| 2828 | break; |
| 2829 | |
| 2830 | case 41: |
| 2831 | |
| 2832 | { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;} |
| 2833 | break; |
| 2834 | |
| 2835 | case 42: |
| 2836 | |
| 2837 | { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;} |
| 2838 | break; |
| 2839 | |
| 2840 | case 43: |
| 2841 | |
| 2842 | { |
| 2843 | (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable); |
| 2844 | if ((yyval.interm.intermTypedNode) == 0) { |
| 2845 | context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); |
| 2846 | context->recover(); |
| 2847 | ConstantUnion *unionArray = new ConstantUnion[1]; |
| 2848 | unionArray->setBConst(false); |
| 2849 | (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line); |
| 2850 | } |
| 2851 | ;} |
| 2852 | break; |
| 2853 | |
| 2854 | case 44: |
| 2855 | |
| 2856 | { |
| 2857 | (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable); |
| 2858 | if ((yyval.interm.intermTypedNode) == 0) { |
| 2859 | context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); |
| 2860 | context->recover(); |
| 2861 | ConstantUnion *unionArray = new ConstantUnion[1]; |
| 2862 | unionArray->setBConst(false); |
| 2863 | (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line); |
| 2864 | } |
| 2865 | ;} |
| 2866 | break; |
| 2867 | |
| 2868 | case 45: |
| 2869 | |
| 2870 | { |
| 2871 | (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable); |
| 2872 | if ((yyval.interm.intermTypedNode) == 0) { |
| 2873 | context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); |
| 2874 | context->recover(); |
| 2875 | ConstantUnion *unionArray = new ConstantUnion[1]; |
| 2876 | unionArray->setBConst(false); |
| 2877 | (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line); |
| 2878 | } |
| 2879 | ;} |
| 2880 | break; |
| 2881 | |
| 2882 | case 46: |
| 2883 | |
| 2884 | { |
| 2885 | (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable); |
| 2886 | if ((yyval.interm.intermTypedNode) == 0) { |
| 2887 | context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); |
| 2888 | context->recover(); |
| 2889 | ConstantUnion *unionArray = new ConstantUnion[1]; |
| 2890 | unionArray->setBConst(false); |
| 2891 | (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line); |
| 2892 | } |
| 2893 | ;} |
| 2894 | break; |
| 2895 | |
| 2896 | case 47: |
| 2897 | |
| 2898 | { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;} |
| 2899 | break; |
| 2900 | |
| 2901 | case 48: |
| 2902 | |
| 2903 | { |
| 2904 | (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable); |
| 2905 | if ((yyval.interm.intermTypedNode) == 0) { |
| 2906 | context->binaryOpError((yyvsp[(2) - (3)].lex).line, "==", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); |
| 2907 | context->recover(); |
| 2908 | ConstantUnion *unionArray = new ConstantUnion[1]; |
| 2909 | unionArray->setBConst(false); |
| 2910 | (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line); |
| 2911 | } |
| 2912 | ;} |
| 2913 | break; |
| 2914 | |
| 2915 | case 49: |
| 2916 | |
| 2917 | { |
| 2918 | (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpNotEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable); |
| 2919 | if ((yyval.interm.intermTypedNode) == 0) { |
| 2920 | context->binaryOpError((yyvsp[(2) - (3)].lex).line, "!=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); |
| 2921 | context->recover(); |
| 2922 | ConstantUnion *unionArray = new ConstantUnion[1]; |
| 2923 | unionArray->setBConst(false); |
| 2924 | (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line); |
| 2925 | } |
| 2926 | ;} |
| 2927 | break; |
| 2928 | |
| 2929 | case 50: |
| 2930 | |
| 2931 | { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;} |
| 2932 | break; |
| 2933 | |
| 2934 | case 51: |
| 2935 | |
| 2936 | { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;} |
| 2937 | break; |
| 2938 | |
| 2939 | case 52: |
| 2940 | |
| 2941 | { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;} |
| 2942 | break; |
| 2943 | |
| 2944 | case 53: |
| 2945 | |
| 2946 | { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;} |
| 2947 | break; |
| 2948 | |
| 2949 | case 54: |
| 2950 | |
| 2951 | { |
| 2952 | (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalAnd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable); |
| 2953 | if ((yyval.interm.intermTypedNode) == 0) { |
| 2954 | context->binaryOpError((yyvsp[(2) - (3)].lex).line, "&&", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); |
| 2955 | context->recover(); |
| 2956 | ConstantUnion *unionArray = new ConstantUnion[1]; |
| 2957 | unionArray->setBConst(false); |
| 2958 | (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line); |
| 2959 | } |
| 2960 | ;} |
| 2961 | break; |
| 2962 | |
| 2963 | case 55: |
| 2964 | |
| 2965 | { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;} |
| 2966 | break; |
| 2967 | |
| 2968 | case 56: |
| 2969 | |
| 2970 | { |
| 2971 | (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalXor, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable); |
| 2972 | if ((yyval.interm.intermTypedNode) == 0) { |
| 2973 | context->binaryOpError((yyvsp[(2) - (3)].lex).line, "^^", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); |
| 2974 | context->recover(); |
| 2975 | ConstantUnion *unionArray = new ConstantUnion[1]; |
| 2976 | unionArray->setBConst(false); |
| 2977 | (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line); |
| 2978 | } |
| 2979 | ;} |
| 2980 | break; |
| 2981 | |
| 2982 | case 57: |
| 2983 | |
| 2984 | { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;} |
| 2985 | break; |
| 2986 | |
| 2987 | case 58: |
| 2988 | |
| 2989 | { |
| 2990 | (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalOr, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable); |
| 2991 | if ((yyval.interm.intermTypedNode) == 0) { |
| 2992 | context->binaryOpError((yyvsp[(2) - (3)].lex).line, "||", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); |
| 2993 | context->recover(); |
| 2994 | ConstantUnion *unionArray = new ConstantUnion[1]; |
| 2995 | unionArray->setBConst(false); |
| 2996 | (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line); |
| 2997 | } |
| 2998 | ;} |
| 2999 | break; |
| 3000 | |
| 3001 | case 59: |
| 3002 | |
| 3003 | { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;} |
| 3004 | break; |
| 3005 | |
| 3006 | case 60: |
| 3007 | |
| 3008 | { |
| 3009 | if (context->boolErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.intermTypedNode))) |
| 3010 | context->recover(); |
| 3011 | |
| 3012 | (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); |
| 3013 | if ((yyvsp[(3) - (5)].interm.intermTypedNode)->getType() != (yyvsp[(5) - (5)].interm.intermTypedNode)->getType()) |
| 3014 | (yyval.interm.intermTypedNode) = 0; |
| 3015 | |
| 3016 | if ((yyval.interm.intermTypedNode) == 0) { |
| 3017 | context->binaryOpError((yyvsp[(2) - (5)].lex).line, ":", (yyvsp[(3) - (5)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(5) - (5)].interm.intermTypedNode)->getCompleteString()); |
| 3018 | context->recover(); |
| 3019 | (yyval.interm.intermTypedNode) = (yyvsp[(5) - (5)].interm.intermTypedNode); |
| 3020 | } |
| 3021 | ;} |
| 3022 | break; |
| 3023 | |
| 3024 | case 61: |
| 3025 | |
| 3026 | { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;} |
| 3027 | break; |
| 3028 | |
| 3029 | case 62: |
| 3030 | |
| 3031 | { |
| 3032 | if (context->lValueErrorCheck((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode))) |
| 3033 | context->recover(); |
| 3034 | (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); |
| 3035 | if ((yyval.interm.intermTypedNode) == 0) { |
| 3036 | context->assignError((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); |
| 3037 | context->recover(); |
| 3038 | (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode); |
| 3039 | } |
| 3040 | ;} |
| 3041 | break; |
| 3042 | |
| 3043 | case 63: |
| 3044 | |
| 3045 | { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAssign; ;} |
| 3046 | break; |
| 3047 | |
| 3048 | case 64: |
| 3049 | |
| 3050 | { FRAG_VERT_ONLY("*=", (yyvsp[(1) - (1)].lex).line); (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpMulAssign; ;} |
| 3051 | break; |
| 3052 | |
| 3053 | case 65: |
| 3054 | |
| 3055 | { FRAG_VERT_ONLY("/=", (yyvsp[(1) - (1)].lex).line); (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpDivAssign; ;} |
| 3056 | break; |
| 3057 | |
| 3058 | case 66: |
| 3059 | |
| 3060 | { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAddAssign; ;} |
| 3061 | break; |
| 3062 | |
| 3063 | case 67: |
| 3064 | |
| 3065 | { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpSubAssign; ;} |
| 3066 | break; |
| 3067 | |
| 3068 | case 68: |
| 3069 | |
| 3070 | { |
| 3071 | (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); |
| 3072 | ;} |
| 3073 | break; |
| 3074 | |
| 3075 | case 69: |
| 3076 | |
| 3077 | { |
| 3078 | (yyval.interm.intermTypedNode) = context->intermediate.addComma((yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line); |
| 3079 | if ((yyval.interm.intermTypedNode) == 0) { |
| 3080 | context->binaryOpError((yyvsp[(2) - (3)].lex).line, ",", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); |
| 3081 | context->recover(); |
| 3082 | (yyval.interm.intermTypedNode) = (yyvsp[(3) - (3)].interm.intermTypedNode); |
| 3083 | } |
| 3084 | ;} |
| 3085 | break; |
| 3086 | |
| 3087 | case 70: |
| 3088 | |
| 3089 | { |
| 3090 | if (context->constErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode))) |
| 3091 | context->recover(); |
| 3092 | (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); |
| 3093 | ;} |
| 3094 | break; |
| 3095 | |
| 3096 | case 71: |
| 3097 | |
| 3098 | { |
| 3099 | TFunction &function = *((yyvsp[(1) - (2)].interm).function); |
| 3100 | |
| 3101 | TIntermAggregate *prototype = new TIntermAggregate; |
| 3102 | prototype->setType(function.getReturnType()); |
| 3103 | prototype->setName(function.getName()); |
| 3104 | |
| 3105 | for (int i = 0; i < function.getParamCount(); i++) |
| 3106 | { |
| 3107 | const TParameter ¶m = function.getParam(i); |
| 3108 | if (param.name != 0) |
| 3109 | { |
| 3110 | TVariable *variable = new TVariable(param.name, *param.type); |
| 3111 | |
| 3112 | prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(variable->getUniqueId(), variable->getName(), variable->getType(), (yyvsp[(1) - (2)].interm).line), (yyvsp[(1) - (2)].interm).line); |
| 3113 | } |
| 3114 | else |
| 3115 | { |
| 3116 | prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (2)].interm).line), (yyvsp[(1) - (2)].interm).line); |
| 3117 | } |
| 3118 | } |
| 3119 | |
| 3120 | prototype->setOp(EOpPrototype); |
| 3121 | (yyval.interm.intermNode) = prototype; |
| 3122 | ;} |
| 3123 | break; |
| 3124 | |
| 3125 | case 72: |
| 3126 | |
| 3127 | { |
| 3128 | if ((yyvsp[(1) - (2)].interm).intermAggregate) |
| 3129 | (yyvsp[(1) - (2)].interm).intermAggregate->setOp(EOpDeclaration); |
| 3130 | (yyval.interm.intermNode) = (yyvsp[(1) - (2)].interm).intermAggregate; |
| 3131 | ;} |
| 3132 | break; |
| 3133 | |
| 3134 | case 73: |
| 3135 | |
| 3136 | { |
| 3137 | context->symbolTable.setDefaultPrecision( (yyvsp[(3) - (4)].interm.type).type, (yyvsp[(2) - (4)].interm.precision) ); |
| 3138 | (yyval.interm.intermNode) = 0; |
| 3139 | ;} |
| 3140 | break; |
| 3141 | |
| 3142 | case 74: |
| 3143 | |
| 3144 | { |
| 3145 | // |
| 3146 | // Multiple declarations of the same function are allowed. |
| 3147 | // |
| 3148 | // If this is a definition, the definition production code will check for redefinitions |
| 3149 | // (we don't know at this point if it's a definition or not). |
| 3150 | // |
| 3151 | // Redeclarations are allowed. But, return types and parameter qualifiers must match. |
| 3152 | // |
| 3153 | TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find((yyvsp[(1) - (2)].interm.function)->getMangledName())); |
| 3154 | if (prevDec) { |
| 3155 | if (prevDec->getReturnType() != (yyvsp[(1) - (2)].interm.function)->getReturnType()) { |
| 3156 | context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same return type", (yyvsp[(1) - (2)].interm.function)->getReturnType().getBasicString(), ""); |
| 3157 | context->recover(); |
| 3158 | } |
| 3159 | for (int i = 0; i < prevDec->getParamCount(); ++i) { |
| 3160 | if (prevDec->getParam(i).type->getQualifier() != (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifier()) { |
| 3161 | context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same parameter qualifiers", (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifierString(), ""); |
| 3162 | context->recover(); |
| 3163 | } |
| 3164 | } |
| 3165 | } |
| 3166 | |
| 3167 | // |
| 3168 | // If this is a redeclaration, it could also be a definition, |
| 3169 | // in which case, we want to use the variable names from this one, and not the one that's |
| 3170 | // being redeclared. So, pass back up this declaration, not the one in the symbol table. |
| 3171 | // |
| 3172 | (yyval.interm).function = (yyvsp[(1) - (2)].interm.function); |
| 3173 | (yyval.interm).line = (yyvsp[(2) - (2)].lex).line; |
| 3174 | |
| 3175 | context->symbolTable.insert(*(yyval.interm).function); |
| 3176 | ;} |
| 3177 | break; |
| 3178 | |
| 3179 | case 75: |
| 3180 | |
| 3181 | { |
| 3182 | (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function); |
| 3183 | ;} |
| 3184 | break; |
| 3185 | |
| 3186 | case 76: |
| 3187 | |
| 3188 | { |
| 3189 | (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function); |
| 3190 | ;} |
| 3191 | break; |
| 3192 | |
| 3193 | case 77: |
| 3194 | |
| 3195 | { |
| 3196 | // Add the parameter |
| 3197 | (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function); |
| 3198 | if ((yyvsp[(2) - (2)].interm).param.type->getBasicType() != EbtVoid) |
| 3199 | (yyvsp[(1) - (2)].interm.function)->addParameter((yyvsp[(2) - (2)].interm).param); |
| 3200 | else |
| 3201 | delete (yyvsp[(2) - (2)].interm).param.type; |
| 3202 | ;} |
| 3203 | break; |
| 3204 | |
| 3205 | case 78: |
| 3206 | |
| 3207 | { |
| 3208 | // |
| 3209 | // Only first parameter of one-parameter functions can be void |
| 3210 | // The check for named parameters not being void is done in parameter_declarator |
| 3211 | // |
| 3212 | if ((yyvsp[(3) - (3)].interm).param.type->getBasicType() == EbtVoid) { |
| 3213 | // |
| 3214 | // This parameter > first is void |
| 3215 | // |
| 3216 | context->error((yyvsp[(2) - (3)].lex).line, "cannot be an argument type except for '(void)'", "void", ""); |
| 3217 | context->recover(); |
| 3218 | delete (yyvsp[(3) - (3)].interm).param.type; |
| 3219 | } else { |
| 3220 | // Add the parameter |
| 3221 | (yyval.interm.function) = (yyvsp[(1) - (3)].interm.function); |
| 3222 | (yyvsp[(1) - (3)].interm.function)->addParameter((yyvsp[(3) - (3)].interm).param); |
| 3223 | } |
| 3224 | ;} |
| 3225 | break; |
| 3226 | |
| 3227 | case 79: |
| 3228 | |
| 3229 | { |
| 3230 | if ((yyvsp[(1) - (3)].interm.type).qualifier != EvqGlobal && (yyvsp[(1) - (3)].interm.type).qualifier != EvqTemporary) { |
| 3231 | context->error((yyvsp[(2) - (3)].lex).line, "no qualifiers allowed for function return", getQualifierString((yyvsp[(1) - (3)].interm.type).qualifier), ""); |
| 3232 | context->recover(); |
| 3233 | } |
| 3234 | // make sure a sampler is not involved as well... |
| 3235 | if (context->structQualifierErrorCheck((yyvsp[(2) - (3)].lex).line, (yyvsp[(1) - (3)].interm.type))) |
| 3236 | context->recover(); |
| 3237 | |
| 3238 | // Add the function as a prototype after parsing it (we do not support recursion) |
| 3239 | TFunction *function; |
| 3240 | TType type((yyvsp[(1) - (3)].interm.type)); |
| 3241 | function = new TFunction((yyvsp[(2) - (3)].lex).string, type); |
| 3242 | (yyval.interm.function) = function; |
| 3243 | ;} |
| 3244 | break; |
| 3245 | |
| 3246 | case 80: |
| 3247 | |
| 3248 | { |
| 3249 | if ((yyvsp[(1) - (2)].interm.type).type == EbtVoid) { |
| 3250 | context->error((yyvsp[(2) - (2)].lex).line, "illegal use of type 'void'", (yyvsp[(2) - (2)].lex).string->c_str(), ""); |
| 3251 | context->recover(); |
| 3252 | } |
| 3253 | if (context->reservedErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string)) |
| 3254 | context->recover(); |
| 3255 | TParameter param = {(yyvsp[(2) - (2)].lex).string, new TType((yyvsp[(1) - (2)].interm.type))}; |
| 3256 | (yyval.interm).line = (yyvsp[(2) - (2)].lex).line; |
| 3257 | (yyval.interm).param = param; |
| 3258 | ;} |
| 3259 | break; |
| 3260 | |
| 3261 | case 81: |
| 3262 | |
| 3263 | { |
| 3264 | // Check that we can make an array out of this type |
| 3265 | if (context->arrayTypeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type))) |
| 3266 | context->recover(); |
| 3267 | |
| 3268 | if (context->reservedErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string)) |
| 3269 | context->recover(); |
| 3270 | |
| 3271 | int size; |
| 3272 | if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size)) |
| 3273 | context->recover(); |
| 3274 | (yyvsp[(1) - (5)].interm.type).setArray(true, size); |
| 3275 | |
| 3276 | TType* type = new TType((yyvsp[(1) - (5)].interm.type)); |
| 3277 | TParameter param = { (yyvsp[(2) - (5)].lex).string, type }; |
| 3278 | (yyval.interm).line = (yyvsp[(2) - (5)].lex).line; |
| 3279 | (yyval.interm).param = param; |
| 3280 | ;} |
| 3281 | break; |
| 3282 | |
| 3283 | case 82: |
| 3284 | |
| 3285 | { |
| 3286 | (yyval.interm) = (yyvsp[(3) - (3)].interm); |
| 3287 | if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type)) |
| 3288 | context->recover(); |
| 3289 | ;} |
| 3290 | break; |
| 3291 | |
| 3292 | case 83: |
| 3293 | |
| 3294 | { |
| 3295 | (yyval.interm) = (yyvsp[(2) - (2)].interm); |
| 3296 | if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type)) |
| 3297 | context->recover(); |
| 3298 | if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type)) |
| 3299 | context->recover(); |
| 3300 | ;} |
| 3301 | break; |
| 3302 | |
| 3303 | case 84: |
| 3304 | |
| 3305 | { |
| 3306 | (yyval.interm) = (yyvsp[(3) - (3)].interm); |
| 3307 | if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type)) |
| 3308 | context->recover(); |
| 3309 | ;} |
| 3310 | break; |
| 3311 | |
| 3312 | case 85: |
| 3313 | |
| 3314 | { |
| 3315 | (yyval.interm) = (yyvsp[(2) - (2)].interm); |
| 3316 | if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type)) |
| 3317 | context->recover(); |
| 3318 | if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type)) |
| 3319 | context->recover(); |
| 3320 | ;} |
| 3321 | break; |
| 3322 | |
| 3323 | case 86: |
| 3324 | |
| 3325 | { |
| 3326 | (yyval.interm.qualifier) = EvqIn; |
| 3327 | ;} |
| 3328 | break; |
| 3329 | |
| 3330 | case 87: |
| 3331 | |
| 3332 | { |
| 3333 | (yyval.interm.qualifier) = EvqIn; |
| 3334 | ;} |
| 3335 | break; |
| 3336 | |
| 3337 | case 88: |
| 3338 | |
| 3339 | { |
| 3340 | (yyval.interm.qualifier) = EvqOut; |
| 3341 | ;} |
| 3342 | break; |
| 3343 | |
| 3344 | case 89: |
| 3345 | |
| 3346 | { |
| 3347 | (yyval.interm.qualifier) = EvqInOut; |
| 3348 | ;} |
| 3349 | break; |
| 3350 | |
| 3351 | case 90: |
| 3352 | |
| 3353 | { |
| 3354 | TParameter param = { 0, new TType((yyvsp[(1) - (1)].interm.type)) }; |
| 3355 | (yyval.interm).param = param; |
| 3356 | ;} |
| 3357 | break; |
| 3358 | |
| 3359 | case 91: |
| 3360 | |
| 3361 | { |
| 3362 | (yyval.interm) = (yyvsp[(1) - (1)].interm); |
| 3363 | |
| 3364 | if ((yyval.interm).type.precision == EbpUndefined) { |
| 3365 | (yyval.interm).type.precision = context->symbolTable.getDefaultPrecision((yyvsp[(1) - (1)].interm).type.type); |
| 3366 | if (context->precisionErrorCheck((yyvsp[(1) - (1)].interm).line, (yyval.interm).type.precision, (yyvsp[(1) - (1)].interm).type.type)) { |
| 3367 | context->recover(); |
| 3368 | } |
| 3369 | } |
| 3370 | ;} |
| 3371 | break; |
| 3372 | |
| 3373 | case 92: |
| 3374 | |
| 3375 | { |
zmo@google.com | fd747b8 | 2011-04-23 01:30:07 +0000 | [diff] [blame] | 3376 | TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(3) - (3)].lex).string, TType((yyvsp[(1) - (3)].interm).type), (yyvsp[(3) - (3)].lex).line); |
| 3377 | (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermNode, symbol, (yyvsp[(3) - (3)].lex).line); |
alokp@chromium.org | 044a5cf | 2010-11-12 15:42:16 +0000 | [diff] [blame] | 3378 | |
| 3379 | if (context->structQualifierErrorCheck((yyvsp[(3) - (3)].lex).line, (yyval.interm).type)) |
| 3380 | context->recover(); |
| 3381 | |
| 3382 | if (context->nonInitConstErrorCheck((yyvsp[(3) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyval.interm).type)) |
| 3383 | context->recover(); |
| 3384 | |
zmo@google.com | fd747b8 | 2011-04-23 01:30:07 +0000 | [diff] [blame] | 3385 | TVariable* variable = 0; |
| 3386 | if (context->nonInitErrorCheck((yyvsp[(3) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyval.interm).type, variable)) |
alokp@chromium.org | 044a5cf | 2010-11-12 15:42:16 +0000 | [diff] [blame] | 3387 | context->recover(); |
zmo@google.com | fd747b8 | 2011-04-23 01:30:07 +0000 | [diff] [blame] | 3388 | if (symbol && variable) |
| 3389 | symbol->setId(variable->getUniqueId()); |
alokp@chromium.org | 044a5cf | 2010-11-12 15:42:16 +0000 | [diff] [blame] | 3390 | ;} |
| 3391 | break; |
| 3392 | |
| 3393 | case 93: |
| 3394 | |
| 3395 | { |
| 3396 | if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type)) |
| 3397 | context->recover(); |
| 3398 | |
| 3399 | if (context->nonInitConstErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type)) |
| 3400 | context->recover(); |
| 3401 | |
| 3402 | (yyval.interm) = (yyvsp[(1) - (5)].interm); |
| 3403 | |
| 3404 | 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)) |
| 3405 | context->recover(); |
| 3406 | else { |
| 3407 | (yyvsp[(1) - (5)].interm).type.setArray(true); |
| 3408 | TVariable* variable; |
| 3409 | if (context->arrayErrorCheck((yyvsp[(4) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, variable)) |
| 3410 | context->recover(); |
| 3411 | } |
| 3412 | ;} |
| 3413 | break; |
| 3414 | |
| 3415 | case 94: |
| 3416 | |
| 3417 | { |
| 3418 | if (context->structQualifierErrorCheck((yyvsp[(3) - (6)].lex).line, (yyvsp[(1) - (6)].interm).type)) |
| 3419 | context->recover(); |
| 3420 | |
| 3421 | if (context->nonInitConstErrorCheck((yyvsp[(3) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type)) |
| 3422 | context->recover(); |
| 3423 | |
| 3424 | (yyval.interm) = (yyvsp[(1) - (6)].interm); |
| 3425 | |
| 3426 | 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)) |
| 3427 | context->recover(); |
| 3428 | else { |
| 3429 | int size; |
| 3430 | if (context->arraySizeErrorCheck((yyvsp[(4) - (6)].lex).line, (yyvsp[(5) - (6)].interm.intermTypedNode), size)) |
| 3431 | context->recover(); |
| 3432 | (yyvsp[(1) - (6)].interm).type.setArray(true, size); |
zmo@google.com | fd747b8 | 2011-04-23 01:30:07 +0000 | [diff] [blame] | 3433 | TVariable* variable = 0; |
alokp@chromium.org | 044a5cf | 2010-11-12 15:42:16 +0000 | [diff] [blame] | 3434 | if (context->arrayErrorCheck((yyvsp[(4) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type, variable)) |
| 3435 | context->recover(); |
| 3436 | TType type = TType((yyvsp[(1) - (6)].interm).type); |
| 3437 | type.setArraySize(size); |
zmo@google.com | fd747b8 | 2011-04-23 01:30:07 +0000 | [diff] [blame] | 3438 | (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (6)].interm).intermNode, context->intermediate.addSymbol(variable ? variable->getUniqueId() : 0, *(yyvsp[(3) - (6)].lex).string, type, (yyvsp[(3) - (6)].lex).line), (yyvsp[(3) - (6)].lex).line); |
alokp@chromium.org | 044a5cf | 2010-11-12 15:42:16 +0000 | [diff] [blame] | 3439 | } |
| 3440 | ;} |
| 3441 | break; |
| 3442 | |
| 3443 | case 95: |
| 3444 | |
| 3445 | { |
| 3446 | if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type)) |
| 3447 | context->recover(); |
| 3448 | |
| 3449 | (yyval.interm) = (yyvsp[(1) - (5)].interm); |
| 3450 | |
| 3451 | TIntermNode* intermNode; |
| 3452 | if (!context->executeInitializer((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, (yyvsp[(5) - (5)].interm.intermTypedNode), intermNode)) { |
| 3453 | // |
| 3454 | // build the intermediate representation |
| 3455 | // |
| 3456 | if (intermNode) |
| 3457 | (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (5)].interm).intermNode, intermNode, (yyvsp[(4) - (5)].lex).line); |
| 3458 | else |
| 3459 | (yyval.interm).intermAggregate = (yyvsp[(1) - (5)].interm).intermAggregate; |
| 3460 | } else { |
| 3461 | context->recover(); |
| 3462 | (yyval.interm).intermAggregate = 0; |
| 3463 | } |
| 3464 | ;} |
| 3465 | break; |
| 3466 | |
| 3467 | case 96: |
| 3468 | |
| 3469 | { |
| 3470 | (yyval.interm).type = (yyvsp[(1) - (1)].interm.type); |
| 3471 | (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); |
| 3472 | ;} |
| 3473 | break; |
| 3474 | |
| 3475 | case 97: |
| 3476 | |
| 3477 | { |
zmo@google.com | fd747b8 | 2011-04-23 01:30:07 +0000 | [diff] [blame] | 3478 | TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyvsp[(1) - (2)].interm.type)), (yyvsp[(2) - (2)].lex).line); |
| 3479 | (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (2)].lex).line); |
alokp@chromium.org | 044a5cf | 2010-11-12 15:42:16 +0000 | [diff] [blame] | 3480 | |
| 3481 | if (context->structQualifierErrorCheck((yyvsp[(2) - (2)].lex).line, (yyval.interm).type)) |
| 3482 | context->recover(); |
| 3483 | |
| 3484 | if (context->nonInitConstErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string, (yyval.interm).type)) |
| 3485 | context->recover(); |
| 3486 | |
| 3487 | (yyval.interm).type = (yyvsp[(1) - (2)].interm.type); |
| 3488 | |
zmo@google.com | fd747b8 | 2011-04-23 01:30:07 +0000 | [diff] [blame] | 3489 | TVariable* variable = 0; |
| 3490 | if (context->nonInitErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string, (yyval.interm).type, variable)) |
alokp@chromium.org | 044a5cf | 2010-11-12 15:42:16 +0000 | [diff] [blame] | 3491 | context->recover(); |
zmo@google.com | fd747b8 | 2011-04-23 01:30:07 +0000 | [diff] [blame] | 3492 | if (variable && symbol) |
| 3493 | symbol->setId(variable->getUniqueId()); |
alokp@chromium.org | 044a5cf | 2010-11-12 15:42:16 +0000 | [diff] [blame] | 3494 | ;} |
| 3495 | break; |
| 3496 | |
| 3497 | case 98: |
| 3498 | |
| 3499 | { |
kbr@chromium.org | 04277b8 | 2011-06-02 18:41:26 +0000 | [diff] [blame^] | 3500 | context->error((yyvsp[(2) - (4)].lex).line, "unsized array declarations not supported", (yyvsp[(2) - (4)].lex).string->c_str(), ""); |
| 3501 | context->recover(); |
| 3502 | |
zmo@google.com | fd747b8 | 2011-04-23 01:30:07 +0000 | [diff] [blame] | 3503 | TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (4)].lex).string, TType((yyvsp[(1) - (4)].interm.type)), (yyvsp[(2) - (4)].lex).line); |
| 3504 | (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (4)].lex).line); |
alokp@chromium.org | 044a5cf | 2010-11-12 15:42:16 +0000 | [diff] [blame] | 3505 | (yyval.interm).type = (yyvsp[(1) - (4)].interm.type); |
alokp@chromium.org | 044a5cf | 2010-11-12 15:42:16 +0000 | [diff] [blame] | 3506 | ;} |
| 3507 | break; |
| 3508 | |
| 3509 | case 99: |
| 3510 | |
| 3511 | { |
| 3512 | TType type = TType((yyvsp[(1) - (5)].interm.type)); |
| 3513 | int size; |
| 3514 | if (context->arraySizeErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size)) |
| 3515 | context->recover(); |
| 3516 | type.setArraySize(size); |
zmo@google.com | fd747b8 | 2011-04-23 01:30:07 +0000 | [diff] [blame] | 3517 | TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (5)].lex).string, type, (yyvsp[(2) - (5)].lex).line); |
| 3518 | (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (5)].lex).line); |
alokp@chromium.org | 044a5cf | 2010-11-12 15:42:16 +0000 | [diff] [blame] | 3519 | |
| 3520 | if (context->structQualifierErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type))) |
| 3521 | context->recover(); |
| 3522 | |
| 3523 | if (context->nonInitConstErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type))) |
| 3524 | context->recover(); |
| 3525 | |
| 3526 | (yyval.interm).type = (yyvsp[(1) - (5)].interm.type); |
| 3527 | |
| 3528 | 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))) |
| 3529 | context->recover(); |
| 3530 | else { |
| 3531 | int size; |
| 3532 | if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size)) |
| 3533 | context->recover(); |
| 3534 | |
| 3535 | (yyvsp[(1) - (5)].interm.type).setArray(true, size); |
zmo@google.com | fd747b8 | 2011-04-23 01:30:07 +0000 | [diff] [blame] | 3536 | TVariable* variable = 0; |
alokp@chromium.org | 044a5cf | 2010-11-12 15:42:16 +0000 | [diff] [blame] | 3537 | if (context->arrayErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type), variable)) |
| 3538 | context->recover(); |
zmo@google.com | fd747b8 | 2011-04-23 01:30:07 +0000 | [diff] [blame] | 3539 | if (variable && symbol) |
| 3540 | symbol->setId(variable->getUniqueId()); |
alokp@chromium.org | 044a5cf | 2010-11-12 15:42:16 +0000 | [diff] [blame] | 3541 | } |
| 3542 | ;} |
| 3543 | break; |
| 3544 | |
| 3545 | case 100: |
| 3546 | |
| 3547 | { |
| 3548 | if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type))) |
| 3549 | context->recover(); |
| 3550 | |
| 3551 | (yyval.interm).type = (yyvsp[(1) - (4)].interm.type); |
| 3552 | |
| 3553 | TIntermNode* intermNode; |
| 3554 | if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode)) { |
| 3555 | // |
| 3556 | // Build intermediate representation |
| 3557 | // |
| 3558 | if(intermNode) |
| 3559 | (yyval.interm).intermAggregate = context->intermediate.makeAggregate(intermNode, (yyvsp[(3) - (4)].lex).line); |
| 3560 | else |
| 3561 | (yyval.interm).intermAggregate = 0; |
| 3562 | } else { |
| 3563 | context->recover(); |
| 3564 | (yyval.interm).intermAggregate = 0; |
| 3565 | } |
| 3566 | ;} |
| 3567 | break; |
| 3568 | |
| 3569 | case 101: |
| 3570 | |
| 3571 | { |
| 3572 | VERTEX_ONLY("invariant declaration", (yyvsp[(1) - (2)].lex).line); |
| 3573 | (yyval.interm).qualifier = EvqInvariantVaryingOut; |
| 3574 | (yyval.interm).intermAggregate = 0; |
| 3575 | ;} |
| 3576 | break; |
| 3577 | |
| 3578 | case 102: |
| 3579 | |
| 3580 | { |
| 3581 | (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type); |
| 3582 | |
| 3583 | if ((yyvsp[(1) - (1)].interm.type).array) { |
| 3584 | context->error((yyvsp[(1) - (1)].interm.type).line, "not supported", "first-class array", ""); |
| 3585 | context->recover(); |
| 3586 | (yyvsp[(1) - (1)].interm.type).setArray(false); |
| 3587 | } |
| 3588 | ;} |
| 3589 | break; |
| 3590 | |
| 3591 | case 103: |
| 3592 | |
| 3593 | { |
| 3594 | if ((yyvsp[(2) - (2)].interm.type).array) { |
| 3595 | context->error((yyvsp[(2) - (2)].interm.type).line, "not supported", "first-class array", ""); |
| 3596 | context->recover(); |
| 3597 | (yyvsp[(2) - (2)].interm.type).setArray(false); |
| 3598 | } |
| 3599 | |
| 3600 | if ((yyvsp[(1) - (2)].interm.type).qualifier == EvqAttribute && |
| 3601 | ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) { |
| 3602 | context->error((yyvsp[(2) - (2)].interm.type).line, "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier), ""); |
| 3603 | context->recover(); |
| 3604 | } |
| 3605 | if (((yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingIn || (yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingOut) && |
| 3606 | ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) { |
| 3607 | context->error((yyvsp[(2) - (2)].interm.type).line, "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier), ""); |
| 3608 | context->recover(); |
| 3609 | } |
| 3610 | (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type); |
| 3611 | (yyval.interm.type).qualifier = (yyvsp[(1) - (2)].interm.type).qualifier; |
| 3612 | ;} |
| 3613 | break; |
| 3614 | |
| 3615 | case 104: |
| 3616 | |
| 3617 | { |
| 3618 | (yyval.interm.type).setBasic(EbtVoid, EvqConst, (yyvsp[(1) - (1)].lex).line); |
| 3619 | ;} |
| 3620 | break; |
| 3621 | |
| 3622 | case 105: |
| 3623 | |
| 3624 | { |
| 3625 | VERTEX_ONLY("attribute", (yyvsp[(1) - (1)].lex).line); |
| 3626 | if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "attribute")) |
| 3627 | context->recover(); |
| 3628 | (yyval.interm.type).setBasic(EbtVoid, EvqAttribute, (yyvsp[(1) - (1)].lex).line); |
| 3629 | ;} |
| 3630 | break; |
| 3631 | |
| 3632 | case 106: |
| 3633 | |
| 3634 | { |
| 3635 | if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "varying")) |
| 3636 | context->recover(); |
| 3637 | if (context->shaderType == SH_VERTEX_SHADER) |
| 3638 | (yyval.interm.type).setBasic(EbtVoid, EvqVaryingOut, (yyvsp[(1) - (1)].lex).line); |
| 3639 | else |
| 3640 | (yyval.interm.type).setBasic(EbtVoid, EvqVaryingIn, (yyvsp[(1) - (1)].lex).line); |
| 3641 | ;} |
| 3642 | break; |
| 3643 | |
| 3644 | case 107: |
| 3645 | |
| 3646 | { |
| 3647 | if (context->globalErrorCheck((yyvsp[(1) - (2)].lex).line, context->symbolTable.atGlobalLevel(), "invariant varying")) |
| 3648 | context->recover(); |
| 3649 | if (context->shaderType == SH_VERTEX_SHADER) |
| 3650 | (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingOut, (yyvsp[(1) - (2)].lex).line); |
| 3651 | else |
| 3652 | (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingIn, (yyvsp[(1) - (2)].lex).line); |
| 3653 | ;} |
| 3654 | break; |
| 3655 | |
| 3656 | case 108: |
| 3657 | |
| 3658 | { |
| 3659 | if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "uniform")) |
| 3660 | context->recover(); |
| 3661 | (yyval.interm.type).setBasic(EbtVoid, EvqUniform, (yyvsp[(1) - (1)].lex).line); |
| 3662 | ;} |
| 3663 | break; |
| 3664 | |
| 3665 | case 109: |
| 3666 | |
| 3667 | { |
| 3668 | (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type); |
| 3669 | ;} |
| 3670 | break; |
| 3671 | |
| 3672 | case 110: |
| 3673 | |
| 3674 | { |
| 3675 | (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type); |
| 3676 | (yyval.interm.type).precision = (yyvsp[(1) - (2)].interm.precision); |
| 3677 | ;} |
| 3678 | break; |
| 3679 | |
| 3680 | case 111: |
| 3681 | |
| 3682 | { |
| 3683 | (yyval.interm.precision) = EbpHigh; |
| 3684 | ;} |
| 3685 | break; |
| 3686 | |
| 3687 | case 112: |
| 3688 | |
| 3689 | { |
| 3690 | (yyval.interm.precision) = EbpMedium; |
| 3691 | ;} |
| 3692 | break; |
| 3693 | |
| 3694 | case 113: |
| 3695 | |
| 3696 | { |
| 3697 | (yyval.interm.precision) = EbpLow; |
| 3698 | ;} |
| 3699 | break; |
| 3700 | |
| 3701 | case 114: |
| 3702 | |
| 3703 | { |
| 3704 | (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type); |
| 3705 | ;} |
| 3706 | break; |
| 3707 | |
| 3708 | case 115: |
| 3709 | |
| 3710 | { |
| 3711 | (yyval.interm.type) = (yyvsp[(1) - (4)].interm.type); |
| 3712 | |
| 3713 | if (context->arrayTypeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type))) |
| 3714 | context->recover(); |
| 3715 | else { |
| 3716 | int size; |
| 3717 | if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size)) |
| 3718 | context->recover(); |
| 3719 | (yyval.interm.type).setArray(true, size); |
| 3720 | } |
| 3721 | ;} |
| 3722 | break; |
| 3723 | |
| 3724 | case 116: |
| 3725 | |
| 3726 | { |
| 3727 | TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; |
| 3728 | (yyval.interm.type).setBasic(EbtVoid, qual, (yyvsp[(1) - (1)].lex).line); |
| 3729 | ;} |
| 3730 | break; |
| 3731 | |
| 3732 | case 117: |
| 3733 | |
| 3734 | { |
| 3735 | TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; |
| 3736 | (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line); |
| 3737 | ;} |
| 3738 | break; |
| 3739 | |
| 3740 | case 118: |
| 3741 | |
| 3742 | { |
| 3743 | TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; |
| 3744 | (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line); |
| 3745 | ;} |
| 3746 | break; |
| 3747 | |
| 3748 | case 119: |
| 3749 | |
| 3750 | { |
| 3751 | TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; |
| 3752 | (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line); |
| 3753 | ;} |
| 3754 | break; |
| 3755 | |
| 3756 | case 120: |
| 3757 | |
| 3758 | { |
| 3759 | TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; |
| 3760 | (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line); |
| 3761 | (yyval.interm.type).setAggregate(2); |
| 3762 | ;} |
| 3763 | break; |
| 3764 | |
| 3765 | case 121: |
| 3766 | |
| 3767 | { |
| 3768 | TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; |
| 3769 | (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line); |
| 3770 | (yyval.interm.type).setAggregate(3); |
| 3771 | ;} |
| 3772 | break; |
| 3773 | |
| 3774 | case 122: |
| 3775 | |
| 3776 | { |
| 3777 | TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; |
| 3778 | (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line); |
| 3779 | (yyval.interm.type).setAggregate(4); |
| 3780 | ;} |
| 3781 | break; |
| 3782 | |
| 3783 | case 123: |
| 3784 | |
| 3785 | { |
| 3786 | TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; |
| 3787 | (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line); |
| 3788 | (yyval.interm.type).setAggregate(2); |
| 3789 | ;} |
| 3790 | break; |
| 3791 | |
| 3792 | case 124: |
| 3793 | |
| 3794 | { |
| 3795 | TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; |
| 3796 | (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line); |
| 3797 | (yyval.interm.type).setAggregate(3); |
| 3798 | ;} |
| 3799 | break; |
| 3800 | |
| 3801 | case 125: |
| 3802 | |
| 3803 | { |
| 3804 | TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; |
| 3805 | (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line); |
| 3806 | (yyval.interm.type).setAggregate(4); |
| 3807 | ;} |
| 3808 | break; |
| 3809 | |
| 3810 | case 126: |
| 3811 | |
| 3812 | { |
| 3813 | TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; |
| 3814 | (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line); |
| 3815 | (yyval.interm.type).setAggregate(2); |
| 3816 | ;} |
| 3817 | break; |
| 3818 | |
| 3819 | case 127: |
| 3820 | |
| 3821 | { |
| 3822 | TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; |
| 3823 | (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line); |
| 3824 | (yyval.interm.type).setAggregate(3); |
| 3825 | ;} |
| 3826 | break; |
| 3827 | |
| 3828 | case 128: |
| 3829 | |
| 3830 | { |
| 3831 | TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; |
| 3832 | (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line); |
| 3833 | (yyval.interm.type).setAggregate(4); |
| 3834 | ;} |
| 3835 | break; |
| 3836 | |
| 3837 | case 129: |
| 3838 | |
| 3839 | { |
| 3840 | FRAG_VERT_ONLY("mat2", (yyvsp[(1) - (1)].lex).line); |
| 3841 | TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; |
| 3842 | (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line); |
| 3843 | (yyval.interm.type).setAggregate(2, true); |
| 3844 | ;} |
| 3845 | break; |
| 3846 | |
| 3847 | case 130: |
| 3848 | |
| 3849 | { |
| 3850 | FRAG_VERT_ONLY("mat3", (yyvsp[(1) - (1)].lex).line); |
| 3851 | TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; |
| 3852 | (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line); |
| 3853 | (yyval.interm.type).setAggregate(3, true); |
| 3854 | ;} |
| 3855 | break; |
| 3856 | |
| 3857 | case 131: |
| 3858 | |
| 3859 | { |
| 3860 | FRAG_VERT_ONLY("mat4", (yyvsp[(1) - (1)].lex).line); |
| 3861 | TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; |
| 3862 | (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line); |
| 3863 | (yyval.interm.type).setAggregate(4, true); |
| 3864 | ;} |
| 3865 | break; |
| 3866 | |
| 3867 | case 132: |
| 3868 | |
| 3869 | { |
| 3870 | FRAG_VERT_ONLY("sampler2D", (yyvsp[(1) - (1)].lex).line); |
| 3871 | TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; |
| 3872 | (yyval.interm.type).setBasic(EbtSampler2D, qual, (yyvsp[(1) - (1)].lex).line); |
| 3873 | ;} |
| 3874 | break; |
| 3875 | |
| 3876 | case 133: |
| 3877 | |
| 3878 | { |
| 3879 | FRAG_VERT_ONLY("samplerCube", (yyvsp[(1) - (1)].lex).line); |
| 3880 | TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; |
| 3881 | (yyval.interm.type).setBasic(EbtSamplerCube, qual, (yyvsp[(1) - (1)].lex).line); |
| 3882 | ;} |
| 3883 | break; |
| 3884 | |
| 3885 | case 134: |
| 3886 | |
| 3887 | { |
| 3888 | FRAG_VERT_ONLY("struct", (yyvsp[(1) - (1)].interm.type).line); |
| 3889 | (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type); |
| 3890 | (yyval.interm.type).qualifier = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; |
| 3891 | ;} |
| 3892 | break; |
| 3893 | |
| 3894 | case 135: |
| 3895 | |
| 3896 | { |
| 3897 | // |
| 3898 | // This is for user defined type names. The lexical phase looked up the |
| 3899 | // type. |
| 3900 | // |
| 3901 | TType& structure = static_cast<TVariable*>((yyvsp[(1) - (1)].lex).symbol)->getType(); |
| 3902 | TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; |
| 3903 | (yyval.interm.type).setBasic(EbtStruct, qual, (yyvsp[(1) - (1)].lex).line); |
| 3904 | (yyval.interm.type).userDef = &structure; |
| 3905 | ;} |
| 3906 | break; |
| 3907 | |
| 3908 | case 136: |
| 3909 | |
| 3910 | { |
| 3911 | if (context->reservedErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string)) |
| 3912 | context->recover(); |
| 3913 | |
| 3914 | TType* structure = new TType((yyvsp[(4) - (5)].interm.typeList), *(yyvsp[(2) - (5)].lex).string); |
| 3915 | TVariable* userTypeDef = new TVariable((yyvsp[(2) - (5)].lex).string, *structure, true); |
| 3916 | if (! context->symbolTable.insert(*userTypeDef)) { |
| 3917 | context->error((yyvsp[(2) - (5)].lex).line, "redefinition", (yyvsp[(2) - (5)].lex).string->c_str(), "struct"); |
| 3918 | context->recover(); |
| 3919 | } |
| 3920 | (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (5)].lex).line); |
| 3921 | (yyval.interm.type).userDef = structure; |
| 3922 | ;} |
| 3923 | break; |
| 3924 | |
| 3925 | case 137: |
| 3926 | |
| 3927 | { |
| 3928 | TType* structure = new TType((yyvsp[(3) - (4)].interm.typeList), TString("")); |
| 3929 | (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (4)].lex).line); |
| 3930 | (yyval.interm.type).userDef = structure; |
| 3931 | ;} |
| 3932 | break; |
| 3933 | |
| 3934 | case 138: |
| 3935 | |
| 3936 | { |
| 3937 | (yyval.interm.typeList) = (yyvsp[(1) - (1)].interm.typeList); |
| 3938 | ;} |
| 3939 | break; |
| 3940 | |
| 3941 | case 139: |
| 3942 | |
| 3943 | { |
| 3944 | (yyval.interm.typeList) = (yyvsp[(1) - (2)].interm.typeList); |
| 3945 | for (unsigned int i = 0; i < (yyvsp[(2) - (2)].interm.typeList)->size(); ++i) { |
| 3946 | for (unsigned int j = 0; j < (yyval.interm.typeList)->size(); ++j) { |
| 3947 | if ((*(yyval.interm.typeList))[j].type->getFieldName() == (*(yyvsp[(2) - (2)].interm.typeList))[i].type->getFieldName()) { |
| 3948 | 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()); |
| 3949 | context->recover(); |
| 3950 | } |
| 3951 | } |
| 3952 | (yyval.interm.typeList)->push_back((*(yyvsp[(2) - (2)].interm.typeList))[i]); |
| 3953 | } |
| 3954 | ;} |
| 3955 | break; |
| 3956 | |
| 3957 | case 140: |
| 3958 | |
| 3959 | { |
| 3960 | (yyval.interm.typeList) = (yyvsp[(2) - (3)].interm.typeList); |
| 3961 | |
| 3962 | if (context->voidErrorCheck((yyvsp[(1) - (3)].interm.type).line, (*(yyvsp[(2) - (3)].interm.typeList))[0].type->getFieldName(), (yyvsp[(1) - (3)].interm.type))) { |
| 3963 | context->recover(); |
| 3964 | } |
| 3965 | for (unsigned int i = 0; i < (yyval.interm.typeList)->size(); ++i) { |
| 3966 | // |
| 3967 | // Careful not to replace already known aspects of type, like array-ness |
| 3968 | // |
| 3969 | TType* type = (*(yyval.interm.typeList))[i].type; |
| 3970 | type->setBasicType((yyvsp[(1) - (3)].interm.type).type); |
| 3971 | type->setNominalSize((yyvsp[(1) - (3)].interm.type).size); |
| 3972 | type->setMatrix((yyvsp[(1) - (3)].interm.type).matrix); |
| 3973 | |
| 3974 | // don't allow arrays of arrays |
| 3975 | if (type->isArray()) { |
| 3976 | if (context->arrayTypeErrorCheck((yyvsp[(1) - (3)].interm.type).line, (yyvsp[(1) - (3)].interm.type))) |
| 3977 | context->recover(); |
| 3978 | } |
| 3979 | if ((yyvsp[(1) - (3)].interm.type).array) |
| 3980 | type->setArraySize((yyvsp[(1) - (3)].interm.type).arraySize); |
| 3981 | if ((yyvsp[(1) - (3)].interm.type).userDef) { |
| 3982 | type->setStruct((yyvsp[(1) - (3)].interm.type).userDef->getStruct()); |
| 3983 | type->setTypeName((yyvsp[(1) - (3)].interm.type).userDef->getTypeName()); |
| 3984 | } |
| 3985 | } |
| 3986 | ;} |
| 3987 | break; |
| 3988 | |
| 3989 | case 141: |
| 3990 | |
| 3991 | { |
| 3992 | (yyval.interm.typeList) = NewPoolTTypeList(); |
| 3993 | (yyval.interm.typeList)->push_back((yyvsp[(1) - (1)].interm.typeLine)); |
| 3994 | ;} |
| 3995 | break; |
| 3996 | |
| 3997 | case 142: |
| 3998 | |
| 3999 | { |
| 4000 | (yyval.interm.typeList)->push_back((yyvsp[(3) - (3)].interm.typeLine)); |
| 4001 | ;} |
| 4002 | break; |
| 4003 | |
| 4004 | case 143: |
| 4005 | |
| 4006 | { |
| 4007 | if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string)) |
| 4008 | context->recover(); |
| 4009 | |
| 4010 | (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined); |
| 4011 | (yyval.interm.typeLine).line = (yyvsp[(1) - (1)].lex).line; |
| 4012 | (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (1)].lex).string); |
| 4013 | ;} |
| 4014 | break; |
| 4015 | |
| 4016 | case 144: |
| 4017 | |
| 4018 | { |
| 4019 | if (context->reservedErrorCheck((yyvsp[(1) - (4)].lex).line, *(yyvsp[(1) - (4)].lex).string)) |
| 4020 | context->recover(); |
| 4021 | |
| 4022 | (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined); |
| 4023 | (yyval.interm.typeLine).line = (yyvsp[(1) - (4)].lex).line; |
| 4024 | (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (4)].lex).string); |
| 4025 | |
| 4026 | int size; |
| 4027 | if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size)) |
| 4028 | context->recover(); |
| 4029 | (yyval.interm.typeLine).type->setArraySize(size); |
| 4030 | ;} |
| 4031 | break; |
| 4032 | |
| 4033 | case 145: |
| 4034 | |
| 4035 | { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;} |
| 4036 | break; |
| 4037 | |
| 4038 | case 146: |
| 4039 | |
| 4040 | { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;} |
| 4041 | break; |
| 4042 | |
| 4043 | case 147: |
| 4044 | |
| 4045 | { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermAggregate); ;} |
| 4046 | break; |
| 4047 | |
| 4048 | case 148: |
| 4049 | |
| 4050 | { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;} |
| 4051 | break; |
| 4052 | |
| 4053 | case 149: |
| 4054 | |
| 4055 | { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;} |
| 4056 | break; |
| 4057 | |
| 4058 | case 150: |
| 4059 | |
| 4060 | { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;} |
| 4061 | break; |
| 4062 | |
| 4063 | case 151: |
| 4064 | |
| 4065 | { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;} |
| 4066 | break; |
| 4067 | |
| 4068 | case 152: |
| 4069 | |
| 4070 | { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;} |
| 4071 | break; |
| 4072 | |
| 4073 | case 153: |
| 4074 | |
| 4075 | { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;} |
| 4076 | break; |
| 4077 | |
| 4078 | case 154: |
| 4079 | |
| 4080 | { (yyval.interm.intermAggregate) = 0; ;} |
| 4081 | break; |
| 4082 | |
| 4083 | case 155: |
| 4084 | |
| 4085 | { context->symbolTable.push(); ;} |
| 4086 | break; |
| 4087 | |
| 4088 | case 156: |
| 4089 | |
| 4090 | { context->symbolTable.pop(); ;} |
| 4091 | break; |
| 4092 | |
| 4093 | case 157: |
| 4094 | |
| 4095 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4096 | if ((yyvsp[(3) - (5)].interm.intermAggregate) != 0) { |
alokp@chromium.org | 044a5cf | 2010-11-12 15:42:16 +0000 | [diff] [blame] | 4097 | (yyvsp[(3) - (5)].interm.intermAggregate)->setOp(EOpSequence); |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4098 | (yyvsp[(3) - (5)].interm.intermAggregate)->setEndLine((yyvsp[(5) - (5)].lex).line); |
| 4099 | } |
alokp@chromium.org | 044a5cf | 2010-11-12 15:42:16 +0000 | [diff] [blame] | 4100 | (yyval.interm.intermAggregate) = (yyvsp[(3) - (5)].interm.intermAggregate); |
| 4101 | ;} |
| 4102 | break; |
| 4103 | |
| 4104 | case 158: |
| 4105 | |
| 4106 | { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;} |
| 4107 | break; |
| 4108 | |
| 4109 | case 159: |
| 4110 | |
| 4111 | { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;} |
| 4112 | break; |
| 4113 | |
| 4114 | case 160: |
| 4115 | |
| 4116 | { |
| 4117 | (yyval.interm.intermNode) = 0; |
| 4118 | ;} |
| 4119 | break; |
| 4120 | |
| 4121 | case 161: |
| 4122 | |
| 4123 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4124 | if ((yyvsp[(2) - (3)].interm.intermAggregate)) { |
alokp@chromium.org | 044a5cf | 2010-11-12 15:42:16 +0000 | [diff] [blame] | 4125 | (yyvsp[(2) - (3)].interm.intermAggregate)->setOp(EOpSequence); |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4126 | (yyvsp[(2) - (3)].interm.intermAggregate)->setEndLine((yyvsp[(3) - (3)].lex).line); |
| 4127 | } |
alokp@chromium.org | 044a5cf | 2010-11-12 15:42:16 +0000 | [diff] [blame] | 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(); |
alokp@chromium.org | 5281355 | 2010-11-16 18:36:09 +0000 | [diff] [blame] | 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); |
alokp@chromium.org | 044a5cf | 2010-11-12 15:42:16 +0000 | [diff] [blame] | 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 | |
alokp@chromium.org | 5281355 | 2010-11-16 18:36:09 +0000 | [diff] [blame] | 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); |
alokp@chromium.org | 044a5cf | 2010-11-12 15:42:16 +0000 | [diff] [blame] | 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(); |
alokp@chromium.org | 5281355 | 2010-11-16 18:36:09 +0000 | [diff] [blame] | 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); |
alokp@chromium.org | 044a5cf | 2010-11-12 15:42:16 +0000 | [diff] [blame] | 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); |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4487 | |
| 4488 | if ((yyvsp[(3) - (3)].interm.intermNode) && (yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate()) |
| 4489 | (yyval.interm.intermNode)->getAsAggregate()->setEndLine((yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate()->getEndLine()); |
alokp@chromium.org | 044a5cf | 2010-11-12 15:42:16 +0000 | [diff] [blame] | 4490 | ;} |
| 4491 | break; |
| 4492 | |
| 4493 | |
| 4494 | /* Line 1267 of yacc.c. */ |
| 4495 | |
| 4496 | default: break; |
| 4497 | } |
| 4498 | YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); |
| 4499 | |
| 4500 | YYPOPSTACK (yylen); |
| 4501 | yylen = 0; |
| 4502 | YY_STACK_PRINT (yyss, yyssp); |
| 4503 | |
| 4504 | *++yyvsp = yyval; |
| 4505 | |
| 4506 | |
| 4507 | /* Now `shift' the result of the reduction. Determine what state |
| 4508 | that goes to, based on the state we popped back to and the rule |
| 4509 | number reduced by. */ |
| 4510 | |
| 4511 | yyn = yyr1[yyn]; |
| 4512 | |
| 4513 | yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; |
| 4514 | if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) |
| 4515 | yystate = yytable[yystate]; |
| 4516 | else |
| 4517 | yystate = yydefgoto[yyn - YYNTOKENS]; |
| 4518 | |
| 4519 | goto yynewstate; |
| 4520 | |
| 4521 | |
| 4522 | /*------------------------------------. |
| 4523 | | yyerrlab -- here on detecting error | |
| 4524 | `------------------------------------*/ |
| 4525 | yyerrlab: |
| 4526 | /* If not already recovering from an error, report this error. */ |
| 4527 | if (!yyerrstatus) |
| 4528 | { |
| 4529 | ++yynerrs; |
| 4530 | #if ! YYERROR_VERBOSE |
| 4531 | yyerror (context, YY_("syntax error")); |
| 4532 | #else |
| 4533 | { |
| 4534 | YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); |
| 4535 | if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) |
| 4536 | { |
| 4537 | YYSIZE_T yyalloc = 2 * yysize; |
| 4538 | if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) |
| 4539 | yyalloc = YYSTACK_ALLOC_MAXIMUM; |
| 4540 | if (yymsg != yymsgbuf) |
| 4541 | YYSTACK_FREE (yymsg); |
| 4542 | yymsg = (char *) YYSTACK_ALLOC (yyalloc); |
| 4543 | if (yymsg) |
| 4544 | yymsg_alloc = yyalloc; |
| 4545 | else |
| 4546 | { |
| 4547 | yymsg = yymsgbuf; |
| 4548 | yymsg_alloc = sizeof yymsgbuf; |
| 4549 | } |
| 4550 | } |
| 4551 | |
| 4552 | if (0 < yysize && yysize <= yymsg_alloc) |
| 4553 | { |
| 4554 | (void) yysyntax_error (yymsg, yystate, yychar); |
| 4555 | yyerror (context, yymsg); |
| 4556 | } |
| 4557 | else |
| 4558 | { |
| 4559 | yyerror (context, YY_("syntax error")); |
| 4560 | if (yysize != 0) |
| 4561 | goto yyexhaustedlab; |
| 4562 | } |
| 4563 | } |
| 4564 | #endif |
| 4565 | } |
| 4566 | |
| 4567 | |
| 4568 | |
| 4569 | if (yyerrstatus == 3) |
| 4570 | { |
| 4571 | /* If just tried and failed to reuse look-ahead token after an |
| 4572 | error, discard it. */ |
| 4573 | |
| 4574 | if (yychar <= YYEOF) |
| 4575 | { |
| 4576 | /* Return failure if at end of input. */ |
| 4577 | if (yychar == YYEOF) |
| 4578 | YYABORT; |
| 4579 | } |
| 4580 | else |
| 4581 | { |
| 4582 | yydestruct ("Error: discarding", |
| 4583 | yytoken, &yylval, context); |
| 4584 | yychar = YYEMPTY; |
| 4585 | } |
| 4586 | } |
| 4587 | |
| 4588 | /* Else will try to reuse look-ahead token after shifting the error |
| 4589 | token. */ |
| 4590 | goto yyerrlab1; |
| 4591 | |
| 4592 | |
| 4593 | /*---------------------------------------------------. |
| 4594 | | yyerrorlab -- error raised explicitly by YYERROR. | |
| 4595 | `---------------------------------------------------*/ |
| 4596 | yyerrorlab: |
| 4597 | |
| 4598 | /* Pacify compilers like GCC when the user code never invokes |
| 4599 | YYERROR and the label yyerrorlab therefore never appears in user |
| 4600 | code. */ |
| 4601 | if (/*CONSTCOND*/ 0) |
| 4602 | goto yyerrorlab; |
| 4603 | |
| 4604 | /* Do not reclaim the symbols of the rule which action triggered |
| 4605 | this YYERROR. */ |
| 4606 | YYPOPSTACK (yylen); |
| 4607 | yylen = 0; |
| 4608 | YY_STACK_PRINT (yyss, yyssp); |
| 4609 | yystate = *yyssp; |
| 4610 | goto yyerrlab1; |
| 4611 | |
| 4612 | |
| 4613 | /*-------------------------------------------------------------. |
| 4614 | | yyerrlab1 -- common code for both syntax error and YYERROR. | |
| 4615 | `-------------------------------------------------------------*/ |
| 4616 | yyerrlab1: |
| 4617 | yyerrstatus = 3; /* Each real token shifted decrements this. */ |
| 4618 | |
| 4619 | for (;;) |
| 4620 | { |
| 4621 | yyn = yypact[yystate]; |
| 4622 | if (yyn != YYPACT_NINF) |
| 4623 | { |
| 4624 | yyn += YYTERROR; |
| 4625 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) |
| 4626 | { |
| 4627 | yyn = yytable[yyn]; |
| 4628 | if (0 < yyn) |
| 4629 | break; |
| 4630 | } |
| 4631 | } |
| 4632 | |
| 4633 | /* Pop the current state because it cannot handle the error token. */ |
| 4634 | if (yyssp == yyss) |
| 4635 | YYABORT; |
| 4636 | |
| 4637 | |
| 4638 | yydestruct ("Error: popping", |
| 4639 | yystos[yystate], yyvsp, context); |
| 4640 | YYPOPSTACK (1); |
| 4641 | yystate = *yyssp; |
| 4642 | YY_STACK_PRINT (yyss, yyssp); |
| 4643 | } |
| 4644 | |
| 4645 | if (yyn == YYFINAL) |
| 4646 | YYACCEPT; |
| 4647 | |
| 4648 | *++yyvsp = yylval; |
| 4649 | |
| 4650 | |
| 4651 | /* Shift the error token. */ |
| 4652 | YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); |
| 4653 | |
| 4654 | yystate = yyn; |
| 4655 | goto yynewstate; |
| 4656 | |
| 4657 | |
| 4658 | /*-------------------------------------. |
| 4659 | | yyacceptlab -- YYACCEPT comes here. | |
| 4660 | `-------------------------------------*/ |
| 4661 | yyacceptlab: |
| 4662 | yyresult = 0; |
| 4663 | goto yyreturn; |
| 4664 | |
| 4665 | /*-----------------------------------. |
| 4666 | | yyabortlab -- YYABORT comes here. | |
| 4667 | `-----------------------------------*/ |
| 4668 | yyabortlab: |
| 4669 | yyresult = 1; |
| 4670 | goto yyreturn; |
| 4671 | |
| 4672 | #ifndef yyoverflow |
| 4673 | /*-------------------------------------------------. |
| 4674 | | yyexhaustedlab -- memory exhaustion comes here. | |
| 4675 | `-------------------------------------------------*/ |
| 4676 | yyexhaustedlab: |
| 4677 | yyerror (context, YY_("memory exhausted")); |
| 4678 | yyresult = 2; |
| 4679 | /* Fall through. */ |
| 4680 | #endif |
| 4681 | |
| 4682 | yyreturn: |
| 4683 | if (yychar != YYEOF && yychar != YYEMPTY) |
| 4684 | yydestruct ("Cleanup: discarding lookahead", |
| 4685 | yytoken, &yylval, context); |
| 4686 | /* Do not reclaim the symbols of the rule which action triggered |
| 4687 | this YYABORT or YYACCEPT. */ |
| 4688 | YYPOPSTACK (yylen); |
| 4689 | YY_STACK_PRINT (yyss, yyssp); |
| 4690 | while (yyssp != yyss) |
| 4691 | { |
| 4692 | yydestruct ("Cleanup: popping", |
| 4693 | yystos[*yyssp], yyvsp, context); |
| 4694 | YYPOPSTACK (1); |
| 4695 | } |
| 4696 | #ifndef yyoverflow |
| 4697 | if (yyss != yyssa) |
| 4698 | YYSTACK_FREE (yyss); |
| 4699 | #endif |
| 4700 | #if YYERROR_VERBOSE |
| 4701 | if (yymsg != yymsgbuf) |
| 4702 | YYSTACK_FREE (yymsg); |
| 4703 | #endif |
| 4704 | /* Make sure YYID is used. */ |
| 4705 | return YYID (yyresult); |
| 4706 | } |
| 4707 | |
| 4708 | |
| 4709 | |
| 4710 | |
| 4711 | |
| 4712 | int glslang_parse(TParseContext* context) { |
| 4713 | return yyparse(context); |
| 4714 | } |
| 4715 | |
| 4716 | |