blob: 2b0f042dbedc06ab8a835cdc7cac076e13a004ad [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//
Alexis Hetub14178b2015-04-13 13:23:20 -040072// Copyright (c) 2002-2015 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
Nicolas Capenscc863da2015-01-21 15:50:55 -050091#include "SymbolTable.h"
92#include "ParseHelper.h"
John Bauman66b8ab22014-05-06 15:57:45 -040093
John Baumand4ae8632014-05-06 16:18:33 -040094#define YYENABLE_NLS 0
95#define YYLTYPE_IS_TRIVIAL 1
96
John Bauman66b8ab22014-05-06 15:57:45 -040097#define YYLEX_PARAM context->scanner
98
99
100
101/* Enabling traces. */
102#ifndef YYDEBUG
103# define YYDEBUG 0
104#endif
105
106/* Enabling verbose error messages. */
107#ifdef YYERROR_VERBOSE
108# undef YYERROR_VERBOSE
109# define YYERROR_VERBOSE 1
110#else
111# define YYERROR_VERBOSE 0
112#endif
113
114/* Enabling the token table. */
115#ifndef YYTOKEN_TABLE
116# define YYTOKEN_TABLE 0
117#endif
118
119
120/* Tokens. */
121#ifndef YYTOKENTYPE
122# define YYTOKENTYPE
123 /* Put the tokens into the symbol table, so that GDB and other debuggers
124 know about them. */
125 enum yytokentype {
126 INVARIANT = 258,
127 HIGH_PRECISION = 259,
128 MEDIUM_PRECISION = 260,
129 LOW_PRECISION = 261,
130 PRECISION = 262,
131 ATTRIBUTE = 263,
132 CONST_QUAL = 264,
133 BOOL_TYPE = 265,
134 FLOAT_TYPE = 266,
135 INT_TYPE = 267,
Nicolas Capens3c20f802015-02-17 17:17:20 -0500136 UINT_TYPE = 268,
137 BREAK = 269,
138 CONTINUE = 270,
139 DO = 271,
140 ELSE = 272,
141 FOR = 273,
142 IF = 274,
143 DISCARD = 275,
144 RETURN = 276,
145 SWITCH = 277,
146 CASE = 278,
147 DEFAULT = 279,
148 BVEC2 = 280,
149 BVEC3 = 281,
150 BVEC4 = 282,
151 IVEC2 = 283,
152 IVEC3 = 284,
153 IVEC4 = 285,
154 VEC2 = 286,
155 VEC3 = 287,
156 VEC4 = 288,
Nicolas Capense4b1b1d2015-02-17 17:26:01 -0500157 UVEC2 = 289,
158 UVEC3 = 290,
159 UVEC4 = 291,
160 MATRIX2 = 292,
161 MATRIX3 = 293,
162 MATRIX4 = 294,
163 IN_QUAL = 295,
164 OUT_QUAL = 296,
165 INOUT_QUAL = 297,
166 UNIFORM = 298,
167 VARYING = 299,
Alexis Hetub14178b2015-04-13 13:23:20 -0400168 MATRIX2x3 = 300,
169 MATRIX3x2 = 301,
170 MATRIX2x4 = 302,
171 MATRIX4x2 = 303,
172 MATRIX3x4 = 304,
173 MATRIX4x3 = 305,
174 CENTROID = 306,
175 FLAT = 307,
176 SMOOTH = 308,
177 STRUCT = 309,
178 VOID_TYPE = 310,
179 WHILE = 311,
180 SAMPLER2D = 312,
181 SAMPLERCUBE = 313,
182 SAMPLER_EXTERNAL_OES = 314,
183 SAMPLER2DRECT = 315,
184 SAMPLER2DARRAY = 316,
185 ISAMPLER2D = 317,
186 ISAMPLER3D = 318,
187 ISAMPLERCUBE = 319,
188 ISAMPLER2DARRAY = 320,
189 USAMPLER2D = 321,
190 USAMPLER3D = 322,
191 USAMPLERCUBE = 323,
192 USAMPLER2DARRAY = 324,
193 SAMPLER3D = 325,
194 SAMPLER3DRECT = 326,
195 SAMPLER2DSHADOW = 327,
196 SAMPLERCUBESHADOW = 328,
197 SAMPLER2DARRAYSHADOW = 329,
198 LAYOUT = 330,
199 IDENTIFIER = 331,
200 TYPE_NAME = 332,
201 FLOATCONSTANT = 333,
202 INTCONSTANT = 334,
203 UINTCONSTANT = 335,
204 BOOLCONSTANT = 336,
205 FIELD_SELECTION = 337,
206 LEFT_OP = 338,
207 RIGHT_OP = 339,
208 INC_OP = 340,
209 DEC_OP = 341,
210 LE_OP = 342,
211 GE_OP = 343,
212 EQ_OP = 344,
213 NE_OP = 345,
214 AND_OP = 346,
215 OR_OP = 347,
216 XOR_OP = 348,
217 MUL_ASSIGN = 349,
218 DIV_ASSIGN = 350,
219 ADD_ASSIGN = 351,
220 MOD_ASSIGN = 352,
221 LEFT_ASSIGN = 353,
222 RIGHT_ASSIGN = 354,
223 AND_ASSIGN = 355,
224 XOR_ASSIGN = 356,
225 OR_ASSIGN = 357,
226 SUB_ASSIGN = 358,
227 LEFT_PAREN = 359,
228 RIGHT_PAREN = 360,
229 LEFT_BRACKET = 361,
230 RIGHT_BRACKET = 362,
231 LEFT_BRACE = 363,
232 RIGHT_BRACE = 364,
233 DOT = 365,
234 COMMA = 366,
235 COLON = 367,
236 EQUAL = 368,
237 SEMICOLON = 369,
238 BANG = 370,
239 DASH = 371,
240 TILDE = 372,
241 PLUS = 373,
242 STAR = 374,
243 SLASH = 375,
244 PERCENT = 376,
245 LEFT_ANGLE = 377,
246 RIGHT_ANGLE = 378,
247 VERTICAL_BAR = 379,
248 CARET = 380,
249 AMPERSAND = 381,
250 QUESTION = 382
John Bauman66b8ab22014-05-06 15:57:45 -0400251 };
252#endif
253
254
255
256#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
257typedef union YYSTYPE
258{
259
260
261 struct {
262 TSourceLoc line;
263 union {
264 TString *string;
265 float f;
266 int i;
Nicolas Capens2c1239f2015-02-17 17:30:04 -0500267 unsigned int u;
John Bauman66b8ab22014-05-06 15:57:45 -0400268 bool b;
269 };
270 TSymbol* symbol;
271 } lex;
272 struct {
273 TSourceLoc line;
274 TOperator op;
275 union {
276 TIntermNode* intermNode;
277 TIntermNodePair nodePair;
278 TIntermTyped* intermTypedNode;
279 TIntermAggregate* intermAggregate;
280 };
281 union {
282 TPublicType type;
283 TPrecision precision;
Nicolas Capens7d626792015-02-17 17:58:31 -0500284 TLayoutQualifier layoutQualifier;
John Bauman66b8ab22014-05-06 15:57:45 -0400285 TQualifier qualifier;
286 TFunction* function;
287 TParameter param;
288 TTypeLine typeLine;
289 TTypeList* typeList;
290 };
291 } interm;
292
293
294
295} YYSTYPE;
296# define YYSTYPE_IS_TRIVIAL 1
297# define yystype YYSTYPE /* obsolescent; will be withdrawn */
298# define YYSTYPE_IS_DECLARED 1
299#endif
300
301
302/* Copy the second part of user declarations. */
303
304
305extern int yylex(YYSTYPE* yylval_param, void* yyscanner);
306extern void yyerror(TParseContext* context, const char* reason);
307
308#define FRAG_VERT_ONLY(S, L) { \
Nicolas Capens08ca3c62015-02-13 16:06:45 -0500309 if (context->shaderType != GL_FRAGMENT_SHADER && \
310 context->shaderType != GL_VERTEX_SHADER) { \
John Bauman66b8ab22014-05-06 15:57:45 -0400311 context->error(L, " supported in vertex/fragment shaders only ", S); \
312 context->recover(); \
313 } \
314}
315
316#define VERTEX_ONLY(S, L) { \
Nicolas Capens08ca3c62015-02-13 16:06:45 -0500317 if (context->shaderType != GL_VERTEX_SHADER) { \
John Bauman66b8ab22014-05-06 15:57:45 -0400318 context->error(L, " supported in vertex shaders only ", S); \
319 context->recover(); \
320 } \
321}
322
323#define FRAG_ONLY(S, L) { \
Nicolas Capens08ca3c62015-02-13 16:06:45 -0500324 if (context->shaderType != GL_FRAGMENT_SHADER) { \
John Bauman66b8ab22014-05-06 15:57:45 -0400325 context->error(L, " supported in fragment shaders only ", S); \
326 context->recover(); \
327 } \
328}
329
Nicolas Capensc6841852015-02-15 14:25:37 -0500330#define ES2_ONLY(S, L) { \
331 if (context->shaderVersion != 100) { \
332 context->error(L, " supported in GLSL ES 1.00 only ", S); \
333 context->recover(); \
334 } \
335}
336
337#define ES3_ONLY(S, L) { \
338 if (context->shaderVersion != 300) { \
339 context->error(L, " supported in GLSL ES 3.00 only ", S); \
340 context->recover(); \
341 } \
342}
343
John Bauman66b8ab22014-05-06 15:57:45 -0400344
345
346#ifdef short
347# undef short
348#endif
349
350#ifdef YYTYPE_UINT8
351typedef YYTYPE_UINT8 yytype_uint8;
352#else
353typedef unsigned char yytype_uint8;
354#endif
355
356#ifdef YYTYPE_INT8
357typedef YYTYPE_INT8 yytype_int8;
358#elif (defined __STDC__ || defined __C99__FUNC__ \
359 || defined __cplusplus || defined _MSC_VER)
360typedef signed char yytype_int8;
361#else
362typedef short int yytype_int8;
363#endif
364
365#ifdef YYTYPE_UINT16
366typedef YYTYPE_UINT16 yytype_uint16;
367#else
368typedef unsigned short int yytype_uint16;
369#endif
370
371#ifdef YYTYPE_INT16
372typedef YYTYPE_INT16 yytype_int16;
373#else
374typedef short int yytype_int16;
375#endif
376
377#ifndef YYSIZE_T
378# ifdef __SIZE_TYPE__
379# define YYSIZE_T __SIZE_TYPE__
380# elif defined size_t
381# define YYSIZE_T size_t
382# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
383 || defined __cplusplus || defined _MSC_VER)
384# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
385# define YYSIZE_T size_t
386# else
387# define YYSIZE_T unsigned int
388# endif
389#endif
390
391#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
392
393#ifndef YY_
Nicolas Capense9c5e4f2014-05-28 22:46:43 -0400394# if YYENABLE_NLS
John Bauman66b8ab22014-05-06 15:57:45 -0400395# if ENABLE_NLS
396# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
397# define YY_(msgid) dgettext ("bison-runtime", msgid)
398# endif
399# endif
400# ifndef YY_
401# define YY_(msgid) msgid
402# endif
403#endif
404
405/* Suppress unused-variable warnings by "using" E. */
406#if ! defined lint || defined __GNUC__
407# define YYUSE(e) ((void) (e))
408#else
409# define YYUSE(e) /* empty */
410#endif
411
412/* Identity function, used to suppress warnings about constant conditions. */
413#ifndef lint
414# define YYID(n) (n)
415#else
416#if (defined __STDC__ || defined __C99__FUNC__ \
417 || defined __cplusplus || defined _MSC_VER)
418static int
419YYID (int yyi)
420#else
421static int
422YYID (yyi)
423 int yyi;
424#endif
425{
426 return yyi;
427}
428#endif
429
430#if ! defined yyoverflow || YYERROR_VERBOSE
431
432/* The parser invokes alloca or malloc; define the necessary symbols. */
433
434# ifdef YYSTACK_USE_ALLOCA
435# if YYSTACK_USE_ALLOCA
436# ifdef __GNUC__
437# define YYSTACK_ALLOC __builtin_alloca
438# elif defined __BUILTIN_VA_ARG_INCR
439# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
440# elif defined _AIX
441# define YYSTACK_ALLOC __alloca
442# elif defined _MSC_VER
443# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
444# define alloca _alloca
445# else
446# define YYSTACK_ALLOC alloca
447# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
448 || defined __cplusplus || defined _MSC_VER)
449# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
450# ifndef _STDLIB_H
451# define _STDLIB_H 1
452# endif
453# endif
454# endif
455# endif
456# endif
457
458# ifdef YYSTACK_ALLOC
459 /* Pacify GCC's `empty if-body' warning. */
460# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
461# ifndef YYSTACK_ALLOC_MAXIMUM
462 /* The OS might guarantee only one guard page at the bottom of the stack,
463 and a page size can be as small as 4096 bytes. So we cannot safely
464 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
465 to allow for a few compiler-allocated temporary stack slots. */
466# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
467# endif
468# else
469# define YYSTACK_ALLOC YYMALLOC
470# define YYSTACK_FREE YYFREE
471# ifndef YYSTACK_ALLOC_MAXIMUM
472# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
473# endif
474# if (defined __cplusplus && ! defined _STDLIB_H \
475 && ! ((defined YYMALLOC || defined malloc) \
476 && (defined YYFREE || defined free)))
477# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
478# ifndef _STDLIB_H
479# define _STDLIB_H 1
480# endif
481# endif
482# ifndef YYMALLOC
483# define YYMALLOC malloc
484# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
485 || defined __cplusplus || defined _MSC_VER)
486void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
487# endif
488# endif
489# ifndef YYFREE
490# define YYFREE free
491# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
492 || defined __cplusplus || defined _MSC_VER)
493void free (void *); /* INFRINGES ON USER NAME SPACE */
494# endif
495# endif
496# endif
497#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
498
499
500#if (! defined yyoverflow \
501 && (! defined __cplusplus \
502 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
503
504/* A type that is properly aligned for any stack member. */
505union yyalloc
506{
507 yytype_int16 yyss_alloc;
508 YYSTYPE yyvs_alloc;
509};
510
511/* The size of the maximum gap between one aligned stack and the next. */
512# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
513
514/* The size of an array large to enough to hold all stacks, each with
515 N elements. */
516# define YYSTACK_BYTES(N) \
517 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
518 + YYSTACK_GAP_MAXIMUM)
519
520/* Copy COUNT objects from FROM to TO. The source and destination do
521 not overlap. */
522# ifndef YYCOPY
523# if defined __GNUC__ && 1 < __GNUC__
524# define YYCOPY(To, From, Count) \
525 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
526# else
527# define YYCOPY(To, From, Count) \
528 do \
529 { \
530 YYSIZE_T yyi; \
531 for (yyi = 0; yyi < (Count); yyi++) \
532 (To)[yyi] = (From)[yyi]; \
533 } \
534 while (YYID (0))
535# endif
536# endif
537
538/* Relocate STACK from its old location to the new one. The
539 local variables YYSIZE and YYSTACKSIZE give the old and new number of
540 elements in the stack, and YYPTR gives the new location of the
541 stack. Advance YYPTR to a properly aligned location for the next
542 stack. */
543# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
544 do \
545 { \
546 YYSIZE_T yynewbytes; \
547 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
548 Stack = &yyptr->Stack_alloc; \
549 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
550 yyptr += yynewbytes / sizeof (*yyptr); \
551 } \
552 while (YYID (0))
553
554#endif
555
556/* YYFINAL -- State number of the termination state. */
Alexis Hetu55a2cbc2015-04-16 10:49:45 -0400557#define YYFINAL 107
John Bauman66b8ab22014-05-06 15:57:45 -0400558/* YYLAST -- Last index in YYTABLE. */
Alexis Hetu55a2cbc2015-04-16 10:49:45 -0400559#define YYLAST 2024
John Bauman66b8ab22014-05-06 15:57:45 -0400560
561/* YYNTOKENS -- Number of terminals. */
Alexis Hetub14178b2015-04-13 13:23:20 -0400562#define YYNTOKENS 128
John Bauman66b8ab22014-05-06 15:57:45 -0400563/* YYNNTS -- Number of nonterminals. */
Alexis Hetu55a2cbc2015-04-16 10:49:45 -0400564#define YYNNTS 89
John Bauman66b8ab22014-05-06 15:57:45 -0400565/* YYNRULES -- Number of rules. */
Alexis Hetu55a2cbc2015-04-16 10:49:45 -0400566#define YYNRULES 242
John Bauman66b8ab22014-05-06 15:57:45 -0400567/* YYNRULES -- Number of states. */
Alexis Hetu55a2cbc2015-04-16 10:49:45 -0400568#define YYNSTATES 351
John Bauman66b8ab22014-05-06 15:57:45 -0400569
570/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
571#define YYUNDEFTOK 2
Alexis Hetub14178b2015-04-13 13:23:20 -0400572#define YYMAXUTOK 382
John Bauman66b8ab22014-05-06 15:57:45 -0400573
574#define YYTRANSLATE(YYX) \
575 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
576
577/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
578static const yytype_uint8 yytranslate[] =
579{
580 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
581 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
582 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
583 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
584 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
585 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
586 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
587 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
588 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
589 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
590 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
591 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
592 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
593 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
594 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
595 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
596 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
597 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
598 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
599 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
600 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
601 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
602 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
603 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
604 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
605 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
606 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
607 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
608 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
609 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
610 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
611 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
612 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
613 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
Alexis Hetub027aa92015-01-19 15:56:12 -0500614 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
Nicolas Capens3c20f802015-02-17 17:17:20 -0500615 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
Alexis Hetub14178b2015-04-13 13:23:20 -0400616 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
617 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
618 125, 126, 127
John Bauman66b8ab22014-05-06 15:57:45 -0400619};
620
621#if YYDEBUG
622/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
623 YYRHS. */
624static const yytype_uint16 yyprhs[] =
625{
Nicolas Capens2c1239f2015-02-17 17:30:04 -0500626 0, 0, 3, 5, 7, 9, 11, 13, 15, 19,
627 21, 26, 28, 32, 35, 38, 40, 42, 44, 48,
628 51, 54, 57, 59, 62, 66, 69, 71, 73, 75,
629 77, 80, 83, 86, 88, 90, 92, 94, 98, 102,
630 104, 108, 112, 114, 116, 120, 124, 128, 132, 134,
631 138, 142, 144, 146, 148, 150, 154, 156, 160, 162,
632 166, 168, 174, 176, 180, 182, 184, 186, 188, 190,
633 192, 196, 198, 201, 204, 209, 212, 214, 216, 219,
634 223, 227, 230, 236, 240, 243, 247, 250, 251, 253,
635 255, 257, 259, 261, 265, 271, 278, 284, 286, 289,
Alexis Hetu55a2cbc2015-04-16 10:49:45 -0400636 294, 300, 305, 308, 310, 313, 315, 317, 319, 321,
637 323, 326, 328, 331, 333, 335, 338, 340, 342, 344,
638 347, 350, 352, 354, 357, 359, 361, 363, 368, 370,
639 374, 376, 380, 384, 386, 391, 393, 395, 397, 399,
640 401, 403, 405, 407, 409, 411, 413, 415, 417, 419,
641 421, 423, 425, 427, 429, 431, 433, 435, 437, 439,
642 441, 443, 445, 447, 449, 451, 453, 455, 457, 459,
643 461, 463, 465, 467, 469, 471, 473, 475, 477, 479,
644 480, 487, 488, 494, 496, 499, 503, 505, 509, 511,
645 516, 518, 520, 522, 524, 526, 528, 530, 532, 534,
646 537, 538, 539, 545, 547, 549, 550, 553, 554, 557,
647 560, 564, 566, 569, 571, 574, 580, 584, 586, 588,
648 593, 594, 601, 602, 611, 612, 620, 622, 624, 626,
649 627, 630, 634, 637, 640, 643, 647, 650, 652, 655,
650 657, 659, 660
John Bauman66b8ab22014-05-06 15:57:45 -0400651};
652
653/* YYRHS -- A `-1'-separated list of the rules' RHS. */
654static const yytype_int16 yyrhs[] =
655{
Alexis Hetu55a2cbc2015-04-16 10:49:45 -0400656 213, 0, -1, 76, -1, 129, -1, 79, -1, 80,
Alexis Hetub14178b2015-04-13 13:23:20 -0400657 -1, 78, -1, 81, -1, 104, 156, 105, -1, 130,
658 -1, 131, 106, 132, 107, -1, 133, -1, 131, 110,
659 82, -1, 131, 85, -1, 131, 86, -1, 156, -1,
660 134, -1, 135, -1, 131, 110, 135, -1, 137, 105,
661 -1, 136, 105, -1, 138, 55, -1, 138, -1, 138,
Alexis Hetu55a2cbc2015-04-16 10:49:45 -0400662 154, -1, 137, 111, 154, -1, 139, 104, -1, 180,
Alexis Hetub14178b2015-04-13 13:23:20 -0400663 -1, 76, -1, 82, -1, 131, -1, 85, 140, -1,
664 86, 140, -1, 141, 140, -1, 118, -1, 116, -1,
665 115, -1, 140, -1, 142, 119, 140, -1, 142, 120,
666 140, -1, 142, -1, 143, 118, 142, -1, 143, 116,
667 142, -1, 143, -1, 144, -1, 145, 122, 144, -1,
668 145, 123, 144, -1, 145, 87, 144, -1, 145, 88,
669 144, -1, 145, -1, 146, 89, 145, -1, 146, 90,
670 145, -1, 146, -1, 147, -1, 148, -1, 149, -1,
671 150, 91, 149, -1, 150, -1, 151, 93, 150, -1,
672 151, -1, 152, 92, 151, -1, 152, -1, 152, 127,
673 156, 112, 154, -1, 153, -1, 140, 155, 154, -1,
674 113, -1, 94, -1, 95, -1, 96, -1, 103, -1,
675 154, -1, 156, 111, 154, -1, 153, -1, 159, 114,
Alexis Hetu55a2cbc2015-04-16 10:49:45 -0400676 -1, 167, 114, -1, 7, 175, 179, 114, -1, 160,
Alexis Hetub14178b2015-04-13 13:23:20 -0400677 105, -1, 162, -1, 161, -1, 162, 164, -1, 161,
Alexis Hetu55a2cbc2015-04-16 10:49:45 -0400678 111, 164, -1, 169, 76, 104, -1, 174, 76, -1,
679 174, 76, 106, 157, 107, -1, 171, 165, 163, -1,
680 165, 163, -1, 171, 165, 166, -1, 165, 166, -1,
681 -1, 40, -1, 41, -1, 42, -1, 174, -1, 168,
Alexis Hetub14178b2015-04-13 13:23:20 -0400682 -1, 167, 111, 76, -1, 167, 111, 76, 106, 107,
683 -1, 167, 111, 76, 106, 157, 107, -1, 167, 111,
Alexis Hetu55a2cbc2015-04-16 10:49:45 -0400684 76, 113, 188, -1, 169, -1, 169, 76, -1, 169,
Alexis Hetub14178b2015-04-13 13:23:20 -0400685 76, 106, 107, -1, 169, 76, 106, 157, 107, -1,
Alexis Hetu55a2cbc2015-04-16 10:49:45 -0400686 169, 76, 113, 188, -1, 3, 76, -1, 174, -1,
687 172, 174, -1, 53, -1, 52, -1, 9, -1, 8,
688 -1, 44, -1, 3, 44, -1, 173, -1, 170, 173,
689 -1, 170, -1, 176, -1, 176, 173, -1, 9, -1,
690 40, -1, 41, -1, 51, 40, -1, 51, 41, -1,
691 43, -1, 179, -1, 175, 179, -1, 4, -1, 5,
692 -1, 6, -1, 75, 104, 177, 105, -1, 178, -1,
693 177, 111, 178, -1, 76, -1, 76, 113, 79, -1,
694 76, 113, 80, -1, 180, -1, 180, 106, 157, 107,
695 -1, 55, -1, 11, -1, 12, -1, 13, -1, 10,
696 -1, 31, -1, 32, -1, 33, -1, 25, -1, 26,
697 -1, 27, -1, 28, -1, 29, -1, 30, -1, 34,
698 -1, 35, -1, 36, -1, 37, -1, 38, -1, 39,
699 -1, 45, -1, 46, -1, 47, -1, 48, -1, 49,
700 -1, 50, -1, 57, -1, 58, -1, 59, -1, 70,
701 -1, 61, -1, 62, -1, 63, -1, 64, -1, 65,
702 -1, 66, -1, 67, -1, 68, -1, 69, -1, 72,
703 -1, 73, -1, 74, -1, 181, -1, 77, -1, -1,
704 54, 76, 108, 182, 184, 109, -1, -1, 54, 108,
705 183, 184, 109, -1, 185, -1, 184, 185, -1, 174,
706 186, 114, -1, 187, -1, 186, 111, 187, -1, 76,
707 -1, 76, 106, 157, 107, -1, 154, -1, 158, -1,
708 192, -1, 191, -1, 189, -1, 201, -1, 202, -1,
709 205, -1, 212, -1, 108, 109, -1, -1, -1, 108,
710 193, 200, 194, 109, -1, 199, -1, 191, -1, -1,
711 197, 199, -1, -1, 198, 191, -1, 108, 109, -1,
712 108, 200, 109, -1, 190, -1, 200, 190, -1, 114,
713 -1, 156, 114, -1, 19, 104, 156, 105, 203, -1,
714 196, 17, 196, -1, 196, -1, 156, -1, 169, 76,
715 113, 188, -1, -1, 56, 104, 206, 204, 105, 195,
716 -1, -1, 16, 207, 196, 56, 104, 156, 105, 114,
717 -1, -1, 18, 104, 208, 209, 211, 105, 195, -1,
718 201, -1, 189, -1, 204, -1, -1, 210, 114, -1,
719 210, 114, 156, -1, 15, 114, -1, 14, 114, -1,
720 21, 114, -1, 21, 156, 114, -1, 20, 114, -1,
721 214, -1, 213, 214, -1, 215, -1, 158, -1, -1,
722 159, 216, 199, -1
John Bauman66b8ab22014-05-06 15:57:45 -0400723};
724
725/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
726static const yytype_uint16 yyrline[] =
727{
Alexis Hetub14178b2015-04-13 13:23:20 -0400728 0, 190, 190, 225, 228, 233, 238, 243, 248, 254,
729 257, 336, 339, 440, 450, 463, 471, 571, 574, 582,
Alexis Hetub7c46af2015-05-12 15:58:09 -0400730 586, 593, 597, 604, 610, 619, 627, 704, 711, 721,
731 724, 734, 744, 765, 766, 767, 772, 773, 782, 794,
732 795, 803, 814, 818, 819, 829, 839, 849, 862, 863,
733 873, 886, 890, 894, 898, 899, 912, 913, 926, 927,
734 940, 941, 958, 959, 972, 973, 974, 975, 976, 980,
735 983, 994, 1002, 1029, 1034, 1044, 1082, 1085, 1092, 1100,
736 1121, 1142, 1153, 1182, 1187, 1197, 1202, 1212, 1215, 1218,
737 1221, 1227, 1234, 1237, 1259, 1277, 1301, 1324, 1328, 1346,
738 1354, 1386, 1406, 1494, 1503, 1526, 1529, 1535, 1541, 1548,
739 1557, 1566, 1569, 1572, 1579, 1583, 1590, 1594, 1599, 1604,
740 1610, 1616, 1625, 1635, 1642, 1645, 1648, 1654, 1661, 1664,
741 1670, 1673, 1676, 1682, 1685, 1700, 1704, 1708, 1712, 1716,
742 1720, 1725, 1730, 1735, 1740, 1745, 1750, 1755, 1760, 1765,
743 1770, 1775, 1780, 1786, 1792, 1798, 1804, 1810, 1816, 1822,
744 1828, 1834, 1839, 1844, 1853, 1858, 1863, 1868, 1873, 1878,
745 1883, 1888, 1893, 1898, 1903, 1908, 1913, 1918, 1923, 1936,
746 1936, 1950, 1950, 1959, 1962, 1977, 2009, 2013, 2019, 2027,
747 2043, 2047, 2051, 2052, 2058, 2059, 2060, 2061, 2062, 2066,
748 2067, 2067, 2067, 2077, 2078, 2082, 2082, 2083, 2083, 2088,
749 2091, 2101, 2104, 2110, 2111, 2115, 2123, 2127, 2137, 2142,
750 2159, 2159, 2164, 2164, 2171, 2171, 2179, 2182, 2188, 2191,
751 2197, 2201, 2208, 2215, 2222, 2229, 2240, 2249, 2253, 2260,
752 2263, 2269, 2269
John Bauman66b8ab22014-05-06 15:57:45 -0400753};
754#endif
755
756#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
757/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
758 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
759static const char *const yytname[] =
760{
761 "$end", "error", "$undefined", "INVARIANT", "HIGH_PRECISION",
762 "MEDIUM_PRECISION", "LOW_PRECISION", "PRECISION", "ATTRIBUTE",
Nicolas Capens3c20f802015-02-17 17:17:20 -0500763 "CONST_QUAL", "BOOL_TYPE", "FLOAT_TYPE", "INT_TYPE", "UINT_TYPE",
764 "BREAK", "CONTINUE", "DO", "ELSE", "FOR", "IF", "DISCARD", "RETURN",
765 "SWITCH", "CASE", "DEFAULT", "BVEC2", "BVEC3", "BVEC4", "IVEC2", "IVEC3",
Nicolas Capense4b1b1d2015-02-17 17:26:01 -0500766 "IVEC4", "VEC2", "VEC3", "VEC4", "UVEC2", "UVEC3", "UVEC4", "MATRIX2",
767 "MATRIX3", "MATRIX4", "IN_QUAL", "OUT_QUAL", "INOUT_QUAL", "UNIFORM",
Alexis Hetub14178b2015-04-13 13:23:20 -0400768 "VARYING", "MATRIX2x3", "MATRIX3x2", "MATRIX2x4", "MATRIX4x2",
769 "MATRIX3x4", "MATRIX4x3", "CENTROID", "FLAT", "SMOOTH", "STRUCT",
770 "VOID_TYPE", "WHILE", "SAMPLER2D", "SAMPLERCUBE", "SAMPLER_EXTERNAL_OES",
771 "SAMPLER2DRECT", "SAMPLER2DARRAY", "ISAMPLER2D", "ISAMPLER3D",
772 "ISAMPLERCUBE", "ISAMPLER2DARRAY", "USAMPLER2D", "USAMPLER3D",
773 "USAMPLERCUBE", "USAMPLER2DARRAY", "SAMPLER3D", "SAMPLER3DRECT",
774 "SAMPLER2DSHADOW", "SAMPLERCUBESHADOW", "SAMPLER2DARRAYSHADOW", "LAYOUT",
775 "IDENTIFIER", "TYPE_NAME", "FLOATCONSTANT", "INTCONSTANT",
776 "UINTCONSTANT", "BOOLCONSTANT", "FIELD_SELECTION", "LEFT_OP", "RIGHT_OP",
777 "INC_OP", "DEC_OP", "LE_OP", "GE_OP", "EQ_OP", "NE_OP", "AND_OP",
778 "OR_OP", "XOR_OP", "MUL_ASSIGN", "DIV_ASSIGN", "ADD_ASSIGN",
779 "MOD_ASSIGN", "LEFT_ASSIGN", "RIGHT_ASSIGN", "AND_ASSIGN", "XOR_ASSIGN",
780 "OR_ASSIGN", "SUB_ASSIGN", "LEFT_PAREN", "RIGHT_PAREN", "LEFT_BRACKET",
Nicolas Capens2c1239f2015-02-17 17:30:04 -0500781 "RIGHT_BRACKET", "LEFT_BRACE", "RIGHT_BRACE", "DOT", "COMMA", "COLON",
782 "EQUAL", "SEMICOLON", "BANG", "DASH", "TILDE", "PLUS", "STAR", "SLASH",
783 "PERCENT", "LEFT_ANGLE", "RIGHT_ANGLE", "VERTICAL_BAR", "CARET",
784 "AMPERSAND", "QUESTION", "$accept", "variable_identifier",
785 "primary_expression", "postfix_expression", "integer_expression",
786 "function_call", "function_call_or_method", "function_call_generic",
John Bauman66b8ab22014-05-06 15:57:45 -0400787 "function_call_header_no_parameters",
788 "function_call_header_with_parameters", "function_call_header",
789 "function_identifier", "unary_expression", "unary_operator",
790 "multiplicative_expression", "additive_expression", "shift_expression",
791 "relational_expression", "equality_expression", "and_expression",
792 "exclusive_or_expression", "inclusive_or_expression",
793 "logical_and_expression", "logical_xor_expression",
794 "logical_or_expression", "conditional_expression",
795 "assignment_expression", "assignment_operator", "expression",
796 "constant_expression", "declaration", "function_prototype",
797 "function_declarator", "function_header_with_parameters",
798 "function_header", "parameter_declarator", "parameter_declaration",
799 "parameter_qualifier", "parameter_type_specifier",
800 "init_declarator_list", "single_declaration", "fully_specified_type",
Alexis Hetu55a2cbc2015-04-16 10:49:45 -0400801 "interpolation_qualifier", "parameter_type_qualifier", "type_qualifier",
802 "storage_qualifier", "type_specifier", "precision_qualifier",
803 "layout_qualifier", "layout_qualifier_id_list", "layout_qualifier_id",
Nicolas Capens7d626792015-02-17 17:58:31 -0500804 "type_specifier_no_prec", "type_specifier_nonarray", "struct_specifier",
805 "$@1", "$@2", "struct_declaration_list", "struct_declaration",
John Bauman66b8ab22014-05-06 15:57:45 -0400806 "struct_declarator_list", "struct_declarator", "initializer",
807 "declaration_statement", "statement", "simple_statement",
808 "compound_statement", "$@3", "$@4", "statement_no_new_scope",
809 "statement_with_scope", "$@5", "$@6", "compound_statement_no_new_scope",
810 "statement_list", "expression_statement", "selection_statement",
811 "selection_rest_statement", "condition", "iteration_statement", "$@7",
812 "$@8", "$@9", "for_init_statement", "conditionopt", "for_rest_statement",
813 "jump_statement", "translation_unit", "external_declaration",
814 "function_definition", "$@10", 0
815};
816#endif
817
818# ifdef YYPRINT
819/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
820 token YYLEX-NUM. */
821static const yytype_uint16 yytoknum[] =
822{
823 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
824 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
825 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
826 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
827 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
828 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
829 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
830 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
831 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
Nicolas Capensc6841852015-02-15 14:25:37 -0500832 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
Nicolas Capens7d626792015-02-17 17:58:31 -0500833 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
Alexis Hetub14178b2015-04-13 13:23:20 -0400834 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
835 375, 376, 377, 378, 379, 380, 381, 382
John Bauman66b8ab22014-05-06 15:57:45 -0400836};
837# endif
838
839/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
840static const yytype_uint8 yyr1[] =
841{
Alexis Hetub14178b2015-04-13 13:23:20 -0400842 0, 128, 129, 130, 130, 130, 130, 130, 130, 131,
843 131, 131, 131, 131, 131, 132, 133, 134, 134, 135,
844 135, 136, 136, 137, 137, 138, 139, 139, 139, 140,
845 140, 140, 140, 141, 141, 141, 142, 142, 142, 143,
846 143, 143, 144, 145, 145, 145, 145, 145, 146, 146,
847 146, 147, 148, 149, 150, 150, 151, 151, 152, 152,
848 153, 153, 154, 154, 155, 155, 155, 155, 155, 156,
849 156, 157, 158, 158, 158, 159, 160, 160, 161, 161,
850 162, 163, 163, 164, 164, 164, 164, 165, 165, 165,
851 165, 166, 167, 167, 167, 167, 167, 168, 168, 168,
Alexis Hetu55a2cbc2015-04-16 10:49:45 -0400852 168, 168, 168, 169, 169, 170, 170, 171, 172, 172,
853 172, 172, 172, 172, 172, 172, 173, 173, 173, 173,
854 173, 173, 174, 174, 175, 175, 175, 176, 177, 177,
855 178, 178, 178, 179, 179, 180, 180, 180, 180, 180,
856 180, 180, 180, 180, 180, 180, 180, 180, 180, 180,
857 180, 180, 180, 180, 180, 180, 180, 180, 180, 180,
858 180, 180, 180, 180, 180, 180, 180, 180, 180, 180,
859 180, 180, 180, 180, 180, 180, 180, 180, 180, 182,
860 181, 183, 181, 184, 184, 185, 186, 186, 187, 187,
861 188, 189, 190, 190, 191, 191, 191, 191, 191, 192,
862 193, 194, 192, 195, 195, 197, 196, 198, 196, 199,
863 199, 200, 200, 201, 201, 202, 203, 203, 204, 204,
864 206, 205, 207, 205, 208, 205, 209, 209, 210, 210,
865 211, 211, 212, 212, 212, 212, 212, 213, 213, 214,
866 214, 216, 215
John Bauman66b8ab22014-05-06 15:57:45 -0400867};
868
869/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
870static const yytype_uint8 yyr2[] =
871{
Nicolas Capens2c1239f2015-02-17 17:30:04 -0500872 0, 2, 1, 1, 1, 1, 1, 1, 3, 1,
873 4, 1, 3, 2, 2, 1, 1, 1, 3, 2,
874 2, 2, 1, 2, 3, 2, 1, 1, 1, 1,
875 2, 2, 2, 1, 1, 1, 1, 3, 3, 1,
876 3, 3, 1, 1, 3, 3, 3, 3, 1, 3,
877 3, 1, 1, 1, 1, 3, 1, 3, 1, 3,
878 1, 5, 1, 3, 1, 1, 1, 1, 1, 1,
879 3, 1, 2, 2, 4, 2, 1, 1, 2, 3,
880 3, 2, 5, 3, 2, 3, 2, 0, 1, 1,
881 1, 1, 1, 3, 5, 6, 5, 1, 2, 4,
Alexis Hetu55a2cbc2015-04-16 10:49:45 -0400882 5, 4, 2, 1, 2, 1, 1, 1, 1, 1,
883 2, 1, 2, 1, 1, 2, 1, 1, 1, 2,
884 2, 1, 1, 2, 1, 1, 1, 4, 1, 3,
885 1, 3, 3, 1, 4, 1, 1, 1, 1, 1,
John Bauman66b8ab22014-05-06 15:57:45 -0400886 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
Alexis Hetub14178b2015-04-13 13:23:20 -0400887 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
888 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
Alexis Hetu55a2cbc2015-04-16 10:49:45 -0400889 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
890 6, 0, 5, 1, 2, 3, 1, 3, 1, 4,
891 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
892 0, 0, 5, 1, 1, 0, 2, 0, 2, 2,
893 3, 1, 2, 1, 2, 5, 3, 1, 1, 4,
894 0, 6, 0, 8, 0, 7, 1, 1, 1, 0,
895 2, 3, 2, 2, 2, 3, 2, 1, 2, 1,
896 1, 0, 3
John Bauman66b8ab22014-05-06 15:57:45 -0400897};
898
899/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
900 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
901 means the default is an error. */
902static const yytype_uint8 yydefact[] =
903{
Alexis Hetu55a2cbc2015-04-16 10:49:45 -0400904 0, 0, 124, 125, 126, 0, 108, 116, 139, 136,
905 137, 138, 143, 144, 145, 146, 147, 148, 140, 141,
906 142, 149, 150, 151, 152, 153, 154, 117, 118, 121,
907 109, 155, 156, 157, 158, 159, 160, 0, 106, 105,
908 0, 135, 161, 162, 163, 165, 166, 167, 168, 169,
909 170, 171, 172, 173, 164, 174, 175, 176, 0, 178,
910 240, 241, 0, 77, 87, 0, 92, 97, 113, 0,
911 111, 103, 0, 114, 122, 133, 177, 0, 237, 239,
912 110, 102, 0, 119, 120, 0, 181, 0, 72, 0,
913 75, 87, 107, 88, 89, 90, 78, 0, 87, 0,
914 73, 98, 112, 104, 123, 115, 0, 1, 238, 0,
915 179, 0, 130, 0, 128, 0, 242, 79, 84, 86,
916 91, 0, 93, 80, 0, 0, 2, 6, 4, 5,
917 7, 28, 0, 0, 0, 35, 34, 33, 3, 9,
918 29, 11, 16, 17, 0, 0, 22, 0, 36, 0,
919 39, 42, 43, 48, 51, 52, 53, 54, 56, 58,
920 60, 71, 0, 26, 74, 0, 0, 0, 183, 0,
921 127, 0, 0, 0, 222, 0, 0, 0, 0, 0,
922 200, 209, 213, 36, 62, 69, 0, 191, 0, 133,
923 194, 211, 193, 192, 0, 195, 196, 197, 198, 81,
924 83, 85, 0, 0, 99, 0, 190, 101, 30, 31,
925 0, 13, 14, 0, 0, 20, 19, 0, 21, 23,
926 25, 32, 0, 0, 0, 0, 0, 0, 0, 0,
927 0, 0, 0, 0, 0, 0, 134, 0, 188, 0,
928 186, 182, 184, 131, 132, 129, 233, 232, 207, 224,
929 0, 236, 234, 0, 220, 199, 0, 65, 66, 67,
930 68, 64, 0, 0, 214, 210, 212, 0, 94, 0,
931 96, 100, 8, 0, 15, 27, 12, 18, 24, 37,
932 38, 41, 40, 46, 47, 44, 45, 49, 50, 55,
933 57, 59, 0, 180, 0, 0, 185, 0, 0, 0,
934 0, 0, 235, 0, 201, 63, 70, 0, 95, 10,
935 0, 0, 187, 0, 206, 208, 227, 226, 229, 207,
936 0, 218, 0, 0, 0, 82, 61, 189, 0, 228,
937 0, 0, 217, 215, 0, 0, 202, 0, 230, 0,
938 207, 0, 204, 221, 203, 0, 231, 225, 216, 219,
939 223
John Bauman66b8ab22014-05-06 15:57:45 -0400940};
941
942/* YYDEFGOTO[NTERM-NUM]. */
943static const yytype_int16 yydefgoto[] =
944{
Alexis Hetu55a2cbc2015-04-16 10:49:45 -0400945 -1, 138, 139, 140, 273, 141, 142, 143, 144, 145,
946 146, 147, 183, 149, 150, 151, 152, 153, 154, 155,
947 156, 157, 158, 159, 160, 184, 185, 262, 186, 162,
948 187, 188, 62, 63, 64, 118, 96, 97, 119, 65,
949 66, 67, 68, 98, 69, 70, 71, 72, 73, 113,
950 114, 74, 163, 76, 165, 111, 167, 168, 239, 240,
951 207, 190, 191, 192, 193, 256, 324, 343, 297, 298,
952 299, 344, 194, 195, 196, 333, 323, 197, 303, 248,
953 300, 318, 330, 331, 198, 77, 78, 79, 89
John Bauman66b8ab22014-05-06 15:57:45 -0400954};
955
956/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
957 STATE-NUM. */
Alexis Hetu55a2cbc2015-04-16 10:49:45 -0400958#define YYPACT_NINF -300
John Bauman66b8ab22014-05-06 15:57:45 -0400959static const yytype_int16 yypact[] =
960{
Alexis Hetu55a2cbc2015-04-16 10:49:45 -0400961 1737, -20, -300, -300, -300, 150, -300, -300, -300, -300,
962 -300, -300, -300, -300, -300, -300, -300, -300, -300, -300,
963 -300, -300, -300, -300, -300, -300, -300, -300, -300, -300,
964 -300, -300, -300, -300, -300, -300, -300, -22, -300, -300,
965 -50, -300, -300, -300, -300, -300, -300, -300, -300, -300,
966 -300, -300, -300, -300, -300, -300, -300, -300, -67, -300,
967 -300, -85, -37, -24, 2, -1, -300, 15, 14, 1811,
968 -300, -300, 1947, 14, -300, -33, -300, 1662, -300, -300,
969 -300, -300, 1947, -300, -300, -4, -300, 19, -300, 28,
970 -300, 5, -300, -300, -300, -300, -300, 1811, 117, 46,
971 -300, -43, -300, -300, -300, -300, 1302, -300, -300, 38,
972 -300, 1811, 53, -75, -300, 337, -300, -300, -300, -300,
973 93, 1811, -78, -300, 216, 1302, 68, -300, -300, -300,
974 -300, -300, 1302, 1302, 1302, -300, -300, -300, -300, -300,
975 -46, -300, -300, -300, 69, -30, 1397, 71, -300, 1302,
976 -3, -38, -300, -56, 52, -300, -300, -300, 86, 88,
977 -76, -300, 75, -300, -300, 1811, 107, 1492, -300, 81,
978 -300, 19, 70, 73, -300, 85, 89, 76, 1109, 92,
979 83, -300, -300, 6, -300, -300, 26, -300, -85, 8,
980 -300, -300, -300, -300, 453, -300, -300, -300, -300, 79,
981 -300, -300, 1204, 1302, -300, 90, -300, -300, -300, -300,
982 -17, -300, -300, 1302, 1879, -300, -300, 1302, 95, -300,
983 -300, -300, 1302, 1302, 1302, 1302, 1302, 1302, 1302, 1302,
984 1302, 1302, 1302, 1302, 1302, 1302, -300, 1577, 94, 37,
985 -300, -300, -300, -300, -300, -300, -300, -300, 96, -300,
986 1302, -300, -300, 39, -300, -300, 569, -300, -300, -300,
987 -300, -300, 1302, 1302, -300, -300, -300, 1302, -300, 98,
988 -300, -300, -300, 99, 91, -300, 97, -300, -300, -300,
989 -300, -3, -3, -300, -300, -300, -300, -56, -56, -300,
990 86, 88, 51, -300, 1302, 107, -300, 147, 28, 801,
991 917, -15, -300, 1014, 569, -300, -300, 100, -300, -300,
992 1302, 102, -300, 106, -300, -300, -300, -300, 1014, 96,
993 168, 91, 137, 109, 110, -300, -300, -300, 1302, -300,
994 101, 111, 201, -300, 108, 685, -300, -13, 1302, 685,
995 96, 1302, -300, -300, -300, 116, 91, -300, -300, -300,
996 -300
John Bauman66b8ab22014-05-06 15:57:45 -0400997};
998
999/* YYPGOTO[NTERM-NUM]. */
1000static const yytype_int16 yypgoto[] =
1001{
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04001002 -300, -300, -300, -300, -300, -300, -300, 10, -300, -300,
1003 -300, -300, -99, -300, -54, -300, -82, -51, -300, -300,
1004 -300, -12, -11, -9, -300, -103, -124, -300, -130, -118,
1005 9, 12, -300, -300, -300, 112, 132, 133, 113, -300,
1006 -300, -244, -300, -300, -300, 3, -59, 227, -300, -300,
1007 64, -55, 0, -300, -300, -300, 74, -152, -300, -57,
1008 -198, -64, -186, -286, -300, -300, -300, -81, -299, -300,
1009 -300, -87, -16, -41, -300, -300, -61, -300, -300, -300,
1010 -300, -300, -300, -300, -300, -300, 183, -300, -300
John Bauman66b8ab22014-05-06 15:57:45 -04001011};
1012
1013/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
1014 positive, shift that token. If negative, reduce the rule which
1015 number is the opposite. If zero, do what YYDEFACT says.
1016 If YYTABLE_NINF, syntax error. */
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04001017#define YYTABLE_NINF -206
John Bauman66b8ab22014-05-06 15:57:45 -04001018static const yytype_int16 yytable[] =
1019{
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04001020 75, 206, 116, 161, 210, 270, 205, 148, 266, 60,
1021 103, 92, 61, 315, 92, 242, 234, 104, 83, 84,
1022 332, 161, 219, 7, 80, 148, 85, 109, 202, 88,
1023 170, 226, 227, 208, 209, 203, 171, 87, 120, 211,
1024 212, 348, 93, 94, 95, 93, 94, 95, 253, 342,
1025 221, 235, 166, 342, 27, 28, 81, 29, 86, 322,
1026 213, 123, 120, 124, 214, 37, 228, 229, 90, 75,
1027 125, 102, 75, 106, 322, 216, 105, 75, 224, 206,
1028 225, 217, 75, 274, 269, 242, 60, 91, 272, 61,
1029 319, 101, 345, 278, 263, 112, 263, 75, 263, 161,
1030 257, 258, 259, 148, 110, 292, 166, -76, 166, 260,
1031 99, 75, -26, 100, 106, 189, 222, 223, 266, 261,
1032 301, 75, 122, 279, 280, 148, 148, 148, 148, 148,
1033 148, 148, 148, 148, 148, 148, 115, 263, 305, 306,
1034 264, 230, 231, 349, 283, 284, 285, 286, 295, 307,
1035 263, 296, 164, 302, 2, 3, 4, 93, 94, 95,
1036 243, 244, 263, 310, 161, 75, 169, 75, 148, 199,
1037 281, 282, -27, 321, 215, 220, 311, 232, 166, 287,
1038 288, 233, 236, 238, 246, 267, 326, 247, 321, 249,
1039 251, 161, 255, 250, 189, 148, 254, 271, 337, -135,
1040 294, -28, 263, 313, -205, 308, 309, 325, 346, 327,
1041 328, 314, 80, 334, 335, 338, 339, 206, 340, 336,
1042 289, 341, 290, 117, 277, 291, 8, 9, 10, 11,
1043 350, 121, 82, 200, 201, 245, 316, 75, 312, 237,
1044 304, 12, 13, 14, 15, 16, 17, 18, 19, 20,
1045 21, 22, 23, 24, 25, 26, 189, 329, 347, 317,
1046 108, 31, 32, 33, 34, 35, 36, 0, 0, 0,
1047 40, 41, 0, 42, 43, 44, 0, 45, 46, 47,
1048 48, 49, 50, 51, 52, 53, 54, 0, 55, 56,
1049 57, 0, 126, 59, 127, 128, 129, 130, 131, 189,
1050 189, 132, 133, 189, 189, 0, 0, 0, 0, 0,
1051 0, 0, 0, 0, 0, 0, 0, 0, 189, 0,
1052 134, 0, 0, 204, 0, 0, 0, 0, 0, 0,
1053 0, 135, 136, 0, 137, 189, 0, 0, 0, 189,
Alexis Hetub14178b2015-04-13 13:23:20 -04001054 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04001055 11, 172, 173, 174, 0, 175, 176, 177, 178, 0,
Nicolas Capens7d626792015-02-17 17:58:31 -05001056 0, 0, 12, 13, 14, 15, 16, 17, 18, 19,
Alexis Hetub14178b2015-04-13 13:23:20 -04001057 20, 21, 22, 23, 24, 25, 26, 27, 28, 0,
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04001058 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
1059 39, 40, 41, 179, 42, 43, 44, 0, 45, 46,
1060 47, 48, 49, 50, 51, 52, 53, 54, 0, 55,
1061 56, 57, 58, 126, 59, 127, 128, 129, 130, 131,
1062 0, 0, 132, 133, 0, 0, 0, 0, 0, 0,
Nicolas Capens7d626792015-02-17 17:58:31 -05001063 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04001064 0, 134, 0, 0, 0, 180, 181, 0, 0, 0,
1065 0, 182, 135, 136, 0, 137, 1, 2, 3, 4,
1066 5, 6, 7, 8, 9, 10, 11, 172, 173, 174,
1067 0, 175, 176, 177, 178, 0, 0, 0, 12, 13,
Alexis Hetub14178b2015-04-13 13:23:20 -04001068 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
1069 24, 25, 26, 27, 28, 0, 29, 30, 31, 32,
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04001070 33, 34, 35, 36, 37, 38, 39, 40, 41, 179,
1071 42, 43, 44, 0, 45, 46, 47, 48, 49, 50,
1072 51, 52, 53, 54, 0, 55, 56, 57, 58, 126,
1073 59, 127, 128, 129, 130, 131, 0, 0, 132, 133,
Alexis Hetub14178b2015-04-13 13:23:20 -04001074 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04001075 0, 0, 0, 0, 0, 0, 0, 134, 0, 0,
1076 0, 180, 265, 0, 0, 0, 0, 182, 135, 136,
1077 0, 137, 1, 2, 3, 4, 5, 6, 7, 8,
1078 9, 10, 11, 172, 173, 174, 0, 175, 176, 177,
1079 178, 0, 0, 0, 12, 13, 14, 15, 16, 17,
1080 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
1081 28, 0, 29, 30, 31, 32, 33, 34, 35, 36,
1082 37, 38, 39, 40, 41, 179, 42, 43, 44, 0,
1083 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1084 0, 55, 56, 57, 58, 126, 59, 127, 128, 129,
1085 130, 131, 0, 0, 132, 133, 0, 0, 0, 0,
Alexis Hetub14178b2015-04-13 13:23:20 -04001086 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04001087 0, 0, 0, 134, 0, 0, 0, 180, 0, 0,
1088 0, 0, 0, 182, 135, 136, 0, 137, 1, 2,
1089 3, 4, 5, 6, 7, 8, 9, 10, 11, 172,
1090 173, 174, 0, 175, 176, 177, 178, 0, 0, 0,
Nicolas Capens7d626792015-02-17 17:58:31 -05001091 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04001092 22, 23, 24, 25, 26, 27, 28, 0, 29, 30,
1093 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
1094 41, 179, 42, 43, 44, 0, 45, 46, 47, 48,
1095 49, 50, 51, 52, 53, 54, 0, 55, 56, 57,
1096 58, 126, 59, 127, 128, 129, 130, 131, 0, 0,
1097 132, 133, 0, 0, 0, 0, 0, 0, 0, 0,
1098 0, 0, 0, 0, 0, 0, 0, 0, 0, 134,
1099 0, 0, 0, 115, 0, 0, 0, 0, 0, 182,
1100 135, 136, 0, 137, 1, 2, 3, 4, 5, 6,
1101 7, 8, 9, 10, 11, 172, 173, 174, 0, 175,
1102 176, 177, 178, 0, 0, 0, 12, 13, 14, 15,
1103 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
1104 26, 27, 28, 0, 29, 30, 31, 32, 33, 34,
1105 35, 36, 37, 38, 39, 40, 41, 179, 42, 43,
1106 44, 0, 45, 46, 47, 48, 49, 50, 51, 52,
1107 53, 54, 0, 55, 56, 57, 58, 126, 59, 127,
1108 128, 129, 130, 131, 0, 0, 132, 133, 0, 0,
Nicolas Capens7d626792015-02-17 17:58:31 -05001109 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04001110 0, 0, 0, 0, 0, 134, 0, 0, 0, 0,
1111 0, 0, 0, 0, 0, 182, 135, 136, 0, 137,
1112 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
Alexis Hetub14178b2015-04-13 13:23:20 -04001113 11, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1114 0, 0, 12, 13, 14, 15, 16, 17, 18, 19,
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04001115 20, 21, 22, 23, 24, 25, 26, 27, 28, 0,
1116 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
1117 39, 40, 41, 0, 42, 43, 44, 0, 45, 46,
1118 47, 48, 49, 50, 51, 52, 53, 54, 0, 55,
1119 56, 57, 58, 126, 59, 127, 128, 129, 130, 131,
1120 0, 0, 132, 133, 0, 0, 0, 0, 0, 0,
1121 0, 0, 0, 0, 0, 0, 0, 320, 2, 3,
1122 4, 134, 6, 7, 8, 9, 10, 11, 0, 0,
1123 0, 182, 135, 136, 0, 137, 0, 0, 0, 12,
1124 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
1125 23, 24, 25, 26, 27, 28, 0, 29, 30, 31,
1126 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
1127 0, 42, 43, 44, 0, 45, 46, 47, 48, 49,
1128 50, 51, 52, 53, 54, 0, 55, 56, 57, 58,
1129 126, 59, 127, 128, 129, 130, 131, 0, 0, 132,
1130 133, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1131 0, 0, 0, 0, 0, 0, 0, 0, 134, 8,
1132 9, 10, 11, 0, 0, 0, 0, 0, 0, 135,
1133 136, 0, 137, 0, 12, 13, 14, 15, 16, 17,
1134 18, 19, 20, 21, 22, 23, 24, 25, 26, 0,
1135 0, 0, 0, 0, 31, 32, 33, 34, 35, 36,
1136 0, 0, 0, 40, 41, 0, 42, 43, 44, 0,
1137 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1138 0, 55, 56, 57, 0, 126, 59, 127, 128, 129,
1139 130, 131, 0, 0, 132, 133, 0, 0, 0, 0,
1140 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1141 0, 0, 0, 134, 8, 9, 10, 11, 0, 0,
1142 0, 0, 0, 252, 135, 136, 0, 137, 0, 12,
1143 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
1144 23, 24, 25, 26, 0, 0, 0, 0, 0, 31,
1145 32, 33, 34, 35, 36, 0, 0, 0, 40, 41,
1146 0, 42, 43, 44, 0, 45, 46, 47, 48, 49,
1147 50, 51, 52, 53, 54, 0, 55, 56, 57, 0,
1148 126, 59, 127, 128, 129, 130, 131, 0, 0, 132,
1149 133, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1150 0, 0, 0, 0, 0, 0, 0, 0, 134, 0,
1151 0, 268, 8, 9, 10, 11, 0, 0, 0, 135,
1152 136, 0, 137, 0, 0, 0, 0, 12, 13, 14,
1153 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1154 25, 26, 0, 0, 0, 0, 0, 31, 32, 33,
1155 34, 35, 36, 0, 0, 0, 40, 41, 0, 42,
1156 43, 44, 0, 45, 46, 47, 48, 49, 50, 51,
1157 52, 53, 54, 0, 55, 56, 57, 0, 126, 59,
1158 127, 128, 129, 130, 131, 0, 0, 132, 133, 0,
1159 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1160 0, 0, 0, 0, 0, 0, 134, 8, 9, 10,
1161 11, 0, 0, 0, 0, 0, 0, 135, 136, 0,
1162 137, 0, 12, 13, 14, 15, 16, 17, 18, 19,
1163 20, 21, 22, 23, 24, 25, 26, 0, 0, 0,
1164 0, 0, 31, 32, 33, 34, 35, 36, 0, 0,
1165 0, 40, 218, 0, 42, 43, 44, 0, 45, 46,
1166 47, 48, 49, 50, 51, 52, 53, 54, 0, 55,
1167 56, 57, 0, 126, 59, 127, 128, 129, 130, 131,
1168 0, 0, 132, 133, 0, 0, 0, 0, 0, 0,
1169 0, 0, 0, 0, 0, 0, 2, 3, 4, 0,
1170 0, 134, 8, 9, 10, 11, 0, 0, 0, 0,
1171 0, 0, 135, 136, 0, 137, 0, 12, 13, 14,
1172 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1173 25, 26, 0, 0, 0, 0, 0, 31, 32, 33,
1174 34, 35, 36, 0, 0, 0, 40, 41, 0, 42,
1175 43, 44, 0, 45, 46, 47, 48, 49, 50, 51,
1176 52, 53, 54, 0, 55, 56, 57, 0, 0, 59,
1177 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1178 0, 2, 3, 4, 0, 0, 0, 8, 9, 10,
1179 11, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1180 0, 241, 12, 13, 14, 15, 16, 17, 18, 19,
1181 20, 21, 22, 23, 24, 25, 26, 0, 0, 0,
1182 0, 0, 31, 32, 33, 34, 35, 36, 0, 0,
1183 0, 40, 41, 0, 42, 43, 44, 0, 45, 46,
1184 47, 48, 49, 50, 51, 52, 53, 54, 0, 55,
1185 56, 57, 0, 0, 59, 0, 0, 0, 0, 0,
1186 0, 0, 107, 0, 0, 1, 2, 3, 4, 5,
1187 6, 7, 8, 9, 10, 11, 0, 0, 0, 0,
1188 0, 0, 0, 0, 0, 0, 293, 12, 13, 14,
1189 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1190 25, 26, 27, 28, 0, 29, 30, 31, 32, 33,
1191 34, 35, 36, 37, 38, 39, 40, 41, 0, 42,
1192 43, 44, 0, 45, 46, 47, 48, 49, 50, 51,
1193 52, 53, 54, 0, 55, 56, 57, 58, 0, 59,
1194 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
1195 11, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1196 0, 0, 12, 13, 14, 15, 16, 17, 18, 19,
1197 20, 21, 22, 23, 24, 25, 26, 27, 28, 0,
1198 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
1199 39, 40, 41, 0, 42, 43, 44, 0, 45, 46,
1200 47, 48, 49, 50, 51, 52, 53, 54, 0, 55,
1201 56, 57, 58, 0, 59, 2, 3, 4, 0, 0,
1202 0, 8, 9, 10, 11, 0, 0, 0, 0, 0,
1203 0, 0, 0, 0, 0, 0, 12, 13, 14, 15,
1204 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
1205 26, 0, 0, 0, 0, 0, 31, 32, 33, 34,
1206 35, 36, 0, 0, 0, 40, 41, 0, 42, 43,
1207 44, 0, 45, 46, 47, 48, 49, 50, 51, 52,
1208 53, 54, 0, 55, 56, 57, 0, 0, 59, 8,
1209 9, 10, 11, 0, 0, 0, 0, 0, 0, 0,
1210 0, 0, 0, 0, 12, 13, 14, 15, 16, 17,
1211 18, 19, 20, 21, 22, 23, 24, 25, 26, 0,
1212 0, 0, 0, 0, 31, 32, 33, 34, 35, 36,
1213 0, 0, 0, 40, 41, 0, 42, 43, 44, 0,
1214 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1215 0, 55, 56, 57, 0, 275, 59, 8, 9, 10,
1216 11, 276, 0, 0, 0, 0, 0, 0, 0, 0,
1217 0, 0, 12, 13, 14, 15, 16, 17, 18, 19,
Alexis Hetub14178b2015-04-13 13:23:20 -04001218 20, 21, 22, 23, 24, 25, 26, 0, 0, 0,
1219 0, 0, 31, 32, 33, 34, 35, 36, 0, 0,
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04001220 0, 40, 41, 0, 42, 43, 44, 0, 45, 46,
1221 47, 48, 49, 50, 51, 52, 53, 54, 0, 55,
1222 56, 57, 0, 0, 59
John Bauman66b8ab22014-05-06 15:57:45 -04001223};
1224
1225static const yytype_int16 yycheck[] =
1226{
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04001227 0, 125, 89, 106, 134, 203, 124, 106, 194, 0,
1228 69, 9, 0, 299, 9, 167, 92, 72, 40, 41,
1229 319, 124, 146, 9, 44, 124, 76, 82, 106, 114,
1230 105, 87, 88, 132, 133, 113, 111, 104, 97, 85,
1231 86, 340, 40, 41, 42, 40, 41, 42, 178, 335,
1232 149, 127, 111, 339, 40, 41, 76, 43, 108, 303,
1233 106, 104, 121, 106, 110, 51, 122, 123, 105, 69,
1234 113, 68, 72, 106, 318, 105, 73, 77, 116, 203,
1235 118, 111, 82, 213, 202, 237, 77, 111, 105, 77,
1236 105, 76, 105, 217, 111, 76, 111, 97, 111, 202,
1237 94, 95, 96, 202, 108, 235, 165, 105, 167, 103,
1238 111, 111, 104, 114, 106, 115, 119, 120, 304, 113,
1239 250, 121, 76, 222, 223, 224, 225, 226, 227, 228,
1240 229, 230, 231, 232, 233, 234, 108, 111, 262, 263,
1241 114, 89, 90, 341, 226, 227, 228, 229, 111, 267,
1242 111, 114, 114, 114, 4, 5, 6, 40, 41, 42,
1243 79, 80, 111, 112, 267, 165, 113, 167, 267, 76,
1244 224, 225, 104, 303, 105, 104, 294, 91, 237, 230,
1245 231, 93, 107, 76, 114, 106, 310, 114, 318, 104,
1246 114, 294, 109, 104, 194, 294, 104, 107, 328, 104,
1247 106, 104, 111, 56, 108, 107, 107, 107, 338, 107,
1248 104, 298, 44, 76, 105, 114, 105, 341, 17, 109,
1249 232, 113, 233, 91, 214, 234, 10, 11, 12, 13,
1250 114, 98, 5, 121, 121, 171, 300, 237, 295, 165,
1251 256, 25, 26, 27, 28, 29, 30, 31, 32, 33,
1252 34, 35, 36, 37, 38, 39, 256, 318, 339, 300,
1253 77, 45, 46, 47, 48, 49, 50, -1, -1, -1,
1254 54, 55, -1, 57, 58, 59, -1, 61, 62, 63,
1255 64, 65, 66, 67, 68, 69, 70, -1, 72, 73,
1256 74, -1, 76, 77, 78, 79, 80, 81, 82, 299,
1257 300, 85, 86, 303, 304, -1, -1, -1, -1, -1,
1258 -1, -1, -1, -1, -1, -1, -1, -1, 318, -1,
1259 104, -1, -1, 107, -1, -1, -1, -1, -1, -1,
1260 -1, 115, 116, -1, 118, 335, -1, -1, -1, 339,
1261 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
1262 13, 14, 15, 16, -1, 18, 19, 20, 21, -1,
1263 -1, -1, 25, 26, 27, 28, 29, 30, 31, 32,
1264 33, 34, 35, 36, 37, 38, 39, 40, 41, -1,
1265 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
1266 53, 54, 55, 56, 57, 58, 59, -1, 61, 62,
1267 63, 64, 65, 66, 67, 68, 69, 70, -1, 72,
1268 73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
1269 -1, -1, 85, 86, -1, -1, -1, -1, -1, -1,
1270 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1271 -1, 104, -1, -1, -1, 108, 109, -1, -1, -1,
1272 -1, 114, 115, 116, -1, 118, 3, 4, 5, 6,
Alexis Hetub14178b2015-04-13 13:23:20 -04001273 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
1274 -1, 18, 19, 20, 21, -1, -1, -1, 25, 26,
1275 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
1276 37, 38, 39, 40, 41, -1, 43, 44, 45, 46,
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04001277 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
Alexis Hetub14178b2015-04-13 13:23:20 -04001278 57, 58, 59, -1, 61, 62, 63, 64, 65, 66,
1279 67, 68, 69, 70, -1, 72, 73, 74, 75, 76,
1280 77, 78, 79, 80, 81, 82, -1, -1, 85, 86,
1281 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1282 -1, -1, -1, -1, -1, -1, -1, 104, -1, -1,
1283 -1, 108, 109, -1, -1, -1, -1, 114, 115, 116,
1284 -1, 118, 3, 4, 5, 6, 7, 8, 9, 10,
1285 11, 12, 13, 14, 15, 16, -1, 18, 19, 20,
1286 21, -1, -1, -1, 25, 26, 27, 28, 29, 30,
1287 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
1288 41, -1, 43, 44, 45, 46, 47, 48, 49, 50,
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04001289 51, 52, 53, 54, 55, 56, 57, 58, 59, -1,
Alexis Hetub14178b2015-04-13 13:23:20 -04001290 61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
1291 -1, 72, 73, 74, 75, 76, 77, 78, 79, 80,
1292 81, 82, -1, -1, 85, 86, -1, -1, -1, -1,
1293 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04001294 -1, -1, -1, 104, -1, -1, -1, 108, -1, -1,
Alexis Hetub14178b2015-04-13 13:23:20 -04001295 -1, -1, -1, 114, 115, 116, -1, 118, 3, 4,
Nicolas Capens7d626792015-02-17 17:58:31 -05001296 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1297 15, 16, -1, 18, 19, 20, 21, -1, -1, -1,
1298 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1299 35, 36, 37, 38, 39, 40, 41, -1, 43, 44,
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04001300 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
Alexis Hetub14178b2015-04-13 13:23:20 -04001301 55, 56, 57, 58, 59, -1, 61, 62, 63, 64,
1302 65, 66, 67, 68, 69, 70, -1, 72, 73, 74,
1303 75, 76, 77, 78, 79, 80, 81, 82, -1, -1,
1304 85, 86, -1, -1, -1, -1, -1, -1, -1, -1,
1305 -1, -1, -1, -1, -1, -1, -1, -1, -1, 104,
1306 -1, -1, -1, 108, -1, -1, -1, -1, -1, 114,
1307 115, 116, -1, 118, 3, 4, 5, 6, 7, 8,
Nicolas Capens7d626792015-02-17 17:58:31 -05001308 9, 10, 11, 12, 13, 14, 15, 16, -1, 18,
1309 19, 20, 21, -1, -1, -1, 25, 26, 27, 28,
1310 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
Alexis Hetub14178b2015-04-13 13:23:20 -04001311 39, 40, 41, -1, 43, 44, 45, 46, 47, 48,
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04001312 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
Alexis Hetub14178b2015-04-13 13:23:20 -04001313 59, -1, 61, 62, 63, 64, 65, 66, 67, 68,
1314 69, 70, -1, 72, 73, 74, 75, 76, 77, 78,
1315 79, 80, 81, 82, -1, -1, 85, 86, -1, -1,
Nicolas Capens7d626792015-02-17 17:58:31 -05001316 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04001317 -1, -1, -1, -1, -1, 104, -1, -1, -1, -1,
Alexis Hetub14178b2015-04-13 13:23:20 -04001318 -1, -1, -1, -1, -1, 114, 115, 116, -1, 118,
1319 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04001320 13, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Nicolas Capens7d626792015-02-17 17:58:31 -05001321 -1, -1, 25, 26, 27, 28, 29, 30, 31, 32,
Alexis Hetub14178b2015-04-13 13:23:20 -04001322 33, 34, 35, 36, 37, 38, 39, 40, 41, -1,
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04001323 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
1324 53, 54, 55, -1, 57, 58, 59, -1, 61, 62,
Alexis Hetub14178b2015-04-13 13:23:20 -04001325 63, 64, 65, 66, 67, 68, 69, 70, -1, 72,
1326 73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
1327 -1, -1, 85, 86, -1, -1, -1, -1, -1, -1,
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04001328 -1, -1, -1, -1, -1, -1, -1, 3, 4, 5,
1329 6, 104, 8, 9, 10, 11, 12, 13, -1, -1,
1330 -1, 114, 115, 116, -1, 118, -1, -1, -1, 25,
1331 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
1332 36, 37, 38, 39, 40, 41, -1, 43, 44, 45,
1333 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
1334 -1, 57, 58, 59, -1, 61, 62, 63, 64, 65,
1335 66, 67, 68, 69, 70, -1, 72, 73, 74, 75,
1336 76, 77, 78, 79, 80, 81, 82, -1, -1, 85,
1337 86, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1338 -1, -1, -1, -1, -1, -1, -1, -1, 104, 10,
1339 11, 12, 13, -1, -1, -1, -1, -1, -1, 115,
1340 116, -1, 118, -1, 25, 26, 27, 28, 29, 30,
1341 31, 32, 33, 34, 35, 36, 37, 38, 39, -1,
1342 -1, -1, -1, -1, 45, 46, 47, 48, 49, 50,
1343 -1, -1, -1, 54, 55, -1, 57, 58, 59, -1,
1344 61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
1345 -1, 72, 73, 74, -1, 76, 77, 78, 79, 80,
1346 81, 82, -1, -1, 85, 86, -1, -1, -1, -1,
Nicolas Capens7d626792015-02-17 17:58:31 -05001347 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04001348 -1, -1, -1, 104, 10, 11, 12, 13, -1, -1,
1349 -1, -1, -1, 114, 115, 116, -1, 118, -1, 25,
1350 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
1351 36, 37, 38, 39, -1, -1, -1, -1, -1, 45,
1352 46, 47, 48, 49, 50, -1, -1, -1, 54, 55,
1353 -1, 57, 58, 59, -1, 61, 62, 63, 64, 65,
1354 66, 67, 68, 69, 70, -1, 72, 73, 74, -1,
1355 76, 77, 78, 79, 80, 81, 82, -1, -1, 85,
1356 86, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1357 -1, -1, -1, -1, -1, -1, -1, -1, 104, -1,
1358 -1, 107, 10, 11, 12, 13, -1, -1, -1, 115,
1359 116, -1, 118, -1, -1, -1, -1, 25, 26, 27,
1360 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
1361 38, 39, -1, -1, -1, -1, -1, 45, 46, 47,
1362 48, 49, 50, -1, -1, -1, 54, 55, -1, 57,
1363 58, 59, -1, 61, 62, 63, 64, 65, 66, 67,
1364 68, 69, 70, -1, 72, 73, 74, -1, 76, 77,
1365 78, 79, 80, 81, 82, -1, -1, 85, 86, -1,
Alexis Hetub14178b2015-04-13 13:23:20 -04001366 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04001367 -1, -1, -1, -1, -1, -1, 104, 10, 11, 12,
1368 13, -1, -1, -1, -1, -1, -1, 115, 116, -1,
1369 118, -1, 25, 26, 27, 28, 29, 30, 31, 32,
1370 33, 34, 35, 36, 37, 38, 39, -1, -1, -1,
1371 -1, -1, 45, 46, 47, 48, 49, 50, -1, -1,
1372 -1, 54, 55, -1, 57, 58, 59, -1, 61, 62,
1373 63, 64, 65, 66, 67, 68, 69, 70, -1, 72,
1374 73, 74, -1, 76, 77, 78, 79, 80, 81, 82,
1375 -1, -1, 85, 86, -1, -1, -1, -1, -1, -1,
1376 -1, -1, -1, -1, -1, -1, 4, 5, 6, -1,
1377 -1, 104, 10, 11, 12, 13, -1, -1, -1, -1,
1378 -1, -1, 115, 116, -1, 118, -1, 25, 26, 27,
1379 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
1380 38, 39, -1, -1, -1, -1, -1, 45, 46, 47,
1381 48, 49, 50, -1, -1, -1, 54, 55, -1, 57,
1382 58, 59, -1, 61, 62, 63, 64, 65, 66, 67,
1383 68, 69, 70, -1, 72, 73, 74, -1, -1, 77,
Alexis Hetub14178b2015-04-13 13:23:20 -04001384 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04001385 -1, 4, 5, 6, -1, -1, -1, 10, 11, 12,
Alexis Hetub14178b2015-04-13 13:23:20 -04001386 13, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04001387 -1, 109, 25, 26, 27, 28, 29, 30, 31, 32,
1388 33, 34, 35, 36, 37, 38, 39, -1, -1, -1,
1389 -1, -1, 45, 46, 47, 48, 49, 50, -1, -1,
1390 -1, 54, 55, -1, 57, 58, 59, -1, 61, 62,
1391 63, 64, 65, 66, 67, 68, 69, 70, -1, 72,
1392 73, 74, -1, -1, 77, -1, -1, -1, -1, -1,
1393 -1, -1, 0, -1, -1, 3, 4, 5, 6, 7,
1394 8, 9, 10, 11, 12, 13, -1, -1, -1, -1,
1395 -1, -1, -1, -1, -1, -1, 109, 25, 26, 27,
1396 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
1397 38, 39, 40, 41, -1, 43, 44, 45, 46, 47,
1398 48, 49, 50, 51, 52, 53, 54, 55, -1, 57,
1399 58, 59, -1, 61, 62, 63, 64, 65, 66, 67,
1400 68, 69, 70, -1, 72, 73, 74, 75, -1, 77,
1401 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
1402 13, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1403 -1, -1, 25, 26, 27, 28, 29, 30, 31, 32,
1404 33, 34, 35, 36, 37, 38, 39, 40, 41, -1,
1405 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
1406 53, 54, 55, -1, 57, 58, 59, -1, 61, 62,
1407 63, 64, 65, 66, 67, 68, 69, 70, -1, 72,
1408 73, 74, 75, -1, 77, 4, 5, 6, -1, -1,
1409 -1, 10, 11, 12, 13, -1, -1, -1, -1, -1,
1410 -1, -1, -1, -1, -1, -1, 25, 26, 27, 28,
1411 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
1412 39, -1, -1, -1, -1, -1, 45, 46, 47, 48,
1413 49, 50, -1, -1, -1, 54, 55, -1, 57, 58,
1414 59, -1, 61, 62, 63, 64, 65, 66, 67, 68,
1415 69, 70, -1, 72, 73, 74, -1, -1, 77, 10,
1416 11, 12, 13, -1, -1, -1, -1, -1, -1, -1,
1417 -1, -1, -1, -1, 25, 26, 27, 28, 29, 30,
1418 31, 32, 33, 34, 35, 36, 37, 38, 39, -1,
1419 -1, -1, -1, -1, 45, 46, 47, 48, 49, 50,
1420 -1, -1, -1, 54, 55, -1, 57, 58, 59, -1,
1421 61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
1422 -1, 72, 73, 74, -1, 76, 77, 10, 11, 12,
1423 13, 82, -1, -1, -1, -1, -1, -1, -1, -1,
Alexis Hetub14178b2015-04-13 13:23:20 -04001424 -1, -1, 25, 26, 27, 28, 29, 30, 31, 32,
1425 33, 34, 35, 36, 37, 38, 39, -1, -1, -1,
1426 -1, -1, 45, 46, 47, 48, 49, 50, -1, -1,
1427 -1, 54, 55, -1, 57, 58, 59, -1, 61, 62,
1428 63, 64, 65, 66, 67, 68, 69, 70, -1, 72,
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04001429 73, 74, -1, -1, 77
John Bauman66b8ab22014-05-06 15:57:45 -04001430};
1431
1432/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
1433 symbol of state STATE-NUM. */
1434static const yytype_uint8 yystos[] =
1435{
1436 0, 3, 4, 5, 6, 7, 8, 9, 10, 11,
Nicolas Capens3c20f802015-02-17 17:17:20 -05001437 12, 13, 25, 26, 27, 28, 29, 30, 31, 32,
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05001438 33, 34, 35, 36, 37, 38, 39, 40, 41, 43,
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04001439 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
1440 54, 55, 57, 58, 59, 61, 62, 63, 64, 65,
1441 66, 67, 68, 69, 70, 72, 73, 74, 75, 77,
1442 158, 159, 160, 161, 162, 167, 168, 169, 170, 172,
1443 173, 174, 175, 176, 179, 180, 181, 213, 214, 215,
1444 44, 76, 175, 40, 41, 76, 108, 104, 114, 216,
1445 105, 111, 9, 40, 41, 42, 164, 165, 171, 111,
1446 114, 76, 173, 174, 179, 173, 106, 0, 214, 179,
1447 108, 183, 76, 177, 178, 108, 199, 164, 163, 166,
1448 174, 165, 76, 104, 106, 113, 76, 78, 79, 80,
1449 81, 82, 85, 86, 104, 115, 116, 118, 129, 130,
1450 131, 133, 134, 135, 136, 137, 138, 139, 140, 141,
1451 142, 143, 144, 145, 146, 147, 148, 149, 150, 151,
1452 152, 153, 157, 180, 114, 182, 174, 184, 185, 113,
1453 105, 111, 14, 15, 16, 18, 19, 20, 21, 56,
1454 108, 109, 114, 140, 153, 154, 156, 158, 159, 180,
1455 189, 190, 191, 192, 200, 201, 202, 205, 212, 76,
1456 163, 166, 106, 113, 107, 157, 154, 188, 140, 140,
1457 156, 85, 86, 106, 110, 105, 105, 111, 55, 154,
1458 104, 140, 119, 120, 116, 118, 87, 88, 122, 123,
1459 89, 90, 91, 93, 92, 127, 107, 184, 76, 186,
1460 187, 109, 185, 79, 80, 178, 114, 114, 207, 104,
1461 104, 114, 114, 156, 104, 109, 193, 94, 95, 96,
1462 103, 113, 155, 111, 114, 109, 190, 106, 107, 157,
1463 188, 107, 105, 132, 156, 76, 82, 135, 154, 140,
1464 140, 142, 142, 144, 144, 144, 144, 145, 145, 149,
1465 150, 151, 156, 109, 106, 111, 114, 196, 197, 198,
1466 208, 156, 114, 206, 200, 154, 154, 157, 107, 107,
1467 112, 157, 187, 56, 199, 191, 189, 201, 209, 105,
1468 3, 156, 169, 204, 194, 107, 154, 107, 104, 204,
1469 210, 211, 196, 203, 76, 105, 109, 156, 114, 105,
1470 17, 113, 191, 195, 199, 105, 156, 195, 196, 188,
1471 114
John Bauman66b8ab22014-05-06 15:57:45 -04001472};
1473
1474#define yyerrok (yyerrstatus = 0)
1475#define yyclearin (yychar = YYEMPTY)
1476#define YYEMPTY (-2)
1477#define YYEOF 0
1478
1479#define YYACCEPT goto yyacceptlab
1480#define YYABORT goto yyabortlab
1481#define YYERROR goto yyerrorlab
1482
1483
1484/* Like YYERROR except do call yyerror. This remains here temporarily
1485 to ease the transition to the new meaning of YYERROR, for GCC.
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04001486 Once GCC version 2 has supplanted version 1, this can go. */
John Bauman66b8ab22014-05-06 15:57:45 -04001487
1488#define YYFAIL goto yyerrlab
John Bauman66b8ab22014-05-06 15:57:45 -04001489
1490#define YYRECOVERING() (!!yyerrstatus)
1491
1492#define YYBACKUP(Token, Value) \
1493do \
1494 if (yychar == YYEMPTY && yylen == 1) \
1495 { \
1496 yychar = (Token); \
1497 yylval = (Value); \
1498 yytoken = YYTRANSLATE (yychar); \
1499 YYPOPSTACK (1); \
1500 goto yybackup; \
1501 } \
1502 else \
1503 { \
1504 yyerror (context, YY_("syntax error: cannot back up")); \
1505 YYERROR; \
1506 } \
1507while (YYID (0))
1508
1509
1510#define YYTERROR 1
1511#define YYERRCODE 256
1512
1513
1514/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
1515 If N is 0, then set CURRENT to the empty location which ends
1516 the previous symbol: RHS[0] (always defined). */
1517
1518#define YYRHSLOC(Rhs, K) ((Rhs)[K])
1519#ifndef YYLLOC_DEFAULT
1520# define YYLLOC_DEFAULT(Current, Rhs, N) \
1521 do \
1522 if (YYID (N)) \
1523 { \
1524 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
1525 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
1526 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
1527 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
1528 } \
1529 else \
1530 { \
1531 (Current).first_line = (Current).last_line = \
1532 YYRHSLOC (Rhs, 0).last_line; \
1533 (Current).first_column = (Current).last_column = \
1534 YYRHSLOC (Rhs, 0).last_column; \
1535 } \
1536 while (YYID (0))
1537#endif
1538
1539
1540/* YY_LOCATION_PRINT -- Print the location on the stream.
1541 This macro was not mandated originally: define only if we know
1542 we won't break user code: when these are the locations we know. */
1543
1544#ifndef YY_LOCATION_PRINT
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04001545# if YYLTYPE_IS_TRIVIAL
John Bauman66b8ab22014-05-06 15:57:45 -04001546# define YY_LOCATION_PRINT(File, Loc) \
1547 fprintf (File, "%d.%d-%d.%d", \
1548 (Loc).first_line, (Loc).first_column, \
1549 (Loc).last_line, (Loc).last_column)
1550# else
1551# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1552# endif
1553#endif
1554
1555
1556/* YYLEX -- calling `yylex' with the right arguments. */
1557
1558#ifdef YYLEX_PARAM
1559# define YYLEX yylex (&yylval, YYLEX_PARAM)
1560#else
1561# define YYLEX yylex (&yylval)
1562#endif
1563
1564/* Enable debugging if requested. */
1565#if YYDEBUG
1566
1567# ifndef YYFPRINTF
1568# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1569# define YYFPRINTF fprintf
1570# endif
1571
1572# define YYDPRINTF(Args) \
1573do { \
1574 if (yydebug) \
1575 YYFPRINTF Args; \
1576} while (YYID (0))
1577
1578# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
1579do { \
1580 if (yydebug) \
1581 { \
1582 YYFPRINTF (stderr, "%s ", Title); \
1583 yy_symbol_print (stderr, \
1584 Type, Value, context); \
1585 YYFPRINTF (stderr, "\n"); \
1586 } \
1587} while (YYID (0))
1588
1589
1590/*--------------------------------.
1591| Print this symbol on YYOUTPUT. |
1592`--------------------------------*/
1593
1594/*ARGSUSED*/
1595#if (defined __STDC__ || defined __C99__FUNC__ \
1596 || defined __cplusplus || defined _MSC_VER)
1597static void
1598yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, TParseContext* context)
1599#else
1600static void
1601yy_symbol_value_print (yyoutput, yytype, yyvaluep, context)
1602 FILE *yyoutput;
1603 int yytype;
1604 YYSTYPE const * const yyvaluep;
1605 TParseContext* context;
1606#endif
1607{
1608 if (!yyvaluep)
1609 return;
1610 YYUSE (context);
1611# ifdef YYPRINT
1612 if (yytype < YYNTOKENS)
1613 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1614# else
1615 YYUSE (yyoutput);
1616# endif
1617 switch (yytype)
1618 {
1619 default:
1620 break;
1621 }
1622}
1623
1624
1625/*--------------------------------.
1626| Print this symbol on YYOUTPUT. |
1627`--------------------------------*/
1628
1629#if (defined __STDC__ || defined __C99__FUNC__ \
1630 || defined __cplusplus || defined _MSC_VER)
1631static void
1632yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, TParseContext* context)
1633#else
1634static void
1635yy_symbol_print (yyoutput, yytype, yyvaluep, context)
1636 FILE *yyoutput;
1637 int yytype;
1638 YYSTYPE const * const yyvaluep;
1639 TParseContext* context;
1640#endif
1641{
1642 if (yytype < YYNTOKENS)
1643 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1644 else
1645 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1646
1647 yy_symbol_value_print (yyoutput, yytype, yyvaluep, context);
1648 YYFPRINTF (yyoutput, ")");
1649}
1650
1651/*------------------------------------------------------------------.
1652| yy_stack_print -- Print the state stack from its BOTTOM up to its |
1653| TOP (included). |
1654`------------------------------------------------------------------*/
1655
1656#if (defined __STDC__ || defined __C99__FUNC__ \
1657 || defined __cplusplus || defined _MSC_VER)
1658static void
1659yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
1660#else
1661static void
1662yy_stack_print (yybottom, yytop)
1663 yytype_int16 *yybottom;
1664 yytype_int16 *yytop;
1665#endif
1666{
1667 YYFPRINTF (stderr, "Stack now");
1668 for (; yybottom <= yytop; yybottom++)
1669 {
1670 int yybot = *yybottom;
1671 YYFPRINTF (stderr, " %d", yybot);
1672 }
1673 YYFPRINTF (stderr, "\n");
1674}
1675
1676# define YY_STACK_PRINT(Bottom, Top) \
1677do { \
1678 if (yydebug) \
1679 yy_stack_print ((Bottom), (Top)); \
1680} while (YYID (0))
1681
1682
1683/*------------------------------------------------.
1684| Report that the YYRULE is going to be reduced. |
1685`------------------------------------------------*/
1686
1687#if (defined __STDC__ || defined __C99__FUNC__ \
1688 || defined __cplusplus || defined _MSC_VER)
1689static void
1690yy_reduce_print (YYSTYPE *yyvsp, int yyrule, TParseContext* context)
1691#else
1692static void
1693yy_reduce_print (yyvsp, yyrule, context)
1694 YYSTYPE *yyvsp;
1695 int yyrule;
1696 TParseContext* context;
1697#endif
1698{
1699 int yynrhs = yyr2[yyrule];
1700 int yyi;
1701 unsigned long int yylno = yyrline[yyrule];
1702 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1703 yyrule - 1, yylno);
1704 /* The symbols being reduced. */
1705 for (yyi = 0; yyi < yynrhs; yyi++)
1706 {
1707 YYFPRINTF (stderr, " $%d = ", yyi + 1);
1708 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1709 &(yyvsp[(yyi + 1) - (yynrhs)])
1710 , context);
1711 YYFPRINTF (stderr, "\n");
1712 }
1713}
1714
1715# define YY_REDUCE_PRINT(Rule) \
1716do { \
1717 if (yydebug) \
1718 yy_reduce_print (yyvsp, Rule, context); \
1719} while (YYID (0))
1720
1721/* Nonzero means print parse trace. It is left uninitialized so that
1722 multiple parsers can coexist. */
1723int yydebug;
1724#else /* !YYDEBUG */
1725# define YYDPRINTF(Args)
1726# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1727# define YY_STACK_PRINT(Bottom, Top)
1728# define YY_REDUCE_PRINT(Rule)
1729#endif /* !YYDEBUG */
1730
1731
1732/* YYINITDEPTH -- initial size of the parser's stacks. */
1733#ifndef YYINITDEPTH
1734# define YYINITDEPTH 200
1735#endif
1736
1737/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1738 if the built-in stack extension method is used).
1739
1740 Do not make this value too large; the results are undefined if
1741 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1742 evaluated with infinite-precision integer arithmetic. */
1743
1744#ifndef YYMAXDEPTH
1745# define YYMAXDEPTH 10000
1746#endif
1747
1748
1749
1750#if YYERROR_VERBOSE
1751
1752# ifndef yystrlen
1753# if defined __GLIBC__ && defined _STRING_H
1754# define yystrlen strlen
1755# else
1756/* Return the length of YYSTR. */
1757#if (defined __STDC__ || defined __C99__FUNC__ \
1758 || defined __cplusplus || defined _MSC_VER)
1759static YYSIZE_T
1760yystrlen (const char *yystr)
1761#else
1762static YYSIZE_T
1763yystrlen (yystr)
1764 const char *yystr;
1765#endif
1766{
1767 YYSIZE_T yylen;
1768 for (yylen = 0; yystr[yylen]; yylen++)
1769 continue;
1770 return yylen;
1771}
1772# endif
1773# endif
1774
1775# ifndef yystpcpy
1776# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1777# define yystpcpy stpcpy
1778# else
1779/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1780 YYDEST. */
1781#if (defined __STDC__ || defined __C99__FUNC__ \
1782 || defined __cplusplus || defined _MSC_VER)
1783static char *
1784yystpcpy (char *yydest, const char *yysrc)
1785#else
1786static char *
1787yystpcpy (yydest, yysrc)
1788 char *yydest;
1789 const char *yysrc;
1790#endif
1791{
1792 char *yyd = yydest;
1793 const char *yys = yysrc;
1794
1795 while ((*yyd++ = *yys++) != '\0')
1796 continue;
1797
1798 return yyd - 1;
1799}
1800# endif
1801# endif
1802
1803# ifndef yytnamerr
1804/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1805 quotes and backslashes, so that it's suitable for yyerror. The
1806 heuristic is that double-quoting is unnecessary unless the string
1807 contains an apostrophe, a comma, or backslash (other than
1808 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1809 null, do not copy; instead, return the length of what the result
1810 would have been. */
1811static YYSIZE_T
1812yytnamerr (char *yyres, const char *yystr)
1813{
1814 if (*yystr == '"')
1815 {
1816 YYSIZE_T yyn = 0;
1817 char const *yyp = yystr;
1818
1819 for (;;)
1820 switch (*++yyp)
1821 {
1822 case '\'':
1823 case ',':
1824 goto do_not_strip_quotes;
1825
1826 case '\\':
1827 if (*++yyp != '\\')
1828 goto do_not_strip_quotes;
1829 /* Fall through. */
1830 default:
1831 if (yyres)
1832 yyres[yyn] = *yyp;
1833 yyn++;
1834 break;
1835
1836 case '"':
1837 if (yyres)
1838 yyres[yyn] = '\0';
1839 return yyn;
1840 }
1841 do_not_strip_quotes: ;
1842 }
1843
1844 if (! yyres)
1845 return yystrlen (yystr);
1846
1847 return yystpcpy (yyres, yystr) - yyres;
1848}
1849# endif
1850
1851/* Copy into YYRESULT an error message about the unexpected token
1852 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1853 including the terminating null byte. If YYRESULT is null, do not
1854 copy anything; just return the number of bytes that would be
1855 copied. As a special case, return 0 if an ordinary "syntax error"
1856 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1857 size calculation. */
1858static YYSIZE_T
1859yysyntax_error (char *yyresult, int yystate, int yychar)
1860{
1861 int yyn = yypact[yystate];
1862
1863 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1864 return 0;
1865 else
1866 {
1867 int yytype = YYTRANSLATE (yychar);
1868 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1869 YYSIZE_T yysize = yysize0;
1870 YYSIZE_T yysize1;
1871 int yysize_overflow = 0;
1872 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1873 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1874 int yyx;
1875
1876# if 0
1877 /* This is so xgettext sees the translatable formats that are
1878 constructed on the fly. */
1879 YY_("syntax error, unexpected %s");
1880 YY_("syntax error, unexpected %s, expecting %s");
1881 YY_("syntax error, unexpected %s, expecting %s or %s");
1882 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1883 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1884# endif
1885 char *yyfmt;
1886 char const *yyf;
1887 static char const yyunexpected[] = "syntax error, unexpected %s";
1888 static char const yyexpecting[] = ", expecting %s";
1889 static char const yyor[] = " or %s";
1890 char yyformat[sizeof yyunexpected
1891 + sizeof yyexpecting - 1
1892 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1893 * (sizeof yyor - 1))];
1894 char const *yyprefix = yyexpecting;
1895
1896 /* Start YYX at -YYN if negative to avoid negative indexes in
1897 YYCHECK. */
1898 int yyxbegin = yyn < 0 ? -yyn : 0;
1899
1900 /* Stay within bounds of both yycheck and yytname. */
1901 int yychecklim = YYLAST - yyn + 1;
1902 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1903 int yycount = 1;
1904
1905 yyarg[0] = yytname[yytype];
1906 yyfmt = yystpcpy (yyformat, yyunexpected);
1907
1908 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1909 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1910 {
1911 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1912 {
1913 yycount = 1;
1914 yysize = yysize0;
1915 yyformat[sizeof yyunexpected - 1] = '\0';
1916 break;
1917 }
1918 yyarg[yycount++] = yytname[yyx];
1919 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1920 yysize_overflow |= (yysize1 < yysize);
1921 yysize = yysize1;
1922 yyfmt = yystpcpy (yyfmt, yyprefix);
1923 yyprefix = yyor;
1924 }
1925
1926 yyf = YY_(yyformat);
1927 yysize1 = yysize + yystrlen (yyf);
1928 yysize_overflow |= (yysize1 < yysize);
1929 yysize = yysize1;
1930
1931 if (yysize_overflow)
1932 return YYSIZE_MAXIMUM;
1933
1934 if (yyresult)
1935 {
1936 /* Avoid sprintf, as that infringes on the user's name space.
1937 Don't have undefined behavior even if the translation
1938 produced a string with the wrong number of "%s"s. */
1939 char *yyp = yyresult;
1940 int yyi = 0;
1941 while ((*yyp = *yyf) != '\0')
1942 {
1943 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1944 {
1945 yyp += yytnamerr (yyp, yyarg[yyi++]);
1946 yyf += 2;
1947 }
1948 else
1949 {
1950 yyp++;
1951 yyf++;
1952 }
1953 }
1954 }
1955 return yysize;
1956 }
1957}
1958#endif /* YYERROR_VERBOSE */
1959
1960
1961/*-----------------------------------------------.
1962| Release the memory associated to this symbol. |
1963`-----------------------------------------------*/
1964
1965/*ARGSUSED*/
1966#if (defined __STDC__ || defined __C99__FUNC__ \
1967 || defined __cplusplus || defined _MSC_VER)
1968static void
1969yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, TParseContext* context)
1970#else
1971static void
1972yydestruct (yymsg, yytype, yyvaluep, context)
1973 const char *yymsg;
1974 int yytype;
1975 YYSTYPE *yyvaluep;
1976 TParseContext* context;
1977#endif
1978{
1979 YYUSE (yyvaluep);
1980 YYUSE (context);
1981
1982 if (!yymsg)
1983 yymsg = "Deleting";
1984 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1985
1986 switch (yytype)
1987 {
1988
1989 default:
1990 break;
1991 }
1992}
1993
1994/* Prevent warnings from -Wmissing-prototypes. */
1995#ifdef YYPARSE_PARAM
1996#if defined __STDC__ || defined __cplusplus
1997int yyparse (void *YYPARSE_PARAM);
1998#else
1999int yyparse ();
2000#endif
2001#else /* ! YYPARSE_PARAM */
2002#if defined __STDC__ || defined __cplusplus
2003int yyparse (TParseContext* context);
2004#else
2005int yyparse ();
2006#endif
2007#endif /* ! YYPARSE_PARAM */
2008
2009
2010
2011
2012
2013/*-------------------------.
2014| yyparse or yypush_parse. |
2015`-------------------------*/
2016
2017#ifdef YYPARSE_PARAM
2018#if (defined __STDC__ || defined __C99__FUNC__ \
2019 || defined __cplusplus || defined _MSC_VER)
2020int
2021yyparse (void *YYPARSE_PARAM)
2022#else
2023int
2024yyparse (YYPARSE_PARAM)
2025 void *YYPARSE_PARAM;
2026#endif
2027#else /* ! YYPARSE_PARAM */
2028#if (defined __STDC__ || defined __C99__FUNC__ \
2029 || defined __cplusplus || defined _MSC_VER)
2030int
2031yyparse (TParseContext* context)
2032#else
2033int
2034yyparse (context)
2035 TParseContext* context;
2036#endif
2037#endif
2038{
2039/* The lookahead symbol. */
2040int yychar;
2041
2042/* The semantic value of the lookahead symbol. */
2043YYSTYPE yylval;
2044
2045 /* Number of syntax errors so far. */
2046 int yynerrs;
2047
2048 int yystate;
2049 /* Number of tokens to shift before error messages enabled. */
2050 int yyerrstatus;
2051
2052 /* The stacks and their tools:
2053 `yyss': related to states.
2054 `yyvs': related to semantic values.
2055
2056 Refer to the stacks thru separate pointers, to allow yyoverflow
2057 to reallocate them elsewhere. */
2058
2059 /* The state stack. */
2060 yytype_int16 yyssa[YYINITDEPTH];
2061 yytype_int16 *yyss;
2062 yytype_int16 *yyssp;
2063
2064 /* The semantic value stack. */
2065 YYSTYPE yyvsa[YYINITDEPTH];
2066 YYSTYPE *yyvs;
2067 YYSTYPE *yyvsp;
2068
2069 YYSIZE_T yystacksize;
2070
2071 int yyn;
2072 int yyresult;
2073 /* Lookahead token as an internal (translated) token number. */
2074 int yytoken;
2075 /* The variables used to return semantic value and location from the
2076 action routines. */
2077 YYSTYPE yyval;
2078
2079#if YYERROR_VERBOSE
2080 /* Buffer for error messages, and its allocated size. */
2081 char yymsgbuf[128];
2082 char *yymsg = yymsgbuf;
2083 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
2084#endif
2085
2086#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
2087
2088 /* The number of symbols on the RHS of the reduced rule.
2089 Keep to zero when no symbol should be popped. */
2090 int yylen = 0;
2091
2092 yytoken = 0;
2093 yyss = yyssa;
2094 yyvs = yyvsa;
2095 yystacksize = YYINITDEPTH;
2096
2097 YYDPRINTF ((stderr, "Starting parse\n"));
2098
2099 yystate = 0;
2100 yyerrstatus = 0;
2101 yynerrs = 0;
2102 yychar = YYEMPTY; /* Cause a token to be read. */
2103
2104 /* Initialize stack pointers.
2105 Waste one element of value and location stack
2106 so that they stay on the same level as the state stack.
2107 The wasted elements are never initialized. */
2108 yyssp = yyss;
2109 yyvsp = yyvs;
2110
2111 goto yysetstate;
2112
2113/*------------------------------------------------------------.
2114| yynewstate -- Push a new state, which is found in yystate. |
2115`------------------------------------------------------------*/
2116 yynewstate:
2117 /* In all cases, when you get here, the value and location stacks
2118 have just been pushed. So pushing a state here evens the stacks. */
2119 yyssp++;
2120
2121 yysetstate:
2122 *yyssp = yystate;
2123
2124 if (yyss + yystacksize - 1 <= yyssp)
2125 {
2126 /* Get the current used size of the three stacks, in elements. */
2127 YYSIZE_T yysize = yyssp - yyss + 1;
2128
2129#ifdef yyoverflow
2130 {
2131 /* Give user a chance to reallocate the stack. Use copies of
2132 these so that the &'s don't force the real ones into
2133 memory. */
2134 YYSTYPE *yyvs1 = yyvs;
2135 yytype_int16 *yyss1 = yyss;
2136
2137 /* Each stack pointer address is followed by the size of the
2138 data in use in that stack, in bytes. This used to be a
2139 conditional around just the two extra args, but that might
2140 be undefined if yyoverflow is a macro. */
2141 yyoverflow (YY_("memory exhausted"),
2142 &yyss1, yysize * sizeof (*yyssp),
2143 &yyvs1, yysize * sizeof (*yyvsp),
2144 &yystacksize);
2145
2146 yyss = yyss1;
2147 yyvs = yyvs1;
2148 }
2149#else /* no yyoverflow */
2150# ifndef YYSTACK_RELOCATE
2151 goto yyexhaustedlab;
2152# else
2153 /* Extend the stack our own way. */
2154 if (YYMAXDEPTH <= yystacksize)
2155 goto yyexhaustedlab;
2156 yystacksize *= 2;
2157 if (YYMAXDEPTH < yystacksize)
2158 yystacksize = YYMAXDEPTH;
2159
2160 {
2161 yytype_int16 *yyss1 = yyss;
2162 union yyalloc *yyptr =
2163 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
2164 if (! yyptr)
2165 goto yyexhaustedlab;
2166 YYSTACK_RELOCATE (yyss_alloc, yyss);
2167 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
2168# undef YYSTACK_RELOCATE
2169 if (yyss1 != yyssa)
2170 YYSTACK_FREE (yyss1);
2171 }
2172# endif
2173#endif /* no yyoverflow */
2174
2175 yyssp = yyss + yysize - 1;
2176 yyvsp = yyvs + yysize - 1;
2177
2178 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
2179 (unsigned long int) yystacksize));
2180
2181 if (yyss + yystacksize - 1 <= yyssp)
2182 YYABORT;
2183 }
2184
2185 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
2186
2187 if (yystate == YYFINAL)
2188 YYACCEPT;
2189
2190 goto yybackup;
2191
2192/*-----------.
2193| yybackup. |
2194`-----------*/
2195yybackup:
2196
2197 /* Do appropriate processing given the current state. Read a
2198 lookahead token if we need one and don't already have one. */
2199
2200 /* First try to decide what to do without reference to lookahead token. */
2201 yyn = yypact[yystate];
2202 if (yyn == YYPACT_NINF)
2203 goto yydefault;
2204
2205 /* Not known => get a lookahead token if don't already have one. */
2206
2207 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
2208 if (yychar == YYEMPTY)
2209 {
2210 YYDPRINTF ((stderr, "Reading a token: "));
2211 yychar = YYLEX;
2212 }
2213
2214 if (yychar <= YYEOF)
2215 {
2216 yychar = yytoken = YYEOF;
2217 YYDPRINTF ((stderr, "Now at end of input.\n"));
2218 }
2219 else
2220 {
2221 yytoken = YYTRANSLATE (yychar);
2222 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
2223 }
2224
2225 /* If the proper action on seeing token YYTOKEN is to reduce or to
2226 detect an error, take that action. */
2227 yyn += yytoken;
2228 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
2229 goto yydefault;
2230 yyn = yytable[yyn];
2231 if (yyn <= 0)
2232 {
2233 if (yyn == 0 || yyn == YYTABLE_NINF)
2234 goto yyerrlab;
2235 yyn = -yyn;
2236 goto yyreduce;
2237 }
2238
2239 /* Count tokens shifted since error; after three, turn off error
2240 status. */
2241 if (yyerrstatus)
2242 yyerrstatus--;
2243
2244 /* Shift the lookahead token. */
2245 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
2246
2247 /* Discard the shifted token. */
2248 yychar = YYEMPTY;
2249
2250 yystate = yyn;
2251 *++yyvsp = yylval;
2252
2253 goto yynewstate;
2254
2255
2256/*-----------------------------------------------------------.
2257| yydefault -- do the default action for the current state. |
2258`-----------------------------------------------------------*/
2259yydefault:
2260 yyn = yydefact[yystate];
2261 if (yyn == 0)
2262 goto yyerrlab;
2263 goto yyreduce;
2264
2265
2266/*-----------------------------.
2267| yyreduce -- Do a reduction. |
2268`-----------------------------*/
2269yyreduce:
2270 /* yyn is the number of a rule to reduce with. */
2271 yylen = yyr2[yyn];
2272
2273 /* If YYLEN is nonzero, implement the default value of the action:
2274 `$$ = $1'.
2275
2276 Otherwise, the following line sets YYVAL to garbage.
2277 This behavior is undocumented and Bison
2278 users should not rely upon it. Assigning to YYVAL
2279 unconditionally makes the parser a bit smaller, and it avoids a
2280 GCC warning that YYVAL may be used uninitialized. */
2281 yyval = yyvsp[1-yylen];
2282
2283
2284 YY_REDUCE_PRINT (yyn);
2285 switch (yyn)
2286 {
2287 case 2:
2288
2289 {
2290 // The symbol table search was done in the lexical phase
2291 const TSymbol* symbol = (yyvsp[(1) - (1)].lex).symbol;
2292 const TVariable* variable;
2293 if (symbol == 0) {
2294 context->error((yyvsp[(1) - (1)].lex).line, "undeclared identifier", (yyvsp[(1) - (1)].lex).string->c_str());
2295 context->recover();
2296 TType type(EbtFloat, EbpUndefined);
2297 TVariable* fakeVariable = new TVariable((yyvsp[(1) - (1)].lex).string, type);
Nicolas Capensd603ecd2015-02-18 14:52:21 -05002298 context->symbolTable.declare(*fakeVariable);
John Bauman66b8ab22014-05-06 15:57:45 -04002299 variable = fakeVariable;
2300 } else {
2301 // This identifier can only be a variable type symbol
2302 if (! symbol->isVariable()) {
2303 context->error((yyvsp[(1) - (1)].lex).line, "variable expected", (yyvsp[(1) - (1)].lex).string->c_str());
2304 context->recover();
2305 }
2306 variable = static_cast<const TVariable*>(symbol);
2307 }
2308
2309 // don't delete $1.string, it's used by error recovery, and the pool
2310 // pop will reclaim the memory
2311
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002312 if (variable->getType().getQualifier() == EvqConstExpr ) {
John Bauman66b8ab22014-05-06 15:57:45 -04002313 ConstantUnion* constArray = variable->getConstPointer();
2314 TType t(variable->getType());
2315 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(constArray, t, (yyvsp[(1) - (1)].lex).line);
2316 } else
2317 (yyval.interm.intermTypedNode) = context->intermediate.addSymbol(variable->getUniqueId(),
2318 variable->getName(),
2319 variable->getType(), (yyvsp[(1) - (1)].lex).line);
2320 }
2321 break;
2322
2323 case 3:
2324
2325 {
2326 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
2327 }
2328 break;
2329
2330 case 4:
2331
2332 {
John Bauman66b8ab22014-05-06 15:57:45 -04002333 ConstantUnion *unionArray = new ConstantUnion[1];
2334 unionArray->setIConst((yyvsp[(1) - (1)].lex).i);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002335 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConstExpr), (yyvsp[(1) - (1)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002336 }
2337 break;
2338
2339 case 5:
2340
2341 {
2342 ConstantUnion *unionArray = new ConstantUnion[1];
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002343 unionArray->setUConst((yyvsp[(1) - (1)].lex).u);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002344 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtUInt, EbpUndefined, EvqConstExpr), (yyvsp[(1) - (1)].lex).line);
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002345 }
2346 break;
2347
2348 case 6:
2349
2350 {
2351 ConstantUnion *unionArray = new ConstantUnion[1];
John Bauman66b8ab22014-05-06 15:57:45 -04002352 unionArray->setFConst((yyvsp[(1) - (1)].lex).f);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002353 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConstExpr), (yyvsp[(1) - (1)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002354 }
2355 break;
2356
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002357 case 7:
John Bauman66b8ab22014-05-06 15:57:45 -04002358
2359 {
2360 ConstantUnion *unionArray = new ConstantUnion[1];
2361 unionArray->setBConst((yyvsp[(1) - (1)].lex).b);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002362 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConstExpr), (yyvsp[(1) - (1)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002363 }
2364 break;
2365
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002366 case 8:
John Bauman66b8ab22014-05-06 15:57:45 -04002367
2368 {
2369 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (3)].interm.intermTypedNode);
2370 }
2371 break;
2372
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002373 case 9:
John Bauman66b8ab22014-05-06 15:57:45 -04002374
2375 {
2376 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
2377 }
2378 break;
2379
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002380 case 10:
John Bauman66b8ab22014-05-06 15:57:45 -04002381
2382 {
2383 if (!(yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isVector()) {
2384 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode())
2385 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());
2386 else
2387 context->error((yyvsp[(2) - (4)].lex).line, " left of '[' is not of type array, matrix, or vector ", "expression");
2388 context->recover();
2389 }
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002390 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConstExpr && (yyvsp[(3) - (4)].interm.intermTypedNode)->getQualifier() == EvqConstExpr) {
John Bauman66b8ab22014-05-06 15:57:45 -04002391 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) { // constant folding for arrays
Nicolas Capens198529d2015-02-10 13:54:19 -05002392 (yyval.interm.intermTypedNode) = context->addConstArrayNode((yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0), (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002393 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector()) { // constant folding for vectors
2394 TVectorFields fields;
2395 fields.num = 1;
Nicolas Capens198529d2015-02-10 13:54:19 -05002396 fields.offsets[0] = (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0); // need to do it this way because v.xy sends fields integer array
John Bauman66b8ab22014-05-06 15:57:45 -04002397 (yyval.interm.intermTypedNode) = context->addConstVectorNode(fields, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2398 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix()) { // constant folding for matrices
Nicolas Capens198529d2015-02-10 13:54:19 -05002399 (yyval.interm.intermTypedNode) = context->addConstMatrixNode((yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0), (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002400 }
2401 } else {
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002402 if ((yyvsp[(3) - (4)].interm.intermTypedNode)->getQualifier() == EvqConstExpr) {
Nicolas Capens198529d2015-02-10 13:54:19 -05002403 if (((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector() || (yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix()) && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getNominalSize() <= (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0) && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() ) {
John Bauman66b8ab22014-05-06 15:57:45 -04002404 std::stringstream extraInfoStream;
Nicolas Capens198529d2015-02-10 13:54:19 -05002405 extraInfoStream << "field selection out of range '" << (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0) << "'";
John Bauman66b8ab22014-05-06 15:57:45 -04002406 std::string extraInfo = extraInfoStream.str();
2407 context->error((yyvsp[(2) - (4)].lex).line, "", "[", extraInfo.c_str());
2408 context->recover();
2409 } else {
2410 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) {
2411 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize() == 0) {
Nicolas Capens198529d2015-02-10 13:54:19 -05002412 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getMaxArraySize() <= (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0)) {
2413 if (context->arraySetMaxSize((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getTypePointer(), (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0), true, (yyvsp[(2) - (4)].lex).line))
John Bauman66b8ab22014-05-06 15:57:45 -04002414 context->recover();
2415 } else {
2416 if (context->arraySetMaxSize((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getTypePointer(), 0, false, (yyvsp[(2) - (4)].lex).line))
2417 context->recover();
2418 }
Nicolas Capens198529d2015-02-10 13:54:19 -05002419 } else if ( (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0) >= (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize()) {
John Bauman66b8ab22014-05-06 15:57:45 -04002420 std::stringstream extraInfoStream;
Nicolas Capens198529d2015-02-10 13:54:19 -05002421 extraInfoStream << "array index out of range '" << (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0) << "'";
John Bauman66b8ab22014-05-06 15:57:45 -04002422 std::string extraInfo = extraInfoStream.str();
2423 context->error((yyvsp[(2) - (4)].lex).line, "", "[", extraInfo.c_str());
2424 context->recover();
2425 }
2426 }
2427 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(3) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2428 }
2429 } else {
2430 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize() == 0) {
2431 context->error((yyvsp[(2) - (4)].lex).line, "", "[", "array must be redeclared with a size before being indexed with a variable");
2432 context->recover();
2433 }
2434
2435 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexIndirect, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(3) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2436 }
2437 }
2438 if ((yyval.interm.intermTypedNode) == 0) {
2439 ConstantUnion *unionArray = new ConstantUnion[1];
2440 unionArray->setFConst(0.0f);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002441 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpHigh, EvqConstExpr), (yyvsp[(2) - (4)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002442 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) {
2443 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getStruct())
2444 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getStruct(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getTypeName()));
2445 else
Alexis Hetub14178b2015-04-13 13:23:20 -04002446 (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)->getSecondarySize()));
John Bauman66b8ab22014-05-06 15:57:45 -04002447
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002448 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConstExpr)
2449 (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConstExpr);
2450 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConstExpr)
2451 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqConstExpr, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize()));
John Bauman66b8ab22014-05-06 15:57:45 -04002452 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix())
2453 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize()));
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002454 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConstExpr)
2455 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqConstExpr));
John Bauman66b8ab22014-05-06 15:57:45 -04002456 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector())
2457 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary));
2458 else
2459 (yyval.interm.intermTypedNode)->setType((yyvsp[(1) - (4)].interm.intermTypedNode)->getType());
2460 }
2461 break;
2462
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002463 case 11:
John Bauman66b8ab22014-05-06 15:57:45 -04002464
2465 {
2466 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
2467 }
2468 break;
2469
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002470 case 12:
John Bauman66b8ab22014-05-06 15:57:45 -04002471
2472 {
2473 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isArray()) {
2474 context->error((yyvsp[(3) - (3)].lex).line, "cannot apply dot operator to an array", ".");
2475 context->recover();
2476 }
2477
2478 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isVector()) {
2479 TVectorFields fields;
2480 if (! context->parseVectorFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yyvsp[(3) - (3)].lex).line)) {
2481 fields.num = 1;
2482 fields.offsets[0] = 0;
2483 context->recover();
2484 }
2485
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002486 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConstExpr) { // constant folding for vector fields
John Bauman66b8ab22014-05-06 15:57:45 -04002487 (yyval.interm.intermTypedNode) = context->addConstVectorNode(fields, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].lex).line);
2488 if ((yyval.interm.intermTypedNode) == 0) {
2489 context->recover();
2490 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2491 }
2492 else
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002493 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(), EvqConstExpr, (int) (*(yyvsp[(3) - (3)].lex).string).size()));
John Bauman66b8ab22014-05-06 15:57:45 -04002494 } else {
2495 TString vectorString = *(yyvsp[(3) - (3)].lex).string;
2496 TIntermTyped* index = context->intermediate.addSwizzle(fields, (yyvsp[(3) - (3)].lex).line);
2497 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpVectorSwizzle, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2498 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (int) vectorString.size()));
2499 }
2500 } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isMatrix()) {
2501 TMatrixFields fields;
2502 if (! context->parseMatrixFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yyvsp[(3) - (3)].lex).line)) {
2503 fields.wholeRow = false;
2504 fields.wholeCol = false;
2505 fields.row = 0;
2506 fields.col = 0;
2507 context->recover();
2508 }
2509
2510 if (fields.wholeRow || fields.wholeCol) {
2511 context->error((yyvsp[(2) - (3)].lex).line, " non-scalar fields not implemented yet", ".");
2512 context->recover();
2513 ConstantUnion *unionArray = new ConstantUnion[1];
2514 unionArray->setIConst(0);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002515 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConstExpr), (yyvsp[(3) - (3)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002516 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2517 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(),EvqTemporary, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize()));
2518 } else {
2519 ConstantUnion *unionArray = new ConstantUnion[1];
2520 unionArray->setIConst(fields.col * (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize() + fields.row);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002521 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConstExpr), (yyvsp[(3) - (3)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002522 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2523 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision()));
2524 }
2525 } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType() == EbtStruct) {
2526 bool fieldFound = false;
2527 const TTypeList* fields = (yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getStruct();
2528 if (fields == 0) {
2529 context->error((yyvsp[(2) - (3)].lex).line, "structure has no fields", "Internal Error");
2530 context->recover();
2531 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2532 } else {
2533 unsigned int i;
2534 for (i = 0; i < fields->size(); ++i) {
2535 if ((*fields)[i].type->getFieldName() == *(yyvsp[(3) - (3)].lex).string) {
2536 fieldFound = true;
2537 break;
2538 }
2539 }
2540 if (fieldFound) {
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002541 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConstExpr) {
John Bauman66b8ab22014-05-06 15:57:45 -04002542 (yyval.interm.intermTypedNode) = context->addConstStruct(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
2543 if ((yyval.interm.intermTypedNode) == 0) {
2544 context->recover();
2545 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2546 }
2547 else {
2548 (yyval.interm.intermTypedNode)->setType(*(*fields)[i].type);
2549 // change the qualifier of the return type, not of the structure field
2550 // as the structure definition is shared between various structures.
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002551 (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConstExpr);
John Bauman66b8ab22014-05-06 15:57:45 -04002552 }
2553 } else {
2554 ConstantUnion *unionArray = new ConstantUnion[1];
2555 unionArray->setIConst(i);
2556 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, *(*fields)[i].type, (yyvsp[(3) - (3)].lex).line);
2557 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirectStruct, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2558 (yyval.interm.intermTypedNode)->setType(*(*fields)[i].type);
2559 }
2560 } else {
2561 context->error((yyvsp[(2) - (3)].lex).line, " no such field in structure", (yyvsp[(3) - (3)].lex).string->c_str());
2562 context->recover();
2563 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2564 }
2565 }
2566 } else {
2567 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());
2568 context->recover();
2569 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2570 }
2571 // don't delete $3.string, it's from the pool
2572 }
2573 break;
2574
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002575 case 13:
John Bauman66b8ab22014-05-06 15:57:45 -04002576
2577 {
2578 if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode)))
2579 context->recover();
John Baumand4ae8632014-05-06 16:18:33 -04002580 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostIncrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002581 if ((yyval.interm.intermTypedNode) == 0) {
2582 context->unaryOpError((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
2583 context->recover();
2584 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode);
2585 }
2586 }
2587 break;
2588
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002589 case 14:
John Bauman66b8ab22014-05-06 15:57:45 -04002590
2591 {
2592 if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode)))
2593 context->recover();
John Baumand4ae8632014-05-06 16:18:33 -04002594 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostDecrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002595 if ((yyval.interm.intermTypedNode) == 0) {
2596 context->unaryOpError((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
2597 context->recover();
2598 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode);
2599 }
2600 }
2601 break;
2602
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002603 case 15:
John Bauman66b8ab22014-05-06 15:57:45 -04002604
2605 {
2606 if (context->integerErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode), "[]"))
2607 context->recover();
2608 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
2609 }
2610 break;
2611
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002612 case 16:
John Bauman66b8ab22014-05-06 15:57:45 -04002613
2614 {
2615 TFunction* fnCall = (yyvsp[(1) - (1)].interm).function;
2616 TOperator op = fnCall->getBuiltInOp();
2617
2618 if (op != EOpNull)
2619 {
2620 //
2621 // Then this should be a constructor.
2622 // Don't go through the symbol table for constructors.
2623 // Their parameters will be verified algorithmically.
2624 //
2625 TType type(EbtVoid, EbpUndefined); // use this to get the type back
2626 if (context->constructorErrorCheck((yyvsp[(1) - (1)].interm).line, (yyvsp[(1) - (1)].interm).intermNode, *fnCall, op, &type)) {
2627 (yyval.interm.intermTypedNode) = 0;
2628 } else {
2629 //
2630 // It's a constructor, of type 'type'.
2631 //
2632 (yyval.interm.intermTypedNode) = context->addConstructor((yyvsp[(1) - (1)].interm).intermNode, &type, op, fnCall, (yyvsp[(1) - (1)].interm).line);
2633 }
2634
2635 if ((yyval.interm.intermTypedNode) == 0) {
2636 context->recover();
2637 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator(0, op, (yyvsp[(1) - (1)].interm).line);
2638 }
2639 (yyval.interm.intermTypedNode)->setType(type);
2640 } else {
2641 //
2642 // Not a constructor. Find it in the symbol table.
2643 //
2644 const TFunction* fnCandidate;
2645 bool builtIn;
2646 fnCandidate = context->findFunction((yyvsp[(1) - (1)].interm).line, fnCall, &builtIn);
2647 if (fnCandidate) {
2648 //
2649 // A declared function.
2650 //
2651 if (builtIn && !fnCandidate->getExtension().empty() &&
2652 context->extensionErrorCheck((yyvsp[(1) - (1)].interm).line, fnCandidate->getExtension())) {
2653 context->recover();
2654 }
2655 op = fnCandidate->getBuiltInOp();
2656 if (builtIn && op != EOpNull) {
2657 //
2658 // A function call mapped to a built-in operation.
2659 //
2660 if (fnCandidate->getParamCount() == 1) {
2661 //
2662 // Treat it like a built-in unary operator.
2663 //
John Baumand4ae8632014-05-06 16:18:33 -04002664 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(op, (yyvsp[(1) - (1)].interm).intermNode, 0);
John Bauman66b8ab22014-05-06 15:57:45 -04002665 if ((yyval.interm.intermTypedNode) == 0) {
2666 std::stringstream extraInfoStream;
2667 extraInfoStream << "built in unary operator function. Type: " << static_cast<TIntermTyped*>((yyvsp[(1) - (1)].interm).intermNode)->getCompleteString();
2668 std::string extraInfo = extraInfoStream.str();
2669 context->error((yyvsp[(1) - (1)].interm).intermNode->getLine(), " wrong operand type", "Internal Error", extraInfo.c_str());
2670 YYERROR;
2671 }
2672 } else {
2673 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, op, (yyvsp[(1) - (1)].interm).line);
2674 }
2675 } else {
2676 // This is a real function call
2677
2678 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, EOpFunctionCall, (yyvsp[(1) - (1)].interm).line);
2679 (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType());
2680
2681 // this is how we know whether the given function is a builtIn function or a user defined function
2682 // if builtIn == false, it's a userDefined -> could be an overloaded builtIn function also
2683 // if builtIn == true, it's definitely a builtIn function with EOpNull
2684 if (!builtIn)
2685 (yyval.interm.intermTypedNode)->getAsAggregate()->setUserDefined();
2686 (yyval.interm.intermTypedNode)->getAsAggregate()->setName(fnCandidate->getMangledName());
2687
2688 TQualifier qual;
2689 for (int i = 0; i < fnCandidate->getParamCount(); ++i) {
2690 qual = fnCandidate->getParam(i).type->getQualifier();
2691 if (qual == EvqOut || qual == EvqInOut) {
2692 if (context->lValueErrorCheck((yyval.interm.intermTypedNode)->getLine(), "assign", (yyval.interm.intermTypedNode)->getAsAggregate()->getSequence()[i]->getAsTyped())) {
2693 context->error((yyvsp[(1) - (1)].interm).intermNode->getLine(), "Constant value cannot be passed for 'out' or 'inout' parameters.", "Error");
2694 context->recover();
2695 }
2696 }
2697 }
2698 }
2699 (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType());
2700 } else {
2701 // error message was put out by PaFindFunction()
2702 // Put on a dummy node for error recovery
2703 ConstantUnion *unionArray = new ConstantUnion[1];
2704 unionArray->setFConst(0.0f);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002705 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConstExpr), (yyvsp[(1) - (1)].interm).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002706 context->recover();
2707 }
2708 }
2709 delete fnCall;
2710 }
2711 break;
2712
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002713 case 17:
John Bauman66b8ab22014-05-06 15:57:45 -04002714
2715 {
2716 (yyval.interm) = (yyvsp[(1) - (1)].interm);
2717 }
2718 break;
2719
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002720 case 18:
John Bauman66b8ab22014-05-06 15:57:45 -04002721
2722 {
2723 context->error((yyvsp[(3) - (3)].interm).line, "methods are not supported", "");
2724 context->recover();
2725 (yyval.interm) = (yyvsp[(3) - (3)].interm);
2726 }
2727 break;
2728
John Bauman66b8ab22014-05-06 15:57:45 -04002729 case 19:
2730
2731 {
2732 (yyval.interm) = (yyvsp[(1) - (2)].interm);
2733 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
2734 }
2735 break;
2736
2737 case 20:
2738
2739 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002740 (yyval.interm) = (yyvsp[(1) - (2)].interm);
2741 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
2742 }
2743 break;
2744
2745 case 21:
2746
2747 {
John Bauman66b8ab22014-05-06 15:57:45 -04002748 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
2749 (yyval.interm).intermNode = 0;
2750 }
2751 break;
2752
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002753 case 22:
John Bauman66b8ab22014-05-06 15:57:45 -04002754
2755 {
2756 (yyval.interm).function = (yyvsp[(1) - (1)].interm.function);
2757 (yyval.interm).intermNode = 0;
2758 }
2759 break;
2760
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002761 case 23:
John Bauman66b8ab22014-05-06 15:57:45 -04002762
2763 {
2764 TParameter param = { 0, new TType((yyvsp[(2) - (2)].interm.intermTypedNode)->getType()) };
2765 (yyvsp[(1) - (2)].interm.function)->addParameter(param);
2766 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
2767 (yyval.interm).intermNode = (yyvsp[(2) - (2)].interm.intermTypedNode);
2768 }
2769 break;
2770
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002771 case 24:
John Bauman66b8ab22014-05-06 15:57:45 -04002772
2773 {
2774 TParameter param = { 0, new TType((yyvsp[(3) - (3)].interm.intermTypedNode)->getType()) };
2775 (yyvsp[(1) - (3)].interm).function->addParameter(param);
2776 (yyval.interm).function = (yyvsp[(1) - (3)].interm).function;
2777 (yyval.interm).intermNode = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermNode, (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
2778 }
2779 break;
2780
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002781 case 25:
John Bauman66b8ab22014-05-06 15:57:45 -04002782
2783 {
2784 (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
2785 }
2786 break;
2787
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002788 case 26:
John Bauman66b8ab22014-05-06 15:57:45 -04002789
2790 {
2791 //
2792 // Constructor
2793 //
2794 TOperator op = EOpNull;
2795 if ((yyvsp[(1) - (1)].interm.type).userDef) {
2796 op = EOpConstructStruct;
2797 } else {
2798 switch ((yyvsp[(1) - (1)].interm.type).type) {
2799 case EbtFloat:
Alexis Hetub14178b2015-04-13 13:23:20 -04002800 switch((yyvsp[(1) - (1)].interm.type).primarySize) {
2801 case 1:
2802 op = EOpConstructFloat; break;
2803 case 2:
2804 switch((yyvsp[(1) - (1)].interm.type).secondarySize) {
2805 case 1: op = EOpConstructVec2; break;
2806 case 2: op = EOpConstructMat2; break;
2807 case 3: op = EOpConstructMat2x3; break;
2808 case 4: op = EOpConstructMat2x4; break;
John Bauman66b8ab22014-05-06 15:57:45 -04002809 }
Alexis Hetub14178b2015-04-13 13:23:20 -04002810 break;
2811 case 3:
2812 switch((yyvsp[(1) - (1)].interm.type).secondarySize) {
2813 case 1: op = EOpConstructVec3; break;
2814 case 2: op = EOpConstructMat3x2; break;
2815 case 3: op = EOpConstructMat3; break;
2816 case 4: op = EOpConstructMat3x4; break;
John Bauman66b8ab22014-05-06 15:57:45 -04002817 }
Alexis Hetub14178b2015-04-13 13:23:20 -04002818 break;
2819 case 4:
2820 switch((yyvsp[(1) - (1)].interm.type).secondarySize) {
2821 case 1: op = EOpConstructVec4; break;
2822 case 2: op = EOpConstructMat4x2; break;
2823 case 3: op = EOpConstructMat4x3; break;
2824 case 4: op = EOpConstructMat4; break;
2825 }
2826 break;
John Bauman66b8ab22014-05-06 15:57:45 -04002827 }
2828 break;
2829 case EbtInt:
Alexis Hetub14178b2015-04-13 13:23:20 -04002830 switch((yyvsp[(1) - (1)].interm.type).primarySize) {
John Bauman66b8ab22014-05-06 15:57:45 -04002831 case 1: op = EOpConstructInt; break;
2832 case 2: FRAG_VERT_ONLY("ivec2", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec2; break;
2833 case 3: FRAG_VERT_ONLY("ivec3", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec3; break;
2834 case 4: FRAG_VERT_ONLY("ivec4", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec4; break;
2835 }
2836 break;
Alexis Hetub7c46af2015-05-12 15:58:09 -04002837 case EbtUInt:
2838 switch((yyvsp[(1) - (1)].interm.type).primarySize) {
2839 case 1: op = EOpConstructUInt; break;
2840 case 2: FRAG_VERT_ONLY("uvec2", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructUVec2; break;
2841 case 3: FRAG_VERT_ONLY("uvec3", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructUVec3; break;
2842 case 4: FRAG_VERT_ONLY("uvec4", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructUVec4; break;
2843 }
2844 break;
John Bauman66b8ab22014-05-06 15:57:45 -04002845 case EbtBool:
Alexis Hetub14178b2015-04-13 13:23:20 -04002846 switch((yyvsp[(1) - (1)].interm.type).primarySize) {
John Bauman66b8ab22014-05-06 15:57:45 -04002847 case 1: op = EOpConstructBool; break;
2848 case 2: FRAG_VERT_ONLY("bvec2", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec2; break;
2849 case 3: FRAG_VERT_ONLY("bvec3", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec3; break;
2850 case 4: FRAG_VERT_ONLY("bvec4", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec4; break;
2851 }
2852 break;
2853 default: break;
2854 }
2855 if (op == EOpNull) {
2856 context->error((yyvsp[(1) - (1)].interm.type).line, "cannot construct this type", getBasicString((yyvsp[(1) - (1)].interm.type).type));
2857 context->recover();
2858 (yyvsp[(1) - (1)].interm.type).type = EbtFloat;
2859 op = EOpConstructFloat;
2860 }
2861 }
2862 TString tempString;
2863 TType type((yyvsp[(1) - (1)].interm.type));
2864 TFunction *function = new TFunction(&tempString, type, op);
2865 (yyval.interm.function) = function;
2866 }
2867 break;
2868
John Bauman66b8ab22014-05-06 15:57:45 -04002869 case 27:
2870
2871 {
2872 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
2873 context->recover();
2874 TType type(EbtVoid, EbpUndefined);
2875 TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type);
2876 (yyval.interm.function) = function;
2877 }
2878 break;
2879
2880 case 28:
2881
2882 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002883 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
2884 context->recover();
2885 TType type(EbtVoid, EbpUndefined);
2886 TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type);
2887 (yyval.interm.function) = function;
John Bauman66b8ab22014-05-06 15:57:45 -04002888 }
2889 break;
2890
2891 case 29:
2892
2893 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002894 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
2895 }
2896 break;
2897
2898 case 30:
2899
2900 {
John Bauman66b8ab22014-05-06 15:57:45 -04002901 if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)))
2902 context->recover();
John Baumand4ae8632014-05-06 16:18:33 -04002903 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreIncrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002904 if ((yyval.interm.intermTypedNode) == 0) {
2905 context->unaryOpError((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2906 context->recover();
2907 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2908 }
2909 }
2910 break;
2911
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002912 case 31:
John Bauman66b8ab22014-05-06 15:57:45 -04002913
2914 {
2915 if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)))
2916 context->recover();
John Baumand4ae8632014-05-06 16:18:33 -04002917 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreDecrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002918 if ((yyval.interm.intermTypedNode) == 0) {
2919 context->unaryOpError((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2920 context->recover();
2921 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2922 }
2923 }
2924 break;
2925
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002926 case 32:
John Bauman66b8ab22014-05-06 15:57:45 -04002927
2928 {
2929 if ((yyvsp[(1) - (2)].interm).op != EOpNull) {
John Baumand4ae8632014-05-06 16:18:33 -04002930 (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 -04002931 if ((yyval.interm.intermTypedNode) == 0) {
2932 const char* errorOp = "";
2933 switch((yyvsp[(1) - (2)].interm).op) {
2934 case EOpNegative: errorOp = "-"; break;
2935 case EOpLogicalNot: errorOp = "!"; break;
2936 default: break;
2937 }
2938 context->unaryOpError((yyvsp[(1) - (2)].interm).line, errorOp, (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2939 context->recover();
2940 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2941 }
2942 } else
2943 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2944 }
2945 break;
2946
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002947 case 33:
John Bauman66b8ab22014-05-06 15:57:45 -04002948
2949 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNull; }
2950 break;
2951
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002952 case 34:
John Bauman66b8ab22014-05-06 15:57:45 -04002953
2954 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNegative; }
2955 break;
2956
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002957 case 35:
John Bauman66b8ab22014-05-06 15:57:45 -04002958
2959 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpLogicalNot; }
2960 break;
2961
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002962 case 36:
John Bauman66b8ab22014-05-06 15:57:45 -04002963
2964 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
2965 break;
2966
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002967 case 37:
John Bauman66b8ab22014-05-06 15:57:45 -04002968
2969 {
2970 FRAG_VERT_ONLY("*", (yyvsp[(2) - (3)].lex).line);
John Baumand4ae8632014-05-06 16:18:33 -04002971 (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 -04002972 if ((yyval.interm.intermTypedNode) == 0) {
2973 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "*", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2974 context->recover();
2975 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2976 }
2977 }
2978 break;
2979
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002980 case 38:
John Bauman66b8ab22014-05-06 15:57:45 -04002981
2982 {
2983 FRAG_VERT_ONLY("/", (yyvsp[(2) - (3)].lex).line);
John Baumand4ae8632014-05-06 16:18:33 -04002984 (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 -04002985 if ((yyval.interm.intermTypedNode) == 0) {
2986 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "/", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2987 context->recover();
2988 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2989 }
2990 }
2991 break;
2992
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002993 case 39:
John Bauman66b8ab22014-05-06 15:57:45 -04002994
2995 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
2996 break;
2997
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002998 case 40:
John Bauman66b8ab22014-05-06 15:57:45 -04002999
3000 {
John Baumand4ae8632014-05-06 16:18:33 -04003001 (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 -04003002 if ((yyval.interm.intermTypedNode) == 0) {
3003 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "+", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3004 context->recover();
3005 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
3006 }
3007 }
3008 break;
3009
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003010 case 41:
John Bauman66b8ab22014-05-06 15:57:45 -04003011
3012 {
John Baumand4ae8632014-05-06 16:18:33 -04003013 (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 -04003014 if ((yyval.interm.intermTypedNode) == 0) {
3015 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "-", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3016 context->recover();
3017 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
3018 }
3019 }
3020 break;
3021
John Bauman66b8ab22014-05-06 15:57:45 -04003022 case 42:
3023
3024 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
3025 break;
3026
3027 case 43:
3028
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003029 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
3030 break;
3031
3032 case 44:
3033
John Bauman66b8ab22014-05-06 15:57:45 -04003034 {
John Baumand4ae8632014-05-06 16:18:33 -04003035 (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 -04003036 if ((yyval.interm.intermTypedNode) == 0) {
3037 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3038 context->recover();
3039 ConstantUnion *unionArray = new ConstantUnion[1];
3040 unionArray->setBConst(false);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05003041 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConstExpr), (yyvsp[(2) - (3)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003042 }
3043 }
3044 break;
3045
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003046 case 45:
John Bauman66b8ab22014-05-06 15:57:45 -04003047
3048 {
John Baumand4ae8632014-05-06 16:18:33 -04003049 (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 -04003050 if ((yyval.interm.intermTypedNode) == 0) {
3051 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3052 context->recover();
3053 ConstantUnion *unionArray = new ConstantUnion[1];
3054 unionArray->setBConst(false);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05003055 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConstExpr), (yyvsp[(2) - (3)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003056 }
3057 }
3058 break;
3059
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003060 case 46:
John Bauman66b8ab22014-05-06 15:57:45 -04003061
3062 {
John Baumand4ae8632014-05-06 16:18:33 -04003063 (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 -04003064 if ((yyval.interm.intermTypedNode) == 0) {
3065 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3066 context->recover();
3067 ConstantUnion *unionArray = new ConstantUnion[1];
3068 unionArray->setBConst(false);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05003069 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConstExpr), (yyvsp[(2) - (3)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003070 }
3071 }
3072 break;
3073
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003074 case 47:
John Bauman66b8ab22014-05-06 15:57:45 -04003075
3076 {
John Baumand4ae8632014-05-06 16:18:33 -04003077 (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 -04003078 if ((yyval.interm.intermTypedNode) == 0) {
3079 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3080 context->recover();
3081 ConstantUnion *unionArray = new ConstantUnion[1];
3082 unionArray->setBConst(false);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05003083 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConstExpr), (yyvsp[(2) - (3)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003084 }
3085 }
3086 break;
3087
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003088 case 48:
John Bauman66b8ab22014-05-06 15:57:45 -04003089
3090 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
3091 break;
3092
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003093 case 49:
John Bauman66b8ab22014-05-06 15:57:45 -04003094
3095 {
John Baumand4ae8632014-05-06 16:18:33 -04003096 (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 -04003097 if ((yyval.interm.intermTypedNode) == 0) {
3098 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "==", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3099 context->recover();
3100 ConstantUnion *unionArray = new ConstantUnion[1];
3101 unionArray->setBConst(false);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05003102 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConstExpr), (yyvsp[(2) - (3)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003103 }
3104 }
3105 break;
3106
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003107 case 50:
John Bauman66b8ab22014-05-06 15:57:45 -04003108
3109 {
John Baumand4ae8632014-05-06 16:18:33 -04003110 (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 -04003111 if ((yyval.interm.intermTypedNode) == 0) {
3112 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "!=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3113 context->recover();
3114 ConstantUnion *unionArray = new ConstantUnion[1];
3115 unionArray->setBConst(false);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05003116 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConstExpr), (yyvsp[(2) - (3)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003117 }
3118 }
3119 break;
3120
John Bauman66b8ab22014-05-06 15:57:45 -04003121 case 51:
3122
3123 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
3124 break;
3125
3126 case 52:
3127
3128 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
3129 break;
3130
3131 case 53:
3132
3133 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
3134 break;
3135
3136 case 54:
3137
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003138 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
3139 break;
3140
3141 case 55:
3142
John Bauman66b8ab22014-05-06 15:57:45 -04003143 {
John Baumand4ae8632014-05-06 16:18:33 -04003144 (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 -04003145 if ((yyval.interm.intermTypedNode) == 0) {
3146 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "&&", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3147 context->recover();
3148 ConstantUnion *unionArray = new ConstantUnion[1];
3149 unionArray->setBConst(false);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05003150 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConstExpr), (yyvsp[(2) - (3)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003151 }
3152 }
3153 break;
3154
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003155 case 56:
John Bauman66b8ab22014-05-06 15:57:45 -04003156
3157 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
3158 break;
3159
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003160 case 57:
John Bauman66b8ab22014-05-06 15:57:45 -04003161
3162 {
John Baumand4ae8632014-05-06 16:18:33 -04003163 (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 -04003164 if ((yyval.interm.intermTypedNode) == 0) {
3165 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "^^", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3166 context->recover();
3167 ConstantUnion *unionArray = new ConstantUnion[1];
3168 unionArray->setBConst(false);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05003169 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConstExpr), (yyvsp[(2) - (3)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003170 }
3171 }
3172 break;
3173
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003174 case 58:
John Bauman66b8ab22014-05-06 15:57:45 -04003175
3176 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
3177 break;
3178
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003179 case 59:
John Bauman66b8ab22014-05-06 15:57:45 -04003180
3181 {
John Baumand4ae8632014-05-06 16:18:33 -04003182 (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 -04003183 if ((yyval.interm.intermTypedNode) == 0) {
3184 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "||", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3185 context->recover();
3186 ConstantUnion *unionArray = new ConstantUnion[1];
3187 unionArray->setBConst(false);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05003188 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConstExpr), (yyvsp[(2) - (3)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003189 }
3190 }
3191 break;
3192
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003193 case 60:
John Bauman66b8ab22014-05-06 15:57:45 -04003194
3195 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
3196 break;
3197
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003198 case 61:
John Bauman66b8ab22014-05-06 15:57:45 -04003199
3200 {
3201 if (context->boolErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.intermTypedNode)))
3202 context->recover();
3203
3204 (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);
3205 if ((yyvsp[(3) - (5)].interm.intermTypedNode)->getType() != (yyvsp[(5) - (5)].interm.intermTypedNode)->getType())
3206 (yyval.interm.intermTypedNode) = 0;
3207
3208 if ((yyval.interm.intermTypedNode) == 0) {
3209 context->binaryOpError((yyvsp[(2) - (5)].lex).line, ":", (yyvsp[(3) - (5)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(5) - (5)].interm.intermTypedNode)->getCompleteString());
3210 context->recover();
3211 (yyval.interm.intermTypedNode) = (yyvsp[(5) - (5)].interm.intermTypedNode);
3212 }
3213 }
3214 break;
3215
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003216 case 62:
John Bauman66b8ab22014-05-06 15:57:45 -04003217
3218 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
3219 break;
3220
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003221 case 63:
John Bauman66b8ab22014-05-06 15:57:45 -04003222
3223 {
3224 if (context->lValueErrorCheck((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)))
3225 context->recover();
3226 (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);
3227 if ((yyval.interm.intermTypedNode) == 0) {
3228 context->assignError((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3229 context->recover();
3230 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
3231 }
3232 }
3233 break;
3234
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003235 case 64:
John Bauman66b8ab22014-05-06 15:57:45 -04003236
3237 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAssign; }
3238 break;
3239
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003240 case 65:
John Bauman66b8ab22014-05-06 15:57:45 -04003241
3242 { FRAG_VERT_ONLY("*=", (yyvsp[(1) - (1)].lex).line); (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpMulAssign; }
3243 break;
3244
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003245 case 66:
John Bauman66b8ab22014-05-06 15:57:45 -04003246
3247 { FRAG_VERT_ONLY("/=", (yyvsp[(1) - (1)].lex).line); (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpDivAssign; }
3248 break;
3249
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003250 case 67:
John Bauman66b8ab22014-05-06 15:57:45 -04003251
3252 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAddAssign; }
3253 break;
3254
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003255 case 68:
John Bauman66b8ab22014-05-06 15:57:45 -04003256
3257 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpSubAssign; }
3258 break;
3259
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003260 case 69:
John Bauman66b8ab22014-05-06 15:57:45 -04003261
3262 {
3263 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
3264 }
3265 break;
3266
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003267 case 70:
John Bauman66b8ab22014-05-06 15:57:45 -04003268
3269 {
3270 (yyval.interm.intermTypedNode) = context->intermediate.addComma((yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
3271 if ((yyval.interm.intermTypedNode) == 0) {
3272 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ",", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3273 context->recover();
3274 (yyval.interm.intermTypedNode) = (yyvsp[(3) - (3)].interm.intermTypedNode);
3275 }
3276 }
3277 break;
3278
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003279 case 71:
John Bauman66b8ab22014-05-06 15:57:45 -04003280
3281 {
3282 if (context->constErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)))
3283 context->recover();
3284 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
3285 }
3286 break;
3287
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003288 case 72:
John Bauman66b8ab22014-05-06 15:57:45 -04003289
3290 {
3291 TFunction &function = *((yyvsp[(1) - (2)].interm).function);
3292
3293 TIntermAggregate *prototype = new TIntermAggregate;
3294 prototype->setType(function.getReturnType());
3295 prototype->setName(function.getName());
3296
3297 for (int i = 0; i < function.getParamCount(); i++)
3298 {
3299 const TParameter &param = function.getParam(i);
3300 if (param.name != 0)
3301 {
John Baumand4ae8632014-05-06 16:18:33 -04003302 TVariable variable(param.name, *param.type);
John Bauman66b8ab22014-05-06 15:57:45 -04003303
John Baumand4ae8632014-05-06 16:18:33 -04003304 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 -04003305 }
3306 else
3307 {
3308 prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (2)].interm).line), (yyvsp[(1) - (2)].interm).line);
3309 }
3310 }
3311
3312 prototype->setOp(EOpPrototype);
3313 (yyval.interm.intermNode) = prototype;
3314
3315 context->symbolTable.pop();
3316 }
3317 break;
3318
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003319 case 73:
John Bauman66b8ab22014-05-06 15:57:45 -04003320
3321 {
3322 if ((yyvsp[(1) - (2)].interm).intermAggregate)
3323 (yyvsp[(1) - (2)].interm).intermAggregate->setOp(EOpDeclaration);
3324 (yyval.interm.intermNode) = (yyvsp[(1) - (2)].interm).intermAggregate;
3325 }
3326 break;
3327
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003328 case 74:
John Bauman66b8ab22014-05-06 15:57:45 -04003329
3330 {
John Baumand4ae8632014-05-06 16:18:33 -04003331 if (!context->symbolTable.setDefaultPrecision( (yyvsp[(3) - (4)].interm.type), (yyvsp[(2) - (4)].interm.precision) )) {
3332 context->error((yyvsp[(1) - (4)].lex).line, "illegal type argument for default precision qualifier", getBasicString((yyvsp[(3) - (4)].interm.type).type));
3333 context->recover();
3334 }
John Bauman66b8ab22014-05-06 15:57:45 -04003335 (yyval.interm.intermNode) = 0;
3336 }
3337 break;
3338
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003339 case 75:
John Bauman66b8ab22014-05-06 15:57:45 -04003340
3341 {
3342 //
3343 // Multiple declarations of the same function are allowed.
3344 //
3345 // If this is a definition, the definition production code will check for redefinitions
3346 // (we don't know at this point if it's a definition or not).
3347 //
3348 // Redeclarations are allowed. But, return types and parameter qualifiers must match.
3349 //
Nicolas Capens0a7f0c22015-02-18 14:47:31 -05003350 TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find((yyvsp[(1) - (2)].interm.function)->getMangledName(), context->shaderVersion));
John Bauman66b8ab22014-05-06 15:57:45 -04003351 if (prevDec) {
3352 if (prevDec->getReturnType() != (yyvsp[(1) - (2)].interm.function)->getReturnType()) {
3353 context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same return type", (yyvsp[(1) - (2)].interm.function)->getReturnType().getBasicString());
3354 context->recover();
3355 }
3356 for (int i = 0; i < prevDec->getParamCount(); ++i) {
3357 if (prevDec->getParam(i).type->getQualifier() != (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifier()) {
3358 context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same parameter qualifiers", (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifierString());
3359 context->recover();
3360 }
3361 }
3362 }
3363
3364 //
3365 // If this is a redeclaration, it could also be a definition,
3366 // in which case, we want to use the variable names from this one, and not the one that's
3367 // being redeclared. So, pass back up this declaration, not the one in the symbol table.
3368 //
3369 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
3370 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
3371
3372 // We're at the inner scope level of the function's arguments and body statement.
3373 // Add the function prototype to the surrounding scope instead.
3374 context->symbolTable.getOuterLevel()->insert(*(yyval.interm).function);
3375 }
3376 break;
3377
John Bauman66b8ab22014-05-06 15:57:45 -04003378 case 76:
3379
3380 {
3381 (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
3382 }
3383 break;
3384
3385 case 77:
3386
3387 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003388 (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
3389 }
3390 break;
3391
3392 case 78:
3393
3394 {
John Bauman66b8ab22014-05-06 15:57:45 -04003395 // Add the parameter
3396 (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
3397 if ((yyvsp[(2) - (2)].interm).param.type->getBasicType() != EbtVoid)
3398 (yyvsp[(1) - (2)].interm.function)->addParameter((yyvsp[(2) - (2)].interm).param);
3399 else
3400 delete (yyvsp[(2) - (2)].interm).param.type;
3401 }
3402 break;
3403
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003404 case 79:
John Bauman66b8ab22014-05-06 15:57:45 -04003405
3406 {
3407 //
3408 // Only first parameter of one-parameter functions can be void
3409 // The check for named parameters not being void is done in parameter_declarator
3410 //
3411 if ((yyvsp[(3) - (3)].interm).param.type->getBasicType() == EbtVoid) {
3412 //
3413 // This parameter > first is void
3414 //
3415 context->error((yyvsp[(2) - (3)].lex).line, "cannot be an argument type except for '(void)'", "void");
3416 context->recover();
3417 delete (yyvsp[(3) - (3)].interm).param.type;
3418 } else {
3419 // Add the parameter
3420 (yyval.interm.function) = (yyvsp[(1) - (3)].interm.function);
3421 (yyvsp[(1) - (3)].interm.function)->addParameter((yyvsp[(3) - (3)].interm).param);
3422 }
3423 }
3424 break;
3425
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003426 case 80:
John Bauman66b8ab22014-05-06 15:57:45 -04003427
3428 {
3429 if ((yyvsp[(1) - (3)].interm.type).qualifier != EvqGlobal && (yyvsp[(1) - (3)].interm.type).qualifier != EvqTemporary) {
3430 context->error((yyvsp[(2) - (3)].lex).line, "no qualifiers allowed for function return", getQualifierString((yyvsp[(1) - (3)].interm.type).qualifier));
3431 context->recover();
3432 }
3433 // make sure a sampler is not involved as well...
3434 if (context->structQualifierErrorCheck((yyvsp[(2) - (3)].lex).line, (yyvsp[(1) - (3)].interm.type)))
3435 context->recover();
3436
3437 // Add the function as a prototype after parsing it (we do not support recursion)
3438 TFunction *function;
3439 TType type((yyvsp[(1) - (3)].interm.type));
3440 function = new TFunction((yyvsp[(2) - (3)].lex).string, type);
3441 (yyval.interm.function) = function;
3442
3443 context->symbolTable.push();
3444 }
3445 break;
3446
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003447 case 81:
John Bauman66b8ab22014-05-06 15:57:45 -04003448
3449 {
3450 if ((yyvsp[(1) - (2)].interm.type).type == EbtVoid) {
3451 context->error((yyvsp[(2) - (2)].lex).line, "illegal use of type 'void'", (yyvsp[(2) - (2)].lex).string->c_str());
3452 context->recover();
3453 }
3454 if (context->reservedErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string))
3455 context->recover();
3456 TParameter param = {(yyvsp[(2) - (2)].lex).string, new TType((yyvsp[(1) - (2)].interm.type))};
3457 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
3458 (yyval.interm).param = param;
3459 }
3460 break;
3461
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003462 case 82:
John Bauman66b8ab22014-05-06 15:57:45 -04003463
3464 {
3465 // Check that we can make an array out of this type
3466 if (context->arrayTypeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
3467 context->recover();
3468
3469 if (context->reservedErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string))
3470 context->recover();
3471
3472 int size;
3473 if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3474 context->recover();
3475 (yyvsp[(1) - (5)].interm.type).setArray(true, size);
3476
3477 TType* type = new TType((yyvsp[(1) - (5)].interm.type));
3478 TParameter param = { (yyvsp[(2) - (5)].lex).string, type };
3479 (yyval.interm).line = (yyvsp[(2) - (5)].lex).line;
3480 (yyval.interm).param = param;
3481 }
3482 break;
3483
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003484 case 83:
John Bauman66b8ab22014-05-06 15:57:45 -04003485
3486 {
3487 (yyval.interm) = (yyvsp[(3) - (3)].interm);
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003488 if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.qualifier), (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
John Bauman66b8ab22014-05-06 15:57:45 -04003489 context->recover();
3490 }
3491 break;
3492
John Bauman66b8ab22014-05-06 15:57:45 -04003493 case 84:
3494
3495 {
John Bauman66b8ab22014-05-06 15:57:45 -04003496 (yyval.interm) = (yyvsp[(2) - (2)].interm);
3497 if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
3498 context->recover();
3499 if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
3500 context->recover();
3501 }
3502 break;
3503
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003504 case 85:
3505
3506 {
3507 (yyval.interm) = (yyvsp[(3) - (3)].interm);
3508 if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.qualifier), (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
3509 context->recover();
3510 }
3511 break;
3512
John Bauman66b8ab22014-05-06 15:57:45 -04003513 case 86:
3514
3515 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003516 (yyval.interm) = (yyvsp[(2) - (2)].interm);
3517 if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
3518 context->recover();
3519 if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
3520 context->recover();
John Bauman66b8ab22014-05-06 15:57:45 -04003521 }
3522 break;
3523
3524 case 87:
3525
3526 {
3527 (yyval.interm.qualifier) = EvqIn;
3528 }
3529 break;
3530
3531 case 88:
3532
3533 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003534 (yyval.interm.qualifier) = EvqIn;
John Bauman66b8ab22014-05-06 15:57:45 -04003535 }
3536 break;
3537
3538 case 89:
3539
3540 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003541 (yyval.interm.qualifier) = EvqOut;
John Bauman66b8ab22014-05-06 15:57:45 -04003542 }
3543 break;
3544
3545 case 90:
3546
3547 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003548 (yyval.interm.qualifier) = EvqInOut;
3549 }
3550 break;
3551
3552 case 91:
3553
3554 {
John Bauman66b8ab22014-05-06 15:57:45 -04003555 TParameter param = { 0, new TType((yyvsp[(1) - (1)].interm.type)) };
3556 (yyval.interm).param = param;
3557 }
3558 break;
3559
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003560 case 92:
John Bauman66b8ab22014-05-06 15:57:45 -04003561
3562 {
3563 (yyval.interm) = (yyvsp[(1) - (1)].interm);
3564 }
3565 break;
3566
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003567 case 93:
John Bauman66b8ab22014-05-06 15:57:45 -04003568
3569 {
3570 if ((yyvsp[(1) - (3)].interm).type.type == EbtInvariant && !(yyvsp[(3) - (3)].lex).symbol)
3571 {
3572 context->error((yyvsp[(3) - (3)].lex).line, "undeclared identifier declared as invariant", (yyvsp[(3) - (3)].lex).string->c_str());
3573 context->recover();
3574 }
3575
3576 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(3) - (3)].lex).string, TType((yyvsp[(1) - (3)].interm).type), (yyvsp[(3) - (3)].lex).line);
3577 (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermNode, symbol, (yyvsp[(3) - (3)].lex).line);
3578
3579 if (context->structQualifierErrorCheck((yyvsp[(3) - (3)].lex).line, (yyval.interm).type))
3580 context->recover();
3581
3582 if (context->nonInitConstErrorCheck((yyvsp[(3) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyval.interm).type, false))
3583 context->recover();
3584
3585 TVariable* variable = 0;
3586 if (context->nonInitErrorCheck((yyvsp[(3) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyval.interm).type, variable))
3587 context->recover();
3588 if (symbol && variable)
3589 symbol->setId(variable->getUniqueId());
3590 }
3591 break;
3592
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003593 case 94:
John Bauman66b8ab22014-05-06 15:57:45 -04003594
3595 {
3596 if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
3597 context->recover();
3598
3599 if (context->nonInitConstErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, true))
3600 context->recover();
3601
3602 (yyval.interm) = (yyvsp[(1) - (5)].interm);
3603
3604 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))
3605 context->recover();
3606 else {
3607 (yyvsp[(1) - (5)].interm).type.setArray(true);
3608 TVariable* variable;
3609 if (context->arrayErrorCheck((yyvsp[(4) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, variable))
3610 context->recover();
3611 }
3612 }
3613 break;
3614
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003615 case 95:
John Bauman66b8ab22014-05-06 15:57:45 -04003616
3617 {
3618 if (context->structQualifierErrorCheck((yyvsp[(3) - (6)].lex).line, (yyvsp[(1) - (6)].interm).type))
3619 context->recover();
3620
3621 if (context->nonInitConstErrorCheck((yyvsp[(3) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type, true))
3622 context->recover();
3623
3624 (yyval.interm) = (yyvsp[(1) - (6)].interm);
3625
3626 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))
3627 context->recover();
3628 else {
3629 int size;
3630 if (context->arraySizeErrorCheck((yyvsp[(4) - (6)].lex).line, (yyvsp[(5) - (6)].interm.intermTypedNode), size))
3631 context->recover();
3632 (yyvsp[(1) - (6)].interm).type.setArray(true, size);
3633 TVariable* variable = 0;
3634 if (context->arrayErrorCheck((yyvsp[(4) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type, variable))
3635 context->recover();
3636 TType type = TType((yyvsp[(1) - (6)].interm).type);
3637 type.setArraySize(size);
3638 (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);
3639 }
3640 }
3641 break;
3642
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003643 case 96:
John Bauman66b8ab22014-05-06 15:57:45 -04003644
3645 {
3646 if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
3647 context->recover();
3648
3649 (yyval.interm) = (yyvsp[(1) - (5)].interm);
3650
3651 TIntermNode* intermNode;
3652 if (!context->executeInitializer((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, (yyvsp[(5) - (5)].interm.intermTypedNode), intermNode)) {
3653 //
3654 // build the intermediate representation
3655 //
3656 if (intermNode)
3657 (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (5)].interm).intermNode, intermNode, (yyvsp[(4) - (5)].lex).line);
3658 else
3659 (yyval.interm).intermAggregate = (yyvsp[(1) - (5)].interm).intermAggregate;
3660 } else {
3661 context->recover();
3662 (yyval.interm).intermAggregate = 0;
3663 }
3664 }
3665 break;
3666
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003667 case 97:
John Bauman66b8ab22014-05-06 15:57:45 -04003668
3669 {
3670 (yyval.interm).type = (yyvsp[(1) - (1)].interm.type);
3671 (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);
3672 }
3673 break;
3674
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003675 case 98:
John Bauman66b8ab22014-05-06 15:57:45 -04003676
3677 {
3678 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyvsp[(1) - (2)].interm.type)), (yyvsp[(2) - (2)].lex).line);
3679 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (2)].lex).line);
3680
3681 if (context->structQualifierErrorCheck((yyvsp[(2) - (2)].lex).line, (yyval.interm).type))
3682 context->recover();
3683
3684 if (context->nonInitConstErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string, (yyval.interm).type, false))
3685 context->recover();
3686
3687 (yyval.interm).type = (yyvsp[(1) - (2)].interm.type);
3688
3689 TVariable* variable = 0;
3690 if (context->nonInitErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string, (yyval.interm).type, variable))
3691 context->recover();
3692 if (variable && symbol)
3693 symbol->setId(variable->getUniqueId());
3694 }
3695 break;
3696
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003697 case 99:
John Bauman66b8ab22014-05-06 15:57:45 -04003698
3699 {
3700 context->error((yyvsp[(2) - (4)].lex).line, "unsized array declarations not supported", (yyvsp[(2) - (4)].lex).string->c_str());
3701 context->recover();
3702
3703 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (4)].lex).string, TType((yyvsp[(1) - (4)].interm.type)), (yyvsp[(2) - (4)].lex).line);
3704 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (4)].lex).line);
3705 (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
3706 }
3707 break;
3708
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003709 case 100:
John Bauman66b8ab22014-05-06 15:57:45 -04003710
3711 {
3712 TType type = TType((yyvsp[(1) - (5)].interm.type));
3713 int size;
3714 if (context->arraySizeErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3715 context->recover();
3716 type.setArraySize(size);
3717 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (5)].lex).string, type, (yyvsp[(2) - (5)].lex).line);
3718 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (5)].lex).line);
3719
3720 if (context->structQualifierErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
3721 context->recover();
3722
3723 if (context->nonInitConstErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type), true))
3724 context->recover();
3725
3726 (yyval.interm).type = (yyvsp[(1) - (5)].interm.type);
3727
3728 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)))
3729 context->recover();
3730 else {
3731 int size;
3732 if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3733 context->recover();
3734
3735 (yyvsp[(1) - (5)].interm.type).setArray(true, size);
3736 TVariable* variable = 0;
3737 if (context->arrayErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type), variable))
3738 context->recover();
3739 if (variable && symbol)
3740 symbol->setId(variable->getUniqueId());
3741 }
3742 }
3743 break;
3744
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003745 case 101:
John Bauman66b8ab22014-05-06 15:57:45 -04003746
3747 {
3748 if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
3749 context->recover();
3750
3751 (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
3752
3753 TIntermNode* intermNode;
3754 if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode)) {
3755 //
3756 // Build intermediate representation
3757 //
3758 if(intermNode)
3759 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(intermNode, (yyvsp[(3) - (4)].lex).line);
3760 else
3761 (yyval.interm).intermAggregate = 0;
3762 } else {
3763 context->recover();
3764 (yyval.interm).intermAggregate = 0;
3765 }
3766 }
3767 break;
3768
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003769 case 102:
John Bauman66b8ab22014-05-06 15:57:45 -04003770
3771 {
John Bauman66b8ab22014-05-06 15:57:45 -04003772 if (context->globalErrorCheck((yyvsp[(1) - (2)].lex).line, context->symbolTable.atGlobalLevel(), "invariant varying"))
3773 context->recover();
3774 (yyval.interm).type.setBasic(EbtInvariant, EvqInvariantVaryingOut, (yyvsp[(2) - (2)].lex).line);
3775 if (!(yyvsp[(2) - (2)].lex).symbol)
3776 {
3777 context->error((yyvsp[(2) - (2)].lex).line, "undeclared identifier declared as invariant", (yyvsp[(2) - (2)].lex).string->c_str());
3778 context->recover();
3779
3780 (yyval.interm).intermAggregate = 0;
3781 }
3782 else
3783 {
3784 TIntermSymbol *symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyval.interm).type), (yyvsp[(2) - (2)].lex).line);
3785 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (2)].lex).line);
3786 }
3787 }
3788 break;
3789
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003790 case 103:
John Bauman66b8ab22014-05-06 15:57:45 -04003791
3792 {
3793 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3794
3795 if ((yyvsp[(1) - (1)].interm.type).array) {
3796 context->error((yyvsp[(1) - (1)].interm.type).line, "not supported", "first-class array");
3797 context->recover();
3798 (yyvsp[(1) - (1)].interm.type).setArray(false);
3799 }
3800 }
3801 break;
3802
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003803 case 104:
John Bauman66b8ab22014-05-06 15:57:45 -04003804
3805 {
3806 if ((yyvsp[(2) - (2)].interm.type).array) {
3807 context->error((yyvsp[(2) - (2)].interm.type).line, "not supported", "first-class array");
3808 context->recover();
3809 (yyvsp[(2) - (2)].interm.type).setArray(false);
3810 }
3811
3812 if ((yyvsp[(1) - (2)].interm.type).qualifier == EvqAttribute &&
3813 ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
3814 context->error((yyvsp[(2) - (2)].interm.type).line, "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier));
3815 context->recover();
3816 }
3817 if (((yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingIn || (yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingOut) &&
3818 ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
3819 context->error((yyvsp[(2) - (2)].interm.type).line, "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier));
3820 context->recover();
3821 }
3822 (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
3823 (yyval.interm.type).qualifier = (yyvsp[(1) - (2)].interm.type).qualifier;
3824 }
3825 break;
3826
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003827 case 105:
John Bauman66b8ab22014-05-06 15:57:45 -04003828
3829 {
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04003830 (yyval.interm.type).qualifier = EvqSmooth;
John Bauman66b8ab22014-05-06 15:57:45 -04003831 }
3832 break;
3833
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003834 case 106:
John Bauman66b8ab22014-05-06 15:57:45 -04003835
3836 {
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04003837 (yyval.interm.type).qualifier = EvqFlat;
3838 }
3839 break;
3840
3841 case 107:
3842
3843 {
3844 (yyval.interm.qualifier) = EvqConstReadOnly;
3845 }
3846 break;
3847
3848 case 108:
3849
3850 {
John Bauman66b8ab22014-05-06 15:57:45 -04003851 VERTEX_ONLY("attribute", (yyvsp[(1) - (1)].lex).line);
Nicolas Capensc6841852015-02-15 14:25:37 -05003852 ES2_ONLY("attribute", (yyvsp[(1) - (1)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003853 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "attribute"))
3854 context->recover();
3855 (yyval.interm.type).setBasic(EbtVoid, EvqAttribute, (yyvsp[(1) - (1)].lex).line);
3856 }
3857 break;
3858
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04003859 case 109:
John Bauman66b8ab22014-05-06 15:57:45 -04003860
3861 {
Nicolas Capensc6841852015-02-15 14:25:37 -05003862 ES2_ONLY("varying", (yyvsp[(1) - (1)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003863 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "varying"))
3864 context->recover();
Nicolas Capens08ca3c62015-02-13 16:06:45 -05003865 if (context->shaderType == GL_VERTEX_SHADER)
John Bauman66b8ab22014-05-06 15:57:45 -04003866 (yyval.interm.type).setBasic(EbtVoid, EvqVaryingOut, (yyvsp[(1) - (1)].lex).line);
3867 else
3868 (yyval.interm.type).setBasic(EbtVoid, EvqVaryingIn, (yyvsp[(1) - (1)].lex).line);
3869 }
3870 break;
3871
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04003872 case 110:
John Bauman66b8ab22014-05-06 15:57:45 -04003873
3874 {
Nicolas Capensc6841852015-02-15 14:25:37 -05003875 ES2_ONLY("varying", (yyvsp[(1) - (2)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003876 if (context->globalErrorCheck((yyvsp[(1) - (2)].lex).line, context->symbolTable.atGlobalLevel(), "invariant varying"))
3877 context->recover();
Nicolas Capens08ca3c62015-02-13 16:06:45 -05003878 if (context->shaderType == GL_VERTEX_SHADER)
John Bauman66b8ab22014-05-06 15:57:45 -04003879 (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingOut, (yyvsp[(1) - (2)].lex).line);
3880 else
3881 (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingIn, (yyvsp[(1) - (2)].lex).line);
3882 }
3883 break;
3884
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04003885 case 111:
John Bauman66b8ab22014-05-06 15:57:45 -04003886
3887 {
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003888 (yyval.interm.type).setBasic(EbtVoid, (yyvsp[(1) - (1)].interm.type).qualifier, (yyvsp[(1) - (1)].interm.type).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003889 }
3890 break;
3891
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04003892 case 112:
3893
3894 {
3895 (yyval.interm.type) = context->joinInterpolationQualifiers((yyvsp[(1) - (2)].interm.type).line, (yyvsp[(1) - (2)].interm.type).qualifier, (yyvsp[(2) - (2)].interm.type).line, (yyvsp[(2) - (2)].interm.type).qualifier);
3896 }
3897 break;
3898
3899 case 113:
3900
3901 {
3902 context->error((yyvsp[(1) - (1)].interm.type).line, "interpolation qualifier requires a fragment 'in' or vertex 'out' storage qualifier", getQualifierString((yyvsp[(1) - (1)].interm.type).qualifier));
3903 context->recover();
3904
3905 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3906 (yyval.interm.type).setBasic(EbtVoid, qual, (yyvsp[(1) - (1)].interm.type).line);
3907 }
3908 break;
3909
3910 case 114:
John Bauman66b8ab22014-05-06 15:57:45 -04003911
3912 {
Nicolas Capens7d626792015-02-17 17:58:31 -05003913 (yyval.interm.type).qualifier = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3914 (yyval.interm.type).layoutQualifier = (yyvsp[(1) - (1)].interm.layoutQualifier);
3915 }
3916 break;
3917
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04003918 case 115:
Nicolas Capens7d626792015-02-17 17:58:31 -05003919
3920 {
3921 (yyval.interm.type).setBasic(EbtVoid, (yyvsp[(2) - (2)].interm.type).qualifier, (yyvsp[(2) - (2)].interm.type).line);
3922 (yyval.interm.type).layoutQualifier = (yyvsp[(1) - (2)].interm.layoutQualifier);
3923 }
3924 break;
3925
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04003926 case 116:
Nicolas Capens7d626792015-02-17 17:58:31 -05003927
3928 {
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05003929 (yyval.interm.type).qualifier = EvqConstExpr;
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003930 (yyval.interm.type).line = (yyvsp[(1) - (1)].lex).line;
3931 }
3932 break;
3933
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04003934 case 117:
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003935
3936 {
3937 ES3_ONLY("in", (yyvsp[(1) - (1)].lex).line);
3938 (yyval.interm.type).qualifier = (context->shaderType == GL_FRAGMENT_SHADER) ? EvqVaryingIn : EvqAttribute;
3939 (yyval.interm.type).line = (yyvsp[(1) - (1)].lex).line;
3940 }
3941 break;
3942
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04003943 case 118:
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003944
3945 {
3946 ES3_ONLY("out", (yyvsp[(1) - (1)].lex).line);
3947 (yyval.interm.type).qualifier = (context->shaderType == GL_FRAGMENT_SHADER) ? EvqFragColor : EvqVaryingOut;
3948 (yyval.interm.type).line = (yyvsp[(1) - (1)].lex).line;
3949 }
3950 break;
3951
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04003952 case 119:
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003953
3954 {
3955 ES3_ONLY("in", (yyvsp[(1) - (2)].lex).line);
3956 // FIXME: Handle centroid qualifier
3957 (yyval.interm.type).qualifier = (context->shaderType == GL_FRAGMENT_SHADER) ? EvqVaryingIn : EvqAttribute;
3958 (yyval.interm.type).line = (yyvsp[(2) - (2)].lex).line;
3959 }
3960 break;
3961
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04003962 case 120:
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003963
3964 {
3965 ES3_ONLY("out", (yyvsp[(1) - (2)].lex).line);
3966 // FIXME: Handle centroid qualifier
3967 (yyval.interm.type).qualifier = (context->shaderType == GL_FRAGMENT_SHADER) ? EvqFragColor : EvqVaryingOut;
3968 (yyval.interm.type).line = (yyvsp[(2) - (2)].lex).line;
3969 }
3970 break;
3971
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04003972 case 121:
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003973
3974 {
3975 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "uniform"))
3976 context->recover();
3977 (yyval.interm.type).qualifier = EvqUniform;
3978 (yyval.interm.type).line = (yyvsp[(1) - (1)].lex).line;
3979 }
3980 break;
3981
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04003982 case 122:
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003983
3984 {
John Bauman66b8ab22014-05-06 15:57:45 -04003985 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3986
3987 if ((yyval.interm.type).precision == EbpUndefined) {
3988 (yyval.interm.type).precision = context->symbolTable.getDefaultPrecision((yyvsp[(1) - (1)].interm.type).type);
3989 if (context->precisionErrorCheck((yyvsp[(1) - (1)].interm.type).line, (yyval.interm.type).precision, (yyvsp[(1) - (1)].interm.type).type)) {
3990 context->recover();
3991 }
3992 }
3993 }
3994 break;
3995
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04003996 case 123:
John Bauman66b8ab22014-05-06 15:57:45 -04003997
3998 {
3999 (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
4000 (yyval.interm.type).precision = (yyvsp[(1) - (2)].interm.precision);
4001 }
4002 break;
4003
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004004 case 124:
John Bauman66b8ab22014-05-06 15:57:45 -04004005
4006 {
4007 (yyval.interm.precision) = EbpHigh;
4008 }
4009 break;
4010
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004011 case 125:
John Bauman66b8ab22014-05-06 15:57:45 -04004012
4013 {
4014 (yyval.interm.precision) = EbpMedium;
4015 }
4016 break;
4017
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004018 case 126:
John Bauman66b8ab22014-05-06 15:57:45 -04004019
4020 {
4021 (yyval.interm.precision) = EbpLow;
4022 }
4023 break;
4024
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004025 case 127:
Nicolas Capens7d626792015-02-17 17:58:31 -05004026
4027 {
4028 ES3_ONLY("layout", (yyvsp[(1) - (4)].lex).line);
4029 (yyval.interm.layoutQualifier) = (yyvsp[(3) - (4)].interm.layoutQualifier);
4030 }
4031 break;
4032
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004033 case 128:
Nicolas Capens7d626792015-02-17 17:58:31 -05004034
4035 {
4036 (yyval.interm.layoutQualifier) = (yyvsp[(1) - (1)].interm.layoutQualifier);
4037 }
4038 break;
4039
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004040 case 129:
Nicolas Capens7d626792015-02-17 17:58:31 -05004041
4042 {
4043 (yyval.interm.layoutQualifier) = context->joinLayoutQualifiers((yyvsp[(1) - (3)].interm.layoutQualifier), (yyvsp[(3) - (3)].interm.layoutQualifier));
4044 }
4045 break;
4046
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004047 case 130:
Nicolas Capens7d626792015-02-17 17:58:31 -05004048
4049 {
4050 (yyval.interm.layoutQualifier) = context->parseLayoutQualifier(*(yyvsp[(1) - (1)].lex).string, (yyvsp[(1) - (1)].lex).line);
4051 }
4052 break;
4053
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004054 case 131:
Nicolas Capens7d626792015-02-17 17:58:31 -05004055
4056 {
4057 (yyval.interm.layoutQualifier) = context->parseLayoutQualifier(*(yyvsp[(1) - (3)].lex).string, (yyvsp[(1) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyvsp[(3) - (3)].lex).i, (yyvsp[(3) - (3)].lex).line);
4058 }
4059 break;
4060
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004061 case 132:
Nicolas Capens7d626792015-02-17 17:58:31 -05004062
4063 {
4064 (yyval.interm.layoutQualifier) = context->parseLayoutQualifier(*(yyvsp[(1) - (3)].lex).string, (yyvsp[(1) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyvsp[(3) - (3)].lex).i, (yyvsp[(3) - (3)].lex).line);
4065 }
4066 break;
4067
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004068 case 133:
John Bauman66b8ab22014-05-06 15:57:45 -04004069
4070 {
4071 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
4072 }
4073 break;
4074
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004075 case 134:
John Bauman66b8ab22014-05-06 15:57:45 -04004076
4077 {
4078 (yyval.interm.type) = (yyvsp[(1) - (4)].interm.type);
4079
4080 if (context->arrayTypeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
4081 context->recover();
4082 else {
4083 int size;
4084 if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
4085 context->recover();
4086 (yyval.interm.type).setArray(true, size);
4087 }
4088 }
4089 break;
4090
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05004091 case 135:
4092
4093 {
Nicolas Capens3c20f802015-02-17 17:17:20 -05004094 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004095 (yyval.interm.type).setBasic(EbtVoid, qual, (yyvsp[(1) - (1)].lex).line);
Nicolas Capens7d626792015-02-17 17:58:31 -05004096 }
4097 break;
4098
4099 case 136:
4100
4101 {
4102 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4103 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
Nicolas Capens7d626792015-02-17 17:58:31 -05004104 }
4105 break;
4106
4107 case 137:
4108
4109 {
4110 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004111 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
Nicolas Capens7d626792015-02-17 17:58:31 -05004112 }
4113 break;
4114
4115 case 138:
4116
4117 {
4118 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004119 (yyval.interm.type).setBasic(EbtUInt, qual, (yyvsp[(1) - (1)].lex).line);
Nicolas Capens7d626792015-02-17 17:58:31 -05004120 }
4121 break;
4122
4123 case 139:
4124
4125 {
4126 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4127 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
Nicolas Capens7d626792015-02-17 17:58:31 -05004128 }
4129 break;
4130
4131 case 140:
4132
4133 {
4134 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004135 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
4136 (yyval.interm.type).setAggregate(2);
Nicolas Capens7d626792015-02-17 17:58:31 -05004137 }
4138 break;
4139
4140 case 141:
4141
4142 {
4143 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004144 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
4145 (yyval.interm.type).setAggregate(3);
Nicolas Capens7d626792015-02-17 17:58:31 -05004146 }
4147 break;
4148
4149 case 142:
4150
4151 {
4152 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004153 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
4154 (yyval.interm.type).setAggregate(4);
Nicolas Capens7d626792015-02-17 17:58:31 -05004155 }
4156 break;
4157
4158 case 143:
4159
4160 {
4161 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004162 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
4163 (yyval.interm.type).setAggregate(2);
4164 }
4165 break;
4166
4167 case 144:
4168
4169 {
4170 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4171 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
4172 (yyval.interm.type).setAggregate(3);
4173 }
4174 break;
4175
4176 case 145:
4177
4178 {
4179 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4180 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
4181 (yyval.interm.type).setAggregate(4);
4182 }
4183 break;
4184
4185 case 146:
4186
4187 {
4188 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4189 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
4190 (yyval.interm.type).setAggregate(2);
4191 }
4192 break;
4193
4194 case 147:
4195
4196 {
4197 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
Nicolas Capens3c20f802015-02-17 17:17:20 -05004198 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004199 (yyval.interm.type).setAggregate(3);
Nicolas Capens3c20f802015-02-17 17:17:20 -05004200 }
4201 break;
4202
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004203 case 148:
Nicolas Capens3c20f802015-02-17 17:17:20 -05004204
4205 {
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004206 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004207 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
4208 (yyval.interm.type).setAggregate(4);
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004209 }
4210 break;
4211
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004212 case 149:
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004213
4214 {
4215 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4216 (yyval.interm.type).setBasic(EbtUInt, qual, (yyvsp[(1) - (1)].lex).line);
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004217 (yyval.interm.type).setAggregate(2);
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004218 }
4219 break;
4220
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004221 case 150:
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004222
4223 {
4224 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4225 (yyval.interm.type).setBasic(EbtUInt, qual, (yyvsp[(1) - (1)].lex).line);
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004226 (yyval.interm.type).setAggregate(3);
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004227 }
4228 break;
4229
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004230 case 151:
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004231
4232 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004233 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4234 (yyval.interm.type).setBasic(EbtUInt, qual, (yyvsp[(1) - (1)].lex).line);
4235 (yyval.interm.type).setAggregate(4);
4236 }
4237 break;
4238
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004239 case 152:
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004240
4241 {
John Bauman66b8ab22014-05-06 15:57:45 -04004242 FRAG_VERT_ONLY("mat2", (yyvsp[(1) - (1)].lex).line);
4243 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4244 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
Alexis Hetub14178b2015-04-13 13:23:20 -04004245 (yyval.interm.type).setMatrix(2, 2);
John Bauman66b8ab22014-05-06 15:57:45 -04004246 }
4247 break;
4248
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004249 case 153:
John Bauman66b8ab22014-05-06 15:57:45 -04004250
4251 {
4252 FRAG_VERT_ONLY("mat3", (yyvsp[(1) - (1)].lex).line);
4253 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4254 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
Alexis Hetub14178b2015-04-13 13:23:20 -04004255 (yyval.interm.type).setMatrix(3, 3);
John Bauman66b8ab22014-05-06 15:57:45 -04004256 }
4257 break;
4258
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004259 case 154:
John Bauman66b8ab22014-05-06 15:57:45 -04004260
4261 {
4262 FRAG_VERT_ONLY("mat4", (yyvsp[(1) - (1)].lex).line);
4263 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4264 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
Alexis Hetub14178b2015-04-13 13:23:20 -04004265 (yyval.interm.type).setMatrix(4, 4);
John Bauman66b8ab22014-05-06 15:57:45 -04004266 }
4267 break;
4268
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004269 case 155:
John Bauman66b8ab22014-05-06 15:57:45 -04004270
4271 {
Alexis Hetub14178b2015-04-13 13:23:20 -04004272 FRAG_VERT_ONLY("mat2x3", (yyvsp[(1) - (1)].lex).line);
4273 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4274 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
4275 (yyval.interm.type).setMatrix(2, 3);
4276 }
4277 break;
4278
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004279 case 156:
Alexis Hetub14178b2015-04-13 13:23:20 -04004280
4281 {
4282 FRAG_VERT_ONLY("mat3x2", (yyvsp[(1) - (1)].lex).line);
4283 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4284 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
4285 (yyval.interm.type).setMatrix(3, 2);
4286 }
4287 break;
4288
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004289 case 157:
Alexis Hetub14178b2015-04-13 13:23:20 -04004290
4291 {
4292 FRAG_VERT_ONLY("mat2x4", (yyvsp[(1) - (1)].lex).line);
4293 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4294 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
4295 (yyval.interm.type).setMatrix(2, 4);
4296 }
4297 break;
4298
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004299 case 158:
Alexis Hetub14178b2015-04-13 13:23:20 -04004300
4301 {
4302 FRAG_VERT_ONLY("mat4x2", (yyvsp[(1) - (1)].lex).line);
4303 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4304 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
4305 (yyval.interm.type).setMatrix(4, 2);
4306 }
4307 break;
4308
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004309 case 159:
Alexis Hetub14178b2015-04-13 13:23:20 -04004310
4311 {
4312 FRAG_VERT_ONLY("mat3x4", (yyvsp[(1) - (1)].lex).line);
4313 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4314 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
4315 (yyval.interm.type).setMatrix(3, 4);
4316 }
4317 break;
4318
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004319 case 160:
Alexis Hetub14178b2015-04-13 13:23:20 -04004320
4321 {
4322 FRAG_VERT_ONLY("mat4x3", (yyvsp[(1) - (1)].lex).line);
4323 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4324 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
4325 (yyval.interm.type).setMatrix(4, 3);
4326 }
4327 break;
4328
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004329 case 161:
Alexis Hetub14178b2015-04-13 13:23:20 -04004330
4331 {
John Bauman66b8ab22014-05-06 15:57:45 -04004332 FRAG_VERT_ONLY("sampler2D", (yyvsp[(1) - (1)].lex).line);
4333 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4334 (yyval.interm.type).setBasic(EbtSampler2D, qual, (yyvsp[(1) - (1)].lex).line);
4335 }
4336 break;
4337
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004338 case 162:
John Bauman66b8ab22014-05-06 15:57:45 -04004339
4340 {
4341 FRAG_VERT_ONLY("samplerCube", (yyvsp[(1) - (1)].lex).line);
4342 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4343 (yyval.interm.type).setBasic(EbtSamplerCube, qual, (yyvsp[(1) - (1)].lex).line);
4344 }
4345 break;
4346
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004347 case 163:
John Bauman66b8ab22014-05-06 15:57:45 -04004348
4349 {
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04004350 if (!context->supportsExtension("GL_OES_EGL_image_external")) {
4351 context->error((yyvsp[(1) - (1)].lex).line, "unsupported type", "samplerExternalOES", "");
4352 context->recover();
4353 }
4354 FRAG_VERT_ONLY("samplerExternalOES", (yyvsp[(1) - (1)].lex).line);
4355 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4356 (yyval.interm.type).setBasic(EbtSamplerExternalOES, qual, (yyvsp[(1) - (1)].lex).line);
4357 }
4358 break;
4359
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004360 case 164:
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04004361
4362 {
Alexis Hetub027aa92015-01-19 15:56:12 -05004363 FRAG_VERT_ONLY("sampler3D", (yyvsp[(1) - (1)].lex).line);
4364 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4365 (yyval.interm.type).setBasic(EbtSampler3D, qual, (yyvsp[(1) - (1)].lex).line);
4366 }
4367 break;
4368
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004369 case 165:
Alexis Hetub14178b2015-04-13 13:23:20 -04004370
4371 {
4372 FRAG_VERT_ONLY("sampler2DArray", (yyvsp[(1) - (1)].lex).line);
4373 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4374 (yyval.interm.type).setBasic(EbtSampler2DArray, qual, (yyvsp[(1) - (1)].lex).line);
4375 }
4376 break;
4377
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004378 case 166:
Alexis Hetub14178b2015-04-13 13:23:20 -04004379
4380 {
4381 FRAG_VERT_ONLY("isampler2D", (yyvsp[(1) - (1)].lex).line);
4382 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4383 (yyval.interm.type).setBasic(EbtISampler2D, qual, (yyvsp[(1) - (1)].lex).line);
4384 }
4385 break;
4386
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004387 case 167:
Alexis Hetub14178b2015-04-13 13:23:20 -04004388
4389 {
4390 FRAG_VERT_ONLY("isampler3D", (yyvsp[(1) - (1)].lex).line);
4391 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4392 (yyval.interm.type).setBasic(EbtISampler3D, qual, (yyvsp[(1) - (1)].lex).line);
4393 }
4394 break;
4395
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004396 case 168:
Alexis Hetub14178b2015-04-13 13:23:20 -04004397
4398 {
4399 FRAG_VERT_ONLY("isamplerCube", (yyvsp[(1) - (1)].lex).line);
4400 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4401 (yyval.interm.type).setBasic(EbtISamplerCube, qual, (yyvsp[(1) - (1)].lex).line);
4402 }
4403 break;
4404
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004405 case 169:
Alexis Hetub14178b2015-04-13 13:23:20 -04004406
4407 {
4408 FRAG_VERT_ONLY("isampler2DArray", (yyvsp[(1) - (1)].lex).line);
4409 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4410 (yyval.interm.type).setBasic(EbtISampler2DArray, qual, (yyvsp[(1) - (1)].lex).line);
4411 }
4412 break;
4413
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004414 case 170:
Alexis Hetub14178b2015-04-13 13:23:20 -04004415
4416 {
4417 FRAG_VERT_ONLY("usampler2D", (yyvsp[(1) - (1)].lex).line);
4418 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4419 (yyval.interm.type).setBasic(EbtUSampler2D, qual, (yyvsp[(1) - (1)].lex).line);
4420 }
4421 break;
4422
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004423 case 171:
Alexis Hetub14178b2015-04-13 13:23:20 -04004424
4425 {
4426 FRAG_VERT_ONLY("usampler3D", (yyvsp[(1) - (1)].lex).line);
4427 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4428 (yyval.interm.type).setBasic(EbtUSampler3D, qual, (yyvsp[(1) - (1)].lex).line);
4429 }
4430 break;
4431
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004432 case 172:
Alexis Hetub14178b2015-04-13 13:23:20 -04004433
4434 {
4435 FRAG_VERT_ONLY("usamplerCube", (yyvsp[(1) - (1)].lex).line);
4436 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4437 (yyval.interm.type).setBasic(EbtUSamplerCube, qual, (yyvsp[(1) - (1)].lex).line);
4438 }
4439 break;
4440
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004441 case 173:
Alexis Hetub14178b2015-04-13 13:23:20 -04004442
4443 {
4444 FRAG_VERT_ONLY("usampler2DArray", (yyvsp[(1) - (1)].lex).line);
4445 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4446 (yyval.interm.type).setBasic(EbtUSampler2DArray, qual, (yyvsp[(1) - (1)].lex).line);
4447 }
4448 break;
4449
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004450 case 174:
Alexis Hetub14178b2015-04-13 13:23:20 -04004451
4452 {
4453 FRAG_VERT_ONLY("sampler2DShadow", (yyvsp[(1) - (1)].lex).line);
4454 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4455 (yyval.interm.type).setBasic(EbtSampler2DShadow, qual, (yyvsp[(1) - (1)].lex).line);
4456 }
4457 break;
4458
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004459 case 175:
Alexis Hetub14178b2015-04-13 13:23:20 -04004460
4461 {
4462 FRAG_VERT_ONLY("samplerCubeShadow", (yyvsp[(1) - (1)].lex).line);
4463 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4464 (yyval.interm.type).setBasic(EbtSamplerCubeShadow, qual, (yyvsp[(1) - (1)].lex).line);
4465 }
4466 break;
4467
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004468 case 176:
Alexis Hetub14178b2015-04-13 13:23:20 -04004469
4470 {
4471 FRAG_VERT_ONLY("sampler2DArrayShadow", (yyvsp[(1) - (1)].lex).line);
4472 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4473 (yyval.interm.type).setBasic(EbtSampler2DArrayShadow, qual, (yyvsp[(1) - (1)].lex).line);
4474 }
4475 break;
4476
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004477 case 177:
Alexis Hetub027aa92015-01-19 15:56:12 -05004478
4479 {
John Bauman66b8ab22014-05-06 15:57:45 -04004480 FRAG_VERT_ONLY("struct", (yyvsp[(1) - (1)].interm.type).line);
4481 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
4482 (yyval.interm.type).qualifier = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4483 }
4484 break;
4485
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004486 case 178:
John Bauman66b8ab22014-05-06 15:57:45 -04004487
4488 {
4489 //
4490 // This is for user defined type names. The lexical phase looked up the
4491 // type.
4492 //
4493 TType& structure = static_cast<TVariable*>((yyvsp[(1) - (1)].lex).symbol)->getType();
4494 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4495 (yyval.interm.type).setBasic(EbtStruct, qual, (yyvsp[(1) - (1)].lex).line);
4496 (yyval.interm.type).userDef = &structure;
4497 }
4498 break;
4499
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004500 case 179:
John Bauman66b8ab22014-05-06 15:57:45 -04004501
4502 { if (context->enterStructDeclaration((yyvsp[(2) - (3)].lex).line, *(yyvsp[(2) - (3)].lex).string)) context->recover(); }
4503 break;
4504
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004505 case 180:
John Bauman66b8ab22014-05-06 15:57:45 -04004506
4507 {
4508 if (context->reservedErrorCheck((yyvsp[(2) - (6)].lex).line, *(yyvsp[(2) - (6)].lex).string))
4509 context->recover();
4510
4511 TType* structure = new TType((yyvsp[(5) - (6)].interm.typeList), *(yyvsp[(2) - (6)].lex).string);
4512 TVariable* userTypeDef = new TVariable((yyvsp[(2) - (6)].lex).string, *structure, true);
Nicolas Capensd603ecd2015-02-18 14:52:21 -05004513 if (! context->symbolTable.declare(*userTypeDef)) {
John Bauman66b8ab22014-05-06 15:57:45 -04004514 context->error((yyvsp[(2) - (6)].lex).line, "redefinition", (yyvsp[(2) - (6)].lex).string->c_str(), "struct");
4515 context->recover();
4516 }
4517 (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (6)].lex).line);
4518 (yyval.interm.type).userDef = structure;
4519 context->exitStructDeclaration();
4520 }
4521 break;
4522
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004523 case 181:
John Bauman66b8ab22014-05-06 15:57:45 -04004524
4525 { if (context->enterStructDeclaration((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string)) context->recover(); }
4526 break;
4527
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004528 case 182:
John Bauman66b8ab22014-05-06 15:57:45 -04004529
4530 {
4531 TType* structure = new TType((yyvsp[(4) - (5)].interm.typeList), TString(""));
4532 (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (5)].lex).line);
4533 (yyval.interm.type).userDef = structure;
4534 context->exitStructDeclaration();
4535 }
4536 break;
4537
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004538 case 183:
John Bauman66b8ab22014-05-06 15:57:45 -04004539
4540 {
4541 (yyval.interm.typeList) = (yyvsp[(1) - (1)].interm.typeList);
4542 }
4543 break;
4544
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004545 case 184:
John Bauman66b8ab22014-05-06 15:57:45 -04004546
4547 {
4548 (yyval.interm.typeList) = (yyvsp[(1) - (2)].interm.typeList);
4549 for (unsigned int i = 0; i < (yyvsp[(2) - (2)].interm.typeList)->size(); ++i) {
4550 for (unsigned int j = 0; j < (yyval.interm.typeList)->size(); ++j) {
4551 if ((*(yyval.interm.typeList))[j].type->getFieldName() == (*(yyvsp[(2) - (2)].interm.typeList))[i].type->getFieldName()) {
4552 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());
4553 context->recover();
4554 }
4555 }
4556 (yyval.interm.typeList)->push_back((*(yyvsp[(2) - (2)].interm.typeList))[i]);
4557 }
4558 }
4559 break;
4560
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004561 case 185:
John Bauman66b8ab22014-05-06 15:57:45 -04004562
4563 {
4564 (yyval.interm.typeList) = (yyvsp[(2) - (3)].interm.typeList);
4565
4566 if (context->voidErrorCheck((yyvsp[(1) - (3)].interm.type).line, (*(yyvsp[(2) - (3)].interm.typeList))[0].type->getFieldName(), (yyvsp[(1) - (3)].interm.type))) {
4567 context->recover();
4568 }
4569 for (unsigned int i = 0; i < (yyval.interm.typeList)->size(); ++i) {
4570 //
4571 // Careful not to replace already known aspects of type, like array-ness
4572 //
4573 TType* type = (*(yyval.interm.typeList))[i].type;
4574 type->setBasicType((yyvsp[(1) - (3)].interm.type).type);
Alexis Hetub14178b2015-04-13 13:23:20 -04004575 type->setNominalSize((yyvsp[(1) - (3)].interm.type).primarySize);
4576 type->setSecondarySize((yyvsp[(1) - (3)].interm.type).secondarySize);
John Bauman66b8ab22014-05-06 15:57:45 -04004577 type->setPrecision((yyvsp[(1) - (3)].interm.type).precision);
4578
4579 // don't allow arrays of arrays
4580 if (type->isArray()) {
4581 if (context->arrayTypeErrorCheck((yyvsp[(1) - (3)].interm.type).line, (yyvsp[(1) - (3)].interm.type)))
4582 context->recover();
4583 }
4584 if ((yyvsp[(1) - (3)].interm.type).array)
4585 type->setArraySize((yyvsp[(1) - (3)].interm.type).arraySize);
4586 if ((yyvsp[(1) - (3)].interm.type).userDef) {
4587 type->setStruct((yyvsp[(1) - (3)].interm.type).userDef->getStruct());
4588 type->setTypeName((yyvsp[(1) - (3)].interm.type).userDef->getTypeName());
4589 }
John Bauman66b8ab22014-05-06 15:57:45 -04004590 }
4591 }
4592 break;
4593
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004594 case 186:
John Bauman66b8ab22014-05-06 15:57:45 -04004595
4596 {
4597 (yyval.interm.typeList) = NewPoolTTypeList();
4598 (yyval.interm.typeList)->push_back((yyvsp[(1) - (1)].interm.typeLine));
4599 }
4600 break;
4601
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004602 case 187:
John Bauman66b8ab22014-05-06 15:57:45 -04004603
4604 {
4605 (yyval.interm.typeList)->push_back((yyvsp[(3) - (3)].interm.typeLine));
4606 }
4607 break;
4608
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004609 case 188:
John Bauman66b8ab22014-05-06 15:57:45 -04004610
4611 {
4612 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
4613 context->recover();
4614
4615 (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
4616 (yyval.interm.typeLine).line = (yyvsp[(1) - (1)].lex).line;
4617 (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (1)].lex).string);
4618 }
4619 break;
4620
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004621 case 189:
John Bauman66b8ab22014-05-06 15:57:45 -04004622
4623 {
4624 if (context->reservedErrorCheck((yyvsp[(1) - (4)].lex).line, *(yyvsp[(1) - (4)].lex).string))
4625 context->recover();
4626
4627 (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
4628 (yyval.interm.typeLine).line = (yyvsp[(1) - (4)].lex).line;
4629 (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (4)].lex).string);
4630
4631 int size;
4632 if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
4633 context->recover();
4634 (yyval.interm.typeLine).type->setArraySize(size);
4635 }
4636 break;
4637
Alexis Hetub14178b2015-04-13 13:23:20 -04004638 case 190:
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004639
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004640 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
Alexis Hetub027aa92015-01-19 15:56:12 -05004641 break;
4642
Alexis Hetub14178b2015-04-13 13:23:20 -04004643 case 191:
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05004644
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004645 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05004646 break;
4647
Alexis Hetub14178b2015-04-13 13:23:20 -04004648 case 192:
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05004649
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004650 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermAggregate); }
Nicolas Capens3c20f802015-02-17 17:17:20 -05004651 break;
4652
Alexis Hetub14178b2015-04-13 13:23:20 -04004653 case 193:
Nicolas Capens3c20f802015-02-17 17:17:20 -05004654
Nicolas Capens7d626792015-02-17 17:58:31 -05004655 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004656 break;
4657
Alexis Hetub14178b2015-04-13 13:23:20 -04004658 case 194:
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004659
Nicolas Capens7d626792015-02-17 17:58:31 -05004660 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004661 break;
4662
Alexis Hetub14178b2015-04-13 13:23:20 -04004663 case 195:
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004664
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004665 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004666 break;
4667
Alexis Hetub14178b2015-04-13 13:23:20 -04004668 case 196:
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004669
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004670 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004671 break;
4672
Alexis Hetub14178b2015-04-13 13:23:20 -04004673 case 197:
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004674
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004675 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
Nicolas Capens7d626792015-02-17 17:58:31 -05004676 break;
4677
Alexis Hetub14178b2015-04-13 13:23:20 -04004678 case 198:
Nicolas Capens7d626792015-02-17 17:58:31 -05004679
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004680 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
4681 break;
4682
4683 case 199:
4684
4685 { (yyval.interm.intermAggregate) = 0; }
4686 break;
4687
4688 case 200:
4689
4690 { context->symbolTable.push(); }
4691 break;
4692
4693 case 201:
4694
4695 { context->symbolTable.pop(); }
4696 break;
4697
4698 case 202:
4699
Nicolas Capens7d626792015-02-17 17:58:31 -05004700 {
4701 if ((yyvsp[(3) - (5)].interm.intermAggregate) != 0) {
4702 (yyvsp[(3) - (5)].interm.intermAggregate)->setOp(EOpSequence);
4703 (yyvsp[(3) - (5)].interm.intermAggregate)->setEndLine((yyvsp[(5) - (5)].lex).line);
4704 }
4705 (yyval.interm.intermAggregate) = (yyvsp[(3) - (5)].interm.intermAggregate);
4706 }
4707 break;
4708
Alexis Hetub14178b2015-04-13 13:23:20 -04004709 case 203:
Nicolas Capens7d626792015-02-17 17:58:31 -05004710
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004711 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
Nicolas Capens7d626792015-02-17 17:58:31 -05004712 break;
4713
Alexis Hetub14178b2015-04-13 13:23:20 -04004714 case 204:
Nicolas Capens7d626792015-02-17 17:58:31 -05004715
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004716 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
Nicolas Capens7d626792015-02-17 17:58:31 -05004717 break;
4718
Alexis Hetub14178b2015-04-13 13:23:20 -04004719 case 205:
Nicolas Capens7d626792015-02-17 17:58:31 -05004720
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004721 { context->symbolTable.push(); }
4722 break;
4723
4724 case 206:
4725
4726 { context->symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[(2) - (2)].interm.intermNode); }
4727 break;
4728
4729 case 207:
4730
4731 { context->symbolTable.push(); }
4732 break;
4733
4734 case 208:
4735
4736 { context->symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[(2) - (2)].interm.intermNode); }
4737 break;
4738
4739 case 209:
4740
John Bauman66b8ab22014-05-06 15:57:45 -04004741 {
4742 (yyval.interm.intermNode) = 0;
4743 }
4744 break;
4745
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004746 case 210:
John Bauman66b8ab22014-05-06 15:57:45 -04004747
4748 {
4749 if ((yyvsp[(2) - (3)].interm.intermAggregate)) {
4750 (yyvsp[(2) - (3)].interm.intermAggregate)->setOp(EOpSequence);
4751 (yyvsp[(2) - (3)].interm.intermAggregate)->setEndLine((yyvsp[(3) - (3)].lex).line);
4752 }
4753 (yyval.interm.intermNode) = (yyvsp[(2) - (3)].interm.intermAggregate);
4754 }
4755 break;
4756
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004757 case 211:
John Bauman66b8ab22014-05-06 15:57:45 -04004758
4759 {
4760 (yyval.interm.intermAggregate) = context->intermediate.makeAggregate((yyvsp[(1) - (1)].interm.intermNode), 0);
4761 }
4762 break;
4763
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004764 case 212:
John Bauman66b8ab22014-05-06 15:57:45 -04004765
4766 {
4767 (yyval.interm.intermAggregate) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermAggregate), (yyvsp[(2) - (2)].interm.intermNode), 0);
4768 }
4769 break;
4770
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004771 case 213:
John Bauman66b8ab22014-05-06 15:57:45 -04004772
4773 { (yyval.interm.intermNode) = 0; }
4774 break;
4775
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004776 case 214:
John Bauman66b8ab22014-05-06 15:57:45 -04004777
4778 { (yyval.interm.intermNode) = static_cast<TIntermNode*>((yyvsp[(1) - (2)].interm.intermTypedNode)); }
4779 break;
4780
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004781 case 215:
John Bauman66b8ab22014-05-06 15:57:45 -04004782
4783 {
4784 if (context->boolErrorCheck((yyvsp[(1) - (5)].lex).line, (yyvsp[(3) - (5)].interm.intermTypedNode)))
4785 context->recover();
4786 (yyval.interm.intermNode) = context->intermediate.addSelection((yyvsp[(3) - (5)].interm.intermTypedNode), (yyvsp[(5) - (5)].interm.nodePair), (yyvsp[(1) - (5)].lex).line);
4787 }
4788 break;
4789
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004790 case 216:
John Bauman66b8ab22014-05-06 15:57:45 -04004791
4792 {
4793 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermNode);
4794 (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermNode);
4795 }
4796 break;
4797
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004798 case 217:
John Bauman66b8ab22014-05-06 15:57:45 -04004799
4800 {
4801 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (1)].interm.intermNode);
4802 (yyval.interm.nodePair).node2 = 0;
4803 }
4804 break;
4805
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004806 case 218:
John Bauman66b8ab22014-05-06 15:57:45 -04004807
4808 {
4809 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
4810 if (context->boolErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)->getLine(), (yyvsp[(1) - (1)].interm.intermTypedNode)))
4811 context->recover();
4812 }
4813 break;
4814
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004815 case 219:
John Bauman66b8ab22014-05-06 15:57:45 -04004816
4817 {
4818 TIntermNode* intermNode;
4819 if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
4820 context->recover();
4821 if (context->boolErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
4822 context->recover();
4823
4824 if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode))
4825 (yyval.interm.intermTypedNode) = (yyvsp[(4) - (4)].interm.intermTypedNode);
4826 else {
4827 context->recover();
4828 (yyval.interm.intermTypedNode) = 0;
4829 }
4830 }
4831 break;
4832
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004833 case 220:
John Bauman66b8ab22014-05-06 15:57:45 -04004834
4835 { context->symbolTable.push(); ++context->loopNestingLevel; }
4836 break;
4837
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004838 case 221:
John Bauman66b8ab22014-05-06 15:57:45 -04004839
4840 {
4841 context->symbolTable.pop();
4842 (yyval.interm.intermNode) = context->intermediate.addLoop(ELoopWhile, 0, (yyvsp[(4) - (6)].interm.intermTypedNode), 0, (yyvsp[(6) - (6)].interm.intermNode), (yyvsp[(1) - (6)].lex).line);
4843 --context->loopNestingLevel;
4844 }
4845 break;
4846
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004847 case 222:
John Bauman66b8ab22014-05-06 15:57:45 -04004848
4849 { ++context->loopNestingLevel; }
4850 break;
4851
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004852 case 223:
John Bauman66b8ab22014-05-06 15:57:45 -04004853
4854 {
4855 if (context->boolErrorCheck((yyvsp[(8) - (8)].lex).line, (yyvsp[(6) - (8)].interm.intermTypedNode)))
4856 context->recover();
4857
4858 (yyval.interm.intermNode) = context->intermediate.addLoop(ELoopDoWhile, 0, (yyvsp[(6) - (8)].interm.intermTypedNode), 0, (yyvsp[(3) - (8)].interm.intermNode), (yyvsp[(4) - (8)].lex).line);
4859 --context->loopNestingLevel;
4860 }
4861 break;
4862
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004863 case 224:
John Bauman66b8ab22014-05-06 15:57:45 -04004864
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004865 { context->symbolTable.push(); ++context->loopNestingLevel; }
John Bauman66b8ab22014-05-06 15:57:45 -04004866 break;
4867
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004868 case 225:
John Bauman66b8ab22014-05-06 15:57:45 -04004869
4870 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004871 context->symbolTable.pop();
4872 (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);
4873 --context->loopNestingLevel;
John Bauman66b8ab22014-05-06 15:57:45 -04004874 }
4875 break;
4876
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004877 case 226:
John Bauman66b8ab22014-05-06 15:57:45 -04004878
4879 {
Nicolas Capens3c20f802015-02-17 17:17:20 -05004880 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04004881 }
4882 break;
4883
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004884 case 227:
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04004885
4886 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004887 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
Alexis Hetub027aa92015-01-19 15:56:12 -05004888 }
4889 break;
4890
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004891 case 228:
Alexis Hetub027aa92015-01-19 15:56:12 -05004892
4893 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004894 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
Nicolas Capens3c20f802015-02-17 17:17:20 -05004895 }
4896 break;
4897
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004898 case 229:
Nicolas Capens3c20f802015-02-17 17:17:20 -05004899
4900 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004901 (yyval.interm.intermTypedNode) = 0;
4902 }
4903 break;
4904
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004905 case 230:
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004906
4907 {
John Bauman66b8ab22014-05-06 15:57:45 -04004908 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (2)].interm.intermTypedNode);
4909 (yyval.interm.nodePair).node2 = 0;
4910 }
4911 break;
4912
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004913 case 231:
John Bauman66b8ab22014-05-06 15:57:45 -04004914
4915 {
4916 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermTypedNode);
4917 (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermTypedNode);
4918 }
4919 break;
4920
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004921 case 232:
John Bauman66b8ab22014-05-06 15:57:45 -04004922
4923 {
4924 if (context->loopNestingLevel <= 0) {
4925 context->error((yyvsp[(1) - (2)].lex).line, "continue statement only allowed in loops", "");
4926 context->recover();
4927 }
4928 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpContinue, (yyvsp[(1) - (2)].lex).line);
4929 }
4930 break;
4931
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004932 case 233:
John Bauman66b8ab22014-05-06 15:57:45 -04004933
4934 {
4935 if (context->loopNestingLevel <= 0) {
4936 context->error((yyvsp[(1) - (2)].lex).line, "break statement only allowed in loops", "");
4937 context->recover();
4938 }
4939 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpBreak, (yyvsp[(1) - (2)].lex).line);
4940 }
4941 break;
4942
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004943 case 234:
John Bauman66b8ab22014-05-06 15:57:45 -04004944
4945 {
4946 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(1) - (2)].lex).line);
4947 if (context->currentFunctionType->getBasicType() != EbtVoid) {
4948 context->error((yyvsp[(1) - (2)].lex).line, "non-void function must return a value", "return");
4949 context->recover();
4950 }
4951 }
4952 break;
4953
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004954 case 235:
John Bauman66b8ab22014-05-06 15:57:45 -04004955
4956 {
4957 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(2) - (3)].interm.intermTypedNode), (yyvsp[(1) - (3)].lex).line);
4958 context->functionReturnsValue = true;
4959 if (context->currentFunctionType->getBasicType() == EbtVoid) {
4960 context->error((yyvsp[(1) - (3)].lex).line, "void function cannot return a value", "return");
4961 context->recover();
4962 } else if (*(context->currentFunctionType) != (yyvsp[(2) - (3)].interm.intermTypedNode)->getType()) {
4963 context->error((yyvsp[(1) - (3)].lex).line, "function return is not matching type:", "return");
4964 context->recover();
4965 }
4966 }
4967 break;
4968
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004969 case 236:
John Bauman66b8ab22014-05-06 15:57:45 -04004970
4971 {
4972 FRAG_ONLY("discard", (yyvsp[(1) - (2)].lex).line);
4973 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpKill, (yyvsp[(1) - (2)].lex).line);
4974 }
4975 break;
4976
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004977 case 237:
John Bauman66b8ab22014-05-06 15:57:45 -04004978
4979 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004980 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
Nicolas Capens3c20f802015-02-17 17:17:20 -05004981 context->treeRoot = (yyval.interm.intermNode);
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04004982 }
4983 break;
4984
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004985 case 238:
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04004986
4987 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004988 (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermNode), (yyvsp[(2) - (2)].interm.intermNode), 0);
4989 context->treeRoot = (yyval.interm.intermNode);
Alexis Hetub027aa92015-01-19 15:56:12 -05004990 }
4991 break;
4992
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004993 case 239:
Alexis Hetub027aa92015-01-19 15:56:12 -05004994
4995 {
Nicolas Capens3c20f802015-02-17 17:17:20 -05004996 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
4997 }
4998 break;
4999
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04005000 case 240:
Nicolas Capens3c20f802015-02-17 17:17:20 -05005001
5002 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05005003 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
5004 }
5005 break;
5006
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04005007 case 241:
Nicolas Capens2c1239f2015-02-17 17:30:04 -05005008
5009 {
John Bauman66b8ab22014-05-06 15:57:45 -04005010 TFunction* function = (yyvsp[(1) - (1)].interm).function;
5011
Nicolas Capens0a7f0c22015-02-18 14:47:31 -05005012 const TSymbol *builtIn = context->symbolTable.findBuiltIn(function->getMangledName(), context->shaderVersion);
John Bauman66b8ab22014-05-06 15:57:45 -04005013
5014 if (builtIn)
5015 {
5016 context->error((yyvsp[(1) - (1)].interm).line, "built-in functions cannot be redefined", function->getName().c_str());
5017 context->recover();
5018 }
5019
Nicolas Capens0a7f0c22015-02-18 14:47:31 -05005020 TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find(function->getMangledName(), context->shaderVersion));
John Bauman66b8ab22014-05-06 15:57:45 -04005021 //
5022 // Note: 'prevDec' could be 'function' if this is the first time we've seen function
5023 // as it would have just been put in the symbol table. Otherwise, we're looking up
5024 // an earlier occurance.
5025 //
5026 if (prevDec->isDefined()) {
5027 //
5028 // Then this function already has a body.
5029 //
5030 context->error((yyvsp[(1) - (1)].interm).line, "function already has a body", function->getName().c_str());
5031 context->recover();
5032 }
5033 prevDec->setDefined();
5034
5035 //
5036 // Raise error message if main function takes any parameters or return anything other than void
5037 //
5038 if (function->getName() == "main") {
5039 if (function->getParamCount() > 0) {
5040 context->error((yyvsp[(1) - (1)].interm).line, "function cannot take any parameter(s)", function->getName().c_str());
5041 context->recover();
5042 }
5043 if (function->getReturnType().getBasicType() != EbtVoid) {
5044 context->error((yyvsp[(1) - (1)].interm).line, "", function->getReturnType().getBasicString(), "main function cannot return a value");
5045 context->recover();
5046 }
5047 }
5048
5049 //
5050 // Remember the return type for later checking for RETURN statements.
5051 //
5052 context->currentFunctionType = &(prevDec->getReturnType());
5053 context->functionReturnsValue = false;
5054
5055 //
5056 // Insert parameters into the symbol table.
5057 // If the parameter has no name, it's not an error, just don't insert it
5058 // (could be used for unused args).
5059 //
5060 // Also, accumulate the list of parameters into the HIL, so lower level code
5061 // knows where to find parameters.
5062 //
5063 TIntermAggregate* paramNodes = new TIntermAggregate;
5064 for (int i = 0; i < function->getParamCount(); i++) {
5065 const TParameter& param = function->getParam(i);
5066 if (param.name != 0) {
5067 TVariable *variable = new TVariable(param.name, *param.type);
5068 //
5069 // Insert the parameters with name in the symbol table.
5070 //
Nicolas Capensd603ecd2015-02-18 14:52:21 -05005071 if (! context->symbolTable.declare(*variable)) {
John Bauman66b8ab22014-05-06 15:57:45 -04005072 context->error((yyvsp[(1) - (1)].interm).line, "redefinition", variable->getName().c_str());
5073 context->recover();
5074 delete variable;
5075 }
5076
5077 //
5078 // Add the parameter to the HIL
5079 //
5080 paramNodes = context->intermediate.growAggregate(
5081 paramNodes,
5082 context->intermediate.addSymbol(variable->getUniqueId(),
5083 variable->getName(),
5084 variable->getType(), (yyvsp[(1) - (1)].interm).line),
5085 (yyvsp[(1) - (1)].interm).line);
5086 } else {
5087 paramNodes = context->intermediate.growAggregate(paramNodes, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (1)].interm).line), (yyvsp[(1) - (1)].interm).line);
5088 }
5089 }
5090 context->intermediate.setAggregateOperator(paramNodes, EOpParameters, (yyvsp[(1) - (1)].interm).line);
5091 (yyvsp[(1) - (1)].interm).intermAggregate = paramNodes;
5092 context->loopNestingLevel = 0;
5093 }
5094 break;
5095
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04005096 case 242:
John Bauman66b8ab22014-05-06 15:57:45 -04005097
5098 {
5099 //?? Check that all paths return a value if return type != void ?
5100 // May be best done as post process phase on intermediate code
5101 if (context->currentFunctionType->getBasicType() != EbtVoid && ! context->functionReturnsValue) {
5102 context->error((yyvsp[(1) - (3)].interm).line, "function does not return a value:", "", (yyvsp[(1) - (3)].interm).function->getName().c_str());
5103 context->recover();
5104 }
5105
5106 (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermAggregate, (yyvsp[(3) - (3)].interm.intermNode), 0);
5107 context->intermediate.setAggregateOperator((yyval.interm.intermNode), EOpFunction, (yyvsp[(1) - (3)].interm).line);
5108 (yyval.interm.intermNode)->getAsAggregate()->setName((yyvsp[(1) - (3)].interm).function->getMangledName().c_str());
5109 (yyval.interm.intermNode)->getAsAggregate()->setType((yyvsp[(1) - (3)].interm).function->getReturnType());
5110
5111 // store the pragma information for debug and optimize and other vendor specific
5112 // information. This information can be queried from the parse tree
5113 (yyval.interm.intermNode)->getAsAggregate()->setOptimize(context->pragma().optimize);
5114 (yyval.interm.intermNode)->getAsAggregate()->setDebug(context->pragma().debug);
5115
5116 if ((yyvsp[(3) - (3)].interm.intermNode) && (yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate())
5117 (yyval.interm.intermNode)->getAsAggregate()->setEndLine((yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate()->getEndLine());
5118
5119 context->symbolTable.pop();
5120 }
5121 break;
5122
5123
5124
5125 default: break;
5126 }
5127 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
5128
5129 YYPOPSTACK (yylen);
5130 yylen = 0;
5131 YY_STACK_PRINT (yyss, yyssp);
5132
5133 *++yyvsp = yyval;
5134
5135 /* Now `shift' the result of the reduction. Determine what state
5136 that goes to, based on the state we popped back to and the rule
5137 number reduced by. */
5138
5139 yyn = yyr1[yyn];
5140
5141 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
5142 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
5143 yystate = yytable[yystate];
5144 else
5145 yystate = yydefgoto[yyn - YYNTOKENS];
5146
5147 goto yynewstate;
5148
5149
5150/*------------------------------------.
5151| yyerrlab -- here on detecting error |
5152`------------------------------------*/
5153yyerrlab:
5154 /* If not already recovering from an error, report this error. */
5155 if (!yyerrstatus)
5156 {
5157 ++yynerrs;
5158#if ! YYERROR_VERBOSE
5159 yyerror (context, YY_("syntax error"));
5160#else
5161 {
5162 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
5163 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
5164 {
5165 YYSIZE_T yyalloc = 2 * yysize;
5166 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
5167 yyalloc = YYSTACK_ALLOC_MAXIMUM;
5168 if (yymsg != yymsgbuf)
5169 YYSTACK_FREE (yymsg);
5170 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
5171 if (yymsg)
5172 yymsg_alloc = yyalloc;
5173 else
5174 {
5175 yymsg = yymsgbuf;
5176 yymsg_alloc = sizeof yymsgbuf;
5177 }
5178 }
5179
5180 if (0 < yysize && yysize <= yymsg_alloc)
5181 {
5182 (void) yysyntax_error (yymsg, yystate, yychar);
5183 yyerror (context, yymsg);
5184 }
5185 else
5186 {
5187 yyerror (context, YY_("syntax error"));
5188 if (yysize != 0)
5189 goto yyexhaustedlab;
5190 }
5191 }
5192#endif
5193 }
5194
5195
5196
5197 if (yyerrstatus == 3)
5198 {
5199 /* If just tried and failed to reuse lookahead token after an
5200 error, discard it. */
5201
5202 if (yychar <= YYEOF)
5203 {
5204 /* Return failure if at end of input. */
5205 if (yychar == YYEOF)
5206 YYABORT;
5207 }
5208 else
5209 {
5210 yydestruct ("Error: discarding",
5211 yytoken, &yylval, context);
5212 yychar = YYEMPTY;
5213 }
5214 }
5215
5216 /* Else will try to reuse lookahead token after shifting the error
5217 token. */
5218 goto yyerrlab1;
5219
5220
5221/*---------------------------------------------------.
5222| yyerrorlab -- error raised explicitly by YYERROR. |
5223`---------------------------------------------------*/
5224yyerrorlab:
5225
5226 /* Pacify compilers like GCC when the user code never invokes
5227 YYERROR and the label yyerrorlab therefore never appears in user
5228 code. */
5229 if (/*CONSTCOND*/ 0)
5230 goto yyerrorlab;
5231
5232 /* Do not reclaim the symbols of the rule which action triggered
5233 this YYERROR. */
5234 YYPOPSTACK (yylen);
5235 yylen = 0;
5236 YY_STACK_PRINT (yyss, yyssp);
5237 yystate = *yyssp;
5238 goto yyerrlab1;
5239
5240
5241/*-------------------------------------------------------------.
5242| yyerrlab1 -- common code for both syntax error and YYERROR. |
5243`-------------------------------------------------------------*/
5244yyerrlab1:
5245 yyerrstatus = 3; /* Each real token shifted decrements this. */
5246
5247 for (;;)
5248 {
5249 yyn = yypact[yystate];
5250 if (yyn != YYPACT_NINF)
5251 {
5252 yyn += YYTERROR;
5253 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
5254 {
5255 yyn = yytable[yyn];
5256 if (0 < yyn)
5257 break;
5258 }
5259 }
5260
5261 /* Pop the current state because it cannot handle the error token. */
5262 if (yyssp == yyss)
5263 YYABORT;
5264
5265
5266 yydestruct ("Error: popping",
5267 yystos[yystate], yyvsp, context);
5268 YYPOPSTACK (1);
5269 yystate = *yyssp;
5270 YY_STACK_PRINT (yyss, yyssp);
5271 }
5272
5273 *++yyvsp = yylval;
5274
5275
5276 /* Shift the error token. */
5277 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
5278
5279 yystate = yyn;
5280 goto yynewstate;
5281
5282
5283/*-------------------------------------.
5284| yyacceptlab -- YYACCEPT comes here. |
5285`-------------------------------------*/
5286yyacceptlab:
5287 yyresult = 0;
5288 goto yyreturn;
5289
5290/*-----------------------------------.
5291| yyabortlab -- YYABORT comes here. |
5292`-----------------------------------*/
5293yyabortlab:
5294 yyresult = 1;
5295 goto yyreturn;
5296
5297#if !defined(yyoverflow) || YYERROR_VERBOSE
5298/*-------------------------------------------------.
5299| yyexhaustedlab -- memory exhaustion comes here. |
5300`-------------------------------------------------*/
5301yyexhaustedlab:
5302 yyerror (context, YY_("memory exhausted"));
5303 yyresult = 2;
5304 /* Fall through. */
5305#endif
5306
5307yyreturn:
5308 if (yychar != YYEMPTY)
5309 yydestruct ("Cleanup: discarding lookahead",
5310 yytoken, &yylval, context);
5311 /* Do not reclaim the symbols of the rule which action triggered
5312 this YYABORT or YYACCEPT. */
5313 YYPOPSTACK (yylen);
5314 YY_STACK_PRINT (yyss, yyssp);
5315 while (yyssp != yyss)
5316 {
5317 yydestruct ("Cleanup: popping",
5318 yystos[*yyssp], yyvsp, context);
5319 YYPOPSTACK (1);
5320 }
5321#ifndef yyoverflow
5322 if (yyss != yyssa)
5323 YYSTACK_FREE (yyss);
5324#endif
5325#if YYERROR_VERBOSE
5326 if (yymsg != yymsgbuf)
5327 YYSTACK_FREE (yymsg);
5328#endif
5329 /* Make sure YYID is used. */
5330 return YYID (yyresult);
5331}
5332
5333
5334
5335
5336
5337int glslang_parse(TParseContext* context) {
5338 return yyparse(context);
5339}
5340