blob: 6d23119dff93c883cd4d6b46da7f471e017b4c15 [file] [log] [blame]
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04001
2/* A Bison parser, made by GNU Bison 2.4.1. */
John Bauman66b8ab22014-05-06 15:57:45 -04003
4/* Skeleton implementation for Bison's Yacc-like parsers in C
5
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04006 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
7 Free Software Foundation, Inc.
John Bauman66b8ab22014-05-06 15:57:45 -04008
9 This program is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
21
22/* As a special exception, you may create a larger work that contains
23 part or all of the Bison parser skeleton and distribute that work
24 under terms of your choice, so long as that work isn't itself a
25 parser generator using the skeleton or a modified version thereof
26 as a parser skeleton. Alternatively, if you modify or redistribute
27 the parser skeleton itself, you may (at your option) remove this
28 special exception, which will cause the skeleton and the resulting
29 Bison output files to be licensed under the GNU General Public
30 License without this special exception.
31
32 This special exception was added by the Free Software Foundation in
33 version 2.2 of Bison. */
34
35/* C LALR(1) parser skeleton written by Richard Stallman, by
36 simplifying the original so-called "semantic" parser. */
37
38/* All symbols defined below should begin with yy or YY, to avoid
39 infringing on user name space. This should be done even for local
40 variables, as they might otherwise be expanded by user macros.
41 There are some unavoidable exceptions within include files to
42 define necessary library symbols; they are noted "INFRINGES ON
43 USER NAME SPACE" below. */
44
45/* Identify Bison output. */
46#define YYBISON 1
47
48/* Bison version. */
Nicolas Capense9c5e4f2014-05-28 22:46:43 -040049#define YYBISON_VERSION "2.4.1"
John Bauman66b8ab22014-05-06 15:57:45 -040050
51/* Skeleton name. */
52#define YYSKELETON_NAME "yacc.c"
53
54/* Pure parsers. */
55#define YYPURE 1
56
57/* Push parsers. */
58#define YYPUSH 0
59
60/* Pull parsers. */
61#define YYPULL 1
62
63/* Using locations. */
64#define YYLSP_NEEDED 0
65
66
67
68/* Copy the first part of user declarations. */
69
70
71//
John Baumand4ae8632014-05-06 16:18:33 -040072// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
John Bauman66b8ab22014-05-06 15:57:45 -040073// Use of this source code is governed by a BSD-style license that can be
74// found in the LICENSE file.
75//
76
77// This file is auto-generated by generate_parser.sh. DO NOT EDIT!
78
79// Ignore errors in auto-generated code.
80#if defined(__GNUC__)
81#pragma GCC diagnostic ignored "-Wunused-function"
82#pragma GCC diagnostic ignored "-Wunused-variable"
83#pragma GCC diagnostic ignored "-Wswitch-enum"
84#elif defined(_MSC_VER)
85#pragma warning(disable: 4065)
86#pragma warning(disable: 4189)
87#pragma warning(disable: 4505)
88#pragma warning(disable: 4701)
89#endif
90
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,
168 CENTROID = 300,
169 FLAT = 301,
170 SMOOTH = 302,
171 STRUCT = 303,
172 VOID_TYPE = 304,
173 WHILE = 305,
174 SAMPLER2D = 306,
175 SAMPLERCUBE = 307,
176 SAMPLER_EXTERNAL_OES = 308,
177 SAMPLER2DRECT = 309,
178 SAMPLER3D = 310,
179 SAMPLER3DRECT = 311,
180 SAMPLER2DSHADOW = 312,
181 IDENTIFIER = 313,
182 TYPE_NAME = 314,
183 FLOATCONSTANT = 315,
184 INTCONSTANT = 316,
Nicolas Capens2c1239f2015-02-17 17:30:04 -0500185 UINTCONSTANT = 317,
186 BOOLCONSTANT = 318,
187 FIELD_SELECTION = 319,
188 LEFT_OP = 320,
189 RIGHT_OP = 321,
190 INC_OP = 322,
191 DEC_OP = 323,
192 LE_OP = 324,
193 GE_OP = 325,
194 EQ_OP = 326,
195 NE_OP = 327,
196 AND_OP = 328,
197 OR_OP = 329,
198 XOR_OP = 330,
199 MUL_ASSIGN = 331,
200 DIV_ASSIGN = 332,
201 ADD_ASSIGN = 333,
202 MOD_ASSIGN = 334,
203 LEFT_ASSIGN = 335,
204 RIGHT_ASSIGN = 336,
205 AND_ASSIGN = 337,
206 XOR_ASSIGN = 338,
207 OR_ASSIGN = 339,
208 SUB_ASSIGN = 340,
209 LEFT_PAREN = 341,
210 RIGHT_PAREN = 342,
211 LEFT_BRACKET = 343,
212 RIGHT_BRACKET = 344,
213 LEFT_BRACE = 345,
214 RIGHT_BRACE = 346,
215 DOT = 347,
216 COMMA = 348,
217 COLON = 349,
218 EQUAL = 350,
219 SEMICOLON = 351,
220 BANG = 352,
221 DASH = 353,
222 TILDE = 354,
223 PLUS = 355,
224 STAR = 356,
225 SLASH = 357,
226 PERCENT = 358,
227 LEFT_ANGLE = 359,
228 RIGHT_ANGLE = 360,
229 VERTICAL_BAR = 361,
230 CARET = 362,
231 AMPERSAND = 363,
232 QUESTION = 364
John Bauman66b8ab22014-05-06 15:57:45 -0400233 };
234#endif
235
236
237
238#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
239typedef union YYSTYPE
240{
241
242
243 struct {
244 TSourceLoc line;
245 union {
246 TString *string;
247 float f;
248 int i;
Nicolas Capens2c1239f2015-02-17 17:30:04 -0500249 unsigned int u;
John Bauman66b8ab22014-05-06 15:57:45 -0400250 bool b;
251 };
252 TSymbol* symbol;
253 } lex;
254 struct {
255 TSourceLoc line;
256 TOperator op;
257 union {
258 TIntermNode* intermNode;
259 TIntermNodePair nodePair;
260 TIntermTyped* intermTypedNode;
261 TIntermAggregate* intermAggregate;
262 };
263 union {
264 TPublicType type;
265 TPrecision precision;
266 TQualifier qualifier;
267 TFunction* function;
268 TParameter param;
269 TTypeLine typeLine;
270 TTypeList* typeList;
271 };
272 } interm;
273
274
275
276} YYSTYPE;
277# define YYSTYPE_IS_TRIVIAL 1
278# define yystype YYSTYPE /* obsolescent; will be withdrawn */
279# define YYSTYPE_IS_DECLARED 1
280#endif
281
282
283/* Copy the second part of user declarations. */
284
285
286extern int yylex(YYSTYPE* yylval_param, void* yyscanner);
287extern void yyerror(TParseContext* context, const char* reason);
288
289#define FRAG_VERT_ONLY(S, L) { \
Nicolas Capens08ca3c62015-02-13 16:06:45 -0500290 if (context->shaderType != GL_FRAGMENT_SHADER && \
291 context->shaderType != GL_VERTEX_SHADER) { \
John Bauman66b8ab22014-05-06 15:57:45 -0400292 context->error(L, " supported in vertex/fragment shaders only ", S); \
293 context->recover(); \
294 } \
295}
296
297#define VERTEX_ONLY(S, L) { \
Nicolas Capens08ca3c62015-02-13 16:06:45 -0500298 if (context->shaderType != GL_VERTEX_SHADER) { \
John Bauman66b8ab22014-05-06 15:57:45 -0400299 context->error(L, " supported in vertex shaders only ", S); \
300 context->recover(); \
301 } \
302}
303
304#define FRAG_ONLY(S, L) { \
Nicolas Capens08ca3c62015-02-13 16:06:45 -0500305 if (context->shaderType != GL_FRAGMENT_SHADER) { \
John Bauman66b8ab22014-05-06 15:57:45 -0400306 context->error(L, " supported in fragment shaders only ", S); \
307 context->recover(); \
308 } \
309}
310
Nicolas Capensc6841852015-02-15 14:25:37 -0500311#define ES2_ONLY(S, L) { \
312 if (context->shaderVersion != 100) { \
313 context->error(L, " supported in GLSL ES 1.00 only ", S); \
314 context->recover(); \
315 } \
316}
317
318#define ES3_ONLY(S, L) { \
319 if (context->shaderVersion != 300) { \
320 context->error(L, " supported in GLSL ES 3.00 only ", S); \
321 context->recover(); \
322 } \
323}
324
John Bauman66b8ab22014-05-06 15:57:45 -0400325
326
327#ifdef short
328# undef short
329#endif
330
331#ifdef YYTYPE_UINT8
332typedef YYTYPE_UINT8 yytype_uint8;
333#else
334typedef unsigned char yytype_uint8;
335#endif
336
337#ifdef YYTYPE_INT8
338typedef YYTYPE_INT8 yytype_int8;
339#elif (defined __STDC__ || defined __C99__FUNC__ \
340 || defined __cplusplus || defined _MSC_VER)
341typedef signed char yytype_int8;
342#else
343typedef short int yytype_int8;
344#endif
345
346#ifdef YYTYPE_UINT16
347typedef YYTYPE_UINT16 yytype_uint16;
348#else
349typedef unsigned short int yytype_uint16;
350#endif
351
352#ifdef YYTYPE_INT16
353typedef YYTYPE_INT16 yytype_int16;
354#else
355typedef short int yytype_int16;
356#endif
357
358#ifndef YYSIZE_T
359# ifdef __SIZE_TYPE__
360# define YYSIZE_T __SIZE_TYPE__
361# elif defined size_t
362# define YYSIZE_T size_t
363# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
364 || defined __cplusplus || defined _MSC_VER)
365# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
366# define YYSIZE_T size_t
367# else
368# define YYSIZE_T unsigned int
369# endif
370#endif
371
372#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
373
374#ifndef YY_
Nicolas Capense9c5e4f2014-05-28 22:46:43 -0400375# if YYENABLE_NLS
John Bauman66b8ab22014-05-06 15:57:45 -0400376# if ENABLE_NLS
377# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
378# define YY_(msgid) dgettext ("bison-runtime", msgid)
379# endif
380# endif
381# ifndef YY_
382# define YY_(msgid) msgid
383# endif
384#endif
385
386/* Suppress unused-variable warnings by "using" E. */
387#if ! defined lint || defined __GNUC__
388# define YYUSE(e) ((void) (e))
389#else
390# define YYUSE(e) /* empty */
391#endif
392
393/* Identity function, used to suppress warnings about constant conditions. */
394#ifndef lint
395# define YYID(n) (n)
396#else
397#if (defined __STDC__ || defined __C99__FUNC__ \
398 || defined __cplusplus || defined _MSC_VER)
399static int
400YYID (int yyi)
401#else
402static int
403YYID (yyi)
404 int yyi;
405#endif
406{
407 return yyi;
408}
409#endif
410
411#if ! defined yyoverflow || YYERROR_VERBOSE
412
413/* The parser invokes alloca or malloc; define the necessary symbols. */
414
415# ifdef YYSTACK_USE_ALLOCA
416# if YYSTACK_USE_ALLOCA
417# ifdef __GNUC__
418# define YYSTACK_ALLOC __builtin_alloca
419# elif defined __BUILTIN_VA_ARG_INCR
420# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
421# elif defined _AIX
422# define YYSTACK_ALLOC __alloca
423# elif defined _MSC_VER
424# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
425# define alloca _alloca
426# else
427# define YYSTACK_ALLOC alloca
428# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
429 || defined __cplusplus || defined _MSC_VER)
430# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
431# ifndef _STDLIB_H
432# define _STDLIB_H 1
433# endif
434# endif
435# endif
436# endif
437# endif
438
439# ifdef YYSTACK_ALLOC
440 /* Pacify GCC's `empty if-body' warning. */
441# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
442# ifndef YYSTACK_ALLOC_MAXIMUM
443 /* The OS might guarantee only one guard page at the bottom of the stack,
444 and a page size can be as small as 4096 bytes. So we cannot safely
445 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
446 to allow for a few compiler-allocated temporary stack slots. */
447# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
448# endif
449# else
450# define YYSTACK_ALLOC YYMALLOC
451# define YYSTACK_FREE YYFREE
452# ifndef YYSTACK_ALLOC_MAXIMUM
453# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
454# endif
455# if (defined __cplusplus && ! defined _STDLIB_H \
456 && ! ((defined YYMALLOC || defined malloc) \
457 && (defined YYFREE || defined free)))
458# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
459# ifndef _STDLIB_H
460# define _STDLIB_H 1
461# endif
462# endif
463# ifndef YYMALLOC
464# define YYMALLOC malloc
465# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
466 || defined __cplusplus || defined _MSC_VER)
467void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
468# endif
469# endif
470# ifndef YYFREE
471# define YYFREE free
472# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
473 || defined __cplusplus || defined _MSC_VER)
474void free (void *); /* INFRINGES ON USER NAME SPACE */
475# endif
476# endif
477# endif
478#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
479
480
481#if (! defined yyoverflow \
482 && (! defined __cplusplus \
483 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
484
485/* A type that is properly aligned for any stack member. */
486union yyalloc
487{
488 yytype_int16 yyss_alloc;
489 YYSTYPE yyvs_alloc;
490};
491
492/* The size of the maximum gap between one aligned stack and the next. */
493# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
494
495/* The size of an array large to enough to hold all stacks, each with
496 N elements. */
497# define YYSTACK_BYTES(N) \
498 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
499 + YYSTACK_GAP_MAXIMUM)
500
501/* Copy COUNT objects from FROM to TO. The source and destination do
502 not overlap. */
503# ifndef YYCOPY
504# if defined __GNUC__ && 1 < __GNUC__
505# define YYCOPY(To, From, Count) \
506 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
507# else
508# define YYCOPY(To, From, Count) \
509 do \
510 { \
511 YYSIZE_T yyi; \
512 for (yyi = 0; yyi < (Count); yyi++) \
513 (To)[yyi] = (From)[yyi]; \
514 } \
515 while (YYID (0))
516# endif
517# endif
518
519/* Relocate STACK from its old location to the new one. The
520 local variables YYSIZE and YYSTACKSIZE give the old and new number of
521 elements in the stack, and YYPTR gives the new location of the
522 stack. Advance YYPTR to a properly aligned location for the next
523 stack. */
524# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
525 do \
526 { \
527 YYSIZE_T yynewbytes; \
528 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
529 Stack = &yyptr->Stack_alloc; \
530 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
531 yyptr += yynewbytes / sizeof (*yyptr); \
532 } \
533 while (YYID (0))
534
535#endif
536
537/* YYFINAL -- State number of the termination state. */
Nicolas Capense4b1b1d2015-02-17 17:26:01 -0500538#define YYFINAL 81
John Bauman66b8ab22014-05-06 15:57:45 -0400539/* YYLAST -- Last index in YYTABLE. */
Nicolas Capens2c1239f2015-02-17 17:30:04 -0500540#define YYLAST 1674
John Bauman66b8ab22014-05-06 15:57:45 -0400541
542/* YYNTOKENS -- Number of terminals. */
Nicolas Capens2c1239f2015-02-17 17:30:04 -0500543#define YYNTOKENS 110
John Bauman66b8ab22014-05-06 15:57:45 -0400544/* YYNNTS -- Number of nonterminals. */
Nicolas Capensa6a79ab2015-02-17 12:42:14 -0500545#define YYNNTS 85
John Bauman66b8ab22014-05-06 15:57:45 -0400546/* YYNRULES -- Number of rules. */
Nicolas Capens2c1239f2015-02-17 17:30:04 -0500547#define YYNRULES 212
John Bauman66b8ab22014-05-06 15:57:45 -0400548/* YYNRULES -- Number of states. */
Nicolas Capens2c1239f2015-02-17 17:30:04 -0500549#define YYNSTATES 316
John Bauman66b8ab22014-05-06 15:57:45 -0400550
551/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
552#define YYUNDEFTOK 2
Nicolas Capens2c1239f2015-02-17 17:30:04 -0500553#define YYMAXUTOK 364
John Bauman66b8ab22014-05-06 15:57:45 -0400554
555#define YYTRANSLATE(YYX) \
556 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
557
558/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
559static const yytype_uint8 yytranslate[] =
560{
561 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
562 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
563 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
564 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
565 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
566 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
567 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
568 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
569 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
570 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
571 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
572 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
573 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
574 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
575 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
576 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
577 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
578 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
579 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
580 2, 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, 1, 2, 3, 4,
587 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
588 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
589 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
590 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
591 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
592 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
593 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
594 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
Alexis Hetub027aa92015-01-19 15:56:12 -0500595 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
Nicolas Capens3c20f802015-02-17 17:17:20 -0500596 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
Nicolas Capens2c1239f2015-02-17 17:30:04 -0500597 105, 106, 107, 108, 109
John Bauman66b8ab22014-05-06 15:57:45 -0400598};
599
600#if YYDEBUG
601/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
602 YYRHS. */
603static const yytype_uint16 yyprhs[] =
604{
Nicolas Capens2c1239f2015-02-17 17:30:04 -0500605 0, 0, 3, 5, 7, 9, 11, 13, 15, 19,
606 21, 26, 28, 32, 35, 38, 40, 42, 44, 48,
607 51, 54, 57, 59, 62, 66, 69, 71, 73, 75,
608 77, 80, 83, 86, 88, 90, 92, 94, 98, 102,
609 104, 108, 112, 114, 116, 120, 124, 128, 132, 134,
610 138, 142, 144, 146, 148, 150, 154, 156, 160, 162,
611 166, 168, 174, 176, 180, 182, 184, 186, 188, 190,
612 192, 196, 198, 201, 204, 209, 212, 214, 216, 219,
613 223, 227, 230, 236, 240, 243, 247, 250, 251, 253,
614 255, 257, 259, 261, 265, 271, 278, 284, 286, 289,
615 294, 300, 305, 308, 310, 313, 315, 317, 319, 322,
616 324, 326, 328, 330, 333, 336, 338, 340, 343, 345,
617 347, 349, 351, 356, 358, 360, 362, 364, 366, 368,
Nicolas Capensa6a79ab2015-02-17 12:42:14 -0500618 370, 372, 374, 376, 378, 380, 382, 384, 386, 388,
Nicolas Capens2c1239f2015-02-17 17:30:04 -0500619 390, 392, 394, 396, 398, 400, 402, 404, 406, 408,
620 409, 416, 417, 423, 425, 428, 432, 434, 438, 440,
621 445, 447, 449, 451, 453, 455, 457, 459, 461, 463,
622 466, 467, 468, 474, 476, 478, 479, 482, 483, 486,
623 489, 493, 495, 498, 500, 503, 509, 513, 515, 517,
624 522, 523, 530, 531, 540, 541, 549, 551, 553, 555,
625 556, 559, 563, 566, 569, 572, 576, 579, 581, 584,
626 586, 588, 589
John Bauman66b8ab22014-05-06 15:57:45 -0400627};
628
629/* YYRHS -- A `-1'-separated list of the rules' RHS. */
630static const yytype_int16 yyrhs[] =
631{
Nicolas Capens2c1239f2015-02-17 17:30:04 -0500632 191, 0, -1, 58, -1, 111, -1, 61, -1, 62,
633 -1, 60, -1, 63, -1, 86, 138, 87, -1, 112,
634 -1, 113, 88, 114, 89, -1, 115, -1, 113, 92,
635 64, -1, 113, 67, -1, 113, 68, -1, 138, -1,
636 116, -1, 117, -1, 113, 92, 117, -1, 119, 87,
637 -1, 118, 87, -1, 120, 49, -1, 120, -1, 120,
638 136, -1, 119, 93, 136, -1, 121, 86, -1, 158,
639 -1, 58, -1, 64, -1, 113, -1, 67, 122, -1,
640 68, 122, -1, 123, 122, -1, 100, -1, 98, -1,
641 97, -1, 122, -1, 124, 101, 122, -1, 124, 102,
642 122, -1, 124, -1, 125, 100, 124, -1, 125, 98,
643 124, -1, 125, -1, 126, -1, 127, 104, 126, -1,
644 127, 105, 126, -1, 127, 69, 126, -1, 127, 70,
645 126, -1, 127, -1, 128, 71, 127, -1, 128, 72,
646 127, -1, 128, -1, 129, -1, 130, -1, 131, -1,
647 132, 73, 131, -1, 132, -1, 133, 75, 132, -1,
648 133, -1, 134, 74, 133, -1, 134, -1, 134, 109,
649 138, 94, 136, -1, 135, -1, 122, 137, 136, -1,
650 95, -1, 76, -1, 77, -1, 78, -1, 85, -1,
651 136, -1, 138, 93, 136, -1, 135, -1, 141, 96,
652 -1, 149, 96, -1, 7, 156, 157, 96, -1, 142,
653 87, -1, 144, -1, 143, -1, 144, 146, -1, 143,
654 93, 146, -1, 151, 58, 86, -1, 155, 58, -1,
655 155, 58, 88, 139, 89, -1, 152, 147, 145, -1,
656 147, 145, -1, 152, 147, 148, -1, 147, 148, -1,
657 -1, 40, -1, 41, -1, 42, -1, 155, -1, 150,
658 -1, 149, 93, 58, -1, 149, 93, 58, 88, 89,
659 -1, 149, 93, 58, 88, 139, 89, -1, 149, 93,
660 58, 95, 166, -1, 151, -1, 151, 58, -1, 151,
661 58, 88, 89, -1, 151, 58, 88, 139, 89, -1,
662 151, 58, 95, 166, -1, 3, 58, -1, 155, -1,
663 153, 155, -1, 9, -1, 8, -1, 44, -1, 3,
664 44, -1, 154, -1, 9, -1, 40, -1, 41, -1,
665 45, 40, -1, 45, 41, -1, 43, -1, 157, -1,
666 156, 157, -1, 4, -1, 5, -1, 6, -1, 158,
667 -1, 158, 88, 139, 89, -1, 49, -1, 11, -1,
668 12, -1, 13, -1, 10, -1, 31, -1, 32, -1,
669 33, -1, 25, -1, 26, -1, 27, -1, 28, -1,
670 29, -1, 30, -1, 34, -1, 35, -1, 36, -1,
671 37, -1, 38, -1, 39, -1, 51, -1, 52, -1,
672 53, -1, 55, -1, 159, -1, 59, -1, -1, 48,
673 58, 90, 160, 162, 91, -1, -1, 48, 90, 161,
674 162, 91, -1, 163, -1, 162, 163, -1, 155, 164,
675 96, -1, 165, -1, 164, 93, 165, -1, 58, -1,
676 58, 88, 139, 89, -1, 136, -1, 140, -1, 170,
677 -1, 169, -1, 167, -1, 179, -1, 180, -1, 183,
678 -1, 190, -1, 90, 91, -1, -1, -1, 90, 171,
679 178, 172, 91, -1, 177, -1, 169, -1, -1, 175,
680 177, -1, -1, 176, 169, -1, 90, 91, -1, 90,
681 178, 91, -1, 168, -1, 178, 168, -1, 96, -1,
682 138, 96, -1, 19, 86, 138, 87, 181, -1, 174,
683 17, 174, -1, 174, -1, 138, -1, 151, 58, 95,
684 166, -1, -1, 50, 86, 184, 182, 87, 173, -1,
685 -1, 16, 185, 174, 50, 86, 138, 87, 96, -1,
686 -1, 18, 86, 186, 187, 189, 87, 173, -1, 179,
687 -1, 167, -1, 182, -1, -1, 188, 96, -1, 188,
688 96, 138, -1, 15, 96, -1, 14, 96, -1, 21,
689 96, -1, 21, 138, 96, -1, 20, 96, -1, 192,
690 -1, 191, 192, -1, 193, -1, 140, -1, -1, 141,
691 194, 177, -1
John Bauman66b8ab22014-05-06 15:57:45 -0400692};
693
694/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
695static const yytype_uint16 yyrline[] =
696{
Nicolas Capens2c1239f2015-02-17 17:30:04 -0500697 0, 184, 184, 219, 222, 227, 232, 237, 242, 248,
698 251, 330, 333, 434, 444, 457, 465, 565, 568, 576,
699 580, 587, 591, 598, 604, 613, 621, 676, 683, 693,
700 696, 706, 716, 737, 738, 739, 744, 745, 754, 766,
701 767, 775, 786, 790, 791, 801, 811, 821, 834, 835,
702 845, 858, 862, 866, 870, 871, 884, 885, 898, 899,
703 912, 913, 930, 931, 944, 945, 946, 947, 948, 952,
704 955, 966, 974, 1001, 1006, 1016, 1054, 1057, 1064, 1072,
705 1093, 1114, 1125, 1154, 1159, 1169, 1174, 1184, 1187, 1190,
706 1193, 1199, 1206, 1209, 1231, 1249, 1273, 1296, 1300, 1318,
707 1326, 1358, 1378, 1466, 1475, 1498, 1504, 1511, 1520, 1529,
708 1535, 1539, 1544, 1549, 1555, 1561, 1570, 1580, 1587, 1590,
709 1593, 1599, 1602, 1617, 1621, 1625, 1629, 1633, 1637, 1642,
710 1647, 1652, 1657, 1662, 1667, 1672, 1677, 1682, 1687, 1692,
711 1697, 1703, 1709, 1715, 1720, 1725, 1734, 1739, 1744, 1757,
712 1757, 1771, 1771, 1780, 1783, 1798, 1830, 1834, 1840, 1848,
713 1864, 1868, 1872, 1873, 1879, 1880, 1881, 1882, 1883, 1887,
714 1888, 1888, 1888, 1898, 1899, 1903, 1903, 1904, 1904, 1909,
715 1912, 1922, 1925, 1931, 1932, 1936, 1944, 1948, 1958, 1963,
716 1980, 1980, 1985, 1985, 1992, 1992, 2000, 2003, 2009, 2012,
717 2018, 2022, 2029, 2036, 2043, 2050, 2061, 2070, 2074, 2081,
718 2084, 2090, 2090
John Bauman66b8ab22014-05-06 15:57:45 -0400719};
720#endif
721
722#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
723/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
724 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
725static const char *const yytname[] =
726{
727 "$end", "error", "$undefined", "INVARIANT", "HIGH_PRECISION",
728 "MEDIUM_PRECISION", "LOW_PRECISION", "PRECISION", "ATTRIBUTE",
Nicolas Capens3c20f802015-02-17 17:17:20 -0500729 "CONST_QUAL", "BOOL_TYPE", "FLOAT_TYPE", "INT_TYPE", "UINT_TYPE",
730 "BREAK", "CONTINUE", "DO", "ELSE", "FOR", "IF", "DISCARD", "RETURN",
731 "SWITCH", "CASE", "DEFAULT", "BVEC2", "BVEC3", "BVEC4", "IVEC2", "IVEC3",
Nicolas Capense4b1b1d2015-02-17 17:26:01 -0500732 "IVEC4", "VEC2", "VEC3", "VEC4", "UVEC2", "UVEC3", "UVEC4", "MATRIX2",
733 "MATRIX3", "MATRIX4", "IN_QUAL", "OUT_QUAL", "INOUT_QUAL", "UNIFORM",
734 "VARYING", "CENTROID", "FLAT", "SMOOTH", "STRUCT", "VOID_TYPE", "WHILE",
735 "SAMPLER2D", "SAMPLERCUBE", "SAMPLER_EXTERNAL_OES", "SAMPLER2DRECT",
736 "SAMPLER3D", "SAMPLER3DRECT", "SAMPLER2DSHADOW", "IDENTIFIER",
Nicolas Capens2c1239f2015-02-17 17:30:04 -0500737 "TYPE_NAME", "FLOATCONSTANT", "INTCONSTANT", "UINTCONSTANT",
738 "BOOLCONSTANT", "FIELD_SELECTION", "LEFT_OP", "RIGHT_OP", "INC_OP",
739 "DEC_OP", "LE_OP", "GE_OP", "EQ_OP", "NE_OP", "AND_OP", "OR_OP",
740 "XOR_OP", "MUL_ASSIGN", "DIV_ASSIGN", "ADD_ASSIGN", "MOD_ASSIGN",
741 "LEFT_ASSIGN", "RIGHT_ASSIGN", "AND_ASSIGN", "XOR_ASSIGN", "OR_ASSIGN",
742 "SUB_ASSIGN", "LEFT_PAREN", "RIGHT_PAREN", "LEFT_BRACKET",
743 "RIGHT_BRACKET", "LEFT_BRACE", "RIGHT_BRACE", "DOT", "COMMA", "COLON",
744 "EQUAL", "SEMICOLON", "BANG", "DASH", "TILDE", "PLUS", "STAR", "SLASH",
745 "PERCENT", "LEFT_ANGLE", "RIGHT_ANGLE", "VERTICAL_BAR", "CARET",
746 "AMPERSAND", "QUESTION", "$accept", "variable_identifier",
747 "primary_expression", "postfix_expression", "integer_expression",
748 "function_call", "function_call_or_method", "function_call_generic",
John Bauman66b8ab22014-05-06 15:57:45 -0400749 "function_call_header_no_parameters",
750 "function_call_header_with_parameters", "function_call_header",
751 "function_identifier", "unary_expression", "unary_operator",
752 "multiplicative_expression", "additive_expression", "shift_expression",
753 "relational_expression", "equality_expression", "and_expression",
754 "exclusive_or_expression", "inclusive_or_expression",
755 "logical_and_expression", "logical_xor_expression",
756 "logical_or_expression", "conditional_expression",
757 "assignment_expression", "assignment_operator", "expression",
758 "constant_expression", "declaration", "function_prototype",
759 "function_declarator", "function_header_with_parameters",
760 "function_header", "parameter_declarator", "parameter_declaration",
761 "parameter_qualifier", "parameter_type_specifier",
762 "init_declarator_list", "single_declaration", "fully_specified_type",
Nicolas Capensa6a79ab2015-02-17 12:42:14 -0500763 "parameter_type_qualifier", "type_qualifier", "storage_qualifier",
764 "type_specifier", "precision_qualifier", "type_specifier_no_prec",
765 "type_specifier_nonarray", "struct_specifier", "$@1", "$@2",
766 "struct_declaration_list", "struct_declaration",
John Bauman66b8ab22014-05-06 15:57:45 -0400767 "struct_declarator_list", "struct_declarator", "initializer",
768 "declaration_statement", "statement", "simple_statement",
769 "compound_statement", "$@3", "$@4", "statement_no_new_scope",
770 "statement_with_scope", "$@5", "$@6", "compound_statement_no_new_scope",
771 "statement_list", "expression_statement", "selection_statement",
772 "selection_rest_statement", "condition", "iteration_statement", "$@7",
773 "$@8", "$@9", "for_init_statement", "conditionopt", "for_rest_statement",
774 "jump_statement", "translation_unit", "external_declaration",
775 "function_definition", "$@10", 0
776};
777#endif
778
779# ifdef YYPRINT
780/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
781 token YYLEX-NUM. */
782static const yytype_uint16 yytoknum[] =
783{
784 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
785 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
786 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
787 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
788 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
789 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
790 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
791 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
792 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
Nicolas Capensc6841852015-02-15 14:25:37 -0500793 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
Nicolas Capens2c1239f2015-02-17 17:30:04 -0500794 355, 356, 357, 358, 359, 360, 361, 362, 363, 364
John Bauman66b8ab22014-05-06 15:57:45 -0400795};
796# endif
797
798/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
799static const yytype_uint8 yyr1[] =
800{
Nicolas Capens2c1239f2015-02-17 17:30:04 -0500801 0, 110, 111, 112, 112, 112, 112, 112, 112, 113,
802 113, 113, 113, 113, 113, 114, 115, 116, 116, 117,
803 117, 118, 118, 119, 119, 120, 121, 121, 121, 122,
804 122, 122, 122, 123, 123, 123, 124, 124, 124, 125,
805 125, 125, 126, 127, 127, 127, 127, 127, 128, 128,
806 128, 129, 130, 131, 132, 132, 133, 133, 134, 134,
807 135, 135, 136, 136, 137, 137, 137, 137, 137, 138,
808 138, 139, 140, 140, 140, 141, 142, 142, 143, 143,
809 144, 145, 145, 146, 146, 146, 146, 147, 147, 147,
810 147, 148, 149, 149, 149, 149, 149, 150, 150, 150,
811 150, 150, 150, 151, 151, 152, 153, 153, 153, 153,
812 154, 154, 154, 154, 154, 154, 155, 155, 156, 156,
813 156, 157, 157, 158, 158, 158, 158, 158, 158, 158,
814 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
815 158, 158, 158, 158, 158, 158, 158, 158, 158, 160,
816 159, 161, 159, 162, 162, 163, 164, 164, 165, 165,
817 166, 167, 168, 168, 169, 169, 169, 169, 169, 170,
818 171, 172, 170, 173, 173, 175, 174, 176, 174, 177,
819 177, 178, 178, 179, 179, 180, 181, 181, 182, 182,
820 184, 183, 185, 183, 186, 183, 187, 187, 188, 188,
821 189, 189, 190, 190, 190, 190, 190, 191, 191, 192,
822 192, 194, 193
John Bauman66b8ab22014-05-06 15:57:45 -0400823};
824
825/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
826static const yytype_uint8 yyr2[] =
827{
Nicolas Capens2c1239f2015-02-17 17:30:04 -0500828 0, 2, 1, 1, 1, 1, 1, 1, 3, 1,
829 4, 1, 3, 2, 2, 1, 1, 1, 3, 2,
830 2, 2, 1, 2, 3, 2, 1, 1, 1, 1,
831 2, 2, 2, 1, 1, 1, 1, 3, 3, 1,
832 3, 3, 1, 1, 3, 3, 3, 3, 1, 3,
833 3, 1, 1, 1, 1, 3, 1, 3, 1, 3,
834 1, 5, 1, 3, 1, 1, 1, 1, 1, 1,
835 3, 1, 2, 2, 4, 2, 1, 1, 2, 3,
836 3, 2, 5, 3, 2, 3, 2, 0, 1, 1,
837 1, 1, 1, 3, 5, 6, 5, 1, 2, 4,
838 5, 4, 2, 1, 2, 1, 1, 1, 2, 1,
839 1, 1, 1, 2, 2, 1, 1, 2, 1, 1,
840 1, 1, 4, 1, 1, 1, 1, 1, 1, 1,
John Bauman66b8ab22014-05-06 15:57:45 -0400841 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
Nicolas Capens2c1239f2015-02-17 17:30:04 -0500842 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
843 6, 0, 5, 1, 2, 3, 1, 3, 1, 4,
844 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
845 0, 0, 5, 1, 1, 0, 2, 0, 2, 2,
846 3, 1, 2, 1, 2, 5, 3, 1, 1, 4,
847 0, 6, 0, 8, 0, 7, 1, 1, 1, 0,
848 2, 3, 2, 2, 2, 3, 2, 1, 2, 1,
849 1, 0, 3
John Bauman66b8ab22014-05-06 15:57:45 -0400850};
851
852/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
853 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
854 means the default is an error. */
855static const yytype_uint8 yydefact[] =
856{
Nicolas Capens2c1239f2015-02-17 17:30:04 -0500857 0, 0, 118, 119, 120, 0, 106, 110, 127, 124,
858 125, 126, 131, 132, 133, 134, 135, 136, 128, 129,
859 130, 137, 138, 139, 140, 141, 142, 111, 112, 115,
860 107, 0, 0, 123, 143, 144, 145, 146, 148, 210,
861 211, 0, 77, 87, 0, 92, 97, 0, 109, 103,
862 0, 116, 121, 147, 0, 207, 209, 108, 102, 0,
863 113, 114, 0, 151, 72, 0, 75, 87, 105, 88,
864 89, 90, 78, 0, 87, 0, 73, 98, 104, 117,
865 0, 1, 208, 0, 149, 0, 0, 212, 79, 84,
866 86, 91, 0, 93, 80, 0, 0, 2, 6, 4,
867 5, 7, 28, 0, 0, 0, 35, 34, 33, 3,
868 9, 29, 11, 16, 17, 0, 0, 22, 0, 36,
869 0, 39, 42, 43, 48, 51, 52, 53, 54, 56,
870 58, 60, 71, 0, 26, 74, 0, 0, 0, 153,
871 0, 0, 192, 0, 0, 0, 0, 0, 170, 179,
872 183, 36, 62, 69, 0, 161, 0, 121, 164, 181,
873 163, 162, 0, 165, 166, 167, 168, 81, 83, 85,
874 0, 0, 99, 0, 160, 101, 30, 31, 0, 13,
875 14, 0, 0, 20, 19, 0, 21, 23, 25, 32,
Nicolas Capens3c20f802015-02-17 17:17:20 -0500876 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Nicolas Capens2c1239f2015-02-17 17:30:04 -0500877 0, 0, 0, 0, 122, 0, 158, 0, 156, 152,
878 154, 203, 202, 177, 194, 0, 206, 204, 0, 190,
879 169, 0, 65, 66, 67, 68, 64, 0, 0, 184,
880 180, 182, 0, 94, 0, 96, 100, 8, 0, 15,
881 27, 12, 18, 24, 37, 38, 41, 40, 46, 47,
882 44, 45, 49, 50, 55, 57, 59, 0, 150, 0,
883 0, 155, 0, 0, 0, 0, 0, 205, 0, 171,
884 63, 70, 0, 95, 10, 0, 0, 157, 0, 176,
885 178, 197, 196, 199, 177, 0, 188, 0, 0, 0,
886 82, 61, 159, 0, 198, 0, 0, 187, 185, 0,
887 0, 172, 0, 200, 0, 177, 0, 174, 191, 173,
888 0, 201, 195, 186, 189, 193
John Bauman66b8ab22014-05-06 15:57:45 -0400889};
890
891/* YYDEFGOTO[NTERM-NUM]. */
892static const yytype_int16 yydefgoto[] =
893{
Nicolas Capens2c1239f2015-02-17 17:30:04 -0500894 -1, 109, 110, 111, 238, 112, 113, 114, 115, 116,
895 117, 118, 151, 120, 121, 122, 123, 124, 125, 126,
896 127, 128, 129, 130, 131, 152, 153, 227, 154, 133,
897 155, 156, 41, 42, 43, 89, 72, 73, 90, 44,
898 45, 46, 74, 47, 48, 49, 50, 51, 134, 53,
899 136, 85, 138, 139, 207, 208, 175, 158, 159, 160,
900 161, 221, 289, 308, 262, 263, 264, 309, 162, 163,
901 164, 298, 288, 165, 268, 213, 265, 283, 295, 296,
902 166, 54, 55, 56, 65
John Bauman66b8ab22014-05-06 15:57:45 -0400903};
904
905/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
906 STATE-NUM. */
Nicolas Capens2c1239f2015-02-17 17:30:04 -0500907#define YYPACT_NINF -253
John Bauman66b8ab22014-05-06 15:57:45 -0400908static const yytype_int16 yypact[] =
909{
Nicolas Capens2c1239f2015-02-17 17:30:04 -0500910 1463, -20, -253, -253, -253, 125, -253, -253, -253, -253,
911 -253, -253, -253, -253, -253, -253, -253, -253, -253, -253,
912 -253, -253, -253, -253, -253, -253, -253, -253, -253, -253,
913 -253, 68, -44, -253, -253, -253, -253, -253, -253, -253,
914 -71, -25, -23, 1, -66, -253, 56, 1515, -253, -253,
915 1615, -253, 49, -253, 1406, -253, -253, -253, -253, 1615,
916 -253, -253, 57, -253, -253, 64, -253, 27, -253, -253,
917 -253, -253, -253, 1515, 104, 95, -253, -6, -253, -253,
918 1185, -253, -253, 59, -253, 1515, 302, -253, -253, -253,
919 -253, 101, 1515, -62, -253, 948, 1185, 74, -253, -253,
920 -253, -253, -253, 1185, 1185, 1185, -253, -253, -253, -253,
921 -253, -28, -253, -253, -253, 76, -22, 1262, 75, -253,
922 1185, -67, -26, -253, -52, 40, -253, -253, -253, 91,
923 90, -61, -253, 78, -253, -253, 1515, 110, 202, -253,
924 77, 79, -253, 85, 86, 80, 1028, 88, 87, -253,
925 -253, 63, -253, -253, -35, -253, -71, 10, -253, -253,
926 -253, -253, 400, -253, -253, -253, -253, 89, -253, -253,
927 1105, 1185, -253, 93, -253, -253, -253, -253, -10, -253,
928 -253, 1185, 1565, -253, -253, 1185, 99, -253, -253, -253,
929 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185,
930 1185, 1185, 1185, 1185, -253, 1339, 98, -9, -253, -253,
931 -253, -253, -253, 97, -253, 1185, -253, -253, 14, -253,
932 -253, 498, -253, -253, -253, -253, -253, 1185, 1185, -253,
933 -253, -253, 1185, -253, 100, -253, -253, -253, 103, 102,
934 -253, 107, -253, -253, -253, -253, -67, -67, -253, -253,
935 -253, -253, -52, -52, -253, 91, 90, 41, -253, 1185,
936 110, -253, 129, 64, 694, 792, 4, -253, 871, 498,
937 -253, -253, 105, -253, -253, 1185, 108, -253, 112, -253,
938 -253, -253, -253, 871, 97, 144, 102, 132, 109, 111,
939 -253, -253, -253, 1185, -253, 113, 116, 182, -253, 115,
940 596, -253, 6, 1185, 596, 97, 1185, -253, -253, -253,
941 120, 102, -253, -253, -253, -253
John Bauman66b8ab22014-05-06 15:57:45 -0400942};
943
944/* YYPGOTO[NTERM-NUM]. */
945static const yytype_int16 yypgoto[] =
946{
Nicolas Capens2c1239f2015-02-17 17:30:04 -0500947 -253, -253, -253, -253, -253, -253, -253, 22, -253, -253,
948 -253, -253, -75, -253, -43, -253, -91, -47, -253, -253,
949 -253, 17, 18, 16, -253, -76, -95, -253, -102, -89,
950 9, 12, -253, -253, -253, 128, 155, 149, 133, -253,
951 -253, -252, -253, -253, -253, -36, 219, -27, 0, -253,
952 -253, -253, 106, -130, -253, -34, -164, -21, -141, -249,
953 -253, -253, -253, -59, -227, -253, -253, -63, 25, -18,
954 -253, -253, -40, -253, -253, -253, -253, -253, -253, -253,
955 -253, -253, 194, -253, -253
John Bauman66b8ab22014-05-06 15:57:45 -0400956};
957
958/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
959 positive, shift that token. If negative, reduce the rule which
960 number is the opposite. If zero, do what YYDEFACT says.
961 If YYTABLE_NINF, syntax error. */
Nicolas Capens2c1239f2015-02-17 17:30:04 -0500962#define YYTABLE_NINF -176
John Bauman66b8ab22014-05-06 15:57:45 -0400963static const yytype_int16 yytable[] =
964{
Nicolas Capens2c1239f2015-02-17 17:30:04 -0500965 52, 174, 87, 178, 132, 119, 173, 235, 210, 39,
966 68, 78, 40, 202, 62, 280, 287, 194, 195, 132,
967 119, 231, 187, 79, 57, 64, 170, 75, 176, 177,
968 76, 287, 83, 171, 190, 191, 68, 91, 58, 179,
969 180, 69, 70, 71, 218, 189, 63, 52, 203, 137,
970 52, 307, 196, 197, 52, 307, 91, 297, 228, 52,
971 181, 229, 66, 39, 182, 184, 40, 69, 70, 71,
972 67, 185, 192, 52, 193, 210, 174, 237, 313, 239,
973 94, 234, 95, 228, 260, 52, 157, 261, -76, 96,
974 243, 284, 52, 310, 132, 119, -26, 228, 80, 228,
975 137, 257, 137, 248, 249, 250, 251, 228, 60, 61,
976 267, 198, 199, 266, 77, 244, 245, 119, 119, 119,
977 119, 119, 119, 119, 119, 119, 119, 119, 231, 2,
978 3, 4, 270, 271, 228, 275, 52, 80, 52, 222,
979 223, 224, 314, 272, 69, 70, 71, 84, 225, 246,
980 247, 252, 253, 93, 86, 135, 132, 119, 226, 167,
981 -27, 188, 157, 183, 200, 201, 286, 204, 206, 137,
982 276, 214, 215, 211, 219, 212, 216, 232, 220, 278,
983 291, 286, 236, 132, 119, -123, 259, -175, 57, 273,
984 299, 302, 274, -28, 290, 228, 300, 292, 293, 305,
985 279, 311, 301, 304, 242, 52, 2, 3, 4, 303,
986 306, 174, 8, 9, 10, 11, 315, 254, 256, 255,
987 168, 157, 88, 92, 59, 169, 277, 12, 13, 14,
988 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
989 25, 26, 205, 294, 281, 312, 269, 282, 82, 0,
990 32, 33, 0, 34, 35, 36, 0, 37, 0, 0,
991 0, 38, 0, 0, 157, 157, 0, 0, 157, 157,
Nicolas Capense4b1b1d2015-02-17 17:26:01 -0500992 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Nicolas Capens2c1239f2015-02-17 17:30:04 -0500993 0, 0, 0, 157, 0, 0, 0, 0, 0, 0,
994 0, 0, 0, 209, 0, 0, 0, 0, 0, 0,
995 157, 0, 0, 0, 157, 1, 2, 3, 4, 5,
996 6, 7, 8, 9, 10, 11, 140, 141, 142, 0,
997 143, 144, 145, 146, 0, 0, 0, 12, 13, 14,
Nicolas Capense4b1b1d2015-02-17 17:26:01 -0500998 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
999 25, 26, 27, 28, 0, 29, 30, 31, 0, 0,
Nicolas Capens2c1239f2015-02-17 17:30:04 -05001000 32, 33, 147, 34, 35, 36, 0, 37, 0, 0,
1001 97, 38, 98, 99, 100, 101, 102, 0, 0, 103,
1002 104, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1003 0, 0, 0, 0, 0, 0, 0, 0, 105, 0,
1004 0, 0, 148, 149, 0, 0, 0, 0, 150, 106,
1005 107, 0, 108, 1, 2, 3, 4, 5, 6, 7,
1006 8, 9, 10, 11, 140, 141, 142, 0, 143, 144,
1007 145, 146, 0, 0, 0, 12, 13, 14, 15, 16,
1008 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
1009 27, 28, 0, 29, 30, 31, 0, 0, 32, 33,
1010 147, 34, 35, 36, 0, 37, 0, 0, 97, 38,
1011 98, 99, 100, 101, 102, 0, 0, 103, 104, 0,
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05001012 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Nicolas Capens2c1239f2015-02-17 17:30:04 -05001013 0, 0, 0, 0, 0, 0, 105, 0, 0, 0,
1014 148, 230, 0, 0, 0, 0, 150, 106, 107, 0,
1015 108, 1, 2, 3, 4, 5, 6, 7, 8, 9,
1016 10, 11, 140, 141, 142, 0, 143, 144, 145, 146,
1017 0, 0, 0, 12, 13, 14, 15, 16, 17, 18,
1018 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
1019 0, 29, 30, 31, 0, 0, 32, 33, 147, 34,
1020 35, 36, 0, 37, 0, 0, 97, 38, 98, 99,
1021 100, 101, 102, 0, 0, 103, 104, 0, 0, 0,
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05001022 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Nicolas Capens2c1239f2015-02-17 17:30:04 -05001023 0, 0, 0, 0, 105, 0, 0, 0, 148, 0,
1024 0, 0, 0, 0, 150, 106, 107, 0, 108, 1,
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05001025 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
Nicolas Capens2c1239f2015-02-17 17:30:04 -05001026 140, 141, 142, 0, 143, 144, 145, 146, 0, 0,
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05001027 0, 12, 13, 14, 15, 16, 17, 18, 19, 20,
1028 21, 22, 23, 24, 25, 26, 27, 28, 0, 29,
Nicolas Capens2c1239f2015-02-17 17:30:04 -05001029 30, 31, 0, 0, 32, 33, 147, 34, 35, 36,
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05001030 0, 37, 0, 0, 97, 38, 98, 99, 100, 101,
Nicolas Capens2c1239f2015-02-17 17:30:04 -05001031 102, 0, 0, 103, 104, 0, 0, 0, 0, 0,
1032 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1033 0, 0, 105, 0, 0, 0, 86, 0, 0, 0,
1034 0, 0, 150, 106, 107, 0, 108, 1, 2, 3,
1035 4, 5, 6, 7, 8, 9, 10, 11, 140, 141,
1036 142, 0, 143, 144, 145, 146, 0, 0, 0, 12,
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05001037 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
1038 23, 24, 25, 26, 27, 28, 0, 29, 30, 31,
Nicolas Capens2c1239f2015-02-17 17:30:04 -05001039 0, 0, 32, 33, 147, 34, 35, 36, 0, 37,
1040 0, 0, 97, 38, 98, 99, 100, 101, 102, 0,
1041 0, 103, 104, 0, 0, 0, 0, 0, 0, 0,
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05001042 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Nicolas Capens2c1239f2015-02-17 17:30:04 -05001043 105, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1044 150, 106, 107, 0, 108, 1, 2, 3, 4, 5,
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05001045 6, 7, 8, 9, 10, 11, 0, 0, 0, 0,
Nicolas Capens2c1239f2015-02-17 17:30:04 -05001046 0, 0, 0, 0, 0, 0, 0, 12, 13, 14,
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05001047 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1048 25, 26, 27, 28, 0, 29, 30, 31, 0, 0,
1049 32, 33, 0, 34, 35, 36, 0, 37, 0, 0,
Nicolas Capens2c1239f2015-02-17 17:30:04 -05001050 97, 38, 98, 99, 100, 101, 102, 0, 0, 103,
1051 104, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1052 0, 0, 0, 0, 285, 2, 3, 4, 105, 6,
1053 7, 8, 9, 10, 11, 0, 0, 0, 150, 106,
1054 107, 0, 108, 0, 0, 0, 12, 13, 14, 15,
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05001055 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
Nicolas Capens2c1239f2015-02-17 17:30:04 -05001056 26, 27, 28, 0, 29, 30, 31, 0, 0, 32,
1057 33, 0, 34, 35, 36, 0, 37, 0, 0, 97,
1058 38, 98, 99, 100, 101, 102, 0, 0, 103, 104,
1059 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1060 0, 0, 0, 0, 0, 0, 0, 105, 8, 9,
1061 10, 11, 0, 0, 0, 0, 0, 0, 106, 107,
1062 0, 108, 0, 12, 13, 14, 15, 16, 17, 18,
1063 19, 20, 21, 22, 23, 24, 25, 26, 0, 0,
1064 0, 0, 0, 0, 0, 0, 32, 33, 0, 34,
1065 35, 36, 0, 37, 0, 0, 97, 38, 98, 99,
1066 100, 101, 102, 0, 0, 103, 104, 0, 0, 0,
1067 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1068 0, 0, 0, 0, 105, 0, 0, 172, 8, 9,
1069 10, 11, 0, 0, 0, 106, 107, 0, 108, 0,
1070 0, 0, 0, 12, 13, 14, 15, 16, 17, 18,
1071 19, 20, 21, 22, 23, 24, 25, 26, 0, 0,
1072 0, 0, 0, 0, 0, 0, 32, 33, 0, 34,
1073 35, 36, 0, 37, 0, 0, 97, 38, 98, 99,
1074 100, 101, 102, 0, 0, 103, 104, 0, 0, 0,
1075 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1076 0, 0, 0, 0, 105, 8, 9, 10, 11, 0,
1077 0, 0, 0, 0, 217, 106, 107, 0, 108, 0,
1078 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
1079 22, 23, 24, 25, 26, 0, 0, 0, 0, 0,
1080 0, 0, 0, 32, 33, 0, 34, 35, 36, 0,
1081 37, 0, 0, 97, 38, 98, 99, 100, 101, 102,
1082 0, 0, 103, 104, 0, 0, 0, 0, 0, 0,
1083 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1084 0, 105, 0, 0, 233, 8, 9, 10, 11, 0,
1085 0, 0, 106, 107, 0, 108, 0, 0, 0, 0,
1086 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
1087 22, 23, 24, 25, 26, 0, 0, 0, 0, 0,
1088 0, 0, 0, 32, 33, 0, 34, 35, 36, 0,
1089 37, 0, 0, 97, 38, 98, 99, 100, 101, 102,
1090 0, 0, 103, 104, 0, 0, 0, 0, 0, 0,
1091 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1092 0, 105, 8, 9, 10, 11, 0, 0, 0, 0,
1093 0, 0, 106, 107, 0, 108, 0, 12, 13, 14,
1094 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1095 25, 26, 0, 0, 0, 0, 0, 0, 0, 0,
1096 32, 186, 0, 34, 35, 36, 0, 37, 0, 0,
1097 97, 38, 98, 99, 100, 101, 102, 0, 0, 103,
1098 104, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1099 0, 0, 0, 2, 3, 4, 0, 0, 105, 8,
1100 9, 10, 11, 0, 0, 0, 0, 0, 0, 106,
1101 107, 0, 108, 0, 12, 13, 14, 15, 16, 17,
1102 18, 19, 20, 21, 22, 23, 24, 25, 26, 0,
1103 0, 0, 0, 0, 0, 0, 0, 32, 33, 0,
1104 34, 35, 36, 0, 37, 0, 0, 0, 38, 0,
1105 0, 0, 0, 0, 0, 0, 81, 0, 0, 1,
1106 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
1107 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1108 258, 12, 13, 14, 15, 16, 17, 18, 19, 20,
1109 21, 22, 23, 24, 25, 26, 27, 28, 0, 29,
1110 30, 31, 0, 0, 32, 33, 0, 34, 35, 36,
1111 0, 37, 0, 0, 0, 38, 1, 2, 3, 4,
1112 5, 6, 7, 8, 9, 10, 11, 0, 0, 0,
1113 0, 0, 0, 0, 0, 0, 0, 0, 12, 13,
1114 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
1115 24, 25, 26, 27, 28, 0, 29, 30, 31, 0,
1116 0, 32, 33, 0, 34, 35, 36, 0, 37, 2,
1117 3, 4, 38, 0, 0, 8, 9, 10, 11, 0,
1118 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1119 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
1120 22, 23, 24, 25, 26, 0, 0, 0, 0, 0,
1121 0, 0, 0, 32, 33, 0, 34, 35, 36, 0,
1122 37, 0, 0, 0, 38, 8, 9, 10, 11, 0,
1123 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1124 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
1125 22, 23, 24, 25, 26, 0, 0, 0, 0, 0,
1126 0, 0, 0, 32, 33, 0, 34, 35, 36, 0,
1127 37, 0, 0, 240, 38, 8, 9, 10, 11, 241,
Nicolas Capens3c20f802015-02-17 17:17:20 -05001128 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1129 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05001130 22, 23, 24, 25, 26, 0, 0, 0, 0, 0,
1131 0, 0, 0, 32, 33, 0, 34, 35, 36, 0,
1132 37, 0, 0, 0, 38
John Bauman66b8ab22014-05-06 15:57:45 -04001133};
1134
1135static const yytype_int16 yycheck[] =
1136{
Nicolas Capens2c1239f2015-02-17 17:30:04 -05001137 0, 96, 65, 105, 80, 80, 95, 171, 138, 0,
1138 9, 47, 0, 74, 58, 264, 268, 69, 70, 95,
1139 95, 162, 117, 50, 44, 96, 88, 93, 103, 104,
1140 96, 283, 59, 95, 101, 102, 9, 73, 58, 67,
1141 68, 40, 41, 42, 146, 120, 90, 47, 109, 85,
1142 50, 300, 104, 105, 54, 304, 92, 284, 93, 59,
1143 88, 96, 87, 54, 92, 87, 54, 40, 41, 42,
1144 93, 93, 98, 73, 100, 205, 171, 87, 305, 181,
1145 86, 170, 88, 93, 93, 85, 86, 96, 87, 95,
1146 185, 87, 92, 87, 170, 170, 86, 93, 88, 93,
1147 136, 203, 138, 194, 195, 196, 197, 93, 40, 41,
1148 96, 71, 72, 215, 58, 190, 191, 192, 193, 194,
1149 195, 196, 197, 198, 199, 200, 201, 202, 269, 4,
1150 5, 6, 227, 228, 93, 94, 136, 88, 138, 76,
1151 77, 78, 306, 232, 40, 41, 42, 90, 85, 192,
1152 193, 198, 199, 58, 90, 96, 232, 232, 95, 58,
1153 86, 86, 162, 87, 73, 75, 268, 89, 58, 205,
1154 259, 86, 86, 96, 86, 96, 96, 88, 91, 50,
1155 275, 283, 89, 259, 259, 86, 88, 90, 44, 89,
1156 58, 293, 89, 86, 89, 93, 87, 89, 86, 17,
1157 263, 303, 91, 87, 182, 205, 4, 5, 6, 96,
1158 95, 306, 10, 11, 12, 13, 96, 200, 202, 201,
1159 92, 221, 67, 74, 5, 92, 260, 25, 26, 27,
1160 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
1161 38, 39, 136, 283, 265, 304, 221, 265, 54, -1,
1162 48, 49, -1, 51, 52, 53, -1, 55, -1, -1,
1163 -1, 59, -1, -1, 264, 265, -1, -1, 268, 269,
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05001164 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Nicolas Capens2c1239f2015-02-17 17:30:04 -05001165 -1, -1, -1, 283, -1, -1, -1, -1, -1, -1,
1166 -1, -1, -1, 91, -1, -1, -1, -1, -1, -1,
1167 300, -1, -1, -1, 304, 3, 4, 5, 6, 7,
Nicolas Capens3c20f802015-02-17 17:17:20 -05001168 8, 9, 10, 11, 12, 13, 14, 15, 16, -1,
1169 18, 19, 20, 21, -1, -1, -1, 25, 26, 27,
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05001170 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05001171 38, 39, 40, 41, -1, 43, 44, 45, -1, -1,
1172 48, 49, 50, 51, 52, 53, -1, 55, -1, -1,
Nicolas Capens2c1239f2015-02-17 17:30:04 -05001173 58, 59, 60, 61, 62, 63, 64, -1, -1, 67,
1174 68, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1175 -1, -1, -1, -1, -1, -1, -1, -1, 86, -1,
1176 -1, -1, 90, 91, -1, -1, -1, -1, 96, 97,
1177 98, -1, 100, 3, 4, 5, 6, 7, 8, 9,
1178 10, 11, 12, 13, 14, 15, 16, -1, 18, 19,
1179 20, 21, -1, -1, -1, 25, 26, 27, 28, 29,
1180 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
1181 40, 41, -1, 43, 44, 45, -1, -1, 48, 49,
1182 50, 51, 52, 53, -1, 55, -1, -1, 58, 59,
1183 60, 61, 62, 63, 64, -1, -1, 67, 68, -1,
Nicolas Capensc6841852015-02-15 14:25:37 -05001184 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Nicolas Capens2c1239f2015-02-17 17:30:04 -05001185 -1, -1, -1, -1, -1, -1, 86, -1, -1, -1,
1186 90, 91, -1, -1, -1, -1, 96, 97, 98, -1,
1187 100, 3, 4, 5, 6, 7, 8, 9, 10, 11,
1188 12, 13, 14, 15, 16, -1, 18, 19, 20, 21,
1189 -1, -1, -1, 25, 26, 27, 28, 29, 30, 31,
1190 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
1191 -1, 43, 44, 45, -1, -1, 48, 49, 50, 51,
1192 52, 53, -1, 55, -1, -1, 58, 59, 60, 61,
1193 62, 63, 64, -1, -1, 67, 68, -1, -1, -1,
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05001194 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Nicolas Capens2c1239f2015-02-17 17:30:04 -05001195 -1, -1, -1, -1, 86, -1, -1, -1, 90, -1,
1196 -1, -1, -1, -1, 96, 97, 98, -1, 100, 3,
Nicolas Capens3c20f802015-02-17 17:17:20 -05001197 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
Nicolas Capens2c1239f2015-02-17 17:30:04 -05001198 14, 15, 16, -1, 18, 19, 20, 21, -1, -1,
Nicolas Capens3c20f802015-02-17 17:17:20 -05001199 -1, 25, 26, 27, 28, 29, 30, 31, 32, 33,
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05001200 34, 35, 36, 37, 38, 39, 40, 41, -1, 43,
Nicolas Capens2c1239f2015-02-17 17:30:04 -05001201 44, 45, -1, -1, 48, 49, 50, 51, 52, 53,
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05001202 -1, 55, -1, -1, 58, 59, 60, 61, 62, 63,
Nicolas Capens2c1239f2015-02-17 17:30:04 -05001203 64, -1, -1, 67, 68, -1, -1, -1, -1, -1,
1204 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1205 -1, -1, 86, -1, -1, -1, 90, -1, -1, -1,
1206 -1, -1, 96, 97, 98, -1, 100, 3, 4, 5,
1207 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
1208 16, -1, 18, 19, 20, 21, -1, -1, -1, 25,
Nicolas Capens3c20f802015-02-17 17:17:20 -05001209 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05001210 36, 37, 38, 39, 40, 41, -1, 43, 44, 45,
Nicolas Capens2c1239f2015-02-17 17:30:04 -05001211 -1, -1, 48, 49, 50, 51, 52, 53, -1, 55,
1212 -1, -1, 58, 59, 60, 61, 62, 63, 64, -1,
1213 -1, 67, 68, -1, -1, -1, -1, -1, -1, -1,
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05001214 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Nicolas Capens2c1239f2015-02-17 17:30:04 -05001215 86, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1216 96, 97, 98, -1, 100, 3, 4, 5, 6, 7,
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05001217 8, 9, 10, 11, 12, 13, -1, -1, -1, -1,
Nicolas Capens2c1239f2015-02-17 17:30:04 -05001218 -1, -1, -1, -1, -1, -1, -1, 25, 26, 27,
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05001219 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
1220 38, 39, 40, 41, -1, 43, 44, 45, -1, -1,
1221 48, 49, -1, 51, 52, 53, -1, 55, -1, -1,
Nicolas Capens2c1239f2015-02-17 17:30:04 -05001222 58, 59, 60, 61, 62, 63, 64, -1, -1, 67,
1223 68, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1224 -1, -1, -1, -1, 3, 4, 5, 6, 86, 8,
1225 9, 10, 11, 12, 13, -1, -1, -1, 96, 97,
1226 98, -1, 100, -1, -1, -1, 25, 26, 27, 28,
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05001227 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
Nicolas Capens2c1239f2015-02-17 17:30:04 -05001228 39, 40, 41, -1, 43, 44, 45, -1, -1, 48,
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05001229 49, -1, 51, 52, 53, -1, 55, -1, -1, 58,
Nicolas Capens2c1239f2015-02-17 17:30:04 -05001230 59, 60, 61, 62, 63, 64, -1, -1, 67, 68,
1231 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1232 -1, -1, -1, -1, -1, -1, -1, 86, 10, 11,
1233 12, 13, -1, -1, -1, -1, -1, -1, 97, 98,
1234 -1, 100, -1, 25, 26, 27, 28, 29, 30, 31,
1235 32, 33, 34, 35, 36, 37, 38, 39, -1, -1,
1236 -1, -1, -1, -1, -1, -1, 48, 49, -1, 51,
1237 52, 53, -1, 55, -1, -1, 58, 59, 60, 61,
1238 62, 63, 64, -1, -1, 67, 68, -1, -1, -1,
1239 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1240 -1, -1, -1, -1, 86, -1, -1, 89, 10, 11,
1241 12, 13, -1, -1, -1, 97, 98, -1, 100, -1,
1242 -1, -1, -1, 25, 26, 27, 28, 29, 30, 31,
1243 32, 33, 34, 35, 36, 37, 38, 39, -1, -1,
1244 -1, -1, -1, -1, -1, -1, 48, 49, -1, 51,
1245 52, 53, -1, 55, -1, -1, 58, 59, 60, 61,
1246 62, 63, 64, -1, -1, 67, 68, -1, -1, -1,
1247 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1248 -1, -1, -1, -1, 86, 10, 11, 12, 13, -1,
1249 -1, -1, -1, -1, 96, 97, 98, -1, 100, -1,
1250 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1251 35, 36, 37, 38, 39, -1, -1, -1, -1, -1,
1252 -1, -1, -1, 48, 49, -1, 51, 52, 53, -1,
1253 55, -1, -1, 58, 59, 60, 61, 62, 63, 64,
1254 -1, -1, 67, 68, -1, -1, -1, -1, -1, -1,
1255 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1256 -1, 86, -1, -1, 89, 10, 11, 12, 13, -1,
1257 -1, -1, 97, 98, -1, 100, -1, -1, -1, -1,
1258 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1259 35, 36, 37, 38, 39, -1, -1, -1, -1, -1,
1260 -1, -1, -1, 48, 49, -1, 51, 52, 53, -1,
1261 55, -1, -1, 58, 59, 60, 61, 62, 63, 64,
1262 -1, -1, 67, 68, -1, -1, -1, -1, -1, -1,
1263 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1264 -1, 86, 10, 11, 12, 13, -1, -1, -1, -1,
1265 -1, -1, 97, 98, -1, 100, -1, 25, 26, 27,
1266 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
1267 38, 39, -1, -1, -1, -1, -1, -1, -1, -1,
1268 48, 49, -1, 51, 52, 53, -1, 55, -1, -1,
1269 58, 59, 60, 61, 62, 63, 64, -1, -1, 67,
1270 68, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1271 -1, -1, -1, 4, 5, 6, -1, -1, 86, 10,
1272 11, 12, 13, -1, -1, -1, -1, -1, -1, 97,
1273 98, -1, 100, -1, 25, 26, 27, 28, 29, 30,
1274 31, 32, 33, 34, 35, 36, 37, 38, 39, -1,
1275 -1, -1, -1, -1, -1, -1, -1, 48, 49, -1,
1276 51, 52, 53, -1, 55, -1, -1, -1, 59, -1,
1277 -1, -1, -1, -1, -1, -1, 0, -1, -1, 3,
1278 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
1279 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1280 91, 25, 26, 27, 28, 29, 30, 31, 32, 33,
1281 34, 35, 36, 37, 38, 39, 40, 41, -1, 43,
1282 44, 45, -1, -1, 48, 49, -1, 51, 52, 53,
1283 -1, 55, -1, -1, -1, 59, 3, 4, 5, 6,
1284 7, 8, 9, 10, 11, 12, 13, -1, -1, -1,
1285 -1, -1, -1, -1, -1, -1, -1, -1, 25, 26,
1286 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
1287 37, 38, 39, 40, 41, -1, 43, 44, 45, -1,
1288 -1, 48, 49, -1, 51, 52, 53, -1, 55, 4,
1289 5, 6, 59, -1, -1, 10, 11, 12, 13, -1,
1290 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1291 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1292 35, 36, 37, 38, 39, -1, -1, -1, -1, -1,
1293 -1, -1, -1, 48, 49, -1, 51, 52, 53, -1,
1294 55, -1, -1, -1, 59, 10, 11, 12, 13, -1,
1295 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1296 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1297 35, 36, 37, 38, 39, -1, -1, -1, -1, -1,
1298 -1, -1, -1, 48, 49, -1, 51, 52, 53, -1,
1299 55, -1, -1, 58, 59, 10, 11, 12, 13, 64,
Nicolas Capens3c20f802015-02-17 17:17:20 -05001300 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1301 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05001302 35, 36, 37, 38, 39, -1, -1, -1, -1, -1,
1303 -1, -1, -1, 48, 49, -1, 51, 52, 53, -1,
1304 55, -1, -1, -1, 59
John Bauman66b8ab22014-05-06 15:57:45 -04001305};
1306
1307/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
1308 symbol of state STATE-NUM. */
1309static const yytype_uint8 yystos[] =
1310{
1311 0, 3, 4, 5, 6, 7, 8, 9, 10, 11,
Nicolas Capens3c20f802015-02-17 17:17:20 -05001312 12, 13, 25, 26, 27, 28, 29, 30, 31, 32,
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05001313 33, 34, 35, 36, 37, 38, 39, 40, 41, 43,
Nicolas Capens2c1239f2015-02-17 17:30:04 -05001314 44, 45, 48, 49, 51, 52, 53, 55, 59, 140,
1315 141, 142, 143, 144, 149, 150, 151, 153, 154, 155,
1316 156, 157, 158, 159, 191, 192, 193, 44, 58, 156,
1317 40, 41, 58, 90, 96, 194, 87, 93, 9, 40,
1318 41, 42, 146, 147, 152, 93, 96, 58, 155, 157,
1319 88, 0, 192, 157, 90, 161, 90, 177, 146, 145,
1320 148, 155, 147, 58, 86, 88, 95, 58, 60, 61,
1321 62, 63, 64, 67, 68, 86, 97, 98, 100, 111,
1322 112, 113, 115, 116, 117, 118, 119, 120, 121, 122,
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05001323 123, 124, 125, 126, 127, 128, 129, 130, 131, 132,
Nicolas Capens2c1239f2015-02-17 17:30:04 -05001324 133, 134, 135, 139, 158, 96, 160, 155, 162, 163,
1325 14, 15, 16, 18, 19, 20, 21, 50, 90, 91,
1326 96, 122, 135, 136, 138, 140, 141, 158, 167, 168,
1327 169, 170, 178, 179, 180, 183, 190, 58, 145, 148,
1328 88, 95, 89, 139, 136, 166, 122, 122, 138, 67,
1329 68, 88, 92, 87, 87, 93, 49, 136, 86, 122,
1330 101, 102, 98, 100, 69, 70, 104, 105, 71, 72,
1331 73, 75, 74, 109, 89, 162, 58, 164, 165, 91,
1332 163, 96, 96, 185, 86, 86, 96, 96, 138, 86,
1333 91, 171, 76, 77, 78, 85, 95, 137, 93, 96,
1334 91, 168, 88, 89, 139, 166, 89, 87, 114, 138,
1335 58, 64, 117, 136, 122, 122, 124, 124, 126, 126,
1336 126, 126, 127, 127, 131, 132, 133, 138, 91, 88,
1337 93, 96, 174, 175, 176, 186, 138, 96, 184, 178,
1338 136, 136, 139, 89, 89, 94, 139, 165, 50, 177,
1339 169, 167, 179, 187, 87, 3, 138, 151, 182, 172,
1340 89, 136, 89, 86, 182, 188, 189, 174, 181, 58,
1341 87, 91, 138, 96, 87, 17, 95, 169, 173, 177,
1342 87, 138, 173, 174, 166, 96
John Bauman66b8ab22014-05-06 15:57:45 -04001343};
1344
1345#define yyerrok (yyerrstatus = 0)
1346#define yyclearin (yychar = YYEMPTY)
1347#define YYEMPTY (-2)
1348#define YYEOF 0
1349
1350#define YYACCEPT goto yyacceptlab
1351#define YYABORT goto yyabortlab
1352#define YYERROR goto yyerrorlab
1353
1354
1355/* Like YYERROR except do call yyerror. This remains here temporarily
1356 to ease the transition to the new meaning of YYERROR, for GCC.
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04001357 Once GCC version 2 has supplanted version 1, this can go. */
John Bauman66b8ab22014-05-06 15:57:45 -04001358
1359#define YYFAIL goto yyerrlab
John Bauman66b8ab22014-05-06 15:57:45 -04001360
1361#define YYRECOVERING() (!!yyerrstatus)
1362
1363#define YYBACKUP(Token, Value) \
1364do \
1365 if (yychar == YYEMPTY && yylen == 1) \
1366 { \
1367 yychar = (Token); \
1368 yylval = (Value); \
1369 yytoken = YYTRANSLATE (yychar); \
1370 YYPOPSTACK (1); \
1371 goto yybackup; \
1372 } \
1373 else \
1374 { \
1375 yyerror (context, YY_("syntax error: cannot back up")); \
1376 YYERROR; \
1377 } \
1378while (YYID (0))
1379
1380
1381#define YYTERROR 1
1382#define YYERRCODE 256
1383
1384
1385/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
1386 If N is 0, then set CURRENT to the empty location which ends
1387 the previous symbol: RHS[0] (always defined). */
1388
1389#define YYRHSLOC(Rhs, K) ((Rhs)[K])
1390#ifndef YYLLOC_DEFAULT
1391# define YYLLOC_DEFAULT(Current, Rhs, N) \
1392 do \
1393 if (YYID (N)) \
1394 { \
1395 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
1396 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
1397 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
1398 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
1399 } \
1400 else \
1401 { \
1402 (Current).first_line = (Current).last_line = \
1403 YYRHSLOC (Rhs, 0).last_line; \
1404 (Current).first_column = (Current).last_column = \
1405 YYRHSLOC (Rhs, 0).last_column; \
1406 } \
1407 while (YYID (0))
1408#endif
1409
1410
1411/* YY_LOCATION_PRINT -- Print the location on the stream.
1412 This macro was not mandated originally: define only if we know
1413 we won't break user code: when these are the locations we know. */
1414
1415#ifndef YY_LOCATION_PRINT
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04001416# if YYLTYPE_IS_TRIVIAL
John Bauman66b8ab22014-05-06 15:57:45 -04001417# define YY_LOCATION_PRINT(File, Loc) \
1418 fprintf (File, "%d.%d-%d.%d", \
1419 (Loc).first_line, (Loc).first_column, \
1420 (Loc).last_line, (Loc).last_column)
1421# else
1422# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1423# endif
1424#endif
1425
1426
1427/* YYLEX -- calling `yylex' with the right arguments. */
1428
1429#ifdef YYLEX_PARAM
1430# define YYLEX yylex (&yylval, YYLEX_PARAM)
1431#else
1432# define YYLEX yylex (&yylval)
1433#endif
1434
1435/* Enable debugging if requested. */
1436#if YYDEBUG
1437
1438# ifndef YYFPRINTF
1439# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1440# define YYFPRINTF fprintf
1441# endif
1442
1443# define YYDPRINTF(Args) \
1444do { \
1445 if (yydebug) \
1446 YYFPRINTF Args; \
1447} while (YYID (0))
1448
1449# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
1450do { \
1451 if (yydebug) \
1452 { \
1453 YYFPRINTF (stderr, "%s ", Title); \
1454 yy_symbol_print (stderr, \
1455 Type, Value, context); \
1456 YYFPRINTF (stderr, "\n"); \
1457 } \
1458} while (YYID (0))
1459
1460
1461/*--------------------------------.
1462| Print this symbol on YYOUTPUT. |
1463`--------------------------------*/
1464
1465/*ARGSUSED*/
1466#if (defined __STDC__ || defined __C99__FUNC__ \
1467 || defined __cplusplus || defined _MSC_VER)
1468static void
1469yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, TParseContext* context)
1470#else
1471static void
1472yy_symbol_value_print (yyoutput, yytype, yyvaluep, context)
1473 FILE *yyoutput;
1474 int yytype;
1475 YYSTYPE const * const yyvaluep;
1476 TParseContext* context;
1477#endif
1478{
1479 if (!yyvaluep)
1480 return;
1481 YYUSE (context);
1482# ifdef YYPRINT
1483 if (yytype < YYNTOKENS)
1484 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1485# else
1486 YYUSE (yyoutput);
1487# endif
1488 switch (yytype)
1489 {
1490 default:
1491 break;
1492 }
1493}
1494
1495
1496/*--------------------------------.
1497| Print this symbol on YYOUTPUT. |
1498`--------------------------------*/
1499
1500#if (defined __STDC__ || defined __C99__FUNC__ \
1501 || defined __cplusplus || defined _MSC_VER)
1502static void
1503yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, TParseContext* context)
1504#else
1505static void
1506yy_symbol_print (yyoutput, yytype, yyvaluep, context)
1507 FILE *yyoutput;
1508 int yytype;
1509 YYSTYPE const * const yyvaluep;
1510 TParseContext* context;
1511#endif
1512{
1513 if (yytype < YYNTOKENS)
1514 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1515 else
1516 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1517
1518 yy_symbol_value_print (yyoutput, yytype, yyvaluep, context);
1519 YYFPRINTF (yyoutput, ")");
1520}
1521
1522/*------------------------------------------------------------------.
1523| yy_stack_print -- Print the state stack from its BOTTOM up to its |
1524| TOP (included). |
1525`------------------------------------------------------------------*/
1526
1527#if (defined __STDC__ || defined __C99__FUNC__ \
1528 || defined __cplusplus || defined _MSC_VER)
1529static void
1530yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
1531#else
1532static void
1533yy_stack_print (yybottom, yytop)
1534 yytype_int16 *yybottom;
1535 yytype_int16 *yytop;
1536#endif
1537{
1538 YYFPRINTF (stderr, "Stack now");
1539 for (; yybottom <= yytop; yybottom++)
1540 {
1541 int yybot = *yybottom;
1542 YYFPRINTF (stderr, " %d", yybot);
1543 }
1544 YYFPRINTF (stderr, "\n");
1545}
1546
1547# define YY_STACK_PRINT(Bottom, Top) \
1548do { \
1549 if (yydebug) \
1550 yy_stack_print ((Bottom), (Top)); \
1551} while (YYID (0))
1552
1553
1554/*------------------------------------------------.
1555| Report that the YYRULE is going to be reduced. |
1556`------------------------------------------------*/
1557
1558#if (defined __STDC__ || defined __C99__FUNC__ \
1559 || defined __cplusplus || defined _MSC_VER)
1560static void
1561yy_reduce_print (YYSTYPE *yyvsp, int yyrule, TParseContext* context)
1562#else
1563static void
1564yy_reduce_print (yyvsp, yyrule, context)
1565 YYSTYPE *yyvsp;
1566 int yyrule;
1567 TParseContext* context;
1568#endif
1569{
1570 int yynrhs = yyr2[yyrule];
1571 int yyi;
1572 unsigned long int yylno = yyrline[yyrule];
1573 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1574 yyrule - 1, yylno);
1575 /* The symbols being reduced. */
1576 for (yyi = 0; yyi < yynrhs; yyi++)
1577 {
1578 YYFPRINTF (stderr, " $%d = ", yyi + 1);
1579 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1580 &(yyvsp[(yyi + 1) - (yynrhs)])
1581 , context);
1582 YYFPRINTF (stderr, "\n");
1583 }
1584}
1585
1586# define YY_REDUCE_PRINT(Rule) \
1587do { \
1588 if (yydebug) \
1589 yy_reduce_print (yyvsp, Rule, context); \
1590} while (YYID (0))
1591
1592/* Nonzero means print parse trace. It is left uninitialized so that
1593 multiple parsers can coexist. */
1594int yydebug;
1595#else /* !YYDEBUG */
1596# define YYDPRINTF(Args)
1597# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1598# define YY_STACK_PRINT(Bottom, Top)
1599# define YY_REDUCE_PRINT(Rule)
1600#endif /* !YYDEBUG */
1601
1602
1603/* YYINITDEPTH -- initial size of the parser's stacks. */
1604#ifndef YYINITDEPTH
1605# define YYINITDEPTH 200
1606#endif
1607
1608/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1609 if the built-in stack extension method is used).
1610
1611 Do not make this value too large; the results are undefined if
1612 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1613 evaluated with infinite-precision integer arithmetic. */
1614
1615#ifndef YYMAXDEPTH
1616# define YYMAXDEPTH 10000
1617#endif
1618
1619
1620
1621#if YYERROR_VERBOSE
1622
1623# ifndef yystrlen
1624# if defined __GLIBC__ && defined _STRING_H
1625# define yystrlen strlen
1626# else
1627/* Return the length of YYSTR. */
1628#if (defined __STDC__ || defined __C99__FUNC__ \
1629 || defined __cplusplus || defined _MSC_VER)
1630static YYSIZE_T
1631yystrlen (const char *yystr)
1632#else
1633static YYSIZE_T
1634yystrlen (yystr)
1635 const char *yystr;
1636#endif
1637{
1638 YYSIZE_T yylen;
1639 for (yylen = 0; yystr[yylen]; yylen++)
1640 continue;
1641 return yylen;
1642}
1643# endif
1644# endif
1645
1646# ifndef yystpcpy
1647# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1648# define yystpcpy stpcpy
1649# else
1650/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1651 YYDEST. */
1652#if (defined __STDC__ || defined __C99__FUNC__ \
1653 || defined __cplusplus || defined _MSC_VER)
1654static char *
1655yystpcpy (char *yydest, const char *yysrc)
1656#else
1657static char *
1658yystpcpy (yydest, yysrc)
1659 char *yydest;
1660 const char *yysrc;
1661#endif
1662{
1663 char *yyd = yydest;
1664 const char *yys = yysrc;
1665
1666 while ((*yyd++ = *yys++) != '\0')
1667 continue;
1668
1669 return yyd - 1;
1670}
1671# endif
1672# endif
1673
1674# ifndef yytnamerr
1675/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1676 quotes and backslashes, so that it's suitable for yyerror. The
1677 heuristic is that double-quoting is unnecessary unless the string
1678 contains an apostrophe, a comma, or backslash (other than
1679 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1680 null, do not copy; instead, return the length of what the result
1681 would have been. */
1682static YYSIZE_T
1683yytnamerr (char *yyres, const char *yystr)
1684{
1685 if (*yystr == '"')
1686 {
1687 YYSIZE_T yyn = 0;
1688 char const *yyp = yystr;
1689
1690 for (;;)
1691 switch (*++yyp)
1692 {
1693 case '\'':
1694 case ',':
1695 goto do_not_strip_quotes;
1696
1697 case '\\':
1698 if (*++yyp != '\\')
1699 goto do_not_strip_quotes;
1700 /* Fall through. */
1701 default:
1702 if (yyres)
1703 yyres[yyn] = *yyp;
1704 yyn++;
1705 break;
1706
1707 case '"':
1708 if (yyres)
1709 yyres[yyn] = '\0';
1710 return yyn;
1711 }
1712 do_not_strip_quotes: ;
1713 }
1714
1715 if (! yyres)
1716 return yystrlen (yystr);
1717
1718 return yystpcpy (yyres, yystr) - yyres;
1719}
1720# endif
1721
1722/* Copy into YYRESULT an error message about the unexpected token
1723 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1724 including the terminating null byte. If YYRESULT is null, do not
1725 copy anything; just return the number of bytes that would be
1726 copied. As a special case, return 0 if an ordinary "syntax error"
1727 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1728 size calculation. */
1729static YYSIZE_T
1730yysyntax_error (char *yyresult, int yystate, int yychar)
1731{
1732 int yyn = yypact[yystate];
1733
1734 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1735 return 0;
1736 else
1737 {
1738 int yytype = YYTRANSLATE (yychar);
1739 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1740 YYSIZE_T yysize = yysize0;
1741 YYSIZE_T yysize1;
1742 int yysize_overflow = 0;
1743 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1744 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1745 int yyx;
1746
1747# if 0
1748 /* This is so xgettext sees the translatable formats that are
1749 constructed on the fly. */
1750 YY_("syntax error, unexpected %s");
1751 YY_("syntax error, unexpected %s, expecting %s");
1752 YY_("syntax error, unexpected %s, expecting %s or %s");
1753 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1754 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1755# endif
1756 char *yyfmt;
1757 char const *yyf;
1758 static char const yyunexpected[] = "syntax error, unexpected %s";
1759 static char const yyexpecting[] = ", expecting %s";
1760 static char const yyor[] = " or %s";
1761 char yyformat[sizeof yyunexpected
1762 + sizeof yyexpecting - 1
1763 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1764 * (sizeof yyor - 1))];
1765 char const *yyprefix = yyexpecting;
1766
1767 /* Start YYX at -YYN if negative to avoid negative indexes in
1768 YYCHECK. */
1769 int yyxbegin = yyn < 0 ? -yyn : 0;
1770
1771 /* Stay within bounds of both yycheck and yytname. */
1772 int yychecklim = YYLAST - yyn + 1;
1773 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1774 int yycount = 1;
1775
1776 yyarg[0] = yytname[yytype];
1777 yyfmt = yystpcpy (yyformat, yyunexpected);
1778
1779 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1780 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1781 {
1782 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1783 {
1784 yycount = 1;
1785 yysize = yysize0;
1786 yyformat[sizeof yyunexpected - 1] = '\0';
1787 break;
1788 }
1789 yyarg[yycount++] = yytname[yyx];
1790 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1791 yysize_overflow |= (yysize1 < yysize);
1792 yysize = yysize1;
1793 yyfmt = yystpcpy (yyfmt, yyprefix);
1794 yyprefix = yyor;
1795 }
1796
1797 yyf = YY_(yyformat);
1798 yysize1 = yysize + yystrlen (yyf);
1799 yysize_overflow |= (yysize1 < yysize);
1800 yysize = yysize1;
1801
1802 if (yysize_overflow)
1803 return YYSIZE_MAXIMUM;
1804
1805 if (yyresult)
1806 {
1807 /* Avoid sprintf, as that infringes on the user's name space.
1808 Don't have undefined behavior even if the translation
1809 produced a string with the wrong number of "%s"s. */
1810 char *yyp = yyresult;
1811 int yyi = 0;
1812 while ((*yyp = *yyf) != '\0')
1813 {
1814 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1815 {
1816 yyp += yytnamerr (yyp, yyarg[yyi++]);
1817 yyf += 2;
1818 }
1819 else
1820 {
1821 yyp++;
1822 yyf++;
1823 }
1824 }
1825 }
1826 return yysize;
1827 }
1828}
1829#endif /* YYERROR_VERBOSE */
1830
1831
1832/*-----------------------------------------------.
1833| Release the memory associated to this symbol. |
1834`-----------------------------------------------*/
1835
1836/*ARGSUSED*/
1837#if (defined __STDC__ || defined __C99__FUNC__ \
1838 || defined __cplusplus || defined _MSC_VER)
1839static void
1840yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, TParseContext* context)
1841#else
1842static void
1843yydestruct (yymsg, yytype, yyvaluep, context)
1844 const char *yymsg;
1845 int yytype;
1846 YYSTYPE *yyvaluep;
1847 TParseContext* context;
1848#endif
1849{
1850 YYUSE (yyvaluep);
1851 YYUSE (context);
1852
1853 if (!yymsg)
1854 yymsg = "Deleting";
1855 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1856
1857 switch (yytype)
1858 {
1859
1860 default:
1861 break;
1862 }
1863}
1864
1865/* Prevent warnings from -Wmissing-prototypes. */
1866#ifdef YYPARSE_PARAM
1867#if defined __STDC__ || defined __cplusplus
1868int yyparse (void *YYPARSE_PARAM);
1869#else
1870int yyparse ();
1871#endif
1872#else /* ! YYPARSE_PARAM */
1873#if defined __STDC__ || defined __cplusplus
1874int yyparse (TParseContext* context);
1875#else
1876int yyparse ();
1877#endif
1878#endif /* ! YYPARSE_PARAM */
1879
1880
1881
1882
1883
1884/*-------------------------.
1885| yyparse or yypush_parse. |
1886`-------------------------*/
1887
1888#ifdef YYPARSE_PARAM
1889#if (defined __STDC__ || defined __C99__FUNC__ \
1890 || defined __cplusplus || defined _MSC_VER)
1891int
1892yyparse (void *YYPARSE_PARAM)
1893#else
1894int
1895yyparse (YYPARSE_PARAM)
1896 void *YYPARSE_PARAM;
1897#endif
1898#else /* ! YYPARSE_PARAM */
1899#if (defined __STDC__ || defined __C99__FUNC__ \
1900 || defined __cplusplus || defined _MSC_VER)
1901int
1902yyparse (TParseContext* context)
1903#else
1904int
1905yyparse (context)
1906 TParseContext* context;
1907#endif
1908#endif
1909{
1910/* The lookahead symbol. */
1911int yychar;
1912
1913/* The semantic value of the lookahead symbol. */
1914YYSTYPE yylval;
1915
1916 /* Number of syntax errors so far. */
1917 int yynerrs;
1918
1919 int yystate;
1920 /* Number of tokens to shift before error messages enabled. */
1921 int yyerrstatus;
1922
1923 /* The stacks and their tools:
1924 `yyss': related to states.
1925 `yyvs': related to semantic values.
1926
1927 Refer to the stacks thru separate pointers, to allow yyoverflow
1928 to reallocate them elsewhere. */
1929
1930 /* The state stack. */
1931 yytype_int16 yyssa[YYINITDEPTH];
1932 yytype_int16 *yyss;
1933 yytype_int16 *yyssp;
1934
1935 /* The semantic value stack. */
1936 YYSTYPE yyvsa[YYINITDEPTH];
1937 YYSTYPE *yyvs;
1938 YYSTYPE *yyvsp;
1939
1940 YYSIZE_T yystacksize;
1941
1942 int yyn;
1943 int yyresult;
1944 /* Lookahead token as an internal (translated) token number. */
1945 int yytoken;
1946 /* The variables used to return semantic value and location from the
1947 action routines. */
1948 YYSTYPE yyval;
1949
1950#if YYERROR_VERBOSE
1951 /* Buffer for error messages, and its allocated size. */
1952 char yymsgbuf[128];
1953 char *yymsg = yymsgbuf;
1954 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1955#endif
1956
1957#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1958
1959 /* The number of symbols on the RHS of the reduced rule.
1960 Keep to zero when no symbol should be popped. */
1961 int yylen = 0;
1962
1963 yytoken = 0;
1964 yyss = yyssa;
1965 yyvs = yyvsa;
1966 yystacksize = YYINITDEPTH;
1967
1968 YYDPRINTF ((stderr, "Starting parse\n"));
1969
1970 yystate = 0;
1971 yyerrstatus = 0;
1972 yynerrs = 0;
1973 yychar = YYEMPTY; /* Cause a token to be read. */
1974
1975 /* Initialize stack pointers.
1976 Waste one element of value and location stack
1977 so that they stay on the same level as the state stack.
1978 The wasted elements are never initialized. */
1979 yyssp = yyss;
1980 yyvsp = yyvs;
1981
1982 goto yysetstate;
1983
1984/*------------------------------------------------------------.
1985| yynewstate -- Push a new state, which is found in yystate. |
1986`------------------------------------------------------------*/
1987 yynewstate:
1988 /* In all cases, when you get here, the value and location stacks
1989 have just been pushed. So pushing a state here evens the stacks. */
1990 yyssp++;
1991
1992 yysetstate:
1993 *yyssp = yystate;
1994
1995 if (yyss + yystacksize - 1 <= yyssp)
1996 {
1997 /* Get the current used size of the three stacks, in elements. */
1998 YYSIZE_T yysize = yyssp - yyss + 1;
1999
2000#ifdef yyoverflow
2001 {
2002 /* Give user a chance to reallocate the stack. Use copies of
2003 these so that the &'s don't force the real ones into
2004 memory. */
2005 YYSTYPE *yyvs1 = yyvs;
2006 yytype_int16 *yyss1 = yyss;
2007
2008 /* Each stack pointer address is followed by the size of the
2009 data in use in that stack, in bytes. This used to be a
2010 conditional around just the two extra args, but that might
2011 be undefined if yyoverflow is a macro. */
2012 yyoverflow (YY_("memory exhausted"),
2013 &yyss1, yysize * sizeof (*yyssp),
2014 &yyvs1, yysize * sizeof (*yyvsp),
2015 &yystacksize);
2016
2017 yyss = yyss1;
2018 yyvs = yyvs1;
2019 }
2020#else /* no yyoverflow */
2021# ifndef YYSTACK_RELOCATE
2022 goto yyexhaustedlab;
2023# else
2024 /* Extend the stack our own way. */
2025 if (YYMAXDEPTH <= yystacksize)
2026 goto yyexhaustedlab;
2027 yystacksize *= 2;
2028 if (YYMAXDEPTH < yystacksize)
2029 yystacksize = YYMAXDEPTH;
2030
2031 {
2032 yytype_int16 *yyss1 = yyss;
2033 union yyalloc *yyptr =
2034 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
2035 if (! yyptr)
2036 goto yyexhaustedlab;
2037 YYSTACK_RELOCATE (yyss_alloc, yyss);
2038 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
2039# undef YYSTACK_RELOCATE
2040 if (yyss1 != yyssa)
2041 YYSTACK_FREE (yyss1);
2042 }
2043# endif
2044#endif /* no yyoverflow */
2045
2046 yyssp = yyss + yysize - 1;
2047 yyvsp = yyvs + yysize - 1;
2048
2049 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
2050 (unsigned long int) yystacksize));
2051
2052 if (yyss + yystacksize - 1 <= yyssp)
2053 YYABORT;
2054 }
2055
2056 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
2057
2058 if (yystate == YYFINAL)
2059 YYACCEPT;
2060
2061 goto yybackup;
2062
2063/*-----------.
2064| yybackup. |
2065`-----------*/
2066yybackup:
2067
2068 /* Do appropriate processing given the current state. Read a
2069 lookahead token if we need one and don't already have one. */
2070
2071 /* First try to decide what to do without reference to lookahead token. */
2072 yyn = yypact[yystate];
2073 if (yyn == YYPACT_NINF)
2074 goto yydefault;
2075
2076 /* Not known => get a lookahead token if don't already have one. */
2077
2078 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
2079 if (yychar == YYEMPTY)
2080 {
2081 YYDPRINTF ((stderr, "Reading a token: "));
2082 yychar = YYLEX;
2083 }
2084
2085 if (yychar <= YYEOF)
2086 {
2087 yychar = yytoken = YYEOF;
2088 YYDPRINTF ((stderr, "Now at end of input.\n"));
2089 }
2090 else
2091 {
2092 yytoken = YYTRANSLATE (yychar);
2093 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
2094 }
2095
2096 /* If the proper action on seeing token YYTOKEN is to reduce or to
2097 detect an error, take that action. */
2098 yyn += yytoken;
2099 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
2100 goto yydefault;
2101 yyn = yytable[yyn];
2102 if (yyn <= 0)
2103 {
2104 if (yyn == 0 || yyn == YYTABLE_NINF)
2105 goto yyerrlab;
2106 yyn = -yyn;
2107 goto yyreduce;
2108 }
2109
2110 /* Count tokens shifted since error; after three, turn off error
2111 status. */
2112 if (yyerrstatus)
2113 yyerrstatus--;
2114
2115 /* Shift the lookahead token. */
2116 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
2117
2118 /* Discard the shifted token. */
2119 yychar = YYEMPTY;
2120
2121 yystate = yyn;
2122 *++yyvsp = yylval;
2123
2124 goto yynewstate;
2125
2126
2127/*-----------------------------------------------------------.
2128| yydefault -- do the default action for the current state. |
2129`-----------------------------------------------------------*/
2130yydefault:
2131 yyn = yydefact[yystate];
2132 if (yyn == 0)
2133 goto yyerrlab;
2134 goto yyreduce;
2135
2136
2137/*-----------------------------.
2138| yyreduce -- Do a reduction. |
2139`-----------------------------*/
2140yyreduce:
2141 /* yyn is the number of a rule to reduce with. */
2142 yylen = yyr2[yyn];
2143
2144 /* If YYLEN is nonzero, implement the default value of the action:
2145 `$$ = $1'.
2146
2147 Otherwise, the following line sets YYVAL to garbage.
2148 This behavior is undocumented and Bison
2149 users should not rely upon it. Assigning to YYVAL
2150 unconditionally makes the parser a bit smaller, and it avoids a
2151 GCC warning that YYVAL may be used uninitialized. */
2152 yyval = yyvsp[1-yylen];
2153
2154
2155 YY_REDUCE_PRINT (yyn);
2156 switch (yyn)
2157 {
2158 case 2:
2159
2160 {
2161 // The symbol table search was done in the lexical phase
2162 const TSymbol* symbol = (yyvsp[(1) - (1)].lex).symbol;
2163 const TVariable* variable;
2164 if (symbol == 0) {
2165 context->error((yyvsp[(1) - (1)].lex).line, "undeclared identifier", (yyvsp[(1) - (1)].lex).string->c_str());
2166 context->recover();
2167 TType type(EbtFloat, EbpUndefined);
2168 TVariable* fakeVariable = new TVariable((yyvsp[(1) - (1)].lex).string, type);
2169 context->symbolTable.insert(*fakeVariable);
2170 variable = fakeVariable;
2171 } else {
2172 // This identifier can only be a variable type symbol
2173 if (! symbol->isVariable()) {
2174 context->error((yyvsp[(1) - (1)].lex).line, "variable expected", (yyvsp[(1) - (1)].lex).string->c_str());
2175 context->recover();
2176 }
2177 variable = static_cast<const TVariable*>(symbol);
2178 }
2179
2180 // don't delete $1.string, it's used by error recovery, and the pool
2181 // pop will reclaim the memory
2182
2183 if (variable->getType().getQualifier() == EvqConst ) {
2184 ConstantUnion* constArray = variable->getConstPointer();
2185 TType t(variable->getType());
2186 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(constArray, t, (yyvsp[(1) - (1)].lex).line);
2187 } else
2188 (yyval.interm.intermTypedNode) = context->intermediate.addSymbol(variable->getUniqueId(),
2189 variable->getName(),
2190 variable->getType(), (yyvsp[(1) - (1)].lex).line);
2191 }
2192 break;
2193
2194 case 3:
2195
2196 {
2197 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
2198 }
2199 break;
2200
2201 case 4:
2202
2203 {
John Bauman66b8ab22014-05-06 15:57:45 -04002204 ConstantUnion *unionArray = new ConstantUnion[1];
2205 unionArray->setIConst((yyvsp[(1) - (1)].lex).i);
2206 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
2207 }
2208 break;
2209
2210 case 5:
2211
2212 {
2213 ConstantUnion *unionArray = new ConstantUnion[1];
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002214 unionArray->setUConst((yyvsp[(1) - (1)].lex).u);
2215 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtUInt, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
2216 }
2217 break;
2218
2219 case 6:
2220
2221 {
2222 ConstantUnion *unionArray = new ConstantUnion[1];
John Bauman66b8ab22014-05-06 15:57:45 -04002223 unionArray->setFConst((yyvsp[(1) - (1)].lex).f);
2224 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
2225 }
2226 break;
2227
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002228 case 7:
John Bauman66b8ab22014-05-06 15:57:45 -04002229
2230 {
2231 ConstantUnion *unionArray = new ConstantUnion[1];
2232 unionArray->setBConst((yyvsp[(1) - (1)].lex).b);
2233 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
2234 }
2235 break;
2236
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002237 case 8:
John Bauman66b8ab22014-05-06 15:57:45 -04002238
2239 {
2240 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (3)].interm.intermTypedNode);
2241 }
2242 break;
2243
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002244 case 9:
John Bauman66b8ab22014-05-06 15:57:45 -04002245
2246 {
2247 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
2248 }
2249 break;
2250
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002251 case 10:
John Bauman66b8ab22014-05-06 15:57:45 -04002252
2253 {
2254 if (!(yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isVector()) {
2255 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode())
2256 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());
2257 else
2258 context->error((yyvsp[(2) - (4)].lex).line, " left of '[' is not of type array, matrix, or vector ", "expression");
2259 context->recover();
2260 }
2261 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst && (yyvsp[(3) - (4)].interm.intermTypedNode)->getQualifier() == EvqConst) {
2262 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) { // constant folding for arrays
Nicolas Capens198529d2015-02-10 13:54:19 -05002263 (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 -04002264 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector()) { // constant folding for vectors
2265 TVectorFields fields;
2266 fields.num = 1;
Nicolas Capens198529d2015-02-10 13:54:19 -05002267 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 -04002268 (yyval.interm.intermTypedNode) = context->addConstVectorNode(fields, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2269 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix()) { // constant folding for matrices
Nicolas Capens198529d2015-02-10 13:54:19 -05002270 (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 -04002271 }
2272 } else {
2273 if ((yyvsp[(3) - (4)].interm.intermTypedNode)->getQualifier() == EvqConst) {
Nicolas Capens198529d2015-02-10 13:54:19 -05002274 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 -04002275 std::stringstream extraInfoStream;
Nicolas Capens198529d2015-02-10 13:54:19 -05002276 extraInfoStream << "field selection out of range '" << (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0) << "'";
John Bauman66b8ab22014-05-06 15:57:45 -04002277 std::string extraInfo = extraInfoStream.str();
2278 context->error((yyvsp[(2) - (4)].lex).line, "", "[", extraInfo.c_str());
2279 context->recover();
2280 } else {
2281 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) {
2282 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize() == 0) {
Nicolas Capens198529d2015-02-10 13:54:19 -05002283 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getMaxArraySize() <= (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0)) {
2284 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 -04002285 context->recover();
2286 } else {
2287 if (context->arraySetMaxSize((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getTypePointer(), 0, false, (yyvsp[(2) - (4)].lex).line))
2288 context->recover();
2289 }
Nicolas Capens198529d2015-02-10 13:54:19 -05002290 } else if ( (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0) >= (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize()) {
John Bauman66b8ab22014-05-06 15:57:45 -04002291 std::stringstream extraInfoStream;
Nicolas Capens198529d2015-02-10 13:54:19 -05002292 extraInfoStream << "array index out of range '" << (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0) << "'";
John Bauman66b8ab22014-05-06 15:57:45 -04002293 std::string extraInfo = extraInfoStream.str();
2294 context->error((yyvsp[(2) - (4)].lex).line, "", "[", extraInfo.c_str());
2295 context->recover();
2296 }
2297 }
2298 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(3) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2299 }
2300 } else {
2301 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize() == 0) {
2302 context->error((yyvsp[(2) - (4)].lex).line, "", "[", "array must be redeclared with a size before being indexed with a variable");
2303 context->recover();
2304 }
2305
2306 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexIndirect, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(3) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2307 }
2308 }
2309 if ((yyval.interm.intermTypedNode) == 0) {
2310 ConstantUnion *unionArray = new ConstantUnion[1];
2311 unionArray->setFConst(0.0f);
2312 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpHigh, EvqConst), (yyvsp[(2) - (4)].lex).line);
2313 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) {
2314 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getStruct())
2315 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getStruct(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getTypeName()));
2316 else
2317 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize(), (yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix()));
2318
2319 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst)
2320 (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConst);
2321 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst)
2322 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqConst, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize()));
2323 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix())
2324 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize()));
2325 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst)
2326 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqConst));
2327 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector())
2328 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary));
2329 else
2330 (yyval.interm.intermTypedNode)->setType((yyvsp[(1) - (4)].interm.intermTypedNode)->getType());
2331 }
2332 break;
2333
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002334 case 11:
John Bauman66b8ab22014-05-06 15:57:45 -04002335
2336 {
2337 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
2338 }
2339 break;
2340
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002341 case 12:
John Bauman66b8ab22014-05-06 15:57:45 -04002342
2343 {
2344 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isArray()) {
2345 context->error((yyvsp[(3) - (3)].lex).line, "cannot apply dot operator to an array", ".");
2346 context->recover();
2347 }
2348
2349 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isVector()) {
2350 TVectorFields fields;
2351 if (! context->parseVectorFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yyvsp[(3) - (3)].lex).line)) {
2352 fields.num = 1;
2353 fields.offsets[0] = 0;
2354 context->recover();
2355 }
2356
2357 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) { // constant folding for vector fields
2358 (yyval.interm.intermTypedNode) = context->addConstVectorNode(fields, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].lex).line);
2359 if ((yyval.interm.intermTypedNode) == 0) {
2360 context->recover();
2361 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2362 }
2363 else
2364 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(), EvqConst, (int) (*(yyvsp[(3) - (3)].lex).string).size()));
2365 } else {
2366 TString vectorString = *(yyvsp[(3) - (3)].lex).string;
2367 TIntermTyped* index = context->intermediate.addSwizzle(fields, (yyvsp[(3) - (3)].lex).line);
2368 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpVectorSwizzle, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2369 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (int) vectorString.size()));
2370 }
2371 } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isMatrix()) {
2372 TMatrixFields fields;
2373 if (! context->parseMatrixFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yyvsp[(3) - (3)].lex).line)) {
2374 fields.wholeRow = false;
2375 fields.wholeCol = false;
2376 fields.row = 0;
2377 fields.col = 0;
2378 context->recover();
2379 }
2380
2381 if (fields.wholeRow || fields.wholeCol) {
2382 context->error((yyvsp[(2) - (3)].lex).line, " non-scalar fields not implemented yet", ".");
2383 context->recover();
2384 ConstantUnion *unionArray = new ConstantUnion[1];
2385 unionArray->setIConst(0);
2386 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line);
2387 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2388 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(),EvqTemporary, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize()));
2389 } else {
2390 ConstantUnion *unionArray = new ConstantUnion[1];
2391 unionArray->setIConst(fields.col * (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize() + fields.row);
2392 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line);
2393 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2394 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision()));
2395 }
2396 } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType() == EbtStruct) {
2397 bool fieldFound = false;
2398 const TTypeList* fields = (yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getStruct();
2399 if (fields == 0) {
2400 context->error((yyvsp[(2) - (3)].lex).line, "structure has no fields", "Internal Error");
2401 context->recover();
2402 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2403 } else {
2404 unsigned int i;
2405 for (i = 0; i < fields->size(); ++i) {
2406 if ((*fields)[i].type->getFieldName() == *(yyvsp[(3) - (3)].lex).string) {
2407 fieldFound = true;
2408 break;
2409 }
2410 }
2411 if (fieldFound) {
2412 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) {
2413 (yyval.interm.intermTypedNode) = context->addConstStruct(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
2414 if ((yyval.interm.intermTypedNode) == 0) {
2415 context->recover();
2416 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2417 }
2418 else {
2419 (yyval.interm.intermTypedNode)->setType(*(*fields)[i].type);
2420 // change the qualifier of the return type, not of the structure field
2421 // as the structure definition is shared between various structures.
2422 (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConst);
2423 }
2424 } else {
2425 ConstantUnion *unionArray = new ConstantUnion[1];
2426 unionArray->setIConst(i);
2427 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, *(*fields)[i].type, (yyvsp[(3) - (3)].lex).line);
2428 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirectStruct, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2429 (yyval.interm.intermTypedNode)->setType(*(*fields)[i].type);
2430 }
2431 } else {
2432 context->error((yyvsp[(2) - (3)].lex).line, " no such field in structure", (yyvsp[(3) - (3)].lex).string->c_str());
2433 context->recover();
2434 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2435 }
2436 }
2437 } else {
2438 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());
2439 context->recover();
2440 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2441 }
2442 // don't delete $3.string, it's from the pool
2443 }
2444 break;
2445
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002446 case 13:
John Bauman66b8ab22014-05-06 15:57:45 -04002447
2448 {
2449 if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode)))
2450 context->recover();
John Baumand4ae8632014-05-06 16:18:33 -04002451 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostIncrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002452 if ((yyval.interm.intermTypedNode) == 0) {
2453 context->unaryOpError((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
2454 context->recover();
2455 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode);
2456 }
2457 }
2458 break;
2459
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002460 case 14:
John Bauman66b8ab22014-05-06 15:57:45 -04002461
2462 {
2463 if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode)))
2464 context->recover();
John Baumand4ae8632014-05-06 16:18:33 -04002465 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostDecrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002466 if ((yyval.interm.intermTypedNode) == 0) {
2467 context->unaryOpError((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
2468 context->recover();
2469 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode);
2470 }
2471 }
2472 break;
2473
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002474 case 15:
John Bauman66b8ab22014-05-06 15:57:45 -04002475
2476 {
2477 if (context->integerErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode), "[]"))
2478 context->recover();
2479 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
2480 }
2481 break;
2482
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002483 case 16:
John Bauman66b8ab22014-05-06 15:57:45 -04002484
2485 {
2486 TFunction* fnCall = (yyvsp[(1) - (1)].interm).function;
2487 TOperator op = fnCall->getBuiltInOp();
2488
2489 if (op != EOpNull)
2490 {
2491 //
2492 // Then this should be a constructor.
2493 // Don't go through the symbol table for constructors.
2494 // Their parameters will be verified algorithmically.
2495 //
2496 TType type(EbtVoid, EbpUndefined); // use this to get the type back
2497 if (context->constructorErrorCheck((yyvsp[(1) - (1)].interm).line, (yyvsp[(1) - (1)].interm).intermNode, *fnCall, op, &type)) {
2498 (yyval.interm.intermTypedNode) = 0;
2499 } else {
2500 //
2501 // It's a constructor, of type 'type'.
2502 //
2503 (yyval.interm.intermTypedNode) = context->addConstructor((yyvsp[(1) - (1)].interm).intermNode, &type, op, fnCall, (yyvsp[(1) - (1)].interm).line);
2504 }
2505
2506 if ((yyval.interm.intermTypedNode) == 0) {
2507 context->recover();
2508 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator(0, op, (yyvsp[(1) - (1)].interm).line);
2509 }
2510 (yyval.interm.intermTypedNode)->setType(type);
2511 } else {
2512 //
2513 // Not a constructor. Find it in the symbol table.
2514 //
2515 const TFunction* fnCandidate;
2516 bool builtIn;
2517 fnCandidate = context->findFunction((yyvsp[(1) - (1)].interm).line, fnCall, &builtIn);
2518 if (fnCandidate) {
2519 //
2520 // A declared function.
2521 //
2522 if (builtIn && !fnCandidate->getExtension().empty() &&
2523 context->extensionErrorCheck((yyvsp[(1) - (1)].interm).line, fnCandidate->getExtension())) {
2524 context->recover();
2525 }
2526 op = fnCandidate->getBuiltInOp();
2527 if (builtIn && op != EOpNull) {
2528 //
2529 // A function call mapped to a built-in operation.
2530 //
2531 if (fnCandidate->getParamCount() == 1) {
2532 //
2533 // Treat it like a built-in unary operator.
2534 //
John Baumand4ae8632014-05-06 16:18:33 -04002535 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(op, (yyvsp[(1) - (1)].interm).intermNode, 0);
John Bauman66b8ab22014-05-06 15:57:45 -04002536 if ((yyval.interm.intermTypedNode) == 0) {
2537 std::stringstream extraInfoStream;
2538 extraInfoStream << "built in unary operator function. Type: " << static_cast<TIntermTyped*>((yyvsp[(1) - (1)].interm).intermNode)->getCompleteString();
2539 std::string extraInfo = extraInfoStream.str();
2540 context->error((yyvsp[(1) - (1)].interm).intermNode->getLine(), " wrong operand type", "Internal Error", extraInfo.c_str());
2541 YYERROR;
2542 }
2543 } else {
2544 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, op, (yyvsp[(1) - (1)].interm).line);
2545 }
2546 } else {
2547 // This is a real function call
2548
2549 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, EOpFunctionCall, (yyvsp[(1) - (1)].interm).line);
2550 (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType());
2551
2552 // this is how we know whether the given function is a builtIn function or a user defined function
2553 // if builtIn == false, it's a userDefined -> could be an overloaded builtIn function also
2554 // if builtIn == true, it's definitely a builtIn function with EOpNull
2555 if (!builtIn)
2556 (yyval.interm.intermTypedNode)->getAsAggregate()->setUserDefined();
2557 (yyval.interm.intermTypedNode)->getAsAggregate()->setName(fnCandidate->getMangledName());
2558
2559 TQualifier qual;
2560 for (int i = 0; i < fnCandidate->getParamCount(); ++i) {
2561 qual = fnCandidate->getParam(i).type->getQualifier();
2562 if (qual == EvqOut || qual == EvqInOut) {
2563 if (context->lValueErrorCheck((yyval.interm.intermTypedNode)->getLine(), "assign", (yyval.interm.intermTypedNode)->getAsAggregate()->getSequence()[i]->getAsTyped())) {
2564 context->error((yyvsp[(1) - (1)].interm).intermNode->getLine(), "Constant value cannot be passed for 'out' or 'inout' parameters.", "Error");
2565 context->recover();
2566 }
2567 }
2568 }
2569 }
2570 (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType());
2571 } else {
2572 // error message was put out by PaFindFunction()
2573 // Put on a dummy node for error recovery
2574 ConstantUnion *unionArray = new ConstantUnion[1];
2575 unionArray->setFConst(0.0f);
2576 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].interm).line);
2577 context->recover();
2578 }
2579 }
2580 delete fnCall;
2581 }
2582 break;
2583
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002584 case 17:
John Bauman66b8ab22014-05-06 15:57:45 -04002585
2586 {
2587 (yyval.interm) = (yyvsp[(1) - (1)].interm);
2588 }
2589 break;
2590
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002591 case 18:
John Bauman66b8ab22014-05-06 15:57:45 -04002592
2593 {
2594 context->error((yyvsp[(3) - (3)].interm).line, "methods are not supported", "");
2595 context->recover();
2596 (yyval.interm) = (yyvsp[(3) - (3)].interm);
2597 }
2598 break;
2599
John Bauman66b8ab22014-05-06 15:57:45 -04002600 case 19:
2601
2602 {
2603 (yyval.interm) = (yyvsp[(1) - (2)].interm);
2604 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
2605 }
2606 break;
2607
2608 case 20:
2609
2610 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002611 (yyval.interm) = (yyvsp[(1) - (2)].interm);
2612 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
2613 }
2614 break;
2615
2616 case 21:
2617
2618 {
John Bauman66b8ab22014-05-06 15:57:45 -04002619 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
2620 (yyval.interm).intermNode = 0;
2621 }
2622 break;
2623
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002624 case 22:
John Bauman66b8ab22014-05-06 15:57:45 -04002625
2626 {
2627 (yyval.interm).function = (yyvsp[(1) - (1)].interm.function);
2628 (yyval.interm).intermNode = 0;
2629 }
2630 break;
2631
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002632 case 23:
John Bauman66b8ab22014-05-06 15:57:45 -04002633
2634 {
2635 TParameter param = { 0, new TType((yyvsp[(2) - (2)].interm.intermTypedNode)->getType()) };
2636 (yyvsp[(1) - (2)].interm.function)->addParameter(param);
2637 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
2638 (yyval.interm).intermNode = (yyvsp[(2) - (2)].interm.intermTypedNode);
2639 }
2640 break;
2641
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002642 case 24:
John Bauman66b8ab22014-05-06 15:57:45 -04002643
2644 {
2645 TParameter param = { 0, new TType((yyvsp[(3) - (3)].interm.intermTypedNode)->getType()) };
2646 (yyvsp[(1) - (3)].interm).function->addParameter(param);
2647 (yyval.interm).function = (yyvsp[(1) - (3)].interm).function;
2648 (yyval.interm).intermNode = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermNode, (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
2649 }
2650 break;
2651
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002652 case 25:
John Bauman66b8ab22014-05-06 15:57:45 -04002653
2654 {
2655 (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
2656 }
2657 break;
2658
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002659 case 26:
John Bauman66b8ab22014-05-06 15:57:45 -04002660
2661 {
2662 //
2663 // Constructor
2664 //
2665 TOperator op = EOpNull;
2666 if ((yyvsp[(1) - (1)].interm.type).userDef) {
2667 op = EOpConstructStruct;
2668 } else {
2669 switch ((yyvsp[(1) - (1)].interm.type).type) {
2670 case EbtFloat:
2671 if ((yyvsp[(1) - (1)].interm.type).matrix) {
2672 switch((yyvsp[(1) - (1)].interm.type).size) {
2673 case 2: op = EOpConstructMat2; break;
2674 case 3: op = EOpConstructMat3; break;
2675 case 4: op = EOpConstructMat4; break;
2676 }
2677 } else {
2678 switch((yyvsp[(1) - (1)].interm.type).size) {
2679 case 1: op = EOpConstructFloat; break;
2680 case 2: op = EOpConstructVec2; break;
2681 case 3: op = EOpConstructVec3; break;
2682 case 4: op = EOpConstructVec4; break;
2683 }
2684 }
2685 break;
2686 case EbtInt:
2687 switch((yyvsp[(1) - (1)].interm.type).size) {
2688 case 1: op = EOpConstructInt; break;
2689 case 2: FRAG_VERT_ONLY("ivec2", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec2; break;
2690 case 3: FRAG_VERT_ONLY("ivec3", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec3; break;
2691 case 4: FRAG_VERT_ONLY("ivec4", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec4; break;
2692 }
2693 break;
2694 case EbtBool:
2695 switch((yyvsp[(1) - (1)].interm.type).size) {
2696 case 1: op = EOpConstructBool; break;
2697 case 2: FRAG_VERT_ONLY("bvec2", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec2; break;
2698 case 3: FRAG_VERT_ONLY("bvec3", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec3; break;
2699 case 4: FRAG_VERT_ONLY("bvec4", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec4; break;
2700 }
2701 break;
2702 default: break;
2703 }
2704 if (op == EOpNull) {
2705 context->error((yyvsp[(1) - (1)].interm.type).line, "cannot construct this type", getBasicString((yyvsp[(1) - (1)].interm.type).type));
2706 context->recover();
2707 (yyvsp[(1) - (1)].interm.type).type = EbtFloat;
2708 op = EOpConstructFloat;
2709 }
2710 }
2711 TString tempString;
2712 TType type((yyvsp[(1) - (1)].interm.type));
2713 TFunction *function = new TFunction(&tempString, type, op);
2714 (yyval.interm.function) = function;
2715 }
2716 break;
2717
John Bauman66b8ab22014-05-06 15:57:45 -04002718 case 27:
2719
2720 {
2721 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
2722 context->recover();
2723 TType type(EbtVoid, EbpUndefined);
2724 TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type);
2725 (yyval.interm.function) = function;
2726 }
2727 break;
2728
2729 case 28:
2730
2731 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002732 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
2733 context->recover();
2734 TType type(EbtVoid, EbpUndefined);
2735 TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type);
2736 (yyval.interm.function) = function;
John Bauman66b8ab22014-05-06 15:57:45 -04002737 }
2738 break;
2739
2740 case 29:
2741
2742 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002743 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
2744 }
2745 break;
2746
2747 case 30:
2748
2749 {
John Bauman66b8ab22014-05-06 15:57:45 -04002750 if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)))
2751 context->recover();
John Baumand4ae8632014-05-06 16:18:33 -04002752 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreIncrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002753 if ((yyval.interm.intermTypedNode) == 0) {
2754 context->unaryOpError((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2755 context->recover();
2756 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2757 }
2758 }
2759 break;
2760
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002761 case 31:
John Bauman66b8ab22014-05-06 15:57:45 -04002762
2763 {
2764 if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)))
2765 context->recover();
John Baumand4ae8632014-05-06 16:18:33 -04002766 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreDecrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002767 if ((yyval.interm.intermTypedNode) == 0) {
2768 context->unaryOpError((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2769 context->recover();
2770 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2771 }
2772 }
2773 break;
2774
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002775 case 32:
John Bauman66b8ab22014-05-06 15:57:45 -04002776
2777 {
2778 if ((yyvsp[(1) - (2)].interm).op != EOpNull) {
John Baumand4ae8632014-05-06 16:18:33 -04002779 (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 -04002780 if ((yyval.interm.intermTypedNode) == 0) {
2781 const char* errorOp = "";
2782 switch((yyvsp[(1) - (2)].interm).op) {
2783 case EOpNegative: errorOp = "-"; break;
2784 case EOpLogicalNot: errorOp = "!"; break;
2785 default: break;
2786 }
2787 context->unaryOpError((yyvsp[(1) - (2)].interm).line, errorOp, (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2788 context->recover();
2789 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2790 }
2791 } else
2792 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2793 }
2794 break;
2795
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002796 case 33:
John Bauman66b8ab22014-05-06 15:57:45 -04002797
2798 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNull; }
2799 break;
2800
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002801 case 34:
John Bauman66b8ab22014-05-06 15:57:45 -04002802
2803 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNegative; }
2804 break;
2805
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002806 case 35:
John Bauman66b8ab22014-05-06 15:57:45 -04002807
2808 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpLogicalNot; }
2809 break;
2810
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002811 case 36:
John Bauman66b8ab22014-05-06 15:57:45 -04002812
2813 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
2814 break;
2815
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002816 case 37:
John Bauman66b8ab22014-05-06 15:57:45 -04002817
2818 {
2819 FRAG_VERT_ONLY("*", (yyvsp[(2) - (3)].lex).line);
John Baumand4ae8632014-05-06 16:18:33 -04002820 (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 -04002821 if ((yyval.interm.intermTypedNode) == 0) {
2822 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "*", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2823 context->recover();
2824 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2825 }
2826 }
2827 break;
2828
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002829 case 38:
John Bauman66b8ab22014-05-06 15:57:45 -04002830
2831 {
2832 FRAG_VERT_ONLY("/", (yyvsp[(2) - (3)].lex).line);
John Baumand4ae8632014-05-06 16:18:33 -04002833 (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 -04002834 if ((yyval.interm.intermTypedNode) == 0) {
2835 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "/", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2836 context->recover();
2837 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2838 }
2839 }
2840 break;
2841
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002842 case 39:
John Bauman66b8ab22014-05-06 15:57:45 -04002843
2844 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
2845 break;
2846
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002847 case 40:
John Bauman66b8ab22014-05-06 15:57:45 -04002848
2849 {
John Baumand4ae8632014-05-06 16:18:33 -04002850 (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 -04002851 if ((yyval.interm.intermTypedNode) == 0) {
2852 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "+", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2853 context->recover();
2854 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2855 }
2856 }
2857 break;
2858
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002859 case 41:
John Bauman66b8ab22014-05-06 15:57:45 -04002860
2861 {
John Baumand4ae8632014-05-06 16:18:33 -04002862 (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 -04002863 if ((yyval.interm.intermTypedNode) == 0) {
2864 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "-", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2865 context->recover();
2866 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2867 }
2868 }
2869 break;
2870
John Bauman66b8ab22014-05-06 15:57:45 -04002871 case 42:
2872
2873 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
2874 break;
2875
2876 case 43:
2877
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002878 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
2879 break;
2880
2881 case 44:
2882
John Bauman66b8ab22014-05-06 15:57:45 -04002883 {
John Baumand4ae8632014-05-06 16:18:33 -04002884 (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 -04002885 if ((yyval.interm.intermTypedNode) == 0) {
2886 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2887 context->recover();
2888 ConstantUnion *unionArray = new ConstantUnion[1];
2889 unionArray->setBConst(false);
2890 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2891 }
2892 }
2893 break;
2894
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002895 case 45:
John Bauman66b8ab22014-05-06 15:57:45 -04002896
2897 {
John Baumand4ae8632014-05-06 16:18:33 -04002898 (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 -04002899 if ((yyval.interm.intermTypedNode) == 0) {
2900 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2901 context->recover();
2902 ConstantUnion *unionArray = new ConstantUnion[1];
2903 unionArray->setBConst(false);
2904 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2905 }
2906 }
2907 break;
2908
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002909 case 46:
John Bauman66b8ab22014-05-06 15:57:45 -04002910
2911 {
John Baumand4ae8632014-05-06 16:18:33 -04002912 (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 -04002913 if ((yyval.interm.intermTypedNode) == 0) {
2914 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2915 context->recover();
2916 ConstantUnion *unionArray = new ConstantUnion[1];
2917 unionArray->setBConst(false);
2918 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2919 }
2920 }
2921 break;
2922
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002923 case 47:
John Bauman66b8ab22014-05-06 15:57:45 -04002924
2925 {
John Baumand4ae8632014-05-06 16:18:33 -04002926 (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 -04002927 if ((yyval.interm.intermTypedNode) == 0) {
2928 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2929 context->recover();
2930 ConstantUnion *unionArray = new ConstantUnion[1];
2931 unionArray->setBConst(false);
2932 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2933 }
2934 }
2935 break;
2936
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002937 case 48:
John Bauman66b8ab22014-05-06 15:57:45 -04002938
2939 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
2940 break;
2941
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002942 case 49:
John Bauman66b8ab22014-05-06 15:57:45 -04002943
2944 {
John Baumand4ae8632014-05-06 16:18:33 -04002945 (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 -04002946 if ((yyval.interm.intermTypedNode) == 0) {
2947 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "==", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2948 context->recover();
2949 ConstantUnion *unionArray = new ConstantUnion[1];
2950 unionArray->setBConst(false);
2951 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2952 }
2953 }
2954 break;
2955
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002956 case 50:
John Bauman66b8ab22014-05-06 15:57:45 -04002957
2958 {
John Baumand4ae8632014-05-06 16:18:33 -04002959 (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 -04002960 if ((yyval.interm.intermTypedNode) == 0) {
2961 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "!=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2962 context->recover();
2963 ConstantUnion *unionArray = new ConstantUnion[1];
2964 unionArray->setBConst(false);
2965 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2966 }
2967 }
2968 break;
2969
John Bauman66b8ab22014-05-06 15:57:45 -04002970 case 51:
2971
2972 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
2973 break;
2974
2975 case 52:
2976
2977 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
2978 break;
2979
2980 case 53:
2981
2982 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
2983 break;
2984
2985 case 54:
2986
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002987 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
2988 break;
2989
2990 case 55:
2991
John Bauman66b8ab22014-05-06 15:57:45 -04002992 {
John Baumand4ae8632014-05-06 16:18:33 -04002993 (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 -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 ConstantUnion *unionArray = new ConstantUnion[1];
2998 unionArray->setBConst(false);
2999 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
3000 }
3001 }
3002 break;
3003
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003004 case 56:
John Bauman66b8ab22014-05-06 15:57:45 -04003005
3006 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
3007 break;
3008
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003009 case 57:
John Bauman66b8ab22014-05-06 15:57:45 -04003010
3011 {
John Baumand4ae8632014-05-06 16:18:33 -04003012 (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 -04003013 if ((yyval.interm.intermTypedNode) == 0) {
3014 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "^^", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3015 context->recover();
3016 ConstantUnion *unionArray = new ConstantUnion[1];
3017 unionArray->setBConst(false);
3018 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
3019 }
3020 }
3021 break;
3022
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003023 case 58:
John Bauman66b8ab22014-05-06 15:57:45 -04003024
3025 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
3026 break;
3027
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003028 case 59:
John Bauman66b8ab22014-05-06 15:57:45 -04003029
3030 {
John Baumand4ae8632014-05-06 16:18:33 -04003031 (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 -04003032 if ((yyval.interm.intermTypedNode) == 0) {
3033 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "||", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3034 context->recover();
3035 ConstantUnion *unionArray = new ConstantUnion[1];
3036 unionArray->setBConst(false);
3037 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
3038 }
3039 }
3040 break;
3041
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003042 case 60:
John Bauman66b8ab22014-05-06 15:57:45 -04003043
3044 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
3045 break;
3046
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003047 case 61:
John Bauman66b8ab22014-05-06 15:57:45 -04003048
3049 {
3050 if (context->boolErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.intermTypedNode)))
3051 context->recover();
3052
3053 (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);
3054 if ((yyvsp[(3) - (5)].interm.intermTypedNode)->getType() != (yyvsp[(5) - (5)].interm.intermTypedNode)->getType())
3055 (yyval.interm.intermTypedNode) = 0;
3056
3057 if ((yyval.interm.intermTypedNode) == 0) {
3058 context->binaryOpError((yyvsp[(2) - (5)].lex).line, ":", (yyvsp[(3) - (5)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(5) - (5)].interm.intermTypedNode)->getCompleteString());
3059 context->recover();
3060 (yyval.interm.intermTypedNode) = (yyvsp[(5) - (5)].interm.intermTypedNode);
3061 }
3062 }
3063 break;
3064
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003065 case 62:
John Bauman66b8ab22014-05-06 15:57:45 -04003066
3067 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
3068 break;
3069
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003070 case 63:
John Bauman66b8ab22014-05-06 15:57:45 -04003071
3072 {
3073 if (context->lValueErrorCheck((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)))
3074 context->recover();
3075 (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);
3076 if ((yyval.interm.intermTypedNode) == 0) {
3077 context->assignError((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3078 context->recover();
3079 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
3080 }
3081 }
3082 break;
3083
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003084 case 64:
John Bauman66b8ab22014-05-06 15:57:45 -04003085
3086 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAssign; }
3087 break;
3088
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003089 case 65:
John Bauman66b8ab22014-05-06 15:57:45 -04003090
3091 { FRAG_VERT_ONLY("*=", (yyvsp[(1) - (1)].lex).line); (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpMulAssign; }
3092 break;
3093
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003094 case 66:
John Bauman66b8ab22014-05-06 15:57:45 -04003095
3096 { FRAG_VERT_ONLY("/=", (yyvsp[(1) - (1)].lex).line); (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpDivAssign; }
3097 break;
3098
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003099 case 67:
John Bauman66b8ab22014-05-06 15:57:45 -04003100
3101 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAddAssign; }
3102 break;
3103
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003104 case 68:
John Bauman66b8ab22014-05-06 15:57:45 -04003105
3106 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpSubAssign; }
3107 break;
3108
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003109 case 69:
John Bauman66b8ab22014-05-06 15:57:45 -04003110
3111 {
3112 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
3113 }
3114 break;
3115
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003116 case 70:
John Bauman66b8ab22014-05-06 15:57:45 -04003117
3118 {
3119 (yyval.interm.intermTypedNode) = context->intermediate.addComma((yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
3120 if ((yyval.interm.intermTypedNode) == 0) {
3121 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ",", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3122 context->recover();
3123 (yyval.interm.intermTypedNode) = (yyvsp[(3) - (3)].interm.intermTypedNode);
3124 }
3125 }
3126 break;
3127
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003128 case 71:
John Bauman66b8ab22014-05-06 15:57:45 -04003129
3130 {
3131 if (context->constErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)))
3132 context->recover();
3133 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
3134 }
3135 break;
3136
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003137 case 72:
John Bauman66b8ab22014-05-06 15:57:45 -04003138
3139 {
3140 TFunction &function = *((yyvsp[(1) - (2)].interm).function);
3141
3142 TIntermAggregate *prototype = new TIntermAggregate;
3143 prototype->setType(function.getReturnType());
3144 prototype->setName(function.getName());
3145
3146 for (int i = 0; i < function.getParamCount(); i++)
3147 {
3148 const TParameter &param = function.getParam(i);
3149 if (param.name != 0)
3150 {
John Baumand4ae8632014-05-06 16:18:33 -04003151 TVariable variable(param.name, *param.type);
John Bauman66b8ab22014-05-06 15:57:45 -04003152
John Baumand4ae8632014-05-06 16:18:33 -04003153 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 -04003154 }
3155 else
3156 {
3157 prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (2)].interm).line), (yyvsp[(1) - (2)].interm).line);
3158 }
3159 }
3160
3161 prototype->setOp(EOpPrototype);
3162 (yyval.interm.intermNode) = prototype;
3163
3164 context->symbolTable.pop();
3165 }
3166 break;
3167
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003168 case 73:
John Bauman66b8ab22014-05-06 15:57:45 -04003169
3170 {
3171 if ((yyvsp[(1) - (2)].interm).intermAggregate)
3172 (yyvsp[(1) - (2)].interm).intermAggregate->setOp(EOpDeclaration);
3173 (yyval.interm.intermNode) = (yyvsp[(1) - (2)].interm).intermAggregate;
3174 }
3175 break;
3176
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003177 case 74:
John Bauman66b8ab22014-05-06 15:57:45 -04003178
3179 {
John Baumand4ae8632014-05-06 16:18:33 -04003180 if (!context->symbolTable.setDefaultPrecision( (yyvsp[(3) - (4)].interm.type), (yyvsp[(2) - (4)].interm.precision) )) {
3181 context->error((yyvsp[(1) - (4)].lex).line, "illegal type argument for default precision qualifier", getBasicString((yyvsp[(3) - (4)].interm.type).type));
3182 context->recover();
3183 }
John Bauman66b8ab22014-05-06 15:57:45 -04003184 (yyval.interm.intermNode) = 0;
3185 }
3186 break;
3187
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003188 case 75:
John Bauman66b8ab22014-05-06 15:57:45 -04003189
3190 {
3191 //
3192 // Multiple declarations of the same function are allowed.
3193 //
3194 // If this is a definition, the definition production code will check for redefinitions
3195 // (we don't know at this point if it's a definition or not).
3196 //
3197 // Redeclarations are allowed. But, return types and parameter qualifiers must match.
3198 //
3199 TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find((yyvsp[(1) - (2)].interm.function)->getMangledName()));
3200 if (prevDec) {
3201 if (prevDec->getReturnType() != (yyvsp[(1) - (2)].interm.function)->getReturnType()) {
3202 context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same return type", (yyvsp[(1) - (2)].interm.function)->getReturnType().getBasicString());
3203 context->recover();
3204 }
3205 for (int i = 0; i < prevDec->getParamCount(); ++i) {
3206 if (prevDec->getParam(i).type->getQualifier() != (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifier()) {
3207 context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same parameter qualifiers", (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifierString());
3208 context->recover();
3209 }
3210 }
3211 }
3212
3213 //
3214 // If this is a redeclaration, it could also be a definition,
3215 // in which case, we want to use the variable names from this one, and not the one that's
3216 // being redeclared. So, pass back up this declaration, not the one in the symbol table.
3217 //
3218 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
3219 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
3220
3221 // We're at the inner scope level of the function's arguments and body statement.
3222 // Add the function prototype to the surrounding scope instead.
3223 context->symbolTable.getOuterLevel()->insert(*(yyval.interm).function);
3224 }
3225 break;
3226
John Bauman66b8ab22014-05-06 15:57:45 -04003227 case 76:
3228
3229 {
3230 (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
3231 }
3232 break;
3233
3234 case 77:
3235
3236 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003237 (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
3238 }
3239 break;
3240
3241 case 78:
3242
3243 {
John Bauman66b8ab22014-05-06 15:57:45 -04003244 // Add the parameter
3245 (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
3246 if ((yyvsp[(2) - (2)].interm).param.type->getBasicType() != EbtVoid)
3247 (yyvsp[(1) - (2)].interm.function)->addParameter((yyvsp[(2) - (2)].interm).param);
3248 else
3249 delete (yyvsp[(2) - (2)].interm).param.type;
3250 }
3251 break;
3252
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003253 case 79:
John Bauman66b8ab22014-05-06 15:57:45 -04003254
3255 {
3256 //
3257 // Only first parameter of one-parameter functions can be void
3258 // The check for named parameters not being void is done in parameter_declarator
3259 //
3260 if ((yyvsp[(3) - (3)].interm).param.type->getBasicType() == EbtVoid) {
3261 //
3262 // This parameter > first is void
3263 //
3264 context->error((yyvsp[(2) - (3)].lex).line, "cannot be an argument type except for '(void)'", "void");
3265 context->recover();
3266 delete (yyvsp[(3) - (3)].interm).param.type;
3267 } else {
3268 // Add the parameter
3269 (yyval.interm.function) = (yyvsp[(1) - (3)].interm.function);
3270 (yyvsp[(1) - (3)].interm.function)->addParameter((yyvsp[(3) - (3)].interm).param);
3271 }
3272 }
3273 break;
3274
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003275 case 80:
John Bauman66b8ab22014-05-06 15:57:45 -04003276
3277 {
3278 if ((yyvsp[(1) - (3)].interm.type).qualifier != EvqGlobal && (yyvsp[(1) - (3)].interm.type).qualifier != EvqTemporary) {
3279 context->error((yyvsp[(2) - (3)].lex).line, "no qualifiers allowed for function return", getQualifierString((yyvsp[(1) - (3)].interm.type).qualifier));
3280 context->recover();
3281 }
3282 // make sure a sampler is not involved as well...
3283 if (context->structQualifierErrorCheck((yyvsp[(2) - (3)].lex).line, (yyvsp[(1) - (3)].interm.type)))
3284 context->recover();
3285
3286 // Add the function as a prototype after parsing it (we do not support recursion)
3287 TFunction *function;
3288 TType type((yyvsp[(1) - (3)].interm.type));
3289 function = new TFunction((yyvsp[(2) - (3)].lex).string, type);
3290 (yyval.interm.function) = function;
3291
3292 context->symbolTable.push();
3293 }
3294 break;
3295
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003296 case 81:
John Bauman66b8ab22014-05-06 15:57:45 -04003297
3298 {
3299 if ((yyvsp[(1) - (2)].interm.type).type == EbtVoid) {
3300 context->error((yyvsp[(2) - (2)].lex).line, "illegal use of type 'void'", (yyvsp[(2) - (2)].lex).string->c_str());
3301 context->recover();
3302 }
3303 if (context->reservedErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string))
3304 context->recover();
3305 TParameter param = {(yyvsp[(2) - (2)].lex).string, new TType((yyvsp[(1) - (2)].interm.type))};
3306 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
3307 (yyval.interm).param = param;
3308 }
3309 break;
3310
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003311 case 82:
John Bauman66b8ab22014-05-06 15:57:45 -04003312
3313 {
3314 // Check that we can make an array out of this type
3315 if (context->arrayTypeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
3316 context->recover();
3317
3318 if (context->reservedErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string))
3319 context->recover();
3320
3321 int size;
3322 if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3323 context->recover();
3324 (yyvsp[(1) - (5)].interm.type).setArray(true, size);
3325
3326 TType* type = new TType((yyvsp[(1) - (5)].interm.type));
3327 TParameter param = { (yyvsp[(2) - (5)].lex).string, type };
3328 (yyval.interm).line = (yyvsp[(2) - (5)].lex).line;
3329 (yyval.interm).param = param;
3330 }
3331 break;
3332
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003333 case 83:
John Bauman66b8ab22014-05-06 15:57:45 -04003334
3335 {
3336 (yyval.interm) = (yyvsp[(3) - (3)].interm);
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003337 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 -04003338 context->recover();
3339 }
3340 break;
3341
John Bauman66b8ab22014-05-06 15:57:45 -04003342 case 84:
3343
3344 {
John Bauman66b8ab22014-05-06 15:57:45 -04003345 (yyval.interm) = (yyvsp[(2) - (2)].interm);
3346 if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
3347 context->recover();
3348 if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
3349 context->recover();
3350 }
3351 break;
3352
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003353 case 85:
3354
3355 {
3356 (yyval.interm) = (yyvsp[(3) - (3)].interm);
3357 if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.qualifier), (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
3358 context->recover();
3359 }
3360 break;
3361
John Bauman66b8ab22014-05-06 15:57:45 -04003362 case 86:
3363
3364 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003365 (yyval.interm) = (yyvsp[(2) - (2)].interm);
3366 if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
3367 context->recover();
3368 if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
3369 context->recover();
John Bauman66b8ab22014-05-06 15:57:45 -04003370 }
3371 break;
3372
3373 case 87:
3374
3375 {
3376 (yyval.interm.qualifier) = EvqIn;
3377 }
3378 break;
3379
3380 case 88:
3381
3382 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003383 (yyval.interm.qualifier) = EvqIn;
John Bauman66b8ab22014-05-06 15:57:45 -04003384 }
3385 break;
3386
3387 case 89:
3388
3389 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003390 (yyval.interm.qualifier) = EvqOut;
John Bauman66b8ab22014-05-06 15:57:45 -04003391 }
3392 break;
3393
3394 case 90:
3395
3396 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003397 (yyval.interm.qualifier) = EvqInOut;
3398 }
3399 break;
3400
3401 case 91:
3402
3403 {
John Bauman66b8ab22014-05-06 15:57:45 -04003404 TParameter param = { 0, new TType((yyvsp[(1) - (1)].interm.type)) };
3405 (yyval.interm).param = param;
3406 }
3407 break;
3408
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003409 case 92:
John Bauman66b8ab22014-05-06 15:57:45 -04003410
3411 {
3412 (yyval.interm) = (yyvsp[(1) - (1)].interm);
3413 }
3414 break;
3415
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003416 case 93:
John Bauman66b8ab22014-05-06 15:57:45 -04003417
3418 {
3419 if ((yyvsp[(1) - (3)].interm).type.type == EbtInvariant && !(yyvsp[(3) - (3)].lex).symbol)
3420 {
3421 context->error((yyvsp[(3) - (3)].lex).line, "undeclared identifier declared as invariant", (yyvsp[(3) - (3)].lex).string->c_str());
3422 context->recover();
3423 }
3424
3425 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(3) - (3)].lex).string, TType((yyvsp[(1) - (3)].interm).type), (yyvsp[(3) - (3)].lex).line);
3426 (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermNode, symbol, (yyvsp[(3) - (3)].lex).line);
3427
3428 if (context->structQualifierErrorCheck((yyvsp[(3) - (3)].lex).line, (yyval.interm).type))
3429 context->recover();
3430
3431 if (context->nonInitConstErrorCheck((yyvsp[(3) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyval.interm).type, false))
3432 context->recover();
3433
3434 TVariable* variable = 0;
3435 if (context->nonInitErrorCheck((yyvsp[(3) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyval.interm).type, variable))
3436 context->recover();
3437 if (symbol && variable)
3438 symbol->setId(variable->getUniqueId());
3439 }
3440 break;
3441
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003442 case 94:
John Bauman66b8ab22014-05-06 15:57:45 -04003443
3444 {
3445 if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
3446 context->recover();
3447
3448 if (context->nonInitConstErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, true))
3449 context->recover();
3450
3451 (yyval.interm) = (yyvsp[(1) - (5)].interm);
3452
3453 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))
3454 context->recover();
3455 else {
3456 (yyvsp[(1) - (5)].interm).type.setArray(true);
3457 TVariable* variable;
3458 if (context->arrayErrorCheck((yyvsp[(4) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, variable))
3459 context->recover();
3460 }
3461 }
3462 break;
3463
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003464 case 95:
John Bauman66b8ab22014-05-06 15:57:45 -04003465
3466 {
3467 if (context->structQualifierErrorCheck((yyvsp[(3) - (6)].lex).line, (yyvsp[(1) - (6)].interm).type))
3468 context->recover();
3469
3470 if (context->nonInitConstErrorCheck((yyvsp[(3) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type, true))
3471 context->recover();
3472
3473 (yyval.interm) = (yyvsp[(1) - (6)].interm);
3474
3475 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))
3476 context->recover();
3477 else {
3478 int size;
3479 if (context->arraySizeErrorCheck((yyvsp[(4) - (6)].lex).line, (yyvsp[(5) - (6)].interm.intermTypedNode), size))
3480 context->recover();
3481 (yyvsp[(1) - (6)].interm).type.setArray(true, size);
3482 TVariable* variable = 0;
3483 if (context->arrayErrorCheck((yyvsp[(4) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type, variable))
3484 context->recover();
3485 TType type = TType((yyvsp[(1) - (6)].interm).type);
3486 type.setArraySize(size);
3487 (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);
3488 }
3489 }
3490 break;
3491
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003492 case 96:
John Bauman66b8ab22014-05-06 15:57:45 -04003493
3494 {
3495 if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
3496 context->recover();
3497
3498 (yyval.interm) = (yyvsp[(1) - (5)].interm);
3499
3500 TIntermNode* intermNode;
3501 if (!context->executeInitializer((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, (yyvsp[(5) - (5)].interm.intermTypedNode), intermNode)) {
3502 //
3503 // build the intermediate representation
3504 //
3505 if (intermNode)
3506 (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (5)].interm).intermNode, intermNode, (yyvsp[(4) - (5)].lex).line);
3507 else
3508 (yyval.interm).intermAggregate = (yyvsp[(1) - (5)].interm).intermAggregate;
3509 } else {
3510 context->recover();
3511 (yyval.interm).intermAggregate = 0;
3512 }
3513 }
3514 break;
3515
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003516 case 97:
John Bauman66b8ab22014-05-06 15:57:45 -04003517
3518 {
3519 (yyval.interm).type = (yyvsp[(1) - (1)].interm.type);
3520 (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);
3521 }
3522 break;
3523
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003524 case 98:
John Bauman66b8ab22014-05-06 15:57:45 -04003525
3526 {
3527 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyvsp[(1) - (2)].interm.type)), (yyvsp[(2) - (2)].lex).line);
3528 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (2)].lex).line);
3529
3530 if (context->structQualifierErrorCheck((yyvsp[(2) - (2)].lex).line, (yyval.interm).type))
3531 context->recover();
3532
3533 if (context->nonInitConstErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string, (yyval.interm).type, false))
3534 context->recover();
3535
3536 (yyval.interm).type = (yyvsp[(1) - (2)].interm.type);
3537
3538 TVariable* variable = 0;
3539 if (context->nonInitErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string, (yyval.interm).type, variable))
3540 context->recover();
3541 if (variable && symbol)
3542 symbol->setId(variable->getUniqueId());
3543 }
3544 break;
3545
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003546 case 99:
John Bauman66b8ab22014-05-06 15:57:45 -04003547
3548 {
3549 context->error((yyvsp[(2) - (4)].lex).line, "unsized array declarations not supported", (yyvsp[(2) - (4)].lex).string->c_str());
3550 context->recover();
3551
3552 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (4)].lex).string, TType((yyvsp[(1) - (4)].interm.type)), (yyvsp[(2) - (4)].lex).line);
3553 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (4)].lex).line);
3554 (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
3555 }
3556 break;
3557
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003558 case 100:
John Bauman66b8ab22014-05-06 15:57:45 -04003559
3560 {
3561 TType type = TType((yyvsp[(1) - (5)].interm.type));
3562 int size;
3563 if (context->arraySizeErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3564 context->recover();
3565 type.setArraySize(size);
3566 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (5)].lex).string, type, (yyvsp[(2) - (5)].lex).line);
3567 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (5)].lex).line);
3568
3569 if (context->structQualifierErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
3570 context->recover();
3571
3572 if (context->nonInitConstErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type), true))
3573 context->recover();
3574
3575 (yyval.interm).type = (yyvsp[(1) - (5)].interm.type);
3576
3577 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)))
3578 context->recover();
3579 else {
3580 int size;
3581 if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3582 context->recover();
3583
3584 (yyvsp[(1) - (5)].interm.type).setArray(true, size);
3585 TVariable* variable = 0;
3586 if (context->arrayErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type), variable))
3587 context->recover();
3588 if (variable && symbol)
3589 symbol->setId(variable->getUniqueId());
3590 }
3591 }
3592 break;
3593
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003594 case 101:
John Bauman66b8ab22014-05-06 15:57:45 -04003595
3596 {
3597 if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
3598 context->recover();
3599
3600 (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
3601
3602 TIntermNode* intermNode;
3603 if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode)) {
3604 //
3605 // Build intermediate representation
3606 //
3607 if(intermNode)
3608 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(intermNode, (yyvsp[(3) - (4)].lex).line);
3609 else
3610 (yyval.interm).intermAggregate = 0;
3611 } else {
3612 context->recover();
3613 (yyval.interm).intermAggregate = 0;
3614 }
3615 }
3616 break;
3617
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003618 case 102:
John Bauman66b8ab22014-05-06 15:57:45 -04003619
3620 {
John Bauman66b8ab22014-05-06 15:57:45 -04003621 if (context->globalErrorCheck((yyvsp[(1) - (2)].lex).line, context->symbolTable.atGlobalLevel(), "invariant varying"))
3622 context->recover();
3623 (yyval.interm).type.setBasic(EbtInvariant, EvqInvariantVaryingOut, (yyvsp[(2) - (2)].lex).line);
3624 if (!(yyvsp[(2) - (2)].lex).symbol)
3625 {
3626 context->error((yyvsp[(2) - (2)].lex).line, "undeclared identifier declared as invariant", (yyvsp[(2) - (2)].lex).string->c_str());
3627 context->recover();
3628
3629 (yyval.interm).intermAggregate = 0;
3630 }
3631 else
3632 {
3633 TIntermSymbol *symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyval.interm).type), (yyvsp[(2) - (2)].lex).line);
3634 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (2)].lex).line);
3635 }
3636 }
3637 break;
3638
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003639 case 103:
John Bauman66b8ab22014-05-06 15:57:45 -04003640
3641 {
3642 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3643
3644 if ((yyvsp[(1) - (1)].interm.type).array) {
3645 context->error((yyvsp[(1) - (1)].interm.type).line, "not supported", "first-class array");
3646 context->recover();
3647 (yyvsp[(1) - (1)].interm.type).setArray(false);
3648 }
3649 }
3650 break;
3651
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003652 case 104:
John Bauman66b8ab22014-05-06 15:57:45 -04003653
3654 {
3655 if ((yyvsp[(2) - (2)].interm.type).array) {
3656 context->error((yyvsp[(2) - (2)].interm.type).line, "not supported", "first-class array");
3657 context->recover();
3658 (yyvsp[(2) - (2)].interm.type).setArray(false);
3659 }
3660
3661 if ((yyvsp[(1) - (2)].interm.type).qualifier == EvqAttribute &&
3662 ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
3663 context->error((yyvsp[(2) - (2)].interm.type).line, "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier));
3664 context->recover();
3665 }
3666 if (((yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingIn || (yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingOut) &&
3667 ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
3668 context->error((yyvsp[(2) - (2)].interm.type).line, "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier));
3669 context->recover();
3670 }
3671 (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
3672 (yyval.interm.type).qualifier = (yyvsp[(1) - (2)].interm.type).qualifier;
3673 }
3674 break;
3675
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003676 case 105:
John Bauman66b8ab22014-05-06 15:57:45 -04003677
3678 {
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003679 (yyval.interm.qualifier) = EvqConst;
John Bauman66b8ab22014-05-06 15:57:45 -04003680 }
3681 break;
3682
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003683 case 106:
John Bauman66b8ab22014-05-06 15:57:45 -04003684
3685 {
3686 VERTEX_ONLY("attribute", (yyvsp[(1) - (1)].lex).line);
Nicolas Capensc6841852015-02-15 14:25:37 -05003687 ES2_ONLY("attribute", (yyvsp[(1) - (1)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003688 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "attribute"))
3689 context->recover();
3690 (yyval.interm.type).setBasic(EbtVoid, EvqAttribute, (yyvsp[(1) - (1)].lex).line);
3691 }
3692 break;
3693
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003694 case 107:
John Bauman66b8ab22014-05-06 15:57:45 -04003695
3696 {
Nicolas Capensc6841852015-02-15 14:25:37 -05003697 ES2_ONLY("varying", (yyvsp[(1) - (1)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003698 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "varying"))
3699 context->recover();
Nicolas Capens08ca3c62015-02-13 16:06:45 -05003700 if (context->shaderType == GL_VERTEX_SHADER)
John Bauman66b8ab22014-05-06 15:57:45 -04003701 (yyval.interm.type).setBasic(EbtVoid, EvqVaryingOut, (yyvsp[(1) - (1)].lex).line);
3702 else
3703 (yyval.interm.type).setBasic(EbtVoid, EvqVaryingIn, (yyvsp[(1) - (1)].lex).line);
3704 }
3705 break;
3706
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003707 case 108:
John Bauman66b8ab22014-05-06 15:57:45 -04003708
3709 {
Nicolas Capensc6841852015-02-15 14:25:37 -05003710 ES2_ONLY("varying", (yyvsp[(1) - (2)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003711 if (context->globalErrorCheck((yyvsp[(1) - (2)].lex).line, context->symbolTable.atGlobalLevel(), "invariant varying"))
3712 context->recover();
Nicolas Capens08ca3c62015-02-13 16:06:45 -05003713 if (context->shaderType == GL_VERTEX_SHADER)
John Bauman66b8ab22014-05-06 15:57:45 -04003714 (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingOut, (yyvsp[(1) - (2)].lex).line);
3715 else
3716 (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingIn, (yyvsp[(1) - (2)].lex).line);
3717 }
3718 break;
3719
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003720 case 109:
John Bauman66b8ab22014-05-06 15:57:45 -04003721
3722 {
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003723 (yyval.interm.type).setBasic(EbtVoid, (yyvsp[(1) - (1)].interm.type).qualifier, (yyvsp[(1) - (1)].interm.type).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003724 }
3725 break;
3726
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003727 case 110:
John Bauman66b8ab22014-05-06 15:57:45 -04003728
3729 {
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003730 (yyval.interm.type).qualifier = EvqConst;
3731 (yyval.interm.type).line = (yyvsp[(1) - (1)].lex).line;
3732 }
3733 break;
3734
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003735 case 111:
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003736
3737 {
3738 ES3_ONLY("in", (yyvsp[(1) - (1)].lex).line);
3739 (yyval.interm.type).qualifier = (context->shaderType == GL_FRAGMENT_SHADER) ? EvqVaryingIn : EvqAttribute;
3740 (yyval.interm.type).line = (yyvsp[(1) - (1)].lex).line;
3741 }
3742 break;
3743
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003744 case 112:
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003745
3746 {
3747 ES3_ONLY("out", (yyvsp[(1) - (1)].lex).line);
3748 (yyval.interm.type).qualifier = (context->shaderType == GL_FRAGMENT_SHADER) ? EvqFragColor : EvqVaryingOut;
3749 (yyval.interm.type).line = (yyvsp[(1) - (1)].lex).line;
3750 }
3751 break;
3752
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003753 case 113:
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003754
3755 {
3756 ES3_ONLY("in", (yyvsp[(1) - (2)].lex).line);
3757 // FIXME: Handle centroid qualifier
3758 (yyval.interm.type).qualifier = (context->shaderType == GL_FRAGMENT_SHADER) ? EvqVaryingIn : EvqAttribute;
3759 (yyval.interm.type).line = (yyvsp[(2) - (2)].lex).line;
3760 }
3761 break;
3762
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003763 case 114:
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003764
3765 {
3766 ES3_ONLY("out", (yyvsp[(1) - (2)].lex).line);
3767 // FIXME: Handle centroid qualifier
3768 (yyval.interm.type).qualifier = (context->shaderType == GL_FRAGMENT_SHADER) ? EvqFragColor : EvqVaryingOut;
3769 (yyval.interm.type).line = (yyvsp[(2) - (2)].lex).line;
3770 }
3771 break;
3772
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003773 case 115:
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003774
3775 {
3776 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "uniform"))
3777 context->recover();
3778 (yyval.interm.type).qualifier = EvqUniform;
3779 (yyval.interm.type).line = (yyvsp[(1) - (1)].lex).line;
3780 }
3781 break;
3782
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003783 case 116:
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003784
3785 {
John Bauman66b8ab22014-05-06 15:57:45 -04003786 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3787
3788 if ((yyval.interm.type).precision == EbpUndefined) {
3789 (yyval.interm.type).precision = context->symbolTable.getDefaultPrecision((yyvsp[(1) - (1)].interm.type).type);
3790 if (context->precisionErrorCheck((yyvsp[(1) - (1)].interm.type).line, (yyval.interm.type).precision, (yyvsp[(1) - (1)].interm.type).type)) {
3791 context->recover();
3792 }
3793 }
3794 }
3795 break;
3796
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003797 case 117:
John Bauman66b8ab22014-05-06 15:57:45 -04003798
3799 {
3800 (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
3801 (yyval.interm.type).precision = (yyvsp[(1) - (2)].interm.precision);
3802 }
3803 break;
3804
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003805 case 118:
John Bauman66b8ab22014-05-06 15:57:45 -04003806
3807 {
3808 (yyval.interm.precision) = EbpHigh;
3809 }
3810 break;
3811
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003812 case 119:
John Bauman66b8ab22014-05-06 15:57:45 -04003813
3814 {
3815 (yyval.interm.precision) = EbpMedium;
3816 }
3817 break;
3818
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003819 case 120:
John Bauman66b8ab22014-05-06 15:57:45 -04003820
3821 {
3822 (yyval.interm.precision) = EbpLow;
3823 }
3824 break;
3825
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003826 case 121:
John Bauman66b8ab22014-05-06 15:57:45 -04003827
3828 {
3829 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3830 }
3831 break;
3832
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003833 case 122:
John Bauman66b8ab22014-05-06 15:57:45 -04003834
3835 {
3836 (yyval.interm.type) = (yyvsp[(1) - (4)].interm.type);
3837
3838 if (context->arrayTypeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
3839 context->recover();
3840 else {
3841 int size;
3842 if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
3843 context->recover();
3844 (yyval.interm.type).setArray(true, size);
3845 }
3846 }
3847 break;
3848
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003849 case 123:
John Bauman66b8ab22014-05-06 15:57:45 -04003850
3851 {
3852 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3853 (yyval.interm.type).setBasic(EbtVoid, qual, (yyvsp[(1) - (1)].lex).line);
3854 }
3855 break;
3856
John Bauman66b8ab22014-05-06 15:57:45 -04003857 case 124:
3858
3859 {
3860 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003861 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003862 }
3863 break;
3864
3865 case 125:
3866
3867 {
3868 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003869 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003870 }
3871 break;
3872
3873 case 126:
3874
3875 {
3876 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003877 (yyval.interm.type).setBasic(EbtUInt, qual, (yyvsp[(1) - (1)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003878 }
3879 break;
3880
3881 case 127:
3882
3883 {
3884 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003885 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003886 }
3887 break;
3888
3889 case 128:
3890
3891 {
3892 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003893 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003894 (yyval.interm.type).setAggregate(2);
John Bauman66b8ab22014-05-06 15:57:45 -04003895 }
3896 break;
3897
3898 case 129:
3899
3900 {
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003901 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
Nicolas Capens3c20f802015-02-17 17:17:20 -05003902 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003903 (yyval.interm.type).setAggregate(3);
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003904 }
3905 break;
3906
3907 case 130:
3908
3909 {
3910 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003911 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3912 (yyval.interm.type).setAggregate(4);
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003913 }
3914 break;
3915
3916 case 131:
3917
3918 {
3919 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3920 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003921 (yyval.interm.type).setAggregate(2);
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003922 }
3923 break;
3924
3925 case 132:
3926
3927 {
3928 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
Nicolas Capens3c20f802015-02-17 17:17:20 -05003929 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003930 (yyval.interm.type).setAggregate(3);
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003931 }
3932 break;
3933
3934 case 133:
3935
3936 {
3937 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003938 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3939 (yyval.interm.type).setAggregate(4);
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003940 }
3941 break;
3942
3943 case 134:
3944
3945 {
3946 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3947 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003948 (yyval.interm.type).setAggregate(2);
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003949 }
3950 break;
3951
3952 case 135:
3953
3954 {
Nicolas Capens3c20f802015-02-17 17:17:20 -05003955 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3956 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003957 (yyval.interm.type).setAggregate(3);
Nicolas Capens3c20f802015-02-17 17:17:20 -05003958 }
3959 break;
3960
3961 case 136:
3962
3963 {
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05003964 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003965 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3966 (yyval.interm.type).setAggregate(4);
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05003967 }
3968 break;
3969
3970 case 137:
3971
3972 {
3973 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3974 (yyval.interm.type).setBasic(EbtUInt, qual, (yyvsp[(1) - (1)].lex).line);
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003975 (yyval.interm.type).setAggregate(2);
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05003976 }
3977 break;
3978
3979 case 138:
3980
3981 {
3982 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3983 (yyval.interm.type).setBasic(EbtUInt, qual, (yyvsp[(1) - (1)].lex).line);
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003984 (yyval.interm.type).setAggregate(3);
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05003985 }
3986 break;
3987
3988 case 139:
3989
3990 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003991 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3992 (yyval.interm.type).setBasic(EbtUInt, qual, (yyvsp[(1) - (1)].lex).line);
3993 (yyval.interm.type).setAggregate(4);
3994 }
3995 break;
3996
3997 case 140:
3998
3999 {
John Bauman66b8ab22014-05-06 15:57:45 -04004000 FRAG_VERT_ONLY("mat2", (yyvsp[(1) - (1)].lex).line);
4001 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4002 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
4003 (yyval.interm.type).setAggregate(2, true);
4004 }
4005 break;
4006
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004007 case 141:
John Bauman66b8ab22014-05-06 15:57:45 -04004008
4009 {
4010 FRAG_VERT_ONLY("mat3", (yyvsp[(1) - (1)].lex).line);
4011 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4012 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
4013 (yyval.interm.type).setAggregate(3, true);
4014 }
4015 break;
4016
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004017 case 142:
John Bauman66b8ab22014-05-06 15:57:45 -04004018
4019 {
4020 FRAG_VERT_ONLY("mat4", (yyvsp[(1) - (1)].lex).line);
4021 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4022 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
4023 (yyval.interm.type).setAggregate(4, true);
4024 }
4025 break;
4026
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004027 case 143:
John Bauman66b8ab22014-05-06 15:57:45 -04004028
4029 {
4030 FRAG_VERT_ONLY("sampler2D", (yyvsp[(1) - (1)].lex).line);
4031 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4032 (yyval.interm.type).setBasic(EbtSampler2D, qual, (yyvsp[(1) - (1)].lex).line);
4033 }
4034 break;
4035
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004036 case 144:
John Bauman66b8ab22014-05-06 15:57:45 -04004037
4038 {
4039 FRAG_VERT_ONLY("samplerCube", (yyvsp[(1) - (1)].lex).line);
4040 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4041 (yyval.interm.type).setBasic(EbtSamplerCube, qual, (yyvsp[(1) - (1)].lex).line);
4042 }
4043 break;
4044
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004045 case 145:
John Bauman66b8ab22014-05-06 15:57:45 -04004046
4047 {
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04004048 if (!context->supportsExtension("GL_OES_EGL_image_external")) {
4049 context->error((yyvsp[(1) - (1)].lex).line, "unsupported type", "samplerExternalOES", "");
4050 context->recover();
4051 }
4052 FRAG_VERT_ONLY("samplerExternalOES", (yyvsp[(1) - (1)].lex).line);
4053 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4054 (yyval.interm.type).setBasic(EbtSamplerExternalOES, qual, (yyvsp[(1) - (1)].lex).line);
4055 }
4056 break;
4057
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004058 case 146:
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04004059
4060 {
Alexis Hetub027aa92015-01-19 15:56:12 -05004061 FRAG_VERT_ONLY("sampler3D", (yyvsp[(1) - (1)].lex).line);
4062 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4063 (yyval.interm.type).setBasic(EbtSampler3D, qual, (yyvsp[(1) - (1)].lex).line);
4064 }
4065 break;
4066
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004067 case 147:
Alexis Hetub027aa92015-01-19 15:56:12 -05004068
4069 {
John Bauman66b8ab22014-05-06 15:57:45 -04004070 FRAG_VERT_ONLY("struct", (yyvsp[(1) - (1)].interm.type).line);
4071 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
4072 (yyval.interm.type).qualifier = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4073 }
4074 break;
4075
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004076 case 148:
John Bauman66b8ab22014-05-06 15:57:45 -04004077
4078 {
4079 //
4080 // This is for user defined type names. The lexical phase looked up the
4081 // type.
4082 //
4083 TType& structure = static_cast<TVariable*>((yyvsp[(1) - (1)].lex).symbol)->getType();
4084 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4085 (yyval.interm.type).setBasic(EbtStruct, qual, (yyvsp[(1) - (1)].lex).line);
4086 (yyval.interm.type).userDef = &structure;
4087 }
4088 break;
4089
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004090 case 149:
John Bauman66b8ab22014-05-06 15:57:45 -04004091
4092 { if (context->enterStructDeclaration((yyvsp[(2) - (3)].lex).line, *(yyvsp[(2) - (3)].lex).string)) context->recover(); }
4093 break;
4094
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004095 case 150:
John Bauman66b8ab22014-05-06 15:57:45 -04004096
4097 {
4098 if (context->reservedErrorCheck((yyvsp[(2) - (6)].lex).line, *(yyvsp[(2) - (6)].lex).string))
4099 context->recover();
4100
4101 TType* structure = new TType((yyvsp[(5) - (6)].interm.typeList), *(yyvsp[(2) - (6)].lex).string);
4102 TVariable* userTypeDef = new TVariable((yyvsp[(2) - (6)].lex).string, *structure, true);
4103 if (! context->symbolTable.insert(*userTypeDef)) {
4104 context->error((yyvsp[(2) - (6)].lex).line, "redefinition", (yyvsp[(2) - (6)].lex).string->c_str(), "struct");
4105 context->recover();
4106 }
4107 (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (6)].lex).line);
4108 (yyval.interm.type).userDef = structure;
4109 context->exitStructDeclaration();
4110 }
4111 break;
4112
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004113 case 151:
John Bauman66b8ab22014-05-06 15:57:45 -04004114
4115 { if (context->enterStructDeclaration((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string)) context->recover(); }
4116 break;
4117
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004118 case 152:
John Bauman66b8ab22014-05-06 15:57:45 -04004119
4120 {
4121 TType* structure = new TType((yyvsp[(4) - (5)].interm.typeList), TString(""));
4122 (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (5)].lex).line);
4123 (yyval.interm.type).userDef = structure;
4124 context->exitStructDeclaration();
4125 }
4126 break;
4127
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004128 case 153:
John Bauman66b8ab22014-05-06 15:57:45 -04004129
4130 {
4131 (yyval.interm.typeList) = (yyvsp[(1) - (1)].interm.typeList);
4132 }
4133 break;
4134
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004135 case 154:
John Bauman66b8ab22014-05-06 15:57:45 -04004136
4137 {
4138 (yyval.interm.typeList) = (yyvsp[(1) - (2)].interm.typeList);
4139 for (unsigned int i = 0; i < (yyvsp[(2) - (2)].interm.typeList)->size(); ++i) {
4140 for (unsigned int j = 0; j < (yyval.interm.typeList)->size(); ++j) {
4141 if ((*(yyval.interm.typeList))[j].type->getFieldName() == (*(yyvsp[(2) - (2)].interm.typeList))[i].type->getFieldName()) {
4142 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());
4143 context->recover();
4144 }
4145 }
4146 (yyval.interm.typeList)->push_back((*(yyvsp[(2) - (2)].interm.typeList))[i]);
4147 }
4148 }
4149 break;
4150
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004151 case 155:
John Bauman66b8ab22014-05-06 15:57:45 -04004152
4153 {
4154 (yyval.interm.typeList) = (yyvsp[(2) - (3)].interm.typeList);
4155
4156 if (context->voidErrorCheck((yyvsp[(1) - (3)].interm.type).line, (*(yyvsp[(2) - (3)].interm.typeList))[0].type->getFieldName(), (yyvsp[(1) - (3)].interm.type))) {
4157 context->recover();
4158 }
4159 for (unsigned int i = 0; i < (yyval.interm.typeList)->size(); ++i) {
4160 //
4161 // Careful not to replace already known aspects of type, like array-ness
4162 //
4163 TType* type = (*(yyval.interm.typeList))[i].type;
4164 type->setBasicType((yyvsp[(1) - (3)].interm.type).type);
4165 type->setNominalSize((yyvsp[(1) - (3)].interm.type).size);
4166 type->setMatrix((yyvsp[(1) - (3)].interm.type).matrix);
4167 type->setPrecision((yyvsp[(1) - (3)].interm.type).precision);
4168
4169 // don't allow arrays of arrays
4170 if (type->isArray()) {
4171 if (context->arrayTypeErrorCheck((yyvsp[(1) - (3)].interm.type).line, (yyvsp[(1) - (3)].interm.type)))
4172 context->recover();
4173 }
4174 if ((yyvsp[(1) - (3)].interm.type).array)
4175 type->setArraySize((yyvsp[(1) - (3)].interm.type).arraySize);
4176 if ((yyvsp[(1) - (3)].interm.type).userDef) {
4177 type->setStruct((yyvsp[(1) - (3)].interm.type).userDef->getStruct());
4178 type->setTypeName((yyvsp[(1) - (3)].interm.type).userDef->getTypeName());
4179 }
John Bauman66b8ab22014-05-06 15:57:45 -04004180 }
4181 }
4182 break;
4183
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004184 case 156:
John Bauman66b8ab22014-05-06 15:57:45 -04004185
4186 {
4187 (yyval.interm.typeList) = NewPoolTTypeList();
4188 (yyval.interm.typeList)->push_back((yyvsp[(1) - (1)].interm.typeLine));
4189 }
4190 break;
4191
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004192 case 157:
John Bauman66b8ab22014-05-06 15:57:45 -04004193
4194 {
4195 (yyval.interm.typeList)->push_back((yyvsp[(3) - (3)].interm.typeLine));
4196 }
4197 break;
4198
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004199 case 158:
John Bauman66b8ab22014-05-06 15:57:45 -04004200
4201 {
4202 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
4203 context->recover();
4204
4205 (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
4206 (yyval.interm.typeLine).line = (yyvsp[(1) - (1)].lex).line;
4207 (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (1)].lex).string);
4208 }
4209 break;
4210
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004211 case 159:
John Bauman66b8ab22014-05-06 15:57:45 -04004212
4213 {
4214 if (context->reservedErrorCheck((yyvsp[(1) - (4)].lex).line, *(yyvsp[(1) - (4)].lex).string))
4215 context->recover();
4216
4217 (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
4218 (yyval.interm.typeLine).line = (yyvsp[(1) - (4)].lex).line;
4219 (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (4)].lex).string);
4220
4221 int size;
4222 if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
4223 context->recover();
4224 (yyval.interm.typeLine).type->setArraySize(size);
4225 }
4226 break;
4227
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004228 case 160:
John Bauman66b8ab22014-05-06 15:57:45 -04004229
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004230 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04004231 break;
4232
Alexis Hetub027aa92015-01-19 15:56:12 -05004233 case 161:
4234
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004235 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
John Bauman66b8ab22014-05-06 15:57:45 -04004236 break;
4237
John Bauman66b8ab22014-05-06 15:57:45 -04004238 case 162:
4239
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004240 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermAggregate); }
John Bauman66b8ab22014-05-06 15:57:45 -04004241 break;
4242
4243 case 163:
4244
Alexis Hetub027aa92015-01-19 15:56:12 -05004245 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
John Bauman66b8ab22014-05-06 15:57:45 -04004246 break;
4247
4248 case 164:
4249
Nicolas Capens3c20f802015-02-17 17:17:20 -05004250 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
John Bauman66b8ab22014-05-06 15:57:45 -04004251 break;
4252
4253 case 165:
4254
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004255 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
John Bauman66b8ab22014-05-06 15:57:45 -04004256 break;
4257
4258 case 166:
4259
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004260 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04004261 break;
4262
4263 case 167:
4264
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004265 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
Nicolas Capens3c20f802015-02-17 17:17:20 -05004266 break;
4267
4268 case 168:
4269
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004270 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004271 break;
4272
4273 case 169:
4274
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004275 { (yyval.interm.intermAggregate) = 0; }
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004276 break;
4277
4278 case 170:
4279
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004280 { context->symbolTable.push(); }
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004281 break;
4282
4283 case 171:
4284
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004285 { context->symbolTable.pop(); }
4286 break;
4287
4288 case 172:
4289
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05004290 {
4291 if ((yyvsp[(3) - (5)].interm.intermAggregate) != 0) {
4292 (yyvsp[(3) - (5)].interm.intermAggregate)->setOp(EOpSequence);
4293 (yyvsp[(3) - (5)].interm.intermAggregate)->setEndLine((yyvsp[(5) - (5)].lex).line);
4294 }
4295 (yyval.interm.intermAggregate) = (yyvsp[(3) - (5)].interm.intermAggregate);
4296 }
Alexis Hetub027aa92015-01-19 15:56:12 -05004297 break;
4298
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05004299 case 173:
4300
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004301 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05004302 break;
4303
4304 case 174:
4305
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004306 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
Nicolas Capens3c20f802015-02-17 17:17:20 -05004307 break;
4308
4309 case 175:
4310
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004311 { context->symbolTable.push(); }
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004312 break;
4313
4314 case 176:
4315
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004316 { context->symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[(2) - (2)].interm.intermNode); }
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004317 break;
4318
4319 case 177:
4320
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004321 { context->symbolTable.push(); }
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004322 break;
4323
4324 case 178:
4325
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004326 { context->symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[(2) - (2)].interm.intermNode); }
4327 break;
4328
4329 case 179:
4330
John Bauman66b8ab22014-05-06 15:57:45 -04004331 {
4332 (yyval.interm.intermNode) = 0;
4333 }
4334 break;
4335
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004336 case 180:
John Bauman66b8ab22014-05-06 15:57:45 -04004337
4338 {
4339 if ((yyvsp[(2) - (3)].interm.intermAggregate)) {
4340 (yyvsp[(2) - (3)].interm.intermAggregate)->setOp(EOpSequence);
4341 (yyvsp[(2) - (3)].interm.intermAggregate)->setEndLine((yyvsp[(3) - (3)].lex).line);
4342 }
4343 (yyval.interm.intermNode) = (yyvsp[(2) - (3)].interm.intermAggregate);
4344 }
4345 break;
4346
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004347 case 181:
John Bauman66b8ab22014-05-06 15:57:45 -04004348
4349 {
4350 (yyval.interm.intermAggregate) = context->intermediate.makeAggregate((yyvsp[(1) - (1)].interm.intermNode), 0);
4351 }
4352 break;
4353
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004354 case 182:
John Bauman66b8ab22014-05-06 15:57:45 -04004355
4356 {
4357 (yyval.interm.intermAggregate) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermAggregate), (yyvsp[(2) - (2)].interm.intermNode), 0);
4358 }
4359 break;
4360
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004361 case 183:
John Bauman66b8ab22014-05-06 15:57:45 -04004362
4363 { (yyval.interm.intermNode) = 0; }
4364 break;
4365
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004366 case 184:
John Bauman66b8ab22014-05-06 15:57:45 -04004367
4368 { (yyval.interm.intermNode) = static_cast<TIntermNode*>((yyvsp[(1) - (2)].interm.intermTypedNode)); }
4369 break;
4370
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004371 case 185:
John Bauman66b8ab22014-05-06 15:57:45 -04004372
4373 {
4374 if (context->boolErrorCheck((yyvsp[(1) - (5)].lex).line, (yyvsp[(3) - (5)].interm.intermTypedNode)))
4375 context->recover();
4376 (yyval.interm.intermNode) = context->intermediate.addSelection((yyvsp[(3) - (5)].interm.intermTypedNode), (yyvsp[(5) - (5)].interm.nodePair), (yyvsp[(1) - (5)].lex).line);
4377 }
4378 break;
4379
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004380 case 186:
John Bauman66b8ab22014-05-06 15:57:45 -04004381
4382 {
4383 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermNode);
4384 (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermNode);
4385 }
4386 break;
4387
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004388 case 187:
John Bauman66b8ab22014-05-06 15:57:45 -04004389
4390 {
4391 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (1)].interm.intermNode);
4392 (yyval.interm.nodePair).node2 = 0;
4393 }
4394 break;
4395
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004396 case 188:
John Bauman66b8ab22014-05-06 15:57:45 -04004397
4398 {
4399 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
4400 if (context->boolErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)->getLine(), (yyvsp[(1) - (1)].interm.intermTypedNode)))
4401 context->recover();
4402 }
4403 break;
4404
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004405 case 189:
John Bauman66b8ab22014-05-06 15:57:45 -04004406
4407 {
4408 TIntermNode* intermNode;
4409 if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
4410 context->recover();
4411 if (context->boolErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
4412 context->recover();
4413
4414 if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode))
4415 (yyval.interm.intermTypedNode) = (yyvsp[(4) - (4)].interm.intermTypedNode);
4416 else {
4417 context->recover();
4418 (yyval.interm.intermTypedNode) = 0;
4419 }
4420 }
4421 break;
4422
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004423 case 190:
John Bauman66b8ab22014-05-06 15:57:45 -04004424
4425 { context->symbolTable.push(); ++context->loopNestingLevel; }
4426 break;
4427
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004428 case 191:
John Bauman66b8ab22014-05-06 15:57:45 -04004429
4430 {
4431 context->symbolTable.pop();
4432 (yyval.interm.intermNode) = context->intermediate.addLoop(ELoopWhile, 0, (yyvsp[(4) - (6)].interm.intermTypedNode), 0, (yyvsp[(6) - (6)].interm.intermNode), (yyvsp[(1) - (6)].lex).line);
4433 --context->loopNestingLevel;
4434 }
4435 break;
4436
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004437 case 192:
John Bauman66b8ab22014-05-06 15:57:45 -04004438
4439 { ++context->loopNestingLevel; }
4440 break;
4441
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004442 case 193:
John Bauman66b8ab22014-05-06 15:57:45 -04004443
4444 {
4445 if (context->boolErrorCheck((yyvsp[(8) - (8)].lex).line, (yyvsp[(6) - (8)].interm.intermTypedNode)))
4446 context->recover();
4447
4448 (yyval.interm.intermNode) = context->intermediate.addLoop(ELoopDoWhile, 0, (yyvsp[(6) - (8)].interm.intermTypedNode), 0, (yyvsp[(3) - (8)].interm.intermNode), (yyvsp[(4) - (8)].lex).line);
4449 --context->loopNestingLevel;
4450 }
4451 break;
4452
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004453 case 194:
John Bauman66b8ab22014-05-06 15:57:45 -04004454
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004455 { context->symbolTable.push(); ++context->loopNestingLevel; }
John Bauman66b8ab22014-05-06 15:57:45 -04004456 break;
4457
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004458 case 195:
John Bauman66b8ab22014-05-06 15:57:45 -04004459
4460 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004461 context->symbolTable.pop();
4462 (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);
4463 --context->loopNestingLevel;
John Bauman66b8ab22014-05-06 15:57:45 -04004464 }
4465 break;
4466
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004467 case 196:
John Bauman66b8ab22014-05-06 15:57:45 -04004468
4469 {
Nicolas Capens3c20f802015-02-17 17:17:20 -05004470 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04004471 }
4472 break;
4473
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004474 case 197:
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04004475
4476 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004477 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
Alexis Hetub027aa92015-01-19 15:56:12 -05004478 }
4479 break;
4480
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004481 case 198:
Alexis Hetub027aa92015-01-19 15:56:12 -05004482
4483 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004484 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
Nicolas Capens3c20f802015-02-17 17:17:20 -05004485 }
4486 break;
4487
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004488 case 199:
Nicolas Capens3c20f802015-02-17 17:17:20 -05004489
4490 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004491 (yyval.interm.intermTypedNode) = 0;
4492 }
4493 break;
4494
4495 case 200:
4496
4497 {
John Bauman66b8ab22014-05-06 15:57:45 -04004498 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (2)].interm.intermTypedNode);
4499 (yyval.interm.nodePair).node2 = 0;
4500 }
4501 break;
4502
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004503 case 201:
John Bauman66b8ab22014-05-06 15:57:45 -04004504
4505 {
4506 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermTypedNode);
4507 (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermTypedNode);
4508 }
4509 break;
4510
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004511 case 202:
John Bauman66b8ab22014-05-06 15:57:45 -04004512
4513 {
4514 if (context->loopNestingLevel <= 0) {
4515 context->error((yyvsp[(1) - (2)].lex).line, "continue statement only allowed in loops", "");
4516 context->recover();
4517 }
4518 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpContinue, (yyvsp[(1) - (2)].lex).line);
4519 }
4520 break;
4521
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004522 case 203:
John Bauman66b8ab22014-05-06 15:57:45 -04004523
4524 {
4525 if (context->loopNestingLevel <= 0) {
4526 context->error((yyvsp[(1) - (2)].lex).line, "break statement only allowed in loops", "");
4527 context->recover();
4528 }
4529 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpBreak, (yyvsp[(1) - (2)].lex).line);
4530 }
4531 break;
4532
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004533 case 204:
John Bauman66b8ab22014-05-06 15:57:45 -04004534
4535 {
4536 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(1) - (2)].lex).line);
4537 if (context->currentFunctionType->getBasicType() != EbtVoid) {
4538 context->error((yyvsp[(1) - (2)].lex).line, "non-void function must return a value", "return");
4539 context->recover();
4540 }
4541 }
4542 break;
4543
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004544 case 205:
John Bauman66b8ab22014-05-06 15:57:45 -04004545
4546 {
4547 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(2) - (3)].interm.intermTypedNode), (yyvsp[(1) - (3)].lex).line);
4548 context->functionReturnsValue = true;
4549 if (context->currentFunctionType->getBasicType() == EbtVoid) {
4550 context->error((yyvsp[(1) - (3)].lex).line, "void function cannot return a value", "return");
4551 context->recover();
4552 } else if (*(context->currentFunctionType) != (yyvsp[(2) - (3)].interm.intermTypedNode)->getType()) {
4553 context->error((yyvsp[(1) - (3)].lex).line, "function return is not matching type:", "return");
4554 context->recover();
4555 }
4556 }
4557 break;
4558
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004559 case 206:
John Bauman66b8ab22014-05-06 15:57:45 -04004560
4561 {
4562 FRAG_ONLY("discard", (yyvsp[(1) - (2)].lex).line);
4563 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpKill, (yyvsp[(1) - (2)].lex).line);
4564 }
4565 break;
4566
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004567 case 207:
John Bauman66b8ab22014-05-06 15:57:45 -04004568
4569 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004570 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
Nicolas Capens3c20f802015-02-17 17:17:20 -05004571 context->treeRoot = (yyval.interm.intermNode);
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04004572 }
4573 break;
4574
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004575 case 208:
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04004576
4577 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004578 (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermNode), (yyvsp[(2) - (2)].interm.intermNode), 0);
4579 context->treeRoot = (yyval.interm.intermNode);
Alexis Hetub027aa92015-01-19 15:56:12 -05004580 }
4581 break;
4582
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004583 case 209:
Alexis Hetub027aa92015-01-19 15:56:12 -05004584
4585 {
Nicolas Capens3c20f802015-02-17 17:17:20 -05004586 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
4587 }
4588 break;
4589
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004590 case 210:
Nicolas Capens3c20f802015-02-17 17:17:20 -05004591
4592 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004593 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
4594 }
4595 break;
4596
4597 case 211:
4598
4599 {
John Bauman66b8ab22014-05-06 15:57:45 -04004600 TFunction* function = (yyvsp[(1) - (1)].interm).function;
4601
4602 const TSymbol *builtIn = context->symbolTable.findBuiltIn(function->getMangledName());
4603
4604 if (builtIn)
4605 {
4606 context->error((yyvsp[(1) - (1)].interm).line, "built-in functions cannot be redefined", function->getName().c_str());
4607 context->recover();
4608 }
4609
4610 TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find(function->getMangledName()));
4611 //
4612 // Note: 'prevDec' could be 'function' if this is the first time we've seen function
4613 // as it would have just been put in the symbol table. Otherwise, we're looking up
4614 // an earlier occurance.
4615 //
4616 if (prevDec->isDefined()) {
4617 //
4618 // Then this function already has a body.
4619 //
4620 context->error((yyvsp[(1) - (1)].interm).line, "function already has a body", function->getName().c_str());
4621 context->recover();
4622 }
4623 prevDec->setDefined();
4624
4625 //
4626 // Raise error message if main function takes any parameters or return anything other than void
4627 //
4628 if (function->getName() == "main") {
4629 if (function->getParamCount() > 0) {
4630 context->error((yyvsp[(1) - (1)].interm).line, "function cannot take any parameter(s)", function->getName().c_str());
4631 context->recover();
4632 }
4633 if (function->getReturnType().getBasicType() != EbtVoid) {
4634 context->error((yyvsp[(1) - (1)].interm).line, "", function->getReturnType().getBasicString(), "main function cannot return a value");
4635 context->recover();
4636 }
4637 }
4638
4639 //
4640 // Remember the return type for later checking for RETURN statements.
4641 //
4642 context->currentFunctionType = &(prevDec->getReturnType());
4643 context->functionReturnsValue = false;
4644
4645 //
4646 // Insert parameters into the symbol table.
4647 // If the parameter has no name, it's not an error, just don't insert it
4648 // (could be used for unused args).
4649 //
4650 // Also, accumulate the list of parameters into the HIL, so lower level code
4651 // knows where to find parameters.
4652 //
4653 TIntermAggregate* paramNodes = new TIntermAggregate;
4654 for (int i = 0; i < function->getParamCount(); i++) {
4655 const TParameter& param = function->getParam(i);
4656 if (param.name != 0) {
4657 TVariable *variable = new TVariable(param.name, *param.type);
4658 //
4659 // Insert the parameters with name in the symbol table.
4660 //
4661 if (! context->symbolTable.insert(*variable)) {
4662 context->error((yyvsp[(1) - (1)].interm).line, "redefinition", variable->getName().c_str());
4663 context->recover();
4664 delete variable;
4665 }
4666
4667 //
4668 // Add the parameter to the HIL
4669 //
4670 paramNodes = context->intermediate.growAggregate(
4671 paramNodes,
4672 context->intermediate.addSymbol(variable->getUniqueId(),
4673 variable->getName(),
4674 variable->getType(), (yyvsp[(1) - (1)].interm).line),
4675 (yyvsp[(1) - (1)].interm).line);
4676 } else {
4677 paramNodes = context->intermediate.growAggregate(paramNodes, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (1)].interm).line), (yyvsp[(1) - (1)].interm).line);
4678 }
4679 }
4680 context->intermediate.setAggregateOperator(paramNodes, EOpParameters, (yyvsp[(1) - (1)].interm).line);
4681 (yyvsp[(1) - (1)].interm).intermAggregate = paramNodes;
4682 context->loopNestingLevel = 0;
4683 }
4684 break;
4685
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004686 case 212:
John Bauman66b8ab22014-05-06 15:57:45 -04004687
4688 {
4689 //?? Check that all paths return a value if return type != void ?
4690 // May be best done as post process phase on intermediate code
4691 if (context->currentFunctionType->getBasicType() != EbtVoid && ! context->functionReturnsValue) {
4692 context->error((yyvsp[(1) - (3)].interm).line, "function does not return a value:", "", (yyvsp[(1) - (3)].interm).function->getName().c_str());
4693 context->recover();
4694 }
4695
4696 (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermAggregate, (yyvsp[(3) - (3)].interm.intermNode), 0);
4697 context->intermediate.setAggregateOperator((yyval.interm.intermNode), EOpFunction, (yyvsp[(1) - (3)].interm).line);
4698 (yyval.interm.intermNode)->getAsAggregate()->setName((yyvsp[(1) - (3)].interm).function->getMangledName().c_str());
4699 (yyval.interm.intermNode)->getAsAggregate()->setType((yyvsp[(1) - (3)].interm).function->getReturnType());
4700
4701 // store the pragma information for debug and optimize and other vendor specific
4702 // information. This information can be queried from the parse tree
4703 (yyval.interm.intermNode)->getAsAggregate()->setOptimize(context->pragma().optimize);
4704 (yyval.interm.intermNode)->getAsAggregate()->setDebug(context->pragma().debug);
4705
4706 if ((yyvsp[(3) - (3)].interm.intermNode) && (yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate())
4707 (yyval.interm.intermNode)->getAsAggregate()->setEndLine((yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate()->getEndLine());
4708
4709 context->symbolTable.pop();
4710 }
4711 break;
4712
4713
4714
4715 default: break;
4716 }
4717 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
4718
4719 YYPOPSTACK (yylen);
4720 yylen = 0;
4721 YY_STACK_PRINT (yyss, yyssp);
4722
4723 *++yyvsp = yyval;
4724
4725 /* Now `shift' the result of the reduction. Determine what state
4726 that goes to, based on the state we popped back to and the rule
4727 number reduced by. */
4728
4729 yyn = yyr1[yyn];
4730
4731 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
4732 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
4733 yystate = yytable[yystate];
4734 else
4735 yystate = yydefgoto[yyn - YYNTOKENS];
4736
4737 goto yynewstate;
4738
4739
4740/*------------------------------------.
4741| yyerrlab -- here on detecting error |
4742`------------------------------------*/
4743yyerrlab:
4744 /* If not already recovering from an error, report this error. */
4745 if (!yyerrstatus)
4746 {
4747 ++yynerrs;
4748#if ! YYERROR_VERBOSE
4749 yyerror (context, YY_("syntax error"));
4750#else
4751 {
4752 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
4753 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
4754 {
4755 YYSIZE_T yyalloc = 2 * yysize;
4756 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
4757 yyalloc = YYSTACK_ALLOC_MAXIMUM;
4758 if (yymsg != yymsgbuf)
4759 YYSTACK_FREE (yymsg);
4760 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
4761 if (yymsg)
4762 yymsg_alloc = yyalloc;
4763 else
4764 {
4765 yymsg = yymsgbuf;
4766 yymsg_alloc = sizeof yymsgbuf;
4767 }
4768 }
4769
4770 if (0 < yysize && yysize <= yymsg_alloc)
4771 {
4772 (void) yysyntax_error (yymsg, yystate, yychar);
4773 yyerror (context, yymsg);
4774 }
4775 else
4776 {
4777 yyerror (context, YY_("syntax error"));
4778 if (yysize != 0)
4779 goto yyexhaustedlab;
4780 }
4781 }
4782#endif
4783 }
4784
4785
4786
4787 if (yyerrstatus == 3)
4788 {
4789 /* If just tried and failed to reuse lookahead token after an
4790 error, discard it. */
4791
4792 if (yychar <= YYEOF)
4793 {
4794 /* Return failure if at end of input. */
4795 if (yychar == YYEOF)
4796 YYABORT;
4797 }
4798 else
4799 {
4800 yydestruct ("Error: discarding",
4801 yytoken, &yylval, context);
4802 yychar = YYEMPTY;
4803 }
4804 }
4805
4806 /* Else will try to reuse lookahead token after shifting the error
4807 token. */
4808 goto yyerrlab1;
4809
4810
4811/*---------------------------------------------------.
4812| yyerrorlab -- error raised explicitly by YYERROR. |
4813`---------------------------------------------------*/
4814yyerrorlab:
4815
4816 /* Pacify compilers like GCC when the user code never invokes
4817 YYERROR and the label yyerrorlab therefore never appears in user
4818 code. */
4819 if (/*CONSTCOND*/ 0)
4820 goto yyerrorlab;
4821
4822 /* Do not reclaim the symbols of the rule which action triggered
4823 this YYERROR. */
4824 YYPOPSTACK (yylen);
4825 yylen = 0;
4826 YY_STACK_PRINT (yyss, yyssp);
4827 yystate = *yyssp;
4828 goto yyerrlab1;
4829
4830
4831/*-------------------------------------------------------------.
4832| yyerrlab1 -- common code for both syntax error and YYERROR. |
4833`-------------------------------------------------------------*/
4834yyerrlab1:
4835 yyerrstatus = 3; /* Each real token shifted decrements this. */
4836
4837 for (;;)
4838 {
4839 yyn = yypact[yystate];
4840 if (yyn != YYPACT_NINF)
4841 {
4842 yyn += YYTERROR;
4843 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
4844 {
4845 yyn = yytable[yyn];
4846 if (0 < yyn)
4847 break;
4848 }
4849 }
4850
4851 /* Pop the current state because it cannot handle the error token. */
4852 if (yyssp == yyss)
4853 YYABORT;
4854
4855
4856 yydestruct ("Error: popping",
4857 yystos[yystate], yyvsp, context);
4858 YYPOPSTACK (1);
4859 yystate = *yyssp;
4860 YY_STACK_PRINT (yyss, yyssp);
4861 }
4862
4863 *++yyvsp = yylval;
4864
4865
4866 /* Shift the error token. */
4867 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
4868
4869 yystate = yyn;
4870 goto yynewstate;
4871
4872
4873/*-------------------------------------.
4874| yyacceptlab -- YYACCEPT comes here. |
4875`-------------------------------------*/
4876yyacceptlab:
4877 yyresult = 0;
4878 goto yyreturn;
4879
4880/*-----------------------------------.
4881| yyabortlab -- YYABORT comes here. |
4882`-----------------------------------*/
4883yyabortlab:
4884 yyresult = 1;
4885 goto yyreturn;
4886
4887#if !defined(yyoverflow) || YYERROR_VERBOSE
4888/*-------------------------------------------------.
4889| yyexhaustedlab -- memory exhaustion comes here. |
4890`-------------------------------------------------*/
4891yyexhaustedlab:
4892 yyerror (context, YY_("memory exhausted"));
4893 yyresult = 2;
4894 /* Fall through. */
4895#endif
4896
4897yyreturn:
4898 if (yychar != YYEMPTY)
4899 yydestruct ("Cleanup: discarding lookahead",
4900 yytoken, &yylval, context);
4901 /* Do not reclaim the symbols of the rule which action triggered
4902 this YYABORT or YYACCEPT. */
4903 YYPOPSTACK (yylen);
4904 YY_STACK_PRINT (yyss, yyssp);
4905 while (yyssp != yyss)
4906 {
4907 yydestruct ("Cleanup: popping",
4908 yystos[*yyssp], yyvsp, context);
4909 YYPOPSTACK (1);
4910 }
4911#ifndef yyoverflow
4912 if (yyss != yyssa)
4913 YYSTACK_FREE (yyss);
4914#endif
4915#if YYERROR_VERBOSE
4916 if (yymsg != yymsgbuf)
4917 YYSTACK_FREE (yymsg);
4918#endif
4919 /* Make sure YYID is used. */
4920 return YYID (yyresult);
4921}
4922
4923
4924
4925
4926
4927int glslang_parse(TParseContext* context) {
4928 return yyparse(context);
4929}
4930