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