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