blob: dbda52de11d9e97099b89d9c4831c3ba988a73f7 [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,
157 MATRIX2 = 289,
158 MATRIX3 = 290,
159 MATRIX4 = 291,
160 IN_QUAL = 292,
161 OUT_QUAL = 293,
162 INOUT_QUAL = 294,
163 UNIFORM = 295,
164 VARYING = 296,
165 CENTROID = 297,
166 FLAT = 298,
167 SMOOTH = 299,
168 STRUCT = 300,
169 VOID_TYPE = 301,
170 WHILE = 302,
171 SAMPLER2D = 303,
172 SAMPLERCUBE = 304,
173 SAMPLER_EXTERNAL_OES = 305,
174 SAMPLER2DRECT = 306,
175 SAMPLER3D = 307,
176 SAMPLER3DRECT = 308,
177 SAMPLER2DSHADOW = 309,
178 IDENTIFIER = 310,
179 TYPE_NAME = 311,
180 FLOATCONSTANT = 312,
181 INTCONSTANT = 313,
182 BOOLCONSTANT = 314,
183 FIELD_SELECTION = 315,
184 LEFT_OP = 316,
185 RIGHT_OP = 317,
186 INC_OP = 318,
187 DEC_OP = 319,
188 LE_OP = 320,
189 GE_OP = 321,
190 EQ_OP = 322,
191 NE_OP = 323,
192 AND_OP = 324,
193 OR_OP = 325,
194 XOR_OP = 326,
195 MUL_ASSIGN = 327,
196 DIV_ASSIGN = 328,
197 ADD_ASSIGN = 329,
198 MOD_ASSIGN = 330,
199 LEFT_ASSIGN = 331,
200 RIGHT_ASSIGN = 332,
201 AND_ASSIGN = 333,
202 XOR_ASSIGN = 334,
203 OR_ASSIGN = 335,
204 SUB_ASSIGN = 336,
205 LEFT_PAREN = 337,
206 RIGHT_PAREN = 338,
207 LEFT_BRACKET = 339,
208 RIGHT_BRACKET = 340,
209 LEFT_BRACE = 341,
210 RIGHT_BRACE = 342,
211 DOT = 343,
212 COMMA = 344,
213 COLON = 345,
214 EQUAL = 346,
215 SEMICOLON = 347,
216 BANG = 348,
217 DASH = 349,
218 TILDE = 350,
219 PLUS = 351,
220 STAR = 352,
221 SLASH = 353,
222 PERCENT = 354,
223 LEFT_ANGLE = 355,
224 RIGHT_ANGLE = 356,
225 VERTICAL_BAR = 357,
226 CARET = 358,
227 AMPERSAND = 359,
228 QUESTION = 360
John Bauman66b8ab22014-05-06 15:57:45 -0400229 };
230#endif
231
232
233
234#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
235typedef union YYSTYPE
236{
237
238
239 struct {
240 TSourceLoc line;
241 union {
242 TString *string;
243 float f;
244 int i;
245 bool b;
246 };
247 TSymbol* symbol;
248 } lex;
249 struct {
250 TSourceLoc line;
251 TOperator op;
252 union {
253 TIntermNode* intermNode;
254 TIntermNodePair nodePair;
255 TIntermTyped* intermTypedNode;
256 TIntermAggregate* intermAggregate;
257 };
258 union {
259 TPublicType type;
260 TPrecision precision;
261 TQualifier qualifier;
262 TFunction* function;
263 TParameter param;
264 TTypeLine typeLine;
265 TTypeList* typeList;
266 };
267 } interm;
268
269
270
271} YYSTYPE;
272# define YYSTYPE_IS_TRIVIAL 1
273# define yystype YYSTYPE /* obsolescent; will be withdrawn */
274# define YYSTYPE_IS_DECLARED 1
275#endif
276
277
278/* Copy the second part of user declarations. */
279
280
281extern int yylex(YYSTYPE* yylval_param, void* yyscanner);
282extern void yyerror(TParseContext* context, const char* reason);
283
284#define FRAG_VERT_ONLY(S, L) { \
Nicolas Capens08ca3c62015-02-13 16:06:45 -0500285 if (context->shaderType != GL_FRAGMENT_SHADER && \
286 context->shaderType != GL_VERTEX_SHADER) { \
John Bauman66b8ab22014-05-06 15:57:45 -0400287 context->error(L, " supported in vertex/fragment shaders only ", S); \
288 context->recover(); \
289 } \
290}
291
292#define VERTEX_ONLY(S, L) { \
Nicolas Capens08ca3c62015-02-13 16:06:45 -0500293 if (context->shaderType != GL_VERTEX_SHADER) { \
John Bauman66b8ab22014-05-06 15:57:45 -0400294 context->error(L, " supported in vertex shaders only ", S); \
295 context->recover(); \
296 } \
297}
298
299#define FRAG_ONLY(S, L) { \
Nicolas Capens08ca3c62015-02-13 16:06:45 -0500300 if (context->shaderType != GL_FRAGMENT_SHADER) { \
John Bauman66b8ab22014-05-06 15:57:45 -0400301 context->error(L, " supported in fragment shaders only ", S); \
302 context->recover(); \
303 } \
304}
305
Nicolas Capensc6841852015-02-15 14:25:37 -0500306#define ES2_ONLY(S, L) { \
307 if (context->shaderVersion != 100) { \
308 context->error(L, " supported in GLSL ES 1.00 only ", S); \
309 context->recover(); \
310 } \
311}
312
313#define ES3_ONLY(S, L) { \
314 if (context->shaderVersion != 300) { \
315 context->error(L, " supported in GLSL ES 3.00 only ", S); \
316 context->recover(); \
317 } \
318}
319
John Bauman66b8ab22014-05-06 15:57:45 -0400320
321
322#ifdef short
323# undef short
324#endif
325
326#ifdef YYTYPE_UINT8
327typedef YYTYPE_UINT8 yytype_uint8;
328#else
329typedef unsigned char yytype_uint8;
330#endif
331
332#ifdef YYTYPE_INT8
333typedef YYTYPE_INT8 yytype_int8;
334#elif (defined __STDC__ || defined __C99__FUNC__ \
335 || defined __cplusplus || defined _MSC_VER)
336typedef signed char yytype_int8;
337#else
338typedef short int yytype_int8;
339#endif
340
341#ifdef YYTYPE_UINT16
342typedef YYTYPE_UINT16 yytype_uint16;
343#else
344typedef unsigned short int yytype_uint16;
345#endif
346
347#ifdef YYTYPE_INT16
348typedef YYTYPE_INT16 yytype_int16;
349#else
350typedef short int yytype_int16;
351#endif
352
353#ifndef YYSIZE_T
354# ifdef __SIZE_TYPE__
355# define YYSIZE_T __SIZE_TYPE__
356# elif defined size_t
357# define YYSIZE_T size_t
358# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
359 || defined __cplusplus || defined _MSC_VER)
360# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
361# define YYSIZE_T size_t
362# else
363# define YYSIZE_T unsigned int
364# endif
365#endif
366
367#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
368
369#ifndef YY_
Nicolas Capense9c5e4f2014-05-28 22:46:43 -0400370# if YYENABLE_NLS
John Bauman66b8ab22014-05-06 15:57:45 -0400371# if ENABLE_NLS
372# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
373# define YY_(msgid) dgettext ("bison-runtime", msgid)
374# endif
375# endif
376# ifndef YY_
377# define YY_(msgid) msgid
378# endif
379#endif
380
381/* Suppress unused-variable warnings by "using" E. */
382#if ! defined lint || defined __GNUC__
383# define YYUSE(e) ((void) (e))
384#else
385# define YYUSE(e) /* empty */
386#endif
387
388/* Identity function, used to suppress warnings about constant conditions. */
389#ifndef lint
390# define YYID(n) (n)
391#else
392#if (defined __STDC__ || defined __C99__FUNC__ \
393 || defined __cplusplus || defined _MSC_VER)
394static int
395YYID (int yyi)
396#else
397static int
398YYID (yyi)
399 int yyi;
400#endif
401{
402 return yyi;
403}
404#endif
405
406#if ! defined yyoverflow || YYERROR_VERBOSE
407
408/* The parser invokes alloca or malloc; define the necessary symbols. */
409
410# ifdef YYSTACK_USE_ALLOCA
411# if YYSTACK_USE_ALLOCA
412# ifdef __GNUC__
413# define YYSTACK_ALLOC __builtin_alloca
414# elif defined __BUILTIN_VA_ARG_INCR
415# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
416# elif defined _AIX
417# define YYSTACK_ALLOC __alloca
418# elif defined _MSC_VER
419# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
420# define alloca _alloca
421# else
422# define YYSTACK_ALLOC alloca
423# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
424 || defined __cplusplus || defined _MSC_VER)
425# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
426# ifndef _STDLIB_H
427# define _STDLIB_H 1
428# endif
429# endif
430# endif
431# endif
432# endif
433
434# ifdef YYSTACK_ALLOC
435 /* Pacify GCC's `empty if-body' warning. */
436# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
437# ifndef YYSTACK_ALLOC_MAXIMUM
438 /* The OS might guarantee only one guard page at the bottom of the stack,
439 and a page size can be as small as 4096 bytes. So we cannot safely
440 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
441 to allow for a few compiler-allocated temporary stack slots. */
442# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
443# endif
444# else
445# define YYSTACK_ALLOC YYMALLOC
446# define YYSTACK_FREE YYFREE
447# ifndef YYSTACK_ALLOC_MAXIMUM
448# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
449# endif
450# if (defined __cplusplus && ! defined _STDLIB_H \
451 && ! ((defined YYMALLOC || defined malloc) \
452 && (defined YYFREE || defined free)))
453# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
454# ifndef _STDLIB_H
455# define _STDLIB_H 1
456# endif
457# endif
458# ifndef YYMALLOC
459# define YYMALLOC malloc
460# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
461 || defined __cplusplus || defined _MSC_VER)
462void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
463# endif
464# endif
465# ifndef YYFREE
466# define YYFREE free
467# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
468 || defined __cplusplus || defined _MSC_VER)
469void free (void *); /* INFRINGES ON USER NAME SPACE */
470# endif
471# endif
472# endif
473#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
474
475
476#if (! defined yyoverflow \
477 && (! defined __cplusplus \
478 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
479
480/* A type that is properly aligned for any stack member. */
481union yyalloc
482{
483 yytype_int16 yyss_alloc;
484 YYSTYPE yyvs_alloc;
485};
486
487/* The size of the maximum gap between one aligned stack and the next. */
488# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
489
490/* The size of an array large to enough to hold all stacks, each with
491 N elements. */
492# define YYSTACK_BYTES(N) \
493 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
494 + YYSTACK_GAP_MAXIMUM)
495
496/* Copy COUNT objects from FROM to TO. The source and destination do
497 not overlap. */
498# ifndef YYCOPY
499# if defined __GNUC__ && 1 < __GNUC__
500# define YYCOPY(To, From, Count) \
501 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
502# else
503# define YYCOPY(To, From, Count) \
504 do \
505 { \
506 YYSIZE_T yyi; \
507 for (yyi = 0; yyi < (Count); yyi++) \
508 (To)[yyi] = (From)[yyi]; \
509 } \
510 while (YYID (0))
511# endif
512# endif
513
514/* Relocate STACK from its old location to the new one. The
515 local variables YYSIZE and YYSTACKSIZE give the old and new number of
516 elements in the stack, and YYPTR gives the new location of the
517 stack. Advance YYPTR to a properly aligned location for the next
518 stack. */
519# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
520 do \
521 { \
522 YYSIZE_T yynewbytes; \
523 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
524 Stack = &yyptr->Stack_alloc; \
525 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
526 yyptr += yynewbytes / sizeof (*yyptr); \
527 } \
528 while (YYID (0))
529
530#endif
531
532/* YYFINAL -- State number of the termination state. */
Nicolas Capens3c20f802015-02-17 17:17:20 -0500533#define YYFINAL 78
John Bauman66b8ab22014-05-06 15:57:45 -0400534/* YYLAST -- Last index in YYTABLE. */
Nicolas Capens3c20f802015-02-17 17:17:20 -0500535#define YYLAST 1562
John Bauman66b8ab22014-05-06 15:57:45 -0400536
537/* YYNTOKENS -- Number of terminals. */
Nicolas Capens3c20f802015-02-17 17:17:20 -0500538#define YYNTOKENS 106
John Bauman66b8ab22014-05-06 15:57:45 -0400539/* YYNNTS -- Number of nonterminals. */
Nicolas Capensa6a79ab2015-02-17 12:42:14 -0500540#define YYNNTS 85
John Bauman66b8ab22014-05-06 15:57:45 -0400541/* YYNRULES -- Number of rules. */
Nicolas Capens3c20f802015-02-17 17:17:20 -0500542#define YYNRULES 208
John Bauman66b8ab22014-05-06 15:57:45 -0400543/* YYNRULES -- Number of states. */
Nicolas Capens3c20f802015-02-17 17:17:20 -0500544#define YYNSTATES 312
John Bauman66b8ab22014-05-06 15:57:45 -0400545
546/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
547#define YYUNDEFTOK 2
Nicolas Capens3c20f802015-02-17 17:17:20 -0500548#define YYMAXUTOK 360
John Bauman66b8ab22014-05-06 15:57:45 -0400549
550#define YYTRANSLATE(YYX) \
551 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
552
553/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
554static const yytype_uint8 yytranslate[] =
555{
556 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
557 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
558 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
559 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
560 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
561 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
562 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
563 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
564 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
565 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
566 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
567 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
568 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
569 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
570 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
571 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
572 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
573 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
574 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
575 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
576 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
577 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
578 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
579 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
580 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
581 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
582 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
583 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
584 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
585 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
586 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
587 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
588 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
589 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
Alexis Hetub027aa92015-01-19 15:56:12 -0500590 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
Nicolas Capens3c20f802015-02-17 17:17:20 -0500591 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
592 105
John Bauman66b8ab22014-05-06 15:57:45 -0400593};
594
595#if YYDEBUG
596/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
597 YYRHS. */
598static const yytype_uint16 yyprhs[] =
599{
600 0, 0, 3, 5, 7, 9, 11, 13, 17, 19,
601 24, 26, 30, 33, 36, 38, 40, 42, 46, 49,
602 52, 55, 57, 60, 64, 67, 69, 71, 73, 75,
603 78, 81, 84, 86, 88, 90, 92, 96, 100, 102,
604 106, 110, 112, 114, 118, 122, 126, 130, 132, 136,
605 140, 142, 144, 146, 148, 152, 154, 158, 160, 164,
606 166, 172, 174, 178, 180, 182, 184, 186, 188, 190,
607 194, 196, 199, 202, 207, 210, 212, 214, 217, 221,
608 225, 228, 234, 238, 241, 245, 248, 249, 251, 253,
609 255, 257, 259, 263, 269, 276, 282, 284, 287, 292,
610 298, 303, 306, 308, 311, 313, 315, 317, 320, 322,
Nicolas Capensa6a79ab2015-02-17 12:42:14 -0500611 324, 326, 328, 331, 334, 336, 338, 341, 343, 345,
612 347, 349, 354, 356, 358, 360, 362, 364, 366, 368,
613 370, 372, 374, 376, 378, 380, 382, 384, 386, 388,
Nicolas Capens3c20f802015-02-17 17:17:20 -0500614 390, 392, 394, 396, 398, 400, 401, 408, 409, 415,
615 417, 420, 424, 426, 430, 432, 437, 439, 441, 443,
616 445, 447, 449, 451, 453, 455, 458, 459, 460, 466,
617 468, 470, 471, 474, 475, 478, 481, 485, 487, 490,
618 492, 495, 501, 505, 507, 509, 514, 515, 522, 523,
619 532, 533, 541, 543, 545, 547, 548, 551, 555, 558,
620 561, 564, 568, 571, 573, 576, 578, 580, 581
John Bauman66b8ab22014-05-06 15:57:45 -0400621};
622
623/* YYRHS -- A `-1'-separated list of the rules' RHS. */
624static const yytype_int16 yyrhs[] =
625{
Nicolas Capens3c20f802015-02-17 17:17:20 -0500626 187, 0, -1, 55, -1, 107, -1, 58, -1, 57,
627 -1, 59, -1, 82, 134, 83, -1, 108, -1, 109,
628 84, 110, 85, -1, 111, -1, 109, 88, 60, -1,
629 109, 63, -1, 109, 64, -1, 134, -1, 112, -1,
630 113, -1, 109, 88, 113, -1, 115, 83, -1, 114,
631 83, -1, 116, 46, -1, 116, -1, 116, 132, -1,
632 115, 89, 132, -1, 117, 82, -1, 154, -1, 55,
633 -1, 60, -1, 109, -1, 63, 118, -1, 64, 118,
634 -1, 119, 118, -1, 96, -1, 94, -1, 93, -1,
635 118, -1, 120, 97, 118, -1, 120, 98, 118, -1,
636 120, -1, 121, 96, 120, -1, 121, 94, 120, -1,
637 121, -1, 122, -1, 123, 100, 122, -1, 123, 101,
638 122, -1, 123, 65, 122, -1, 123, 66, 122, -1,
639 123, -1, 124, 67, 123, -1, 124, 68, 123, -1,
640 124, -1, 125, -1, 126, -1, 127, -1, 128, 69,
641 127, -1, 128, -1, 129, 71, 128, -1, 129, -1,
642 130, 70, 129, -1, 130, -1, 130, 105, 134, 90,
643 132, -1, 131, -1, 118, 133, 132, -1, 91, -1,
644 72, -1, 73, -1, 74, -1, 81, -1, 132, -1,
645 134, 89, 132, -1, 131, -1, 137, 92, -1, 145,
646 92, -1, 7, 152, 153, 92, -1, 138, 83, -1,
647 140, -1, 139, -1, 140, 142, -1, 139, 89, 142,
648 -1, 147, 55, 82, -1, 151, 55, -1, 151, 55,
649 84, 135, 85, -1, 148, 143, 141, -1, 143, 141,
650 -1, 148, 143, 144, -1, 143, 144, -1, -1, 37,
651 -1, 38, -1, 39, -1, 151, -1, 146, -1, 145,
652 89, 55, -1, 145, 89, 55, 84, 85, -1, 145,
653 89, 55, 84, 135, 85, -1, 145, 89, 55, 91,
654 162, -1, 147, -1, 147, 55, -1, 147, 55, 84,
655 85, -1, 147, 55, 84, 135, 85, -1, 147, 55,
656 91, 162, -1, 3, 55, -1, 151, -1, 149, 151,
657 -1, 9, -1, 8, -1, 41, -1, 3, 41, -1,
658 150, -1, 9, -1, 37, -1, 38, -1, 42, 37,
659 -1, 42, 38, -1, 40, -1, 153, -1, 152, 153,
660 -1, 4, -1, 5, -1, 6, -1, 154, -1, 154,
661 84, 135, 85, -1, 46, -1, 11, -1, 12, -1,
662 13, -1, 10, -1, 31, -1, 32, -1, 33, -1,
Nicolas Capensa6a79ab2015-02-17 12:42:14 -0500663 25, -1, 26, -1, 27, -1, 28, -1, 29, -1,
Nicolas Capens3c20f802015-02-17 17:17:20 -0500664 30, -1, 34, -1, 35, -1, 36, -1, 48, -1,
665 49, -1, 50, -1, 52, -1, 155, -1, 56, -1,
666 -1, 45, 55, 86, 156, 158, 87, -1, -1, 45,
667 86, 157, 158, 87, -1, 159, -1, 158, 159, -1,
668 151, 160, 92, -1, 161, -1, 160, 89, 161, -1,
669 55, -1, 55, 84, 135, 85, -1, 132, -1, 136,
670 -1, 166, -1, 165, -1, 163, -1, 175, -1, 176,
671 -1, 179, -1, 186, -1, 86, 87, -1, -1, -1,
672 86, 167, 174, 168, 87, -1, 173, -1, 165, -1,
673 -1, 171, 173, -1, -1, 172, 165, -1, 86, 87,
674 -1, 86, 174, 87, -1, 164, -1, 174, 164, -1,
675 92, -1, 134, 92, -1, 19, 82, 134, 83, 177,
676 -1, 170, 17, 170, -1, 170, -1, 134, -1, 147,
677 55, 91, 162, -1, -1, 47, 82, 180, 178, 83,
678 169, -1, -1, 16, 181, 170, 47, 82, 134, 83,
679 92, -1, -1, 18, 82, 182, 183, 185, 83, 169,
680 -1, 175, -1, 163, -1, 178, -1, -1, 184, 92,
681 -1, 184, 92, 134, -1, 15, 92, -1, 14, 92,
682 -1, 21, 92, -1, 21, 134, 92, -1, 20, 92,
683 -1, 188, -1, 187, 188, -1, 189, -1, 136, -1,
684 -1, 137, 190, 173, -1
John Bauman66b8ab22014-05-06 15:57:45 -0400685};
686
687/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
688static const yytype_uint16 yyrline[] =
689{
Nicolas Capens3c20f802015-02-17 17:17:20 -0500690 0, 183, 183, 218, 221, 226, 231, 236, 242, 245,
691 324, 327, 428, 438, 451, 459, 559, 562, 570, 574,
692 581, 585, 592, 598, 607, 615, 670, 677, 687, 690,
693 700, 710, 731, 732, 733, 738, 739, 748, 760, 761,
694 769, 780, 784, 785, 795, 805, 815, 828, 829, 839,
695 852, 856, 860, 864, 865, 878, 879, 892, 893, 906,
696 907, 924, 925, 938, 939, 940, 941, 942, 946, 949,
697 960, 968, 995, 1000, 1010, 1048, 1051, 1058, 1066, 1087,
698 1108, 1119, 1148, 1153, 1163, 1168, 1178, 1181, 1184, 1187,
699 1193, 1200, 1203, 1225, 1243, 1267, 1290, 1294, 1312, 1320,
700 1352, 1372, 1460, 1469, 1492, 1498, 1505, 1514, 1523, 1529,
701 1533, 1538, 1543, 1549, 1555, 1564, 1574, 1581, 1584, 1587,
702 1593, 1596, 1611, 1615, 1619, 1623, 1627, 1631, 1636, 1641,
703 1646, 1651, 1656, 1661, 1666, 1671, 1676, 1682, 1688, 1694,
704 1699, 1704, 1713, 1718, 1723, 1736, 1736, 1750, 1750, 1759,
705 1762, 1777, 1809, 1813, 1819, 1827, 1843, 1847, 1851, 1852,
706 1858, 1859, 1860, 1861, 1862, 1866, 1867, 1867, 1867, 1877,
707 1878, 1882, 1882, 1883, 1883, 1888, 1891, 1901, 1904, 1910,
708 1911, 1915, 1923, 1927, 1937, 1942, 1959, 1959, 1964, 1964,
709 1971, 1971, 1979, 1982, 1988, 1991, 1997, 2001, 2008, 2015,
710 2022, 2029, 2040, 2049, 2053, 2060, 2063, 2069, 2069
John Bauman66b8ab22014-05-06 15:57:45 -0400711};
712#endif
713
714#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
715/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
716 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
717static const char *const yytname[] =
718{
719 "$end", "error", "$undefined", "INVARIANT", "HIGH_PRECISION",
720 "MEDIUM_PRECISION", "LOW_PRECISION", "PRECISION", "ATTRIBUTE",
Nicolas Capens3c20f802015-02-17 17:17:20 -0500721 "CONST_QUAL", "BOOL_TYPE", "FLOAT_TYPE", "INT_TYPE", "UINT_TYPE",
722 "BREAK", "CONTINUE", "DO", "ELSE", "FOR", "IF", "DISCARD", "RETURN",
723 "SWITCH", "CASE", "DEFAULT", "BVEC2", "BVEC3", "BVEC4", "IVEC2", "IVEC3",
724 "IVEC4", "VEC2", "VEC3", "VEC4", "MATRIX2", "MATRIX3", "MATRIX4",
725 "IN_QUAL", "OUT_QUAL", "INOUT_QUAL", "UNIFORM", "VARYING", "CENTROID",
726 "FLAT", "SMOOTH", "STRUCT", "VOID_TYPE", "WHILE", "SAMPLER2D",
727 "SAMPLERCUBE", "SAMPLER_EXTERNAL_OES", "SAMPLER2DRECT", "SAMPLER3D",
728 "SAMPLER3DRECT", "SAMPLER2DSHADOW", "IDENTIFIER", "TYPE_NAME",
729 "FLOATCONSTANT", "INTCONSTANT", "BOOLCONSTANT", "FIELD_SELECTION",
730 "LEFT_OP", "RIGHT_OP", "INC_OP", "DEC_OP", "LE_OP", "GE_OP", "EQ_OP",
731 "NE_OP", "AND_OP", "OR_OP", "XOR_OP", "MUL_ASSIGN", "DIV_ASSIGN",
732 "ADD_ASSIGN", "MOD_ASSIGN", "LEFT_ASSIGN", "RIGHT_ASSIGN", "AND_ASSIGN",
733 "XOR_ASSIGN", "OR_ASSIGN", "SUB_ASSIGN", "LEFT_PAREN", "RIGHT_PAREN",
734 "LEFT_BRACKET", "RIGHT_BRACKET", "LEFT_BRACE", "RIGHT_BRACE", "DOT",
735 "COMMA", "COLON", "EQUAL", "SEMICOLON", "BANG", "DASH", "TILDE", "PLUS",
736 "STAR", "SLASH", "PERCENT", "LEFT_ANGLE", "RIGHT_ANGLE", "VERTICAL_BAR",
737 "CARET", "AMPERSAND", "QUESTION", "$accept", "variable_identifier",
John Bauman66b8ab22014-05-06 15:57:45 -0400738 "primary_expression", "postfix_expression", "integer_expression",
739 "function_call", "function_call_or_method", "function_call_generic",
740 "function_call_header_no_parameters",
741 "function_call_header_with_parameters", "function_call_header",
742 "function_identifier", "unary_expression", "unary_operator",
743 "multiplicative_expression", "additive_expression", "shift_expression",
744 "relational_expression", "equality_expression", "and_expression",
745 "exclusive_or_expression", "inclusive_or_expression",
746 "logical_and_expression", "logical_xor_expression",
747 "logical_or_expression", "conditional_expression",
748 "assignment_expression", "assignment_operator", "expression",
749 "constant_expression", "declaration", "function_prototype",
750 "function_declarator", "function_header_with_parameters",
751 "function_header", "parameter_declarator", "parameter_declaration",
752 "parameter_qualifier", "parameter_type_specifier",
753 "init_declarator_list", "single_declaration", "fully_specified_type",
Nicolas Capensa6a79ab2015-02-17 12:42:14 -0500754 "parameter_type_qualifier", "type_qualifier", "storage_qualifier",
755 "type_specifier", "precision_qualifier", "type_specifier_no_prec",
756 "type_specifier_nonarray", "struct_specifier", "$@1", "$@2",
757 "struct_declaration_list", "struct_declaration",
John Bauman66b8ab22014-05-06 15:57:45 -0400758 "struct_declarator_list", "struct_declarator", "initializer",
759 "declaration_statement", "statement", "simple_statement",
760 "compound_statement", "$@3", "$@4", "statement_no_new_scope",
761 "statement_with_scope", "$@5", "$@6", "compound_statement_no_new_scope",
762 "statement_list", "expression_statement", "selection_statement",
763 "selection_rest_statement", "condition", "iteration_statement", "$@7",
764 "$@8", "$@9", "for_init_statement", "conditionopt", "for_rest_statement",
765 "jump_statement", "translation_unit", "external_declaration",
766 "function_definition", "$@10", 0
767};
768#endif
769
770# ifdef YYPRINT
771/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
772 token YYLEX-NUM. */
773static const yytype_uint16 yytoknum[] =
774{
775 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
776 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
777 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
778 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
779 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
780 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
781 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
782 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
783 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
Nicolas Capensc6841852015-02-15 14:25:37 -0500784 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
Nicolas Capens3c20f802015-02-17 17:17:20 -0500785 355, 356, 357, 358, 359, 360
John Bauman66b8ab22014-05-06 15:57:45 -0400786};
787# endif
788
789/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
790static const yytype_uint8 yyr1[] =
791{
Nicolas Capens3c20f802015-02-17 17:17:20 -0500792 0, 106, 107, 108, 108, 108, 108, 108, 109, 109,
793 109, 109, 109, 109, 110, 111, 112, 112, 113, 113,
794 114, 114, 115, 115, 116, 117, 117, 117, 118, 118,
795 118, 118, 119, 119, 119, 120, 120, 120, 121, 121,
796 121, 122, 123, 123, 123, 123, 123, 124, 124, 124,
797 125, 126, 127, 128, 128, 129, 129, 130, 130, 131,
798 131, 132, 132, 133, 133, 133, 133, 133, 134, 134,
799 135, 136, 136, 136, 137, 138, 138, 139, 139, 140,
800 141, 141, 142, 142, 142, 142, 143, 143, 143, 143,
801 144, 145, 145, 145, 145, 145, 146, 146, 146, 146,
802 146, 146, 147, 147, 148, 149, 149, 149, 149, 150,
803 150, 150, 150, 150, 150, 151, 151, 152, 152, 152,
804 153, 153, 154, 154, 154, 154, 154, 154, 154, 154,
805 154, 154, 154, 154, 154, 154, 154, 154, 154, 154,
806 154, 154, 154, 154, 154, 156, 155, 157, 155, 158,
807 158, 159, 160, 160, 161, 161, 162, 163, 164, 164,
808 165, 165, 165, 165, 165, 166, 167, 168, 166, 169,
809 169, 171, 170, 172, 170, 173, 173, 174, 174, 175,
810 175, 176, 177, 177, 178, 178, 180, 179, 181, 179,
811 182, 179, 183, 183, 184, 184, 185, 185, 186, 186,
812 186, 186, 186, 187, 187, 188, 188, 190, 189
John Bauman66b8ab22014-05-06 15:57:45 -0400813};
814
815/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
816static const yytype_uint8 yyr2[] =
817{
818 0, 2, 1, 1, 1, 1, 1, 3, 1, 4,
819 1, 3, 2, 2, 1, 1, 1, 3, 2, 2,
820 2, 1, 2, 3, 2, 1, 1, 1, 1, 2,
821 2, 2, 1, 1, 1, 1, 3, 3, 1, 3,
822 3, 1, 1, 3, 3, 3, 3, 1, 3, 3,
823 1, 1, 1, 1, 3, 1, 3, 1, 3, 1,
824 5, 1, 3, 1, 1, 1, 1, 1, 1, 3,
825 1, 2, 2, 4, 2, 1, 1, 2, 3, 3,
826 2, 5, 3, 2, 3, 2, 0, 1, 1, 1,
827 1, 1, 3, 5, 6, 5, 1, 2, 4, 5,
828 4, 2, 1, 2, 1, 1, 1, 2, 1, 1,
Nicolas Capensa6a79ab2015-02-17 12:42:14 -0500829 1, 1, 2, 2, 1, 1, 2, 1, 1, 1,
830 1, 4, 1, 1, 1, 1, 1, 1, 1, 1,
John Bauman66b8ab22014-05-06 15:57:45 -0400831 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
Nicolas Capens3c20f802015-02-17 17:17:20 -0500832 1, 1, 1, 1, 1, 0, 6, 0, 5, 1,
833 2, 3, 1, 3, 1, 4, 1, 1, 1, 1,
834 1, 1, 1, 1, 1, 2, 0, 0, 5, 1,
835 1, 0, 2, 0, 2, 2, 3, 1, 2, 1,
836 2, 5, 3, 1, 1, 4, 0, 6, 0, 8,
837 0, 7, 1, 1, 1, 0, 2, 3, 2, 2,
838 2, 3, 2, 1, 2, 1, 1, 0, 3
John Bauman66b8ab22014-05-06 15:57:45 -0400839};
840
841/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
842 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
843 means the default is an error. */
844static const yytype_uint8 yydefact[] =
845{
Nicolas Capens3c20f802015-02-17 17:17:20 -0500846 0, 0, 117, 118, 119, 0, 105, 109, 126, 123,
847 124, 125, 130, 131, 132, 133, 134, 135, 127, 128,
848 129, 136, 137, 138, 110, 111, 114, 106, 0, 0,
849 122, 139, 140, 141, 142, 144, 206, 207, 0, 76,
850 86, 0, 91, 96, 0, 108, 102, 0, 115, 120,
851 143, 0, 203, 205, 107, 101, 0, 112, 113, 0,
852 147, 71, 0, 74, 86, 104, 87, 88, 89, 77,
853 0, 86, 0, 72, 97, 103, 116, 0, 1, 204,
854 0, 145, 0, 0, 208, 78, 83, 85, 90, 0,
855 92, 79, 0, 0, 2, 5, 4, 6, 27, 0,
856 0, 0, 34, 33, 32, 3, 8, 28, 10, 15,
857 16, 0, 0, 21, 0, 35, 0, 38, 41, 42,
858 47, 50, 51, 52, 53, 55, 57, 59, 70, 0,
859 25, 73, 0, 0, 0, 149, 0, 0, 188, 0,
860 0, 0, 0, 0, 166, 175, 179, 35, 61, 68,
861 0, 157, 0, 120, 160, 177, 159, 158, 0, 161,
862 162, 163, 164, 80, 82, 84, 0, 0, 98, 0,
863 156, 100, 29, 30, 0, 12, 13, 0, 0, 19,
864 18, 0, 20, 22, 24, 31, 0, 0, 0, 0,
865 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
866 121, 0, 154, 0, 152, 148, 150, 199, 198, 173,
867 190, 0, 202, 200, 0, 186, 165, 0, 64, 65,
868 66, 67, 63, 0, 0, 180, 176, 178, 0, 93,
869 0, 95, 99, 7, 0, 14, 26, 11, 17, 23,
870 36, 37, 40, 39, 45, 46, 43, 44, 48, 49,
871 54, 56, 58, 0, 146, 0, 0, 151, 0, 0,
872 0, 0, 0, 201, 0, 167, 62, 69, 0, 94,
873 9, 0, 0, 153, 0, 172, 174, 193, 192, 195,
874 173, 0, 184, 0, 0, 0, 81, 60, 155, 0,
875 194, 0, 0, 183, 181, 0, 0, 168, 0, 196,
876 0, 173, 0, 170, 187, 169, 0, 197, 191, 182,
877 185, 189
John Bauman66b8ab22014-05-06 15:57:45 -0400878};
879
880/* YYDEFGOTO[NTERM-NUM]. */
881static const yytype_int16 yydefgoto[] =
882{
Nicolas Capens3c20f802015-02-17 17:17:20 -0500883 -1, 105, 106, 107, 234, 108, 109, 110, 111, 112,
884 113, 114, 147, 116, 117, 118, 119, 120, 121, 122,
885 123, 124, 125, 126, 127, 148, 149, 223, 150, 129,
886 151, 152, 38, 39, 40, 86, 69, 70, 87, 41,
887 42, 43, 71, 44, 45, 46, 47, 48, 130, 50,
888 132, 82, 134, 135, 203, 204, 171, 154, 155, 156,
889 157, 217, 285, 304, 258, 259, 260, 305, 158, 159,
890 160, 294, 284, 161, 264, 209, 261, 279, 291, 292,
891 162, 51, 52, 53, 62
John Bauman66b8ab22014-05-06 15:57:45 -0400892};
893
894/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
895 STATE-NUM. */
Nicolas Capens3c20f802015-02-17 17:17:20 -0500896#define YYPACT_NINF -265
John Bauman66b8ab22014-05-06 15:57:45 -0400897static const yytype_int16 yypact[] =
898{
Nicolas Capens3c20f802015-02-17 17:17:20 -0500899 1359, -22, -265, -265, -265, 108, -265, -265, -265, -265,
900 -265, -265, -265, -265, -265, -265, -265, -265, -265, -265,
901 -265, -265, -265, -265, -265, -265, -265, -265, -6, -37,
902 -265, -265, -265, -265, -265, -265, -265, -40, -9, -11,
903 1, -32, -265, 31, 1408, -265, -265, 1506, -265, 20,
904 -265, 1305, -265, -265, -265, -265, 1506, -265, -265, 15,
905 -265, -265, 59, -265, 27, -265, -265, -265, -265, -265,
906 1408, 103, 101, -265, 3, -265, -265, 1047, -265, -265,
907 67, -265, 1408, 298, -265, -265, -265, -265, 105, 1408,
908 -64, -265, 822, 1047, 79, -265, -265, -265, -265, 1047,
909 1047, 1047, -265, -265, -265, -265, -265, 4, -265, -265,
910 -265, 83, -28, 1120, 81, -265, 1047, 40, -53, -265,
911 -42, 80, -265, -265, -265, 93, 96, -57, -265, 84,
912 -265, -265, 1408, 113, 1193, -265, 82, 85, -265, 89,
913 90, 86, 898, 91, 88, -265, -265, -1, -265, -265,
914 13, -265, -40, 62, -265, -265, -265, -265, 392, -265,
915 -265, -265, -265, 92, -265, -265, 971, 1047, -265, 97,
916 -265, -265, -265, -265, -14, -265, -265, 1047, 1455, -265,
917 -265, 1047, 99, -265, -265, -265, 1047, 1047, 1047, 1047,
918 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047,
919 -265, 1242, 102, 39, -265, -265, -265, -265, -265, 104,
920 -265, 1047, -265, -265, 41, -265, -265, 486, -265, -265,
921 -265, -265, -265, 1047, 1047, -265, -265, -265, 1047, -265,
922 100, -265, -265, -265, 106, 98, -265, 110, -265, -265,
923 -265, -265, 40, 40, -265, -265, -265, -265, -42, -42,
924 -265, 93, 96, 60, -265, 1047, 113, -265, 141, 59,
925 674, 199, 14, -265, 749, 486, -265, -265, 109, -265,
926 -265, 1047, 111, -265, 115, -265, -265, -265, -265, 749,
927 104, 152, 98, 140, 130, 128, -265, -265, -265, 1047,
928 -265, 124, 135, 181, -265, 129, 580, -265, 17, 1047,
929 580, 104, 1047, -265, -265, -265, 127, 98, -265, -265,
930 -265, -265
John Bauman66b8ab22014-05-06 15:57:45 -0400931};
932
933/* YYPGOTO[NTERM-NUM]. */
934static const yytype_int16 yypgoto[] =
935{
Nicolas Capens3c20f802015-02-17 17:17:20 -0500936 -265, -265, -265, -265, -265, -265, -265, 43, -265, -265,
937 -265, -265, -71, -265, -34, -265, -83, -43, -265, -265,
938 -265, 26, 45, 25, -265, -75, -88, -265, -100, -85,
939 11, 12, -265, -265, -265, 149, 179, 175, 161, -265,
940 -265, -249, -265, -265, -265, -36, 247, -21, 0, -265,
941 -265, -265, 121, -125, -265, 10, -163, 6, -136, -246,
942 -265, -265, -265, -31, -264, -265, -265, -59, 51, 9,
943 -265, -265, -8, -265, -265, -265, -265, -265, -265, -265,
944 -265, -265, 221, -265, -265
John Bauman66b8ab22014-05-06 15:57:45 -0400945};
946
947/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
948 positive, shift that token. If negative, reduce the rule which
949 number is the opposite. If zero, do what YYDEFACT says.
950 If YYTABLE_NINF, syntax error. */
Nicolas Capens3c20f802015-02-17 17:17:20 -0500951#define YYTABLE_NINF -172
John Bauman66b8ab22014-05-06 15:57:45 -0400952static const yytype_int16 yytable[] =
953{
Nicolas Capens3c20f802015-02-17 17:17:20 -0500954 49, 174, 128, 84, 231, 170, 115, 169, 75, 206,
955 65, 36, 37, 198, 276, 283, 293, 128, 59, 54,
956 166, 115, 227, 190, 191, 183, 76, 167, 172, 173,
957 283, 57, 58, 55, 88, 80, 65, 309, 66, 67,
958 68, 188, 214, 189, 49, 185, 133, 49, 199, 60,
959 303, 49, 61, 88, 303, 180, 49, 72, 192, 193,
960 73, 181, 36, 37, 66, 67, 68, 175, 176, 233,
961 49, 218, 219, 220, 63, 224, 206, 235, 64, 170,
962 221, 230, 49, 153, -75, 91, 74, 92, 177, 49,
963 222, 128, 178, 239, 93, 115, 133, 280, 133, 253,
964 306, 81, 224, 224, 77, 225, 224, 244, 245, 246,
965 247, 262, 2, 3, 4, 240, 241, 115, 115, 115,
966 115, 115, 115, 115, 115, 115, 115, 115, 256, 227,
967 224, 257, 49, 263, 49, 266, 267, 186, 187, 310,
968 66, 67, 68, 268, -25, 83, 77, 194, 195, 224,
969 271, 248, 249, 128, 242, 243, 90, 115, 153, 131,
970 163, -26, 196, 184, 282, 133, 179, 197, 202, 200,
971 272, 210, 211, 215, 207, 216, 228, 208, 212, 282,
972 128, -122, 232, 287, 115, 269, 255, 224, 274, 298,
973 -171, 270, -27, 54, 286, 295, 288, 289, 301, 307,
974 275, 49, 1, 2, 3, 4, 5, 6, 7, 8,
975 9, 10, 11, 296, 170, 297, 299, 153, 300, 311,
976 302, 238, 250, 252, 12, 13, 14, 15, 16, 17,
977 18, 19, 20, 21, 22, 23, 24, 25, 164, 26,
978 27, 28, 251, 85, 29, 30, 89, 31, 32, 33,
979 165, 34, 56, 201, 94, 35, 95, 96, 97, 98,
980 153, 153, 99, 100, 153, 153, 273, 277, 265, 308,
981 278, 290, 79, 0, 0, 0, 0, 0, 0, 153,
982 0, 101, 0, 0, 0, 0, 0, 0, 0, 0,
983 0, 146, 102, 103, 0, 104, 153, 0, 0, 0,
984 153, 1, 2, 3, 4, 5, 6, 7, 8, 9,
985 10, 11, 136, 137, 138, 0, 139, 140, 141, 142,
986 0, 0, 0, 12, 13, 14, 15, 16, 17, 18,
987 19, 20, 21, 22, 23, 24, 25, 0, 26, 27,
988 28, 0, 0, 29, 30, 143, 31, 32, 33, 0,
989 34, 0, 0, 94, 35, 95, 96, 97, 98, 0,
990 0, 99, 100, 0, 0, 0, 0, 0, 0, 0,
John Bauman66b8ab22014-05-06 15:57:45 -0400991 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Nicolas Capens3c20f802015-02-17 17:17:20 -0500992 101, 0, 0, 0, 144, 145, 0, 0, 0, 0,
993 146, 102, 103, 0, 104, 1, 2, 3, 4, 5,
994 6, 7, 8, 9, 10, 11, 136, 137, 138, 0,
995 139, 140, 141, 142, 0, 0, 0, 12, 13, 14,
Nicolas Capensa6a79ab2015-02-17 12:42:14 -0500996 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
Nicolas Capens3c20f802015-02-17 17:17:20 -0500997 25, 0, 26, 27, 28, 0, 0, 29, 30, 143,
998 31, 32, 33, 0, 34, 0, 0, 94, 35, 95,
999 96, 97, 98, 0, 0, 99, 100, 0, 0, 0,
Nicolas Capensc6841852015-02-15 14:25:37 -05001000 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Nicolas Capens3c20f802015-02-17 17:17:20 -05001001 0, 0, 0, 0, 101, 0, 0, 0, 144, 226,
1002 0, 0, 0, 0, 146, 102, 103, 0, 104, 1,
1003 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
1004 136, 137, 138, 0, 139, 140, 141, 142, 0, 0,
1005 0, 12, 13, 14, 15, 16, 17, 18, 19, 20,
1006 21, 22, 23, 24, 25, 0, 26, 27, 28, 0,
1007 0, 29, 30, 143, 31, 32, 33, 0, 34, 0,
1008 0, 94, 35, 95, 96, 97, 98, 0, 0, 99,
1009 100, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1010 0, 0, 0, 0, 0, 0, 0, 0, 101, 0,
1011 0, 0, 144, 0, 0, 0, 0, 0, 146, 102,
1012 103, 0, 104, 1, 2, 3, 4, 5, 6, 7,
1013 8, 9, 10, 11, 136, 137, 138, 0, 139, 140,
1014 141, 142, 0, 0, 0, 12, 13, 14, 15, 16,
1015 17, 18, 19, 20, 21, 22, 23, 24, 25, 0,
1016 26, 27, 28, 0, 0, 29, 30, 143, 31, 32,
1017 33, 0, 34, 0, 0, 94, 35, 95, 96, 97,
1018 98, 0, 0, 99, 100, 0, 0, 0, 0, 0,
Nicolas Capensc6841852015-02-15 14:25:37 -05001019 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Nicolas Capens3c20f802015-02-17 17:17:20 -05001020 0, 0, 101, 0, 0, 0, 83, 0, 0, 0,
1021 0, 0, 146, 102, 103, 0, 104, 1, 2, 3,
1022 4, 5, 6, 7, 8, 9, 10, 11, 136, 137,
1023 138, 0, 139, 140, 141, 142, 0, 0, 0, 12,
1024 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
1025 23, 24, 25, 0, 26, 27, 28, 0, 0, 29,
1026 30, 143, 31, 32, 33, 0, 34, 0, 0, 94,
1027 35, 95, 96, 97, 98, 0, 0, 99, 100, 0,
Nicolas Capensc6841852015-02-15 14:25:37 -05001028 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Nicolas Capens3c20f802015-02-17 17:17:20 -05001029 0, 0, 281, 2, 3, 4, 101, 6, 7, 8,
1030 9, 10, 11, 0, 0, 0, 146, 102, 103, 0,
1031 104, 0, 0, 0, 12, 13, 14, 15, 16, 17,
1032 18, 19, 20, 21, 22, 23, 24, 25, 0, 26,
1033 27, 28, 0, 0, 29, 30, 0, 31, 32, 33,
1034 0, 34, 0, 0, 94, 35, 95, 96, 97, 98,
1035 0, 0, 99, 100, 0, 0, 0, 0, 0, 0,
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05001036 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Nicolas Capens3c20f802015-02-17 17:17:20 -05001037 0, 101, 8, 9, 10, 11, 0, 0, 0, 0,
1038 0, 0, 102, 103, 0, 104, 0, 12, 13, 14,
1039 15, 16, 17, 18, 19, 20, 21, 22, 23, 0,
1040 0, 0, 0, 0, 0, 0, 0, 29, 30, 0,
1041 31, 32, 33, 0, 34, 0, 0, 94, 35, 95,
1042 96, 97, 98, 0, 0, 99, 100, 0, 0, 0,
1043 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1044 0, 0, 0, 0, 101, 0, 0, 168, 8, 9,
1045 10, 11, 0, 0, 0, 102, 103, 0, 104, 0,
1046 0, 0, 0, 12, 13, 14, 15, 16, 17, 18,
1047 19, 20, 21, 22, 23, 0, 0, 0, 0, 0,
1048 0, 0, 0, 29, 30, 0, 31, 32, 33, 0,
1049 34, 0, 0, 94, 35, 95, 96, 97, 98, 0,
1050 0, 99, 100, 0, 0, 0, 0, 0, 0, 0,
1051 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1052 101, 8, 9, 10, 11, 0, 0, 0, 0, 0,
1053 213, 102, 103, 0, 104, 0, 12, 13, 14, 15,
1054 16, 17, 18, 19, 20, 21, 22, 23, 0, 0,
1055 0, 0, 0, 0, 0, 0, 29, 30, 0, 31,
1056 32, 33, 0, 34, 0, 0, 94, 35, 95, 96,
1057 97, 98, 0, 0, 99, 100, 0, 0, 0, 0,
1058 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1059 0, 0, 0, 101, 0, 0, 229, 8, 9, 10,
1060 11, 0, 0, 0, 102, 103, 0, 104, 0, 0,
1061 0, 0, 12, 13, 14, 15, 16, 17, 18, 19,
1062 20, 21, 22, 23, 0, 0, 0, 0, 0, 0,
1063 0, 0, 29, 30, 0, 31, 32, 33, 0, 34,
1064 0, 0, 94, 35, 95, 96, 97, 98, 0, 0,
1065 99, 100, 0, 0, 0, 0, 0, 0, 0, 0,
1066 0, 0, 0, 0, 0, 0, 0, 0, 0, 101,
1067 8, 9, 10, 11, 0, 0, 0, 0, 0, 0,
1068 102, 103, 0, 104, 0, 12, 13, 14, 15, 16,
1069 17, 18, 19, 20, 21, 22, 23, 0, 0, 0,
1070 0, 0, 0, 0, 0, 29, 182, 0, 31, 32,
1071 33, 0, 34, 0, 0, 94, 35, 95, 96, 97,
1072 98, 0, 0, 99, 100, 0, 0, 0, 0, 0,
1073 0, 0, 0, 0, 0, 0, 0, 2, 3, 4,
1074 0, 0, 101, 8, 9, 10, 11, 0, 0, 0,
1075 0, 0, 0, 102, 103, 0, 104, 0, 12, 13,
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05001076 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
Nicolas Capens3c20f802015-02-17 17:17:20 -05001077 0, 0, 0, 0, 0, 0, 0, 0, 29, 30,
1078 0, 31, 32, 33, 0, 34, 2, 3, 4, 35,
1079 0, 0, 8, 9, 10, 11, 0, 0, 0, 0,
1080 0, 0, 0, 0, 0, 0, 0, 12, 13, 14,
1081 15, 16, 17, 18, 19, 20, 21, 22, 23, 0,
1082 205, 0, 0, 0, 0, 0, 0, 29, 30, 0,
1083 31, 32, 33, 0, 34, 0, 0, 0, 35, 0,
1084 0, 0, 0, 0, 0, 78, 0, 0, 1, 2,
1085 3, 4, 5, 6, 7, 8, 9, 10, 11, 0,
1086 0, 0, 0, 0, 0, 0, 0, 0, 0, 254,
1087 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
1088 22, 23, 24, 25, 0, 26, 27, 28, 0, 0,
1089 29, 30, 0, 31, 32, 33, 0, 34, 0, 0,
1090 0, 35, 1, 2, 3, 4, 5, 6, 7, 8,
1091 9, 10, 11, 0, 0, 0, 0, 0, 0, 0,
1092 0, 0, 0, 0, 12, 13, 14, 15, 16, 17,
1093 18, 19, 20, 21, 22, 23, 24, 25, 0, 26,
1094 27, 28, 0, 0, 29, 30, 0, 31, 32, 33,
1095 0, 34, 2, 3, 4, 35, 0, 0, 8, 9,
1096 10, 11, 0, 0, 0, 0, 0, 0, 0, 0,
1097 0, 0, 0, 12, 13, 14, 15, 16, 17, 18,
1098 19, 20, 21, 22, 23, 0, 0, 0, 0, 0,
1099 0, 0, 0, 29, 30, 0, 31, 32, 33, 0,
1100 34, 0, 0, 0, 35, 8, 9, 10, 11, 0,
1101 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1102 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
1103 22, 23, 0, 0, 0, 0, 0, 0, 0, 0,
1104 29, 30, 0, 31, 32, 33, 0, 34, 0, 0,
1105 236, 35, 0, 0, 0, 237, 8, 9, 10, 11,
1106 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1107 0, 12, 13, 14, 15, 16, 17, 18, 19, 20,
1108 21, 22, 23, 0, 0, 0, 0, 0, 0, 0,
1109 0, 29, 30, 0, 31, 32, 33, 0, 34, 0,
1110 0, 0, 35
John Bauman66b8ab22014-05-06 15:57:45 -04001111};
1112
1113static const yytype_int16 yycheck[] =
1114{
Nicolas Capens3c20f802015-02-17 17:17:20 -05001115 0, 101, 77, 62, 167, 93, 77, 92, 44, 134,
1116 9, 0, 0, 70, 260, 264, 280, 92, 55, 41,
1117 84, 92, 158, 65, 66, 113, 47, 91, 99, 100,
1118 279, 37, 38, 55, 70, 56, 9, 301, 37, 38,
1119 39, 94, 142, 96, 44, 116, 82, 47, 105, 86,
1120 296, 51, 92, 89, 300, 83, 56, 89, 100, 101,
1121 92, 89, 51, 51, 37, 38, 39, 63, 64, 83,
1122 70, 72, 73, 74, 83, 89, 201, 177, 89, 167,
1123 81, 166, 82, 83, 83, 82, 55, 84, 84, 89,
1124 91, 166, 88, 181, 91, 166, 132, 83, 134, 199,
1125 83, 86, 89, 89, 84, 92, 89, 190, 191, 192,
1126 193, 211, 4, 5, 6, 186, 187, 188, 189, 190,
1127 191, 192, 193, 194, 195, 196, 197, 198, 89, 265,
1128 89, 92, 132, 92, 134, 223, 224, 97, 98, 302,
1129 37, 38, 39, 228, 82, 86, 84, 67, 68, 89,
1130 90, 194, 195, 228, 188, 189, 55, 228, 158, 92,
1131 55, 82, 69, 82, 264, 201, 83, 71, 55, 85,
1132 255, 82, 82, 82, 92, 87, 84, 92, 92, 279,
1133 255, 82, 85, 271, 255, 85, 84, 89, 47, 289,
1134 86, 85, 82, 41, 85, 55, 85, 82, 17, 299,
1135 259, 201, 3, 4, 5, 6, 7, 8, 9, 10,
1136 11, 12, 13, 83, 302, 87, 92, 217, 83, 92,
1137 91, 178, 196, 198, 25, 26, 27, 28, 29, 30,
1138 31, 32, 33, 34, 35, 36, 37, 38, 89, 40,
1139 41, 42, 197, 64, 45, 46, 71, 48, 49, 50,
1140 89, 52, 5, 132, 55, 56, 57, 58, 59, 60,
1141 260, 261, 63, 64, 264, 265, 256, 261, 217, 300,
1142 261, 279, 51, -1, -1, -1, -1, -1, -1, 279,
1143 -1, 82, -1, -1, -1, -1, -1, -1, -1, -1,
1144 -1, 92, 93, 94, -1, 96, 296, -1, -1, -1,
1145 300, 3, 4, 5, 6, 7, 8, 9, 10, 11,
1146 12, 13, 14, 15, 16, -1, 18, 19, 20, 21,
1147 -1, -1, -1, 25, 26, 27, 28, 29, 30, 31,
1148 32, 33, 34, 35, 36, 37, 38, -1, 40, 41,
1149 42, -1, -1, 45, 46, 47, 48, 49, 50, -1,
1150 52, -1, -1, 55, 56, 57, 58, 59, 60, -1,
1151 -1, 63, 64, -1, -1, -1, -1, -1, -1, -1,
John Bauman66b8ab22014-05-06 15:57:45 -04001152 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Nicolas Capens3c20f802015-02-17 17:17:20 -05001153 82, -1, -1, -1, 86, 87, -1, -1, -1, -1,
1154 92, 93, 94, -1, 96, 3, 4, 5, 6, 7,
1155 8, 9, 10, 11, 12, 13, 14, 15, 16, -1,
1156 18, 19, 20, 21, -1, -1, -1, 25, 26, 27,
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05001157 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
Nicolas Capens3c20f802015-02-17 17:17:20 -05001158 38, -1, 40, 41, 42, -1, -1, 45, 46, 47,
1159 48, 49, 50, -1, 52, -1, -1, 55, 56, 57,
1160 58, 59, 60, -1, -1, 63, 64, -1, -1, -1,
Nicolas Capensc6841852015-02-15 14:25:37 -05001161 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Nicolas Capens3c20f802015-02-17 17:17:20 -05001162 -1, -1, -1, -1, 82, -1, -1, -1, 86, 87,
1163 -1, -1, -1, -1, 92, 93, 94, -1, 96, 3,
1164 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
1165 14, 15, 16, -1, 18, 19, 20, 21, -1, -1,
1166 -1, 25, 26, 27, 28, 29, 30, 31, 32, 33,
1167 34, 35, 36, 37, 38, -1, 40, 41, 42, -1,
1168 -1, 45, 46, 47, 48, 49, 50, -1, 52, -1,
1169 -1, 55, 56, 57, 58, 59, 60, -1, -1, 63,
1170 64, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1171 -1, -1, -1, -1, -1, -1, -1, -1, 82, -1,
1172 -1, -1, 86, -1, -1, -1, -1, -1, 92, 93,
1173 94, -1, 96, 3, 4, 5, 6, 7, 8, 9,
1174 10, 11, 12, 13, 14, 15, 16, -1, 18, 19,
1175 20, 21, -1, -1, -1, 25, 26, 27, 28, 29,
1176 30, 31, 32, 33, 34, 35, 36, 37, 38, -1,
1177 40, 41, 42, -1, -1, 45, 46, 47, 48, 49,
1178 50, -1, 52, -1, -1, 55, 56, 57, 58, 59,
1179 60, -1, -1, 63, 64, -1, -1, -1, -1, -1,
Nicolas Capensc6841852015-02-15 14:25:37 -05001180 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Nicolas Capens3c20f802015-02-17 17:17:20 -05001181 -1, -1, 82, -1, -1, -1, 86, -1, -1, -1,
1182 -1, -1, 92, 93, 94, -1, 96, 3, 4, 5,
1183 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
1184 16, -1, 18, 19, 20, 21, -1, -1, -1, 25,
1185 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
1186 36, 37, 38, -1, 40, 41, 42, -1, -1, 45,
1187 46, 47, 48, 49, 50, -1, 52, -1, -1, 55,
1188 56, 57, 58, 59, 60, -1, -1, 63, 64, -1,
Nicolas Capensc6841852015-02-15 14:25:37 -05001189 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Nicolas Capens3c20f802015-02-17 17:17:20 -05001190 -1, -1, 3, 4, 5, 6, 82, 8, 9, 10,
1191 11, 12, 13, -1, -1, -1, 92, 93, 94, -1,
1192 96, -1, -1, -1, 25, 26, 27, 28, 29, 30,
1193 31, 32, 33, 34, 35, 36, 37, 38, -1, 40,
1194 41, 42, -1, -1, 45, 46, -1, 48, 49, 50,
1195 -1, 52, -1, -1, 55, 56, 57, 58, 59, 60,
1196 -1, -1, 63, 64, -1, -1, -1, -1, -1, -1,
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05001197 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Nicolas Capens3c20f802015-02-17 17:17:20 -05001198 -1, 82, 10, 11, 12, 13, -1, -1, -1, -1,
1199 -1, -1, 93, 94, -1, 96, -1, 25, 26, 27,
1200 28, 29, 30, 31, 32, 33, 34, 35, 36, -1,
1201 -1, -1, -1, -1, -1, -1, -1, 45, 46, -1,
1202 48, 49, 50, -1, 52, -1, -1, 55, 56, 57,
1203 58, 59, 60, -1, -1, 63, 64, -1, -1, -1,
1204 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1205 -1, -1, -1, -1, 82, -1, -1, 85, 10, 11,
1206 12, 13, -1, -1, -1, 93, 94, -1, 96, -1,
1207 -1, -1, -1, 25, 26, 27, 28, 29, 30, 31,
1208 32, 33, 34, 35, 36, -1, -1, -1, -1, -1,
1209 -1, -1, -1, 45, 46, -1, 48, 49, 50, -1,
1210 52, -1, -1, 55, 56, 57, 58, 59, 60, -1,
1211 -1, 63, 64, -1, -1, -1, -1, -1, -1, -1,
1212 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1213 82, 10, 11, 12, 13, -1, -1, -1, -1, -1,
1214 92, 93, 94, -1, 96, -1, 25, 26, 27, 28,
1215 29, 30, 31, 32, 33, 34, 35, 36, -1, -1,
1216 -1, -1, -1, -1, -1, -1, 45, 46, -1, 48,
1217 49, 50, -1, 52, -1, -1, 55, 56, 57, 58,
1218 59, 60, -1, -1, 63, 64, -1, -1, -1, -1,
1219 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1220 -1, -1, -1, 82, -1, -1, 85, 10, 11, 12,
1221 13, -1, -1, -1, 93, 94, -1, 96, -1, -1,
1222 -1, -1, 25, 26, 27, 28, 29, 30, 31, 32,
1223 33, 34, 35, 36, -1, -1, -1, -1, -1, -1,
1224 -1, -1, 45, 46, -1, 48, 49, 50, -1, 52,
1225 -1, -1, 55, 56, 57, 58, 59, 60, -1, -1,
1226 63, 64, -1, -1, -1, -1, -1, -1, -1, -1,
1227 -1, -1, -1, -1, -1, -1, -1, -1, -1, 82,
1228 10, 11, 12, 13, -1, -1, -1, -1, -1, -1,
1229 93, 94, -1, 96, -1, 25, 26, 27, 28, 29,
1230 30, 31, 32, 33, 34, 35, 36, -1, -1, -1,
1231 -1, -1, -1, -1, -1, 45, 46, -1, 48, 49,
1232 50, -1, 52, -1, -1, 55, 56, 57, 58, 59,
1233 60, -1, -1, 63, 64, -1, -1, -1, -1, -1,
1234 -1, -1, -1, -1, -1, -1, -1, 4, 5, 6,
1235 -1, -1, 82, 10, 11, 12, 13, -1, -1, -1,
1236 -1, -1, -1, 93, 94, -1, 96, -1, 25, 26,
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05001237 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
Nicolas Capens3c20f802015-02-17 17:17:20 -05001238 -1, -1, -1, -1, -1, -1, -1, -1, 45, 46,
1239 -1, 48, 49, 50, -1, 52, 4, 5, 6, 56,
1240 -1, -1, 10, 11, 12, 13, -1, -1, -1, -1,
1241 -1, -1, -1, -1, -1, -1, -1, 25, 26, 27,
1242 28, 29, 30, 31, 32, 33, 34, 35, 36, -1,
1243 87, -1, -1, -1, -1, -1, -1, 45, 46, -1,
1244 48, 49, 50, -1, 52, -1, -1, -1, 56, -1,
1245 -1, -1, -1, -1, -1, 0, -1, -1, 3, 4,
1246 5, 6, 7, 8, 9, 10, 11, 12, 13, -1,
1247 -1, -1, -1, -1, -1, -1, -1, -1, -1, 87,
1248 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1249 35, 36, 37, 38, -1, 40, 41, 42, -1, -1,
1250 45, 46, -1, 48, 49, 50, -1, 52, -1, -1,
1251 -1, 56, 3, 4, 5, 6, 7, 8, 9, 10,
1252 11, 12, 13, -1, -1, -1, -1, -1, -1, -1,
1253 -1, -1, -1, -1, 25, 26, 27, 28, 29, 30,
1254 31, 32, 33, 34, 35, 36, 37, 38, -1, 40,
1255 41, 42, -1, -1, 45, 46, -1, 48, 49, 50,
1256 -1, 52, 4, 5, 6, 56, -1, -1, 10, 11,
1257 12, 13, -1, -1, -1, -1, -1, -1, -1, -1,
1258 -1, -1, -1, 25, 26, 27, 28, 29, 30, 31,
1259 32, 33, 34, 35, 36, -1, -1, -1, -1, -1,
1260 -1, -1, -1, 45, 46, -1, 48, 49, 50, -1,
1261 52, -1, -1, -1, 56, 10, 11, 12, 13, -1,
1262 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1263 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1264 35, 36, -1, -1, -1, -1, -1, -1, -1, -1,
1265 45, 46, -1, 48, 49, 50, -1, 52, -1, -1,
1266 55, 56, -1, -1, -1, 60, 10, 11, 12, 13,
1267 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1268 -1, 25, 26, 27, 28, 29, 30, 31, 32, 33,
1269 34, 35, 36, -1, -1, -1, -1, -1, -1, -1,
1270 -1, 45, 46, -1, 48, 49, 50, -1, 52, -1,
1271 -1, -1, 56
John Bauman66b8ab22014-05-06 15:57:45 -04001272};
1273
1274/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
1275 symbol of state STATE-NUM. */
1276static const yytype_uint8 yystos[] =
1277{
1278 0, 3, 4, 5, 6, 7, 8, 9, 10, 11,
Nicolas Capens3c20f802015-02-17 17:17:20 -05001279 12, 13, 25, 26, 27, 28, 29, 30, 31, 32,
1280 33, 34, 35, 36, 37, 38, 40, 41, 42, 45,
1281 46, 48, 49, 50, 52, 56, 136, 137, 138, 139,
1282 140, 145, 146, 147, 149, 150, 151, 152, 153, 154,
1283 155, 187, 188, 189, 41, 55, 152, 37, 38, 55,
1284 86, 92, 190, 83, 89, 9, 37, 38, 39, 142,
1285 143, 148, 89, 92, 55, 151, 153, 84, 0, 188,
1286 153, 86, 157, 86, 173, 142, 141, 144, 151, 143,
1287 55, 82, 84, 91, 55, 57, 58, 59, 60, 63,
1288 64, 82, 93, 94, 96, 107, 108, 109, 111, 112,
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05001289 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,
Nicolas Capens3c20f802015-02-17 17:17:20 -05001290 123, 124, 125, 126, 127, 128, 129, 130, 131, 135,
1291 154, 92, 156, 151, 158, 159, 14, 15, 16, 18,
1292 19, 20, 21, 47, 86, 87, 92, 118, 131, 132,
1293 134, 136, 137, 154, 163, 164, 165, 166, 174, 175,
1294 176, 179, 186, 55, 141, 144, 84, 91, 85, 135,
1295 132, 162, 118, 118, 134, 63, 64, 84, 88, 83,
1296 83, 89, 46, 132, 82, 118, 97, 98, 94, 96,
1297 65, 66, 100, 101, 67, 68, 69, 71, 70, 105,
1298 85, 158, 55, 160, 161, 87, 159, 92, 92, 181,
1299 82, 82, 92, 92, 134, 82, 87, 167, 72, 73,
1300 74, 81, 91, 133, 89, 92, 87, 164, 84, 85,
1301 135, 162, 85, 83, 110, 134, 55, 60, 113, 132,
1302 118, 118, 120, 120, 122, 122, 122, 122, 123, 123,
1303 127, 128, 129, 134, 87, 84, 89, 92, 170, 171,
1304 172, 182, 134, 92, 180, 174, 132, 132, 135, 85,
1305 85, 90, 135, 161, 47, 173, 165, 163, 175, 183,
1306 83, 3, 134, 147, 178, 168, 85, 132, 85, 82,
1307 178, 184, 185, 170, 177, 55, 83, 87, 134, 92,
1308 83, 17, 91, 165, 169, 173, 83, 134, 169, 170,
1309 162, 92
John Bauman66b8ab22014-05-06 15:57:45 -04001310};
1311
1312#define yyerrok (yyerrstatus = 0)
1313#define yyclearin (yychar = YYEMPTY)
1314#define YYEMPTY (-2)
1315#define YYEOF 0
1316
1317#define YYACCEPT goto yyacceptlab
1318#define YYABORT goto yyabortlab
1319#define YYERROR goto yyerrorlab
1320
1321
1322/* Like YYERROR except do call yyerror. This remains here temporarily
1323 to ease the transition to the new meaning of YYERROR, for GCC.
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04001324 Once GCC version 2 has supplanted version 1, this can go. */
John Bauman66b8ab22014-05-06 15:57:45 -04001325
1326#define YYFAIL goto yyerrlab
John Bauman66b8ab22014-05-06 15:57:45 -04001327
1328#define YYRECOVERING() (!!yyerrstatus)
1329
1330#define YYBACKUP(Token, Value) \
1331do \
1332 if (yychar == YYEMPTY && yylen == 1) \
1333 { \
1334 yychar = (Token); \
1335 yylval = (Value); \
1336 yytoken = YYTRANSLATE (yychar); \
1337 YYPOPSTACK (1); \
1338 goto yybackup; \
1339 } \
1340 else \
1341 { \
1342 yyerror (context, YY_("syntax error: cannot back up")); \
1343 YYERROR; \
1344 } \
1345while (YYID (0))
1346
1347
1348#define YYTERROR 1
1349#define YYERRCODE 256
1350
1351
1352/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
1353 If N is 0, then set CURRENT to the empty location which ends
1354 the previous symbol: RHS[0] (always defined). */
1355
1356#define YYRHSLOC(Rhs, K) ((Rhs)[K])
1357#ifndef YYLLOC_DEFAULT
1358# define YYLLOC_DEFAULT(Current, Rhs, N) \
1359 do \
1360 if (YYID (N)) \
1361 { \
1362 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
1363 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
1364 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
1365 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
1366 } \
1367 else \
1368 { \
1369 (Current).first_line = (Current).last_line = \
1370 YYRHSLOC (Rhs, 0).last_line; \
1371 (Current).first_column = (Current).last_column = \
1372 YYRHSLOC (Rhs, 0).last_column; \
1373 } \
1374 while (YYID (0))
1375#endif
1376
1377
1378/* YY_LOCATION_PRINT -- Print the location on the stream.
1379 This macro was not mandated originally: define only if we know
1380 we won't break user code: when these are the locations we know. */
1381
1382#ifndef YY_LOCATION_PRINT
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04001383# if YYLTYPE_IS_TRIVIAL
John Bauman66b8ab22014-05-06 15:57:45 -04001384# define YY_LOCATION_PRINT(File, Loc) \
1385 fprintf (File, "%d.%d-%d.%d", \
1386 (Loc).first_line, (Loc).first_column, \
1387 (Loc).last_line, (Loc).last_column)
1388# else
1389# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1390# endif
1391#endif
1392
1393
1394/* YYLEX -- calling `yylex' with the right arguments. */
1395
1396#ifdef YYLEX_PARAM
1397# define YYLEX yylex (&yylval, YYLEX_PARAM)
1398#else
1399# define YYLEX yylex (&yylval)
1400#endif
1401
1402/* Enable debugging if requested. */
1403#if YYDEBUG
1404
1405# ifndef YYFPRINTF
1406# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1407# define YYFPRINTF fprintf
1408# endif
1409
1410# define YYDPRINTF(Args) \
1411do { \
1412 if (yydebug) \
1413 YYFPRINTF Args; \
1414} while (YYID (0))
1415
1416# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
1417do { \
1418 if (yydebug) \
1419 { \
1420 YYFPRINTF (stderr, "%s ", Title); \
1421 yy_symbol_print (stderr, \
1422 Type, Value, context); \
1423 YYFPRINTF (stderr, "\n"); \
1424 } \
1425} while (YYID (0))
1426
1427
1428/*--------------------------------.
1429| Print this symbol on YYOUTPUT. |
1430`--------------------------------*/
1431
1432/*ARGSUSED*/
1433#if (defined __STDC__ || defined __C99__FUNC__ \
1434 || defined __cplusplus || defined _MSC_VER)
1435static void
1436yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, TParseContext* context)
1437#else
1438static void
1439yy_symbol_value_print (yyoutput, yytype, yyvaluep, context)
1440 FILE *yyoutput;
1441 int yytype;
1442 YYSTYPE const * const yyvaluep;
1443 TParseContext* context;
1444#endif
1445{
1446 if (!yyvaluep)
1447 return;
1448 YYUSE (context);
1449# ifdef YYPRINT
1450 if (yytype < YYNTOKENS)
1451 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1452# else
1453 YYUSE (yyoutput);
1454# endif
1455 switch (yytype)
1456 {
1457 default:
1458 break;
1459 }
1460}
1461
1462
1463/*--------------------------------.
1464| Print this symbol on YYOUTPUT. |
1465`--------------------------------*/
1466
1467#if (defined __STDC__ || defined __C99__FUNC__ \
1468 || defined __cplusplus || defined _MSC_VER)
1469static void
1470yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, TParseContext* context)
1471#else
1472static void
1473yy_symbol_print (yyoutput, yytype, yyvaluep, context)
1474 FILE *yyoutput;
1475 int yytype;
1476 YYSTYPE const * const yyvaluep;
1477 TParseContext* context;
1478#endif
1479{
1480 if (yytype < YYNTOKENS)
1481 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1482 else
1483 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1484
1485 yy_symbol_value_print (yyoutput, yytype, yyvaluep, context);
1486 YYFPRINTF (yyoutput, ")");
1487}
1488
1489/*------------------------------------------------------------------.
1490| yy_stack_print -- Print the state stack from its BOTTOM up to its |
1491| TOP (included). |
1492`------------------------------------------------------------------*/
1493
1494#if (defined __STDC__ || defined __C99__FUNC__ \
1495 || defined __cplusplus || defined _MSC_VER)
1496static void
1497yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
1498#else
1499static void
1500yy_stack_print (yybottom, yytop)
1501 yytype_int16 *yybottom;
1502 yytype_int16 *yytop;
1503#endif
1504{
1505 YYFPRINTF (stderr, "Stack now");
1506 for (; yybottom <= yytop; yybottom++)
1507 {
1508 int yybot = *yybottom;
1509 YYFPRINTF (stderr, " %d", yybot);
1510 }
1511 YYFPRINTF (stderr, "\n");
1512}
1513
1514# define YY_STACK_PRINT(Bottom, Top) \
1515do { \
1516 if (yydebug) \
1517 yy_stack_print ((Bottom), (Top)); \
1518} while (YYID (0))
1519
1520
1521/*------------------------------------------------.
1522| Report that the YYRULE is going to be reduced. |
1523`------------------------------------------------*/
1524
1525#if (defined __STDC__ || defined __C99__FUNC__ \
1526 || defined __cplusplus || defined _MSC_VER)
1527static void
1528yy_reduce_print (YYSTYPE *yyvsp, int yyrule, TParseContext* context)
1529#else
1530static void
1531yy_reduce_print (yyvsp, yyrule, context)
1532 YYSTYPE *yyvsp;
1533 int yyrule;
1534 TParseContext* context;
1535#endif
1536{
1537 int yynrhs = yyr2[yyrule];
1538 int yyi;
1539 unsigned long int yylno = yyrline[yyrule];
1540 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1541 yyrule - 1, yylno);
1542 /* The symbols being reduced. */
1543 for (yyi = 0; yyi < yynrhs; yyi++)
1544 {
1545 YYFPRINTF (stderr, " $%d = ", yyi + 1);
1546 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1547 &(yyvsp[(yyi + 1) - (yynrhs)])
1548 , context);
1549 YYFPRINTF (stderr, "\n");
1550 }
1551}
1552
1553# define YY_REDUCE_PRINT(Rule) \
1554do { \
1555 if (yydebug) \
1556 yy_reduce_print (yyvsp, Rule, context); \
1557} while (YYID (0))
1558
1559/* Nonzero means print parse trace. It is left uninitialized so that
1560 multiple parsers can coexist. */
1561int yydebug;
1562#else /* !YYDEBUG */
1563# define YYDPRINTF(Args)
1564# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1565# define YY_STACK_PRINT(Bottom, Top)
1566# define YY_REDUCE_PRINT(Rule)
1567#endif /* !YYDEBUG */
1568
1569
1570/* YYINITDEPTH -- initial size of the parser's stacks. */
1571#ifndef YYINITDEPTH
1572# define YYINITDEPTH 200
1573#endif
1574
1575/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1576 if the built-in stack extension method is used).
1577
1578 Do not make this value too large; the results are undefined if
1579 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1580 evaluated with infinite-precision integer arithmetic. */
1581
1582#ifndef YYMAXDEPTH
1583# define YYMAXDEPTH 10000
1584#endif
1585
1586
1587
1588#if YYERROR_VERBOSE
1589
1590# ifndef yystrlen
1591# if defined __GLIBC__ && defined _STRING_H
1592# define yystrlen strlen
1593# else
1594/* Return the length of YYSTR. */
1595#if (defined __STDC__ || defined __C99__FUNC__ \
1596 || defined __cplusplus || defined _MSC_VER)
1597static YYSIZE_T
1598yystrlen (const char *yystr)
1599#else
1600static YYSIZE_T
1601yystrlen (yystr)
1602 const char *yystr;
1603#endif
1604{
1605 YYSIZE_T yylen;
1606 for (yylen = 0; yystr[yylen]; yylen++)
1607 continue;
1608 return yylen;
1609}
1610# endif
1611# endif
1612
1613# ifndef yystpcpy
1614# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1615# define yystpcpy stpcpy
1616# else
1617/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1618 YYDEST. */
1619#if (defined __STDC__ || defined __C99__FUNC__ \
1620 || defined __cplusplus || defined _MSC_VER)
1621static char *
1622yystpcpy (char *yydest, const char *yysrc)
1623#else
1624static char *
1625yystpcpy (yydest, yysrc)
1626 char *yydest;
1627 const char *yysrc;
1628#endif
1629{
1630 char *yyd = yydest;
1631 const char *yys = yysrc;
1632
1633 while ((*yyd++ = *yys++) != '\0')
1634 continue;
1635
1636 return yyd - 1;
1637}
1638# endif
1639# endif
1640
1641# ifndef yytnamerr
1642/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1643 quotes and backslashes, so that it's suitable for yyerror. The
1644 heuristic is that double-quoting is unnecessary unless the string
1645 contains an apostrophe, a comma, or backslash (other than
1646 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1647 null, do not copy; instead, return the length of what the result
1648 would have been. */
1649static YYSIZE_T
1650yytnamerr (char *yyres, const char *yystr)
1651{
1652 if (*yystr == '"')
1653 {
1654 YYSIZE_T yyn = 0;
1655 char const *yyp = yystr;
1656
1657 for (;;)
1658 switch (*++yyp)
1659 {
1660 case '\'':
1661 case ',':
1662 goto do_not_strip_quotes;
1663
1664 case '\\':
1665 if (*++yyp != '\\')
1666 goto do_not_strip_quotes;
1667 /* Fall through. */
1668 default:
1669 if (yyres)
1670 yyres[yyn] = *yyp;
1671 yyn++;
1672 break;
1673
1674 case '"':
1675 if (yyres)
1676 yyres[yyn] = '\0';
1677 return yyn;
1678 }
1679 do_not_strip_quotes: ;
1680 }
1681
1682 if (! yyres)
1683 return yystrlen (yystr);
1684
1685 return yystpcpy (yyres, yystr) - yyres;
1686}
1687# endif
1688
1689/* Copy into YYRESULT an error message about the unexpected token
1690 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1691 including the terminating null byte. If YYRESULT is null, do not
1692 copy anything; just return the number of bytes that would be
1693 copied. As a special case, return 0 if an ordinary "syntax error"
1694 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1695 size calculation. */
1696static YYSIZE_T
1697yysyntax_error (char *yyresult, int yystate, int yychar)
1698{
1699 int yyn = yypact[yystate];
1700
1701 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1702 return 0;
1703 else
1704 {
1705 int yytype = YYTRANSLATE (yychar);
1706 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1707 YYSIZE_T yysize = yysize0;
1708 YYSIZE_T yysize1;
1709 int yysize_overflow = 0;
1710 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1711 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1712 int yyx;
1713
1714# if 0
1715 /* This is so xgettext sees the translatable formats that are
1716 constructed on the fly. */
1717 YY_("syntax error, unexpected %s");
1718 YY_("syntax error, unexpected %s, expecting %s");
1719 YY_("syntax error, unexpected %s, expecting %s or %s");
1720 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1721 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1722# endif
1723 char *yyfmt;
1724 char const *yyf;
1725 static char const yyunexpected[] = "syntax error, unexpected %s";
1726 static char const yyexpecting[] = ", expecting %s";
1727 static char const yyor[] = " or %s";
1728 char yyformat[sizeof yyunexpected
1729 + sizeof yyexpecting - 1
1730 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1731 * (sizeof yyor - 1))];
1732 char const *yyprefix = yyexpecting;
1733
1734 /* Start YYX at -YYN if negative to avoid negative indexes in
1735 YYCHECK. */
1736 int yyxbegin = yyn < 0 ? -yyn : 0;
1737
1738 /* Stay within bounds of both yycheck and yytname. */
1739 int yychecklim = YYLAST - yyn + 1;
1740 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1741 int yycount = 1;
1742
1743 yyarg[0] = yytname[yytype];
1744 yyfmt = yystpcpy (yyformat, yyunexpected);
1745
1746 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1747 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1748 {
1749 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1750 {
1751 yycount = 1;
1752 yysize = yysize0;
1753 yyformat[sizeof yyunexpected - 1] = '\0';
1754 break;
1755 }
1756 yyarg[yycount++] = yytname[yyx];
1757 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1758 yysize_overflow |= (yysize1 < yysize);
1759 yysize = yysize1;
1760 yyfmt = yystpcpy (yyfmt, yyprefix);
1761 yyprefix = yyor;
1762 }
1763
1764 yyf = YY_(yyformat);
1765 yysize1 = yysize + yystrlen (yyf);
1766 yysize_overflow |= (yysize1 < yysize);
1767 yysize = yysize1;
1768
1769 if (yysize_overflow)
1770 return YYSIZE_MAXIMUM;
1771
1772 if (yyresult)
1773 {
1774 /* Avoid sprintf, as that infringes on the user's name space.
1775 Don't have undefined behavior even if the translation
1776 produced a string with the wrong number of "%s"s. */
1777 char *yyp = yyresult;
1778 int yyi = 0;
1779 while ((*yyp = *yyf) != '\0')
1780 {
1781 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1782 {
1783 yyp += yytnamerr (yyp, yyarg[yyi++]);
1784 yyf += 2;
1785 }
1786 else
1787 {
1788 yyp++;
1789 yyf++;
1790 }
1791 }
1792 }
1793 return yysize;
1794 }
1795}
1796#endif /* YYERROR_VERBOSE */
1797
1798
1799/*-----------------------------------------------.
1800| Release the memory associated to this symbol. |
1801`-----------------------------------------------*/
1802
1803/*ARGSUSED*/
1804#if (defined __STDC__ || defined __C99__FUNC__ \
1805 || defined __cplusplus || defined _MSC_VER)
1806static void
1807yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, TParseContext* context)
1808#else
1809static void
1810yydestruct (yymsg, yytype, yyvaluep, context)
1811 const char *yymsg;
1812 int yytype;
1813 YYSTYPE *yyvaluep;
1814 TParseContext* context;
1815#endif
1816{
1817 YYUSE (yyvaluep);
1818 YYUSE (context);
1819
1820 if (!yymsg)
1821 yymsg = "Deleting";
1822 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1823
1824 switch (yytype)
1825 {
1826
1827 default:
1828 break;
1829 }
1830}
1831
1832/* Prevent warnings from -Wmissing-prototypes. */
1833#ifdef YYPARSE_PARAM
1834#if defined __STDC__ || defined __cplusplus
1835int yyparse (void *YYPARSE_PARAM);
1836#else
1837int yyparse ();
1838#endif
1839#else /* ! YYPARSE_PARAM */
1840#if defined __STDC__ || defined __cplusplus
1841int yyparse (TParseContext* context);
1842#else
1843int yyparse ();
1844#endif
1845#endif /* ! YYPARSE_PARAM */
1846
1847
1848
1849
1850
1851/*-------------------------.
1852| yyparse or yypush_parse. |
1853`-------------------------*/
1854
1855#ifdef YYPARSE_PARAM
1856#if (defined __STDC__ || defined __C99__FUNC__ \
1857 || defined __cplusplus || defined _MSC_VER)
1858int
1859yyparse (void *YYPARSE_PARAM)
1860#else
1861int
1862yyparse (YYPARSE_PARAM)
1863 void *YYPARSE_PARAM;
1864#endif
1865#else /* ! YYPARSE_PARAM */
1866#if (defined __STDC__ || defined __C99__FUNC__ \
1867 || defined __cplusplus || defined _MSC_VER)
1868int
1869yyparse (TParseContext* context)
1870#else
1871int
1872yyparse (context)
1873 TParseContext* context;
1874#endif
1875#endif
1876{
1877/* The lookahead symbol. */
1878int yychar;
1879
1880/* The semantic value of the lookahead symbol. */
1881YYSTYPE yylval;
1882
1883 /* Number of syntax errors so far. */
1884 int yynerrs;
1885
1886 int yystate;
1887 /* Number of tokens to shift before error messages enabled. */
1888 int yyerrstatus;
1889
1890 /* The stacks and their tools:
1891 `yyss': related to states.
1892 `yyvs': related to semantic values.
1893
1894 Refer to the stacks thru separate pointers, to allow yyoverflow
1895 to reallocate them elsewhere. */
1896
1897 /* The state stack. */
1898 yytype_int16 yyssa[YYINITDEPTH];
1899 yytype_int16 *yyss;
1900 yytype_int16 *yyssp;
1901
1902 /* The semantic value stack. */
1903 YYSTYPE yyvsa[YYINITDEPTH];
1904 YYSTYPE *yyvs;
1905 YYSTYPE *yyvsp;
1906
1907 YYSIZE_T yystacksize;
1908
1909 int yyn;
1910 int yyresult;
1911 /* Lookahead token as an internal (translated) token number. */
1912 int yytoken;
1913 /* The variables used to return semantic value and location from the
1914 action routines. */
1915 YYSTYPE yyval;
1916
1917#if YYERROR_VERBOSE
1918 /* Buffer for error messages, and its allocated size. */
1919 char yymsgbuf[128];
1920 char *yymsg = yymsgbuf;
1921 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1922#endif
1923
1924#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1925
1926 /* The number of symbols on the RHS of the reduced rule.
1927 Keep to zero when no symbol should be popped. */
1928 int yylen = 0;
1929
1930 yytoken = 0;
1931 yyss = yyssa;
1932 yyvs = yyvsa;
1933 yystacksize = YYINITDEPTH;
1934
1935 YYDPRINTF ((stderr, "Starting parse\n"));
1936
1937 yystate = 0;
1938 yyerrstatus = 0;
1939 yynerrs = 0;
1940 yychar = YYEMPTY; /* Cause a token to be read. */
1941
1942 /* Initialize stack pointers.
1943 Waste one element of value and location stack
1944 so that they stay on the same level as the state stack.
1945 The wasted elements are never initialized. */
1946 yyssp = yyss;
1947 yyvsp = yyvs;
1948
1949 goto yysetstate;
1950
1951/*------------------------------------------------------------.
1952| yynewstate -- Push a new state, which is found in yystate. |
1953`------------------------------------------------------------*/
1954 yynewstate:
1955 /* In all cases, when you get here, the value and location stacks
1956 have just been pushed. So pushing a state here evens the stacks. */
1957 yyssp++;
1958
1959 yysetstate:
1960 *yyssp = yystate;
1961
1962 if (yyss + yystacksize - 1 <= yyssp)
1963 {
1964 /* Get the current used size of the three stacks, in elements. */
1965 YYSIZE_T yysize = yyssp - yyss + 1;
1966
1967#ifdef yyoverflow
1968 {
1969 /* Give user a chance to reallocate the stack. Use copies of
1970 these so that the &'s don't force the real ones into
1971 memory. */
1972 YYSTYPE *yyvs1 = yyvs;
1973 yytype_int16 *yyss1 = yyss;
1974
1975 /* Each stack pointer address is followed by the size of the
1976 data in use in that stack, in bytes. This used to be a
1977 conditional around just the two extra args, but that might
1978 be undefined if yyoverflow is a macro. */
1979 yyoverflow (YY_("memory exhausted"),
1980 &yyss1, yysize * sizeof (*yyssp),
1981 &yyvs1, yysize * sizeof (*yyvsp),
1982 &yystacksize);
1983
1984 yyss = yyss1;
1985 yyvs = yyvs1;
1986 }
1987#else /* no yyoverflow */
1988# ifndef YYSTACK_RELOCATE
1989 goto yyexhaustedlab;
1990# else
1991 /* Extend the stack our own way. */
1992 if (YYMAXDEPTH <= yystacksize)
1993 goto yyexhaustedlab;
1994 yystacksize *= 2;
1995 if (YYMAXDEPTH < yystacksize)
1996 yystacksize = YYMAXDEPTH;
1997
1998 {
1999 yytype_int16 *yyss1 = yyss;
2000 union yyalloc *yyptr =
2001 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
2002 if (! yyptr)
2003 goto yyexhaustedlab;
2004 YYSTACK_RELOCATE (yyss_alloc, yyss);
2005 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
2006# undef YYSTACK_RELOCATE
2007 if (yyss1 != yyssa)
2008 YYSTACK_FREE (yyss1);
2009 }
2010# endif
2011#endif /* no yyoverflow */
2012
2013 yyssp = yyss + yysize - 1;
2014 yyvsp = yyvs + yysize - 1;
2015
2016 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
2017 (unsigned long int) yystacksize));
2018
2019 if (yyss + yystacksize - 1 <= yyssp)
2020 YYABORT;
2021 }
2022
2023 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
2024
2025 if (yystate == YYFINAL)
2026 YYACCEPT;
2027
2028 goto yybackup;
2029
2030/*-----------.
2031| yybackup. |
2032`-----------*/
2033yybackup:
2034
2035 /* Do appropriate processing given the current state. Read a
2036 lookahead token if we need one and don't already have one. */
2037
2038 /* First try to decide what to do without reference to lookahead token. */
2039 yyn = yypact[yystate];
2040 if (yyn == YYPACT_NINF)
2041 goto yydefault;
2042
2043 /* Not known => get a lookahead token if don't already have one. */
2044
2045 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
2046 if (yychar == YYEMPTY)
2047 {
2048 YYDPRINTF ((stderr, "Reading a token: "));
2049 yychar = YYLEX;
2050 }
2051
2052 if (yychar <= YYEOF)
2053 {
2054 yychar = yytoken = YYEOF;
2055 YYDPRINTF ((stderr, "Now at end of input.\n"));
2056 }
2057 else
2058 {
2059 yytoken = YYTRANSLATE (yychar);
2060 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
2061 }
2062
2063 /* If the proper action on seeing token YYTOKEN is to reduce or to
2064 detect an error, take that action. */
2065 yyn += yytoken;
2066 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
2067 goto yydefault;
2068 yyn = yytable[yyn];
2069 if (yyn <= 0)
2070 {
2071 if (yyn == 0 || yyn == YYTABLE_NINF)
2072 goto yyerrlab;
2073 yyn = -yyn;
2074 goto yyreduce;
2075 }
2076
2077 /* Count tokens shifted since error; after three, turn off error
2078 status. */
2079 if (yyerrstatus)
2080 yyerrstatus--;
2081
2082 /* Shift the lookahead token. */
2083 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
2084
2085 /* Discard the shifted token. */
2086 yychar = YYEMPTY;
2087
2088 yystate = yyn;
2089 *++yyvsp = yylval;
2090
2091 goto yynewstate;
2092
2093
2094/*-----------------------------------------------------------.
2095| yydefault -- do the default action for the current state. |
2096`-----------------------------------------------------------*/
2097yydefault:
2098 yyn = yydefact[yystate];
2099 if (yyn == 0)
2100 goto yyerrlab;
2101 goto yyreduce;
2102
2103
2104/*-----------------------------.
2105| yyreduce -- Do a reduction. |
2106`-----------------------------*/
2107yyreduce:
2108 /* yyn is the number of a rule to reduce with. */
2109 yylen = yyr2[yyn];
2110
2111 /* If YYLEN is nonzero, implement the default value of the action:
2112 `$$ = $1'.
2113
2114 Otherwise, the following line sets YYVAL to garbage.
2115 This behavior is undocumented and Bison
2116 users should not rely upon it. Assigning to YYVAL
2117 unconditionally makes the parser a bit smaller, and it avoids a
2118 GCC warning that YYVAL may be used uninitialized. */
2119 yyval = yyvsp[1-yylen];
2120
2121
2122 YY_REDUCE_PRINT (yyn);
2123 switch (yyn)
2124 {
2125 case 2:
2126
2127 {
2128 // The symbol table search was done in the lexical phase
2129 const TSymbol* symbol = (yyvsp[(1) - (1)].lex).symbol;
2130 const TVariable* variable;
2131 if (symbol == 0) {
2132 context->error((yyvsp[(1) - (1)].lex).line, "undeclared identifier", (yyvsp[(1) - (1)].lex).string->c_str());
2133 context->recover();
2134 TType type(EbtFloat, EbpUndefined);
2135 TVariable* fakeVariable = new TVariable((yyvsp[(1) - (1)].lex).string, type);
2136 context->symbolTable.insert(*fakeVariable);
2137 variable = fakeVariable;
2138 } else {
2139 // This identifier can only be a variable type symbol
2140 if (! symbol->isVariable()) {
2141 context->error((yyvsp[(1) - (1)].lex).line, "variable expected", (yyvsp[(1) - (1)].lex).string->c_str());
2142 context->recover();
2143 }
2144 variable = static_cast<const TVariable*>(symbol);
2145 }
2146
2147 // don't delete $1.string, it's used by error recovery, and the pool
2148 // pop will reclaim the memory
2149
2150 if (variable->getType().getQualifier() == EvqConst ) {
2151 ConstantUnion* constArray = variable->getConstPointer();
2152 TType t(variable->getType());
2153 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(constArray, t, (yyvsp[(1) - (1)].lex).line);
2154 } else
2155 (yyval.interm.intermTypedNode) = context->intermediate.addSymbol(variable->getUniqueId(),
2156 variable->getName(),
2157 variable->getType(), (yyvsp[(1) - (1)].lex).line);
2158 }
2159 break;
2160
2161 case 3:
2162
2163 {
2164 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
2165 }
2166 break;
2167
2168 case 4:
2169
2170 {
John Bauman66b8ab22014-05-06 15:57:45 -04002171 ConstantUnion *unionArray = new ConstantUnion[1];
2172 unionArray->setIConst((yyvsp[(1) - (1)].lex).i);
2173 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
2174 }
2175 break;
2176
2177 case 5:
2178
2179 {
2180 ConstantUnion *unionArray = new ConstantUnion[1];
2181 unionArray->setFConst((yyvsp[(1) - (1)].lex).f);
2182 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
2183 }
2184 break;
2185
2186 case 6:
2187
2188 {
2189 ConstantUnion *unionArray = new ConstantUnion[1];
2190 unionArray->setBConst((yyvsp[(1) - (1)].lex).b);
2191 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
2192 }
2193 break;
2194
2195 case 7:
2196
2197 {
2198 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (3)].interm.intermTypedNode);
2199 }
2200 break;
2201
2202 case 8:
2203
2204 {
2205 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
2206 }
2207 break;
2208
2209 case 9:
2210
2211 {
2212 if (!(yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isVector()) {
2213 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode())
2214 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());
2215 else
2216 context->error((yyvsp[(2) - (4)].lex).line, " left of '[' is not of type array, matrix, or vector ", "expression");
2217 context->recover();
2218 }
2219 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst && (yyvsp[(3) - (4)].interm.intermTypedNode)->getQualifier() == EvqConst) {
2220 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) { // constant folding for arrays
Nicolas Capens198529d2015-02-10 13:54:19 -05002221 (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 -04002222 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector()) { // constant folding for vectors
2223 TVectorFields fields;
2224 fields.num = 1;
Nicolas Capens198529d2015-02-10 13:54:19 -05002225 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 -04002226 (yyval.interm.intermTypedNode) = context->addConstVectorNode(fields, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2227 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix()) { // constant folding for matrices
Nicolas Capens198529d2015-02-10 13:54:19 -05002228 (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 -04002229 }
2230 } else {
2231 if ((yyvsp[(3) - (4)].interm.intermTypedNode)->getQualifier() == EvqConst) {
Nicolas Capens198529d2015-02-10 13:54:19 -05002232 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 -04002233 std::stringstream extraInfoStream;
Nicolas Capens198529d2015-02-10 13:54:19 -05002234 extraInfoStream << "field selection out of range '" << (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0) << "'";
John Bauman66b8ab22014-05-06 15:57:45 -04002235 std::string extraInfo = extraInfoStream.str();
2236 context->error((yyvsp[(2) - (4)].lex).line, "", "[", extraInfo.c_str());
2237 context->recover();
2238 } else {
2239 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) {
2240 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize() == 0) {
Nicolas Capens198529d2015-02-10 13:54:19 -05002241 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getMaxArraySize() <= (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0)) {
2242 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 -04002243 context->recover();
2244 } else {
2245 if (context->arraySetMaxSize((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getTypePointer(), 0, false, (yyvsp[(2) - (4)].lex).line))
2246 context->recover();
2247 }
Nicolas Capens198529d2015-02-10 13:54:19 -05002248 } else if ( (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0) >= (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize()) {
John Bauman66b8ab22014-05-06 15:57:45 -04002249 std::stringstream extraInfoStream;
Nicolas Capens198529d2015-02-10 13:54:19 -05002250 extraInfoStream << "array index out of range '" << (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0) << "'";
John Bauman66b8ab22014-05-06 15:57:45 -04002251 std::string extraInfo = extraInfoStream.str();
2252 context->error((yyvsp[(2) - (4)].lex).line, "", "[", extraInfo.c_str());
2253 context->recover();
2254 }
2255 }
2256 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(3) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2257 }
2258 } else {
2259 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize() == 0) {
2260 context->error((yyvsp[(2) - (4)].lex).line, "", "[", "array must be redeclared with a size before being indexed with a variable");
2261 context->recover();
2262 }
2263
2264 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexIndirect, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(3) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2265 }
2266 }
2267 if ((yyval.interm.intermTypedNode) == 0) {
2268 ConstantUnion *unionArray = new ConstantUnion[1];
2269 unionArray->setFConst(0.0f);
2270 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpHigh, EvqConst), (yyvsp[(2) - (4)].lex).line);
2271 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) {
2272 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getStruct())
2273 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getStruct(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getTypeName()));
2274 else
2275 (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()));
2276
2277 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst)
2278 (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConst);
2279 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst)
2280 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqConst, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize()));
2281 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix())
2282 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize()));
2283 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst)
2284 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqConst));
2285 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector())
2286 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary));
2287 else
2288 (yyval.interm.intermTypedNode)->setType((yyvsp[(1) - (4)].interm.intermTypedNode)->getType());
2289 }
2290 break;
2291
2292 case 10:
2293
2294 {
2295 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
2296 }
2297 break;
2298
2299 case 11:
2300
2301 {
2302 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isArray()) {
2303 context->error((yyvsp[(3) - (3)].lex).line, "cannot apply dot operator to an array", ".");
2304 context->recover();
2305 }
2306
2307 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isVector()) {
2308 TVectorFields fields;
2309 if (! context->parseVectorFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yyvsp[(3) - (3)].lex).line)) {
2310 fields.num = 1;
2311 fields.offsets[0] = 0;
2312 context->recover();
2313 }
2314
2315 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) { // constant folding for vector fields
2316 (yyval.interm.intermTypedNode) = context->addConstVectorNode(fields, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].lex).line);
2317 if ((yyval.interm.intermTypedNode) == 0) {
2318 context->recover();
2319 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2320 }
2321 else
2322 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(), EvqConst, (int) (*(yyvsp[(3) - (3)].lex).string).size()));
2323 } else {
2324 TString vectorString = *(yyvsp[(3) - (3)].lex).string;
2325 TIntermTyped* index = context->intermediate.addSwizzle(fields, (yyvsp[(3) - (3)].lex).line);
2326 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpVectorSwizzle, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2327 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (int) vectorString.size()));
2328 }
2329 } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isMatrix()) {
2330 TMatrixFields fields;
2331 if (! context->parseMatrixFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yyvsp[(3) - (3)].lex).line)) {
2332 fields.wholeRow = false;
2333 fields.wholeCol = false;
2334 fields.row = 0;
2335 fields.col = 0;
2336 context->recover();
2337 }
2338
2339 if (fields.wholeRow || fields.wholeCol) {
2340 context->error((yyvsp[(2) - (3)].lex).line, " non-scalar fields not implemented yet", ".");
2341 context->recover();
2342 ConstantUnion *unionArray = new ConstantUnion[1];
2343 unionArray->setIConst(0);
2344 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line);
2345 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2346 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(),EvqTemporary, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize()));
2347 } else {
2348 ConstantUnion *unionArray = new ConstantUnion[1];
2349 unionArray->setIConst(fields.col * (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize() + fields.row);
2350 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line);
2351 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2352 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision()));
2353 }
2354 } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType() == EbtStruct) {
2355 bool fieldFound = false;
2356 const TTypeList* fields = (yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getStruct();
2357 if (fields == 0) {
2358 context->error((yyvsp[(2) - (3)].lex).line, "structure has no fields", "Internal Error");
2359 context->recover();
2360 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2361 } else {
2362 unsigned int i;
2363 for (i = 0; i < fields->size(); ++i) {
2364 if ((*fields)[i].type->getFieldName() == *(yyvsp[(3) - (3)].lex).string) {
2365 fieldFound = true;
2366 break;
2367 }
2368 }
2369 if (fieldFound) {
2370 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) {
2371 (yyval.interm.intermTypedNode) = context->addConstStruct(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
2372 if ((yyval.interm.intermTypedNode) == 0) {
2373 context->recover();
2374 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2375 }
2376 else {
2377 (yyval.interm.intermTypedNode)->setType(*(*fields)[i].type);
2378 // change the qualifier of the return type, not of the structure field
2379 // as the structure definition is shared between various structures.
2380 (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConst);
2381 }
2382 } else {
2383 ConstantUnion *unionArray = new ConstantUnion[1];
2384 unionArray->setIConst(i);
2385 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, *(*fields)[i].type, (yyvsp[(3) - (3)].lex).line);
2386 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirectStruct, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2387 (yyval.interm.intermTypedNode)->setType(*(*fields)[i].type);
2388 }
2389 } else {
2390 context->error((yyvsp[(2) - (3)].lex).line, " no such field in structure", (yyvsp[(3) - (3)].lex).string->c_str());
2391 context->recover();
2392 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2393 }
2394 }
2395 } else {
2396 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());
2397 context->recover();
2398 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2399 }
2400 // don't delete $3.string, it's from the pool
2401 }
2402 break;
2403
2404 case 12:
2405
2406 {
2407 if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode)))
2408 context->recover();
John Baumand4ae8632014-05-06 16:18:33 -04002409 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostIncrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002410 if ((yyval.interm.intermTypedNode) == 0) {
2411 context->unaryOpError((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
2412 context->recover();
2413 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode);
2414 }
2415 }
2416 break;
2417
2418 case 13:
2419
2420 {
2421 if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode)))
2422 context->recover();
John Baumand4ae8632014-05-06 16:18:33 -04002423 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostDecrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002424 if ((yyval.interm.intermTypedNode) == 0) {
2425 context->unaryOpError((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
2426 context->recover();
2427 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode);
2428 }
2429 }
2430 break;
2431
2432 case 14:
2433
2434 {
2435 if (context->integerErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode), "[]"))
2436 context->recover();
2437 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
2438 }
2439 break;
2440
2441 case 15:
2442
2443 {
2444 TFunction* fnCall = (yyvsp[(1) - (1)].interm).function;
2445 TOperator op = fnCall->getBuiltInOp();
2446
2447 if (op != EOpNull)
2448 {
2449 //
2450 // Then this should be a constructor.
2451 // Don't go through the symbol table for constructors.
2452 // Their parameters will be verified algorithmically.
2453 //
2454 TType type(EbtVoid, EbpUndefined); // use this to get the type back
2455 if (context->constructorErrorCheck((yyvsp[(1) - (1)].interm).line, (yyvsp[(1) - (1)].interm).intermNode, *fnCall, op, &type)) {
2456 (yyval.interm.intermTypedNode) = 0;
2457 } else {
2458 //
2459 // It's a constructor, of type 'type'.
2460 //
2461 (yyval.interm.intermTypedNode) = context->addConstructor((yyvsp[(1) - (1)].interm).intermNode, &type, op, fnCall, (yyvsp[(1) - (1)].interm).line);
2462 }
2463
2464 if ((yyval.interm.intermTypedNode) == 0) {
2465 context->recover();
2466 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator(0, op, (yyvsp[(1) - (1)].interm).line);
2467 }
2468 (yyval.interm.intermTypedNode)->setType(type);
2469 } else {
2470 //
2471 // Not a constructor. Find it in the symbol table.
2472 //
2473 const TFunction* fnCandidate;
2474 bool builtIn;
2475 fnCandidate = context->findFunction((yyvsp[(1) - (1)].interm).line, fnCall, &builtIn);
2476 if (fnCandidate) {
2477 //
2478 // A declared function.
2479 //
2480 if (builtIn && !fnCandidate->getExtension().empty() &&
2481 context->extensionErrorCheck((yyvsp[(1) - (1)].interm).line, fnCandidate->getExtension())) {
2482 context->recover();
2483 }
2484 op = fnCandidate->getBuiltInOp();
2485 if (builtIn && op != EOpNull) {
2486 //
2487 // A function call mapped to a built-in operation.
2488 //
2489 if (fnCandidate->getParamCount() == 1) {
2490 //
2491 // Treat it like a built-in unary operator.
2492 //
John Baumand4ae8632014-05-06 16:18:33 -04002493 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(op, (yyvsp[(1) - (1)].interm).intermNode, 0);
John Bauman66b8ab22014-05-06 15:57:45 -04002494 if ((yyval.interm.intermTypedNode) == 0) {
2495 std::stringstream extraInfoStream;
2496 extraInfoStream << "built in unary operator function. Type: " << static_cast<TIntermTyped*>((yyvsp[(1) - (1)].interm).intermNode)->getCompleteString();
2497 std::string extraInfo = extraInfoStream.str();
2498 context->error((yyvsp[(1) - (1)].interm).intermNode->getLine(), " wrong operand type", "Internal Error", extraInfo.c_str());
2499 YYERROR;
2500 }
2501 } else {
2502 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, op, (yyvsp[(1) - (1)].interm).line);
2503 }
2504 } else {
2505 // This is a real function call
2506
2507 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, EOpFunctionCall, (yyvsp[(1) - (1)].interm).line);
2508 (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType());
2509
2510 // this is how we know whether the given function is a builtIn function or a user defined function
2511 // if builtIn == false, it's a userDefined -> could be an overloaded builtIn function also
2512 // if builtIn == true, it's definitely a builtIn function with EOpNull
2513 if (!builtIn)
2514 (yyval.interm.intermTypedNode)->getAsAggregate()->setUserDefined();
2515 (yyval.interm.intermTypedNode)->getAsAggregate()->setName(fnCandidate->getMangledName());
2516
2517 TQualifier qual;
2518 for (int i = 0; i < fnCandidate->getParamCount(); ++i) {
2519 qual = fnCandidate->getParam(i).type->getQualifier();
2520 if (qual == EvqOut || qual == EvqInOut) {
2521 if (context->lValueErrorCheck((yyval.interm.intermTypedNode)->getLine(), "assign", (yyval.interm.intermTypedNode)->getAsAggregate()->getSequence()[i]->getAsTyped())) {
2522 context->error((yyvsp[(1) - (1)].interm).intermNode->getLine(), "Constant value cannot be passed for 'out' or 'inout' parameters.", "Error");
2523 context->recover();
2524 }
2525 }
2526 }
2527 }
2528 (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType());
2529 } else {
2530 // error message was put out by PaFindFunction()
2531 // Put on a dummy node for error recovery
2532 ConstantUnion *unionArray = new ConstantUnion[1];
2533 unionArray->setFConst(0.0f);
2534 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].interm).line);
2535 context->recover();
2536 }
2537 }
2538 delete fnCall;
2539 }
2540 break;
2541
2542 case 16:
2543
2544 {
2545 (yyval.interm) = (yyvsp[(1) - (1)].interm);
2546 }
2547 break;
2548
2549 case 17:
2550
2551 {
2552 context->error((yyvsp[(3) - (3)].interm).line, "methods are not supported", "");
2553 context->recover();
2554 (yyval.interm) = (yyvsp[(3) - (3)].interm);
2555 }
2556 break;
2557
2558 case 18:
2559
2560 {
2561 (yyval.interm) = (yyvsp[(1) - (2)].interm);
2562 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
2563 }
2564 break;
2565
2566 case 19:
2567
2568 {
2569 (yyval.interm) = (yyvsp[(1) - (2)].interm);
2570 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
2571 }
2572 break;
2573
2574 case 20:
2575
2576 {
2577 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
2578 (yyval.interm).intermNode = 0;
2579 }
2580 break;
2581
2582 case 21:
2583
2584 {
2585 (yyval.interm).function = (yyvsp[(1) - (1)].interm.function);
2586 (yyval.interm).intermNode = 0;
2587 }
2588 break;
2589
2590 case 22:
2591
2592 {
2593 TParameter param = { 0, new TType((yyvsp[(2) - (2)].interm.intermTypedNode)->getType()) };
2594 (yyvsp[(1) - (2)].interm.function)->addParameter(param);
2595 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
2596 (yyval.interm).intermNode = (yyvsp[(2) - (2)].interm.intermTypedNode);
2597 }
2598 break;
2599
2600 case 23:
2601
2602 {
2603 TParameter param = { 0, new TType((yyvsp[(3) - (3)].interm.intermTypedNode)->getType()) };
2604 (yyvsp[(1) - (3)].interm).function->addParameter(param);
2605 (yyval.interm).function = (yyvsp[(1) - (3)].interm).function;
2606 (yyval.interm).intermNode = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermNode, (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
2607 }
2608 break;
2609
2610 case 24:
2611
2612 {
2613 (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
2614 }
2615 break;
2616
2617 case 25:
2618
2619 {
2620 //
2621 // Constructor
2622 //
2623 TOperator op = EOpNull;
2624 if ((yyvsp[(1) - (1)].interm.type).userDef) {
2625 op = EOpConstructStruct;
2626 } else {
2627 switch ((yyvsp[(1) - (1)].interm.type).type) {
2628 case EbtFloat:
2629 if ((yyvsp[(1) - (1)].interm.type).matrix) {
2630 switch((yyvsp[(1) - (1)].interm.type).size) {
2631 case 2: op = EOpConstructMat2; break;
2632 case 3: op = EOpConstructMat3; break;
2633 case 4: op = EOpConstructMat4; break;
2634 }
2635 } else {
2636 switch((yyvsp[(1) - (1)].interm.type).size) {
2637 case 1: op = EOpConstructFloat; break;
2638 case 2: op = EOpConstructVec2; break;
2639 case 3: op = EOpConstructVec3; break;
2640 case 4: op = EOpConstructVec4; break;
2641 }
2642 }
2643 break;
2644 case EbtInt:
2645 switch((yyvsp[(1) - (1)].interm.type).size) {
2646 case 1: op = EOpConstructInt; break;
2647 case 2: FRAG_VERT_ONLY("ivec2", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec2; break;
2648 case 3: FRAG_VERT_ONLY("ivec3", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec3; break;
2649 case 4: FRAG_VERT_ONLY("ivec4", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec4; break;
2650 }
2651 break;
2652 case EbtBool:
2653 switch((yyvsp[(1) - (1)].interm.type).size) {
2654 case 1: op = EOpConstructBool; break;
2655 case 2: FRAG_VERT_ONLY("bvec2", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec2; break;
2656 case 3: FRAG_VERT_ONLY("bvec3", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec3; break;
2657 case 4: FRAG_VERT_ONLY("bvec4", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec4; break;
2658 }
2659 break;
2660 default: break;
2661 }
2662 if (op == EOpNull) {
2663 context->error((yyvsp[(1) - (1)].interm.type).line, "cannot construct this type", getBasicString((yyvsp[(1) - (1)].interm.type).type));
2664 context->recover();
2665 (yyvsp[(1) - (1)].interm.type).type = EbtFloat;
2666 op = EOpConstructFloat;
2667 }
2668 }
2669 TString tempString;
2670 TType type((yyvsp[(1) - (1)].interm.type));
2671 TFunction *function = new TFunction(&tempString, type, op);
2672 (yyval.interm.function) = function;
2673 }
2674 break;
2675
2676 case 26:
2677
2678 {
2679 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
2680 context->recover();
2681 TType type(EbtVoid, EbpUndefined);
2682 TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type);
2683 (yyval.interm.function) = function;
2684 }
2685 break;
2686
2687 case 27:
2688
2689 {
2690 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
2691 context->recover();
2692 TType type(EbtVoid, EbpUndefined);
2693 TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type);
2694 (yyval.interm.function) = function;
2695 }
2696 break;
2697
2698 case 28:
2699
2700 {
2701 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
2702 }
2703 break;
2704
2705 case 29:
2706
2707 {
2708 if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)))
2709 context->recover();
John Baumand4ae8632014-05-06 16:18:33 -04002710 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreIncrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002711 if ((yyval.interm.intermTypedNode) == 0) {
2712 context->unaryOpError((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2713 context->recover();
2714 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2715 }
2716 }
2717 break;
2718
2719 case 30:
2720
2721 {
2722 if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)))
2723 context->recover();
John Baumand4ae8632014-05-06 16:18:33 -04002724 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreDecrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002725 if ((yyval.interm.intermTypedNode) == 0) {
2726 context->unaryOpError((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2727 context->recover();
2728 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2729 }
2730 }
2731 break;
2732
2733 case 31:
2734
2735 {
2736 if ((yyvsp[(1) - (2)].interm).op != EOpNull) {
John Baumand4ae8632014-05-06 16:18:33 -04002737 (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 -04002738 if ((yyval.interm.intermTypedNode) == 0) {
2739 const char* errorOp = "";
2740 switch((yyvsp[(1) - (2)].interm).op) {
2741 case EOpNegative: errorOp = "-"; break;
2742 case EOpLogicalNot: errorOp = "!"; break;
2743 default: break;
2744 }
2745 context->unaryOpError((yyvsp[(1) - (2)].interm).line, errorOp, (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2746 context->recover();
2747 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2748 }
2749 } else
2750 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2751 }
2752 break;
2753
2754 case 32:
2755
2756 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNull; }
2757 break;
2758
2759 case 33:
2760
2761 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNegative; }
2762 break;
2763
2764 case 34:
2765
2766 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpLogicalNot; }
2767 break;
2768
2769 case 35:
2770
2771 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
2772 break;
2773
2774 case 36:
2775
2776 {
2777 FRAG_VERT_ONLY("*", (yyvsp[(2) - (3)].lex).line);
John Baumand4ae8632014-05-06 16:18:33 -04002778 (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 -04002779 if ((yyval.interm.intermTypedNode) == 0) {
2780 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "*", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2781 context->recover();
2782 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2783 }
2784 }
2785 break;
2786
2787 case 37:
2788
2789 {
2790 FRAG_VERT_ONLY("/", (yyvsp[(2) - (3)].lex).line);
John Baumand4ae8632014-05-06 16:18:33 -04002791 (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 -04002792 if ((yyval.interm.intermTypedNode) == 0) {
2793 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "/", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2794 context->recover();
2795 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2796 }
2797 }
2798 break;
2799
2800 case 38:
2801
2802 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
2803 break;
2804
2805 case 39:
2806
2807 {
John Baumand4ae8632014-05-06 16:18:33 -04002808 (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 -04002809 if ((yyval.interm.intermTypedNode) == 0) {
2810 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "+", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2811 context->recover();
2812 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2813 }
2814 }
2815 break;
2816
2817 case 40:
2818
2819 {
John Baumand4ae8632014-05-06 16:18:33 -04002820 (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 -04002821 if ((yyval.interm.intermTypedNode) == 0) {
2822 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "-", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2823 context->recover();
2824 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2825 }
2826 }
2827 break;
2828
2829 case 41:
2830
2831 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
2832 break;
2833
2834 case 42:
2835
2836 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
2837 break;
2838
2839 case 43:
2840
2841 {
John Baumand4ae8632014-05-06 16:18:33 -04002842 (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 -04002843 if ((yyval.interm.intermTypedNode) == 0) {
2844 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2845 context->recover();
2846 ConstantUnion *unionArray = new ConstantUnion[1];
2847 unionArray->setBConst(false);
2848 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2849 }
2850 }
2851 break;
2852
2853 case 44:
2854
2855 {
John Baumand4ae8632014-05-06 16:18:33 -04002856 (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 -04002857 if ((yyval.interm.intermTypedNode) == 0) {
2858 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2859 context->recover();
2860 ConstantUnion *unionArray = new ConstantUnion[1];
2861 unionArray->setBConst(false);
2862 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2863 }
2864 }
2865 break;
2866
2867 case 45:
2868
2869 {
John Baumand4ae8632014-05-06 16:18:33 -04002870 (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 -04002871 if ((yyval.interm.intermTypedNode) == 0) {
2872 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2873 context->recover();
2874 ConstantUnion *unionArray = new ConstantUnion[1];
2875 unionArray->setBConst(false);
2876 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2877 }
2878 }
2879 break;
2880
2881 case 46:
2882
2883 {
John Baumand4ae8632014-05-06 16:18:33 -04002884 (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 -04002885 if ((yyval.interm.intermTypedNode) == 0) {
2886 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2887 context->recover();
2888 ConstantUnion *unionArray = new ConstantUnion[1];
2889 unionArray->setBConst(false);
2890 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2891 }
2892 }
2893 break;
2894
2895 case 47:
2896
2897 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
2898 break;
2899
2900 case 48:
2901
2902 {
John Baumand4ae8632014-05-06 16:18:33 -04002903 (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 -04002904 if ((yyval.interm.intermTypedNode) == 0) {
2905 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "==", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2906 context->recover();
2907 ConstantUnion *unionArray = new ConstantUnion[1];
2908 unionArray->setBConst(false);
2909 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2910 }
2911 }
2912 break;
2913
2914 case 49:
2915
2916 {
John Baumand4ae8632014-05-06 16:18:33 -04002917 (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 -04002918 if ((yyval.interm.intermTypedNode) == 0) {
2919 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "!=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2920 context->recover();
2921 ConstantUnion *unionArray = new ConstantUnion[1];
2922 unionArray->setBConst(false);
2923 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2924 }
2925 }
2926 break;
2927
2928 case 50:
2929
2930 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
2931 break;
2932
2933 case 51:
2934
2935 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
2936 break;
2937
2938 case 52:
2939
2940 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
2941 break;
2942
2943 case 53:
2944
2945 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
2946 break;
2947
2948 case 54:
2949
2950 {
John Baumand4ae8632014-05-06 16:18:33 -04002951 (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 -04002952 if ((yyval.interm.intermTypedNode) == 0) {
2953 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "&&", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2954 context->recover();
2955 ConstantUnion *unionArray = new ConstantUnion[1];
2956 unionArray->setBConst(false);
2957 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2958 }
2959 }
2960 break;
2961
2962 case 55:
2963
2964 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
2965 break;
2966
2967 case 56:
2968
2969 {
John Baumand4ae8632014-05-06 16:18:33 -04002970 (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 -04002971 if ((yyval.interm.intermTypedNode) == 0) {
2972 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "^^", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2973 context->recover();
2974 ConstantUnion *unionArray = new ConstantUnion[1];
2975 unionArray->setBConst(false);
2976 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2977 }
2978 }
2979 break;
2980
2981 case 57:
2982
2983 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
2984 break;
2985
2986 case 58:
2987
2988 {
John Baumand4ae8632014-05-06 16:18:33 -04002989 (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 -04002990 if ((yyval.interm.intermTypedNode) == 0) {
2991 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "||", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2992 context->recover();
2993 ConstantUnion *unionArray = new ConstantUnion[1];
2994 unionArray->setBConst(false);
2995 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2996 }
2997 }
2998 break;
2999
3000 case 59:
3001
3002 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
3003 break;
3004
3005 case 60:
3006
3007 {
3008 if (context->boolErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.intermTypedNode)))
3009 context->recover();
3010
3011 (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);
3012 if ((yyvsp[(3) - (5)].interm.intermTypedNode)->getType() != (yyvsp[(5) - (5)].interm.intermTypedNode)->getType())
3013 (yyval.interm.intermTypedNode) = 0;
3014
3015 if ((yyval.interm.intermTypedNode) == 0) {
3016 context->binaryOpError((yyvsp[(2) - (5)].lex).line, ":", (yyvsp[(3) - (5)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(5) - (5)].interm.intermTypedNode)->getCompleteString());
3017 context->recover();
3018 (yyval.interm.intermTypedNode) = (yyvsp[(5) - (5)].interm.intermTypedNode);
3019 }
3020 }
3021 break;
3022
3023 case 61:
3024
3025 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
3026 break;
3027
3028 case 62:
3029
3030 {
3031 if (context->lValueErrorCheck((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)))
3032 context->recover();
3033 (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);
3034 if ((yyval.interm.intermTypedNode) == 0) {
3035 context->assignError((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3036 context->recover();
3037 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
3038 }
3039 }
3040 break;
3041
3042 case 63:
3043
3044 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAssign; }
3045 break;
3046
3047 case 64:
3048
3049 { FRAG_VERT_ONLY("*=", (yyvsp[(1) - (1)].lex).line); (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpMulAssign; }
3050 break;
3051
3052 case 65:
3053
3054 { FRAG_VERT_ONLY("/=", (yyvsp[(1) - (1)].lex).line); (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpDivAssign; }
3055 break;
3056
3057 case 66:
3058
3059 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAddAssign; }
3060 break;
3061
3062 case 67:
3063
3064 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpSubAssign; }
3065 break;
3066
3067 case 68:
3068
3069 {
3070 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
3071 }
3072 break;
3073
3074 case 69:
3075
3076 {
3077 (yyval.interm.intermTypedNode) = context->intermediate.addComma((yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
3078 if ((yyval.interm.intermTypedNode) == 0) {
3079 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ",", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3080 context->recover();
3081 (yyval.interm.intermTypedNode) = (yyvsp[(3) - (3)].interm.intermTypedNode);
3082 }
3083 }
3084 break;
3085
3086 case 70:
3087
3088 {
3089 if (context->constErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)))
3090 context->recover();
3091 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
3092 }
3093 break;
3094
3095 case 71:
3096
3097 {
3098 TFunction &function = *((yyvsp[(1) - (2)].interm).function);
3099
3100 TIntermAggregate *prototype = new TIntermAggregate;
3101 prototype->setType(function.getReturnType());
3102 prototype->setName(function.getName());
3103
3104 for (int i = 0; i < function.getParamCount(); i++)
3105 {
3106 const TParameter &param = function.getParam(i);
3107 if (param.name != 0)
3108 {
John Baumand4ae8632014-05-06 16:18:33 -04003109 TVariable variable(param.name, *param.type);
John Bauman66b8ab22014-05-06 15:57:45 -04003110
John Baumand4ae8632014-05-06 16:18:33 -04003111 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 -04003112 }
3113 else
3114 {
3115 prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (2)].interm).line), (yyvsp[(1) - (2)].interm).line);
3116 }
3117 }
3118
3119 prototype->setOp(EOpPrototype);
3120 (yyval.interm.intermNode) = prototype;
3121
3122 context->symbolTable.pop();
3123 }
3124 break;
3125
3126 case 72:
3127
3128 {
3129 if ((yyvsp[(1) - (2)].interm).intermAggregate)
3130 (yyvsp[(1) - (2)].interm).intermAggregate->setOp(EOpDeclaration);
3131 (yyval.interm.intermNode) = (yyvsp[(1) - (2)].interm).intermAggregate;
3132 }
3133 break;
3134
3135 case 73:
3136
3137 {
John Baumand4ae8632014-05-06 16:18:33 -04003138 if (!context->symbolTable.setDefaultPrecision( (yyvsp[(3) - (4)].interm.type), (yyvsp[(2) - (4)].interm.precision) )) {
3139 context->error((yyvsp[(1) - (4)].lex).line, "illegal type argument for default precision qualifier", getBasicString((yyvsp[(3) - (4)].interm.type).type));
3140 context->recover();
3141 }
John Bauman66b8ab22014-05-06 15:57:45 -04003142 (yyval.interm.intermNode) = 0;
3143 }
3144 break;
3145
3146 case 74:
3147
3148 {
3149 //
3150 // Multiple declarations of the same function are allowed.
3151 //
3152 // If this is a definition, the definition production code will check for redefinitions
3153 // (we don't know at this point if it's a definition or not).
3154 //
3155 // Redeclarations are allowed. But, return types and parameter qualifiers must match.
3156 //
3157 TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find((yyvsp[(1) - (2)].interm.function)->getMangledName()));
3158 if (prevDec) {
3159 if (prevDec->getReturnType() != (yyvsp[(1) - (2)].interm.function)->getReturnType()) {
3160 context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same return type", (yyvsp[(1) - (2)].interm.function)->getReturnType().getBasicString());
3161 context->recover();
3162 }
3163 for (int i = 0; i < prevDec->getParamCount(); ++i) {
3164 if (prevDec->getParam(i).type->getQualifier() != (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifier()) {
3165 context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same parameter qualifiers", (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifierString());
3166 context->recover();
3167 }
3168 }
3169 }
3170
3171 //
3172 // If this is a redeclaration, it could also be a definition,
3173 // in which case, we want to use the variable names from this one, and not the one that's
3174 // being redeclared. So, pass back up this declaration, not the one in the symbol table.
3175 //
3176 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
3177 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
3178
3179 // We're at the inner scope level of the function's arguments and body statement.
3180 // Add the function prototype to the surrounding scope instead.
3181 context->symbolTable.getOuterLevel()->insert(*(yyval.interm).function);
3182 }
3183 break;
3184
3185 case 75:
3186
3187 {
3188 (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
3189 }
3190 break;
3191
3192 case 76:
3193
3194 {
3195 (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
3196 }
3197 break;
3198
3199 case 77:
3200
3201 {
3202 // Add the parameter
3203 (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
3204 if ((yyvsp[(2) - (2)].interm).param.type->getBasicType() != EbtVoid)
3205 (yyvsp[(1) - (2)].interm.function)->addParameter((yyvsp[(2) - (2)].interm).param);
3206 else
3207 delete (yyvsp[(2) - (2)].interm).param.type;
3208 }
3209 break;
3210
3211 case 78:
3212
3213 {
3214 //
3215 // Only first parameter of one-parameter functions can be void
3216 // The check for named parameters not being void is done in parameter_declarator
3217 //
3218 if ((yyvsp[(3) - (3)].interm).param.type->getBasicType() == EbtVoid) {
3219 //
3220 // This parameter > first is void
3221 //
3222 context->error((yyvsp[(2) - (3)].lex).line, "cannot be an argument type except for '(void)'", "void");
3223 context->recover();
3224 delete (yyvsp[(3) - (3)].interm).param.type;
3225 } else {
3226 // Add the parameter
3227 (yyval.interm.function) = (yyvsp[(1) - (3)].interm.function);
3228 (yyvsp[(1) - (3)].interm.function)->addParameter((yyvsp[(3) - (3)].interm).param);
3229 }
3230 }
3231 break;
3232
3233 case 79:
3234
3235 {
3236 if ((yyvsp[(1) - (3)].interm.type).qualifier != EvqGlobal && (yyvsp[(1) - (3)].interm.type).qualifier != EvqTemporary) {
3237 context->error((yyvsp[(2) - (3)].lex).line, "no qualifiers allowed for function return", getQualifierString((yyvsp[(1) - (3)].interm.type).qualifier));
3238 context->recover();
3239 }
3240 // make sure a sampler is not involved as well...
3241 if (context->structQualifierErrorCheck((yyvsp[(2) - (3)].lex).line, (yyvsp[(1) - (3)].interm.type)))
3242 context->recover();
3243
3244 // Add the function as a prototype after parsing it (we do not support recursion)
3245 TFunction *function;
3246 TType type((yyvsp[(1) - (3)].interm.type));
3247 function = new TFunction((yyvsp[(2) - (3)].lex).string, type);
3248 (yyval.interm.function) = function;
3249
3250 context->symbolTable.push();
3251 }
3252 break;
3253
3254 case 80:
3255
3256 {
3257 if ((yyvsp[(1) - (2)].interm.type).type == EbtVoid) {
3258 context->error((yyvsp[(2) - (2)].lex).line, "illegal use of type 'void'", (yyvsp[(2) - (2)].lex).string->c_str());
3259 context->recover();
3260 }
3261 if (context->reservedErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string))
3262 context->recover();
3263 TParameter param = {(yyvsp[(2) - (2)].lex).string, new TType((yyvsp[(1) - (2)].interm.type))};
3264 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
3265 (yyval.interm).param = param;
3266 }
3267 break;
3268
3269 case 81:
3270
3271 {
3272 // Check that we can make an array out of this type
3273 if (context->arrayTypeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
3274 context->recover();
3275
3276 if (context->reservedErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string))
3277 context->recover();
3278
3279 int size;
3280 if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3281 context->recover();
3282 (yyvsp[(1) - (5)].interm.type).setArray(true, size);
3283
3284 TType* type = new TType((yyvsp[(1) - (5)].interm.type));
3285 TParameter param = { (yyvsp[(2) - (5)].lex).string, type };
3286 (yyval.interm).line = (yyvsp[(2) - (5)].lex).line;
3287 (yyval.interm).param = param;
3288 }
3289 break;
3290
3291 case 82:
3292
3293 {
3294 (yyval.interm) = (yyvsp[(3) - (3)].interm);
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003295 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 -04003296 context->recover();
3297 }
3298 break;
3299
3300 case 83:
3301
3302 {
3303 (yyval.interm) = (yyvsp[(2) - (2)].interm);
3304 if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
3305 context->recover();
3306 if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
3307 context->recover();
3308 }
3309 break;
3310
3311 case 84:
3312
3313 {
3314 (yyval.interm) = (yyvsp[(3) - (3)].interm);
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003315 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 -04003316 context->recover();
3317 }
3318 break;
3319
3320 case 85:
3321
3322 {
3323 (yyval.interm) = (yyvsp[(2) - (2)].interm);
3324 if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
3325 context->recover();
3326 if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
3327 context->recover();
3328 }
3329 break;
3330
3331 case 86:
3332
3333 {
3334 (yyval.interm.qualifier) = EvqIn;
3335 }
3336 break;
3337
3338 case 87:
3339
3340 {
3341 (yyval.interm.qualifier) = EvqIn;
3342 }
3343 break;
3344
3345 case 88:
3346
3347 {
3348 (yyval.interm.qualifier) = EvqOut;
3349 }
3350 break;
3351
3352 case 89:
3353
3354 {
3355 (yyval.interm.qualifier) = EvqInOut;
3356 }
3357 break;
3358
3359 case 90:
3360
3361 {
3362 TParameter param = { 0, new TType((yyvsp[(1) - (1)].interm.type)) };
3363 (yyval.interm).param = param;
3364 }
3365 break;
3366
3367 case 91:
3368
3369 {
3370 (yyval.interm) = (yyvsp[(1) - (1)].interm);
3371 }
3372 break;
3373
3374 case 92:
3375
3376 {
3377 if ((yyvsp[(1) - (3)].interm).type.type == EbtInvariant && !(yyvsp[(3) - (3)].lex).symbol)
3378 {
3379 context->error((yyvsp[(3) - (3)].lex).line, "undeclared identifier declared as invariant", (yyvsp[(3) - (3)].lex).string->c_str());
3380 context->recover();
3381 }
3382
3383 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(3) - (3)].lex).string, TType((yyvsp[(1) - (3)].interm).type), (yyvsp[(3) - (3)].lex).line);
3384 (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermNode, symbol, (yyvsp[(3) - (3)].lex).line);
3385
3386 if (context->structQualifierErrorCheck((yyvsp[(3) - (3)].lex).line, (yyval.interm).type))
3387 context->recover();
3388
3389 if (context->nonInitConstErrorCheck((yyvsp[(3) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyval.interm).type, false))
3390 context->recover();
3391
3392 TVariable* variable = 0;
3393 if (context->nonInitErrorCheck((yyvsp[(3) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyval.interm).type, variable))
3394 context->recover();
3395 if (symbol && variable)
3396 symbol->setId(variable->getUniqueId());
3397 }
3398 break;
3399
3400 case 93:
3401
3402 {
3403 if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
3404 context->recover();
3405
3406 if (context->nonInitConstErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, true))
3407 context->recover();
3408
3409 (yyval.interm) = (yyvsp[(1) - (5)].interm);
3410
3411 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))
3412 context->recover();
3413 else {
3414 (yyvsp[(1) - (5)].interm).type.setArray(true);
3415 TVariable* variable;
3416 if (context->arrayErrorCheck((yyvsp[(4) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, variable))
3417 context->recover();
3418 }
3419 }
3420 break;
3421
3422 case 94:
3423
3424 {
3425 if (context->structQualifierErrorCheck((yyvsp[(3) - (6)].lex).line, (yyvsp[(1) - (6)].interm).type))
3426 context->recover();
3427
3428 if (context->nonInitConstErrorCheck((yyvsp[(3) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type, true))
3429 context->recover();
3430
3431 (yyval.interm) = (yyvsp[(1) - (6)].interm);
3432
3433 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))
3434 context->recover();
3435 else {
3436 int size;
3437 if (context->arraySizeErrorCheck((yyvsp[(4) - (6)].lex).line, (yyvsp[(5) - (6)].interm.intermTypedNode), size))
3438 context->recover();
3439 (yyvsp[(1) - (6)].interm).type.setArray(true, size);
3440 TVariable* variable = 0;
3441 if (context->arrayErrorCheck((yyvsp[(4) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type, variable))
3442 context->recover();
3443 TType type = TType((yyvsp[(1) - (6)].interm).type);
3444 type.setArraySize(size);
3445 (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);
3446 }
3447 }
3448 break;
3449
3450 case 95:
3451
3452 {
3453 if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
3454 context->recover();
3455
3456 (yyval.interm) = (yyvsp[(1) - (5)].interm);
3457
3458 TIntermNode* intermNode;
3459 if (!context->executeInitializer((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, (yyvsp[(5) - (5)].interm.intermTypedNode), intermNode)) {
3460 //
3461 // build the intermediate representation
3462 //
3463 if (intermNode)
3464 (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (5)].interm).intermNode, intermNode, (yyvsp[(4) - (5)].lex).line);
3465 else
3466 (yyval.interm).intermAggregate = (yyvsp[(1) - (5)].interm).intermAggregate;
3467 } else {
3468 context->recover();
3469 (yyval.interm).intermAggregate = 0;
3470 }
3471 }
3472 break;
3473
3474 case 96:
3475
3476 {
3477 (yyval.interm).type = (yyvsp[(1) - (1)].interm.type);
3478 (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);
3479 }
3480 break;
3481
3482 case 97:
3483
3484 {
3485 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyvsp[(1) - (2)].interm.type)), (yyvsp[(2) - (2)].lex).line);
3486 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (2)].lex).line);
3487
3488 if (context->structQualifierErrorCheck((yyvsp[(2) - (2)].lex).line, (yyval.interm).type))
3489 context->recover();
3490
3491 if (context->nonInitConstErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string, (yyval.interm).type, false))
3492 context->recover();
3493
3494 (yyval.interm).type = (yyvsp[(1) - (2)].interm.type);
3495
3496 TVariable* variable = 0;
3497 if (context->nonInitErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string, (yyval.interm).type, variable))
3498 context->recover();
3499 if (variable && symbol)
3500 symbol->setId(variable->getUniqueId());
3501 }
3502 break;
3503
3504 case 98:
3505
3506 {
3507 context->error((yyvsp[(2) - (4)].lex).line, "unsized array declarations not supported", (yyvsp[(2) - (4)].lex).string->c_str());
3508 context->recover();
3509
3510 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (4)].lex).string, TType((yyvsp[(1) - (4)].interm.type)), (yyvsp[(2) - (4)].lex).line);
3511 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (4)].lex).line);
3512 (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
3513 }
3514 break;
3515
3516 case 99:
3517
3518 {
3519 TType type = TType((yyvsp[(1) - (5)].interm.type));
3520 int size;
3521 if (context->arraySizeErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3522 context->recover();
3523 type.setArraySize(size);
3524 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (5)].lex).string, type, (yyvsp[(2) - (5)].lex).line);
3525 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (5)].lex).line);
3526
3527 if (context->structQualifierErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
3528 context->recover();
3529
3530 if (context->nonInitConstErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type), true))
3531 context->recover();
3532
3533 (yyval.interm).type = (yyvsp[(1) - (5)].interm.type);
3534
3535 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)))
3536 context->recover();
3537 else {
3538 int size;
3539 if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3540 context->recover();
3541
3542 (yyvsp[(1) - (5)].interm.type).setArray(true, size);
3543 TVariable* variable = 0;
3544 if (context->arrayErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type), variable))
3545 context->recover();
3546 if (variable && symbol)
3547 symbol->setId(variable->getUniqueId());
3548 }
3549 }
3550 break;
3551
3552 case 100:
3553
3554 {
3555 if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
3556 context->recover();
3557
3558 (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
3559
3560 TIntermNode* intermNode;
3561 if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode)) {
3562 //
3563 // Build intermediate representation
3564 //
3565 if(intermNode)
3566 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(intermNode, (yyvsp[(3) - (4)].lex).line);
3567 else
3568 (yyval.interm).intermAggregate = 0;
3569 } else {
3570 context->recover();
3571 (yyval.interm).intermAggregate = 0;
3572 }
3573 }
3574 break;
3575
3576 case 101:
3577
3578 {
John Bauman66b8ab22014-05-06 15:57:45 -04003579 if (context->globalErrorCheck((yyvsp[(1) - (2)].lex).line, context->symbolTable.atGlobalLevel(), "invariant varying"))
3580 context->recover();
3581 (yyval.interm).type.setBasic(EbtInvariant, EvqInvariantVaryingOut, (yyvsp[(2) - (2)].lex).line);
3582 if (!(yyvsp[(2) - (2)].lex).symbol)
3583 {
3584 context->error((yyvsp[(2) - (2)].lex).line, "undeclared identifier declared as invariant", (yyvsp[(2) - (2)].lex).string->c_str());
3585 context->recover();
3586
3587 (yyval.interm).intermAggregate = 0;
3588 }
3589 else
3590 {
3591 TIntermSymbol *symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyval.interm).type), (yyvsp[(2) - (2)].lex).line);
3592 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (2)].lex).line);
3593 }
3594 }
3595 break;
3596
3597 case 102:
3598
3599 {
3600 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3601
3602 if ((yyvsp[(1) - (1)].interm.type).array) {
3603 context->error((yyvsp[(1) - (1)].interm.type).line, "not supported", "first-class array");
3604 context->recover();
3605 (yyvsp[(1) - (1)].interm.type).setArray(false);
3606 }
3607 }
3608 break;
3609
3610 case 103:
3611
3612 {
3613 if ((yyvsp[(2) - (2)].interm.type).array) {
3614 context->error((yyvsp[(2) - (2)].interm.type).line, "not supported", "first-class array");
3615 context->recover();
3616 (yyvsp[(2) - (2)].interm.type).setArray(false);
3617 }
3618
3619 if ((yyvsp[(1) - (2)].interm.type).qualifier == EvqAttribute &&
3620 ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
3621 context->error((yyvsp[(2) - (2)].interm.type).line, "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier));
3622 context->recover();
3623 }
3624 if (((yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingIn || (yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingOut) &&
3625 ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
3626 context->error((yyvsp[(2) - (2)].interm.type).line, "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier));
3627 context->recover();
3628 }
3629 (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
3630 (yyval.interm.type).qualifier = (yyvsp[(1) - (2)].interm.type).qualifier;
3631 }
3632 break;
3633
3634 case 104:
3635
3636 {
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003637 (yyval.interm.qualifier) = EvqConst;
John Bauman66b8ab22014-05-06 15:57:45 -04003638 }
3639 break;
3640
3641 case 105:
3642
3643 {
3644 VERTEX_ONLY("attribute", (yyvsp[(1) - (1)].lex).line);
Nicolas Capensc6841852015-02-15 14:25:37 -05003645 ES2_ONLY("attribute", (yyvsp[(1) - (1)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003646 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "attribute"))
3647 context->recover();
3648 (yyval.interm.type).setBasic(EbtVoid, EvqAttribute, (yyvsp[(1) - (1)].lex).line);
3649 }
3650 break;
3651
3652 case 106:
3653
3654 {
Nicolas Capensc6841852015-02-15 14:25:37 -05003655 ES2_ONLY("varying", (yyvsp[(1) - (1)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003656 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "varying"))
3657 context->recover();
Nicolas Capens08ca3c62015-02-13 16:06:45 -05003658 if (context->shaderType == GL_VERTEX_SHADER)
John Bauman66b8ab22014-05-06 15:57:45 -04003659 (yyval.interm.type).setBasic(EbtVoid, EvqVaryingOut, (yyvsp[(1) - (1)].lex).line);
3660 else
3661 (yyval.interm.type).setBasic(EbtVoid, EvqVaryingIn, (yyvsp[(1) - (1)].lex).line);
3662 }
3663 break;
3664
3665 case 107:
3666
3667 {
Nicolas Capensc6841852015-02-15 14:25:37 -05003668 ES2_ONLY("varying", (yyvsp[(1) - (2)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003669 if (context->globalErrorCheck((yyvsp[(1) - (2)].lex).line, context->symbolTable.atGlobalLevel(), "invariant varying"))
3670 context->recover();
Nicolas Capens08ca3c62015-02-13 16:06:45 -05003671 if (context->shaderType == GL_VERTEX_SHADER)
John Bauman66b8ab22014-05-06 15:57:45 -04003672 (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingOut, (yyvsp[(1) - (2)].lex).line);
3673 else
3674 (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingIn, (yyvsp[(1) - (2)].lex).line);
3675 }
3676 break;
3677
3678 case 108:
3679
3680 {
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003681 (yyval.interm.type).setBasic(EbtVoid, (yyvsp[(1) - (1)].interm.type).qualifier, (yyvsp[(1) - (1)].interm.type).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003682 }
3683 break;
3684
3685 case 109:
3686
3687 {
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003688 (yyval.interm.type).qualifier = EvqConst;
3689 (yyval.interm.type).line = (yyvsp[(1) - (1)].lex).line;
3690 }
3691 break;
3692
3693 case 110:
3694
3695 {
3696 ES3_ONLY("in", (yyvsp[(1) - (1)].lex).line);
3697 (yyval.interm.type).qualifier = (context->shaderType == GL_FRAGMENT_SHADER) ? EvqVaryingIn : EvqAttribute;
3698 (yyval.interm.type).line = (yyvsp[(1) - (1)].lex).line;
3699 }
3700 break;
3701
3702 case 111:
3703
3704 {
3705 ES3_ONLY("out", (yyvsp[(1) - (1)].lex).line);
3706 (yyval.interm.type).qualifier = (context->shaderType == GL_FRAGMENT_SHADER) ? EvqFragColor : EvqVaryingOut;
3707 (yyval.interm.type).line = (yyvsp[(1) - (1)].lex).line;
3708 }
3709 break;
3710
3711 case 112:
3712
3713 {
3714 ES3_ONLY("in", (yyvsp[(1) - (2)].lex).line);
3715 // FIXME: Handle centroid qualifier
3716 (yyval.interm.type).qualifier = (context->shaderType == GL_FRAGMENT_SHADER) ? EvqVaryingIn : EvqAttribute;
3717 (yyval.interm.type).line = (yyvsp[(2) - (2)].lex).line;
3718 }
3719 break;
3720
3721 case 113:
3722
3723 {
3724 ES3_ONLY("out", (yyvsp[(1) - (2)].lex).line);
3725 // FIXME: Handle centroid qualifier
3726 (yyval.interm.type).qualifier = (context->shaderType == GL_FRAGMENT_SHADER) ? EvqFragColor : EvqVaryingOut;
3727 (yyval.interm.type).line = (yyvsp[(2) - (2)].lex).line;
3728 }
3729 break;
3730
3731 case 114:
3732
3733 {
3734 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "uniform"))
3735 context->recover();
3736 (yyval.interm.type).qualifier = EvqUniform;
3737 (yyval.interm.type).line = (yyvsp[(1) - (1)].lex).line;
3738 }
3739 break;
3740
3741 case 115:
3742
3743 {
John Bauman66b8ab22014-05-06 15:57:45 -04003744 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3745
3746 if ((yyval.interm.type).precision == EbpUndefined) {
3747 (yyval.interm.type).precision = context->symbolTable.getDefaultPrecision((yyvsp[(1) - (1)].interm.type).type);
3748 if (context->precisionErrorCheck((yyvsp[(1) - (1)].interm.type).line, (yyval.interm.type).precision, (yyvsp[(1) - (1)].interm.type).type)) {
3749 context->recover();
3750 }
3751 }
3752 }
3753 break;
3754
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003755 case 116:
John Bauman66b8ab22014-05-06 15:57:45 -04003756
3757 {
3758 (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
3759 (yyval.interm.type).precision = (yyvsp[(1) - (2)].interm.precision);
3760 }
3761 break;
3762
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003763 case 117:
John Bauman66b8ab22014-05-06 15:57:45 -04003764
3765 {
3766 (yyval.interm.precision) = EbpHigh;
3767 }
3768 break;
3769
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003770 case 118:
John Bauman66b8ab22014-05-06 15:57:45 -04003771
3772 {
3773 (yyval.interm.precision) = EbpMedium;
3774 }
3775 break;
3776
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003777 case 119:
John Bauman66b8ab22014-05-06 15:57:45 -04003778
3779 {
3780 (yyval.interm.precision) = EbpLow;
3781 }
3782 break;
3783
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003784 case 120:
John Bauman66b8ab22014-05-06 15:57:45 -04003785
3786 {
3787 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3788 }
3789 break;
3790
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003791 case 121:
John Bauman66b8ab22014-05-06 15:57:45 -04003792
3793 {
3794 (yyval.interm.type) = (yyvsp[(1) - (4)].interm.type);
3795
3796 if (context->arrayTypeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
3797 context->recover();
3798 else {
3799 int size;
3800 if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
3801 context->recover();
3802 (yyval.interm.type).setArray(true, size);
3803 }
3804 }
3805 break;
3806
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003807 case 122:
John Bauman66b8ab22014-05-06 15:57:45 -04003808
3809 {
3810 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3811 (yyval.interm.type).setBasic(EbtVoid, qual, (yyvsp[(1) - (1)].lex).line);
3812 }
3813 break;
3814
John Bauman66b8ab22014-05-06 15:57:45 -04003815 case 123:
3816
3817 {
3818 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003819 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003820 }
3821 break;
3822
3823 case 124:
3824
3825 {
3826 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003827 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003828 }
3829 break;
3830
3831 case 125:
3832
3833 {
3834 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
Nicolas Capens3c20f802015-02-17 17:17:20 -05003835 (yyval.interm.type).setBasic(EbtUInt, qual, (yyvsp[(1) - (1)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003836 }
3837 break;
3838
3839 case 126:
3840
3841 {
3842 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
Nicolas Capens3c20f802015-02-17 17:17:20 -05003843 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003844 }
3845 break;
3846
3847 case 127:
3848
3849 {
3850 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003851 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
Nicolas Capens3c20f802015-02-17 17:17:20 -05003852 (yyval.interm.type).setAggregate(2);
John Bauman66b8ab22014-05-06 15:57:45 -04003853 }
3854 break;
3855
3856 case 128:
3857
3858 {
3859 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003860 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
Nicolas Capens3c20f802015-02-17 17:17:20 -05003861 (yyval.interm.type).setAggregate(3);
John Bauman66b8ab22014-05-06 15:57:45 -04003862 }
3863 break;
3864
3865 case 129:
3866
3867 {
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003868 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
Nicolas Capens3c20f802015-02-17 17:17:20 -05003869 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3870 (yyval.interm.type).setAggregate(4);
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003871 }
3872 break;
3873
3874 case 130:
3875
3876 {
3877 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3878 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
Nicolas Capens3c20f802015-02-17 17:17:20 -05003879 (yyval.interm.type).setAggregate(2);
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003880 }
3881 break;
3882
3883 case 131:
3884
3885 {
3886 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3887 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
Nicolas Capens3c20f802015-02-17 17:17:20 -05003888 (yyval.interm.type).setAggregate(3);
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003889 }
3890 break;
3891
3892 case 132:
3893
3894 {
3895 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
Nicolas Capens3c20f802015-02-17 17:17:20 -05003896 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3897 (yyval.interm.type).setAggregate(4);
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003898 }
3899 break;
3900
3901 case 133:
3902
3903 {
3904 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3905 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
Nicolas Capens3c20f802015-02-17 17:17:20 -05003906 (yyval.interm.type).setAggregate(2);
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003907 }
3908 break;
3909
3910 case 134:
3911
3912 {
3913 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3914 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
Nicolas Capens3c20f802015-02-17 17:17:20 -05003915 (yyval.interm.type).setAggregate(3);
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003916 }
3917 break;
3918
3919 case 135:
3920
3921 {
Nicolas Capens3c20f802015-02-17 17:17:20 -05003922 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3923 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3924 (yyval.interm.type).setAggregate(4);
3925 }
3926 break;
3927
3928 case 136:
3929
3930 {
John Bauman66b8ab22014-05-06 15:57:45 -04003931 FRAG_VERT_ONLY("mat2", (yyvsp[(1) - (1)].lex).line);
3932 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3933 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3934 (yyval.interm.type).setAggregate(2, true);
3935 }
3936 break;
3937
Nicolas Capens3c20f802015-02-17 17:17:20 -05003938 case 137:
John Bauman66b8ab22014-05-06 15:57:45 -04003939
3940 {
3941 FRAG_VERT_ONLY("mat3", (yyvsp[(1) - (1)].lex).line);
3942 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3943 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3944 (yyval.interm.type).setAggregate(3, true);
3945 }
3946 break;
3947
Nicolas Capens3c20f802015-02-17 17:17:20 -05003948 case 138:
John Bauman66b8ab22014-05-06 15:57:45 -04003949
3950 {
3951 FRAG_VERT_ONLY("mat4", (yyvsp[(1) - (1)].lex).line);
3952 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3953 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3954 (yyval.interm.type).setAggregate(4, true);
3955 }
3956 break;
3957
Nicolas Capens3c20f802015-02-17 17:17:20 -05003958 case 139:
John Bauman66b8ab22014-05-06 15:57:45 -04003959
3960 {
3961 FRAG_VERT_ONLY("sampler2D", (yyvsp[(1) - (1)].lex).line);
3962 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3963 (yyval.interm.type).setBasic(EbtSampler2D, qual, (yyvsp[(1) - (1)].lex).line);
3964 }
3965 break;
3966
Nicolas Capens3c20f802015-02-17 17:17:20 -05003967 case 140:
John Bauman66b8ab22014-05-06 15:57:45 -04003968
3969 {
3970 FRAG_VERT_ONLY("samplerCube", (yyvsp[(1) - (1)].lex).line);
3971 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3972 (yyval.interm.type).setBasic(EbtSamplerCube, qual, (yyvsp[(1) - (1)].lex).line);
3973 }
3974 break;
3975
Nicolas Capens3c20f802015-02-17 17:17:20 -05003976 case 141:
John Bauman66b8ab22014-05-06 15:57:45 -04003977
3978 {
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04003979 if (!context->supportsExtension("GL_OES_EGL_image_external")) {
3980 context->error((yyvsp[(1) - (1)].lex).line, "unsupported type", "samplerExternalOES", "");
3981 context->recover();
3982 }
3983 FRAG_VERT_ONLY("samplerExternalOES", (yyvsp[(1) - (1)].lex).line);
3984 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3985 (yyval.interm.type).setBasic(EbtSamplerExternalOES, qual, (yyvsp[(1) - (1)].lex).line);
3986 }
3987 break;
3988
Nicolas Capens3c20f802015-02-17 17:17:20 -05003989 case 142:
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04003990
3991 {
Alexis Hetub027aa92015-01-19 15:56:12 -05003992 FRAG_VERT_ONLY("sampler3D", (yyvsp[(1) - (1)].lex).line);
3993 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3994 (yyval.interm.type).setBasic(EbtSampler3D, qual, (yyvsp[(1) - (1)].lex).line);
3995 }
3996 break;
3997
Nicolas Capens3c20f802015-02-17 17:17:20 -05003998 case 143:
Alexis Hetub027aa92015-01-19 15:56:12 -05003999
4000 {
John Bauman66b8ab22014-05-06 15:57:45 -04004001 FRAG_VERT_ONLY("struct", (yyvsp[(1) - (1)].interm.type).line);
4002 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
4003 (yyval.interm.type).qualifier = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4004 }
4005 break;
4006
Nicolas Capens3c20f802015-02-17 17:17:20 -05004007 case 144:
John Bauman66b8ab22014-05-06 15:57:45 -04004008
4009 {
4010 //
4011 // This is for user defined type names. The lexical phase looked up the
4012 // type.
4013 //
4014 TType& structure = static_cast<TVariable*>((yyvsp[(1) - (1)].lex).symbol)->getType();
4015 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4016 (yyval.interm.type).setBasic(EbtStruct, qual, (yyvsp[(1) - (1)].lex).line);
4017 (yyval.interm.type).userDef = &structure;
4018 }
4019 break;
4020
Nicolas Capens3c20f802015-02-17 17:17:20 -05004021 case 145:
John Bauman66b8ab22014-05-06 15:57:45 -04004022
4023 { if (context->enterStructDeclaration((yyvsp[(2) - (3)].lex).line, *(yyvsp[(2) - (3)].lex).string)) context->recover(); }
4024 break;
4025
Nicolas Capens3c20f802015-02-17 17:17:20 -05004026 case 146:
John Bauman66b8ab22014-05-06 15:57:45 -04004027
4028 {
4029 if (context->reservedErrorCheck((yyvsp[(2) - (6)].lex).line, *(yyvsp[(2) - (6)].lex).string))
4030 context->recover();
4031
4032 TType* structure = new TType((yyvsp[(5) - (6)].interm.typeList), *(yyvsp[(2) - (6)].lex).string);
4033 TVariable* userTypeDef = new TVariable((yyvsp[(2) - (6)].lex).string, *structure, true);
4034 if (! context->symbolTable.insert(*userTypeDef)) {
4035 context->error((yyvsp[(2) - (6)].lex).line, "redefinition", (yyvsp[(2) - (6)].lex).string->c_str(), "struct");
4036 context->recover();
4037 }
4038 (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (6)].lex).line);
4039 (yyval.interm.type).userDef = structure;
4040 context->exitStructDeclaration();
4041 }
4042 break;
4043
Nicolas Capens3c20f802015-02-17 17:17:20 -05004044 case 147:
John Bauman66b8ab22014-05-06 15:57:45 -04004045
4046 { if (context->enterStructDeclaration((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string)) context->recover(); }
4047 break;
4048
Nicolas Capens3c20f802015-02-17 17:17:20 -05004049 case 148:
John Bauman66b8ab22014-05-06 15:57:45 -04004050
4051 {
4052 TType* structure = new TType((yyvsp[(4) - (5)].interm.typeList), TString(""));
4053 (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (5)].lex).line);
4054 (yyval.interm.type).userDef = structure;
4055 context->exitStructDeclaration();
4056 }
4057 break;
4058
Nicolas Capens3c20f802015-02-17 17:17:20 -05004059 case 149:
John Bauman66b8ab22014-05-06 15:57:45 -04004060
4061 {
4062 (yyval.interm.typeList) = (yyvsp[(1) - (1)].interm.typeList);
4063 }
4064 break;
4065
Nicolas Capens3c20f802015-02-17 17:17:20 -05004066 case 150:
John Bauman66b8ab22014-05-06 15:57:45 -04004067
4068 {
4069 (yyval.interm.typeList) = (yyvsp[(1) - (2)].interm.typeList);
4070 for (unsigned int i = 0; i < (yyvsp[(2) - (2)].interm.typeList)->size(); ++i) {
4071 for (unsigned int j = 0; j < (yyval.interm.typeList)->size(); ++j) {
4072 if ((*(yyval.interm.typeList))[j].type->getFieldName() == (*(yyvsp[(2) - (2)].interm.typeList))[i].type->getFieldName()) {
4073 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());
4074 context->recover();
4075 }
4076 }
4077 (yyval.interm.typeList)->push_back((*(yyvsp[(2) - (2)].interm.typeList))[i]);
4078 }
4079 }
4080 break;
4081
Nicolas Capens3c20f802015-02-17 17:17:20 -05004082 case 151:
John Bauman66b8ab22014-05-06 15:57:45 -04004083
4084 {
4085 (yyval.interm.typeList) = (yyvsp[(2) - (3)].interm.typeList);
4086
4087 if (context->voidErrorCheck((yyvsp[(1) - (3)].interm.type).line, (*(yyvsp[(2) - (3)].interm.typeList))[0].type->getFieldName(), (yyvsp[(1) - (3)].interm.type))) {
4088 context->recover();
4089 }
4090 for (unsigned int i = 0; i < (yyval.interm.typeList)->size(); ++i) {
4091 //
4092 // Careful not to replace already known aspects of type, like array-ness
4093 //
4094 TType* type = (*(yyval.interm.typeList))[i].type;
4095 type->setBasicType((yyvsp[(1) - (3)].interm.type).type);
4096 type->setNominalSize((yyvsp[(1) - (3)].interm.type).size);
4097 type->setMatrix((yyvsp[(1) - (3)].interm.type).matrix);
4098 type->setPrecision((yyvsp[(1) - (3)].interm.type).precision);
4099
4100 // don't allow arrays of arrays
4101 if (type->isArray()) {
4102 if (context->arrayTypeErrorCheck((yyvsp[(1) - (3)].interm.type).line, (yyvsp[(1) - (3)].interm.type)))
4103 context->recover();
4104 }
4105 if ((yyvsp[(1) - (3)].interm.type).array)
4106 type->setArraySize((yyvsp[(1) - (3)].interm.type).arraySize);
4107 if ((yyvsp[(1) - (3)].interm.type).userDef) {
4108 type->setStruct((yyvsp[(1) - (3)].interm.type).userDef->getStruct());
4109 type->setTypeName((yyvsp[(1) - (3)].interm.type).userDef->getTypeName());
4110 }
John Bauman66b8ab22014-05-06 15:57:45 -04004111 }
4112 }
4113 break;
4114
Nicolas Capens3c20f802015-02-17 17:17:20 -05004115 case 152:
John Bauman66b8ab22014-05-06 15:57:45 -04004116
4117 {
4118 (yyval.interm.typeList) = NewPoolTTypeList();
4119 (yyval.interm.typeList)->push_back((yyvsp[(1) - (1)].interm.typeLine));
4120 }
4121 break;
4122
Nicolas Capens3c20f802015-02-17 17:17:20 -05004123 case 153:
John Bauman66b8ab22014-05-06 15:57:45 -04004124
4125 {
4126 (yyval.interm.typeList)->push_back((yyvsp[(3) - (3)].interm.typeLine));
4127 }
4128 break;
4129
Nicolas Capens3c20f802015-02-17 17:17:20 -05004130 case 154:
John Bauman66b8ab22014-05-06 15:57:45 -04004131
4132 {
4133 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
4134 context->recover();
4135
4136 (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
4137 (yyval.interm.typeLine).line = (yyvsp[(1) - (1)].lex).line;
4138 (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (1)].lex).string);
4139 }
4140 break;
4141
Nicolas Capens3c20f802015-02-17 17:17:20 -05004142 case 155:
John Bauman66b8ab22014-05-06 15:57:45 -04004143
4144 {
4145 if (context->reservedErrorCheck((yyvsp[(1) - (4)].lex).line, *(yyvsp[(1) - (4)].lex).string))
4146 context->recover();
4147
4148 (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
4149 (yyval.interm.typeLine).line = (yyvsp[(1) - (4)].lex).line;
4150 (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (4)].lex).string);
4151
4152 int size;
4153 if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
4154 context->recover();
4155 (yyval.interm.typeLine).type->setArraySize(size);
4156 }
4157 break;
4158
Nicolas Capens3c20f802015-02-17 17:17:20 -05004159 case 156:
John Bauman66b8ab22014-05-06 15:57:45 -04004160
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05004161 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
John Bauman66b8ab22014-05-06 15:57:45 -04004162 break;
4163
John Bauman66b8ab22014-05-06 15:57:45 -04004164 case 157:
4165
Nicolas Capens3c20f802015-02-17 17:17:20 -05004166 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
John Bauman66b8ab22014-05-06 15:57:45 -04004167 break;
4168
4169 case 158:
4170
Nicolas Capens3c20f802015-02-17 17:17:20 -05004171 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermAggregate); }
John Bauman66b8ab22014-05-06 15:57:45 -04004172 break;
4173
4174 case 159:
4175
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05004176 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04004177 break;
4178
4179 case 160:
4180
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05004181 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
Alexis Hetub027aa92015-01-19 15:56:12 -05004182 break;
4183
4184 case 161:
4185
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05004186 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
John Bauman66b8ab22014-05-06 15:57:45 -04004187 break;
4188
John Bauman66b8ab22014-05-06 15:57:45 -04004189 case 162:
4190
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04004191 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
John Bauman66b8ab22014-05-06 15:57:45 -04004192 break;
4193
4194 case 163:
4195
Alexis Hetub027aa92015-01-19 15:56:12 -05004196 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
John Bauman66b8ab22014-05-06 15:57:45 -04004197 break;
4198
4199 case 164:
4200
Nicolas Capens3c20f802015-02-17 17:17:20 -05004201 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
John Bauman66b8ab22014-05-06 15:57:45 -04004202 break;
4203
4204 case 165:
4205
Nicolas Capens3c20f802015-02-17 17:17:20 -05004206 { (yyval.interm.intermAggregate) = 0; }
John Bauman66b8ab22014-05-06 15:57:45 -04004207 break;
4208
4209 case 166:
4210
Nicolas Capens3c20f802015-02-17 17:17:20 -05004211 { context->symbolTable.push(); }
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04004212 break;
4213
4214 case 167:
4215
Nicolas Capens3c20f802015-02-17 17:17:20 -05004216 { context->symbolTable.pop(); }
4217 break;
4218
4219 case 168:
4220
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05004221 {
4222 if ((yyvsp[(3) - (5)].interm.intermAggregate) != 0) {
4223 (yyvsp[(3) - (5)].interm.intermAggregate)->setOp(EOpSequence);
4224 (yyvsp[(3) - (5)].interm.intermAggregate)->setEndLine((yyvsp[(5) - (5)].lex).line);
4225 }
4226 (yyval.interm.intermAggregate) = (yyvsp[(3) - (5)].interm.intermAggregate);
4227 }
Alexis Hetub027aa92015-01-19 15:56:12 -05004228 break;
4229
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05004230 case 169:
4231
4232 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
4233 break;
4234
4235 case 170:
4236
Nicolas Capens3c20f802015-02-17 17:17:20 -05004237 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05004238 break;
4239
4240 case 171:
4241
Nicolas Capens3c20f802015-02-17 17:17:20 -05004242 { context->symbolTable.push(); }
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05004243 break;
4244
4245 case 172:
4246
Nicolas Capens3c20f802015-02-17 17:17:20 -05004247 { context->symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[(2) - (2)].interm.intermNode); }
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05004248 break;
4249
4250 case 173:
4251
Nicolas Capens3c20f802015-02-17 17:17:20 -05004252 { context->symbolTable.push(); }
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05004253 break;
4254
4255 case 174:
4256
Nicolas Capens3c20f802015-02-17 17:17:20 -05004257 { context->symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[(2) - (2)].interm.intermNode); }
4258 break;
4259
4260 case 175:
4261
John Bauman66b8ab22014-05-06 15:57:45 -04004262 {
4263 (yyval.interm.intermNode) = 0;
4264 }
4265 break;
4266
Nicolas Capens3c20f802015-02-17 17:17:20 -05004267 case 176:
John Bauman66b8ab22014-05-06 15:57:45 -04004268
4269 {
4270 if ((yyvsp[(2) - (3)].interm.intermAggregate)) {
4271 (yyvsp[(2) - (3)].interm.intermAggregate)->setOp(EOpSequence);
4272 (yyvsp[(2) - (3)].interm.intermAggregate)->setEndLine((yyvsp[(3) - (3)].lex).line);
4273 }
4274 (yyval.interm.intermNode) = (yyvsp[(2) - (3)].interm.intermAggregate);
4275 }
4276 break;
4277
Nicolas Capens3c20f802015-02-17 17:17:20 -05004278 case 177:
John Bauman66b8ab22014-05-06 15:57:45 -04004279
4280 {
4281 (yyval.interm.intermAggregate) = context->intermediate.makeAggregate((yyvsp[(1) - (1)].interm.intermNode), 0);
4282 }
4283 break;
4284
Nicolas Capens3c20f802015-02-17 17:17:20 -05004285 case 178:
John Bauman66b8ab22014-05-06 15:57:45 -04004286
4287 {
4288 (yyval.interm.intermAggregate) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermAggregate), (yyvsp[(2) - (2)].interm.intermNode), 0);
4289 }
4290 break;
4291
Nicolas Capens3c20f802015-02-17 17:17:20 -05004292 case 179:
John Bauman66b8ab22014-05-06 15:57:45 -04004293
4294 { (yyval.interm.intermNode) = 0; }
4295 break;
4296
Nicolas Capens3c20f802015-02-17 17:17:20 -05004297 case 180:
John Bauman66b8ab22014-05-06 15:57:45 -04004298
4299 { (yyval.interm.intermNode) = static_cast<TIntermNode*>((yyvsp[(1) - (2)].interm.intermTypedNode)); }
4300 break;
4301
Nicolas Capens3c20f802015-02-17 17:17:20 -05004302 case 181:
John Bauman66b8ab22014-05-06 15:57:45 -04004303
4304 {
4305 if (context->boolErrorCheck((yyvsp[(1) - (5)].lex).line, (yyvsp[(3) - (5)].interm.intermTypedNode)))
4306 context->recover();
4307 (yyval.interm.intermNode) = context->intermediate.addSelection((yyvsp[(3) - (5)].interm.intermTypedNode), (yyvsp[(5) - (5)].interm.nodePair), (yyvsp[(1) - (5)].lex).line);
4308 }
4309 break;
4310
Nicolas Capens3c20f802015-02-17 17:17:20 -05004311 case 182:
John Bauman66b8ab22014-05-06 15:57:45 -04004312
4313 {
4314 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermNode);
4315 (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermNode);
4316 }
4317 break;
4318
Nicolas Capens3c20f802015-02-17 17:17:20 -05004319 case 183:
John Bauman66b8ab22014-05-06 15:57:45 -04004320
4321 {
4322 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (1)].interm.intermNode);
4323 (yyval.interm.nodePair).node2 = 0;
4324 }
4325 break;
4326
Nicolas Capens3c20f802015-02-17 17:17:20 -05004327 case 184:
John Bauman66b8ab22014-05-06 15:57:45 -04004328
4329 {
4330 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
4331 if (context->boolErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)->getLine(), (yyvsp[(1) - (1)].interm.intermTypedNode)))
4332 context->recover();
4333 }
4334 break;
4335
Nicolas Capens3c20f802015-02-17 17:17:20 -05004336 case 185:
John Bauman66b8ab22014-05-06 15:57:45 -04004337
4338 {
4339 TIntermNode* intermNode;
4340 if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
4341 context->recover();
4342 if (context->boolErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
4343 context->recover();
4344
4345 if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode))
4346 (yyval.interm.intermTypedNode) = (yyvsp[(4) - (4)].interm.intermTypedNode);
4347 else {
4348 context->recover();
4349 (yyval.interm.intermTypedNode) = 0;
4350 }
4351 }
4352 break;
4353
Nicolas Capens3c20f802015-02-17 17:17:20 -05004354 case 186:
John Bauman66b8ab22014-05-06 15:57:45 -04004355
4356 { context->symbolTable.push(); ++context->loopNestingLevel; }
4357 break;
4358
Nicolas Capens3c20f802015-02-17 17:17:20 -05004359 case 187:
John Bauman66b8ab22014-05-06 15:57:45 -04004360
4361 {
4362 context->symbolTable.pop();
4363 (yyval.interm.intermNode) = context->intermediate.addLoop(ELoopWhile, 0, (yyvsp[(4) - (6)].interm.intermTypedNode), 0, (yyvsp[(6) - (6)].interm.intermNode), (yyvsp[(1) - (6)].lex).line);
4364 --context->loopNestingLevel;
4365 }
4366 break;
4367
Nicolas Capens3c20f802015-02-17 17:17:20 -05004368 case 188:
John Bauman66b8ab22014-05-06 15:57:45 -04004369
4370 { ++context->loopNestingLevel; }
4371 break;
4372
Nicolas Capens3c20f802015-02-17 17:17:20 -05004373 case 189:
John Bauman66b8ab22014-05-06 15:57:45 -04004374
4375 {
4376 if (context->boolErrorCheck((yyvsp[(8) - (8)].lex).line, (yyvsp[(6) - (8)].interm.intermTypedNode)))
4377 context->recover();
4378
4379 (yyval.interm.intermNode) = context->intermediate.addLoop(ELoopDoWhile, 0, (yyvsp[(6) - (8)].interm.intermTypedNode), 0, (yyvsp[(3) - (8)].interm.intermNode), (yyvsp[(4) - (8)].lex).line);
4380 --context->loopNestingLevel;
4381 }
4382 break;
4383
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05004384 case 190:
John Bauman66b8ab22014-05-06 15:57:45 -04004385
Nicolas Capens3c20f802015-02-17 17:17:20 -05004386 { context->symbolTable.push(); ++context->loopNestingLevel; }
John Bauman66b8ab22014-05-06 15:57:45 -04004387 break;
4388
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05004389 case 191:
John Bauman66b8ab22014-05-06 15:57:45 -04004390
4391 {
Nicolas Capens3c20f802015-02-17 17:17:20 -05004392 context->symbolTable.pop();
4393 (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);
4394 --context->loopNestingLevel;
John Bauman66b8ab22014-05-06 15:57:45 -04004395 }
4396 break;
4397
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05004398 case 192:
John Bauman66b8ab22014-05-06 15:57:45 -04004399
4400 {
Alexis Hetub027aa92015-01-19 15:56:12 -05004401 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
John Bauman66b8ab22014-05-06 15:57:45 -04004402 }
4403 break;
4404
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05004405 case 193:
John Bauman66b8ab22014-05-06 15:57:45 -04004406
4407 {
Nicolas Capens3c20f802015-02-17 17:17:20 -05004408 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04004409 }
4410 break;
4411
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05004412 case 194:
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04004413
4414 {
Nicolas Capens3c20f802015-02-17 17:17:20 -05004415 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
Alexis Hetub027aa92015-01-19 15:56:12 -05004416 }
4417 break;
4418
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05004419 case 195:
Alexis Hetub027aa92015-01-19 15:56:12 -05004420
4421 {
Nicolas Capens3c20f802015-02-17 17:17:20 -05004422 (yyval.interm.intermTypedNode) = 0;
4423 }
4424 break;
4425
4426 case 196:
4427
4428 {
John Bauman66b8ab22014-05-06 15:57:45 -04004429 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (2)].interm.intermTypedNode);
4430 (yyval.interm.nodePair).node2 = 0;
4431 }
4432 break;
4433
Nicolas Capens3c20f802015-02-17 17:17:20 -05004434 case 197:
John Bauman66b8ab22014-05-06 15:57:45 -04004435
4436 {
4437 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermTypedNode);
4438 (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermTypedNode);
4439 }
4440 break;
4441
Nicolas Capens3c20f802015-02-17 17:17:20 -05004442 case 198:
John Bauman66b8ab22014-05-06 15:57:45 -04004443
4444 {
4445 if (context->loopNestingLevel <= 0) {
4446 context->error((yyvsp[(1) - (2)].lex).line, "continue statement only allowed in loops", "");
4447 context->recover();
4448 }
4449 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpContinue, (yyvsp[(1) - (2)].lex).line);
4450 }
4451 break;
4452
Nicolas Capens3c20f802015-02-17 17:17:20 -05004453 case 199:
John Bauman66b8ab22014-05-06 15:57:45 -04004454
4455 {
4456 if (context->loopNestingLevel <= 0) {
4457 context->error((yyvsp[(1) - (2)].lex).line, "break statement only allowed in loops", "");
4458 context->recover();
4459 }
4460 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpBreak, (yyvsp[(1) - (2)].lex).line);
4461 }
4462 break;
4463
Nicolas Capens3c20f802015-02-17 17:17:20 -05004464 case 200:
John Bauman66b8ab22014-05-06 15:57:45 -04004465
4466 {
4467 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(1) - (2)].lex).line);
4468 if (context->currentFunctionType->getBasicType() != EbtVoid) {
4469 context->error((yyvsp[(1) - (2)].lex).line, "non-void function must return a value", "return");
4470 context->recover();
4471 }
4472 }
4473 break;
4474
Nicolas Capens3c20f802015-02-17 17:17:20 -05004475 case 201:
John Bauman66b8ab22014-05-06 15:57:45 -04004476
4477 {
4478 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(2) - (3)].interm.intermTypedNode), (yyvsp[(1) - (3)].lex).line);
4479 context->functionReturnsValue = true;
4480 if (context->currentFunctionType->getBasicType() == EbtVoid) {
4481 context->error((yyvsp[(1) - (3)].lex).line, "void function cannot return a value", "return");
4482 context->recover();
4483 } else if (*(context->currentFunctionType) != (yyvsp[(2) - (3)].interm.intermTypedNode)->getType()) {
4484 context->error((yyvsp[(1) - (3)].lex).line, "function return is not matching type:", "return");
4485 context->recover();
4486 }
4487 }
4488 break;
4489
Nicolas Capens3c20f802015-02-17 17:17:20 -05004490 case 202:
John Bauman66b8ab22014-05-06 15:57:45 -04004491
4492 {
4493 FRAG_ONLY("discard", (yyvsp[(1) - (2)].lex).line);
4494 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpKill, (yyvsp[(1) - (2)].lex).line);
4495 }
4496 break;
4497
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05004498 case 203:
John Bauman66b8ab22014-05-06 15:57:45 -04004499
4500 {
Nicolas Capens3c20f802015-02-17 17:17:20 -05004501 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
Alexis Hetub027aa92015-01-19 15:56:12 -05004502 context->treeRoot = (yyval.interm.intermNode);
John Bauman66b8ab22014-05-06 15:57:45 -04004503 }
4504 break;
4505
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05004506 case 204:
John Bauman66b8ab22014-05-06 15:57:45 -04004507
4508 {
Nicolas Capens3c20f802015-02-17 17:17:20 -05004509 (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermNode), (yyvsp[(2) - (2)].interm.intermNode), 0);
4510 context->treeRoot = (yyval.interm.intermNode);
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04004511 }
4512 break;
4513
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05004514 case 205:
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04004515
4516 {
Alexis Hetub027aa92015-01-19 15:56:12 -05004517 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
4518 }
4519 break;
4520
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05004521 case 206:
Alexis Hetub027aa92015-01-19 15:56:12 -05004522
4523 {
Nicolas Capens3c20f802015-02-17 17:17:20 -05004524 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
4525 }
4526 break;
4527
4528 case 207:
4529
4530 {
John Bauman66b8ab22014-05-06 15:57:45 -04004531 TFunction* function = (yyvsp[(1) - (1)].interm).function;
4532
4533 const TSymbol *builtIn = context->symbolTable.findBuiltIn(function->getMangledName());
4534
4535 if (builtIn)
4536 {
4537 context->error((yyvsp[(1) - (1)].interm).line, "built-in functions cannot be redefined", function->getName().c_str());
4538 context->recover();
4539 }
4540
4541 TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find(function->getMangledName()));
4542 //
4543 // Note: 'prevDec' could be 'function' if this is the first time we've seen function
4544 // as it would have just been put in the symbol table. Otherwise, we're looking up
4545 // an earlier occurance.
4546 //
4547 if (prevDec->isDefined()) {
4548 //
4549 // Then this function already has a body.
4550 //
4551 context->error((yyvsp[(1) - (1)].interm).line, "function already has a body", function->getName().c_str());
4552 context->recover();
4553 }
4554 prevDec->setDefined();
4555
4556 //
4557 // Raise error message if main function takes any parameters or return anything other than void
4558 //
4559 if (function->getName() == "main") {
4560 if (function->getParamCount() > 0) {
4561 context->error((yyvsp[(1) - (1)].interm).line, "function cannot take any parameter(s)", function->getName().c_str());
4562 context->recover();
4563 }
4564 if (function->getReturnType().getBasicType() != EbtVoid) {
4565 context->error((yyvsp[(1) - (1)].interm).line, "", function->getReturnType().getBasicString(), "main function cannot return a value");
4566 context->recover();
4567 }
4568 }
4569
4570 //
4571 // Remember the return type for later checking for RETURN statements.
4572 //
4573 context->currentFunctionType = &(prevDec->getReturnType());
4574 context->functionReturnsValue = false;
4575
4576 //
4577 // Insert parameters into the symbol table.
4578 // If the parameter has no name, it's not an error, just don't insert it
4579 // (could be used for unused args).
4580 //
4581 // Also, accumulate the list of parameters into the HIL, so lower level code
4582 // knows where to find parameters.
4583 //
4584 TIntermAggregate* paramNodes = new TIntermAggregate;
4585 for (int i = 0; i < function->getParamCount(); i++) {
4586 const TParameter& param = function->getParam(i);
4587 if (param.name != 0) {
4588 TVariable *variable = new TVariable(param.name, *param.type);
4589 //
4590 // Insert the parameters with name in the symbol table.
4591 //
4592 if (! context->symbolTable.insert(*variable)) {
4593 context->error((yyvsp[(1) - (1)].interm).line, "redefinition", variable->getName().c_str());
4594 context->recover();
4595 delete variable;
4596 }
4597
4598 //
4599 // Add the parameter to the HIL
4600 //
4601 paramNodes = context->intermediate.growAggregate(
4602 paramNodes,
4603 context->intermediate.addSymbol(variable->getUniqueId(),
4604 variable->getName(),
4605 variable->getType(), (yyvsp[(1) - (1)].interm).line),
4606 (yyvsp[(1) - (1)].interm).line);
4607 } else {
4608 paramNodes = context->intermediate.growAggregate(paramNodes, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (1)].interm).line), (yyvsp[(1) - (1)].interm).line);
4609 }
4610 }
4611 context->intermediate.setAggregateOperator(paramNodes, EOpParameters, (yyvsp[(1) - (1)].interm).line);
4612 (yyvsp[(1) - (1)].interm).intermAggregate = paramNodes;
4613 context->loopNestingLevel = 0;
4614 }
4615 break;
4616
Nicolas Capens3c20f802015-02-17 17:17:20 -05004617 case 208:
John Bauman66b8ab22014-05-06 15:57:45 -04004618
4619 {
4620 //?? Check that all paths return a value if return type != void ?
4621 // May be best done as post process phase on intermediate code
4622 if (context->currentFunctionType->getBasicType() != EbtVoid && ! context->functionReturnsValue) {
4623 context->error((yyvsp[(1) - (3)].interm).line, "function does not return a value:", "", (yyvsp[(1) - (3)].interm).function->getName().c_str());
4624 context->recover();
4625 }
4626
4627 (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermAggregate, (yyvsp[(3) - (3)].interm.intermNode), 0);
4628 context->intermediate.setAggregateOperator((yyval.interm.intermNode), EOpFunction, (yyvsp[(1) - (3)].interm).line);
4629 (yyval.interm.intermNode)->getAsAggregate()->setName((yyvsp[(1) - (3)].interm).function->getMangledName().c_str());
4630 (yyval.interm.intermNode)->getAsAggregate()->setType((yyvsp[(1) - (3)].interm).function->getReturnType());
4631
4632 // store the pragma information for debug and optimize and other vendor specific
4633 // information. This information can be queried from the parse tree
4634 (yyval.interm.intermNode)->getAsAggregate()->setOptimize(context->pragma().optimize);
4635 (yyval.interm.intermNode)->getAsAggregate()->setDebug(context->pragma().debug);
4636
4637 if ((yyvsp[(3) - (3)].interm.intermNode) && (yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate())
4638 (yyval.interm.intermNode)->getAsAggregate()->setEndLine((yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate()->getEndLine());
4639
4640 context->symbolTable.pop();
4641 }
4642 break;
4643
4644
4645
4646 default: break;
4647 }
4648 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
4649
4650 YYPOPSTACK (yylen);
4651 yylen = 0;
4652 YY_STACK_PRINT (yyss, yyssp);
4653
4654 *++yyvsp = yyval;
4655
4656 /* Now `shift' the result of the reduction. Determine what state
4657 that goes to, based on the state we popped back to and the rule
4658 number reduced by. */
4659
4660 yyn = yyr1[yyn];
4661
4662 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
4663 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
4664 yystate = yytable[yystate];
4665 else
4666 yystate = yydefgoto[yyn - YYNTOKENS];
4667
4668 goto yynewstate;
4669
4670
4671/*------------------------------------.
4672| yyerrlab -- here on detecting error |
4673`------------------------------------*/
4674yyerrlab:
4675 /* If not already recovering from an error, report this error. */
4676 if (!yyerrstatus)
4677 {
4678 ++yynerrs;
4679#if ! YYERROR_VERBOSE
4680 yyerror (context, YY_("syntax error"));
4681#else
4682 {
4683 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
4684 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
4685 {
4686 YYSIZE_T yyalloc = 2 * yysize;
4687 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
4688 yyalloc = YYSTACK_ALLOC_MAXIMUM;
4689 if (yymsg != yymsgbuf)
4690 YYSTACK_FREE (yymsg);
4691 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
4692 if (yymsg)
4693 yymsg_alloc = yyalloc;
4694 else
4695 {
4696 yymsg = yymsgbuf;
4697 yymsg_alloc = sizeof yymsgbuf;
4698 }
4699 }
4700
4701 if (0 < yysize && yysize <= yymsg_alloc)
4702 {
4703 (void) yysyntax_error (yymsg, yystate, yychar);
4704 yyerror (context, yymsg);
4705 }
4706 else
4707 {
4708 yyerror (context, YY_("syntax error"));
4709 if (yysize != 0)
4710 goto yyexhaustedlab;
4711 }
4712 }
4713#endif
4714 }
4715
4716
4717
4718 if (yyerrstatus == 3)
4719 {
4720 /* If just tried and failed to reuse lookahead token after an
4721 error, discard it. */
4722
4723 if (yychar <= YYEOF)
4724 {
4725 /* Return failure if at end of input. */
4726 if (yychar == YYEOF)
4727 YYABORT;
4728 }
4729 else
4730 {
4731 yydestruct ("Error: discarding",
4732 yytoken, &yylval, context);
4733 yychar = YYEMPTY;
4734 }
4735 }
4736
4737 /* Else will try to reuse lookahead token after shifting the error
4738 token. */
4739 goto yyerrlab1;
4740
4741
4742/*---------------------------------------------------.
4743| yyerrorlab -- error raised explicitly by YYERROR. |
4744`---------------------------------------------------*/
4745yyerrorlab:
4746
4747 /* Pacify compilers like GCC when the user code never invokes
4748 YYERROR and the label yyerrorlab therefore never appears in user
4749 code. */
4750 if (/*CONSTCOND*/ 0)
4751 goto yyerrorlab;
4752
4753 /* Do not reclaim the symbols of the rule which action triggered
4754 this YYERROR. */
4755 YYPOPSTACK (yylen);
4756 yylen = 0;
4757 YY_STACK_PRINT (yyss, yyssp);
4758 yystate = *yyssp;
4759 goto yyerrlab1;
4760
4761
4762/*-------------------------------------------------------------.
4763| yyerrlab1 -- common code for both syntax error and YYERROR. |
4764`-------------------------------------------------------------*/
4765yyerrlab1:
4766 yyerrstatus = 3; /* Each real token shifted decrements this. */
4767
4768 for (;;)
4769 {
4770 yyn = yypact[yystate];
4771 if (yyn != YYPACT_NINF)
4772 {
4773 yyn += YYTERROR;
4774 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
4775 {
4776 yyn = yytable[yyn];
4777 if (0 < yyn)
4778 break;
4779 }
4780 }
4781
4782 /* Pop the current state because it cannot handle the error token. */
4783 if (yyssp == yyss)
4784 YYABORT;
4785
4786
4787 yydestruct ("Error: popping",
4788 yystos[yystate], yyvsp, context);
4789 YYPOPSTACK (1);
4790 yystate = *yyssp;
4791 YY_STACK_PRINT (yyss, yyssp);
4792 }
4793
4794 *++yyvsp = yylval;
4795
4796
4797 /* Shift the error token. */
4798 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
4799
4800 yystate = yyn;
4801 goto yynewstate;
4802
4803
4804/*-------------------------------------.
4805| yyacceptlab -- YYACCEPT comes here. |
4806`-------------------------------------*/
4807yyacceptlab:
4808 yyresult = 0;
4809 goto yyreturn;
4810
4811/*-----------------------------------.
4812| yyabortlab -- YYABORT comes here. |
4813`-----------------------------------*/
4814yyabortlab:
4815 yyresult = 1;
4816 goto yyreturn;
4817
4818#if !defined(yyoverflow) || YYERROR_VERBOSE
4819/*-------------------------------------------------.
4820| yyexhaustedlab -- memory exhaustion comes here. |
4821`-------------------------------------------------*/
4822yyexhaustedlab:
4823 yyerror (context, YY_("memory exhausted"));
4824 yyresult = 2;
4825 /* Fall through. */
4826#endif
4827
4828yyreturn:
4829 if (yychar != YYEMPTY)
4830 yydestruct ("Cleanup: discarding lookahead",
4831 yytoken, &yylval, context);
4832 /* Do not reclaim the symbols of the rule which action triggered
4833 this YYABORT or YYACCEPT. */
4834 YYPOPSTACK (yylen);
4835 YY_STACK_PRINT (yyss, yyssp);
4836 while (yyssp != yyss)
4837 {
4838 yydestruct ("Cleanup: popping",
4839 yystos[*yyssp], yyvsp, context);
4840 YYPOPSTACK (1);
4841 }
4842#ifndef yyoverflow
4843 if (yyss != yyssa)
4844 YYSTACK_FREE (yyss);
4845#endif
4846#if YYERROR_VERBOSE
4847 if (yymsg != yymsgbuf)
4848 YYSTACK_FREE (yymsg);
4849#endif
4850 /* Make sure YYID is used. */
4851 return YYID (yyresult);
4852}
4853
4854
4855
4856
4857
4858int glslang_parse(TParseContext* context) {
4859 return yyparse(context);
4860}
4861