blob: 6400be9725a5138386e3ef9824e649000678fa92 [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,
Nicolas Capens7d626792015-02-17 17:58:31 -0500181 LAYOUT = 313,
182 IDENTIFIER = 314,
183 TYPE_NAME = 315,
184 FLOATCONSTANT = 316,
185 INTCONSTANT = 317,
186 UINTCONSTANT = 318,
187 BOOLCONSTANT = 319,
188 FIELD_SELECTION = 320,
189 LEFT_OP = 321,
190 RIGHT_OP = 322,
191 INC_OP = 323,
192 DEC_OP = 324,
193 LE_OP = 325,
194 GE_OP = 326,
195 EQ_OP = 327,
196 NE_OP = 328,
197 AND_OP = 329,
198 OR_OP = 330,
199 XOR_OP = 331,
200 MUL_ASSIGN = 332,
201 DIV_ASSIGN = 333,
202 ADD_ASSIGN = 334,
203 MOD_ASSIGN = 335,
204 LEFT_ASSIGN = 336,
205 RIGHT_ASSIGN = 337,
206 AND_ASSIGN = 338,
207 XOR_ASSIGN = 339,
208 OR_ASSIGN = 340,
209 SUB_ASSIGN = 341,
210 LEFT_PAREN = 342,
211 RIGHT_PAREN = 343,
212 LEFT_BRACKET = 344,
213 RIGHT_BRACKET = 345,
214 LEFT_BRACE = 346,
215 RIGHT_BRACE = 347,
216 DOT = 348,
217 COMMA = 349,
218 COLON = 350,
219 EQUAL = 351,
220 SEMICOLON = 352,
221 BANG = 353,
222 DASH = 354,
223 TILDE = 355,
224 PLUS = 356,
225 STAR = 357,
226 SLASH = 358,
227 PERCENT = 359,
228 LEFT_ANGLE = 360,
229 RIGHT_ANGLE = 361,
230 VERTICAL_BAR = 362,
231 CARET = 363,
232 AMPERSAND = 364,
233 QUESTION = 365
John Bauman66b8ab22014-05-06 15:57:45 -0400234 };
235#endif
236
237
238
239#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
240typedef union YYSTYPE
241{
242
243
244 struct {
245 TSourceLoc line;
246 union {
247 TString *string;
248 float f;
249 int i;
Nicolas Capens2c1239f2015-02-17 17:30:04 -0500250 unsigned int u;
John Bauman66b8ab22014-05-06 15:57:45 -0400251 bool b;
252 };
253 TSymbol* symbol;
254 } lex;
255 struct {
256 TSourceLoc line;
257 TOperator op;
258 union {
259 TIntermNode* intermNode;
260 TIntermNodePair nodePair;
261 TIntermTyped* intermTypedNode;
262 TIntermAggregate* intermAggregate;
263 };
264 union {
265 TPublicType type;
266 TPrecision precision;
Nicolas Capens7d626792015-02-17 17:58:31 -0500267 TLayoutQualifier layoutQualifier;
John Bauman66b8ab22014-05-06 15:57:45 -0400268 TQualifier qualifier;
269 TFunction* function;
270 TParameter param;
271 TTypeLine typeLine;
272 TTypeList* typeList;
273 };
274 } interm;
275
276
277
278} YYSTYPE;
279# define YYSTYPE_IS_TRIVIAL 1
280# define yystype YYSTYPE /* obsolescent; will be withdrawn */
281# define YYSTYPE_IS_DECLARED 1
282#endif
283
284
285/* Copy the second part of user declarations. */
286
287
288extern int yylex(YYSTYPE* yylval_param, void* yyscanner);
289extern void yyerror(TParseContext* context, const char* reason);
290
291#define FRAG_VERT_ONLY(S, L) { \
Nicolas Capens08ca3c62015-02-13 16:06:45 -0500292 if (context->shaderType != GL_FRAGMENT_SHADER && \
293 context->shaderType != GL_VERTEX_SHADER) { \
John Bauman66b8ab22014-05-06 15:57:45 -0400294 context->error(L, " supported in vertex/fragment shaders only ", S); \
295 context->recover(); \
296 } \
297}
298
299#define VERTEX_ONLY(S, L) { \
Nicolas Capens08ca3c62015-02-13 16:06:45 -0500300 if (context->shaderType != GL_VERTEX_SHADER) { \
John Bauman66b8ab22014-05-06 15:57:45 -0400301 context->error(L, " supported in vertex shaders only ", S); \
302 context->recover(); \
303 } \
304}
305
306#define FRAG_ONLY(S, L) { \
Nicolas Capens08ca3c62015-02-13 16:06:45 -0500307 if (context->shaderType != GL_FRAGMENT_SHADER) { \
John Bauman66b8ab22014-05-06 15:57:45 -0400308 context->error(L, " supported in fragment shaders only ", S); \
309 context->recover(); \
310 } \
311}
312
Nicolas Capensc6841852015-02-15 14:25:37 -0500313#define ES2_ONLY(S, L) { \
314 if (context->shaderVersion != 100) { \
315 context->error(L, " supported in GLSL ES 1.00 only ", S); \
316 context->recover(); \
317 } \
318}
319
320#define ES3_ONLY(S, L) { \
321 if (context->shaderVersion != 300) { \
322 context->error(L, " supported in GLSL ES 3.00 only ", S); \
323 context->recover(); \
324 } \
325}
326
John Bauman66b8ab22014-05-06 15:57:45 -0400327
328
329#ifdef short
330# undef short
331#endif
332
333#ifdef YYTYPE_UINT8
334typedef YYTYPE_UINT8 yytype_uint8;
335#else
336typedef unsigned char yytype_uint8;
337#endif
338
339#ifdef YYTYPE_INT8
340typedef YYTYPE_INT8 yytype_int8;
341#elif (defined __STDC__ || defined __C99__FUNC__ \
342 || defined __cplusplus || defined _MSC_VER)
343typedef signed char yytype_int8;
344#else
345typedef short int yytype_int8;
346#endif
347
348#ifdef YYTYPE_UINT16
349typedef YYTYPE_UINT16 yytype_uint16;
350#else
351typedef unsigned short int yytype_uint16;
352#endif
353
354#ifdef YYTYPE_INT16
355typedef YYTYPE_INT16 yytype_int16;
356#else
357typedef short int yytype_int16;
358#endif
359
360#ifndef YYSIZE_T
361# ifdef __SIZE_TYPE__
362# define YYSIZE_T __SIZE_TYPE__
363# elif defined size_t
364# define YYSIZE_T size_t
365# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
366 || defined __cplusplus || defined _MSC_VER)
367# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
368# define YYSIZE_T size_t
369# else
370# define YYSIZE_T unsigned int
371# endif
372#endif
373
374#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
375
376#ifndef YY_
Nicolas Capense9c5e4f2014-05-28 22:46:43 -0400377# if YYENABLE_NLS
John Bauman66b8ab22014-05-06 15:57:45 -0400378# if ENABLE_NLS
379# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
380# define YY_(msgid) dgettext ("bison-runtime", msgid)
381# endif
382# endif
383# ifndef YY_
384# define YY_(msgid) msgid
385# endif
386#endif
387
388/* Suppress unused-variable warnings by "using" E. */
389#if ! defined lint || defined __GNUC__
390# define YYUSE(e) ((void) (e))
391#else
392# define YYUSE(e) /* empty */
393#endif
394
395/* Identity function, used to suppress warnings about constant conditions. */
396#ifndef lint
397# define YYID(n) (n)
398#else
399#if (defined __STDC__ || defined __C99__FUNC__ \
400 || defined __cplusplus || defined _MSC_VER)
401static int
402YYID (int yyi)
403#else
404static int
405YYID (yyi)
406 int yyi;
407#endif
408{
409 return yyi;
410}
411#endif
412
413#if ! defined yyoverflow || YYERROR_VERBOSE
414
415/* The parser invokes alloca or malloc; define the necessary symbols. */
416
417# ifdef YYSTACK_USE_ALLOCA
418# if YYSTACK_USE_ALLOCA
419# ifdef __GNUC__
420# define YYSTACK_ALLOC __builtin_alloca
421# elif defined __BUILTIN_VA_ARG_INCR
422# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
423# elif defined _AIX
424# define YYSTACK_ALLOC __alloca
425# elif defined _MSC_VER
426# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
427# define alloca _alloca
428# else
429# define YYSTACK_ALLOC alloca
430# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
431 || defined __cplusplus || defined _MSC_VER)
432# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
433# ifndef _STDLIB_H
434# define _STDLIB_H 1
435# endif
436# endif
437# endif
438# endif
439# endif
440
441# ifdef YYSTACK_ALLOC
442 /* Pacify GCC's `empty if-body' warning. */
443# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
444# ifndef YYSTACK_ALLOC_MAXIMUM
445 /* The OS might guarantee only one guard page at the bottom of the stack,
446 and a page size can be as small as 4096 bytes. So we cannot safely
447 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
448 to allow for a few compiler-allocated temporary stack slots. */
449# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
450# endif
451# else
452# define YYSTACK_ALLOC YYMALLOC
453# define YYSTACK_FREE YYFREE
454# ifndef YYSTACK_ALLOC_MAXIMUM
455# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
456# endif
457# if (defined __cplusplus && ! defined _STDLIB_H \
458 && ! ((defined YYMALLOC || defined malloc) \
459 && (defined YYFREE || defined free)))
460# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
461# ifndef _STDLIB_H
462# define _STDLIB_H 1
463# endif
464# endif
465# ifndef YYMALLOC
466# define YYMALLOC malloc
467# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
468 || defined __cplusplus || defined _MSC_VER)
469void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
470# endif
471# endif
472# ifndef YYFREE
473# define YYFREE free
474# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
475 || defined __cplusplus || defined _MSC_VER)
476void free (void *); /* INFRINGES ON USER NAME SPACE */
477# endif
478# endif
479# endif
480#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
481
482
483#if (! defined yyoverflow \
484 && (! defined __cplusplus \
485 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
486
487/* A type that is properly aligned for any stack member. */
488union yyalloc
489{
490 yytype_int16 yyss_alloc;
491 YYSTYPE yyvs_alloc;
492};
493
494/* The size of the maximum gap between one aligned stack and the next. */
495# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
496
497/* The size of an array large to enough to hold all stacks, each with
498 N elements. */
499# define YYSTACK_BYTES(N) \
500 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
501 + YYSTACK_GAP_MAXIMUM)
502
503/* Copy COUNT objects from FROM to TO. The source and destination do
504 not overlap. */
505# ifndef YYCOPY
506# if defined __GNUC__ && 1 < __GNUC__
507# define YYCOPY(To, From, Count) \
508 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
509# else
510# define YYCOPY(To, From, Count) \
511 do \
512 { \
513 YYSIZE_T yyi; \
514 for (yyi = 0; yyi < (Count); yyi++) \
515 (To)[yyi] = (From)[yyi]; \
516 } \
517 while (YYID (0))
518# endif
519# endif
520
521/* Relocate STACK from its old location to the new one. The
522 local variables YYSIZE and YYSTACKSIZE give the old and new number of
523 elements in the stack, and YYPTR gives the new location of the
524 stack. Advance YYPTR to a properly aligned location for the next
525 stack. */
526# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
527 do \
528 { \
529 YYSIZE_T yynewbytes; \
530 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
531 Stack = &yyptr->Stack_alloc; \
532 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
533 yyptr += yynewbytes / sizeof (*yyptr); \
534 } \
535 while (YYID (0))
536
537#endif
538
539/* YYFINAL -- State number of the termination state. */
Nicolas Capens7d626792015-02-17 17:58:31 -0500540#define YYFINAL 85
John Bauman66b8ab22014-05-06 15:57:45 -0400541/* YYLAST -- Last index in YYTABLE. */
Nicolas Capens7d626792015-02-17 17:58:31 -0500542#define YYLAST 1675
John Bauman66b8ab22014-05-06 15:57:45 -0400543
544/* YYNTOKENS -- Number of terminals. */
Nicolas Capens7d626792015-02-17 17:58:31 -0500545#define YYNTOKENS 111
John Bauman66b8ab22014-05-06 15:57:45 -0400546/* YYNNTS -- Number of nonterminals. */
Nicolas Capens7d626792015-02-17 17:58:31 -0500547#define YYNNTS 88
John Bauman66b8ab22014-05-06 15:57:45 -0400548/* YYNRULES -- Number of rules. */
Nicolas Capens7d626792015-02-17 17:58:31 -0500549#define YYNRULES 220
John Bauman66b8ab22014-05-06 15:57:45 -0400550/* YYNRULES -- Number of states. */
Nicolas Capens7d626792015-02-17 17:58:31 -0500551#define YYNSTATES 329
John Bauman66b8ab22014-05-06 15:57:45 -0400552
553/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
554#define YYUNDEFTOK 2
Nicolas Capens7d626792015-02-17 17:58:31 -0500555#define YYMAXUTOK 365
John Bauman66b8ab22014-05-06 15:57:45 -0400556
557#define YYTRANSLATE(YYX) \
558 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
559
560/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
561static const yytype_uint8 yytranslate[] =
562{
563 0, 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, 2, 2, 2, 2,
587 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
588 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
589 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
590 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
591 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
592 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
593 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
594 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
595 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
596 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
Alexis Hetub027aa92015-01-19 15:56:12 -0500597 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
Nicolas Capens3c20f802015-02-17 17:17:20 -0500598 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
Nicolas Capens7d626792015-02-17 17:58:31 -0500599 105, 106, 107, 108, 109, 110
John Bauman66b8ab22014-05-06 15:57:45 -0400600};
601
602#if YYDEBUG
603/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
604 YYRHS. */
605static const yytype_uint16 yyprhs[] =
606{
Nicolas Capens2c1239f2015-02-17 17:30:04 -0500607 0, 0, 3, 5, 7, 9, 11, 13, 15, 19,
608 21, 26, 28, 32, 35, 38, 40, 42, 44, 48,
609 51, 54, 57, 59, 62, 66, 69, 71, 73, 75,
610 77, 80, 83, 86, 88, 90, 92, 94, 98, 102,
611 104, 108, 112, 114, 116, 120, 124, 128, 132, 134,
612 138, 142, 144, 146, 148, 150, 154, 156, 160, 162,
613 166, 168, 174, 176, 180, 182, 184, 186, 188, 190,
614 192, 196, 198, 201, 204, 209, 212, 214, 216, 219,
615 223, 227, 230, 236, 240, 243, 247, 250, 251, 253,
616 255, 257, 259, 261, 265, 271, 278, 284, 286, 289,
617 294, 300, 305, 308, 310, 313, 315, 317, 319, 322,
Nicolas Capens7d626792015-02-17 17:58:31 -0500618 324, 326, 329, 331, 333, 335, 338, 341, 343, 345,
619 348, 350, 352, 354, 359, 361, 365, 367, 371, 375,
620 377, 382, 384, 386, 388, 390, 392, 394, 396, 398,
621 400, 402, 404, 406, 408, 410, 412, 414, 416, 418,
622 420, 422, 424, 426, 428, 430, 432, 434, 435, 442,
623 443, 449, 451, 454, 458, 460, 464, 466, 471, 473,
624 475, 477, 479, 481, 483, 485, 487, 489, 492, 493,
625 494, 500, 502, 504, 505, 508, 509, 512, 515, 519,
626 521, 524, 526, 529, 535, 539, 541, 543, 548, 549,
627 556, 557, 566, 567, 575, 577, 579, 581, 582, 585,
628 589, 592, 595, 598, 602, 605, 607, 610, 612, 614,
629 615
John Bauman66b8ab22014-05-06 15:57:45 -0400630};
631
632/* YYRHS -- A `-1'-separated list of the rules' RHS. */
633static const yytype_int16 yyrhs[] =
634{
Nicolas Capens7d626792015-02-17 17:58:31 -0500635 195, 0, -1, 59, -1, 112, -1, 62, -1, 63,
636 -1, 61, -1, 64, -1, 87, 139, 88, -1, 113,
637 -1, 114, 89, 115, 90, -1, 116, -1, 114, 93,
638 65, -1, 114, 68, -1, 114, 69, -1, 139, -1,
639 117, -1, 118, -1, 114, 93, 118, -1, 120, 88,
640 -1, 119, 88, -1, 121, 49, -1, 121, -1, 121,
641 137, -1, 120, 94, 137, -1, 122, 87, -1, 162,
642 -1, 59, -1, 65, -1, 114, -1, 68, 123, -1,
643 69, 123, -1, 124, 123, -1, 101, -1, 99, -1,
644 98, -1, 123, -1, 125, 102, 123, -1, 125, 103,
645 123, -1, 125, -1, 126, 101, 125, -1, 126, 99,
646 125, -1, 126, -1, 127, -1, 128, 105, 127, -1,
647 128, 106, 127, -1, 128, 70, 127, -1, 128, 71,
648 127, -1, 128, -1, 129, 72, 128, -1, 129, 73,
649 128, -1, 129, -1, 130, -1, 131, -1, 132, -1,
650 133, 74, 132, -1, 133, -1, 134, 76, 133, -1,
651 134, -1, 135, 75, 134, -1, 135, -1, 135, 110,
652 139, 95, 137, -1, 136, -1, 123, 138, 137, -1,
653 96, -1, 77, -1, 78, -1, 79, -1, 86, -1,
654 137, -1, 139, 94, 137, -1, 136, -1, 142, 97,
655 -1, 150, 97, -1, 7, 157, 161, 97, -1, 143,
656 88, -1, 145, -1, 144, -1, 145, 147, -1, 144,
657 94, 147, -1, 152, 59, 87, -1, 156, 59, -1,
658 156, 59, 89, 140, 90, -1, 153, 148, 146, -1,
659 148, 146, -1, 153, 148, 149, -1, 148, 149, -1,
660 -1, 40, -1, 41, -1, 42, -1, 156, -1, 151,
661 -1, 150, 94, 59, -1, 150, 94, 59, 89, 90,
662 -1, 150, 94, 59, 89, 140, 90, -1, 150, 94,
663 59, 96, 170, -1, 152, -1, 152, 59, -1, 152,
664 59, 89, 90, -1, 152, 59, 89, 140, 90, -1,
665 152, 59, 96, 170, -1, 3, 59, -1, 156, -1,
666 154, 156, -1, 9, -1, 8, -1, 44, -1, 3,
667 44, -1, 155, -1, 158, -1, 158, 155, -1, 9,
668 -1, 40, -1, 41, -1, 45, 40, -1, 45, 41,
669 -1, 43, -1, 161, -1, 157, 161, -1, 4, -1,
670 5, -1, 6, -1, 58, 87, 159, 88, -1, 160,
671 -1, 159, 94, 160, -1, 59, -1, 59, 96, 62,
672 -1, 59, 96, 63, -1, 162, -1, 162, 89, 140,
673 90, -1, 49, -1, 11, -1, 12, -1, 13, -1,
674 10, -1, 31, -1, 32, -1, 33, -1, 25, -1,
675 26, -1, 27, -1, 28, -1, 29, -1, 30, -1,
676 34, -1, 35, -1, 36, -1, 37, -1, 38, -1,
677 39, -1, 51, -1, 52, -1, 53, -1, 55, -1,
678 163, -1, 60, -1, -1, 48, 59, 91, 164, 166,
679 92, -1, -1, 48, 91, 165, 166, 92, -1, 167,
680 -1, 166, 167, -1, 156, 168, 97, -1, 169, -1,
681 168, 94, 169, -1, 59, -1, 59, 89, 140, 90,
682 -1, 137, -1, 141, -1, 174, -1, 173, -1, 171,
683 -1, 183, -1, 184, -1, 187, -1, 194, -1, 91,
684 92, -1, -1, -1, 91, 175, 182, 176, 92, -1,
685 181, -1, 173, -1, -1, 179, 181, -1, -1, 180,
686 173, -1, 91, 92, -1, 91, 182, 92, -1, 172,
687 -1, 182, 172, -1, 97, -1, 139, 97, -1, 19,
688 87, 139, 88, 185, -1, 178, 17, 178, -1, 178,
689 -1, 139, -1, 152, 59, 96, 170, -1, -1, 50,
690 87, 188, 186, 88, 177, -1, -1, 16, 189, 178,
691 50, 87, 139, 88, 97, -1, -1, 18, 87, 190,
692 191, 193, 88, 177, -1, 183, -1, 171, -1, 186,
693 -1, -1, 192, 97, -1, 192, 97, 139, -1, 15,
694 97, -1, 14, 97, -1, 21, 97, -1, 21, 139,
695 97, -1, 20, 97, -1, 196, -1, 195, 196, -1,
696 197, -1, 141, -1, -1, 142, 198, 181, -1
John Bauman66b8ab22014-05-06 15:57:45 -0400697};
698
699/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
700static const yytype_uint16 yyrline[] =
701{
Nicolas Capens7d626792015-02-17 17:58:31 -0500702 0, 187, 187, 222, 225, 230, 235, 240, 245, 251,
703 254, 333, 336, 437, 447, 460, 468, 568, 571, 579,
704 583, 590, 594, 601, 607, 616, 624, 679, 686, 696,
705 699, 709, 719, 740, 741, 742, 747, 748, 757, 769,
706 770, 778, 789, 793, 794, 804, 814, 824, 837, 838,
707 848, 861, 865, 869, 873, 874, 887, 888, 901, 902,
708 915, 916, 933, 934, 947, 948, 949, 950, 951, 955,
709 958, 969, 977, 1004, 1009, 1019, 1057, 1060, 1067, 1075,
710 1096, 1117, 1128, 1157, 1162, 1172, 1177, 1187, 1190, 1193,
711 1196, 1202, 1209, 1212, 1234, 1252, 1276, 1299, 1303, 1321,
712 1329, 1361, 1381, 1469, 1478, 1501, 1507, 1514, 1523, 1532,
713 1535, 1539, 1546, 1550, 1555, 1560, 1566, 1572, 1581, 1591,
714 1598, 1601, 1604, 1610, 1617, 1620, 1626, 1629, 1632, 1638,
715 1641, 1656, 1660, 1664, 1668, 1672, 1676, 1681, 1686, 1691,
716 1696, 1701, 1706, 1711, 1716, 1721, 1726, 1731, 1736, 1742,
717 1748, 1754, 1759, 1764, 1773, 1778, 1783, 1796, 1796, 1810,
718 1810, 1819, 1822, 1837, 1869, 1873, 1879, 1887, 1903, 1907,
719 1911, 1912, 1918, 1919, 1920, 1921, 1922, 1926, 1927, 1927,
720 1927, 1937, 1938, 1942, 1942, 1943, 1943, 1948, 1951, 1961,
721 1964, 1970, 1971, 1975, 1983, 1987, 1997, 2002, 2019, 2019,
722 2024, 2024, 2031, 2031, 2039, 2042, 2048, 2051, 2057, 2061,
723 2068, 2075, 2082, 2089, 2100, 2109, 2113, 2120, 2123, 2129,
724 2129
John Bauman66b8ab22014-05-06 15:57:45 -0400725};
726#endif
727
728#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
729/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
730 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
731static const char *const yytname[] =
732{
733 "$end", "error", "$undefined", "INVARIANT", "HIGH_PRECISION",
734 "MEDIUM_PRECISION", "LOW_PRECISION", "PRECISION", "ATTRIBUTE",
Nicolas Capens3c20f802015-02-17 17:17:20 -0500735 "CONST_QUAL", "BOOL_TYPE", "FLOAT_TYPE", "INT_TYPE", "UINT_TYPE",
736 "BREAK", "CONTINUE", "DO", "ELSE", "FOR", "IF", "DISCARD", "RETURN",
737 "SWITCH", "CASE", "DEFAULT", "BVEC2", "BVEC3", "BVEC4", "IVEC2", "IVEC3",
Nicolas Capense4b1b1d2015-02-17 17:26:01 -0500738 "IVEC4", "VEC2", "VEC3", "VEC4", "UVEC2", "UVEC3", "UVEC4", "MATRIX2",
739 "MATRIX3", "MATRIX4", "IN_QUAL", "OUT_QUAL", "INOUT_QUAL", "UNIFORM",
740 "VARYING", "CENTROID", "FLAT", "SMOOTH", "STRUCT", "VOID_TYPE", "WHILE",
741 "SAMPLER2D", "SAMPLERCUBE", "SAMPLER_EXTERNAL_OES", "SAMPLER2DRECT",
Nicolas Capens7d626792015-02-17 17:58:31 -0500742 "SAMPLER3D", "SAMPLER3DRECT", "SAMPLER2DSHADOW", "LAYOUT", "IDENTIFIER",
Nicolas Capens2c1239f2015-02-17 17:30:04 -0500743 "TYPE_NAME", "FLOATCONSTANT", "INTCONSTANT", "UINTCONSTANT",
744 "BOOLCONSTANT", "FIELD_SELECTION", "LEFT_OP", "RIGHT_OP", "INC_OP",
745 "DEC_OP", "LE_OP", "GE_OP", "EQ_OP", "NE_OP", "AND_OP", "OR_OP",
746 "XOR_OP", "MUL_ASSIGN", "DIV_ASSIGN", "ADD_ASSIGN", "MOD_ASSIGN",
747 "LEFT_ASSIGN", "RIGHT_ASSIGN", "AND_ASSIGN", "XOR_ASSIGN", "OR_ASSIGN",
748 "SUB_ASSIGN", "LEFT_PAREN", "RIGHT_PAREN", "LEFT_BRACKET",
749 "RIGHT_BRACKET", "LEFT_BRACE", "RIGHT_BRACE", "DOT", "COMMA", "COLON",
750 "EQUAL", "SEMICOLON", "BANG", "DASH", "TILDE", "PLUS", "STAR", "SLASH",
751 "PERCENT", "LEFT_ANGLE", "RIGHT_ANGLE", "VERTICAL_BAR", "CARET",
752 "AMPERSAND", "QUESTION", "$accept", "variable_identifier",
753 "primary_expression", "postfix_expression", "integer_expression",
754 "function_call", "function_call_or_method", "function_call_generic",
John Bauman66b8ab22014-05-06 15:57:45 -0400755 "function_call_header_no_parameters",
756 "function_call_header_with_parameters", "function_call_header",
757 "function_identifier", "unary_expression", "unary_operator",
758 "multiplicative_expression", "additive_expression", "shift_expression",
759 "relational_expression", "equality_expression", "and_expression",
760 "exclusive_or_expression", "inclusive_or_expression",
761 "logical_and_expression", "logical_xor_expression",
762 "logical_or_expression", "conditional_expression",
763 "assignment_expression", "assignment_operator", "expression",
764 "constant_expression", "declaration", "function_prototype",
765 "function_declarator", "function_header_with_parameters",
766 "function_header", "parameter_declarator", "parameter_declaration",
767 "parameter_qualifier", "parameter_type_specifier",
768 "init_declarator_list", "single_declaration", "fully_specified_type",
Nicolas Capensa6a79ab2015-02-17 12:42:14 -0500769 "parameter_type_qualifier", "type_qualifier", "storage_qualifier",
Nicolas Capens7d626792015-02-17 17:58:31 -0500770 "type_specifier", "precision_qualifier", "layout_qualifier",
771 "layout_qualifier_id_list", "layout_qualifier_id",
772 "type_specifier_no_prec", "type_specifier_nonarray", "struct_specifier",
773 "$@1", "$@2", "struct_declaration_list", "struct_declaration",
John Bauman66b8ab22014-05-06 15:57:45 -0400774 "struct_declarator_list", "struct_declarator", "initializer",
775 "declaration_statement", "statement", "simple_statement",
776 "compound_statement", "$@3", "$@4", "statement_no_new_scope",
777 "statement_with_scope", "$@5", "$@6", "compound_statement_no_new_scope",
778 "statement_list", "expression_statement", "selection_statement",
779 "selection_rest_statement", "condition", "iteration_statement", "$@7",
780 "$@8", "$@9", "for_init_statement", "conditionopt", "for_rest_statement",
781 "jump_statement", "translation_unit", "external_declaration",
782 "function_definition", "$@10", 0
783};
784#endif
785
786# ifdef YYPRINT
787/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
788 token YYLEX-NUM. */
789static const yytype_uint16 yytoknum[] =
790{
791 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
792 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
793 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
794 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
795 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
796 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
797 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
798 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
799 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
Nicolas Capensc6841852015-02-15 14:25:37 -0500800 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
Nicolas Capens7d626792015-02-17 17:58:31 -0500801 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
802 365
John Bauman66b8ab22014-05-06 15:57:45 -0400803};
804# endif
805
806/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
807static const yytype_uint8 yyr1[] =
808{
Nicolas Capens7d626792015-02-17 17:58:31 -0500809 0, 111, 112, 113, 113, 113, 113, 113, 113, 114,
810 114, 114, 114, 114, 114, 115, 116, 117, 117, 118,
811 118, 119, 119, 120, 120, 121, 122, 122, 122, 123,
812 123, 123, 123, 124, 124, 124, 125, 125, 125, 126,
813 126, 126, 127, 128, 128, 128, 128, 128, 129, 129,
814 129, 130, 131, 132, 133, 133, 134, 134, 135, 135,
815 136, 136, 137, 137, 138, 138, 138, 138, 138, 139,
816 139, 140, 141, 141, 141, 142, 143, 143, 144, 144,
817 145, 146, 146, 147, 147, 147, 147, 148, 148, 148,
818 148, 149, 150, 150, 150, 150, 150, 151, 151, 151,
819 151, 151, 151, 152, 152, 153, 154, 154, 154, 154,
820 154, 154, 155, 155, 155, 155, 155, 155, 156, 156,
821 157, 157, 157, 158, 159, 159, 160, 160, 160, 161,
822 161, 162, 162, 162, 162, 162, 162, 162, 162, 162,
823 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
824 162, 162, 162, 162, 162, 162, 162, 164, 163, 165,
825 163, 166, 166, 167, 168, 168, 169, 169, 170, 171,
826 172, 172, 173, 173, 173, 173, 173, 174, 175, 176,
827 174, 177, 177, 179, 178, 180, 178, 181, 181, 182,
828 182, 183, 183, 184, 185, 185, 186, 186, 188, 187,
829 189, 187, 190, 187, 191, 191, 192, 192, 193, 193,
830 194, 194, 194, 194, 194, 195, 195, 196, 196, 198,
831 197
John Bauman66b8ab22014-05-06 15:57:45 -0400832};
833
834/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
835static const yytype_uint8 yyr2[] =
836{
Nicolas Capens2c1239f2015-02-17 17:30:04 -0500837 0, 2, 1, 1, 1, 1, 1, 1, 3, 1,
838 4, 1, 3, 2, 2, 1, 1, 1, 3, 2,
839 2, 2, 1, 2, 3, 2, 1, 1, 1, 1,
840 2, 2, 2, 1, 1, 1, 1, 3, 3, 1,
841 3, 3, 1, 1, 3, 3, 3, 3, 1, 3,
842 3, 1, 1, 1, 1, 3, 1, 3, 1, 3,
843 1, 5, 1, 3, 1, 1, 1, 1, 1, 1,
844 3, 1, 2, 2, 4, 2, 1, 1, 2, 3,
845 3, 2, 5, 3, 2, 3, 2, 0, 1, 1,
846 1, 1, 1, 3, 5, 6, 5, 1, 2, 4,
847 5, 4, 2, 1, 2, 1, 1, 1, 2, 1,
Nicolas Capens7d626792015-02-17 17:58:31 -0500848 1, 2, 1, 1, 1, 2, 2, 1, 1, 2,
849 1, 1, 1, 4, 1, 3, 1, 3, 3, 1,
850 4, 1, 1, 1, 1, 1, 1, 1, 1, 1,
John Bauman66b8ab22014-05-06 15:57:45 -0400851 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
Nicolas Capens7d626792015-02-17 17:58:31 -0500852 1, 1, 1, 1, 1, 1, 1, 0, 6, 0,
853 5, 1, 2, 3, 1, 3, 1, 4, 1, 1,
854 1, 1, 1, 1, 1, 1, 1, 2, 0, 0,
855 5, 1, 1, 0, 2, 0, 2, 2, 3, 1,
856 2, 1, 2, 5, 3, 1, 1, 4, 0, 6,
857 0, 8, 0, 7, 1, 1, 1, 0, 2, 3,
858 2, 2, 2, 3, 2, 1, 2, 1, 1, 0,
859 3
John Bauman66b8ab22014-05-06 15:57:45 -0400860};
861
862/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
863 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
864 means the default is an error. */
865static const yytype_uint8 yydefact[] =
866{
Nicolas Capens7d626792015-02-17 17:58:31 -0500867 0, 0, 120, 121, 122, 0, 106, 112, 135, 132,
868 133, 134, 139, 140, 141, 142, 143, 144, 136, 137,
869 138, 145, 146, 147, 148, 149, 150, 113, 114, 117,
870 107, 0, 0, 131, 151, 152, 153, 154, 0, 156,
871 218, 219, 0, 77, 87, 0, 92, 97, 0, 109,
872 103, 0, 110, 118, 129, 155, 0, 215, 217, 108,
873 102, 0, 115, 116, 0, 159, 0, 72, 0, 75,
874 87, 105, 88, 89, 90, 78, 0, 87, 0, 73,
875 98, 104, 119, 111, 0, 1, 216, 0, 157, 0,
876 126, 0, 124, 0, 220, 79, 84, 86, 91, 0,
877 93, 80, 0, 0, 2, 6, 4, 5, 7, 28,
878 0, 0, 0, 35, 34, 33, 3, 9, 29, 11,
879 16, 17, 0, 0, 22, 0, 36, 0, 39, 42,
880 43, 48, 51, 52, 53, 54, 56, 58, 60, 71,
881 0, 26, 74, 0, 0, 0, 161, 0, 123, 0,
882 0, 0, 200, 0, 0, 0, 0, 0, 178, 187,
883 191, 36, 62, 69, 0, 169, 0, 129, 172, 189,
884 171, 170, 0, 173, 174, 175, 176, 81, 83, 85,
885 0, 0, 99, 0, 168, 101, 30, 31, 0, 13,
Nicolas Capens2c1239f2015-02-17 17:30:04 -0500886 14, 0, 0, 20, 19, 0, 21, 23, 25, 32,
Nicolas Capens3c20f802015-02-17 17:17:20 -0500887 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Nicolas Capens7d626792015-02-17 17:58:31 -0500888 0, 0, 0, 0, 130, 0, 166, 0, 164, 160,
889 162, 127, 128, 125, 211, 210, 185, 202, 0, 214,
890 212, 0, 198, 177, 0, 65, 66, 67, 68, 64,
891 0, 0, 192, 188, 190, 0, 94, 0, 96, 100,
892 8, 0, 15, 27, 12, 18, 24, 37, 38, 41,
893 40, 46, 47, 44, 45, 49, 50, 55, 57, 59,
894 0, 158, 0, 0, 163, 0, 0, 0, 0, 0,
895 213, 0, 179, 63, 70, 0, 95, 10, 0, 0,
896 165, 0, 184, 186, 205, 204, 207, 185, 0, 196,
897 0, 0, 0, 82, 61, 167, 0, 206, 0, 0,
898 195, 193, 0, 0, 180, 0, 208, 0, 185, 0,
899 182, 199, 181, 0, 209, 203, 194, 197, 201
John Bauman66b8ab22014-05-06 15:57:45 -0400900};
901
902/* YYDEFGOTO[NTERM-NUM]. */
903static const yytype_int16 yydefgoto[] =
904{
Nicolas Capens7d626792015-02-17 17:58:31 -0500905 -1, 116, 117, 118, 251, 119, 120, 121, 122, 123,
906 124, 125, 161, 127, 128, 129, 130, 131, 132, 133,
907 134, 135, 136, 137, 138, 162, 163, 240, 164, 140,
908 165, 166, 42, 43, 44, 96, 75, 76, 97, 45,
909 46, 47, 77, 48, 49, 50, 51, 52, 91, 92,
910 53, 141, 55, 143, 89, 145, 146, 217, 218, 185,
911 168, 169, 170, 171, 234, 302, 321, 275, 276, 277,
912 322, 172, 173, 174, 311, 301, 175, 281, 226, 278,
913 296, 308, 309, 176, 56, 57, 58, 68
John Bauman66b8ab22014-05-06 15:57:45 -0400914};
915
916/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
917 STATE-NUM. */
Nicolas Capens7d626792015-02-17 17:58:31 -0500918#define YYPACT_NINF -282
John Bauman66b8ab22014-05-06 15:57:45 -0400919static const yytype_int16 yypact[] =
920{
Nicolas Capens7d626792015-02-17 17:58:31 -0500921 1461, -26, -282, -282, -282, 67, -282, -282, -282, -282,
922 -282, -282, -282, -282, -282, -282, -282, -282, -282, -282,
923 -282, -282, -282, -282, -282, -282, -282, -282, -282, -282,
924 -282, 76, -44, -282, -282, -282, -282, -282, 1, -282,
925 -282, -5, 7, -32, -2, -39, -282, 50, 1518, -282,
926 -282, 1615, 34, -282, 14, -282, 1403, -282, -282, -282,
927 -282, 1615, -282, -282, 51, -282, 85, -282, 73, -282,
928 56, -282, -282, -282, -282, -282, 1518, 113, 88, -282,
929 15, -282, -282, -282, 1127, -282, -282, 71, -282, 1518,
930 75, -62, -282, 315, -282, -282, -282, -282, 110, 1518,
931 -68, -282, 211, 1127, 87, -282, -282, -282, -282, -282,
932 1127, 1127, 1127, -282, -282, -282, -282, -282, -23, -282,
933 -282, -282, 89, -25, 1205, 91, -282, 1127, 21, -70,
934 -282, -46, 84, -282, -282, -282, 102, 103, -61, -282,
935 92, -282, -282, 1518, 122, 1283, -282, 96, -282, 85,
936 86, 94, -282, 97, 98, 99, 968, 101, 106, -282,
937 -282, 5, -282, -282, -7, -282, -5, -45, -282, -282,
938 -282, -282, 414, -282, -282, -282, -282, 100, -282, -282,
939 1046, 1127, -282, 104, -282, -282, -282, -282, 18, -282,
940 -282, 1127, 1564, -282, -282, 1127, 108, -282, -282, -282,
941 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127,
942 1127, 1127, 1127, 1127, -282, 1335, 112, 24, -282, -282,
943 -282, -282, -282, -282, -282, -282, 95, -282, 1127, -282,
944 -282, 44, -282, -282, 513, -282, -282, -282, -282, -282,
945 1127, 1127, -282, -282, -282, 1127, -282, 109, -282, -282,
946 -282, 114, 111, -282, 115, -282, -282, -282, -282, 21,
947 21, -282, -282, -282, -282, -46, -46, -282, 102, 103,
948 66, -282, 1127, 122, -282, 143, 73, 711, 810, 25,
949 -282, 890, 513, -282, -282, 116, -282, -282, 1127, 117,
950 -282, 121, -282, -282, -282, -282, 890, 95, 159, 111,
951 152, 124, 125, -282, -282, -282, 1127, -282, 119, 126,
952 196, -282, 123, 612, -282, 26, 1127, 612, 95, 1127,
953 -282, -282, -282, 128, 111, -282, -282, -282, -282
John Bauman66b8ab22014-05-06 15:57:45 -0400954};
955
956/* YYPGOTO[NTERM-NUM]. */
957static const yytype_int16 yypgoto[] =
958{
Nicolas Capens7d626792015-02-17 17:58:31 -0500959 -282, -282, -282, -282, -282, -282, -282, 28, -282, -282,
960 -282, -282, -75, -282, -40, -282, -55, -42, -282, -282,
961 -282, 16, 17, 19, -282, -80, -101, -282, -106, -99,
962 11, 12, -282, -282, -282, 130, 157, 153, 133, -282,
963 -282, -262, -282, -282, 181, -35, 230, -282, -282, 105,
964 -31, 0, -282, -282, -282, 118, -137, -282, -22, -171,
965 -21, -167, -260, -282, -282, -282, -65, -281, -282, -282,
966 -67, 22, -20, -282, -282, -43, -282, -282, -282, -282,
967 -282, -282, -282, -282, -282, 199, -282, -282
John Bauman66b8ab22014-05-06 15:57:45 -0400968};
969
970/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
971 positive, shift that token. If negative, reduce the rule which
972 number is the opposite. If zero, do what YYDEFACT says.
973 If YYTABLE_NINF, syntax error. */
Nicolas Capens7d626792015-02-17 17:58:31 -0500974#define YYTABLE_NINF -184
John Bauman66b8ab22014-05-06 15:57:45 -0400975static const yytype_int16 yytable[] =
976{
Nicolas Capens7d626792015-02-17 17:58:31 -0500977 54, 94, 184, 183, 139, 244, 188, 71, 220, 126,
978 248, 40, 41, 81, 212, 64, 310, 293, 59, 300,
979 82, 180, 139, 197, 204, 205, 148, 126, 181, 202,
980 87, 203, 149, 60, 300, 186, 187, 326, 72, 73,
981 74, 98, -26, 7, 84, 189, 190, 65, 54, 213,
982 231, 54, 199, 320, 144, 78, 54, 320, 79, 206,
983 207, 54, 70, 194, 98, 71, 191, 40, 41, 195,
984 192, 2, 3, 4, 27, 28, 54, 29, 220, 31,
985 184, 247, 235, 236, 237, 252, -76, 241, 66, 54,
986 242, 238, 67, 167, 256, 69, 72, 73, 74, 54,
987 139, 239, 101, 84, 102, 126, 250, 270, 144, 80,
988 144, 103, 241, 297, 323, 244, 62, 63, 273, 241,
989 241, 274, 279, 200, 201, 257, 258, 126, 126, 126,
990 126, 126, 126, 126, 126, 126, 126, 126, 241, 283,
991 284, 280, 88, 54, 90, 54, 285, 100, 327, 261,
992 262, 263, 264, 72, 73, 74, 208, 209, 221, 222,
993 241, 288, 259, 260, 93, 139, 265, 266, 142, 177,
994 126, 147, 167, 289, -27, 299, 210, 193, 198, 211,
995 144, 216, 214, 224, 227, 228, -183, 304, 232, 245,
996 299, 225, 139, 291, 249, -131, 229, 126, 233, 286,
997 315, 272, -28, 59, 287, 241, 303, 305, 306, 292,
998 324, 312, 313, 318, 317, 54, 316, 314, 184, 319,
999 255, 8, 9, 10, 11, 328, 267, 95, 268, 178,
1000 99, 269, 179, 83, 167, 61, 12, 13, 14, 15,
1001 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
1002 26, 290, 325, 307, 223, 86, 282, 294, 295, 32,
1003 33, 215, 34, 35, 36, 0, 37, 0, 0, 0,
1004 104, 39, 105, 106, 107, 108, 109, 167, 167, 110,
1005 111, 167, 167, 0, 0, 0, 0, 0, 0, 0,
1006 0, 0, 0, 0, 0, 0, 167, 0, 112, 0,
1007 0, 182, 0, 0, 0, 0, 0, 0, 0, 113,
1008 114, 0, 115, 167, 0, 0, 0, 167, 1, 2,
1009 3, 4, 5, 6, 7, 8, 9, 10, 11, 150,
1010 151, 152, 0, 153, 154, 155, 156, 0, 0, 0,
1011 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
1012 22, 23, 24, 25, 26, 27, 28, 0, 29, 30,
1013 31, 0, 0, 32, 33, 157, 34, 35, 36, 0,
1014 37, 0, 0, 38, 104, 39, 105, 106, 107, 108,
1015 109, 0, 0, 110, 111, 0, 0, 0, 0, 0,
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05001016 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Nicolas Capens7d626792015-02-17 17:58:31 -05001017 0, 0, 112, 0, 0, 0, 158, 159, 0, 0,
1018 0, 0, 160, 113, 114, 0, 115, 1, 2, 3,
1019 4, 5, 6, 7, 8, 9, 10, 11, 150, 151,
1020 152, 0, 153, 154, 155, 156, 0, 0, 0, 12,
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05001021 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
1022 23, 24, 25, 26, 27, 28, 0, 29, 30, 31,
Nicolas Capens7d626792015-02-17 17:58:31 -05001023 0, 0, 32, 33, 157, 34, 35, 36, 0, 37,
1024 0, 0, 38, 104, 39, 105, 106, 107, 108, 109,
1025 0, 0, 110, 111, 0, 0, 0, 0, 0, 0,
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05001026 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Nicolas Capens7d626792015-02-17 17:58:31 -05001027 0, 112, 0, 0, 0, 158, 243, 0, 0, 0,
1028 0, 160, 113, 114, 0, 115, 1, 2, 3, 4,
1029 5, 6, 7, 8, 9, 10, 11, 150, 151, 152,
1030 0, 153, 154, 155, 156, 0, 0, 0, 12, 13,
1031 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
1032 24, 25, 26, 27, 28, 0, 29, 30, 31, 0,
1033 0, 32, 33, 157, 34, 35, 36, 0, 37, 0,
1034 0, 38, 104, 39, 105, 106, 107, 108, 109, 0,
1035 0, 110, 111, 0, 0, 0, 0, 0, 0, 0,
1036 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1037 112, 0, 0, 0, 158, 0, 0, 0, 0, 0,
1038 160, 113, 114, 0, 115, 1, 2, 3, 4, 5,
1039 6, 7, 8, 9, 10, 11, 150, 151, 152, 0,
1040 153, 154, 155, 156, 0, 0, 0, 12, 13, 14,
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05001041 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1042 25, 26, 27, 28, 0, 29, 30, 31, 0, 0,
Nicolas Capens7d626792015-02-17 17:58:31 -05001043 32, 33, 157, 34, 35, 36, 0, 37, 0, 0,
1044 38, 104, 39, 105, 106, 107, 108, 109, 0, 0,
1045 110, 111, 0, 0, 0, 0, 0, 0, 0, 0,
1046 0, 0, 0, 0, 0, 0, 0, 0, 0, 112,
1047 0, 0, 0, 93, 0, 0, 0, 0, 0, 160,
1048 113, 114, 0, 115, 1, 2, 3, 4, 5, 6,
1049 7, 8, 9, 10, 11, 150, 151, 152, 0, 153,
1050 154, 155, 156, 0, 0, 0, 12, 13, 14, 15,
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05001051 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
Nicolas Capens2c1239f2015-02-17 17:30:04 -05001052 26, 27, 28, 0, 29, 30, 31, 0, 0, 32,
Nicolas Capens7d626792015-02-17 17:58:31 -05001053 33, 157, 34, 35, 36, 0, 37, 0, 0, 38,
1054 104, 39, 105, 106, 107, 108, 109, 0, 0, 110,
1055 111, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1056 0, 0, 0, 0, 0, 0, 0, 0, 112, 0,
1057 0, 0, 0, 0, 0, 0, 0, 0, 160, 113,
1058 114, 0, 115, 1, 2, 3, 4, 5, 6, 7,
1059 8, 9, 10, 11, 0, 0, 0, 0, 0, 0,
1060 0, 0, 0, 0, 0, 12, 13, 14, 15, 16,
1061 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
1062 27, 28, 0, 29, 30, 31, 0, 0, 32, 33,
1063 0, 34, 35, 36, 0, 37, 0, 0, 38, 104,
1064 39, 105, 106, 107, 108, 109, 0, 0, 110, 111,
Nicolas Capens2c1239f2015-02-17 17:30:04 -05001065 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Nicolas Capens7d626792015-02-17 17:58:31 -05001066 0, 0, 0, 298, 2, 3, 4, 112, 6, 7,
1067 8, 9, 10, 11, 0, 0, 0, 160, 113, 114,
1068 0, 115, 0, 0, 0, 12, 13, 14, 15, 16,
1069 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
1070 27, 28, 0, 29, 30, 31, 0, 0, 32, 33,
1071 0, 34, 35, 36, 0, 37, 0, 0, 38, 104,
1072 39, 105, 106, 107, 108, 109, 0, 0, 110, 111,
1073 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1074 0, 0, 0, 0, 0, 0, 0, 112, 8, 9,
1075 10, 11, 0, 0, 0, 0, 0, 0, 113, 114,
1076 0, 115, 0, 12, 13, 14, 15, 16, 17, 18,
Nicolas Capens2c1239f2015-02-17 17:30:04 -05001077 19, 20, 21, 22, 23, 24, 25, 26, 0, 0,
1078 0, 0, 0, 0, 0, 0, 32, 33, 0, 34,
Nicolas Capens7d626792015-02-17 17:58:31 -05001079 35, 36, 0, 37, 0, 0, 0, 104, 39, 105,
1080 106, 107, 108, 109, 0, 0, 110, 111, 0, 0,
Nicolas Capens2c1239f2015-02-17 17:30:04 -05001081 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Nicolas Capens7d626792015-02-17 17:58:31 -05001082 0, 0, 0, 0, 0, 112, 8, 9, 10, 11,
1083 0, 0, 0, 0, 0, 230, 113, 114, 0, 115,
1084 0, 12, 13, 14, 15, 16, 17, 18, 19, 20,
1085 21, 22, 23, 24, 25, 26, 0, 0, 0, 0,
1086 0, 0, 0, 0, 32, 33, 0, 34, 35, 36,
1087 0, 37, 0, 0, 0, 104, 39, 105, 106, 107,
1088 108, 109, 0, 0, 110, 111, 0, 0, 0, 0,
1089 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1090 0, 0, 0, 112, 0, 0, 246, 8, 9, 10,
1091 11, 0, 0, 0, 113, 114, 0, 115, 0, 0,
1092 0, 0, 12, 13, 14, 15, 16, 17, 18, 19,
1093 20, 21, 22, 23, 24, 25, 26, 0, 0, 0,
1094 0, 0, 0, 0, 0, 32, 33, 0, 34, 35,
1095 36, 0, 37, 0, 0, 0, 104, 39, 105, 106,
1096 107, 108, 109, 0, 0, 110, 111, 0, 0, 0,
1097 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1098 0, 0, 0, 0, 112, 8, 9, 10, 11, 0,
1099 0, 0, 0, 0, 0, 113, 114, 0, 115, 0,
1100 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
1101 22, 23, 24, 25, 26, 0, 0, 0, 0, 0,
1102 0, 0, 0, 32, 196, 0, 34, 35, 36, 0,
1103 37, 0, 0, 0, 104, 39, 105, 106, 107, 108,
1104 109, 0, 0, 110, 111, 0, 0, 0, 0, 0,
1105 0, 0, 0, 0, 0, 0, 0, 2, 3, 4,
1106 0, 0, 112, 8, 9, 10, 11, 0, 0, 0,
1107 0, 0, 0, 113, 114, 0, 115, 0, 12, 13,
1108 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
1109 24, 25, 26, 0, 0, 0, 0, 0, 0, 0,
1110 0, 32, 33, 0, 34, 35, 36, 0, 37, 2,
1111 3, 4, 0, 39, 0, 8, 9, 10, 11, 0,
1112 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1113 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
1114 22, 23, 24, 25, 26, 219, 0, 0, 0, 0,
1115 0, 0, 0, 32, 33, 0, 34, 35, 36, 0,
1116 37, 0, 0, 0, 0, 39, 0, 0, 0, 0,
1117 0, 0, 0, 85, 0, 0, 1, 2, 3, 4,
1118 5, 6, 7, 8, 9, 10, 11, 0, 0, 0,
1119 0, 0, 0, 0, 0, 0, 0, 271, 12, 13,
1120 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
1121 24, 25, 26, 27, 28, 0, 29, 30, 31, 0,
1122 0, 32, 33, 0, 34, 35, 36, 0, 37, 0,
1123 0, 38, 0, 39, 1, 2, 3, 4, 5, 6,
1124 7, 8, 9, 10, 11, 0, 0, 0, 0, 0,
1125 0, 0, 0, 0, 0, 0, 12, 13, 14, 15,
1126 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
1127 26, 27, 28, 0, 29, 30, 31, 0, 0, 32,
1128 33, 0, 34, 35, 36, 0, 37, 0, 0, 38,
1129 0, 39, 2, 3, 4, 0, 0, 0, 8, 9,
1130 10, 11, 0, 0, 0, 0, 0, 0, 0, 0,
Nicolas Capens2c1239f2015-02-17 17:30:04 -05001131 0, 0, 0, 12, 13, 14, 15, 16, 17, 18,
1132 19, 20, 21, 22, 23, 24, 25, 26, 0, 0,
1133 0, 0, 0, 0, 0, 0, 32, 33, 0, 34,
Nicolas Capens7d626792015-02-17 17:58:31 -05001134 35, 36, 0, 37, 8, 9, 10, 11, 39, 0,
1135 0, 0, 0, 0, 0, 0, 0, 0, 0, 12,
1136 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
1137 23, 24, 25, 26, 0, 0, 0, 0, 0, 0,
1138 0, 0, 32, 33, 0, 34, 35, 36, 0, 37,
1139 0, 0, 0, 253, 39, 8, 9, 10, 11, 254,
Nicolas Capens2c1239f2015-02-17 17:30:04 -05001140 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1141 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
1142 22, 23, 24, 25, 26, 0, 0, 0, 0, 0,
1143 0, 0, 0, 32, 33, 0, 34, 35, 36, 0,
Nicolas Capens7d626792015-02-17 17:58:31 -05001144 37, 0, 0, 0, 0, 39
John Bauman66b8ab22014-05-06 15:57:45 -04001145};
1146
1147static const yytype_int16 yycheck[] =
1148{
Nicolas Capens7d626792015-02-17 17:58:31 -05001149 0, 68, 103, 102, 84, 172, 112, 9, 145, 84,
1150 181, 0, 0, 48, 75, 59, 297, 277, 44, 281,
1151 51, 89, 102, 124, 70, 71, 88, 102, 96, 99,
1152 61, 101, 94, 59, 296, 110, 111, 318, 40, 41,
1153 42, 76, 87, 9, 89, 68, 69, 91, 48, 110,
1154 156, 51, 127, 313, 89, 94, 56, 317, 97, 105,
1155 106, 61, 94, 88, 99, 9, 89, 56, 56, 94,
1156 93, 4, 5, 6, 40, 41, 76, 43, 215, 45,
1157 181, 180, 77, 78, 79, 191, 88, 94, 87, 89,
1158 97, 86, 97, 93, 195, 88, 40, 41, 42, 99,
1159 180, 96, 87, 89, 89, 180, 88, 213, 143, 59,
1160 145, 96, 94, 88, 88, 282, 40, 41, 94, 94,
1161 94, 97, 228, 102, 103, 200, 201, 202, 203, 204,
1162 205, 206, 207, 208, 209, 210, 211, 212, 94, 240,
1163 241, 97, 91, 143, 59, 145, 245, 59, 319, 204,
1164 205, 206, 207, 40, 41, 42, 72, 73, 62, 63,
1165 94, 95, 202, 203, 91, 245, 208, 209, 97, 59,
1166 245, 96, 172, 272, 87, 281, 74, 88, 87, 76,
1167 215, 59, 90, 97, 87, 87, 91, 288, 87, 89,
1168 296, 97, 272, 50, 90, 87, 97, 272, 92, 90,
1169 306, 89, 87, 44, 90, 94, 90, 90, 87, 276,
1170 316, 59, 88, 17, 88, 215, 97, 92, 319, 96,
1171 192, 10, 11, 12, 13, 97, 210, 70, 211, 99,
1172 77, 212, 99, 52, 234, 5, 25, 26, 27, 28,
1173 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
1174 39, 273, 317, 296, 149, 56, 234, 278, 278, 48,
1175 49, 143, 51, 52, 53, -1, 55, -1, -1, -1,
1176 59, 60, 61, 62, 63, 64, 65, 277, 278, 68,
1177 69, 281, 282, -1, -1, -1, -1, -1, -1, -1,
1178 -1, -1, -1, -1, -1, -1, 296, -1, 87, -1,
1179 -1, 90, -1, -1, -1, -1, -1, -1, -1, 98,
1180 99, -1, 101, 313, -1, -1, -1, 317, 3, 4,
1181 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1182 15, 16, -1, 18, 19, 20, 21, -1, -1, -1,
1183 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1184 35, 36, 37, 38, 39, 40, 41, -1, 43, 44,
1185 45, -1, -1, 48, 49, 50, 51, 52, 53, -1,
1186 55, -1, -1, 58, 59, 60, 61, 62, 63, 64,
1187 65, -1, -1, 68, 69, -1, -1, -1, -1, -1,
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05001188 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Nicolas Capens7d626792015-02-17 17:58:31 -05001189 -1, -1, 87, -1, -1, -1, 91, 92, -1, -1,
1190 -1, -1, 97, 98, 99, -1, 101, 3, 4, 5,
Nicolas Capens2c1239f2015-02-17 17:30:04 -05001191 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
1192 16, -1, 18, 19, 20, 21, -1, -1, -1, 25,
Nicolas Capens3c20f802015-02-17 17:17:20 -05001193 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05001194 36, 37, 38, 39, 40, 41, -1, 43, 44, 45,
Nicolas Capens2c1239f2015-02-17 17:30:04 -05001195 -1, -1, 48, 49, 50, 51, 52, 53, -1, 55,
Nicolas Capens7d626792015-02-17 17:58:31 -05001196 -1, -1, 58, 59, 60, 61, 62, 63, 64, 65,
1197 -1, -1, 68, 69, -1, -1, -1, -1, -1, -1,
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05001198 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Nicolas Capens7d626792015-02-17 17:58:31 -05001199 -1, 87, -1, -1, -1, 91, 92, -1, -1, -1,
1200 -1, 97, 98, 99, -1, 101, 3, 4, 5, 6,
1201 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
1202 -1, 18, 19, 20, 21, -1, -1, -1, 25, 26,
1203 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
1204 37, 38, 39, 40, 41, -1, 43, 44, 45, -1,
1205 -1, 48, 49, 50, 51, 52, 53, -1, 55, -1,
1206 -1, 58, 59, 60, 61, 62, 63, 64, 65, -1,
1207 -1, 68, 69, -1, -1, -1, -1, -1, -1, -1,
1208 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1209 87, -1, -1, -1, 91, -1, -1, -1, -1, -1,
1210 97, 98, 99, -1, 101, 3, 4, 5, 6, 7,
1211 8, 9, 10, 11, 12, 13, 14, 15, 16, -1,
1212 18, 19, 20, 21, -1, -1, -1, 25, 26, 27,
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05001213 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
1214 38, 39, 40, 41, -1, 43, 44, 45, -1, -1,
Nicolas Capens7d626792015-02-17 17:58:31 -05001215 48, 49, 50, 51, 52, 53, -1, 55, -1, -1,
1216 58, 59, 60, 61, 62, 63, 64, 65, -1, -1,
1217 68, 69, -1, -1, -1, -1, -1, -1, -1, -1,
1218 -1, -1, -1, -1, -1, -1, -1, -1, -1, 87,
1219 -1, -1, -1, 91, -1, -1, -1, -1, -1, 97,
1220 98, 99, -1, 101, 3, 4, 5, 6, 7, 8,
1221 9, 10, 11, 12, 13, 14, 15, 16, -1, 18,
1222 19, 20, 21, -1, -1, -1, 25, 26, 27, 28,
1223 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
1224 39, 40, 41, -1, 43, 44, 45, -1, -1, 48,
1225 49, 50, 51, 52, 53, -1, 55, -1, -1, 58,
1226 59, 60, 61, 62, 63, 64, 65, -1, -1, 68,
1227 69, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1228 -1, -1, -1, -1, -1, -1, -1, -1, 87, -1,
1229 -1, -1, -1, -1, -1, -1, -1, -1, 97, 98,
1230 99, -1, 101, 3, 4, 5, 6, 7, 8, 9,
1231 10, 11, 12, 13, -1, -1, -1, -1, -1, -1,
1232 -1, -1, -1, -1, -1, 25, 26, 27, 28, 29,
1233 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
1234 40, 41, -1, 43, 44, 45, -1, -1, 48, 49,
1235 -1, 51, 52, 53, -1, 55, -1, -1, 58, 59,
1236 60, 61, 62, 63, 64, 65, -1, -1, 68, 69,
1237 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1238 -1, -1, -1, 3, 4, 5, 6, 87, 8, 9,
1239 10, 11, 12, 13, -1, -1, -1, 97, 98, 99,
1240 -1, 101, -1, -1, -1, 25, 26, 27, 28, 29,
1241 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
1242 40, 41, -1, 43, 44, 45, -1, -1, 48, 49,
1243 -1, 51, 52, 53, -1, 55, -1, -1, 58, 59,
1244 60, 61, 62, 63, 64, 65, -1, -1, 68, 69,
1245 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1246 -1, -1, -1, -1, -1, -1, -1, 87, 10, 11,
1247 12, 13, -1, -1, -1, -1, -1, -1, 98, 99,
1248 -1, 101, -1, 25, 26, 27, 28, 29, 30, 31,
1249 32, 33, 34, 35, 36, 37, 38, 39, -1, -1,
1250 -1, -1, -1, -1, -1, -1, 48, 49, -1, 51,
1251 52, 53, -1, 55, -1, -1, -1, 59, 60, 61,
1252 62, 63, 64, 65, -1, -1, 68, 69, -1, -1,
1253 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1254 -1, -1, -1, -1, -1, 87, 10, 11, 12, 13,
1255 -1, -1, -1, -1, -1, 97, 98, 99, -1, 101,
1256 -1, 25, 26, 27, 28, 29, 30, 31, 32, 33,
1257 34, 35, 36, 37, 38, 39, -1, -1, -1, -1,
1258 -1, -1, -1, -1, 48, 49, -1, 51, 52, 53,
1259 -1, 55, -1, -1, -1, 59, 60, 61, 62, 63,
1260 64, 65, -1, -1, 68, 69, -1, -1, -1, -1,
1261 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1262 -1, -1, -1, 87, -1, -1, 90, 10, 11, 12,
1263 13, -1, -1, -1, 98, 99, -1, 101, -1, -1,
1264 -1, -1, 25, 26, 27, 28, 29, 30, 31, 32,
1265 33, 34, 35, 36, 37, 38, 39, -1, -1, -1,
1266 -1, -1, -1, -1, -1, 48, 49, -1, 51, 52,
1267 53, -1, 55, -1, -1, -1, 59, 60, 61, 62,
1268 63, 64, 65, -1, -1, 68, 69, -1, -1, -1,
1269 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1270 -1, -1, -1, -1, 87, 10, 11, 12, 13, -1,
1271 -1, -1, -1, -1, -1, 98, 99, -1, 101, -1,
1272 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1273 35, 36, 37, 38, 39, -1, -1, -1, -1, -1,
1274 -1, -1, -1, 48, 49, -1, 51, 52, 53, -1,
1275 55, -1, -1, -1, 59, 60, 61, 62, 63, 64,
1276 65, -1, -1, 68, 69, -1, -1, -1, -1, -1,
1277 -1, -1, -1, -1, -1, -1, -1, 4, 5, 6,
1278 -1, -1, 87, 10, 11, 12, 13, -1, -1, -1,
1279 -1, -1, -1, 98, 99, -1, 101, -1, 25, 26,
1280 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
1281 37, 38, 39, -1, -1, -1, -1, -1, -1, -1,
1282 -1, 48, 49, -1, 51, 52, 53, -1, 55, 4,
1283 5, 6, -1, 60, -1, 10, 11, 12, 13, -1,
1284 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1285 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1286 35, 36, 37, 38, 39, 92, -1, -1, -1, -1,
1287 -1, -1, -1, 48, 49, -1, 51, 52, 53, -1,
1288 55, -1, -1, -1, -1, 60, -1, -1, -1, -1,
1289 -1, -1, -1, 0, -1, -1, 3, 4, 5, 6,
1290 7, 8, 9, 10, 11, 12, 13, -1, -1, -1,
1291 -1, -1, -1, -1, -1, -1, -1, 92, 25, 26,
1292 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
1293 37, 38, 39, 40, 41, -1, 43, 44, 45, -1,
1294 -1, 48, 49, -1, 51, 52, 53, -1, 55, -1,
1295 -1, 58, -1, 60, 3, 4, 5, 6, 7, 8,
1296 9, 10, 11, 12, 13, -1, -1, -1, -1, -1,
1297 -1, -1, -1, -1, -1, -1, 25, 26, 27, 28,
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05001298 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
Nicolas Capens2c1239f2015-02-17 17:30:04 -05001299 39, 40, 41, -1, 43, 44, 45, -1, -1, 48,
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05001300 49, -1, 51, 52, 53, -1, 55, -1, -1, 58,
Nicolas Capens7d626792015-02-17 17:58:31 -05001301 -1, 60, 4, 5, 6, -1, -1, -1, 10, 11,
1302 12, 13, -1, -1, -1, -1, -1, -1, -1, -1,
Nicolas Capens2c1239f2015-02-17 17:30:04 -05001303 -1, -1, -1, 25, 26, 27, 28, 29, 30, 31,
1304 32, 33, 34, 35, 36, 37, 38, 39, -1, -1,
1305 -1, -1, -1, -1, -1, -1, 48, 49, -1, 51,
Nicolas Capens7d626792015-02-17 17:58:31 -05001306 52, 53, -1, 55, 10, 11, 12, 13, 60, -1,
1307 -1, -1, -1, -1, -1, -1, -1, -1, -1, 25,
1308 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
1309 36, 37, 38, 39, -1, -1, -1, -1, -1, -1,
1310 -1, -1, 48, 49, -1, 51, 52, 53, -1, 55,
1311 -1, -1, -1, 59, 60, 10, 11, 12, 13, 65,
Nicolas Capens2c1239f2015-02-17 17:30:04 -05001312 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1313 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1314 35, 36, 37, 38, 39, -1, -1, -1, -1, -1,
1315 -1, -1, -1, 48, 49, -1, 51, 52, 53, -1,
Nicolas Capens7d626792015-02-17 17:58:31 -05001316 55, -1, -1, -1, -1, 60
John Bauman66b8ab22014-05-06 15:57:45 -04001317};
1318
1319/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
1320 symbol of state STATE-NUM. */
1321static const yytype_uint8 yystos[] =
1322{
1323 0, 3, 4, 5, 6, 7, 8, 9, 10, 11,
Nicolas Capens3c20f802015-02-17 17:17:20 -05001324 12, 13, 25, 26, 27, 28, 29, 30, 31, 32,
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05001325 33, 34, 35, 36, 37, 38, 39, 40, 41, 43,
Nicolas Capens7d626792015-02-17 17:58:31 -05001326 44, 45, 48, 49, 51, 52, 53, 55, 58, 60,
1327 141, 142, 143, 144, 145, 150, 151, 152, 154, 155,
1328 156, 157, 158, 161, 162, 163, 195, 196, 197, 44,
1329 59, 157, 40, 41, 59, 91, 87, 97, 198, 88,
1330 94, 9, 40, 41, 42, 147, 148, 153, 94, 97,
1331 59, 156, 161, 155, 89, 0, 196, 161, 91, 165,
1332 59, 159, 160, 91, 181, 147, 146, 149, 156, 148,
1333 59, 87, 89, 96, 59, 61, 62, 63, 64, 65,
1334 68, 69, 87, 98, 99, 101, 112, 113, 114, 116,
1335 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
1336 127, 128, 129, 130, 131, 132, 133, 134, 135, 136,
1337 140, 162, 97, 164, 156, 166, 167, 96, 88, 94,
1338 14, 15, 16, 18, 19, 20, 21, 50, 91, 92,
1339 97, 123, 136, 137, 139, 141, 142, 162, 171, 172,
1340 173, 174, 182, 183, 184, 187, 194, 59, 146, 149,
1341 89, 96, 90, 140, 137, 170, 123, 123, 139, 68,
1342 69, 89, 93, 88, 88, 94, 49, 137, 87, 123,
1343 102, 103, 99, 101, 70, 71, 105, 106, 72, 73,
1344 74, 76, 75, 110, 90, 166, 59, 168, 169, 92,
1345 167, 62, 63, 160, 97, 97, 189, 87, 87, 97,
1346 97, 139, 87, 92, 175, 77, 78, 79, 86, 96,
1347 138, 94, 97, 92, 172, 89, 90, 140, 170, 90,
1348 88, 115, 139, 59, 65, 118, 137, 123, 123, 125,
1349 125, 127, 127, 127, 127, 128, 128, 132, 133, 134,
1350 139, 92, 89, 94, 97, 178, 179, 180, 190, 139,
1351 97, 188, 182, 137, 137, 140, 90, 90, 95, 140,
1352 169, 50, 181, 173, 171, 183, 191, 88, 3, 139,
1353 152, 186, 176, 90, 137, 90, 87, 186, 192, 193,
1354 178, 185, 59, 88, 92, 139, 97, 88, 17, 96,
1355 173, 177, 181, 88, 139, 177, 178, 170, 97
John Bauman66b8ab22014-05-06 15:57:45 -04001356};
1357
1358#define yyerrok (yyerrstatus = 0)
1359#define yyclearin (yychar = YYEMPTY)
1360#define YYEMPTY (-2)
1361#define YYEOF 0
1362
1363#define YYACCEPT goto yyacceptlab
1364#define YYABORT goto yyabortlab
1365#define YYERROR goto yyerrorlab
1366
1367
1368/* Like YYERROR except do call yyerror. This remains here temporarily
1369 to ease the transition to the new meaning of YYERROR, for GCC.
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04001370 Once GCC version 2 has supplanted version 1, this can go. */
John Bauman66b8ab22014-05-06 15:57:45 -04001371
1372#define YYFAIL goto yyerrlab
John Bauman66b8ab22014-05-06 15:57:45 -04001373
1374#define YYRECOVERING() (!!yyerrstatus)
1375
1376#define YYBACKUP(Token, Value) \
1377do \
1378 if (yychar == YYEMPTY && yylen == 1) \
1379 { \
1380 yychar = (Token); \
1381 yylval = (Value); \
1382 yytoken = YYTRANSLATE (yychar); \
1383 YYPOPSTACK (1); \
1384 goto yybackup; \
1385 } \
1386 else \
1387 { \
1388 yyerror (context, YY_("syntax error: cannot back up")); \
1389 YYERROR; \
1390 } \
1391while (YYID (0))
1392
1393
1394#define YYTERROR 1
1395#define YYERRCODE 256
1396
1397
1398/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
1399 If N is 0, then set CURRENT to the empty location which ends
1400 the previous symbol: RHS[0] (always defined). */
1401
1402#define YYRHSLOC(Rhs, K) ((Rhs)[K])
1403#ifndef YYLLOC_DEFAULT
1404# define YYLLOC_DEFAULT(Current, Rhs, N) \
1405 do \
1406 if (YYID (N)) \
1407 { \
1408 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
1409 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
1410 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
1411 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
1412 } \
1413 else \
1414 { \
1415 (Current).first_line = (Current).last_line = \
1416 YYRHSLOC (Rhs, 0).last_line; \
1417 (Current).first_column = (Current).last_column = \
1418 YYRHSLOC (Rhs, 0).last_column; \
1419 } \
1420 while (YYID (0))
1421#endif
1422
1423
1424/* YY_LOCATION_PRINT -- Print the location on the stream.
1425 This macro was not mandated originally: define only if we know
1426 we won't break user code: when these are the locations we know. */
1427
1428#ifndef YY_LOCATION_PRINT
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04001429# if YYLTYPE_IS_TRIVIAL
John Bauman66b8ab22014-05-06 15:57:45 -04001430# define YY_LOCATION_PRINT(File, Loc) \
1431 fprintf (File, "%d.%d-%d.%d", \
1432 (Loc).first_line, (Loc).first_column, \
1433 (Loc).last_line, (Loc).last_column)
1434# else
1435# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1436# endif
1437#endif
1438
1439
1440/* YYLEX -- calling `yylex' with the right arguments. */
1441
1442#ifdef YYLEX_PARAM
1443# define YYLEX yylex (&yylval, YYLEX_PARAM)
1444#else
1445# define YYLEX yylex (&yylval)
1446#endif
1447
1448/* Enable debugging if requested. */
1449#if YYDEBUG
1450
1451# ifndef YYFPRINTF
1452# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1453# define YYFPRINTF fprintf
1454# endif
1455
1456# define YYDPRINTF(Args) \
1457do { \
1458 if (yydebug) \
1459 YYFPRINTF Args; \
1460} while (YYID (0))
1461
1462# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
1463do { \
1464 if (yydebug) \
1465 { \
1466 YYFPRINTF (stderr, "%s ", Title); \
1467 yy_symbol_print (stderr, \
1468 Type, Value, context); \
1469 YYFPRINTF (stderr, "\n"); \
1470 } \
1471} while (YYID (0))
1472
1473
1474/*--------------------------------.
1475| Print this symbol on YYOUTPUT. |
1476`--------------------------------*/
1477
1478/*ARGSUSED*/
1479#if (defined __STDC__ || defined __C99__FUNC__ \
1480 || defined __cplusplus || defined _MSC_VER)
1481static void
1482yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, TParseContext* context)
1483#else
1484static void
1485yy_symbol_value_print (yyoutput, yytype, yyvaluep, context)
1486 FILE *yyoutput;
1487 int yytype;
1488 YYSTYPE const * const yyvaluep;
1489 TParseContext* context;
1490#endif
1491{
1492 if (!yyvaluep)
1493 return;
1494 YYUSE (context);
1495# ifdef YYPRINT
1496 if (yytype < YYNTOKENS)
1497 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1498# else
1499 YYUSE (yyoutput);
1500# endif
1501 switch (yytype)
1502 {
1503 default:
1504 break;
1505 }
1506}
1507
1508
1509/*--------------------------------.
1510| Print this symbol on YYOUTPUT. |
1511`--------------------------------*/
1512
1513#if (defined __STDC__ || defined __C99__FUNC__ \
1514 || defined __cplusplus || defined _MSC_VER)
1515static void
1516yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, TParseContext* context)
1517#else
1518static void
1519yy_symbol_print (yyoutput, yytype, yyvaluep, context)
1520 FILE *yyoutput;
1521 int yytype;
1522 YYSTYPE const * const yyvaluep;
1523 TParseContext* context;
1524#endif
1525{
1526 if (yytype < YYNTOKENS)
1527 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1528 else
1529 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1530
1531 yy_symbol_value_print (yyoutput, yytype, yyvaluep, context);
1532 YYFPRINTF (yyoutput, ")");
1533}
1534
1535/*------------------------------------------------------------------.
1536| yy_stack_print -- Print the state stack from its BOTTOM up to its |
1537| TOP (included). |
1538`------------------------------------------------------------------*/
1539
1540#if (defined __STDC__ || defined __C99__FUNC__ \
1541 || defined __cplusplus || defined _MSC_VER)
1542static void
1543yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
1544#else
1545static void
1546yy_stack_print (yybottom, yytop)
1547 yytype_int16 *yybottom;
1548 yytype_int16 *yytop;
1549#endif
1550{
1551 YYFPRINTF (stderr, "Stack now");
1552 for (; yybottom <= yytop; yybottom++)
1553 {
1554 int yybot = *yybottom;
1555 YYFPRINTF (stderr, " %d", yybot);
1556 }
1557 YYFPRINTF (stderr, "\n");
1558}
1559
1560# define YY_STACK_PRINT(Bottom, Top) \
1561do { \
1562 if (yydebug) \
1563 yy_stack_print ((Bottom), (Top)); \
1564} while (YYID (0))
1565
1566
1567/*------------------------------------------------.
1568| Report that the YYRULE is going to be reduced. |
1569`------------------------------------------------*/
1570
1571#if (defined __STDC__ || defined __C99__FUNC__ \
1572 || defined __cplusplus || defined _MSC_VER)
1573static void
1574yy_reduce_print (YYSTYPE *yyvsp, int yyrule, TParseContext* context)
1575#else
1576static void
1577yy_reduce_print (yyvsp, yyrule, context)
1578 YYSTYPE *yyvsp;
1579 int yyrule;
1580 TParseContext* context;
1581#endif
1582{
1583 int yynrhs = yyr2[yyrule];
1584 int yyi;
1585 unsigned long int yylno = yyrline[yyrule];
1586 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1587 yyrule - 1, yylno);
1588 /* The symbols being reduced. */
1589 for (yyi = 0; yyi < yynrhs; yyi++)
1590 {
1591 YYFPRINTF (stderr, " $%d = ", yyi + 1);
1592 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1593 &(yyvsp[(yyi + 1) - (yynrhs)])
1594 , context);
1595 YYFPRINTF (stderr, "\n");
1596 }
1597}
1598
1599# define YY_REDUCE_PRINT(Rule) \
1600do { \
1601 if (yydebug) \
1602 yy_reduce_print (yyvsp, Rule, context); \
1603} while (YYID (0))
1604
1605/* Nonzero means print parse trace. It is left uninitialized so that
1606 multiple parsers can coexist. */
1607int yydebug;
1608#else /* !YYDEBUG */
1609# define YYDPRINTF(Args)
1610# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1611# define YY_STACK_PRINT(Bottom, Top)
1612# define YY_REDUCE_PRINT(Rule)
1613#endif /* !YYDEBUG */
1614
1615
1616/* YYINITDEPTH -- initial size of the parser's stacks. */
1617#ifndef YYINITDEPTH
1618# define YYINITDEPTH 200
1619#endif
1620
1621/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1622 if the built-in stack extension method is used).
1623
1624 Do not make this value too large; the results are undefined if
1625 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1626 evaluated with infinite-precision integer arithmetic. */
1627
1628#ifndef YYMAXDEPTH
1629# define YYMAXDEPTH 10000
1630#endif
1631
1632
1633
1634#if YYERROR_VERBOSE
1635
1636# ifndef yystrlen
1637# if defined __GLIBC__ && defined _STRING_H
1638# define yystrlen strlen
1639# else
1640/* Return the length of YYSTR. */
1641#if (defined __STDC__ || defined __C99__FUNC__ \
1642 || defined __cplusplus || defined _MSC_VER)
1643static YYSIZE_T
1644yystrlen (const char *yystr)
1645#else
1646static YYSIZE_T
1647yystrlen (yystr)
1648 const char *yystr;
1649#endif
1650{
1651 YYSIZE_T yylen;
1652 for (yylen = 0; yystr[yylen]; yylen++)
1653 continue;
1654 return yylen;
1655}
1656# endif
1657# endif
1658
1659# ifndef yystpcpy
1660# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1661# define yystpcpy stpcpy
1662# else
1663/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1664 YYDEST. */
1665#if (defined __STDC__ || defined __C99__FUNC__ \
1666 || defined __cplusplus || defined _MSC_VER)
1667static char *
1668yystpcpy (char *yydest, const char *yysrc)
1669#else
1670static char *
1671yystpcpy (yydest, yysrc)
1672 char *yydest;
1673 const char *yysrc;
1674#endif
1675{
1676 char *yyd = yydest;
1677 const char *yys = yysrc;
1678
1679 while ((*yyd++ = *yys++) != '\0')
1680 continue;
1681
1682 return yyd - 1;
1683}
1684# endif
1685# endif
1686
1687# ifndef yytnamerr
1688/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1689 quotes and backslashes, so that it's suitable for yyerror. The
1690 heuristic is that double-quoting is unnecessary unless the string
1691 contains an apostrophe, a comma, or backslash (other than
1692 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1693 null, do not copy; instead, return the length of what the result
1694 would have been. */
1695static YYSIZE_T
1696yytnamerr (char *yyres, const char *yystr)
1697{
1698 if (*yystr == '"')
1699 {
1700 YYSIZE_T yyn = 0;
1701 char const *yyp = yystr;
1702
1703 for (;;)
1704 switch (*++yyp)
1705 {
1706 case '\'':
1707 case ',':
1708 goto do_not_strip_quotes;
1709
1710 case '\\':
1711 if (*++yyp != '\\')
1712 goto do_not_strip_quotes;
1713 /* Fall through. */
1714 default:
1715 if (yyres)
1716 yyres[yyn] = *yyp;
1717 yyn++;
1718 break;
1719
1720 case '"':
1721 if (yyres)
1722 yyres[yyn] = '\0';
1723 return yyn;
1724 }
1725 do_not_strip_quotes: ;
1726 }
1727
1728 if (! yyres)
1729 return yystrlen (yystr);
1730
1731 return yystpcpy (yyres, yystr) - yyres;
1732}
1733# endif
1734
1735/* Copy into YYRESULT an error message about the unexpected token
1736 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1737 including the terminating null byte. If YYRESULT is null, do not
1738 copy anything; just return the number of bytes that would be
1739 copied. As a special case, return 0 if an ordinary "syntax error"
1740 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1741 size calculation. */
1742static YYSIZE_T
1743yysyntax_error (char *yyresult, int yystate, int yychar)
1744{
1745 int yyn = yypact[yystate];
1746
1747 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1748 return 0;
1749 else
1750 {
1751 int yytype = YYTRANSLATE (yychar);
1752 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1753 YYSIZE_T yysize = yysize0;
1754 YYSIZE_T yysize1;
1755 int yysize_overflow = 0;
1756 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1757 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1758 int yyx;
1759
1760# if 0
1761 /* This is so xgettext sees the translatable formats that are
1762 constructed on the fly. */
1763 YY_("syntax error, unexpected %s");
1764 YY_("syntax error, unexpected %s, expecting %s");
1765 YY_("syntax error, unexpected %s, expecting %s or %s");
1766 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1767 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1768# endif
1769 char *yyfmt;
1770 char const *yyf;
1771 static char const yyunexpected[] = "syntax error, unexpected %s";
1772 static char const yyexpecting[] = ", expecting %s";
1773 static char const yyor[] = " or %s";
1774 char yyformat[sizeof yyunexpected
1775 + sizeof yyexpecting - 1
1776 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1777 * (sizeof yyor - 1))];
1778 char const *yyprefix = yyexpecting;
1779
1780 /* Start YYX at -YYN if negative to avoid negative indexes in
1781 YYCHECK. */
1782 int yyxbegin = yyn < 0 ? -yyn : 0;
1783
1784 /* Stay within bounds of both yycheck and yytname. */
1785 int yychecklim = YYLAST - yyn + 1;
1786 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1787 int yycount = 1;
1788
1789 yyarg[0] = yytname[yytype];
1790 yyfmt = yystpcpy (yyformat, yyunexpected);
1791
1792 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1793 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1794 {
1795 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1796 {
1797 yycount = 1;
1798 yysize = yysize0;
1799 yyformat[sizeof yyunexpected - 1] = '\0';
1800 break;
1801 }
1802 yyarg[yycount++] = yytname[yyx];
1803 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1804 yysize_overflow |= (yysize1 < yysize);
1805 yysize = yysize1;
1806 yyfmt = yystpcpy (yyfmt, yyprefix);
1807 yyprefix = yyor;
1808 }
1809
1810 yyf = YY_(yyformat);
1811 yysize1 = yysize + yystrlen (yyf);
1812 yysize_overflow |= (yysize1 < yysize);
1813 yysize = yysize1;
1814
1815 if (yysize_overflow)
1816 return YYSIZE_MAXIMUM;
1817
1818 if (yyresult)
1819 {
1820 /* Avoid sprintf, as that infringes on the user's name space.
1821 Don't have undefined behavior even if the translation
1822 produced a string with the wrong number of "%s"s. */
1823 char *yyp = yyresult;
1824 int yyi = 0;
1825 while ((*yyp = *yyf) != '\0')
1826 {
1827 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1828 {
1829 yyp += yytnamerr (yyp, yyarg[yyi++]);
1830 yyf += 2;
1831 }
1832 else
1833 {
1834 yyp++;
1835 yyf++;
1836 }
1837 }
1838 }
1839 return yysize;
1840 }
1841}
1842#endif /* YYERROR_VERBOSE */
1843
1844
1845/*-----------------------------------------------.
1846| Release the memory associated to this symbol. |
1847`-----------------------------------------------*/
1848
1849/*ARGSUSED*/
1850#if (defined __STDC__ || defined __C99__FUNC__ \
1851 || defined __cplusplus || defined _MSC_VER)
1852static void
1853yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, TParseContext* context)
1854#else
1855static void
1856yydestruct (yymsg, yytype, yyvaluep, context)
1857 const char *yymsg;
1858 int yytype;
1859 YYSTYPE *yyvaluep;
1860 TParseContext* context;
1861#endif
1862{
1863 YYUSE (yyvaluep);
1864 YYUSE (context);
1865
1866 if (!yymsg)
1867 yymsg = "Deleting";
1868 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1869
1870 switch (yytype)
1871 {
1872
1873 default:
1874 break;
1875 }
1876}
1877
1878/* Prevent warnings from -Wmissing-prototypes. */
1879#ifdef YYPARSE_PARAM
1880#if defined __STDC__ || defined __cplusplus
1881int yyparse (void *YYPARSE_PARAM);
1882#else
1883int yyparse ();
1884#endif
1885#else /* ! YYPARSE_PARAM */
1886#if defined __STDC__ || defined __cplusplus
1887int yyparse (TParseContext* context);
1888#else
1889int yyparse ();
1890#endif
1891#endif /* ! YYPARSE_PARAM */
1892
1893
1894
1895
1896
1897/*-------------------------.
1898| yyparse or yypush_parse. |
1899`-------------------------*/
1900
1901#ifdef YYPARSE_PARAM
1902#if (defined __STDC__ || defined __C99__FUNC__ \
1903 || defined __cplusplus || defined _MSC_VER)
1904int
1905yyparse (void *YYPARSE_PARAM)
1906#else
1907int
1908yyparse (YYPARSE_PARAM)
1909 void *YYPARSE_PARAM;
1910#endif
1911#else /* ! YYPARSE_PARAM */
1912#if (defined __STDC__ || defined __C99__FUNC__ \
1913 || defined __cplusplus || defined _MSC_VER)
1914int
1915yyparse (TParseContext* context)
1916#else
1917int
1918yyparse (context)
1919 TParseContext* context;
1920#endif
1921#endif
1922{
1923/* The lookahead symbol. */
1924int yychar;
1925
1926/* The semantic value of the lookahead symbol. */
1927YYSTYPE yylval;
1928
1929 /* Number of syntax errors so far. */
1930 int yynerrs;
1931
1932 int yystate;
1933 /* Number of tokens to shift before error messages enabled. */
1934 int yyerrstatus;
1935
1936 /* The stacks and their tools:
1937 `yyss': related to states.
1938 `yyvs': related to semantic values.
1939
1940 Refer to the stacks thru separate pointers, to allow yyoverflow
1941 to reallocate them elsewhere. */
1942
1943 /* The state stack. */
1944 yytype_int16 yyssa[YYINITDEPTH];
1945 yytype_int16 *yyss;
1946 yytype_int16 *yyssp;
1947
1948 /* The semantic value stack. */
1949 YYSTYPE yyvsa[YYINITDEPTH];
1950 YYSTYPE *yyvs;
1951 YYSTYPE *yyvsp;
1952
1953 YYSIZE_T yystacksize;
1954
1955 int yyn;
1956 int yyresult;
1957 /* Lookahead token as an internal (translated) token number. */
1958 int yytoken;
1959 /* The variables used to return semantic value and location from the
1960 action routines. */
1961 YYSTYPE yyval;
1962
1963#if YYERROR_VERBOSE
1964 /* Buffer for error messages, and its allocated size. */
1965 char yymsgbuf[128];
1966 char *yymsg = yymsgbuf;
1967 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1968#endif
1969
1970#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1971
1972 /* The number of symbols on the RHS of the reduced rule.
1973 Keep to zero when no symbol should be popped. */
1974 int yylen = 0;
1975
1976 yytoken = 0;
1977 yyss = yyssa;
1978 yyvs = yyvsa;
1979 yystacksize = YYINITDEPTH;
1980
1981 YYDPRINTF ((stderr, "Starting parse\n"));
1982
1983 yystate = 0;
1984 yyerrstatus = 0;
1985 yynerrs = 0;
1986 yychar = YYEMPTY; /* Cause a token to be read. */
1987
1988 /* Initialize stack pointers.
1989 Waste one element of value and location stack
1990 so that they stay on the same level as the state stack.
1991 The wasted elements are never initialized. */
1992 yyssp = yyss;
1993 yyvsp = yyvs;
1994
1995 goto yysetstate;
1996
1997/*------------------------------------------------------------.
1998| yynewstate -- Push a new state, which is found in yystate. |
1999`------------------------------------------------------------*/
2000 yynewstate:
2001 /* In all cases, when you get here, the value and location stacks
2002 have just been pushed. So pushing a state here evens the stacks. */
2003 yyssp++;
2004
2005 yysetstate:
2006 *yyssp = yystate;
2007
2008 if (yyss + yystacksize - 1 <= yyssp)
2009 {
2010 /* Get the current used size of the three stacks, in elements. */
2011 YYSIZE_T yysize = yyssp - yyss + 1;
2012
2013#ifdef yyoverflow
2014 {
2015 /* Give user a chance to reallocate the stack. Use copies of
2016 these so that the &'s don't force the real ones into
2017 memory. */
2018 YYSTYPE *yyvs1 = yyvs;
2019 yytype_int16 *yyss1 = yyss;
2020
2021 /* Each stack pointer address is followed by the size of the
2022 data in use in that stack, in bytes. This used to be a
2023 conditional around just the two extra args, but that might
2024 be undefined if yyoverflow is a macro. */
2025 yyoverflow (YY_("memory exhausted"),
2026 &yyss1, yysize * sizeof (*yyssp),
2027 &yyvs1, yysize * sizeof (*yyvsp),
2028 &yystacksize);
2029
2030 yyss = yyss1;
2031 yyvs = yyvs1;
2032 }
2033#else /* no yyoverflow */
2034# ifndef YYSTACK_RELOCATE
2035 goto yyexhaustedlab;
2036# else
2037 /* Extend the stack our own way. */
2038 if (YYMAXDEPTH <= yystacksize)
2039 goto yyexhaustedlab;
2040 yystacksize *= 2;
2041 if (YYMAXDEPTH < yystacksize)
2042 yystacksize = YYMAXDEPTH;
2043
2044 {
2045 yytype_int16 *yyss1 = yyss;
2046 union yyalloc *yyptr =
2047 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
2048 if (! yyptr)
2049 goto yyexhaustedlab;
2050 YYSTACK_RELOCATE (yyss_alloc, yyss);
2051 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
2052# undef YYSTACK_RELOCATE
2053 if (yyss1 != yyssa)
2054 YYSTACK_FREE (yyss1);
2055 }
2056# endif
2057#endif /* no yyoverflow */
2058
2059 yyssp = yyss + yysize - 1;
2060 yyvsp = yyvs + yysize - 1;
2061
2062 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
2063 (unsigned long int) yystacksize));
2064
2065 if (yyss + yystacksize - 1 <= yyssp)
2066 YYABORT;
2067 }
2068
2069 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
2070
2071 if (yystate == YYFINAL)
2072 YYACCEPT;
2073
2074 goto yybackup;
2075
2076/*-----------.
2077| yybackup. |
2078`-----------*/
2079yybackup:
2080
2081 /* Do appropriate processing given the current state. Read a
2082 lookahead token if we need one and don't already have one. */
2083
2084 /* First try to decide what to do without reference to lookahead token. */
2085 yyn = yypact[yystate];
2086 if (yyn == YYPACT_NINF)
2087 goto yydefault;
2088
2089 /* Not known => get a lookahead token if don't already have one. */
2090
2091 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
2092 if (yychar == YYEMPTY)
2093 {
2094 YYDPRINTF ((stderr, "Reading a token: "));
2095 yychar = YYLEX;
2096 }
2097
2098 if (yychar <= YYEOF)
2099 {
2100 yychar = yytoken = YYEOF;
2101 YYDPRINTF ((stderr, "Now at end of input.\n"));
2102 }
2103 else
2104 {
2105 yytoken = YYTRANSLATE (yychar);
2106 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
2107 }
2108
2109 /* If the proper action on seeing token YYTOKEN is to reduce or to
2110 detect an error, take that action. */
2111 yyn += yytoken;
2112 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
2113 goto yydefault;
2114 yyn = yytable[yyn];
2115 if (yyn <= 0)
2116 {
2117 if (yyn == 0 || yyn == YYTABLE_NINF)
2118 goto yyerrlab;
2119 yyn = -yyn;
2120 goto yyreduce;
2121 }
2122
2123 /* Count tokens shifted since error; after three, turn off error
2124 status. */
2125 if (yyerrstatus)
2126 yyerrstatus--;
2127
2128 /* Shift the lookahead token. */
2129 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
2130
2131 /* Discard the shifted token. */
2132 yychar = YYEMPTY;
2133
2134 yystate = yyn;
2135 *++yyvsp = yylval;
2136
2137 goto yynewstate;
2138
2139
2140/*-----------------------------------------------------------.
2141| yydefault -- do the default action for the current state. |
2142`-----------------------------------------------------------*/
2143yydefault:
2144 yyn = yydefact[yystate];
2145 if (yyn == 0)
2146 goto yyerrlab;
2147 goto yyreduce;
2148
2149
2150/*-----------------------------.
2151| yyreduce -- Do a reduction. |
2152`-----------------------------*/
2153yyreduce:
2154 /* yyn is the number of a rule to reduce with. */
2155 yylen = yyr2[yyn];
2156
2157 /* If YYLEN is nonzero, implement the default value of the action:
2158 `$$ = $1'.
2159
2160 Otherwise, the following line sets YYVAL to garbage.
2161 This behavior is undocumented and Bison
2162 users should not rely upon it. Assigning to YYVAL
2163 unconditionally makes the parser a bit smaller, and it avoids a
2164 GCC warning that YYVAL may be used uninitialized. */
2165 yyval = yyvsp[1-yylen];
2166
2167
2168 YY_REDUCE_PRINT (yyn);
2169 switch (yyn)
2170 {
2171 case 2:
2172
2173 {
2174 // The symbol table search was done in the lexical phase
2175 const TSymbol* symbol = (yyvsp[(1) - (1)].lex).symbol;
2176 const TVariable* variable;
2177 if (symbol == 0) {
2178 context->error((yyvsp[(1) - (1)].lex).line, "undeclared identifier", (yyvsp[(1) - (1)].lex).string->c_str());
2179 context->recover();
2180 TType type(EbtFloat, EbpUndefined);
2181 TVariable* fakeVariable = new TVariable((yyvsp[(1) - (1)].lex).string, type);
Nicolas Capensd603ecd2015-02-18 14:52:21 -05002182 context->symbolTable.declare(*fakeVariable);
John Bauman66b8ab22014-05-06 15:57:45 -04002183 variable = fakeVariable;
2184 } else {
2185 // This identifier can only be a variable type symbol
2186 if (! symbol->isVariable()) {
2187 context->error((yyvsp[(1) - (1)].lex).line, "variable expected", (yyvsp[(1) - (1)].lex).string->c_str());
2188 context->recover();
2189 }
2190 variable = static_cast<const TVariable*>(symbol);
2191 }
2192
2193 // don't delete $1.string, it's used by error recovery, and the pool
2194 // pop will reclaim the memory
2195
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002196 if (variable->getType().getQualifier() == EvqConstExpr ) {
John Bauman66b8ab22014-05-06 15:57:45 -04002197 ConstantUnion* constArray = variable->getConstPointer();
2198 TType t(variable->getType());
2199 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(constArray, t, (yyvsp[(1) - (1)].lex).line);
2200 } else
2201 (yyval.interm.intermTypedNode) = context->intermediate.addSymbol(variable->getUniqueId(),
2202 variable->getName(),
2203 variable->getType(), (yyvsp[(1) - (1)].lex).line);
2204 }
2205 break;
2206
2207 case 3:
2208
2209 {
2210 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
2211 }
2212 break;
2213
2214 case 4:
2215
2216 {
John Bauman66b8ab22014-05-06 15:57:45 -04002217 ConstantUnion *unionArray = new ConstantUnion[1];
2218 unionArray->setIConst((yyvsp[(1) - (1)].lex).i);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002219 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConstExpr), (yyvsp[(1) - (1)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002220 }
2221 break;
2222
2223 case 5:
2224
2225 {
2226 ConstantUnion *unionArray = new ConstantUnion[1];
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002227 unionArray->setUConst((yyvsp[(1) - (1)].lex).u);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002228 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtUInt, EbpUndefined, EvqConstExpr), (yyvsp[(1) - (1)].lex).line);
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002229 }
2230 break;
2231
2232 case 6:
2233
2234 {
2235 ConstantUnion *unionArray = new ConstantUnion[1];
John Bauman66b8ab22014-05-06 15:57:45 -04002236 unionArray->setFConst((yyvsp[(1) - (1)].lex).f);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002237 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConstExpr), (yyvsp[(1) - (1)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002238 }
2239 break;
2240
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002241 case 7:
John Bauman66b8ab22014-05-06 15:57:45 -04002242
2243 {
2244 ConstantUnion *unionArray = new ConstantUnion[1];
2245 unionArray->setBConst((yyvsp[(1) - (1)].lex).b);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002246 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConstExpr), (yyvsp[(1) - (1)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002247 }
2248 break;
2249
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002250 case 8:
John Bauman66b8ab22014-05-06 15:57:45 -04002251
2252 {
2253 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (3)].interm.intermTypedNode);
2254 }
2255 break;
2256
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002257 case 9:
John Bauman66b8ab22014-05-06 15:57:45 -04002258
2259 {
2260 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
2261 }
2262 break;
2263
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002264 case 10:
John Bauman66b8ab22014-05-06 15:57:45 -04002265
2266 {
2267 if (!(yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isVector()) {
2268 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode())
2269 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());
2270 else
2271 context->error((yyvsp[(2) - (4)].lex).line, " left of '[' is not of type array, matrix, or vector ", "expression");
2272 context->recover();
2273 }
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002274 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConstExpr && (yyvsp[(3) - (4)].interm.intermTypedNode)->getQualifier() == EvqConstExpr) {
John Bauman66b8ab22014-05-06 15:57:45 -04002275 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) { // constant folding for arrays
Nicolas Capens198529d2015-02-10 13:54:19 -05002276 (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 -04002277 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector()) { // constant folding for vectors
2278 TVectorFields fields;
2279 fields.num = 1;
Nicolas Capens198529d2015-02-10 13:54:19 -05002280 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 -04002281 (yyval.interm.intermTypedNode) = context->addConstVectorNode(fields, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2282 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix()) { // constant folding for matrices
Nicolas Capens198529d2015-02-10 13:54:19 -05002283 (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 -04002284 }
2285 } else {
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002286 if ((yyvsp[(3) - (4)].interm.intermTypedNode)->getQualifier() == EvqConstExpr) {
Nicolas Capens198529d2015-02-10 13:54:19 -05002287 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 -04002288 std::stringstream extraInfoStream;
Nicolas Capens198529d2015-02-10 13:54:19 -05002289 extraInfoStream << "field selection out of range '" << (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0) << "'";
John Bauman66b8ab22014-05-06 15:57:45 -04002290 std::string extraInfo = extraInfoStream.str();
2291 context->error((yyvsp[(2) - (4)].lex).line, "", "[", extraInfo.c_str());
2292 context->recover();
2293 } else {
2294 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) {
2295 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize() == 0) {
Nicolas Capens198529d2015-02-10 13:54:19 -05002296 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getMaxArraySize() <= (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0)) {
2297 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 -04002298 context->recover();
2299 } else {
2300 if (context->arraySetMaxSize((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getTypePointer(), 0, false, (yyvsp[(2) - (4)].lex).line))
2301 context->recover();
2302 }
Nicolas Capens198529d2015-02-10 13:54:19 -05002303 } else if ( (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0) >= (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize()) {
John Bauman66b8ab22014-05-06 15:57:45 -04002304 std::stringstream extraInfoStream;
Nicolas Capens198529d2015-02-10 13:54:19 -05002305 extraInfoStream << "array index out of range '" << (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0) << "'";
John Bauman66b8ab22014-05-06 15:57:45 -04002306 std::string extraInfo = extraInfoStream.str();
2307 context->error((yyvsp[(2) - (4)].lex).line, "", "[", extraInfo.c_str());
2308 context->recover();
2309 }
2310 }
2311 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(3) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2312 }
2313 } else {
2314 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize() == 0) {
2315 context->error((yyvsp[(2) - (4)].lex).line, "", "[", "array must be redeclared with a size before being indexed with a variable");
2316 context->recover();
2317 }
2318
2319 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexIndirect, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(3) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2320 }
2321 }
2322 if ((yyval.interm.intermTypedNode) == 0) {
2323 ConstantUnion *unionArray = new ConstantUnion[1];
2324 unionArray->setFConst(0.0f);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002325 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpHigh, EvqConstExpr), (yyvsp[(2) - (4)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002326 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) {
2327 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getStruct())
2328 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getStruct(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getTypeName()));
2329 else
2330 (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()));
2331
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002332 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConstExpr)
2333 (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConstExpr);
2334 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConstExpr)
2335 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqConstExpr, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize()));
John Bauman66b8ab22014-05-06 15:57:45 -04002336 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix())
2337 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize()));
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002338 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConstExpr)
2339 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqConstExpr));
John Bauman66b8ab22014-05-06 15:57:45 -04002340 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector())
2341 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary));
2342 else
2343 (yyval.interm.intermTypedNode)->setType((yyvsp[(1) - (4)].interm.intermTypedNode)->getType());
2344 }
2345 break;
2346
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002347 case 11:
John Bauman66b8ab22014-05-06 15:57:45 -04002348
2349 {
2350 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
2351 }
2352 break;
2353
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002354 case 12:
John Bauman66b8ab22014-05-06 15:57:45 -04002355
2356 {
2357 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isArray()) {
2358 context->error((yyvsp[(3) - (3)].lex).line, "cannot apply dot operator to an array", ".");
2359 context->recover();
2360 }
2361
2362 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isVector()) {
2363 TVectorFields fields;
2364 if (! context->parseVectorFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yyvsp[(3) - (3)].lex).line)) {
2365 fields.num = 1;
2366 fields.offsets[0] = 0;
2367 context->recover();
2368 }
2369
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002370 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConstExpr) { // constant folding for vector fields
John Bauman66b8ab22014-05-06 15:57:45 -04002371 (yyval.interm.intermTypedNode) = context->addConstVectorNode(fields, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].lex).line);
2372 if ((yyval.interm.intermTypedNode) == 0) {
2373 context->recover();
2374 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2375 }
2376 else
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002377 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(), EvqConstExpr, (int) (*(yyvsp[(3) - (3)].lex).string).size()));
John Bauman66b8ab22014-05-06 15:57:45 -04002378 } else {
2379 TString vectorString = *(yyvsp[(3) - (3)].lex).string;
2380 TIntermTyped* index = context->intermediate.addSwizzle(fields, (yyvsp[(3) - (3)].lex).line);
2381 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpVectorSwizzle, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2382 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (int) vectorString.size()));
2383 }
2384 } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isMatrix()) {
2385 TMatrixFields fields;
2386 if (! context->parseMatrixFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yyvsp[(3) - (3)].lex).line)) {
2387 fields.wholeRow = false;
2388 fields.wholeCol = false;
2389 fields.row = 0;
2390 fields.col = 0;
2391 context->recover();
2392 }
2393
2394 if (fields.wholeRow || fields.wholeCol) {
2395 context->error((yyvsp[(2) - (3)].lex).line, " non-scalar fields not implemented yet", ".");
2396 context->recover();
2397 ConstantUnion *unionArray = new ConstantUnion[1];
2398 unionArray->setIConst(0);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002399 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConstExpr), (yyvsp[(3) - (3)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002400 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2401 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(),EvqTemporary, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize()));
2402 } else {
2403 ConstantUnion *unionArray = new ConstantUnion[1];
2404 unionArray->setIConst(fields.col * (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize() + fields.row);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002405 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConstExpr), (yyvsp[(3) - (3)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002406 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2407 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision()));
2408 }
2409 } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType() == EbtStruct) {
2410 bool fieldFound = false;
2411 const TTypeList* fields = (yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getStruct();
2412 if (fields == 0) {
2413 context->error((yyvsp[(2) - (3)].lex).line, "structure has no fields", "Internal Error");
2414 context->recover();
2415 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2416 } else {
2417 unsigned int i;
2418 for (i = 0; i < fields->size(); ++i) {
2419 if ((*fields)[i].type->getFieldName() == *(yyvsp[(3) - (3)].lex).string) {
2420 fieldFound = true;
2421 break;
2422 }
2423 }
2424 if (fieldFound) {
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002425 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConstExpr) {
John Bauman66b8ab22014-05-06 15:57:45 -04002426 (yyval.interm.intermTypedNode) = context->addConstStruct(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
2427 if ((yyval.interm.intermTypedNode) == 0) {
2428 context->recover();
2429 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2430 }
2431 else {
2432 (yyval.interm.intermTypedNode)->setType(*(*fields)[i].type);
2433 // change the qualifier of the return type, not of the structure field
2434 // as the structure definition is shared between various structures.
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002435 (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConstExpr);
John Bauman66b8ab22014-05-06 15:57:45 -04002436 }
2437 } else {
2438 ConstantUnion *unionArray = new ConstantUnion[1];
2439 unionArray->setIConst(i);
2440 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, *(*fields)[i].type, (yyvsp[(3) - (3)].lex).line);
2441 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirectStruct, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2442 (yyval.interm.intermTypedNode)->setType(*(*fields)[i].type);
2443 }
2444 } else {
2445 context->error((yyvsp[(2) - (3)].lex).line, " no such field in structure", (yyvsp[(3) - (3)].lex).string->c_str());
2446 context->recover();
2447 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2448 }
2449 }
2450 } else {
2451 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());
2452 context->recover();
2453 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2454 }
2455 // don't delete $3.string, it's from the pool
2456 }
2457 break;
2458
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002459 case 13:
John Bauman66b8ab22014-05-06 15:57:45 -04002460
2461 {
2462 if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode)))
2463 context->recover();
John Baumand4ae8632014-05-06 16:18:33 -04002464 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostIncrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002465 if ((yyval.interm.intermTypedNode) == 0) {
2466 context->unaryOpError((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
2467 context->recover();
2468 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode);
2469 }
2470 }
2471 break;
2472
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002473 case 14:
John Bauman66b8ab22014-05-06 15:57:45 -04002474
2475 {
2476 if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode)))
2477 context->recover();
John Baumand4ae8632014-05-06 16:18:33 -04002478 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostDecrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002479 if ((yyval.interm.intermTypedNode) == 0) {
2480 context->unaryOpError((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
2481 context->recover();
2482 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode);
2483 }
2484 }
2485 break;
2486
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002487 case 15:
John Bauman66b8ab22014-05-06 15:57:45 -04002488
2489 {
2490 if (context->integerErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode), "[]"))
2491 context->recover();
2492 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
2493 }
2494 break;
2495
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002496 case 16:
John Bauman66b8ab22014-05-06 15:57:45 -04002497
2498 {
2499 TFunction* fnCall = (yyvsp[(1) - (1)].interm).function;
2500 TOperator op = fnCall->getBuiltInOp();
2501
2502 if (op != EOpNull)
2503 {
2504 //
2505 // Then this should be a constructor.
2506 // Don't go through the symbol table for constructors.
2507 // Their parameters will be verified algorithmically.
2508 //
2509 TType type(EbtVoid, EbpUndefined); // use this to get the type back
2510 if (context->constructorErrorCheck((yyvsp[(1) - (1)].interm).line, (yyvsp[(1) - (1)].interm).intermNode, *fnCall, op, &type)) {
2511 (yyval.interm.intermTypedNode) = 0;
2512 } else {
2513 //
2514 // It's a constructor, of type 'type'.
2515 //
2516 (yyval.interm.intermTypedNode) = context->addConstructor((yyvsp[(1) - (1)].interm).intermNode, &type, op, fnCall, (yyvsp[(1) - (1)].interm).line);
2517 }
2518
2519 if ((yyval.interm.intermTypedNode) == 0) {
2520 context->recover();
2521 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator(0, op, (yyvsp[(1) - (1)].interm).line);
2522 }
2523 (yyval.interm.intermTypedNode)->setType(type);
2524 } else {
2525 //
2526 // Not a constructor. Find it in the symbol table.
2527 //
2528 const TFunction* fnCandidate;
2529 bool builtIn;
2530 fnCandidate = context->findFunction((yyvsp[(1) - (1)].interm).line, fnCall, &builtIn);
2531 if (fnCandidate) {
2532 //
2533 // A declared function.
2534 //
2535 if (builtIn && !fnCandidate->getExtension().empty() &&
2536 context->extensionErrorCheck((yyvsp[(1) - (1)].interm).line, fnCandidate->getExtension())) {
2537 context->recover();
2538 }
2539 op = fnCandidate->getBuiltInOp();
2540 if (builtIn && op != EOpNull) {
2541 //
2542 // A function call mapped to a built-in operation.
2543 //
2544 if (fnCandidate->getParamCount() == 1) {
2545 //
2546 // Treat it like a built-in unary operator.
2547 //
John Baumand4ae8632014-05-06 16:18:33 -04002548 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(op, (yyvsp[(1) - (1)].interm).intermNode, 0);
John Bauman66b8ab22014-05-06 15:57:45 -04002549 if ((yyval.interm.intermTypedNode) == 0) {
2550 std::stringstream extraInfoStream;
2551 extraInfoStream << "built in unary operator function. Type: " << static_cast<TIntermTyped*>((yyvsp[(1) - (1)].interm).intermNode)->getCompleteString();
2552 std::string extraInfo = extraInfoStream.str();
2553 context->error((yyvsp[(1) - (1)].interm).intermNode->getLine(), " wrong operand type", "Internal Error", extraInfo.c_str());
2554 YYERROR;
2555 }
2556 } else {
2557 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, op, (yyvsp[(1) - (1)].interm).line);
2558 }
2559 } else {
2560 // This is a real function call
2561
2562 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, EOpFunctionCall, (yyvsp[(1) - (1)].interm).line);
2563 (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType());
2564
2565 // this is how we know whether the given function is a builtIn function or a user defined function
2566 // if builtIn == false, it's a userDefined -> could be an overloaded builtIn function also
2567 // if builtIn == true, it's definitely a builtIn function with EOpNull
2568 if (!builtIn)
2569 (yyval.interm.intermTypedNode)->getAsAggregate()->setUserDefined();
2570 (yyval.interm.intermTypedNode)->getAsAggregate()->setName(fnCandidate->getMangledName());
2571
2572 TQualifier qual;
2573 for (int i = 0; i < fnCandidate->getParamCount(); ++i) {
2574 qual = fnCandidate->getParam(i).type->getQualifier();
2575 if (qual == EvqOut || qual == EvqInOut) {
2576 if (context->lValueErrorCheck((yyval.interm.intermTypedNode)->getLine(), "assign", (yyval.interm.intermTypedNode)->getAsAggregate()->getSequence()[i]->getAsTyped())) {
2577 context->error((yyvsp[(1) - (1)].interm).intermNode->getLine(), "Constant value cannot be passed for 'out' or 'inout' parameters.", "Error");
2578 context->recover();
2579 }
2580 }
2581 }
2582 }
2583 (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType());
2584 } else {
2585 // error message was put out by PaFindFunction()
2586 // Put on a dummy node for error recovery
2587 ConstantUnion *unionArray = new ConstantUnion[1];
2588 unionArray->setFConst(0.0f);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002589 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConstExpr), (yyvsp[(1) - (1)].interm).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002590 context->recover();
2591 }
2592 }
2593 delete fnCall;
2594 }
2595 break;
2596
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002597 case 17:
John Bauman66b8ab22014-05-06 15:57:45 -04002598
2599 {
2600 (yyval.interm) = (yyvsp[(1) - (1)].interm);
2601 }
2602 break;
2603
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002604 case 18:
John Bauman66b8ab22014-05-06 15:57:45 -04002605
2606 {
2607 context->error((yyvsp[(3) - (3)].interm).line, "methods are not supported", "");
2608 context->recover();
2609 (yyval.interm) = (yyvsp[(3) - (3)].interm);
2610 }
2611 break;
2612
John Bauman66b8ab22014-05-06 15:57:45 -04002613 case 19:
2614
2615 {
2616 (yyval.interm) = (yyvsp[(1) - (2)].interm);
2617 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
2618 }
2619 break;
2620
2621 case 20:
2622
2623 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002624 (yyval.interm) = (yyvsp[(1) - (2)].interm);
2625 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
2626 }
2627 break;
2628
2629 case 21:
2630
2631 {
John Bauman66b8ab22014-05-06 15:57:45 -04002632 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
2633 (yyval.interm).intermNode = 0;
2634 }
2635 break;
2636
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002637 case 22:
John Bauman66b8ab22014-05-06 15:57:45 -04002638
2639 {
2640 (yyval.interm).function = (yyvsp[(1) - (1)].interm.function);
2641 (yyval.interm).intermNode = 0;
2642 }
2643 break;
2644
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002645 case 23:
John Bauman66b8ab22014-05-06 15:57:45 -04002646
2647 {
2648 TParameter param = { 0, new TType((yyvsp[(2) - (2)].interm.intermTypedNode)->getType()) };
2649 (yyvsp[(1) - (2)].interm.function)->addParameter(param);
2650 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
2651 (yyval.interm).intermNode = (yyvsp[(2) - (2)].interm.intermTypedNode);
2652 }
2653 break;
2654
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002655 case 24:
John Bauman66b8ab22014-05-06 15:57:45 -04002656
2657 {
2658 TParameter param = { 0, new TType((yyvsp[(3) - (3)].interm.intermTypedNode)->getType()) };
2659 (yyvsp[(1) - (3)].interm).function->addParameter(param);
2660 (yyval.interm).function = (yyvsp[(1) - (3)].interm).function;
2661 (yyval.interm).intermNode = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermNode, (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
2662 }
2663 break;
2664
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002665 case 25:
John Bauman66b8ab22014-05-06 15:57:45 -04002666
2667 {
2668 (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
2669 }
2670 break;
2671
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002672 case 26:
John Bauman66b8ab22014-05-06 15:57:45 -04002673
2674 {
2675 //
2676 // Constructor
2677 //
2678 TOperator op = EOpNull;
2679 if ((yyvsp[(1) - (1)].interm.type).userDef) {
2680 op = EOpConstructStruct;
2681 } else {
2682 switch ((yyvsp[(1) - (1)].interm.type).type) {
2683 case EbtFloat:
2684 if ((yyvsp[(1) - (1)].interm.type).matrix) {
2685 switch((yyvsp[(1) - (1)].interm.type).size) {
2686 case 2: op = EOpConstructMat2; break;
2687 case 3: op = EOpConstructMat3; break;
2688 case 4: op = EOpConstructMat4; break;
2689 }
2690 } else {
2691 switch((yyvsp[(1) - (1)].interm.type).size) {
2692 case 1: op = EOpConstructFloat; break;
2693 case 2: op = EOpConstructVec2; break;
2694 case 3: op = EOpConstructVec3; break;
2695 case 4: op = EOpConstructVec4; break;
2696 }
2697 }
2698 break;
2699 case EbtInt:
2700 switch((yyvsp[(1) - (1)].interm.type).size) {
2701 case 1: op = EOpConstructInt; break;
2702 case 2: FRAG_VERT_ONLY("ivec2", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec2; break;
2703 case 3: FRAG_VERT_ONLY("ivec3", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec3; break;
2704 case 4: FRAG_VERT_ONLY("ivec4", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec4; break;
2705 }
2706 break;
2707 case EbtBool:
2708 switch((yyvsp[(1) - (1)].interm.type).size) {
2709 case 1: op = EOpConstructBool; break;
2710 case 2: FRAG_VERT_ONLY("bvec2", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec2; break;
2711 case 3: FRAG_VERT_ONLY("bvec3", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec3; break;
2712 case 4: FRAG_VERT_ONLY("bvec4", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec4; break;
2713 }
2714 break;
2715 default: break;
2716 }
2717 if (op == EOpNull) {
2718 context->error((yyvsp[(1) - (1)].interm.type).line, "cannot construct this type", getBasicString((yyvsp[(1) - (1)].interm.type).type));
2719 context->recover();
2720 (yyvsp[(1) - (1)].interm.type).type = EbtFloat;
2721 op = EOpConstructFloat;
2722 }
2723 }
2724 TString tempString;
2725 TType type((yyvsp[(1) - (1)].interm.type));
2726 TFunction *function = new TFunction(&tempString, type, op);
2727 (yyval.interm.function) = function;
2728 }
2729 break;
2730
John Bauman66b8ab22014-05-06 15:57:45 -04002731 case 27:
2732
2733 {
2734 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
2735 context->recover();
2736 TType type(EbtVoid, EbpUndefined);
2737 TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type);
2738 (yyval.interm.function) = function;
2739 }
2740 break;
2741
2742 case 28:
2743
2744 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002745 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
2746 context->recover();
2747 TType type(EbtVoid, EbpUndefined);
2748 TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type);
2749 (yyval.interm.function) = function;
John Bauman66b8ab22014-05-06 15:57:45 -04002750 }
2751 break;
2752
2753 case 29:
2754
2755 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002756 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
2757 }
2758 break;
2759
2760 case 30:
2761
2762 {
John Bauman66b8ab22014-05-06 15:57:45 -04002763 if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)))
2764 context->recover();
John Baumand4ae8632014-05-06 16:18:33 -04002765 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreIncrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002766 if ((yyval.interm.intermTypedNode) == 0) {
2767 context->unaryOpError((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2768 context->recover();
2769 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2770 }
2771 }
2772 break;
2773
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002774 case 31:
John Bauman66b8ab22014-05-06 15:57:45 -04002775
2776 {
2777 if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)))
2778 context->recover();
John Baumand4ae8632014-05-06 16:18:33 -04002779 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreDecrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002780 if ((yyval.interm.intermTypedNode) == 0) {
2781 context->unaryOpError((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2782 context->recover();
2783 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2784 }
2785 }
2786 break;
2787
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002788 case 32:
John Bauman66b8ab22014-05-06 15:57:45 -04002789
2790 {
2791 if ((yyvsp[(1) - (2)].interm).op != EOpNull) {
John Baumand4ae8632014-05-06 16:18:33 -04002792 (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 -04002793 if ((yyval.interm.intermTypedNode) == 0) {
2794 const char* errorOp = "";
2795 switch((yyvsp[(1) - (2)].interm).op) {
2796 case EOpNegative: errorOp = "-"; break;
2797 case EOpLogicalNot: errorOp = "!"; break;
2798 default: break;
2799 }
2800 context->unaryOpError((yyvsp[(1) - (2)].interm).line, errorOp, (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2801 context->recover();
2802 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2803 }
2804 } else
2805 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2806 }
2807 break;
2808
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002809 case 33:
John Bauman66b8ab22014-05-06 15:57:45 -04002810
2811 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNull; }
2812 break;
2813
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002814 case 34:
John Bauman66b8ab22014-05-06 15:57:45 -04002815
2816 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNegative; }
2817 break;
2818
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002819 case 35:
John Bauman66b8ab22014-05-06 15:57:45 -04002820
2821 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpLogicalNot; }
2822 break;
2823
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002824 case 36:
John Bauman66b8ab22014-05-06 15:57:45 -04002825
2826 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
2827 break;
2828
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002829 case 37:
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(EOpMul, (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 38:
John Bauman66b8ab22014-05-06 15:57:45 -04002843
2844 {
2845 FRAG_VERT_ONLY("/", (yyvsp[(2) - (3)].lex).line);
John Baumand4ae8632014-05-06 16:18:33 -04002846 (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 -04002847 if ((yyval.interm.intermTypedNode) == 0) {
2848 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "/", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2849 context->recover();
2850 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2851 }
2852 }
2853 break;
2854
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002855 case 39:
John Bauman66b8ab22014-05-06 15:57:45 -04002856
2857 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
2858 break;
2859
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002860 case 40:
John Bauman66b8ab22014-05-06 15:57:45 -04002861
2862 {
John Baumand4ae8632014-05-06 16:18:33 -04002863 (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 -04002864 if ((yyval.interm.intermTypedNode) == 0) {
2865 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "+", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2866 context->recover();
2867 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2868 }
2869 }
2870 break;
2871
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002872 case 41:
John Bauman66b8ab22014-05-06 15:57:45 -04002873
2874 {
John Baumand4ae8632014-05-06 16:18:33 -04002875 (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 -04002876 if ((yyval.interm.intermTypedNode) == 0) {
2877 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "-", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2878 context->recover();
2879 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2880 }
2881 }
2882 break;
2883
John Bauman66b8ab22014-05-06 15:57:45 -04002884 case 42:
2885
2886 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
2887 break;
2888
2889 case 43:
2890
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002891 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
2892 break;
2893
2894 case 44:
2895
John Bauman66b8ab22014-05-06 15:57:45 -04002896 {
John Baumand4ae8632014-05-06 16:18:33 -04002897 (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 -04002898 if ((yyval.interm.intermTypedNode) == 0) {
2899 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2900 context->recover();
2901 ConstantUnion *unionArray = new ConstantUnion[1];
2902 unionArray->setBConst(false);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002903 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConstExpr), (yyvsp[(2) - (3)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002904 }
2905 }
2906 break;
2907
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002908 case 45:
John Bauman66b8ab22014-05-06 15:57:45 -04002909
2910 {
John Baumand4ae8632014-05-06 16:18:33 -04002911 (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 -04002912 if ((yyval.interm.intermTypedNode) == 0) {
2913 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2914 context->recover();
2915 ConstantUnion *unionArray = new ConstantUnion[1];
2916 unionArray->setBConst(false);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002917 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConstExpr), (yyvsp[(2) - (3)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002918 }
2919 }
2920 break;
2921
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002922 case 46:
John Bauman66b8ab22014-05-06 15:57:45 -04002923
2924 {
John Baumand4ae8632014-05-06 16:18:33 -04002925 (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 -04002926 if ((yyval.interm.intermTypedNode) == 0) {
2927 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2928 context->recover();
2929 ConstantUnion *unionArray = new ConstantUnion[1];
2930 unionArray->setBConst(false);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002931 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConstExpr), (yyvsp[(2) - (3)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002932 }
2933 }
2934 break;
2935
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002936 case 47:
John Bauman66b8ab22014-05-06 15:57:45 -04002937
2938 {
John Baumand4ae8632014-05-06 16:18:33 -04002939 (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 -04002940 if ((yyval.interm.intermTypedNode) == 0) {
2941 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2942 context->recover();
2943 ConstantUnion *unionArray = new ConstantUnion[1];
2944 unionArray->setBConst(false);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002945 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConstExpr), (yyvsp[(2) - (3)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002946 }
2947 }
2948 break;
2949
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002950 case 48:
John Bauman66b8ab22014-05-06 15:57:45 -04002951
2952 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
2953 break;
2954
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002955 case 49:
John Bauman66b8ab22014-05-06 15:57:45 -04002956
2957 {
John Baumand4ae8632014-05-06 16:18:33 -04002958 (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 -04002959 if ((yyval.interm.intermTypedNode) == 0) {
2960 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "==", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2961 context->recover();
2962 ConstantUnion *unionArray = new ConstantUnion[1];
2963 unionArray->setBConst(false);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002964 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConstExpr), (yyvsp[(2) - (3)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002965 }
2966 }
2967 break;
2968
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002969 case 50:
John Bauman66b8ab22014-05-06 15:57:45 -04002970
2971 {
John Baumand4ae8632014-05-06 16:18:33 -04002972 (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 -04002973 if ((yyval.interm.intermTypedNode) == 0) {
2974 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "!=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2975 context->recover();
2976 ConstantUnion *unionArray = new ConstantUnion[1];
2977 unionArray->setBConst(false);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002978 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConstExpr), (yyvsp[(2) - (3)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002979 }
2980 }
2981 break;
2982
John Bauman66b8ab22014-05-06 15:57:45 -04002983 case 51:
2984
2985 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
2986 break;
2987
2988 case 52:
2989
2990 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
2991 break;
2992
2993 case 53:
2994
2995 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
2996 break;
2997
2998 case 54:
2999
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003000 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
3001 break;
3002
3003 case 55:
3004
John Bauman66b8ab22014-05-06 15:57:45 -04003005 {
John Baumand4ae8632014-05-06 16:18:33 -04003006 (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 -04003007 if ((yyval.interm.intermTypedNode) == 0) {
3008 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "&&", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3009 context->recover();
3010 ConstantUnion *unionArray = new ConstantUnion[1];
3011 unionArray->setBConst(false);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05003012 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConstExpr), (yyvsp[(2) - (3)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003013 }
3014 }
3015 break;
3016
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003017 case 56:
John Bauman66b8ab22014-05-06 15:57:45 -04003018
3019 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
3020 break;
3021
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003022 case 57:
John Bauman66b8ab22014-05-06 15:57:45 -04003023
3024 {
John Baumand4ae8632014-05-06 16:18:33 -04003025 (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 -04003026 if ((yyval.interm.intermTypedNode) == 0) {
3027 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "^^", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3028 context->recover();
3029 ConstantUnion *unionArray = new ConstantUnion[1];
3030 unionArray->setBConst(false);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05003031 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConstExpr), (yyvsp[(2) - (3)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003032 }
3033 }
3034 break;
3035
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003036 case 58:
John Bauman66b8ab22014-05-06 15:57:45 -04003037
3038 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
3039 break;
3040
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003041 case 59:
John Bauman66b8ab22014-05-06 15:57:45 -04003042
3043 {
John Baumand4ae8632014-05-06 16:18:33 -04003044 (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 -04003045 if ((yyval.interm.intermTypedNode) == 0) {
3046 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "||", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3047 context->recover();
3048 ConstantUnion *unionArray = new ConstantUnion[1];
3049 unionArray->setBConst(false);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05003050 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConstExpr), (yyvsp[(2) - (3)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003051 }
3052 }
3053 break;
3054
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003055 case 60:
John Bauman66b8ab22014-05-06 15:57:45 -04003056
3057 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
3058 break;
3059
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003060 case 61:
John Bauman66b8ab22014-05-06 15:57:45 -04003061
3062 {
3063 if (context->boolErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.intermTypedNode)))
3064 context->recover();
3065
3066 (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);
3067 if ((yyvsp[(3) - (5)].interm.intermTypedNode)->getType() != (yyvsp[(5) - (5)].interm.intermTypedNode)->getType())
3068 (yyval.interm.intermTypedNode) = 0;
3069
3070 if ((yyval.interm.intermTypedNode) == 0) {
3071 context->binaryOpError((yyvsp[(2) - (5)].lex).line, ":", (yyvsp[(3) - (5)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(5) - (5)].interm.intermTypedNode)->getCompleteString());
3072 context->recover();
3073 (yyval.interm.intermTypedNode) = (yyvsp[(5) - (5)].interm.intermTypedNode);
3074 }
3075 }
3076 break;
3077
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003078 case 62:
John Bauman66b8ab22014-05-06 15:57:45 -04003079
3080 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
3081 break;
3082
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003083 case 63:
John Bauman66b8ab22014-05-06 15:57:45 -04003084
3085 {
3086 if (context->lValueErrorCheck((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)))
3087 context->recover();
3088 (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);
3089 if ((yyval.interm.intermTypedNode) == 0) {
3090 context->assignError((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3091 context->recover();
3092 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
3093 }
3094 }
3095 break;
3096
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003097 case 64:
John Bauman66b8ab22014-05-06 15:57:45 -04003098
3099 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAssign; }
3100 break;
3101
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003102 case 65:
John Bauman66b8ab22014-05-06 15:57:45 -04003103
3104 { FRAG_VERT_ONLY("*=", (yyvsp[(1) - (1)].lex).line); (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpMulAssign; }
3105 break;
3106
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003107 case 66:
John Bauman66b8ab22014-05-06 15:57:45 -04003108
3109 { FRAG_VERT_ONLY("/=", (yyvsp[(1) - (1)].lex).line); (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpDivAssign; }
3110 break;
3111
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003112 case 67:
John Bauman66b8ab22014-05-06 15:57:45 -04003113
3114 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAddAssign; }
3115 break;
3116
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003117 case 68:
John Bauman66b8ab22014-05-06 15:57:45 -04003118
3119 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpSubAssign; }
3120 break;
3121
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003122 case 69:
John Bauman66b8ab22014-05-06 15:57:45 -04003123
3124 {
3125 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
3126 }
3127 break;
3128
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003129 case 70:
John Bauman66b8ab22014-05-06 15:57:45 -04003130
3131 {
3132 (yyval.interm.intermTypedNode) = context->intermediate.addComma((yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
3133 if ((yyval.interm.intermTypedNode) == 0) {
3134 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ",", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3135 context->recover();
3136 (yyval.interm.intermTypedNode) = (yyvsp[(3) - (3)].interm.intermTypedNode);
3137 }
3138 }
3139 break;
3140
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003141 case 71:
John Bauman66b8ab22014-05-06 15:57:45 -04003142
3143 {
3144 if (context->constErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)))
3145 context->recover();
3146 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
3147 }
3148 break;
3149
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003150 case 72:
John Bauman66b8ab22014-05-06 15:57:45 -04003151
3152 {
3153 TFunction &function = *((yyvsp[(1) - (2)].interm).function);
3154
3155 TIntermAggregate *prototype = new TIntermAggregate;
3156 prototype->setType(function.getReturnType());
3157 prototype->setName(function.getName());
3158
3159 for (int i = 0; i < function.getParamCount(); i++)
3160 {
3161 const TParameter &param = function.getParam(i);
3162 if (param.name != 0)
3163 {
John Baumand4ae8632014-05-06 16:18:33 -04003164 TVariable variable(param.name, *param.type);
John Bauman66b8ab22014-05-06 15:57:45 -04003165
John Baumand4ae8632014-05-06 16:18:33 -04003166 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 -04003167 }
3168 else
3169 {
3170 prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (2)].interm).line), (yyvsp[(1) - (2)].interm).line);
3171 }
3172 }
3173
3174 prototype->setOp(EOpPrototype);
3175 (yyval.interm.intermNode) = prototype;
3176
3177 context->symbolTable.pop();
3178 }
3179 break;
3180
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003181 case 73:
John Bauman66b8ab22014-05-06 15:57:45 -04003182
3183 {
3184 if ((yyvsp[(1) - (2)].interm).intermAggregate)
3185 (yyvsp[(1) - (2)].interm).intermAggregate->setOp(EOpDeclaration);
3186 (yyval.interm.intermNode) = (yyvsp[(1) - (2)].interm).intermAggregate;
3187 }
3188 break;
3189
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003190 case 74:
John Bauman66b8ab22014-05-06 15:57:45 -04003191
3192 {
John Baumand4ae8632014-05-06 16:18:33 -04003193 if (!context->symbolTable.setDefaultPrecision( (yyvsp[(3) - (4)].interm.type), (yyvsp[(2) - (4)].interm.precision) )) {
3194 context->error((yyvsp[(1) - (4)].lex).line, "illegal type argument for default precision qualifier", getBasicString((yyvsp[(3) - (4)].interm.type).type));
3195 context->recover();
3196 }
John Bauman66b8ab22014-05-06 15:57:45 -04003197 (yyval.interm.intermNode) = 0;
3198 }
3199 break;
3200
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003201 case 75:
John Bauman66b8ab22014-05-06 15:57:45 -04003202
3203 {
3204 //
3205 // Multiple declarations of the same function are allowed.
3206 //
3207 // If this is a definition, the definition production code will check for redefinitions
3208 // (we don't know at this point if it's a definition or not).
3209 //
3210 // Redeclarations are allowed. But, return types and parameter qualifiers must match.
3211 //
Nicolas Capens0a7f0c22015-02-18 14:47:31 -05003212 TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find((yyvsp[(1) - (2)].interm.function)->getMangledName(), context->shaderVersion));
John Bauman66b8ab22014-05-06 15:57:45 -04003213 if (prevDec) {
3214 if (prevDec->getReturnType() != (yyvsp[(1) - (2)].interm.function)->getReturnType()) {
3215 context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same return type", (yyvsp[(1) - (2)].interm.function)->getReturnType().getBasicString());
3216 context->recover();
3217 }
3218 for (int i = 0; i < prevDec->getParamCount(); ++i) {
3219 if (prevDec->getParam(i).type->getQualifier() != (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifier()) {
3220 context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same parameter qualifiers", (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifierString());
3221 context->recover();
3222 }
3223 }
3224 }
3225
3226 //
3227 // If this is a redeclaration, it could also be a definition,
3228 // in which case, we want to use the variable names from this one, and not the one that's
3229 // being redeclared. So, pass back up this declaration, not the one in the symbol table.
3230 //
3231 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
3232 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
3233
3234 // We're at the inner scope level of the function's arguments and body statement.
3235 // Add the function prototype to the surrounding scope instead.
3236 context->symbolTable.getOuterLevel()->insert(*(yyval.interm).function);
3237 }
3238 break;
3239
John Bauman66b8ab22014-05-06 15:57:45 -04003240 case 76:
3241
3242 {
3243 (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
3244 }
3245 break;
3246
3247 case 77:
3248
3249 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003250 (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
3251 }
3252 break;
3253
3254 case 78:
3255
3256 {
John Bauman66b8ab22014-05-06 15:57:45 -04003257 // Add the parameter
3258 (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
3259 if ((yyvsp[(2) - (2)].interm).param.type->getBasicType() != EbtVoid)
3260 (yyvsp[(1) - (2)].interm.function)->addParameter((yyvsp[(2) - (2)].interm).param);
3261 else
3262 delete (yyvsp[(2) - (2)].interm).param.type;
3263 }
3264 break;
3265
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003266 case 79:
John Bauman66b8ab22014-05-06 15:57:45 -04003267
3268 {
3269 //
3270 // Only first parameter of one-parameter functions can be void
3271 // The check for named parameters not being void is done in parameter_declarator
3272 //
3273 if ((yyvsp[(3) - (3)].interm).param.type->getBasicType() == EbtVoid) {
3274 //
3275 // This parameter > first is void
3276 //
3277 context->error((yyvsp[(2) - (3)].lex).line, "cannot be an argument type except for '(void)'", "void");
3278 context->recover();
3279 delete (yyvsp[(3) - (3)].interm).param.type;
3280 } else {
3281 // Add the parameter
3282 (yyval.interm.function) = (yyvsp[(1) - (3)].interm.function);
3283 (yyvsp[(1) - (3)].interm.function)->addParameter((yyvsp[(3) - (3)].interm).param);
3284 }
3285 }
3286 break;
3287
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003288 case 80:
John Bauman66b8ab22014-05-06 15:57:45 -04003289
3290 {
3291 if ((yyvsp[(1) - (3)].interm.type).qualifier != EvqGlobal && (yyvsp[(1) - (3)].interm.type).qualifier != EvqTemporary) {
3292 context->error((yyvsp[(2) - (3)].lex).line, "no qualifiers allowed for function return", getQualifierString((yyvsp[(1) - (3)].interm.type).qualifier));
3293 context->recover();
3294 }
3295 // make sure a sampler is not involved as well...
3296 if (context->structQualifierErrorCheck((yyvsp[(2) - (3)].lex).line, (yyvsp[(1) - (3)].interm.type)))
3297 context->recover();
3298
3299 // Add the function as a prototype after parsing it (we do not support recursion)
3300 TFunction *function;
3301 TType type((yyvsp[(1) - (3)].interm.type));
3302 function = new TFunction((yyvsp[(2) - (3)].lex).string, type);
3303 (yyval.interm.function) = function;
3304
3305 context->symbolTable.push();
3306 }
3307 break;
3308
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003309 case 81:
John Bauman66b8ab22014-05-06 15:57:45 -04003310
3311 {
3312 if ((yyvsp[(1) - (2)].interm.type).type == EbtVoid) {
3313 context->error((yyvsp[(2) - (2)].lex).line, "illegal use of type 'void'", (yyvsp[(2) - (2)].lex).string->c_str());
3314 context->recover();
3315 }
3316 if (context->reservedErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string))
3317 context->recover();
3318 TParameter param = {(yyvsp[(2) - (2)].lex).string, new TType((yyvsp[(1) - (2)].interm.type))};
3319 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
3320 (yyval.interm).param = param;
3321 }
3322 break;
3323
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003324 case 82:
John Bauman66b8ab22014-05-06 15:57:45 -04003325
3326 {
3327 // Check that we can make an array out of this type
3328 if (context->arrayTypeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
3329 context->recover();
3330
3331 if (context->reservedErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string))
3332 context->recover();
3333
3334 int size;
3335 if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3336 context->recover();
3337 (yyvsp[(1) - (5)].interm.type).setArray(true, size);
3338
3339 TType* type = new TType((yyvsp[(1) - (5)].interm.type));
3340 TParameter param = { (yyvsp[(2) - (5)].lex).string, type };
3341 (yyval.interm).line = (yyvsp[(2) - (5)].lex).line;
3342 (yyval.interm).param = param;
3343 }
3344 break;
3345
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003346 case 83:
John Bauman66b8ab22014-05-06 15:57:45 -04003347
3348 {
3349 (yyval.interm) = (yyvsp[(3) - (3)].interm);
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003350 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 -04003351 context->recover();
3352 }
3353 break;
3354
John Bauman66b8ab22014-05-06 15:57:45 -04003355 case 84:
3356
3357 {
John Bauman66b8ab22014-05-06 15:57:45 -04003358 (yyval.interm) = (yyvsp[(2) - (2)].interm);
3359 if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
3360 context->recover();
3361 if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
3362 context->recover();
3363 }
3364 break;
3365
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003366 case 85:
3367
3368 {
3369 (yyval.interm) = (yyvsp[(3) - (3)].interm);
3370 if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.qualifier), (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
3371 context->recover();
3372 }
3373 break;
3374
John Bauman66b8ab22014-05-06 15:57:45 -04003375 case 86:
3376
3377 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003378 (yyval.interm) = (yyvsp[(2) - (2)].interm);
3379 if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
3380 context->recover();
3381 if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
3382 context->recover();
John Bauman66b8ab22014-05-06 15:57:45 -04003383 }
3384 break;
3385
3386 case 87:
3387
3388 {
3389 (yyval.interm.qualifier) = EvqIn;
3390 }
3391 break;
3392
3393 case 88:
3394
3395 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003396 (yyval.interm.qualifier) = EvqIn;
John Bauman66b8ab22014-05-06 15:57:45 -04003397 }
3398 break;
3399
3400 case 89:
3401
3402 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003403 (yyval.interm.qualifier) = EvqOut;
John Bauman66b8ab22014-05-06 15:57:45 -04003404 }
3405 break;
3406
3407 case 90:
3408
3409 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003410 (yyval.interm.qualifier) = EvqInOut;
3411 }
3412 break;
3413
3414 case 91:
3415
3416 {
John Bauman66b8ab22014-05-06 15:57:45 -04003417 TParameter param = { 0, new TType((yyvsp[(1) - (1)].interm.type)) };
3418 (yyval.interm).param = param;
3419 }
3420 break;
3421
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003422 case 92:
John Bauman66b8ab22014-05-06 15:57:45 -04003423
3424 {
3425 (yyval.interm) = (yyvsp[(1) - (1)].interm);
3426 }
3427 break;
3428
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003429 case 93:
John Bauman66b8ab22014-05-06 15:57:45 -04003430
3431 {
3432 if ((yyvsp[(1) - (3)].interm).type.type == EbtInvariant && !(yyvsp[(3) - (3)].lex).symbol)
3433 {
3434 context->error((yyvsp[(3) - (3)].lex).line, "undeclared identifier declared as invariant", (yyvsp[(3) - (3)].lex).string->c_str());
3435 context->recover();
3436 }
3437
3438 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(3) - (3)].lex).string, TType((yyvsp[(1) - (3)].interm).type), (yyvsp[(3) - (3)].lex).line);
3439 (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermNode, symbol, (yyvsp[(3) - (3)].lex).line);
3440
3441 if (context->structQualifierErrorCheck((yyvsp[(3) - (3)].lex).line, (yyval.interm).type))
3442 context->recover();
3443
3444 if (context->nonInitConstErrorCheck((yyvsp[(3) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyval.interm).type, false))
3445 context->recover();
3446
3447 TVariable* variable = 0;
3448 if (context->nonInitErrorCheck((yyvsp[(3) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyval.interm).type, variable))
3449 context->recover();
3450 if (symbol && variable)
3451 symbol->setId(variable->getUniqueId());
3452 }
3453 break;
3454
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003455 case 94:
John Bauman66b8ab22014-05-06 15:57:45 -04003456
3457 {
3458 if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
3459 context->recover();
3460
3461 if (context->nonInitConstErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, true))
3462 context->recover();
3463
3464 (yyval.interm) = (yyvsp[(1) - (5)].interm);
3465
3466 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))
3467 context->recover();
3468 else {
3469 (yyvsp[(1) - (5)].interm).type.setArray(true);
3470 TVariable* variable;
3471 if (context->arrayErrorCheck((yyvsp[(4) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, variable))
3472 context->recover();
3473 }
3474 }
3475 break;
3476
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003477 case 95:
John Bauman66b8ab22014-05-06 15:57:45 -04003478
3479 {
3480 if (context->structQualifierErrorCheck((yyvsp[(3) - (6)].lex).line, (yyvsp[(1) - (6)].interm).type))
3481 context->recover();
3482
3483 if (context->nonInitConstErrorCheck((yyvsp[(3) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type, true))
3484 context->recover();
3485
3486 (yyval.interm) = (yyvsp[(1) - (6)].interm);
3487
3488 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))
3489 context->recover();
3490 else {
3491 int size;
3492 if (context->arraySizeErrorCheck((yyvsp[(4) - (6)].lex).line, (yyvsp[(5) - (6)].interm.intermTypedNode), size))
3493 context->recover();
3494 (yyvsp[(1) - (6)].interm).type.setArray(true, size);
3495 TVariable* variable = 0;
3496 if (context->arrayErrorCheck((yyvsp[(4) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type, variable))
3497 context->recover();
3498 TType type = TType((yyvsp[(1) - (6)].interm).type);
3499 type.setArraySize(size);
3500 (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);
3501 }
3502 }
3503 break;
3504
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003505 case 96:
John Bauman66b8ab22014-05-06 15:57:45 -04003506
3507 {
3508 if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
3509 context->recover();
3510
3511 (yyval.interm) = (yyvsp[(1) - (5)].interm);
3512
3513 TIntermNode* intermNode;
3514 if (!context->executeInitializer((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, (yyvsp[(5) - (5)].interm.intermTypedNode), intermNode)) {
3515 //
3516 // build the intermediate representation
3517 //
3518 if (intermNode)
3519 (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (5)].interm).intermNode, intermNode, (yyvsp[(4) - (5)].lex).line);
3520 else
3521 (yyval.interm).intermAggregate = (yyvsp[(1) - (5)].interm).intermAggregate;
3522 } else {
3523 context->recover();
3524 (yyval.interm).intermAggregate = 0;
3525 }
3526 }
3527 break;
3528
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003529 case 97:
John Bauman66b8ab22014-05-06 15:57:45 -04003530
3531 {
3532 (yyval.interm).type = (yyvsp[(1) - (1)].interm.type);
3533 (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);
3534 }
3535 break;
3536
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003537 case 98:
John Bauman66b8ab22014-05-06 15:57:45 -04003538
3539 {
3540 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyvsp[(1) - (2)].interm.type)), (yyvsp[(2) - (2)].lex).line);
3541 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (2)].lex).line);
3542
3543 if (context->structQualifierErrorCheck((yyvsp[(2) - (2)].lex).line, (yyval.interm).type))
3544 context->recover();
3545
3546 if (context->nonInitConstErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string, (yyval.interm).type, false))
3547 context->recover();
3548
3549 (yyval.interm).type = (yyvsp[(1) - (2)].interm.type);
3550
3551 TVariable* variable = 0;
3552 if (context->nonInitErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string, (yyval.interm).type, variable))
3553 context->recover();
3554 if (variable && symbol)
3555 symbol->setId(variable->getUniqueId());
3556 }
3557 break;
3558
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003559 case 99:
John Bauman66b8ab22014-05-06 15:57:45 -04003560
3561 {
3562 context->error((yyvsp[(2) - (4)].lex).line, "unsized array declarations not supported", (yyvsp[(2) - (4)].lex).string->c_str());
3563 context->recover();
3564
3565 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (4)].lex).string, TType((yyvsp[(1) - (4)].interm.type)), (yyvsp[(2) - (4)].lex).line);
3566 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (4)].lex).line);
3567 (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
3568 }
3569 break;
3570
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003571 case 100:
John Bauman66b8ab22014-05-06 15:57:45 -04003572
3573 {
3574 TType type = TType((yyvsp[(1) - (5)].interm.type));
3575 int size;
3576 if (context->arraySizeErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3577 context->recover();
3578 type.setArraySize(size);
3579 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (5)].lex).string, type, (yyvsp[(2) - (5)].lex).line);
3580 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (5)].lex).line);
3581
3582 if (context->structQualifierErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
3583 context->recover();
3584
3585 if (context->nonInitConstErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type), true))
3586 context->recover();
3587
3588 (yyval.interm).type = (yyvsp[(1) - (5)].interm.type);
3589
3590 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)))
3591 context->recover();
3592 else {
3593 int size;
3594 if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3595 context->recover();
3596
3597 (yyvsp[(1) - (5)].interm.type).setArray(true, size);
3598 TVariable* variable = 0;
3599 if (context->arrayErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type), variable))
3600 context->recover();
3601 if (variable && symbol)
3602 symbol->setId(variable->getUniqueId());
3603 }
3604 }
3605 break;
3606
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003607 case 101:
John Bauman66b8ab22014-05-06 15:57:45 -04003608
3609 {
3610 if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
3611 context->recover();
3612
3613 (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
3614
3615 TIntermNode* intermNode;
3616 if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode)) {
3617 //
3618 // Build intermediate representation
3619 //
3620 if(intermNode)
3621 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(intermNode, (yyvsp[(3) - (4)].lex).line);
3622 else
3623 (yyval.interm).intermAggregate = 0;
3624 } else {
3625 context->recover();
3626 (yyval.interm).intermAggregate = 0;
3627 }
3628 }
3629 break;
3630
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003631 case 102:
John Bauman66b8ab22014-05-06 15:57:45 -04003632
3633 {
John Bauman66b8ab22014-05-06 15:57:45 -04003634 if (context->globalErrorCheck((yyvsp[(1) - (2)].lex).line, context->symbolTable.atGlobalLevel(), "invariant varying"))
3635 context->recover();
3636 (yyval.interm).type.setBasic(EbtInvariant, EvqInvariantVaryingOut, (yyvsp[(2) - (2)].lex).line);
3637 if (!(yyvsp[(2) - (2)].lex).symbol)
3638 {
3639 context->error((yyvsp[(2) - (2)].lex).line, "undeclared identifier declared as invariant", (yyvsp[(2) - (2)].lex).string->c_str());
3640 context->recover();
3641
3642 (yyval.interm).intermAggregate = 0;
3643 }
3644 else
3645 {
3646 TIntermSymbol *symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyval.interm).type), (yyvsp[(2) - (2)].lex).line);
3647 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (2)].lex).line);
3648 }
3649 }
3650 break;
3651
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003652 case 103:
John Bauman66b8ab22014-05-06 15:57:45 -04003653
3654 {
3655 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3656
3657 if ((yyvsp[(1) - (1)].interm.type).array) {
3658 context->error((yyvsp[(1) - (1)].interm.type).line, "not supported", "first-class array");
3659 context->recover();
3660 (yyvsp[(1) - (1)].interm.type).setArray(false);
3661 }
3662 }
3663 break;
3664
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003665 case 104:
John Bauman66b8ab22014-05-06 15:57:45 -04003666
3667 {
3668 if ((yyvsp[(2) - (2)].interm.type).array) {
3669 context->error((yyvsp[(2) - (2)].interm.type).line, "not supported", "first-class array");
3670 context->recover();
3671 (yyvsp[(2) - (2)].interm.type).setArray(false);
3672 }
3673
3674 if ((yyvsp[(1) - (2)].interm.type).qualifier == EvqAttribute &&
3675 ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
3676 context->error((yyvsp[(2) - (2)].interm.type).line, "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier));
3677 context->recover();
3678 }
3679 if (((yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingIn || (yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingOut) &&
3680 ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
3681 context->error((yyvsp[(2) - (2)].interm.type).line, "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier));
3682 context->recover();
3683 }
3684 (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
3685 (yyval.interm.type).qualifier = (yyvsp[(1) - (2)].interm.type).qualifier;
3686 }
3687 break;
3688
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003689 case 105:
John Bauman66b8ab22014-05-06 15:57:45 -04003690
3691 {
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05003692 (yyval.interm.qualifier) = EvqConstExpr;
John Bauman66b8ab22014-05-06 15:57:45 -04003693 }
3694 break;
3695
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003696 case 106:
John Bauman66b8ab22014-05-06 15:57:45 -04003697
3698 {
3699 VERTEX_ONLY("attribute", (yyvsp[(1) - (1)].lex).line);
Nicolas Capensc6841852015-02-15 14:25:37 -05003700 ES2_ONLY("attribute", (yyvsp[(1) - (1)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003701 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "attribute"))
3702 context->recover();
3703 (yyval.interm.type).setBasic(EbtVoid, EvqAttribute, (yyvsp[(1) - (1)].lex).line);
3704 }
3705 break;
3706
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003707 case 107:
John Bauman66b8ab22014-05-06 15:57:45 -04003708
3709 {
Nicolas Capensc6841852015-02-15 14:25:37 -05003710 ES2_ONLY("varying", (yyvsp[(1) - (1)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003711 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "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, EvqVaryingOut, (yyvsp[(1) - (1)].lex).line);
3715 else
3716 (yyval.interm.type).setBasic(EbtVoid, EvqVaryingIn, (yyvsp[(1) - (1)].lex).line);
3717 }
3718 break;
3719
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003720 case 108:
John Bauman66b8ab22014-05-06 15:57:45 -04003721
3722 {
Nicolas Capensc6841852015-02-15 14:25:37 -05003723 ES2_ONLY("varying", (yyvsp[(1) - (2)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003724 if (context->globalErrorCheck((yyvsp[(1) - (2)].lex).line, context->symbolTable.atGlobalLevel(), "invariant varying"))
3725 context->recover();
Nicolas Capens08ca3c62015-02-13 16:06:45 -05003726 if (context->shaderType == GL_VERTEX_SHADER)
John Bauman66b8ab22014-05-06 15:57:45 -04003727 (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingOut, (yyvsp[(1) - (2)].lex).line);
3728 else
3729 (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingIn, (yyvsp[(1) - (2)].lex).line);
3730 }
3731 break;
3732
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003733 case 109:
John Bauman66b8ab22014-05-06 15:57:45 -04003734
3735 {
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003736 (yyval.interm.type).setBasic(EbtVoid, (yyvsp[(1) - (1)].interm.type).qualifier, (yyvsp[(1) - (1)].interm.type).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003737 }
3738 break;
3739
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003740 case 110:
John Bauman66b8ab22014-05-06 15:57:45 -04003741
3742 {
Nicolas Capens7d626792015-02-17 17:58:31 -05003743 (yyval.interm.type).qualifier = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3744 (yyval.interm.type).layoutQualifier = (yyvsp[(1) - (1)].interm.layoutQualifier);
3745 }
3746 break;
3747
3748 case 111:
3749
3750 {
3751 (yyval.interm.type).setBasic(EbtVoid, (yyvsp[(2) - (2)].interm.type).qualifier, (yyvsp[(2) - (2)].interm.type).line);
3752 (yyval.interm.type).layoutQualifier = (yyvsp[(1) - (2)].interm.layoutQualifier);
3753 }
3754 break;
3755
3756 case 112:
3757
3758 {
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05003759 (yyval.interm.type).qualifier = EvqConstExpr;
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003760 (yyval.interm.type).line = (yyvsp[(1) - (1)].lex).line;
3761 }
3762 break;
3763
Nicolas Capens7d626792015-02-17 17:58:31 -05003764 case 113:
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003765
3766 {
3767 ES3_ONLY("in", (yyvsp[(1) - (1)].lex).line);
3768 (yyval.interm.type).qualifier = (context->shaderType == GL_FRAGMENT_SHADER) ? EvqVaryingIn : EvqAttribute;
3769 (yyval.interm.type).line = (yyvsp[(1) - (1)].lex).line;
3770 }
3771 break;
3772
Nicolas Capens7d626792015-02-17 17:58:31 -05003773 case 114:
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003774
3775 {
3776 ES3_ONLY("out", (yyvsp[(1) - (1)].lex).line);
3777 (yyval.interm.type).qualifier = (context->shaderType == GL_FRAGMENT_SHADER) ? EvqFragColor : EvqVaryingOut;
3778 (yyval.interm.type).line = (yyvsp[(1) - (1)].lex).line;
3779 }
3780 break;
3781
Nicolas Capens7d626792015-02-17 17:58:31 -05003782 case 115:
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003783
3784 {
3785 ES3_ONLY("in", (yyvsp[(1) - (2)].lex).line);
3786 // FIXME: Handle centroid qualifier
3787 (yyval.interm.type).qualifier = (context->shaderType == GL_FRAGMENT_SHADER) ? EvqVaryingIn : EvqAttribute;
3788 (yyval.interm.type).line = (yyvsp[(2) - (2)].lex).line;
3789 }
3790 break;
3791
Nicolas Capens7d626792015-02-17 17:58:31 -05003792 case 116:
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003793
3794 {
3795 ES3_ONLY("out", (yyvsp[(1) - (2)].lex).line);
3796 // FIXME: Handle centroid qualifier
3797 (yyval.interm.type).qualifier = (context->shaderType == GL_FRAGMENT_SHADER) ? EvqFragColor : EvqVaryingOut;
3798 (yyval.interm.type).line = (yyvsp[(2) - (2)].lex).line;
3799 }
3800 break;
3801
Nicolas Capens7d626792015-02-17 17:58:31 -05003802 case 117:
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003803
3804 {
3805 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "uniform"))
3806 context->recover();
3807 (yyval.interm.type).qualifier = EvqUniform;
3808 (yyval.interm.type).line = (yyvsp[(1) - (1)].lex).line;
3809 }
3810 break;
3811
Nicolas Capens7d626792015-02-17 17:58:31 -05003812 case 118:
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003813
3814 {
John Bauman66b8ab22014-05-06 15:57:45 -04003815 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3816
3817 if ((yyval.interm.type).precision == EbpUndefined) {
3818 (yyval.interm.type).precision = context->symbolTable.getDefaultPrecision((yyvsp[(1) - (1)].interm.type).type);
3819 if (context->precisionErrorCheck((yyvsp[(1) - (1)].interm.type).line, (yyval.interm.type).precision, (yyvsp[(1) - (1)].interm.type).type)) {
3820 context->recover();
3821 }
3822 }
3823 }
3824 break;
3825
Nicolas Capens7d626792015-02-17 17:58:31 -05003826 case 119:
John Bauman66b8ab22014-05-06 15:57:45 -04003827
3828 {
3829 (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
3830 (yyval.interm.type).precision = (yyvsp[(1) - (2)].interm.precision);
3831 }
3832 break;
3833
Nicolas Capens7d626792015-02-17 17:58:31 -05003834 case 120:
John Bauman66b8ab22014-05-06 15:57:45 -04003835
3836 {
3837 (yyval.interm.precision) = EbpHigh;
3838 }
3839 break;
3840
Nicolas Capens7d626792015-02-17 17:58:31 -05003841 case 121:
John Bauman66b8ab22014-05-06 15:57:45 -04003842
3843 {
3844 (yyval.interm.precision) = EbpMedium;
3845 }
3846 break;
3847
Nicolas Capens7d626792015-02-17 17:58:31 -05003848 case 122:
John Bauman66b8ab22014-05-06 15:57:45 -04003849
3850 {
3851 (yyval.interm.precision) = EbpLow;
3852 }
3853 break;
3854
Nicolas Capens7d626792015-02-17 17:58:31 -05003855 case 123:
3856
3857 {
3858 ES3_ONLY("layout", (yyvsp[(1) - (4)].lex).line);
3859 (yyval.interm.layoutQualifier) = (yyvsp[(3) - (4)].interm.layoutQualifier);
3860 }
3861 break;
3862
3863 case 124:
3864
3865 {
3866 (yyval.interm.layoutQualifier) = (yyvsp[(1) - (1)].interm.layoutQualifier);
3867 }
3868 break;
3869
3870 case 125:
3871
3872 {
3873 (yyval.interm.layoutQualifier) = context->joinLayoutQualifiers((yyvsp[(1) - (3)].interm.layoutQualifier), (yyvsp[(3) - (3)].interm.layoutQualifier));
3874 }
3875 break;
3876
3877 case 126:
3878
3879 {
3880 (yyval.interm.layoutQualifier) = context->parseLayoutQualifier(*(yyvsp[(1) - (1)].lex).string, (yyvsp[(1) - (1)].lex).line);
3881 }
3882 break;
3883
3884 case 127:
3885
3886 {
3887 (yyval.interm.layoutQualifier) = context->parseLayoutQualifier(*(yyvsp[(1) - (3)].lex).string, (yyvsp[(1) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyvsp[(3) - (3)].lex).i, (yyvsp[(3) - (3)].lex).line);
3888 }
3889 break;
3890
3891 case 128:
3892
3893 {
3894 (yyval.interm.layoutQualifier) = context->parseLayoutQualifier(*(yyvsp[(1) - (3)].lex).string, (yyvsp[(1) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyvsp[(3) - (3)].lex).i, (yyvsp[(3) - (3)].lex).line);
3895 }
3896 break;
3897
3898 case 129:
John Bauman66b8ab22014-05-06 15:57:45 -04003899
3900 {
3901 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3902 }
3903 break;
3904
Nicolas Capens7d626792015-02-17 17:58:31 -05003905 case 130:
John Bauman66b8ab22014-05-06 15:57:45 -04003906
3907 {
3908 (yyval.interm.type) = (yyvsp[(1) - (4)].interm.type);
3909
3910 if (context->arrayTypeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
3911 context->recover();
3912 else {
3913 int size;
3914 if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
3915 context->recover();
3916 (yyval.interm.type).setArray(true, size);
3917 }
3918 }
3919 break;
3920
Nicolas Capens7d626792015-02-17 17:58:31 -05003921 case 131:
John Bauman66b8ab22014-05-06 15:57:45 -04003922
3923 {
3924 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3925 (yyval.interm.type).setBasic(EbtVoid, qual, (yyvsp[(1) - (1)].lex).line);
3926 }
3927 break;
3928
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003929 case 132:
3930
3931 {
3932 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
Nicolas Capens7d626792015-02-17 17:58:31 -05003933 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003934 }
3935 break;
3936
3937 case 133:
3938
3939 {
3940 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
Nicolas Capens7d626792015-02-17 17:58:31 -05003941 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003942 }
3943 break;
3944
3945 case 134:
3946
3947 {
3948 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
Nicolas Capens7d626792015-02-17 17:58:31 -05003949 (yyval.interm.type).setBasic(EbtUInt, qual, (yyvsp[(1) - (1)].lex).line);
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003950 }
3951 break;
3952
3953 case 135:
3954
3955 {
Nicolas Capens3c20f802015-02-17 17:17:20 -05003956 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
Nicolas Capens7d626792015-02-17 17:58:31 -05003957 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3958 }
3959 break;
3960
3961 case 136:
3962
3963 {
3964 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3965 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3966 (yyval.interm.type).setAggregate(2);
3967 }
3968 break;
3969
3970 case 137:
3971
3972 {
3973 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3974 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3975 (yyval.interm.type).setAggregate(3);
3976 }
3977 break;
3978
3979 case 138:
3980
3981 {
3982 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3983 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3984 (yyval.interm.type).setAggregate(4);
3985 }
3986 break;
3987
3988 case 139:
3989
3990 {
3991 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3992 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3993 (yyval.interm.type).setAggregate(2);
3994 }
3995 break;
3996
3997 case 140:
3998
3999 {
4000 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4001 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
4002 (yyval.interm.type).setAggregate(3);
4003 }
4004 break;
4005
4006 case 141:
4007
4008 {
4009 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4010 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
4011 (yyval.interm.type).setAggregate(4);
4012 }
4013 break;
4014
4015 case 142:
4016
4017 {
4018 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4019 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
4020 (yyval.interm.type).setAggregate(2);
4021 }
4022 break;
4023
4024 case 143:
4025
4026 {
4027 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
Nicolas Capens3c20f802015-02-17 17:17:20 -05004028 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004029 (yyval.interm.type).setAggregate(3);
Nicolas Capens3c20f802015-02-17 17:17:20 -05004030 }
4031 break;
4032
Nicolas Capens7d626792015-02-17 17:58:31 -05004033 case 144:
Nicolas Capens3c20f802015-02-17 17:17:20 -05004034
4035 {
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004036 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004037 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
4038 (yyval.interm.type).setAggregate(4);
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004039 }
4040 break;
4041
Nicolas Capens7d626792015-02-17 17:58:31 -05004042 case 145:
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004043
4044 {
4045 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4046 (yyval.interm.type).setBasic(EbtUInt, qual, (yyvsp[(1) - (1)].lex).line);
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004047 (yyval.interm.type).setAggregate(2);
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004048 }
4049 break;
4050
Nicolas Capens7d626792015-02-17 17:58:31 -05004051 case 146:
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004052
4053 {
4054 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4055 (yyval.interm.type).setBasic(EbtUInt, qual, (yyvsp[(1) - (1)].lex).line);
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004056 (yyval.interm.type).setAggregate(3);
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004057 }
4058 break;
4059
Nicolas Capens7d626792015-02-17 17:58:31 -05004060 case 147:
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004061
4062 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004063 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4064 (yyval.interm.type).setBasic(EbtUInt, qual, (yyvsp[(1) - (1)].lex).line);
4065 (yyval.interm.type).setAggregate(4);
4066 }
4067 break;
4068
Nicolas Capens7d626792015-02-17 17:58:31 -05004069 case 148:
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004070
4071 {
John Bauman66b8ab22014-05-06 15:57:45 -04004072 FRAG_VERT_ONLY("mat2", (yyvsp[(1) - (1)].lex).line);
4073 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4074 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
4075 (yyval.interm.type).setAggregate(2, true);
4076 }
4077 break;
4078
Nicolas Capens7d626792015-02-17 17:58:31 -05004079 case 149:
John Bauman66b8ab22014-05-06 15:57:45 -04004080
4081 {
4082 FRAG_VERT_ONLY("mat3", (yyvsp[(1) - (1)].lex).line);
4083 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4084 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
4085 (yyval.interm.type).setAggregate(3, true);
4086 }
4087 break;
4088
Nicolas Capens7d626792015-02-17 17:58:31 -05004089 case 150:
John Bauman66b8ab22014-05-06 15:57:45 -04004090
4091 {
4092 FRAG_VERT_ONLY("mat4", (yyvsp[(1) - (1)].lex).line);
4093 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4094 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
4095 (yyval.interm.type).setAggregate(4, true);
4096 }
4097 break;
4098
Nicolas Capens7d626792015-02-17 17:58:31 -05004099 case 151:
John Bauman66b8ab22014-05-06 15:57:45 -04004100
4101 {
4102 FRAG_VERT_ONLY("sampler2D", (yyvsp[(1) - (1)].lex).line);
4103 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4104 (yyval.interm.type).setBasic(EbtSampler2D, qual, (yyvsp[(1) - (1)].lex).line);
4105 }
4106 break;
4107
Nicolas Capens7d626792015-02-17 17:58:31 -05004108 case 152:
John Bauman66b8ab22014-05-06 15:57:45 -04004109
4110 {
4111 FRAG_VERT_ONLY("samplerCube", (yyvsp[(1) - (1)].lex).line);
4112 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4113 (yyval.interm.type).setBasic(EbtSamplerCube, qual, (yyvsp[(1) - (1)].lex).line);
4114 }
4115 break;
4116
Nicolas Capens7d626792015-02-17 17:58:31 -05004117 case 153:
John Bauman66b8ab22014-05-06 15:57:45 -04004118
4119 {
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04004120 if (!context->supportsExtension("GL_OES_EGL_image_external")) {
4121 context->error((yyvsp[(1) - (1)].lex).line, "unsupported type", "samplerExternalOES", "");
4122 context->recover();
4123 }
4124 FRAG_VERT_ONLY("samplerExternalOES", (yyvsp[(1) - (1)].lex).line);
4125 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4126 (yyval.interm.type).setBasic(EbtSamplerExternalOES, qual, (yyvsp[(1) - (1)].lex).line);
4127 }
4128 break;
4129
Nicolas Capens7d626792015-02-17 17:58:31 -05004130 case 154:
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04004131
4132 {
Alexis Hetub027aa92015-01-19 15:56:12 -05004133 FRAG_VERT_ONLY("sampler3D", (yyvsp[(1) - (1)].lex).line);
4134 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4135 (yyval.interm.type).setBasic(EbtSampler3D, qual, (yyvsp[(1) - (1)].lex).line);
4136 }
4137 break;
4138
Nicolas Capens7d626792015-02-17 17:58:31 -05004139 case 155:
Alexis Hetub027aa92015-01-19 15:56:12 -05004140
4141 {
John Bauman66b8ab22014-05-06 15:57:45 -04004142 FRAG_VERT_ONLY("struct", (yyvsp[(1) - (1)].interm.type).line);
4143 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
4144 (yyval.interm.type).qualifier = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4145 }
4146 break;
4147
Nicolas Capens7d626792015-02-17 17:58:31 -05004148 case 156:
John Bauman66b8ab22014-05-06 15:57:45 -04004149
4150 {
4151 //
4152 // This is for user defined type names. The lexical phase looked up the
4153 // type.
4154 //
4155 TType& structure = static_cast<TVariable*>((yyvsp[(1) - (1)].lex).symbol)->getType();
4156 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4157 (yyval.interm.type).setBasic(EbtStruct, qual, (yyvsp[(1) - (1)].lex).line);
4158 (yyval.interm.type).userDef = &structure;
4159 }
4160 break;
4161
Nicolas Capens7d626792015-02-17 17:58:31 -05004162 case 157:
John Bauman66b8ab22014-05-06 15:57:45 -04004163
4164 { if (context->enterStructDeclaration((yyvsp[(2) - (3)].lex).line, *(yyvsp[(2) - (3)].lex).string)) context->recover(); }
4165 break;
4166
Nicolas Capens7d626792015-02-17 17:58:31 -05004167 case 158:
John Bauman66b8ab22014-05-06 15:57:45 -04004168
4169 {
4170 if (context->reservedErrorCheck((yyvsp[(2) - (6)].lex).line, *(yyvsp[(2) - (6)].lex).string))
4171 context->recover();
4172
4173 TType* structure = new TType((yyvsp[(5) - (6)].interm.typeList), *(yyvsp[(2) - (6)].lex).string);
4174 TVariable* userTypeDef = new TVariable((yyvsp[(2) - (6)].lex).string, *structure, true);
Nicolas Capensd603ecd2015-02-18 14:52:21 -05004175 if (! context->symbolTable.declare(*userTypeDef)) {
John Bauman66b8ab22014-05-06 15:57:45 -04004176 context->error((yyvsp[(2) - (6)].lex).line, "redefinition", (yyvsp[(2) - (6)].lex).string->c_str(), "struct");
4177 context->recover();
4178 }
4179 (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (6)].lex).line);
4180 (yyval.interm.type).userDef = structure;
4181 context->exitStructDeclaration();
4182 }
4183 break;
4184
Nicolas Capens7d626792015-02-17 17:58:31 -05004185 case 159:
John Bauman66b8ab22014-05-06 15:57:45 -04004186
4187 { if (context->enterStructDeclaration((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string)) context->recover(); }
4188 break;
4189
Nicolas Capens7d626792015-02-17 17:58:31 -05004190 case 160:
John Bauman66b8ab22014-05-06 15:57:45 -04004191
4192 {
4193 TType* structure = new TType((yyvsp[(4) - (5)].interm.typeList), TString(""));
4194 (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (5)].lex).line);
4195 (yyval.interm.type).userDef = structure;
4196 context->exitStructDeclaration();
4197 }
4198 break;
4199
Nicolas Capens7d626792015-02-17 17:58:31 -05004200 case 161:
John Bauman66b8ab22014-05-06 15:57:45 -04004201
4202 {
4203 (yyval.interm.typeList) = (yyvsp[(1) - (1)].interm.typeList);
4204 }
4205 break;
4206
Nicolas Capens7d626792015-02-17 17:58:31 -05004207 case 162:
John Bauman66b8ab22014-05-06 15:57:45 -04004208
4209 {
4210 (yyval.interm.typeList) = (yyvsp[(1) - (2)].interm.typeList);
4211 for (unsigned int i = 0; i < (yyvsp[(2) - (2)].interm.typeList)->size(); ++i) {
4212 for (unsigned int j = 0; j < (yyval.interm.typeList)->size(); ++j) {
4213 if ((*(yyval.interm.typeList))[j].type->getFieldName() == (*(yyvsp[(2) - (2)].interm.typeList))[i].type->getFieldName()) {
4214 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());
4215 context->recover();
4216 }
4217 }
4218 (yyval.interm.typeList)->push_back((*(yyvsp[(2) - (2)].interm.typeList))[i]);
4219 }
4220 }
4221 break;
4222
Nicolas Capens7d626792015-02-17 17:58:31 -05004223 case 163:
John Bauman66b8ab22014-05-06 15:57:45 -04004224
4225 {
4226 (yyval.interm.typeList) = (yyvsp[(2) - (3)].interm.typeList);
4227
4228 if (context->voidErrorCheck((yyvsp[(1) - (3)].interm.type).line, (*(yyvsp[(2) - (3)].interm.typeList))[0].type->getFieldName(), (yyvsp[(1) - (3)].interm.type))) {
4229 context->recover();
4230 }
4231 for (unsigned int i = 0; i < (yyval.interm.typeList)->size(); ++i) {
4232 //
4233 // Careful not to replace already known aspects of type, like array-ness
4234 //
4235 TType* type = (*(yyval.interm.typeList))[i].type;
4236 type->setBasicType((yyvsp[(1) - (3)].interm.type).type);
4237 type->setNominalSize((yyvsp[(1) - (3)].interm.type).size);
4238 type->setMatrix((yyvsp[(1) - (3)].interm.type).matrix);
4239 type->setPrecision((yyvsp[(1) - (3)].interm.type).precision);
4240
4241 // don't allow arrays of arrays
4242 if (type->isArray()) {
4243 if (context->arrayTypeErrorCheck((yyvsp[(1) - (3)].interm.type).line, (yyvsp[(1) - (3)].interm.type)))
4244 context->recover();
4245 }
4246 if ((yyvsp[(1) - (3)].interm.type).array)
4247 type->setArraySize((yyvsp[(1) - (3)].interm.type).arraySize);
4248 if ((yyvsp[(1) - (3)].interm.type).userDef) {
4249 type->setStruct((yyvsp[(1) - (3)].interm.type).userDef->getStruct());
4250 type->setTypeName((yyvsp[(1) - (3)].interm.type).userDef->getTypeName());
4251 }
John Bauman66b8ab22014-05-06 15:57:45 -04004252 }
4253 }
4254 break;
4255
Nicolas Capens7d626792015-02-17 17:58:31 -05004256 case 164:
John Bauman66b8ab22014-05-06 15:57:45 -04004257
4258 {
4259 (yyval.interm.typeList) = NewPoolTTypeList();
4260 (yyval.interm.typeList)->push_back((yyvsp[(1) - (1)].interm.typeLine));
4261 }
4262 break;
4263
Nicolas Capens7d626792015-02-17 17:58:31 -05004264 case 165:
John Bauman66b8ab22014-05-06 15:57:45 -04004265
4266 {
4267 (yyval.interm.typeList)->push_back((yyvsp[(3) - (3)].interm.typeLine));
4268 }
4269 break;
4270
Nicolas Capens7d626792015-02-17 17:58:31 -05004271 case 166:
John Bauman66b8ab22014-05-06 15:57:45 -04004272
4273 {
4274 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
4275 context->recover();
4276
4277 (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
4278 (yyval.interm.typeLine).line = (yyvsp[(1) - (1)].lex).line;
4279 (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (1)].lex).string);
4280 }
4281 break;
4282
Nicolas Capens7d626792015-02-17 17:58:31 -05004283 case 167:
John Bauman66b8ab22014-05-06 15:57:45 -04004284
4285 {
4286 if (context->reservedErrorCheck((yyvsp[(1) - (4)].lex).line, *(yyvsp[(1) - (4)].lex).string))
4287 context->recover();
4288
4289 (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
4290 (yyval.interm.typeLine).line = (yyvsp[(1) - (4)].lex).line;
4291 (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (4)].lex).string);
4292
4293 int size;
4294 if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
4295 context->recover();
4296 (yyval.interm.typeLine).type->setArraySize(size);
4297 }
4298 break;
4299
Nicolas Capens7d626792015-02-17 17:58:31 -05004300 case 168:
John Bauman66b8ab22014-05-06 15:57:45 -04004301
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004302 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04004303 break;
4304
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004305 case 169:
4306
Nicolas Capens7d626792015-02-17 17:58:31 -05004307 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004308 break;
4309
4310 case 170:
4311
Nicolas Capens7d626792015-02-17 17:58:31 -05004312 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermAggregate); }
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004313 break;
4314
4315 case 171:
4316
Nicolas Capens7d626792015-02-17 17:58:31 -05004317 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004318 break;
4319
4320 case 172:
4321
Nicolas Capens7d626792015-02-17 17:58:31 -05004322 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
Alexis Hetub027aa92015-01-19 15:56:12 -05004323 break;
4324
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05004325 case 173:
4326
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004327 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05004328 break;
4329
4330 case 174:
4331
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004332 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
Nicolas Capens3c20f802015-02-17 17:17:20 -05004333 break;
4334
4335 case 175:
4336
Nicolas Capens7d626792015-02-17 17:58:31 -05004337 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004338 break;
4339
4340 case 176:
4341
Nicolas Capens7d626792015-02-17 17:58:31 -05004342 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004343 break;
4344
4345 case 177:
4346
Nicolas Capens7d626792015-02-17 17:58:31 -05004347 { (yyval.interm.intermAggregate) = 0; }
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004348 break;
4349
4350 case 178:
4351
Nicolas Capens7d626792015-02-17 17:58:31 -05004352 { context->symbolTable.push(); }
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004353 break;
4354
4355 case 179:
4356
Nicolas Capens7d626792015-02-17 17:58:31 -05004357 { context->symbolTable.pop(); }
4358 break;
4359
4360 case 180:
4361
4362 {
4363 if ((yyvsp[(3) - (5)].interm.intermAggregate) != 0) {
4364 (yyvsp[(3) - (5)].interm.intermAggregate)->setOp(EOpSequence);
4365 (yyvsp[(3) - (5)].interm.intermAggregate)->setEndLine((yyvsp[(5) - (5)].lex).line);
4366 }
4367 (yyval.interm.intermAggregate) = (yyvsp[(3) - (5)].interm.intermAggregate);
4368 }
4369 break;
4370
4371 case 181:
4372
4373 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
4374 break;
4375
4376 case 182:
4377
4378 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
4379 break;
4380
4381 case 183:
4382
4383 { context->symbolTable.push(); }
4384 break;
4385
4386 case 184:
4387
4388 { context->symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[(2) - (2)].interm.intermNode); }
4389 break;
4390
4391 case 185:
4392
4393 { context->symbolTable.push(); }
4394 break;
4395
4396 case 186:
4397
4398 { context->symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[(2) - (2)].interm.intermNode); }
4399 break;
4400
4401 case 187:
4402
John Bauman66b8ab22014-05-06 15:57:45 -04004403 {
4404 (yyval.interm.intermNode) = 0;
4405 }
4406 break;
4407
Nicolas Capens7d626792015-02-17 17:58:31 -05004408 case 188:
John Bauman66b8ab22014-05-06 15:57:45 -04004409
4410 {
4411 if ((yyvsp[(2) - (3)].interm.intermAggregate)) {
4412 (yyvsp[(2) - (3)].interm.intermAggregate)->setOp(EOpSequence);
4413 (yyvsp[(2) - (3)].interm.intermAggregate)->setEndLine((yyvsp[(3) - (3)].lex).line);
4414 }
4415 (yyval.interm.intermNode) = (yyvsp[(2) - (3)].interm.intermAggregate);
4416 }
4417 break;
4418
Nicolas Capens7d626792015-02-17 17:58:31 -05004419 case 189:
John Bauman66b8ab22014-05-06 15:57:45 -04004420
4421 {
4422 (yyval.interm.intermAggregate) = context->intermediate.makeAggregate((yyvsp[(1) - (1)].interm.intermNode), 0);
4423 }
4424 break;
4425
Nicolas Capens7d626792015-02-17 17:58:31 -05004426 case 190:
John Bauman66b8ab22014-05-06 15:57:45 -04004427
4428 {
4429 (yyval.interm.intermAggregate) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermAggregate), (yyvsp[(2) - (2)].interm.intermNode), 0);
4430 }
4431 break;
4432
Nicolas Capens7d626792015-02-17 17:58:31 -05004433 case 191:
John Bauman66b8ab22014-05-06 15:57:45 -04004434
4435 { (yyval.interm.intermNode) = 0; }
4436 break;
4437
Nicolas Capens7d626792015-02-17 17:58:31 -05004438 case 192:
John Bauman66b8ab22014-05-06 15:57:45 -04004439
4440 { (yyval.interm.intermNode) = static_cast<TIntermNode*>((yyvsp[(1) - (2)].interm.intermTypedNode)); }
4441 break;
4442
Nicolas Capens7d626792015-02-17 17:58:31 -05004443 case 193:
John Bauman66b8ab22014-05-06 15:57:45 -04004444
4445 {
4446 if (context->boolErrorCheck((yyvsp[(1) - (5)].lex).line, (yyvsp[(3) - (5)].interm.intermTypedNode)))
4447 context->recover();
4448 (yyval.interm.intermNode) = context->intermediate.addSelection((yyvsp[(3) - (5)].interm.intermTypedNode), (yyvsp[(5) - (5)].interm.nodePair), (yyvsp[(1) - (5)].lex).line);
4449 }
4450 break;
4451
Nicolas Capens7d626792015-02-17 17:58:31 -05004452 case 194:
John Bauman66b8ab22014-05-06 15:57:45 -04004453
4454 {
4455 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermNode);
4456 (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermNode);
4457 }
4458 break;
4459
Nicolas Capens7d626792015-02-17 17:58:31 -05004460 case 195:
John Bauman66b8ab22014-05-06 15:57:45 -04004461
4462 {
4463 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (1)].interm.intermNode);
4464 (yyval.interm.nodePair).node2 = 0;
4465 }
4466 break;
4467
Nicolas Capens7d626792015-02-17 17:58:31 -05004468 case 196:
John Bauman66b8ab22014-05-06 15:57:45 -04004469
4470 {
4471 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
4472 if (context->boolErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)->getLine(), (yyvsp[(1) - (1)].interm.intermTypedNode)))
4473 context->recover();
4474 }
4475 break;
4476
Nicolas Capens7d626792015-02-17 17:58:31 -05004477 case 197:
John Bauman66b8ab22014-05-06 15:57:45 -04004478
4479 {
4480 TIntermNode* intermNode;
4481 if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
4482 context->recover();
4483 if (context->boolErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
4484 context->recover();
4485
4486 if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode))
4487 (yyval.interm.intermTypedNode) = (yyvsp[(4) - (4)].interm.intermTypedNode);
4488 else {
4489 context->recover();
4490 (yyval.interm.intermTypedNode) = 0;
4491 }
4492 }
4493 break;
4494
Nicolas Capens7d626792015-02-17 17:58:31 -05004495 case 198:
John Bauman66b8ab22014-05-06 15:57:45 -04004496
4497 { context->symbolTable.push(); ++context->loopNestingLevel; }
4498 break;
4499
Nicolas Capens7d626792015-02-17 17:58:31 -05004500 case 199:
John Bauman66b8ab22014-05-06 15:57:45 -04004501
4502 {
4503 context->symbolTable.pop();
4504 (yyval.interm.intermNode) = context->intermediate.addLoop(ELoopWhile, 0, (yyvsp[(4) - (6)].interm.intermTypedNode), 0, (yyvsp[(6) - (6)].interm.intermNode), (yyvsp[(1) - (6)].lex).line);
4505 --context->loopNestingLevel;
4506 }
4507 break;
4508
Nicolas Capens7d626792015-02-17 17:58:31 -05004509 case 200:
John Bauman66b8ab22014-05-06 15:57:45 -04004510
4511 { ++context->loopNestingLevel; }
4512 break;
4513
Nicolas Capens7d626792015-02-17 17:58:31 -05004514 case 201:
John Bauman66b8ab22014-05-06 15:57:45 -04004515
4516 {
4517 if (context->boolErrorCheck((yyvsp[(8) - (8)].lex).line, (yyvsp[(6) - (8)].interm.intermTypedNode)))
4518 context->recover();
4519
4520 (yyval.interm.intermNode) = context->intermediate.addLoop(ELoopDoWhile, 0, (yyvsp[(6) - (8)].interm.intermTypedNode), 0, (yyvsp[(3) - (8)].interm.intermNode), (yyvsp[(4) - (8)].lex).line);
4521 --context->loopNestingLevel;
4522 }
4523 break;
4524
Nicolas Capens7d626792015-02-17 17:58:31 -05004525 case 202:
John Bauman66b8ab22014-05-06 15:57:45 -04004526
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004527 { context->symbolTable.push(); ++context->loopNestingLevel; }
John Bauman66b8ab22014-05-06 15:57:45 -04004528 break;
4529
Nicolas Capens7d626792015-02-17 17:58:31 -05004530 case 203:
John Bauman66b8ab22014-05-06 15:57:45 -04004531
4532 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004533 context->symbolTable.pop();
4534 (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);
4535 --context->loopNestingLevel;
John Bauman66b8ab22014-05-06 15:57:45 -04004536 }
4537 break;
4538
Nicolas Capens7d626792015-02-17 17:58:31 -05004539 case 204:
John Bauman66b8ab22014-05-06 15:57:45 -04004540
4541 {
Nicolas Capens3c20f802015-02-17 17:17:20 -05004542 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04004543 }
4544 break;
4545
Nicolas Capens7d626792015-02-17 17:58:31 -05004546 case 205:
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04004547
4548 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004549 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
Alexis Hetub027aa92015-01-19 15:56:12 -05004550 }
4551 break;
4552
Nicolas Capens7d626792015-02-17 17:58:31 -05004553 case 206:
Alexis Hetub027aa92015-01-19 15:56:12 -05004554
4555 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004556 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
Nicolas Capens3c20f802015-02-17 17:17:20 -05004557 }
4558 break;
4559
Nicolas Capens7d626792015-02-17 17:58:31 -05004560 case 207:
Nicolas Capens3c20f802015-02-17 17:17:20 -05004561
4562 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004563 (yyval.interm.intermTypedNode) = 0;
4564 }
4565 break;
4566
Nicolas Capens7d626792015-02-17 17:58:31 -05004567 case 208:
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004568
4569 {
John Bauman66b8ab22014-05-06 15:57:45 -04004570 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (2)].interm.intermTypedNode);
4571 (yyval.interm.nodePair).node2 = 0;
4572 }
4573 break;
4574
Nicolas Capens7d626792015-02-17 17:58:31 -05004575 case 209:
John Bauman66b8ab22014-05-06 15:57:45 -04004576
4577 {
4578 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermTypedNode);
4579 (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermTypedNode);
4580 }
4581 break;
4582
Nicolas Capens7d626792015-02-17 17:58:31 -05004583 case 210:
John Bauman66b8ab22014-05-06 15:57:45 -04004584
4585 {
4586 if (context->loopNestingLevel <= 0) {
4587 context->error((yyvsp[(1) - (2)].lex).line, "continue statement only allowed in loops", "");
4588 context->recover();
4589 }
4590 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpContinue, (yyvsp[(1) - (2)].lex).line);
4591 }
4592 break;
4593
Nicolas Capens7d626792015-02-17 17:58:31 -05004594 case 211:
John Bauman66b8ab22014-05-06 15:57:45 -04004595
4596 {
4597 if (context->loopNestingLevel <= 0) {
4598 context->error((yyvsp[(1) - (2)].lex).line, "break statement only allowed in loops", "");
4599 context->recover();
4600 }
4601 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpBreak, (yyvsp[(1) - (2)].lex).line);
4602 }
4603 break;
4604
Nicolas Capens7d626792015-02-17 17:58:31 -05004605 case 212:
John Bauman66b8ab22014-05-06 15:57:45 -04004606
4607 {
4608 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(1) - (2)].lex).line);
4609 if (context->currentFunctionType->getBasicType() != EbtVoid) {
4610 context->error((yyvsp[(1) - (2)].lex).line, "non-void function must return a value", "return");
4611 context->recover();
4612 }
4613 }
4614 break;
4615
Nicolas Capens7d626792015-02-17 17:58:31 -05004616 case 213:
John Bauman66b8ab22014-05-06 15:57:45 -04004617
4618 {
4619 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(2) - (3)].interm.intermTypedNode), (yyvsp[(1) - (3)].lex).line);
4620 context->functionReturnsValue = true;
4621 if (context->currentFunctionType->getBasicType() == EbtVoid) {
4622 context->error((yyvsp[(1) - (3)].lex).line, "void function cannot return a value", "return");
4623 context->recover();
4624 } else if (*(context->currentFunctionType) != (yyvsp[(2) - (3)].interm.intermTypedNode)->getType()) {
4625 context->error((yyvsp[(1) - (3)].lex).line, "function return is not matching type:", "return");
4626 context->recover();
4627 }
4628 }
4629 break;
4630
Nicolas Capens7d626792015-02-17 17:58:31 -05004631 case 214:
John Bauman66b8ab22014-05-06 15:57:45 -04004632
4633 {
4634 FRAG_ONLY("discard", (yyvsp[(1) - (2)].lex).line);
4635 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpKill, (yyvsp[(1) - (2)].lex).line);
4636 }
4637 break;
4638
Nicolas Capens7d626792015-02-17 17:58:31 -05004639 case 215:
John Bauman66b8ab22014-05-06 15:57:45 -04004640
4641 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004642 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
Nicolas Capens3c20f802015-02-17 17:17:20 -05004643 context->treeRoot = (yyval.interm.intermNode);
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04004644 }
4645 break;
4646
Nicolas Capens7d626792015-02-17 17:58:31 -05004647 case 216:
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04004648
4649 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004650 (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermNode), (yyvsp[(2) - (2)].interm.intermNode), 0);
4651 context->treeRoot = (yyval.interm.intermNode);
Alexis Hetub027aa92015-01-19 15:56:12 -05004652 }
4653 break;
4654
Nicolas Capens7d626792015-02-17 17:58:31 -05004655 case 217:
Alexis Hetub027aa92015-01-19 15:56:12 -05004656
4657 {
Nicolas Capens3c20f802015-02-17 17:17:20 -05004658 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
4659 }
4660 break;
4661
Nicolas Capens7d626792015-02-17 17:58:31 -05004662 case 218:
Nicolas Capens3c20f802015-02-17 17:17:20 -05004663
4664 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004665 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
4666 }
4667 break;
4668
Nicolas Capens7d626792015-02-17 17:58:31 -05004669 case 219:
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004670
4671 {
John Bauman66b8ab22014-05-06 15:57:45 -04004672 TFunction* function = (yyvsp[(1) - (1)].interm).function;
4673
Nicolas Capens0a7f0c22015-02-18 14:47:31 -05004674 const TSymbol *builtIn = context->symbolTable.findBuiltIn(function->getMangledName(), context->shaderVersion);
John Bauman66b8ab22014-05-06 15:57:45 -04004675
4676 if (builtIn)
4677 {
4678 context->error((yyvsp[(1) - (1)].interm).line, "built-in functions cannot be redefined", function->getName().c_str());
4679 context->recover();
4680 }
4681
Nicolas Capens0a7f0c22015-02-18 14:47:31 -05004682 TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find(function->getMangledName(), context->shaderVersion));
John Bauman66b8ab22014-05-06 15:57:45 -04004683 //
4684 // Note: 'prevDec' could be 'function' if this is the first time we've seen function
4685 // as it would have just been put in the symbol table. Otherwise, we're looking up
4686 // an earlier occurance.
4687 //
4688 if (prevDec->isDefined()) {
4689 //
4690 // Then this function already has a body.
4691 //
4692 context->error((yyvsp[(1) - (1)].interm).line, "function already has a body", function->getName().c_str());
4693 context->recover();
4694 }
4695 prevDec->setDefined();
4696
4697 //
4698 // Raise error message if main function takes any parameters or return anything other than void
4699 //
4700 if (function->getName() == "main") {
4701 if (function->getParamCount() > 0) {
4702 context->error((yyvsp[(1) - (1)].interm).line, "function cannot take any parameter(s)", function->getName().c_str());
4703 context->recover();
4704 }
4705 if (function->getReturnType().getBasicType() != EbtVoid) {
4706 context->error((yyvsp[(1) - (1)].interm).line, "", function->getReturnType().getBasicString(), "main function cannot return a value");
4707 context->recover();
4708 }
4709 }
4710
4711 //
4712 // Remember the return type for later checking for RETURN statements.
4713 //
4714 context->currentFunctionType = &(prevDec->getReturnType());
4715 context->functionReturnsValue = false;
4716
4717 //
4718 // Insert parameters into the symbol table.
4719 // If the parameter has no name, it's not an error, just don't insert it
4720 // (could be used for unused args).
4721 //
4722 // Also, accumulate the list of parameters into the HIL, so lower level code
4723 // knows where to find parameters.
4724 //
4725 TIntermAggregate* paramNodes = new TIntermAggregate;
4726 for (int i = 0; i < function->getParamCount(); i++) {
4727 const TParameter& param = function->getParam(i);
4728 if (param.name != 0) {
4729 TVariable *variable = new TVariable(param.name, *param.type);
4730 //
4731 // Insert the parameters with name in the symbol table.
4732 //
Nicolas Capensd603ecd2015-02-18 14:52:21 -05004733 if (! context->symbolTable.declare(*variable)) {
John Bauman66b8ab22014-05-06 15:57:45 -04004734 context->error((yyvsp[(1) - (1)].interm).line, "redefinition", variable->getName().c_str());
4735 context->recover();
4736 delete variable;
4737 }
4738
4739 //
4740 // Add the parameter to the HIL
4741 //
4742 paramNodes = context->intermediate.growAggregate(
4743 paramNodes,
4744 context->intermediate.addSymbol(variable->getUniqueId(),
4745 variable->getName(),
4746 variable->getType(), (yyvsp[(1) - (1)].interm).line),
4747 (yyvsp[(1) - (1)].interm).line);
4748 } else {
4749 paramNodes = context->intermediate.growAggregate(paramNodes, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (1)].interm).line), (yyvsp[(1) - (1)].interm).line);
4750 }
4751 }
4752 context->intermediate.setAggregateOperator(paramNodes, EOpParameters, (yyvsp[(1) - (1)].interm).line);
4753 (yyvsp[(1) - (1)].interm).intermAggregate = paramNodes;
4754 context->loopNestingLevel = 0;
4755 }
4756 break;
4757
Nicolas Capens7d626792015-02-17 17:58:31 -05004758 case 220:
John Bauman66b8ab22014-05-06 15:57:45 -04004759
4760 {
4761 //?? Check that all paths return a value if return type != void ?
4762 // May be best done as post process phase on intermediate code
4763 if (context->currentFunctionType->getBasicType() != EbtVoid && ! context->functionReturnsValue) {
4764 context->error((yyvsp[(1) - (3)].interm).line, "function does not return a value:", "", (yyvsp[(1) - (3)].interm).function->getName().c_str());
4765 context->recover();
4766 }
4767
4768 (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermAggregate, (yyvsp[(3) - (3)].interm.intermNode), 0);
4769 context->intermediate.setAggregateOperator((yyval.interm.intermNode), EOpFunction, (yyvsp[(1) - (3)].interm).line);
4770 (yyval.interm.intermNode)->getAsAggregate()->setName((yyvsp[(1) - (3)].interm).function->getMangledName().c_str());
4771 (yyval.interm.intermNode)->getAsAggregate()->setType((yyvsp[(1) - (3)].interm).function->getReturnType());
4772
4773 // store the pragma information for debug and optimize and other vendor specific
4774 // information. This information can be queried from the parse tree
4775 (yyval.interm.intermNode)->getAsAggregate()->setOptimize(context->pragma().optimize);
4776 (yyval.interm.intermNode)->getAsAggregate()->setDebug(context->pragma().debug);
4777
4778 if ((yyvsp[(3) - (3)].interm.intermNode) && (yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate())
4779 (yyval.interm.intermNode)->getAsAggregate()->setEndLine((yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate()->getEndLine());
4780
4781 context->symbolTable.pop();
4782 }
4783 break;
4784
4785
4786
4787 default: break;
4788 }
4789 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
4790
4791 YYPOPSTACK (yylen);
4792 yylen = 0;
4793 YY_STACK_PRINT (yyss, yyssp);
4794
4795 *++yyvsp = yyval;
4796
4797 /* Now `shift' the result of the reduction. Determine what state
4798 that goes to, based on the state we popped back to and the rule
4799 number reduced by. */
4800
4801 yyn = yyr1[yyn];
4802
4803 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
4804 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
4805 yystate = yytable[yystate];
4806 else
4807 yystate = yydefgoto[yyn - YYNTOKENS];
4808
4809 goto yynewstate;
4810
4811
4812/*------------------------------------.
4813| yyerrlab -- here on detecting error |
4814`------------------------------------*/
4815yyerrlab:
4816 /* If not already recovering from an error, report this error. */
4817 if (!yyerrstatus)
4818 {
4819 ++yynerrs;
4820#if ! YYERROR_VERBOSE
4821 yyerror (context, YY_("syntax error"));
4822#else
4823 {
4824 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
4825 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
4826 {
4827 YYSIZE_T yyalloc = 2 * yysize;
4828 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
4829 yyalloc = YYSTACK_ALLOC_MAXIMUM;
4830 if (yymsg != yymsgbuf)
4831 YYSTACK_FREE (yymsg);
4832 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
4833 if (yymsg)
4834 yymsg_alloc = yyalloc;
4835 else
4836 {
4837 yymsg = yymsgbuf;
4838 yymsg_alloc = sizeof yymsgbuf;
4839 }
4840 }
4841
4842 if (0 < yysize && yysize <= yymsg_alloc)
4843 {
4844 (void) yysyntax_error (yymsg, yystate, yychar);
4845 yyerror (context, yymsg);
4846 }
4847 else
4848 {
4849 yyerror (context, YY_("syntax error"));
4850 if (yysize != 0)
4851 goto yyexhaustedlab;
4852 }
4853 }
4854#endif
4855 }
4856
4857
4858
4859 if (yyerrstatus == 3)
4860 {
4861 /* If just tried and failed to reuse lookahead token after an
4862 error, discard it. */
4863
4864 if (yychar <= YYEOF)
4865 {
4866 /* Return failure if at end of input. */
4867 if (yychar == YYEOF)
4868 YYABORT;
4869 }
4870 else
4871 {
4872 yydestruct ("Error: discarding",
4873 yytoken, &yylval, context);
4874 yychar = YYEMPTY;
4875 }
4876 }
4877
4878 /* Else will try to reuse lookahead token after shifting the error
4879 token. */
4880 goto yyerrlab1;
4881
4882
4883/*---------------------------------------------------.
4884| yyerrorlab -- error raised explicitly by YYERROR. |
4885`---------------------------------------------------*/
4886yyerrorlab:
4887
4888 /* Pacify compilers like GCC when the user code never invokes
4889 YYERROR and the label yyerrorlab therefore never appears in user
4890 code. */
4891 if (/*CONSTCOND*/ 0)
4892 goto yyerrorlab;
4893
4894 /* Do not reclaim the symbols of the rule which action triggered
4895 this YYERROR. */
4896 YYPOPSTACK (yylen);
4897 yylen = 0;
4898 YY_STACK_PRINT (yyss, yyssp);
4899 yystate = *yyssp;
4900 goto yyerrlab1;
4901
4902
4903/*-------------------------------------------------------------.
4904| yyerrlab1 -- common code for both syntax error and YYERROR. |
4905`-------------------------------------------------------------*/
4906yyerrlab1:
4907 yyerrstatus = 3; /* Each real token shifted decrements this. */
4908
4909 for (;;)
4910 {
4911 yyn = yypact[yystate];
4912 if (yyn != YYPACT_NINF)
4913 {
4914 yyn += YYTERROR;
4915 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
4916 {
4917 yyn = yytable[yyn];
4918 if (0 < yyn)
4919 break;
4920 }
4921 }
4922
4923 /* Pop the current state because it cannot handle the error token. */
4924 if (yyssp == yyss)
4925 YYABORT;
4926
4927
4928 yydestruct ("Error: popping",
4929 yystos[yystate], yyvsp, context);
4930 YYPOPSTACK (1);
4931 yystate = *yyssp;
4932 YY_STACK_PRINT (yyss, yyssp);
4933 }
4934
4935 *++yyvsp = yylval;
4936
4937
4938 /* Shift the error token. */
4939 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
4940
4941 yystate = yyn;
4942 goto yynewstate;
4943
4944
4945/*-------------------------------------.
4946| yyacceptlab -- YYACCEPT comes here. |
4947`-------------------------------------*/
4948yyacceptlab:
4949 yyresult = 0;
4950 goto yyreturn;
4951
4952/*-----------------------------------.
4953| yyabortlab -- YYABORT comes here. |
4954`-----------------------------------*/
4955yyabortlab:
4956 yyresult = 1;
4957 goto yyreturn;
4958
4959#if !defined(yyoverflow) || YYERROR_VERBOSE
4960/*-------------------------------------------------.
4961| yyexhaustedlab -- memory exhaustion comes here. |
4962`-------------------------------------------------*/
4963yyexhaustedlab:
4964 yyerror (context, YY_("memory exhausted"));
4965 yyresult = 2;
4966 /* Fall through. */
4967#endif
4968
4969yyreturn:
4970 if (yychar != YYEMPTY)
4971 yydestruct ("Cleanup: discarding lookahead",
4972 yytoken, &yylval, context);
4973 /* Do not reclaim the symbols of the rule which action triggered
4974 this YYABORT or YYACCEPT. */
4975 YYPOPSTACK (yylen);
4976 YY_STACK_PRINT (yyss, yyssp);
4977 while (yyssp != yyss)
4978 {
4979 yydestruct ("Cleanup: popping",
4980 yystos[*yyssp], yyvsp, context);
4981 YYPOPSTACK (1);
4982 }
4983#ifndef yyoverflow
4984 if (yyss != yyssa)
4985 YYSTACK_FREE (yyss);
4986#endif
4987#if YYERROR_VERBOSE
4988 if (yymsg != yymsgbuf)
4989 YYSTACK_FREE (yymsg);
4990#endif
4991 /* Make sure YYID is used. */
4992 return YYID (yyresult);
4993}
4994
4995
4996
4997
4998
4999int glslang_parse(TParseContext* context) {
5000 return yyparse(context);
5001}
5002