gfx/angle/src/compiler/glslang_tab.cpp

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

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

mercurial