blob: 5919e805cb52998ce526a540515a64f12331e2b3 [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,
730 586, 593, 597, 604, 610, 619, 627, 696, 703, 713,
731 716, 726, 736, 757, 758, 759, 764, 765, 774, 786,
732 787, 795, 806, 810, 811, 821, 831, 841, 854, 855,
733 865, 878, 882, 886, 890, 891, 904, 905, 918, 919,
734 932, 933, 950, 951, 964, 965, 966, 967, 968, 972,
735 975, 986, 994, 1021, 1026, 1036, 1074, 1077, 1084, 1092,
736 1113, 1134, 1145, 1174, 1179, 1189, 1194, 1204, 1207, 1210,
737 1213, 1219, 1226, 1229, 1251, 1269, 1293, 1316, 1320, 1338,
Alexis Hetu55a2cbc2015-04-16 10:49:45 -0400738 1346, 1378, 1398, 1486, 1495, 1518, 1521, 1527, 1533, 1540,
739 1549, 1558, 1561, 1564, 1571, 1575, 1582, 1586, 1591, 1596,
740 1602, 1608, 1617, 1627, 1634, 1637, 1640, 1646, 1653, 1656,
741 1662, 1665, 1668, 1674, 1677, 1692, 1696, 1700, 1704, 1708,
742 1712, 1717, 1722, 1727, 1732, 1737, 1742, 1747, 1752, 1757,
743 1762, 1767, 1772, 1778, 1784, 1790, 1796, 1802, 1808, 1814,
744 1820, 1826, 1831, 1836, 1845, 1850, 1855, 1860, 1865, 1870,
745 1875, 1880, 1885, 1890, 1895, 1900, 1905, 1910, 1915, 1928,
746 1928, 1942, 1942, 1951, 1954, 1969, 2001, 2005, 2011, 2019,
747 2035, 2039, 2043, 2044, 2050, 2051, 2052, 2053, 2054, 2058,
748 2059, 2059, 2059, 2069, 2070, 2074, 2074, 2075, 2075, 2080,
749 2083, 2093, 2096, 2102, 2103, 2107, 2115, 2119, 2129, 2134,
750 2151, 2151, 2156, 2156, 2163, 2163, 2171, 2174, 2180, 2183,
751 2189, 2193, 2200, 2207, 2214, 2221, 2232, 2241, 2245, 2252,
752 2255, 2261, 2261
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;
2837 case EbtBool:
Alexis Hetub14178b2015-04-13 13:23:20 -04002838 switch((yyvsp[(1) - (1)].interm.type).primarySize) {
John Bauman66b8ab22014-05-06 15:57:45 -04002839 case 1: op = EOpConstructBool; break;
2840 case 2: FRAG_VERT_ONLY("bvec2", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec2; break;
2841 case 3: FRAG_VERT_ONLY("bvec3", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec3; break;
2842 case 4: FRAG_VERT_ONLY("bvec4", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec4; break;
2843 }
2844 break;
2845 default: break;
2846 }
2847 if (op == EOpNull) {
2848 context->error((yyvsp[(1) - (1)].interm.type).line, "cannot construct this type", getBasicString((yyvsp[(1) - (1)].interm.type).type));
2849 context->recover();
2850 (yyvsp[(1) - (1)].interm.type).type = EbtFloat;
2851 op = EOpConstructFloat;
2852 }
2853 }
2854 TString tempString;
2855 TType type((yyvsp[(1) - (1)].interm.type));
2856 TFunction *function = new TFunction(&tempString, type, op);
2857 (yyval.interm.function) = function;
2858 }
2859 break;
2860
John Bauman66b8ab22014-05-06 15:57:45 -04002861 case 27:
2862
2863 {
2864 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
2865 context->recover();
2866 TType type(EbtVoid, EbpUndefined);
2867 TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type);
2868 (yyval.interm.function) = function;
2869 }
2870 break;
2871
2872 case 28:
2873
2874 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002875 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
2876 context->recover();
2877 TType type(EbtVoid, EbpUndefined);
2878 TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type);
2879 (yyval.interm.function) = function;
John Bauman66b8ab22014-05-06 15:57:45 -04002880 }
2881 break;
2882
2883 case 29:
2884
2885 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002886 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
2887 }
2888 break;
2889
2890 case 30:
2891
2892 {
John Bauman66b8ab22014-05-06 15:57:45 -04002893 if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)))
2894 context->recover();
John Baumand4ae8632014-05-06 16:18:33 -04002895 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreIncrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002896 if ((yyval.interm.intermTypedNode) == 0) {
2897 context->unaryOpError((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2898 context->recover();
2899 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2900 }
2901 }
2902 break;
2903
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002904 case 31:
John Bauman66b8ab22014-05-06 15:57:45 -04002905
2906 {
2907 if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)))
2908 context->recover();
John Baumand4ae8632014-05-06 16:18:33 -04002909 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreDecrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002910 if ((yyval.interm.intermTypedNode) == 0) {
2911 context->unaryOpError((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2912 context->recover();
2913 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2914 }
2915 }
2916 break;
2917
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002918 case 32:
John Bauman66b8ab22014-05-06 15:57:45 -04002919
2920 {
2921 if ((yyvsp[(1) - (2)].interm).op != EOpNull) {
John Baumand4ae8632014-05-06 16:18:33 -04002922 (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 -04002923 if ((yyval.interm.intermTypedNode) == 0) {
2924 const char* errorOp = "";
2925 switch((yyvsp[(1) - (2)].interm).op) {
2926 case EOpNegative: errorOp = "-"; break;
2927 case EOpLogicalNot: errorOp = "!"; break;
2928 default: break;
2929 }
2930 context->unaryOpError((yyvsp[(1) - (2)].interm).line, errorOp, (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2931 context->recover();
2932 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2933 }
2934 } else
2935 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2936 }
2937 break;
2938
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002939 case 33:
John Bauman66b8ab22014-05-06 15:57:45 -04002940
2941 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNull; }
2942 break;
2943
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002944 case 34:
John Bauman66b8ab22014-05-06 15:57:45 -04002945
2946 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNegative; }
2947 break;
2948
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002949 case 35:
John Bauman66b8ab22014-05-06 15:57:45 -04002950
2951 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpLogicalNot; }
2952 break;
2953
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002954 case 36:
John Bauman66b8ab22014-05-06 15:57:45 -04002955
2956 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
2957 break;
2958
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002959 case 37:
John Bauman66b8ab22014-05-06 15:57:45 -04002960
2961 {
2962 FRAG_VERT_ONLY("*", (yyvsp[(2) - (3)].lex).line);
John Baumand4ae8632014-05-06 16:18:33 -04002963 (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 -04002964 if ((yyval.interm.intermTypedNode) == 0) {
2965 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "*", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2966 context->recover();
2967 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2968 }
2969 }
2970 break;
2971
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002972 case 38:
John Bauman66b8ab22014-05-06 15:57:45 -04002973
2974 {
2975 FRAG_VERT_ONLY("/", (yyvsp[(2) - (3)].lex).line);
John Baumand4ae8632014-05-06 16:18:33 -04002976 (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 -04002977 if ((yyval.interm.intermTypedNode) == 0) {
2978 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "/", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2979 context->recover();
2980 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2981 }
2982 }
2983 break;
2984
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002985 case 39:
John Bauman66b8ab22014-05-06 15:57:45 -04002986
2987 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
2988 break;
2989
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002990 case 40:
John Bauman66b8ab22014-05-06 15:57:45 -04002991
2992 {
John Baumand4ae8632014-05-06 16:18:33 -04002993 (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 -04002994 if ((yyval.interm.intermTypedNode) == 0) {
2995 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "+", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2996 context->recover();
2997 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2998 }
2999 }
3000 break;
3001
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003002 case 41:
John Bauman66b8ab22014-05-06 15:57:45 -04003003
3004 {
John Baumand4ae8632014-05-06 16:18:33 -04003005 (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 -04003006 if ((yyval.interm.intermTypedNode) == 0) {
3007 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "-", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3008 context->recover();
3009 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
3010 }
3011 }
3012 break;
3013
John Bauman66b8ab22014-05-06 15:57:45 -04003014 case 42:
3015
3016 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
3017 break;
3018
3019 case 43:
3020
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003021 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
3022 break;
3023
3024 case 44:
3025
John Bauman66b8ab22014-05-06 15:57:45 -04003026 {
John Baumand4ae8632014-05-06 16:18:33 -04003027 (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 -04003028 if ((yyval.interm.intermTypedNode) == 0) {
3029 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3030 context->recover();
3031 ConstantUnion *unionArray = new ConstantUnion[1];
3032 unionArray->setBConst(false);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05003033 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConstExpr), (yyvsp[(2) - (3)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003034 }
3035 }
3036 break;
3037
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003038 case 45:
John Bauman66b8ab22014-05-06 15:57:45 -04003039
3040 {
John Baumand4ae8632014-05-06 16:18:33 -04003041 (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 -04003042 if ((yyval.interm.intermTypedNode) == 0) {
3043 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3044 context->recover();
3045 ConstantUnion *unionArray = new ConstantUnion[1];
3046 unionArray->setBConst(false);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05003047 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConstExpr), (yyvsp[(2) - (3)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003048 }
3049 }
3050 break;
3051
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003052 case 46:
John Bauman66b8ab22014-05-06 15:57:45 -04003053
3054 {
John Baumand4ae8632014-05-06 16:18:33 -04003055 (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 -04003056 if ((yyval.interm.intermTypedNode) == 0) {
3057 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3058 context->recover();
3059 ConstantUnion *unionArray = new ConstantUnion[1];
3060 unionArray->setBConst(false);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05003061 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConstExpr), (yyvsp[(2) - (3)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003062 }
3063 }
3064 break;
3065
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003066 case 47:
John Bauman66b8ab22014-05-06 15:57:45 -04003067
3068 {
John Baumand4ae8632014-05-06 16:18:33 -04003069 (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 -04003070 if ((yyval.interm.intermTypedNode) == 0) {
3071 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3072 context->recover();
3073 ConstantUnion *unionArray = new ConstantUnion[1];
3074 unionArray->setBConst(false);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05003075 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConstExpr), (yyvsp[(2) - (3)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003076 }
3077 }
3078 break;
3079
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003080 case 48:
John Bauman66b8ab22014-05-06 15:57:45 -04003081
3082 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
3083 break;
3084
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003085 case 49:
John Bauman66b8ab22014-05-06 15:57:45 -04003086
3087 {
John Baumand4ae8632014-05-06 16:18:33 -04003088 (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 -04003089 if ((yyval.interm.intermTypedNode) == 0) {
3090 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "==", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3091 context->recover();
3092 ConstantUnion *unionArray = new ConstantUnion[1];
3093 unionArray->setBConst(false);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05003094 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConstExpr), (yyvsp[(2) - (3)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003095 }
3096 }
3097 break;
3098
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003099 case 50:
John Bauman66b8ab22014-05-06 15:57:45 -04003100
3101 {
John Baumand4ae8632014-05-06 16:18:33 -04003102 (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 -04003103 if ((yyval.interm.intermTypedNode) == 0) {
3104 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "!=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3105 context->recover();
3106 ConstantUnion *unionArray = new ConstantUnion[1];
3107 unionArray->setBConst(false);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05003108 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConstExpr), (yyvsp[(2) - (3)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003109 }
3110 }
3111 break;
3112
John Bauman66b8ab22014-05-06 15:57:45 -04003113 case 51:
3114
3115 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
3116 break;
3117
3118 case 52:
3119
3120 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
3121 break;
3122
3123 case 53:
3124
3125 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
3126 break;
3127
3128 case 54:
3129
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003130 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
3131 break;
3132
3133 case 55:
3134
John Bauman66b8ab22014-05-06 15:57:45 -04003135 {
John Baumand4ae8632014-05-06 16:18:33 -04003136 (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 -04003137 if ((yyval.interm.intermTypedNode) == 0) {
3138 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "&&", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3139 context->recover();
3140 ConstantUnion *unionArray = new ConstantUnion[1];
3141 unionArray->setBConst(false);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05003142 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConstExpr), (yyvsp[(2) - (3)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003143 }
3144 }
3145 break;
3146
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003147 case 56:
John Bauman66b8ab22014-05-06 15:57:45 -04003148
3149 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
3150 break;
3151
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003152 case 57:
John Bauman66b8ab22014-05-06 15:57:45 -04003153
3154 {
John Baumand4ae8632014-05-06 16:18:33 -04003155 (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 -04003156 if ((yyval.interm.intermTypedNode) == 0) {
3157 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "^^", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3158 context->recover();
3159 ConstantUnion *unionArray = new ConstantUnion[1];
3160 unionArray->setBConst(false);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05003161 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConstExpr), (yyvsp[(2) - (3)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003162 }
3163 }
3164 break;
3165
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003166 case 58:
John Bauman66b8ab22014-05-06 15:57:45 -04003167
3168 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
3169 break;
3170
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003171 case 59:
John Bauman66b8ab22014-05-06 15:57:45 -04003172
3173 {
John Baumand4ae8632014-05-06 16:18:33 -04003174 (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 -04003175 if ((yyval.interm.intermTypedNode) == 0) {
3176 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "||", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3177 context->recover();
3178 ConstantUnion *unionArray = new ConstantUnion[1];
3179 unionArray->setBConst(false);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05003180 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConstExpr), (yyvsp[(2) - (3)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003181 }
3182 }
3183 break;
3184
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003185 case 60:
John Bauman66b8ab22014-05-06 15:57:45 -04003186
3187 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
3188 break;
3189
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003190 case 61:
John Bauman66b8ab22014-05-06 15:57:45 -04003191
3192 {
3193 if (context->boolErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.intermTypedNode)))
3194 context->recover();
3195
3196 (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);
3197 if ((yyvsp[(3) - (5)].interm.intermTypedNode)->getType() != (yyvsp[(5) - (5)].interm.intermTypedNode)->getType())
3198 (yyval.interm.intermTypedNode) = 0;
3199
3200 if ((yyval.interm.intermTypedNode) == 0) {
3201 context->binaryOpError((yyvsp[(2) - (5)].lex).line, ":", (yyvsp[(3) - (5)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(5) - (5)].interm.intermTypedNode)->getCompleteString());
3202 context->recover();
3203 (yyval.interm.intermTypedNode) = (yyvsp[(5) - (5)].interm.intermTypedNode);
3204 }
3205 }
3206 break;
3207
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003208 case 62:
John Bauman66b8ab22014-05-06 15:57:45 -04003209
3210 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
3211 break;
3212
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003213 case 63:
John Bauman66b8ab22014-05-06 15:57:45 -04003214
3215 {
3216 if (context->lValueErrorCheck((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)))
3217 context->recover();
3218 (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);
3219 if ((yyval.interm.intermTypedNode) == 0) {
3220 context->assignError((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3221 context->recover();
3222 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
3223 }
3224 }
3225 break;
3226
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003227 case 64:
John Bauman66b8ab22014-05-06 15:57:45 -04003228
3229 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAssign; }
3230 break;
3231
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003232 case 65:
John Bauman66b8ab22014-05-06 15:57:45 -04003233
3234 { FRAG_VERT_ONLY("*=", (yyvsp[(1) - (1)].lex).line); (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpMulAssign; }
3235 break;
3236
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003237 case 66:
John Bauman66b8ab22014-05-06 15:57:45 -04003238
3239 { FRAG_VERT_ONLY("/=", (yyvsp[(1) - (1)].lex).line); (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpDivAssign; }
3240 break;
3241
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003242 case 67:
John Bauman66b8ab22014-05-06 15:57:45 -04003243
3244 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAddAssign; }
3245 break;
3246
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003247 case 68:
John Bauman66b8ab22014-05-06 15:57:45 -04003248
3249 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpSubAssign; }
3250 break;
3251
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003252 case 69:
John Bauman66b8ab22014-05-06 15:57:45 -04003253
3254 {
3255 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
3256 }
3257 break;
3258
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003259 case 70:
John Bauman66b8ab22014-05-06 15:57:45 -04003260
3261 {
3262 (yyval.interm.intermTypedNode) = context->intermediate.addComma((yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
3263 if ((yyval.interm.intermTypedNode) == 0) {
3264 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ",", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3265 context->recover();
3266 (yyval.interm.intermTypedNode) = (yyvsp[(3) - (3)].interm.intermTypedNode);
3267 }
3268 }
3269 break;
3270
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003271 case 71:
John Bauman66b8ab22014-05-06 15:57:45 -04003272
3273 {
3274 if (context->constErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)))
3275 context->recover();
3276 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
3277 }
3278 break;
3279
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003280 case 72:
John Bauman66b8ab22014-05-06 15:57:45 -04003281
3282 {
3283 TFunction &function = *((yyvsp[(1) - (2)].interm).function);
3284
3285 TIntermAggregate *prototype = new TIntermAggregate;
3286 prototype->setType(function.getReturnType());
3287 prototype->setName(function.getName());
3288
3289 for (int i = 0; i < function.getParamCount(); i++)
3290 {
3291 const TParameter &param = function.getParam(i);
3292 if (param.name != 0)
3293 {
John Baumand4ae8632014-05-06 16:18:33 -04003294 TVariable variable(param.name, *param.type);
John Bauman66b8ab22014-05-06 15:57:45 -04003295
John Baumand4ae8632014-05-06 16:18:33 -04003296 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 -04003297 }
3298 else
3299 {
3300 prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (2)].interm).line), (yyvsp[(1) - (2)].interm).line);
3301 }
3302 }
3303
3304 prototype->setOp(EOpPrototype);
3305 (yyval.interm.intermNode) = prototype;
3306
3307 context->symbolTable.pop();
3308 }
3309 break;
3310
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003311 case 73:
John Bauman66b8ab22014-05-06 15:57:45 -04003312
3313 {
3314 if ((yyvsp[(1) - (2)].interm).intermAggregate)
3315 (yyvsp[(1) - (2)].interm).intermAggregate->setOp(EOpDeclaration);
3316 (yyval.interm.intermNode) = (yyvsp[(1) - (2)].interm).intermAggregate;
3317 }
3318 break;
3319
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003320 case 74:
John Bauman66b8ab22014-05-06 15:57:45 -04003321
3322 {
John Baumand4ae8632014-05-06 16:18:33 -04003323 if (!context->symbolTable.setDefaultPrecision( (yyvsp[(3) - (4)].interm.type), (yyvsp[(2) - (4)].interm.precision) )) {
3324 context->error((yyvsp[(1) - (4)].lex).line, "illegal type argument for default precision qualifier", getBasicString((yyvsp[(3) - (4)].interm.type).type));
3325 context->recover();
3326 }
John Bauman66b8ab22014-05-06 15:57:45 -04003327 (yyval.interm.intermNode) = 0;
3328 }
3329 break;
3330
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003331 case 75:
John Bauman66b8ab22014-05-06 15:57:45 -04003332
3333 {
3334 //
3335 // Multiple declarations of the same function are allowed.
3336 //
3337 // If this is a definition, the definition production code will check for redefinitions
3338 // (we don't know at this point if it's a definition or not).
3339 //
3340 // Redeclarations are allowed. But, return types and parameter qualifiers must match.
3341 //
Nicolas Capens0a7f0c22015-02-18 14:47:31 -05003342 TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find((yyvsp[(1) - (2)].interm.function)->getMangledName(), context->shaderVersion));
John Bauman66b8ab22014-05-06 15:57:45 -04003343 if (prevDec) {
3344 if (prevDec->getReturnType() != (yyvsp[(1) - (2)].interm.function)->getReturnType()) {
3345 context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same return type", (yyvsp[(1) - (2)].interm.function)->getReturnType().getBasicString());
3346 context->recover();
3347 }
3348 for (int i = 0; i < prevDec->getParamCount(); ++i) {
3349 if (prevDec->getParam(i).type->getQualifier() != (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifier()) {
3350 context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same parameter qualifiers", (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifierString());
3351 context->recover();
3352 }
3353 }
3354 }
3355
3356 //
3357 // If this is a redeclaration, it could also be a definition,
3358 // in which case, we want to use the variable names from this one, and not the one that's
3359 // being redeclared. So, pass back up this declaration, not the one in the symbol table.
3360 //
3361 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
3362 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
3363
3364 // We're at the inner scope level of the function's arguments and body statement.
3365 // Add the function prototype to the surrounding scope instead.
3366 context->symbolTable.getOuterLevel()->insert(*(yyval.interm).function);
3367 }
3368 break;
3369
John Bauman66b8ab22014-05-06 15:57:45 -04003370 case 76:
3371
3372 {
3373 (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
3374 }
3375 break;
3376
3377 case 77:
3378
3379 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003380 (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
3381 }
3382 break;
3383
3384 case 78:
3385
3386 {
John Bauman66b8ab22014-05-06 15:57:45 -04003387 // Add the parameter
3388 (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
3389 if ((yyvsp[(2) - (2)].interm).param.type->getBasicType() != EbtVoid)
3390 (yyvsp[(1) - (2)].interm.function)->addParameter((yyvsp[(2) - (2)].interm).param);
3391 else
3392 delete (yyvsp[(2) - (2)].interm).param.type;
3393 }
3394 break;
3395
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003396 case 79:
John Bauman66b8ab22014-05-06 15:57:45 -04003397
3398 {
3399 //
3400 // Only first parameter of one-parameter functions can be void
3401 // The check for named parameters not being void is done in parameter_declarator
3402 //
3403 if ((yyvsp[(3) - (3)].interm).param.type->getBasicType() == EbtVoid) {
3404 //
3405 // This parameter > first is void
3406 //
3407 context->error((yyvsp[(2) - (3)].lex).line, "cannot be an argument type except for '(void)'", "void");
3408 context->recover();
3409 delete (yyvsp[(3) - (3)].interm).param.type;
3410 } else {
3411 // Add the parameter
3412 (yyval.interm.function) = (yyvsp[(1) - (3)].interm.function);
3413 (yyvsp[(1) - (3)].interm.function)->addParameter((yyvsp[(3) - (3)].interm).param);
3414 }
3415 }
3416 break;
3417
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003418 case 80:
John Bauman66b8ab22014-05-06 15:57:45 -04003419
3420 {
3421 if ((yyvsp[(1) - (3)].interm.type).qualifier != EvqGlobal && (yyvsp[(1) - (3)].interm.type).qualifier != EvqTemporary) {
3422 context->error((yyvsp[(2) - (3)].lex).line, "no qualifiers allowed for function return", getQualifierString((yyvsp[(1) - (3)].interm.type).qualifier));
3423 context->recover();
3424 }
3425 // make sure a sampler is not involved as well...
3426 if (context->structQualifierErrorCheck((yyvsp[(2) - (3)].lex).line, (yyvsp[(1) - (3)].interm.type)))
3427 context->recover();
3428
3429 // Add the function as a prototype after parsing it (we do not support recursion)
3430 TFunction *function;
3431 TType type((yyvsp[(1) - (3)].interm.type));
3432 function = new TFunction((yyvsp[(2) - (3)].lex).string, type);
3433 (yyval.interm.function) = function;
3434
3435 context->symbolTable.push();
3436 }
3437 break;
3438
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003439 case 81:
John Bauman66b8ab22014-05-06 15:57:45 -04003440
3441 {
3442 if ((yyvsp[(1) - (2)].interm.type).type == EbtVoid) {
3443 context->error((yyvsp[(2) - (2)].lex).line, "illegal use of type 'void'", (yyvsp[(2) - (2)].lex).string->c_str());
3444 context->recover();
3445 }
3446 if (context->reservedErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string))
3447 context->recover();
3448 TParameter param = {(yyvsp[(2) - (2)].lex).string, new TType((yyvsp[(1) - (2)].interm.type))};
3449 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
3450 (yyval.interm).param = param;
3451 }
3452 break;
3453
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003454 case 82:
John Bauman66b8ab22014-05-06 15:57:45 -04003455
3456 {
3457 // Check that we can make an array out of this type
3458 if (context->arrayTypeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
3459 context->recover();
3460
3461 if (context->reservedErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string))
3462 context->recover();
3463
3464 int size;
3465 if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3466 context->recover();
3467 (yyvsp[(1) - (5)].interm.type).setArray(true, size);
3468
3469 TType* type = new TType((yyvsp[(1) - (5)].interm.type));
3470 TParameter param = { (yyvsp[(2) - (5)].lex).string, type };
3471 (yyval.interm).line = (yyvsp[(2) - (5)].lex).line;
3472 (yyval.interm).param = param;
3473 }
3474 break;
3475
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003476 case 83:
John Bauman66b8ab22014-05-06 15:57:45 -04003477
3478 {
3479 (yyval.interm) = (yyvsp[(3) - (3)].interm);
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003480 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 -04003481 context->recover();
3482 }
3483 break;
3484
John Bauman66b8ab22014-05-06 15:57:45 -04003485 case 84:
3486
3487 {
John Bauman66b8ab22014-05-06 15:57:45 -04003488 (yyval.interm) = (yyvsp[(2) - (2)].interm);
3489 if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
3490 context->recover();
3491 if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
3492 context->recover();
3493 }
3494 break;
3495
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003496 case 85:
3497
3498 {
3499 (yyval.interm) = (yyvsp[(3) - (3)].interm);
3500 if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.qualifier), (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
3501 context->recover();
3502 }
3503 break;
3504
John Bauman66b8ab22014-05-06 15:57:45 -04003505 case 86:
3506
3507 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003508 (yyval.interm) = (yyvsp[(2) - (2)].interm);
3509 if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
3510 context->recover();
3511 if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
3512 context->recover();
John Bauman66b8ab22014-05-06 15:57:45 -04003513 }
3514 break;
3515
3516 case 87:
3517
3518 {
3519 (yyval.interm.qualifier) = EvqIn;
3520 }
3521 break;
3522
3523 case 88:
3524
3525 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003526 (yyval.interm.qualifier) = EvqIn;
John Bauman66b8ab22014-05-06 15:57:45 -04003527 }
3528 break;
3529
3530 case 89:
3531
3532 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003533 (yyval.interm.qualifier) = EvqOut;
John Bauman66b8ab22014-05-06 15:57:45 -04003534 }
3535 break;
3536
3537 case 90:
3538
3539 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003540 (yyval.interm.qualifier) = EvqInOut;
3541 }
3542 break;
3543
3544 case 91:
3545
3546 {
John Bauman66b8ab22014-05-06 15:57:45 -04003547 TParameter param = { 0, new TType((yyvsp[(1) - (1)].interm.type)) };
3548 (yyval.interm).param = param;
3549 }
3550 break;
3551
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003552 case 92:
John Bauman66b8ab22014-05-06 15:57:45 -04003553
3554 {
3555 (yyval.interm) = (yyvsp[(1) - (1)].interm);
3556 }
3557 break;
3558
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003559 case 93:
John Bauman66b8ab22014-05-06 15:57:45 -04003560
3561 {
3562 if ((yyvsp[(1) - (3)].interm).type.type == EbtInvariant && !(yyvsp[(3) - (3)].lex).symbol)
3563 {
3564 context->error((yyvsp[(3) - (3)].lex).line, "undeclared identifier declared as invariant", (yyvsp[(3) - (3)].lex).string->c_str());
3565 context->recover();
3566 }
3567
3568 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(3) - (3)].lex).string, TType((yyvsp[(1) - (3)].interm).type), (yyvsp[(3) - (3)].lex).line);
3569 (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermNode, symbol, (yyvsp[(3) - (3)].lex).line);
3570
3571 if (context->structQualifierErrorCheck((yyvsp[(3) - (3)].lex).line, (yyval.interm).type))
3572 context->recover();
3573
3574 if (context->nonInitConstErrorCheck((yyvsp[(3) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyval.interm).type, false))
3575 context->recover();
3576
3577 TVariable* variable = 0;
3578 if (context->nonInitErrorCheck((yyvsp[(3) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyval.interm).type, variable))
3579 context->recover();
3580 if (symbol && variable)
3581 symbol->setId(variable->getUniqueId());
3582 }
3583 break;
3584
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003585 case 94:
John Bauman66b8ab22014-05-06 15:57:45 -04003586
3587 {
3588 if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
3589 context->recover();
3590
3591 if (context->nonInitConstErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, true))
3592 context->recover();
3593
3594 (yyval.interm) = (yyvsp[(1) - (5)].interm);
3595
3596 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))
3597 context->recover();
3598 else {
3599 (yyvsp[(1) - (5)].interm).type.setArray(true);
3600 TVariable* variable;
3601 if (context->arrayErrorCheck((yyvsp[(4) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, variable))
3602 context->recover();
3603 }
3604 }
3605 break;
3606
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003607 case 95:
John Bauman66b8ab22014-05-06 15:57:45 -04003608
3609 {
3610 if (context->structQualifierErrorCheck((yyvsp[(3) - (6)].lex).line, (yyvsp[(1) - (6)].interm).type))
3611 context->recover();
3612
3613 if (context->nonInitConstErrorCheck((yyvsp[(3) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type, true))
3614 context->recover();
3615
3616 (yyval.interm) = (yyvsp[(1) - (6)].interm);
3617
3618 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))
3619 context->recover();
3620 else {
3621 int size;
3622 if (context->arraySizeErrorCheck((yyvsp[(4) - (6)].lex).line, (yyvsp[(5) - (6)].interm.intermTypedNode), size))
3623 context->recover();
3624 (yyvsp[(1) - (6)].interm).type.setArray(true, size);
3625 TVariable* variable = 0;
3626 if (context->arrayErrorCheck((yyvsp[(4) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type, variable))
3627 context->recover();
3628 TType type = TType((yyvsp[(1) - (6)].interm).type);
3629 type.setArraySize(size);
3630 (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);
3631 }
3632 }
3633 break;
3634
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003635 case 96:
John Bauman66b8ab22014-05-06 15:57:45 -04003636
3637 {
3638 if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
3639 context->recover();
3640
3641 (yyval.interm) = (yyvsp[(1) - (5)].interm);
3642
3643 TIntermNode* intermNode;
3644 if (!context->executeInitializer((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, (yyvsp[(5) - (5)].interm.intermTypedNode), intermNode)) {
3645 //
3646 // build the intermediate representation
3647 //
3648 if (intermNode)
3649 (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (5)].interm).intermNode, intermNode, (yyvsp[(4) - (5)].lex).line);
3650 else
3651 (yyval.interm).intermAggregate = (yyvsp[(1) - (5)].interm).intermAggregate;
3652 } else {
3653 context->recover();
3654 (yyval.interm).intermAggregate = 0;
3655 }
3656 }
3657 break;
3658
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003659 case 97:
John Bauman66b8ab22014-05-06 15:57:45 -04003660
3661 {
3662 (yyval.interm).type = (yyvsp[(1) - (1)].interm.type);
3663 (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);
3664 }
3665 break;
3666
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003667 case 98:
John Bauman66b8ab22014-05-06 15:57:45 -04003668
3669 {
3670 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyvsp[(1) - (2)].interm.type)), (yyvsp[(2) - (2)].lex).line);
3671 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (2)].lex).line);
3672
3673 if (context->structQualifierErrorCheck((yyvsp[(2) - (2)].lex).line, (yyval.interm).type))
3674 context->recover();
3675
3676 if (context->nonInitConstErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string, (yyval.interm).type, false))
3677 context->recover();
3678
3679 (yyval.interm).type = (yyvsp[(1) - (2)].interm.type);
3680
3681 TVariable* variable = 0;
3682 if (context->nonInitErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string, (yyval.interm).type, variable))
3683 context->recover();
3684 if (variable && symbol)
3685 symbol->setId(variable->getUniqueId());
3686 }
3687 break;
3688
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003689 case 99:
John Bauman66b8ab22014-05-06 15:57:45 -04003690
3691 {
3692 context->error((yyvsp[(2) - (4)].lex).line, "unsized array declarations not supported", (yyvsp[(2) - (4)].lex).string->c_str());
3693 context->recover();
3694
3695 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (4)].lex).string, TType((yyvsp[(1) - (4)].interm.type)), (yyvsp[(2) - (4)].lex).line);
3696 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (4)].lex).line);
3697 (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
3698 }
3699 break;
3700
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003701 case 100:
John Bauman66b8ab22014-05-06 15:57:45 -04003702
3703 {
3704 TType type = TType((yyvsp[(1) - (5)].interm.type));
3705 int size;
3706 if (context->arraySizeErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3707 context->recover();
3708 type.setArraySize(size);
3709 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (5)].lex).string, type, (yyvsp[(2) - (5)].lex).line);
3710 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (5)].lex).line);
3711
3712 if (context->structQualifierErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
3713 context->recover();
3714
3715 if (context->nonInitConstErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type), true))
3716 context->recover();
3717
3718 (yyval.interm).type = (yyvsp[(1) - (5)].interm.type);
3719
3720 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)))
3721 context->recover();
3722 else {
3723 int size;
3724 if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3725 context->recover();
3726
3727 (yyvsp[(1) - (5)].interm.type).setArray(true, size);
3728 TVariable* variable = 0;
3729 if (context->arrayErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type), variable))
3730 context->recover();
3731 if (variable && symbol)
3732 symbol->setId(variable->getUniqueId());
3733 }
3734 }
3735 break;
3736
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003737 case 101:
John Bauman66b8ab22014-05-06 15:57:45 -04003738
3739 {
3740 if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
3741 context->recover();
3742
3743 (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
3744
3745 TIntermNode* intermNode;
3746 if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode)) {
3747 //
3748 // Build intermediate representation
3749 //
3750 if(intermNode)
3751 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(intermNode, (yyvsp[(3) - (4)].lex).line);
3752 else
3753 (yyval.interm).intermAggregate = 0;
3754 } else {
3755 context->recover();
3756 (yyval.interm).intermAggregate = 0;
3757 }
3758 }
3759 break;
3760
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003761 case 102:
John Bauman66b8ab22014-05-06 15:57:45 -04003762
3763 {
John Bauman66b8ab22014-05-06 15:57:45 -04003764 if (context->globalErrorCheck((yyvsp[(1) - (2)].lex).line, context->symbolTable.atGlobalLevel(), "invariant varying"))
3765 context->recover();
3766 (yyval.interm).type.setBasic(EbtInvariant, EvqInvariantVaryingOut, (yyvsp[(2) - (2)].lex).line);
3767 if (!(yyvsp[(2) - (2)].lex).symbol)
3768 {
3769 context->error((yyvsp[(2) - (2)].lex).line, "undeclared identifier declared as invariant", (yyvsp[(2) - (2)].lex).string->c_str());
3770 context->recover();
3771
3772 (yyval.interm).intermAggregate = 0;
3773 }
3774 else
3775 {
3776 TIntermSymbol *symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyval.interm).type), (yyvsp[(2) - (2)].lex).line);
3777 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (2)].lex).line);
3778 }
3779 }
3780 break;
3781
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003782 case 103:
John Bauman66b8ab22014-05-06 15:57:45 -04003783
3784 {
3785 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3786
3787 if ((yyvsp[(1) - (1)].interm.type).array) {
3788 context->error((yyvsp[(1) - (1)].interm.type).line, "not supported", "first-class array");
3789 context->recover();
3790 (yyvsp[(1) - (1)].interm.type).setArray(false);
3791 }
3792 }
3793 break;
3794
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003795 case 104:
John Bauman66b8ab22014-05-06 15:57:45 -04003796
3797 {
3798 if ((yyvsp[(2) - (2)].interm.type).array) {
3799 context->error((yyvsp[(2) - (2)].interm.type).line, "not supported", "first-class array");
3800 context->recover();
3801 (yyvsp[(2) - (2)].interm.type).setArray(false);
3802 }
3803
3804 if ((yyvsp[(1) - (2)].interm.type).qualifier == EvqAttribute &&
3805 ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
3806 context->error((yyvsp[(2) - (2)].interm.type).line, "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier));
3807 context->recover();
3808 }
3809 if (((yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingIn || (yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingOut) &&
3810 ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
3811 context->error((yyvsp[(2) - (2)].interm.type).line, "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier));
3812 context->recover();
3813 }
3814 (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
3815 (yyval.interm.type).qualifier = (yyvsp[(1) - (2)].interm.type).qualifier;
3816 }
3817 break;
3818
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003819 case 105:
John Bauman66b8ab22014-05-06 15:57:45 -04003820
3821 {
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04003822 (yyval.interm.type).qualifier = EvqSmooth;
John Bauman66b8ab22014-05-06 15:57:45 -04003823 }
3824 break;
3825
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003826 case 106:
John Bauman66b8ab22014-05-06 15:57:45 -04003827
3828 {
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04003829 (yyval.interm.type).qualifier = EvqFlat;
3830 }
3831 break;
3832
3833 case 107:
3834
3835 {
3836 (yyval.interm.qualifier) = EvqConstReadOnly;
3837 }
3838 break;
3839
3840 case 108:
3841
3842 {
John Bauman66b8ab22014-05-06 15:57:45 -04003843 VERTEX_ONLY("attribute", (yyvsp[(1) - (1)].lex).line);
Nicolas Capensc6841852015-02-15 14:25:37 -05003844 ES2_ONLY("attribute", (yyvsp[(1) - (1)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003845 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "attribute"))
3846 context->recover();
3847 (yyval.interm.type).setBasic(EbtVoid, EvqAttribute, (yyvsp[(1) - (1)].lex).line);
3848 }
3849 break;
3850
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04003851 case 109:
John Bauman66b8ab22014-05-06 15:57:45 -04003852
3853 {
Nicolas Capensc6841852015-02-15 14:25:37 -05003854 ES2_ONLY("varying", (yyvsp[(1) - (1)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003855 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "varying"))
3856 context->recover();
Nicolas Capens08ca3c62015-02-13 16:06:45 -05003857 if (context->shaderType == GL_VERTEX_SHADER)
John Bauman66b8ab22014-05-06 15:57:45 -04003858 (yyval.interm.type).setBasic(EbtVoid, EvqVaryingOut, (yyvsp[(1) - (1)].lex).line);
3859 else
3860 (yyval.interm.type).setBasic(EbtVoid, EvqVaryingIn, (yyvsp[(1) - (1)].lex).line);
3861 }
3862 break;
3863
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04003864 case 110:
John Bauman66b8ab22014-05-06 15:57:45 -04003865
3866 {
Nicolas Capensc6841852015-02-15 14:25:37 -05003867 ES2_ONLY("varying", (yyvsp[(1) - (2)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003868 if (context->globalErrorCheck((yyvsp[(1) - (2)].lex).line, context->symbolTable.atGlobalLevel(), "invariant varying"))
3869 context->recover();
Nicolas Capens08ca3c62015-02-13 16:06:45 -05003870 if (context->shaderType == GL_VERTEX_SHADER)
John Bauman66b8ab22014-05-06 15:57:45 -04003871 (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingOut, (yyvsp[(1) - (2)].lex).line);
3872 else
3873 (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingIn, (yyvsp[(1) - (2)].lex).line);
3874 }
3875 break;
3876
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04003877 case 111:
John Bauman66b8ab22014-05-06 15:57:45 -04003878
3879 {
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003880 (yyval.interm.type).setBasic(EbtVoid, (yyvsp[(1) - (1)].interm.type).qualifier, (yyvsp[(1) - (1)].interm.type).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003881 }
3882 break;
3883
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04003884 case 112:
3885
3886 {
3887 (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);
3888 }
3889 break;
3890
3891 case 113:
3892
3893 {
3894 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));
3895 context->recover();
3896
3897 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3898 (yyval.interm.type).setBasic(EbtVoid, qual, (yyvsp[(1) - (1)].interm.type).line);
3899 }
3900 break;
3901
3902 case 114:
John Bauman66b8ab22014-05-06 15:57:45 -04003903
3904 {
Nicolas Capens7d626792015-02-17 17:58:31 -05003905 (yyval.interm.type).qualifier = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3906 (yyval.interm.type).layoutQualifier = (yyvsp[(1) - (1)].interm.layoutQualifier);
3907 }
3908 break;
3909
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04003910 case 115:
Nicolas Capens7d626792015-02-17 17:58:31 -05003911
3912 {
3913 (yyval.interm.type).setBasic(EbtVoid, (yyvsp[(2) - (2)].interm.type).qualifier, (yyvsp[(2) - (2)].interm.type).line);
3914 (yyval.interm.type).layoutQualifier = (yyvsp[(1) - (2)].interm.layoutQualifier);
3915 }
3916 break;
3917
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04003918 case 116:
Nicolas Capens7d626792015-02-17 17:58:31 -05003919
3920 {
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05003921 (yyval.interm.type).qualifier = EvqConstExpr;
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003922 (yyval.interm.type).line = (yyvsp[(1) - (1)].lex).line;
3923 }
3924 break;
3925
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04003926 case 117:
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003927
3928 {
3929 ES3_ONLY("in", (yyvsp[(1) - (1)].lex).line);
3930 (yyval.interm.type).qualifier = (context->shaderType == GL_FRAGMENT_SHADER) ? EvqVaryingIn : EvqAttribute;
3931 (yyval.interm.type).line = (yyvsp[(1) - (1)].lex).line;
3932 }
3933 break;
3934
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04003935 case 118:
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003936
3937 {
3938 ES3_ONLY("out", (yyvsp[(1) - (1)].lex).line);
3939 (yyval.interm.type).qualifier = (context->shaderType == GL_FRAGMENT_SHADER) ? EvqFragColor : EvqVaryingOut;
3940 (yyval.interm.type).line = (yyvsp[(1) - (1)].lex).line;
3941 }
3942 break;
3943
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04003944 case 119:
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003945
3946 {
3947 ES3_ONLY("in", (yyvsp[(1) - (2)].lex).line);
3948 // FIXME: Handle centroid qualifier
3949 (yyval.interm.type).qualifier = (context->shaderType == GL_FRAGMENT_SHADER) ? EvqVaryingIn : EvqAttribute;
3950 (yyval.interm.type).line = (yyvsp[(2) - (2)].lex).line;
3951 }
3952 break;
3953
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04003954 case 120:
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003955
3956 {
3957 ES3_ONLY("out", (yyvsp[(1) - (2)].lex).line);
3958 // FIXME: Handle centroid qualifier
3959 (yyval.interm.type).qualifier = (context->shaderType == GL_FRAGMENT_SHADER) ? EvqFragColor : EvqVaryingOut;
3960 (yyval.interm.type).line = (yyvsp[(2) - (2)].lex).line;
3961 }
3962 break;
3963
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04003964 case 121:
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003965
3966 {
3967 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "uniform"))
3968 context->recover();
3969 (yyval.interm.type).qualifier = EvqUniform;
3970 (yyval.interm.type).line = (yyvsp[(1) - (1)].lex).line;
3971 }
3972 break;
3973
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04003974 case 122:
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003975
3976 {
John Bauman66b8ab22014-05-06 15:57:45 -04003977 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3978
3979 if ((yyval.interm.type).precision == EbpUndefined) {
3980 (yyval.interm.type).precision = context->symbolTable.getDefaultPrecision((yyvsp[(1) - (1)].interm.type).type);
3981 if (context->precisionErrorCheck((yyvsp[(1) - (1)].interm.type).line, (yyval.interm.type).precision, (yyvsp[(1) - (1)].interm.type).type)) {
3982 context->recover();
3983 }
3984 }
3985 }
3986 break;
3987
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04003988 case 123:
John Bauman66b8ab22014-05-06 15:57:45 -04003989
3990 {
3991 (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
3992 (yyval.interm.type).precision = (yyvsp[(1) - (2)].interm.precision);
3993 }
3994 break;
3995
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04003996 case 124:
John Bauman66b8ab22014-05-06 15:57:45 -04003997
3998 {
3999 (yyval.interm.precision) = EbpHigh;
4000 }
4001 break;
4002
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004003 case 125:
John Bauman66b8ab22014-05-06 15:57:45 -04004004
4005 {
4006 (yyval.interm.precision) = EbpMedium;
4007 }
4008 break;
4009
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004010 case 126:
John Bauman66b8ab22014-05-06 15:57:45 -04004011
4012 {
4013 (yyval.interm.precision) = EbpLow;
4014 }
4015 break;
4016
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004017 case 127:
Nicolas Capens7d626792015-02-17 17:58:31 -05004018
4019 {
4020 ES3_ONLY("layout", (yyvsp[(1) - (4)].lex).line);
4021 (yyval.interm.layoutQualifier) = (yyvsp[(3) - (4)].interm.layoutQualifier);
4022 }
4023 break;
4024
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004025 case 128:
Nicolas Capens7d626792015-02-17 17:58:31 -05004026
4027 {
4028 (yyval.interm.layoutQualifier) = (yyvsp[(1) - (1)].interm.layoutQualifier);
4029 }
4030 break;
4031
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004032 case 129:
Nicolas Capens7d626792015-02-17 17:58:31 -05004033
4034 {
4035 (yyval.interm.layoutQualifier) = context->joinLayoutQualifiers((yyvsp[(1) - (3)].interm.layoutQualifier), (yyvsp[(3) - (3)].interm.layoutQualifier));
4036 }
4037 break;
4038
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004039 case 130:
Nicolas Capens7d626792015-02-17 17:58:31 -05004040
4041 {
4042 (yyval.interm.layoutQualifier) = context->parseLayoutQualifier(*(yyvsp[(1) - (1)].lex).string, (yyvsp[(1) - (1)].lex).line);
4043 }
4044 break;
4045
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004046 case 131:
Nicolas Capens7d626792015-02-17 17:58:31 -05004047
4048 {
4049 (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);
4050 }
4051 break;
4052
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004053 case 132:
Nicolas Capens7d626792015-02-17 17:58:31 -05004054
4055 {
4056 (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);
4057 }
4058 break;
4059
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004060 case 133:
John Bauman66b8ab22014-05-06 15:57:45 -04004061
4062 {
4063 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
4064 }
4065 break;
4066
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004067 case 134:
John Bauman66b8ab22014-05-06 15:57:45 -04004068
4069 {
4070 (yyval.interm.type) = (yyvsp[(1) - (4)].interm.type);
4071
4072 if (context->arrayTypeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
4073 context->recover();
4074 else {
4075 int size;
4076 if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
4077 context->recover();
4078 (yyval.interm.type).setArray(true, size);
4079 }
4080 }
4081 break;
4082
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05004083 case 135:
4084
4085 {
Nicolas Capens3c20f802015-02-17 17:17:20 -05004086 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004087 (yyval.interm.type).setBasic(EbtVoid, qual, (yyvsp[(1) - (1)].lex).line);
Nicolas Capens7d626792015-02-17 17:58:31 -05004088 }
4089 break;
4090
4091 case 136:
4092
4093 {
4094 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4095 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
Nicolas Capens7d626792015-02-17 17:58:31 -05004096 }
4097 break;
4098
4099 case 137:
4100
4101 {
4102 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004103 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
Nicolas Capens7d626792015-02-17 17:58:31 -05004104 }
4105 break;
4106
4107 case 138:
4108
4109 {
4110 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004111 (yyval.interm.type).setBasic(EbtUInt, qual, (yyvsp[(1) - (1)].lex).line);
Nicolas Capens7d626792015-02-17 17:58:31 -05004112 }
4113 break;
4114
4115 case 139:
4116
4117 {
4118 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4119 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
Nicolas Capens7d626792015-02-17 17:58:31 -05004120 }
4121 break;
4122
4123 case 140:
4124
4125 {
4126 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004127 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
4128 (yyval.interm.type).setAggregate(2);
Nicolas Capens7d626792015-02-17 17:58:31 -05004129 }
4130 break;
4131
4132 case 141:
4133
4134 {
4135 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004136 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
4137 (yyval.interm.type).setAggregate(3);
Nicolas Capens7d626792015-02-17 17:58:31 -05004138 }
4139 break;
4140
4141 case 142:
4142
4143 {
4144 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004145 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
4146 (yyval.interm.type).setAggregate(4);
Nicolas Capens7d626792015-02-17 17:58:31 -05004147 }
4148 break;
4149
4150 case 143:
4151
4152 {
4153 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004154 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
4155 (yyval.interm.type).setAggregate(2);
4156 }
4157 break;
4158
4159 case 144:
4160
4161 {
4162 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4163 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
4164 (yyval.interm.type).setAggregate(3);
4165 }
4166 break;
4167
4168 case 145:
4169
4170 {
4171 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4172 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
4173 (yyval.interm.type).setAggregate(4);
4174 }
4175 break;
4176
4177 case 146:
4178
4179 {
4180 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4181 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
4182 (yyval.interm.type).setAggregate(2);
4183 }
4184 break;
4185
4186 case 147:
4187
4188 {
4189 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
Nicolas Capens3c20f802015-02-17 17:17:20 -05004190 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004191 (yyval.interm.type).setAggregate(3);
Nicolas Capens3c20f802015-02-17 17:17:20 -05004192 }
4193 break;
4194
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004195 case 148:
Nicolas Capens3c20f802015-02-17 17:17:20 -05004196
4197 {
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004198 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004199 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
4200 (yyval.interm.type).setAggregate(4);
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004201 }
4202 break;
4203
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004204 case 149:
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004205
4206 {
4207 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4208 (yyval.interm.type).setBasic(EbtUInt, qual, (yyvsp[(1) - (1)].lex).line);
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004209 (yyval.interm.type).setAggregate(2);
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004210 }
4211 break;
4212
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004213 case 150:
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004214
4215 {
4216 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4217 (yyval.interm.type).setBasic(EbtUInt, qual, (yyvsp[(1) - (1)].lex).line);
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004218 (yyval.interm.type).setAggregate(3);
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004219 }
4220 break;
4221
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004222 case 151:
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004223
4224 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004225 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4226 (yyval.interm.type).setBasic(EbtUInt, qual, (yyvsp[(1) - (1)].lex).line);
4227 (yyval.interm.type).setAggregate(4);
4228 }
4229 break;
4230
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004231 case 152:
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004232
4233 {
John Bauman66b8ab22014-05-06 15:57:45 -04004234 FRAG_VERT_ONLY("mat2", (yyvsp[(1) - (1)].lex).line);
4235 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4236 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
Alexis Hetub14178b2015-04-13 13:23:20 -04004237 (yyval.interm.type).setMatrix(2, 2);
John Bauman66b8ab22014-05-06 15:57:45 -04004238 }
4239 break;
4240
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004241 case 153:
John Bauman66b8ab22014-05-06 15:57:45 -04004242
4243 {
4244 FRAG_VERT_ONLY("mat3", (yyvsp[(1) - (1)].lex).line);
4245 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4246 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
Alexis Hetub14178b2015-04-13 13:23:20 -04004247 (yyval.interm.type).setMatrix(3, 3);
John Bauman66b8ab22014-05-06 15:57:45 -04004248 }
4249 break;
4250
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004251 case 154:
John Bauman66b8ab22014-05-06 15:57:45 -04004252
4253 {
4254 FRAG_VERT_ONLY("mat4", (yyvsp[(1) - (1)].lex).line);
4255 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4256 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
Alexis Hetub14178b2015-04-13 13:23:20 -04004257 (yyval.interm.type).setMatrix(4, 4);
John Bauman66b8ab22014-05-06 15:57:45 -04004258 }
4259 break;
4260
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004261 case 155:
John Bauman66b8ab22014-05-06 15:57:45 -04004262
4263 {
Alexis Hetub14178b2015-04-13 13:23:20 -04004264 FRAG_VERT_ONLY("mat2x3", (yyvsp[(1) - (1)].lex).line);
4265 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4266 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
4267 (yyval.interm.type).setMatrix(2, 3);
4268 }
4269 break;
4270
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004271 case 156:
Alexis Hetub14178b2015-04-13 13:23:20 -04004272
4273 {
4274 FRAG_VERT_ONLY("mat3x2", (yyvsp[(1) - (1)].lex).line);
4275 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4276 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
4277 (yyval.interm.type).setMatrix(3, 2);
4278 }
4279 break;
4280
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004281 case 157:
Alexis Hetub14178b2015-04-13 13:23:20 -04004282
4283 {
4284 FRAG_VERT_ONLY("mat2x4", (yyvsp[(1) - (1)].lex).line);
4285 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4286 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
4287 (yyval.interm.type).setMatrix(2, 4);
4288 }
4289 break;
4290
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004291 case 158:
Alexis Hetub14178b2015-04-13 13:23:20 -04004292
4293 {
4294 FRAG_VERT_ONLY("mat4x2", (yyvsp[(1) - (1)].lex).line);
4295 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4296 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
4297 (yyval.interm.type).setMatrix(4, 2);
4298 }
4299 break;
4300
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004301 case 159:
Alexis Hetub14178b2015-04-13 13:23:20 -04004302
4303 {
4304 FRAG_VERT_ONLY("mat3x4", (yyvsp[(1) - (1)].lex).line);
4305 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4306 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
4307 (yyval.interm.type).setMatrix(3, 4);
4308 }
4309 break;
4310
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004311 case 160:
Alexis Hetub14178b2015-04-13 13:23:20 -04004312
4313 {
4314 FRAG_VERT_ONLY("mat4x3", (yyvsp[(1) - (1)].lex).line);
4315 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4316 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
4317 (yyval.interm.type).setMatrix(4, 3);
4318 }
4319 break;
4320
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004321 case 161:
Alexis Hetub14178b2015-04-13 13:23:20 -04004322
4323 {
John Bauman66b8ab22014-05-06 15:57:45 -04004324 FRAG_VERT_ONLY("sampler2D", (yyvsp[(1) - (1)].lex).line);
4325 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4326 (yyval.interm.type).setBasic(EbtSampler2D, qual, (yyvsp[(1) - (1)].lex).line);
4327 }
4328 break;
4329
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004330 case 162:
John Bauman66b8ab22014-05-06 15:57:45 -04004331
4332 {
4333 FRAG_VERT_ONLY("samplerCube", (yyvsp[(1) - (1)].lex).line);
4334 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4335 (yyval.interm.type).setBasic(EbtSamplerCube, qual, (yyvsp[(1) - (1)].lex).line);
4336 }
4337 break;
4338
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004339 case 163:
John Bauman66b8ab22014-05-06 15:57:45 -04004340
4341 {
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04004342 if (!context->supportsExtension("GL_OES_EGL_image_external")) {
4343 context->error((yyvsp[(1) - (1)].lex).line, "unsupported type", "samplerExternalOES", "");
4344 context->recover();
4345 }
4346 FRAG_VERT_ONLY("samplerExternalOES", (yyvsp[(1) - (1)].lex).line);
4347 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4348 (yyval.interm.type).setBasic(EbtSamplerExternalOES, qual, (yyvsp[(1) - (1)].lex).line);
4349 }
4350 break;
4351
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004352 case 164:
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04004353
4354 {
Alexis Hetub027aa92015-01-19 15:56:12 -05004355 FRAG_VERT_ONLY("sampler3D", (yyvsp[(1) - (1)].lex).line);
4356 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4357 (yyval.interm.type).setBasic(EbtSampler3D, qual, (yyvsp[(1) - (1)].lex).line);
4358 }
4359 break;
4360
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004361 case 165:
Alexis Hetub14178b2015-04-13 13:23:20 -04004362
4363 {
4364 FRAG_VERT_ONLY("sampler2DArray", (yyvsp[(1) - (1)].lex).line);
4365 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4366 (yyval.interm.type).setBasic(EbtSampler2DArray, qual, (yyvsp[(1) - (1)].lex).line);
4367 }
4368 break;
4369
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004370 case 166:
Alexis Hetub14178b2015-04-13 13:23:20 -04004371
4372 {
4373 FRAG_VERT_ONLY("isampler2D", (yyvsp[(1) - (1)].lex).line);
4374 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4375 (yyval.interm.type).setBasic(EbtISampler2D, qual, (yyvsp[(1) - (1)].lex).line);
4376 }
4377 break;
4378
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004379 case 167:
Alexis Hetub14178b2015-04-13 13:23:20 -04004380
4381 {
4382 FRAG_VERT_ONLY("isampler3D", (yyvsp[(1) - (1)].lex).line);
4383 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4384 (yyval.interm.type).setBasic(EbtISampler3D, qual, (yyvsp[(1) - (1)].lex).line);
4385 }
4386 break;
4387
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004388 case 168:
Alexis Hetub14178b2015-04-13 13:23:20 -04004389
4390 {
4391 FRAG_VERT_ONLY("isamplerCube", (yyvsp[(1) - (1)].lex).line);
4392 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4393 (yyval.interm.type).setBasic(EbtISamplerCube, qual, (yyvsp[(1) - (1)].lex).line);
4394 }
4395 break;
4396
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004397 case 169:
Alexis Hetub14178b2015-04-13 13:23:20 -04004398
4399 {
4400 FRAG_VERT_ONLY("isampler2DArray", (yyvsp[(1) - (1)].lex).line);
4401 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4402 (yyval.interm.type).setBasic(EbtISampler2DArray, qual, (yyvsp[(1) - (1)].lex).line);
4403 }
4404 break;
4405
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004406 case 170:
Alexis Hetub14178b2015-04-13 13:23:20 -04004407
4408 {
4409 FRAG_VERT_ONLY("usampler2D", (yyvsp[(1) - (1)].lex).line);
4410 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4411 (yyval.interm.type).setBasic(EbtUSampler2D, qual, (yyvsp[(1) - (1)].lex).line);
4412 }
4413 break;
4414
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004415 case 171:
Alexis Hetub14178b2015-04-13 13:23:20 -04004416
4417 {
4418 FRAG_VERT_ONLY("usampler3D", (yyvsp[(1) - (1)].lex).line);
4419 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4420 (yyval.interm.type).setBasic(EbtUSampler3D, qual, (yyvsp[(1) - (1)].lex).line);
4421 }
4422 break;
4423
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004424 case 172:
Alexis Hetub14178b2015-04-13 13:23:20 -04004425
4426 {
4427 FRAG_VERT_ONLY("usamplerCube", (yyvsp[(1) - (1)].lex).line);
4428 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4429 (yyval.interm.type).setBasic(EbtUSamplerCube, qual, (yyvsp[(1) - (1)].lex).line);
4430 }
4431 break;
4432
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004433 case 173:
Alexis Hetub14178b2015-04-13 13:23:20 -04004434
4435 {
4436 FRAG_VERT_ONLY("usampler2DArray", (yyvsp[(1) - (1)].lex).line);
4437 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4438 (yyval.interm.type).setBasic(EbtUSampler2DArray, qual, (yyvsp[(1) - (1)].lex).line);
4439 }
4440 break;
4441
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004442 case 174:
Alexis Hetub14178b2015-04-13 13:23:20 -04004443
4444 {
4445 FRAG_VERT_ONLY("sampler2DShadow", (yyvsp[(1) - (1)].lex).line);
4446 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4447 (yyval.interm.type).setBasic(EbtSampler2DShadow, qual, (yyvsp[(1) - (1)].lex).line);
4448 }
4449 break;
4450
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004451 case 175:
Alexis Hetub14178b2015-04-13 13:23:20 -04004452
4453 {
4454 FRAG_VERT_ONLY("samplerCubeShadow", (yyvsp[(1) - (1)].lex).line);
4455 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4456 (yyval.interm.type).setBasic(EbtSamplerCubeShadow, qual, (yyvsp[(1) - (1)].lex).line);
4457 }
4458 break;
4459
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004460 case 176:
Alexis Hetub14178b2015-04-13 13:23:20 -04004461
4462 {
4463 FRAG_VERT_ONLY("sampler2DArrayShadow", (yyvsp[(1) - (1)].lex).line);
4464 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4465 (yyval.interm.type).setBasic(EbtSampler2DArrayShadow, qual, (yyvsp[(1) - (1)].lex).line);
4466 }
4467 break;
4468
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004469 case 177:
Alexis Hetub027aa92015-01-19 15:56:12 -05004470
4471 {
John Bauman66b8ab22014-05-06 15:57:45 -04004472 FRAG_VERT_ONLY("struct", (yyvsp[(1) - (1)].interm.type).line);
4473 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
4474 (yyval.interm.type).qualifier = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4475 }
4476 break;
4477
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004478 case 178:
John Bauman66b8ab22014-05-06 15:57:45 -04004479
4480 {
4481 //
4482 // This is for user defined type names. The lexical phase looked up the
4483 // type.
4484 //
4485 TType& structure = static_cast<TVariable*>((yyvsp[(1) - (1)].lex).symbol)->getType();
4486 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4487 (yyval.interm.type).setBasic(EbtStruct, qual, (yyvsp[(1) - (1)].lex).line);
4488 (yyval.interm.type).userDef = &structure;
4489 }
4490 break;
4491
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004492 case 179:
John Bauman66b8ab22014-05-06 15:57:45 -04004493
4494 { if (context->enterStructDeclaration((yyvsp[(2) - (3)].lex).line, *(yyvsp[(2) - (3)].lex).string)) context->recover(); }
4495 break;
4496
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004497 case 180:
John Bauman66b8ab22014-05-06 15:57:45 -04004498
4499 {
4500 if (context->reservedErrorCheck((yyvsp[(2) - (6)].lex).line, *(yyvsp[(2) - (6)].lex).string))
4501 context->recover();
4502
4503 TType* structure = new TType((yyvsp[(5) - (6)].interm.typeList), *(yyvsp[(2) - (6)].lex).string);
4504 TVariable* userTypeDef = new TVariable((yyvsp[(2) - (6)].lex).string, *structure, true);
Nicolas Capensd603ecd2015-02-18 14:52:21 -05004505 if (! context->symbolTable.declare(*userTypeDef)) {
John Bauman66b8ab22014-05-06 15:57:45 -04004506 context->error((yyvsp[(2) - (6)].lex).line, "redefinition", (yyvsp[(2) - (6)].lex).string->c_str(), "struct");
4507 context->recover();
4508 }
4509 (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (6)].lex).line);
4510 (yyval.interm.type).userDef = structure;
4511 context->exitStructDeclaration();
4512 }
4513 break;
4514
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004515 case 181:
John Bauman66b8ab22014-05-06 15:57:45 -04004516
4517 { if (context->enterStructDeclaration((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string)) context->recover(); }
4518 break;
4519
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004520 case 182:
John Bauman66b8ab22014-05-06 15:57:45 -04004521
4522 {
4523 TType* structure = new TType((yyvsp[(4) - (5)].interm.typeList), TString(""));
4524 (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (5)].lex).line);
4525 (yyval.interm.type).userDef = structure;
4526 context->exitStructDeclaration();
4527 }
4528 break;
4529
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004530 case 183:
John Bauman66b8ab22014-05-06 15:57:45 -04004531
4532 {
4533 (yyval.interm.typeList) = (yyvsp[(1) - (1)].interm.typeList);
4534 }
4535 break;
4536
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004537 case 184:
John Bauman66b8ab22014-05-06 15:57:45 -04004538
4539 {
4540 (yyval.interm.typeList) = (yyvsp[(1) - (2)].interm.typeList);
4541 for (unsigned int i = 0; i < (yyvsp[(2) - (2)].interm.typeList)->size(); ++i) {
4542 for (unsigned int j = 0; j < (yyval.interm.typeList)->size(); ++j) {
4543 if ((*(yyval.interm.typeList))[j].type->getFieldName() == (*(yyvsp[(2) - (2)].interm.typeList))[i].type->getFieldName()) {
4544 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());
4545 context->recover();
4546 }
4547 }
4548 (yyval.interm.typeList)->push_back((*(yyvsp[(2) - (2)].interm.typeList))[i]);
4549 }
4550 }
4551 break;
4552
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004553 case 185:
John Bauman66b8ab22014-05-06 15:57:45 -04004554
4555 {
4556 (yyval.interm.typeList) = (yyvsp[(2) - (3)].interm.typeList);
4557
4558 if (context->voidErrorCheck((yyvsp[(1) - (3)].interm.type).line, (*(yyvsp[(2) - (3)].interm.typeList))[0].type->getFieldName(), (yyvsp[(1) - (3)].interm.type))) {
4559 context->recover();
4560 }
4561 for (unsigned int i = 0; i < (yyval.interm.typeList)->size(); ++i) {
4562 //
4563 // Careful not to replace already known aspects of type, like array-ness
4564 //
4565 TType* type = (*(yyval.interm.typeList))[i].type;
4566 type->setBasicType((yyvsp[(1) - (3)].interm.type).type);
Alexis Hetub14178b2015-04-13 13:23:20 -04004567 type->setNominalSize((yyvsp[(1) - (3)].interm.type).primarySize);
4568 type->setSecondarySize((yyvsp[(1) - (3)].interm.type).secondarySize);
John Bauman66b8ab22014-05-06 15:57:45 -04004569 type->setPrecision((yyvsp[(1) - (3)].interm.type).precision);
4570
4571 // don't allow arrays of arrays
4572 if (type->isArray()) {
4573 if (context->arrayTypeErrorCheck((yyvsp[(1) - (3)].interm.type).line, (yyvsp[(1) - (3)].interm.type)))
4574 context->recover();
4575 }
4576 if ((yyvsp[(1) - (3)].interm.type).array)
4577 type->setArraySize((yyvsp[(1) - (3)].interm.type).arraySize);
4578 if ((yyvsp[(1) - (3)].interm.type).userDef) {
4579 type->setStruct((yyvsp[(1) - (3)].interm.type).userDef->getStruct());
4580 type->setTypeName((yyvsp[(1) - (3)].interm.type).userDef->getTypeName());
4581 }
John Bauman66b8ab22014-05-06 15:57:45 -04004582 }
4583 }
4584 break;
4585
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004586 case 186:
John Bauman66b8ab22014-05-06 15:57:45 -04004587
4588 {
4589 (yyval.interm.typeList) = NewPoolTTypeList();
4590 (yyval.interm.typeList)->push_back((yyvsp[(1) - (1)].interm.typeLine));
4591 }
4592 break;
4593
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004594 case 187:
John Bauman66b8ab22014-05-06 15:57:45 -04004595
4596 {
4597 (yyval.interm.typeList)->push_back((yyvsp[(3) - (3)].interm.typeLine));
4598 }
4599 break;
4600
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004601 case 188:
John Bauman66b8ab22014-05-06 15:57:45 -04004602
4603 {
4604 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
4605 context->recover();
4606
4607 (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
4608 (yyval.interm.typeLine).line = (yyvsp[(1) - (1)].lex).line;
4609 (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (1)].lex).string);
4610 }
4611 break;
4612
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004613 case 189:
John Bauman66b8ab22014-05-06 15:57:45 -04004614
4615 {
4616 if (context->reservedErrorCheck((yyvsp[(1) - (4)].lex).line, *(yyvsp[(1) - (4)].lex).string))
4617 context->recover();
4618
4619 (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
4620 (yyval.interm.typeLine).line = (yyvsp[(1) - (4)].lex).line;
4621 (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (4)].lex).string);
4622
4623 int size;
4624 if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
4625 context->recover();
4626 (yyval.interm.typeLine).type->setArraySize(size);
4627 }
4628 break;
4629
Alexis Hetub14178b2015-04-13 13:23:20 -04004630 case 190:
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004631
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004632 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
Alexis Hetub027aa92015-01-19 15:56:12 -05004633 break;
4634
Alexis Hetub14178b2015-04-13 13:23:20 -04004635 case 191:
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05004636
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004637 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05004638 break;
4639
Alexis Hetub14178b2015-04-13 13:23:20 -04004640 case 192:
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05004641
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004642 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermAggregate); }
Nicolas Capens3c20f802015-02-17 17:17:20 -05004643 break;
4644
Alexis Hetub14178b2015-04-13 13:23:20 -04004645 case 193:
Nicolas Capens3c20f802015-02-17 17:17:20 -05004646
Nicolas Capens7d626792015-02-17 17:58:31 -05004647 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004648 break;
4649
Alexis Hetub14178b2015-04-13 13:23:20 -04004650 case 194:
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004651
Nicolas Capens7d626792015-02-17 17:58:31 -05004652 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004653 break;
4654
Alexis Hetub14178b2015-04-13 13:23:20 -04004655 case 195:
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004656
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004657 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004658 break;
4659
Alexis Hetub14178b2015-04-13 13:23:20 -04004660 case 196:
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004661
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004662 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004663 break;
4664
Alexis Hetub14178b2015-04-13 13:23:20 -04004665 case 197:
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004666
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004667 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
Nicolas Capens7d626792015-02-17 17:58:31 -05004668 break;
4669
Alexis Hetub14178b2015-04-13 13:23:20 -04004670 case 198:
Nicolas Capens7d626792015-02-17 17:58:31 -05004671
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004672 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
4673 break;
4674
4675 case 199:
4676
4677 { (yyval.interm.intermAggregate) = 0; }
4678 break;
4679
4680 case 200:
4681
4682 { context->symbolTable.push(); }
4683 break;
4684
4685 case 201:
4686
4687 { context->symbolTable.pop(); }
4688 break;
4689
4690 case 202:
4691
Nicolas Capens7d626792015-02-17 17:58:31 -05004692 {
4693 if ((yyvsp[(3) - (5)].interm.intermAggregate) != 0) {
4694 (yyvsp[(3) - (5)].interm.intermAggregate)->setOp(EOpSequence);
4695 (yyvsp[(3) - (5)].interm.intermAggregate)->setEndLine((yyvsp[(5) - (5)].lex).line);
4696 }
4697 (yyval.interm.intermAggregate) = (yyvsp[(3) - (5)].interm.intermAggregate);
4698 }
4699 break;
4700
Alexis Hetub14178b2015-04-13 13:23:20 -04004701 case 203:
Nicolas Capens7d626792015-02-17 17:58:31 -05004702
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004703 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
Nicolas Capens7d626792015-02-17 17:58:31 -05004704 break;
4705
Alexis Hetub14178b2015-04-13 13:23:20 -04004706 case 204:
Nicolas Capens7d626792015-02-17 17:58:31 -05004707
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004708 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
Nicolas Capens7d626792015-02-17 17:58:31 -05004709 break;
4710
Alexis Hetub14178b2015-04-13 13:23:20 -04004711 case 205:
Nicolas Capens7d626792015-02-17 17:58:31 -05004712
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004713 { context->symbolTable.push(); }
4714 break;
4715
4716 case 206:
4717
4718 { context->symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[(2) - (2)].interm.intermNode); }
4719 break;
4720
4721 case 207:
4722
4723 { context->symbolTable.push(); }
4724 break;
4725
4726 case 208:
4727
4728 { context->symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[(2) - (2)].interm.intermNode); }
4729 break;
4730
4731 case 209:
4732
John Bauman66b8ab22014-05-06 15:57:45 -04004733 {
4734 (yyval.interm.intermNode) = 0;
4735 }
4736 break;
4737
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004738 case 210:
John Bauman66b8ab22014-05-06 15:57:45 -04004739
4740 {
4741 if ((yyvsp[(2) - (3)].interm.intermAggregate)) {
4742 (yyvsp[(2) - (3)].interm.intermAggregate)->setOp(EOpSequence);
4743 (yyvsp[(2) - (3)].interm.intermAggregate)->setEndLine((yyvsp[(3) - (3)].lex).line);
4744 }
4745 (yyval.interm.intermNode) = (yyvsp[(2) - (3)].interm.intermAggregate);
4746 }
4747 break;
4748
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004749 case 211:
John Bauman66b8ab22014-05-06 15:57:45 -04004750
4751 {
4752 (yyval.interm.intermAggregate) = context->intermediate.makeAggregate((yyvsp[(1) - (1)].interm.intermNode), 0);
4753 }
4754 break;
4755
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004756 case 212:
John Bauman66b8ab22014-05-06 15:57:45 -04004757
4758 {
4759 (yyval.interm.intermAggregate) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermAggregate), (yyvsp[(2) - (2)].interm.intermNode), 0);
4760 }
4761 break;
4762
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004763 case 213:
John Bauman66b8ab22014-05-06 15:57:45 -04004764
4765 { (yyval.interm.intermNode) = 0; }
4766 break;
4767
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004768 case 214:
John Bauman66b8ab22014-05-06 15:57:45 -04004769
4770 { (yyval.interm.intermNode) = static_cast<TIntermNode*>((yyvsp[(1) - (2)].interm.intermTypedNode)); }
4771 break;
4772
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004773 case 215:
John Bauman66b8ab22014-05-06 15:57:45 -04004774
4775 {
4776 if (context->boolErrorCheck((yyvsp[(1) - (5)].lex).line, (yyvsp[(3) - (5)].interm.intermTypedNode)))
4777 context->recover();
4778 (yyval.interm.intermNode) = context->intermediate.addSelection((yyvsp[(3) - (5)].interm.intermTypedNode), (yyvsp[(5) - (5)].interm.nodePair), (yyvsp[(1) - (5)].lex).line);
4779 }
4780 break;
4781
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004782 case 216:
John Bauman66b8ab22014-05-06 15:57:45 -04004783
4784 {
4785 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermNode);
4786 (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermNode);
4787 }
4788 break;
4789
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004790 case 217:
John Bauman66b8ab22014-05-06 15:57:45 -04004791
4792 {
4793 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (1)].interm.intermNode);
4794 (yyval.interm.nodePair).node2 = 0;
4795 }
4796 break;
4797
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004798 case 218:
John Bauman66b8ab22014-05-06 15:57:45 -04004799
4800 {
4801 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
4802 if (context->boolErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)->getLine(), (yyvsp[(1) - (1)].interm.intermTypedNode)))
4803 context->recover();
4804 }
4805 break;
4806
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004807 case 219:
John Bauman66b8ab22014-05-06 15:57:45 -04004808
4809 {
4810 TIntermNode* intermNode;
4811 if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
4812 context->recover();
4813 if (context->boolErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
4814 context->recover();
4815
4816 if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode))
4817 (yyval.interm.intermTypedNode) = (yyvsp[(4) - (4)].interm.intermTypedNode);
4818 else {
4819 context->recover();
4820 (yyval.interm.intermTypedNode) = 0;
4821 }
4822 }
4823 break;
4824
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004825 case 220:
John Bauman66b8ab22014-05-06 15:57:45 -04004826
4827 { context->symbolTable.push(); ++context->loopNestingLevel; }
4828 break;
4829
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004830 case 221:
John Bauman66b8ab22014-05-06 15:57:45 -04004831
4832 {
4833 context->symbolTable.pop();
4834 (yyval.interm.intermNode) = context->intermediate.addLoop(ELoopWhile, 0, (yyvsp[(4) - (6)].interm.intermTypedNode), 0, (yyvsp[(6) - (6)].interm.intermNode), (yyvsp[(1) - (6)].lex).line);
4835 --context->loopNestingLevel;
4836 }
4837 break;
4838
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004839 case 222:
John Bauman66b8ab22014-05-06 15:57:45 -04004840
4841 { ++context->loopNestingLevel; }
4842 break;
4843
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004844 case 223:
John Bauman66b8ab22014-05-06 15:57:45 -04004845
4846 {
4847 if (context->boolErrorCheck((yyvsp[(8) - (8)].lex).line, (yyvsp[(6) - (8)].interm.intermTypedNode)))
4848 context->recover();
4849
4850 (yyval.interm.intermNode) = context->intermediate.addLoop(ELoopDoWhile, 0, (yyvsp[(6) - (8)].interm.intermTypedNode), 0, (yyvsp[(3) - (8)].interm.intermNode), (yyvsp[(4) - (8)].lex).line);
4851 --context->loopNestingLevel;
4852 }
4853 break;
4854
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004855 case 224:
John Bauman66b8ab22014-05-06 15:57:45 -04004856
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004857 { context->symbolTable.push(); ++context->loopNestingLevel; }
John Bauman66b8ab22014-05-06 15:57:45 -04004858 break;
4859
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004860 case 225:
John Bauman66b8ab22014-05-06 15:57:45 -04004861
4862 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004863 context->symbolTable.pop();
4864 (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);
4865 --context->loopNestingLevel;
John Bauman66b8ab22014-05-06 15:57:45 -04004866 }
4867 break;
4868
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004869 case 226:
John Bauman66b8ab22014-05-06 15:57:45 -04004870
4871 {
Nicolas Capens3c20f802015-02-17 17:17:20 -05004872 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04004873 }
4874 break;
4875
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004876 case 227:
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04004877
4878 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004879 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
Alexis Hetub027aa92015-01-19 15:56:12 -05004880 }
4881 break;
4882
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004883 case 228:
Alexis Hetub027aa92015-01-19 15:56:12 -05004884
4885 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004886 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
Nicolas Capens3c20f802015-02-17 17:17:20 -05004887 }
4888 break;
4889
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004890 case 229:
Nicolas Capens3c20f802015-02-17 17:17:20 -05004891
4892 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004893 (yyval.interm.intermTypedNode) = 0;
4894 }
4895 break;
4896
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004897 case 230:
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004898
4899 {
John Bauman66b8ab22014-05-06 15:57:45 -04004900 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (2)].interm.intermTypedNode);
4901 (yyval.interm.nodePair).node2 = 0;
4902 }
4903 break;
4904
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004905 case 231:
John Bauman66b8ab22014-05-06 15:57:45 -04004906
4907 {
4908 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermTypedNode);
4909 (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermTypedNode);
4910 }
4911 break;
4912
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004913 case 232:
John Bauman66b8ab22014-05-06 15:57:45 -04004914
4915 {
4916 if (context->loopNestingLevel <= 0) {
4917 context->error((yyvsp[(1) - (2)].lex).line, "continue statement only allowed in loops", "");
4918 context->recover();
4919 }
4920 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpContinue, (yyvsp[(1) - (2)].lex).line);
4921 }
4922 break;
4923
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004924 case 233:
John Bauman66b8ab22014-05-06 15:57:45 -04004925
4926 {
4927 if (context->loopNestingLevel <= 0) {
4928 context->error((yyvsp[(1) - (2)].lex).line, "break statement only allowed in loops", "");
4929 context->recover();
4930 }
4931 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpBreak, (yyvsp[(1) - (2)].lex).line);
4932 }
4933 break;
4934
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004935 case 234:
John Bauman66b8ab22014-05-06 15:57:45 -04004936
4937 {
4938 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(1) - (2)].lex).line);
4939 if (context->currentFunctionType->getBasicType() != EbtVoid) {
4940 context->error((yyvsp[(1) - (2)].lex).line, "non-void function must return a value", "return");
4941 context->recover();
4942 }
4943 }
4944 break;
4945
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004946 case 235:
John Bauman66b8ab22014-05-06 15:57:45 -04004947
4948 {
4949 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(2) - (3)].interm.intermTypedNode), (yyvsp[(1) - (3)].lex).line);
4950 context->functionReturnsValue = true;
4951 if (context->currentFunctionType->getBasicType() == EbtVoid) {
4952 context->error((yyvsp[(1) - (3)].lex).line, "void function cannot return a value", "return");
4953 context->recover();
4954 } else if (*(context->currentFunctionType) != (yyvsp[(2) - (3)].interm.intermTypedNode)->getType()) {
4955 context->error((yyvsp[(1) - (3)].lex).line, "function return is not matching type:", "return");
4956 context->recover();
4957 }
4958 }
4959 break;
4960
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004961 case 236:
John Bauman66b8ab22014-05-06 15:57:45 -04004962
4963 {
4964 FRAG_ONLY("discard", (yyvsp[(1) - (2)].lex).line);
4965 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpKill, (yyvsp[(1) - (2)].lex).line);
4966 }
4967 break;
4968
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004969 case 237:
John Bauman66b8ab22014-05-06 15:57:45 -04004970
4971 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004972 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
Nicolas Capens3c20f802015-02-17 17:17:20 -05004973 context->treeRoot = (yyval.interm.intermNode);
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04004974 }
4975 break;
4976
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004977 case 238:
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04004978
4979 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004980 (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermNode), (yyvsp[(2) - (2)].interm.intermNode), 0);
4981 context->treeRoot = (yyval.interm.intermNode);
Alexis Hetub027aa92015-01-19 15:56:12 -05004982 }
4983 break;
4984
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004985 case 239:
Alexis Hetub027aa92015-01-19 15:56:12 -05004986
4987 {
Nicolas Capens3c20f802015-02-17 17:17:20 -05004988 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
4989 }
4990 break;
4991
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004992 case 240:
Nicolas Capens3c20f802015-02-17 17:17:20 -05004993
4994 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004995 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
4996 }
4997 break;
4998
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04004999 case 241:
Nicolas Capens2c1239f2015-02-17 17:30:04 -05005000
5001 {
John Bauman66b8ab22014-05-06 15:57:45 -04005002 TFunction* function = (yyvsp[(1) - (1)].interm).function;
5003
Nicolas Capens0a7f0c22015-02-18 14:47:31 -05005004 const TSymbol *builtIn = context->symbolTable.findBuiltIn(function->getMangledName(), context->shaderVersion);
John Bauman66b8ab22014-05-06 15:57:45 -04005005
5006 if (builtIn)
5007 {
5008 context->error((yyvsp[(1) - (1)].interm).line, "built-in functions cannot be redefined", function->getName().c_str());
5009 context->recover();
5010 }
5011
Nicolas Capens0a7f0c22015-02-18 14:47:31 -05005012 TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find(function->getMangledName(), context->shaderVersion));
John Bauman66b8ab22014-05-06 15:57:45 -04005013 //
5014 // Note: 'prevDec' could be 'function' if this is the first time we've seen function
5015 // as it would have just been put in the symbol table. Otherwise, we're looking up
5016 // an earlier occurance.
5017 //
5018 if (prevDec->isDefined()) {
5019 //
5020 // Then this function already has a body.
5021 //
5022 context->error((yyvsp[(1) - (1)].interm).line, "function already has a body", function->getName().c_str());
5023 context->recover();
5024 }
5025 prevDec->setDefined();
5026
5027 //
5028 // Raise error message if main function takes any parameters or return anything other than void
5029 //
5030 if (function->getName() == "main") {
5031 if (function->getParamCount() > 0) {
5032 context->error((yyvsp[(1) - (1)].interm).line, "function cannot take any parameter(s)", function->getName().c_str());
5033 context->recover();
5034 }
5035 if (function->getReturnType().getBasicType() != EbtVoid) {
5036 context->error((yyvsp[(1) - (1)].interm).line, "", function->getReturnType().getBasicString(), "main function cannot return a value");
5037 context->recover();
5038 }
5039 }
5040
5041 //
5042 // Remember the return type for later checking for RETURN statements.
5043 //
5044 context->currentFunctionType = &(prevDec->getReturnType());
5045 context->functionReturnsValue = false;
5046
5047 //
5048 // Insert parameters into the symbol table.
5049 // If the parameter has no name, it's not an error, just don't insert it
5050 // (could be used for unused args).
5051 //
5052 // Also, accumulate the list of parameters into the HIL, so lower level code
5053 // knows where to find parameters.
5054 //
5055 TIntermAggregate* paramNodes = new TIntermAggregate;
5056 for (int i = 0; i < function->getParamCount(); i++) {
5057 const TParameter& param = function->getParam(i);
5058 if (param.name != 0) {
5059 TVariable *variable = new TVariable(param.name, *param.type);
5060 //
5061 // Insert the parameters with name in the symbol table.
5062 //
Nicolas Capensd603ecd2015-02-18 14:52:21 -05005063 if (! context->symbolTable.declare(*variable)) {
John Bauman66b8ab22014-05-06 15:57:45 -04005064 context->error((yyvsp[(1) - (1)].interm).line, "redefinition", variable->getName().c_str());
5065 context->recover();
5066 delete variable;
5067 }
5068
5069 //
5070 // Add the parameter to the HIL
5071 //
5072 paramNodes = context->intermediate.growAggregate(
5073 paramNodes,
5074 context->intermediate.addSymbol(variable->getUniqueId(),
5075 variable->getName(),
5076 variable->getType(), (yyvsp[(1) - (1)].interm).line),
5077 (yyvsp[(1) - (1)].interm).line);
5078 } else {
5079 paramNodes = context->intermediate.growAggregate(paramNodes, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (1)].interm).line), (yyvsp[(1) - (1)].interm).line);
5080 }
5081 }
5082 context->intermediate.setAggregateOperator(paramNodes, EOpParameters, (yyvsp[(1) - (1)].interm).line);
5083 (yyvsp[(1) - (1)].interm).intermAggregate = paramNodes;
5084 context->loopNestingLevel = 0;
5085 }
5086 break;
5087
Alexis Hetu55a2cbc2015-04-16 10:49:45 -04005088 case 242:
John Bauman66b8ab22014-05-06 15:57:45 -04005089
5090 {
5091 //?? Check that all paths return a value if return type != void ?
5092 // May be best done as post process phase on intermediate code
5093 if (context->currentFunctionType->getBasicType() != EbtVoid && ! context->functionReturnsValue) {
5094 context->error((yyvsp[(1) - (3)].interm).line, "function does not return a value:", "", (yyvsp[(1) - (3)].interm).function->getName().c_str());
5095 context->recover();
5096 }
5097
5098 (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermAggregate, (yyvsp[(3) - (3)].interm.intermNode), 0);
5099 context->intermediate.setAggregateOperator((yyval.interm.intermNode), EOpFunction, (yyvsp[(1) - (3)].interm).line);
5100 (yyval.interm.intermNode)->getAsAggregate()->setName((yyvsp[(1) - (3)].interm).function->getMangledName().c_str());
5101 (yyval.interm.intermNode)->getAsAggregate()->setType((yyvsp[(1) - (3)].interm).function->getReturnType());
5102
5103 // store the pragma information for debug and optimize and other vendor specific
5104 // information. This information can be queried from the parse tree
5105 (yyval.interm.intermNode)->getAsAggregate()->setOptimize(context->pragma().optimize);
5106 (yyval.interm.intermNode)->getAsAggregate()->setDebug(context->pragma().debug);
5107
5108 if ((yyvsp[(3) - (3)].interm.intermNode) && (yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate())
5109 (yyval.interm.intermNode)->getAsAggregate()->setEndLine((yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate()->getEndLine());
5110
5111 context->symbolTable.pop();
5112 }
5113 break;
5114
5115
5116
5117 default: break;
5118 }
5119 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
5120
5121 YYPOPSTACK (yylen);
5122 yylen = 0;
5123 YY_STACK_PRINT (yyss, yyssp);
5124
5125 *++yyvsp = yyval;
5126
5127 /* Now `shift' the result of the reduction. Determine what state
5128 that goes to, based on the state we popped back to and the rule
5129 number reduced by. */
5130
5131 yyn = yyr1[yyn];
5132
5133 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
5134 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
5135 yystate = yytable[yystate];
5136 else
5137 yystate = yydefgoto[yyn - YYNTOKENS];
5138
5139 goto yynewstate;
5140
5141
5142/*------------------------------------.
5143| yyerrlab -- here on detecting error |
5144`------------------------------------*/
5145yyerrlab:
5146 /* If not already recovering from an error, report this error. */
5147 if (!yyerrstatus)
5148 {
5149 ++yynerrs;
5150#if ! YYERROR_VERBOSE
5151 yyerror (context, YY_("syntax error"));
5152#else
5153 {
5154 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
5155 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
5156 {
5157 YYSIZE_T yyalloc = 2 * yysize;
5158 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
5159 yyalloc = YYSTACK_ALLOC_MAXIMUM;
5160 if (yymsg != yymsgbuf)
5161 YYSTACK_FREE (yymsg);
5162 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
5163 if (yymsg)
5164 yymsg_alloc = yyalloc;
5165 else
5166 {
5167 yymsg = yymsgbuf;
5168 yymsg_alloc = sizeof yymsgbuf;
5169 }
5170 }
5171
5172 if (0 < yysize && yysize <= yymsg_alloc)
5173 {
5174 (void) yysyntax_error (yymsg, yystate, yychar);
5175 yyerror (context, yymsg);
5176 }
5177 else
5178 {
5179 yyerror (context, YY_("syntax error"));
5180 if (yysize != 0)
5181 goto yyexhaustedlab;
5182 }
5183 }
5184#endif
5185 }
5186
5187
5188
5189 if (yyerrstatus == 3)
5190 {
5191 /* If just tried and failed to reuse lookahead token after an
5192 error, discard it. */
5193
5194 if (yychar <= YYEOF)
5195 {
5196 /* Return failure if at end of input. */
5197 if (yychar == YYEOF)
5198 YYABORT;
5199 }
5200 else
5201 {
5202 yydestruct ("Error: discarding",
5203 yytoken, &yylval, context);
5204 yychar = YYEMPTY;
5205 }
5206 }
5207
5208 /* Else will try to reuse lookahead token after shifting the error
5209 token. */
5210 goto yyerrlab1;
5211
5212
5213/*---------------------------------------------------.
5214| yyerrorlab -- error raised explicitly by YYERROR. |
5215`---------------------------------------------------*/
5216yyerrorlab:
5217
5218 /* Pacify compilers like GCC when the user code never invokes
5219 YYERROR and the label yyerrorlab therefore never appears in user
5220 code. */
5221 if (/*CONSTCOND*/ 0)
5222 goto yyerrorlab;
5223
5224 /* Do not reclaim the symbols of the rule which action triggered
5225 this YYERROR. */
5226 YYPOPSTACK (yylen);
5227 yylen = 0;
5228 YY_STACK_PRINT (yyss, yyssp);
5229 yystate = *yyssp;
5230 goto yyerrlab1;
5231
5232
5233/*-------------------------------------------------------------.
5234| yyerrlab1 -- common code for both syntax error and YYERROR. |
5235`-------------------------------------------------------------*/
5236yyerrlab1:
5237 yyerrstatus = 3; /* Each real token shifted decrements this. */
5238
5239 for (;;)
5240 {
5241 yyn = yypact[yystate];
5242 if (yyn != YYPACT_NINF)
5243 {
5244 yyn += YYTERROR;
5245 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
5246 {
5247 yyn = yytable[yyn];
5248 if (0 < yyn)
5249 break;
5250 }
5251 }
5252
5253 /* Pop the current state because it cannot handle the error token. */
5254 if (yyssp == yyss)
5255 YYABORT;
5256
5257
5258 yydestruct ("Error: popping",
5259 yystos[yystate], yyvsp, context);
5260 YYPOPSTACK (1);
5261 yystate = *yyssp;
5262 YY_STACK_PRINT (yyss, yyssp);
5263 }
5264
5265 *++yyvsp = yylval;
5266
5267
5268 /* Shift the error token. */
5269 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
5270
5271 yystate = yyn;
5272 goto yynewstate;
5273
5274
5275/*-------------------------------------.
5276| yyacceptlab -- YYACCEPT comes here. |
5277`-------------------------------------*/
5278yyacceptlab:
5279 yyresult = 0;
5280 goto yyreturn;
5281
5282/*-----------------------------------.
5283| yyabortlab -- YYABORT comes here. |
5284`-----------------------------------*/
5285yyabortlab:
5286 yyresult = 1;
5287 goto yyreturn;
5288
5289#if !defined(yyoverflow) || YYERROR_VERBOSE
5290/*-------------------------------------------------.
5291| yyexhaustedlab -- memory exhaustion comes here. |
5292`-------------------------------------------------*/
5293yyexhaustedlab:
5294 yyerror (context, YY_("memory exhausted"));
5295 yyresult = 2;
5296 /* Fall through. */
5297#endif
5298
5299yyreturn:
5300 if (yychar != YYEMPTY)
5301 yydestruct ("Cleanup: discarding lookahead",
5302 yytoken, &yylval, context);
5303 /* Do not reclaim the symbols of the rule which action triggered
5304 this YYABORT or YYACCEPT. */
5305 YYPOPSTACK (yylen);
5306 YY_STACK_PRINT (yyss, yyssp);
5307 while (yyssp != yyss)
5308 {
5309 yydestruct ("Cleanup: popping",
5310 yystos[*yyssp], yyvsp, context);
5311 YYPOPSTACK (1);
5312 }
5313#ifndef yyoverflow
5314 if (yyss != yyssa)
5315 YYSTACK_FREE (yyss);
5316#endif
5317#if YYERROR_VERBOSE
5318 if (yymsg != yymsgbuf)
5319 YYSTACK_FREE (yymsg);
5320#endif
5321 /* Make sure YYID is used. */
5322 return YYID (yyresult);
5323}
5324
5325
5326
5327
5328
5329int glslang_parse(TParseContext* context) {
5330 return yyparse(context);
5331}
5332