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