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