blob: 54ac7fe132d2b5b78eac1e69d424fccbff7134a6 [file] [log] [blame]
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04001
2/* A Bison parser, made by GNU Bison 2.4.1. */
John Bauman66b8ab22014-05-06 15:57:45 -04003
4/* Skeleton implementation for Bison's Yacc-like parsers in C
5
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04006 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
7 Free Software Foundation, Inc.
John Bauman66b8ab22014-05-06 15:57:45 -04008
9 This program is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
21
22/* As a special exception, you may create a larger work that contains
23 part or all of the Bison parser skeleton and distribute that work
24 under terms of your choice, so long as that work isn't itself a
25 parser generator using the skeleton or a modified version thereof
26 as a parser skeleton. Alternatively, if you modify or redistribute
27 the parser skeleton itself, you may (at your option) remove this
28 special exception, which will cause the skeleton and the resulting
29 Bison output files to be licensed under the GNU General Public
30 License without this special exception.
31
32 This special exception was added by the Free Software Foundation in
33 version 2.2 of Bison. */
34
35/* C LALR(1) parser skeleton written by Richard Stallman, by
36 simplifying the original so-called "semantic" parser. */
37
38/* All symbols defined below should begin with yy or YY, to avoid
39 infringing on user name space. This should be done even for local
40 variables, as they might otherwise be expanded by user macros.
41 There are some unavoidable exceptions within include files to
42 define necessary library symbols; they are noted "INFRINGES ON
43 USER NAME SPACE" below. */
44
45/* Identify Bison output. */
46#define YYBISON 1
47
48/* Bison version. */
Nicolas Capense9c5e4f2014-05-28 22:46:43 -040049#define YYBISON_VERSION "2.4.1"
John Bauman66b8ab22014-05-06 15:57:45 -040050
51/* Skeleton name. */
52#define YYSKELETON_NAME "yacc.c"
53
54/* Pure parsers. */
55#define YYPURE 1
56
57/* Push parsers. */
58#define YYPUSH 0
59
60/* Pull parsers. */
61#define YYPULL 1
62
63/* Using locations. */
64#define YYLSP_NEEDED 0
65
66
67
68/* Copy the first part of user declarations. */
69
70
71//
Alexis Hetub14178b2015-04-13 13:23:20 -040072// Copyright (c) 2002-2015 The ANGLE Project Authors. All rights reserved.
John Bauman66b8ab22014-05-06 15:57:45 -040073// Use of this source code is governed by a BSD-style license that can be
74// found in the LICENSE file.
75//
76
77// This file is auto-generated by generate_parser.sh. DO NOT EDIT!
78
79// Ignore errors in auto-generated code.
80#if defined(__GNUC__)
81#pragma GCC diagnostic ignored "-Wunused-function"
82#pragma GCC diagnostic ignored "-Wunused-variable"
83#pragma GCC diagnostic ignored "-Wswitch-enum"
84#elif defined(_MSC_VER)
85#pragma warning(disable: 4065)
86#pragma warning(disable: 4189)
87#pragma warning(disable: 4505)
88#pragma warning(disable: 4701)
89#endif
90
Nicolas Capenscc863da2015-01-21 15:50:55 -050091#include "SymbolTable.h"
92#include "ParseHelper.h"
John Bauman66b8ab22014-05-06 15:57:45 -040093
John Baumand4ae8632014-05-06 16:18:33 -040094#define YYENABLE_NLS 0
95#define YYLTYPE_IS_TRIVIAL 1
96
John Bauman66b8ab22014-05-06 15:57:45 -040097#define YYLEX_PARAM context->scanner
98
99
100
101/* Enabling traces. */
102#ifndef YYDEBUG
103# define YYDEBUG 0
104#endif
105
106/* Enabling verbose error messages. */
107#ifdef YYERROR_VERBOSE
108# undef YYERROR_VERBOSE
109# define YYERROR_VERBOSE 1
110#else
111# define YYERROR_VERBOSE 0
112#endif
113
114/* Enabling the token table. */
115#ifndef YYTOKEN_TABLE
116# define YYTOKEN_TABLE 0
117#endif
118
119
120/* Tokens. */
121#ifndef YYTOKENTYPE
122# define YYTOKENTYPE
123 /* Put the tokens into the symbol table, so that GDB and other debuggers
124 know about them. */
125 enum yytokentype {
126 INVARIANT = 258,
127 HIGH_PRECISION = 259,
128 MEDIUM_PRECISION = 260,
129 LOW_PRECISION = 261,
130 PRECISION = 262,
131 ATTRIBUTE = 263,
132 CONST_QUAL = 264,
133 BOOL_TYPE = 265,
134 FLOAT_TYPE = 266,
135 INT_TYPE = 267,
Nicolas Capens3c20f802015-02-17 17:17:20 -0500136 UINT_TYPE = 268,
137 BREAK = 269,
138 CONTINUE = 270,
139 DO = 271,
140 ELSE = 272,
141 FOR = 273,
142 IF = 274,
143 DISCARD = 275,
144 RETURN = 276,
145 SWITCH = 277,
146 CASE = 278,
147 DEFAULT = 279,
148 BVEC2 = 280,
149 BVEC3 = 281,
150 BVEC4 = 282,
151 IVEC2 = 283,
152 IVEC3 = 284,
153 IVEC4 = 285,
154 VEC2 = 286,
155 VEC3 = 287,
156 VEC4 = 288,
Nicolas Capense4b1b1d2015-02-17 17:26:01 -0500157 UVEC2 = 289,
158 UVEC3 = 290,
159 UVEC4 = 291,
160 MATRIX2 = 292,
161 MATRIX3 = 293,
162 MATRIX4 = 294,
163 IN_QUAL = 295,
164 OUT_QUAL = 296,
165 INOUT_QUAL = 297,
166 UNIFORM = 298,
167 VARYING = 299,
Alexis Hetub14178b2015-04-13 13:23:20 -0400168 MATRIX2x3 = 300,
169 MATRIX3x2 = 301,
170 MATRIX2x4 = 302,
171 MATRIX4x2 = 303,
172 MATRIX3x4 = 304,
173 MATRIX4x3 = 305,
174 CENTROID = 306,
175 FLAT = 307,
176 SMOOTH = 308,
177 STRUCT = 309,
178 VOID_TYPE = 310,
179 WHILE = 311,
180 SAMPLER2D = 312,
181 SAMPLERCUBE = 313,
182 SAMPLER_EXTERNAL_OES = 314,
183 SAMPLER2DRECT = 315,
184 SAMPLER2DARRAY = 316,
185 ISAMPLER2D = 317,
186 ISAMPLER3D = 318,
187 ISAMPLERCUBE = 319,
188 ISAMPLER2DARRAY = 320,
189 USAMPLER2D = 321,
190 USAMPLER3D = 322,
191 USAMPLERCUBE = 323,
192 USAMPLER2DARRAY = 324,
193 SAMPLER3D = 325,
194 SAMPLER3DRECT = 326,
195 SAMPLER2DSHADOW = 327,
196 SAMPLERCUBESHADOW = 328,
197 SAMPLER2DARRAYSHADOW = 329,
198 LAYOUT = 330,
199 IDENTIFIER = 331,
200 TYPE_NAME = 332,
201 FLOATCONSTANT = 333,
202 INTCONSTANT = 334,
203 UINTCONSTANT = 335,
204 BOOLCONSTANT = 336,
205 FIELD_SELECTION = 337,
206 LEFT_OP = 338,
207 RIGHT_OP = 339,
208 INC_OP = 340,
209 DEC_OP = 341,
210 LE_OP = 342,
211 GE_OP = 343,
212 EQ_OP = 344,
213 NE_OP = 345,
214 AND_OP = 346,
215 OR_OP = 347,
216 XOR_OP = 348,
217 MUL_ASSIGN = 349,
218 DIV_ASSIGN = 350,
219 ADD_ASSIGN = 351,
220 MOD_ASSIGN = 352,
221 LEFT_ASSIGN = 353,
222 RIGHT_ASSIGN = 354,
223 AND_ASSIGN = 355,
224 XOR_ASSIGN = 356,
225 OR_ASSIGN = 357,
226 SUB_ASSIGN = 358,
227 LEFT_PAREN = 359,
228 RIGHT_PAREN = 360,
229 LEFT_BRACKET = 361,
230 RIGHT_BRACKET = 362,
231 LEFT_BRACE = 363,
232 RIGHT_BRACE = 364,
233 DOT = 365,
234 COMMA = 366,
235 COLON = 367,
236 EQUAL = 368,
237 SEMICOLON = 369,
238 BANG = 370,
239 DASH = 371,
240 TILDE = 372,
241 PLUS = 373,
242 STAR = 374,
243 SLASH = 375,
244 PERCENT = 376,
245 LEFT_ANGLE = 377,
246 RIGHT_ANGLE = 378,
247 VERTICAL_BAR = 379,
248 CARET = 380,
249 AMPERSAND = 381,
250 QUESTION = 382
John Bauman66b8ab22014-05-06 15:57:45 -0400251 };
252#endif
253
254
255
256#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
257typedef union YYSTYPE
258{
259
260
261 struct {
262 TSourceLoc line;
263 union {
264 TString *string;
265 float f;
266 int i;
Nicolas Capens2c1239f2015-02-17 17:30:04 -0500267 unsigned int u;
John Bauman66b8ab22014-05-06 15:57:45 -0400268 bool b;
269 };
270 TSymbol* symbol;
271 } lex;
272 struct {
273 TSourceLoc line;
274 TOperator op;
275 union {
276 TIntermNode* intermNode;
277 TIntermNodePair nodePair;
278 TIntermTyped* intermTypedNode;
279 TIntermAggregate* intermAggregate;
280 };
281 union {
282 TPublicType type;
283 TPrecision precision;
Nicolas Capens7d626792015-02-17 17:58:31 -0500284 TLayoutQualifier layoutQualifier;
John Bauman66b8ab22014-05-06 15:57:45 -0400285 TQualifier qualifier;
286 TFunction* function;
287 TParameter param;
288 TTypeLine typeLine;
289 TTypeList* typeList;
290 };
291 } interm;
292
293
294
295} YYSTYPE;
296# define YYSTYPE_IS_TRIVIAL 1
297# define yystype YYSTYPE /* obsolescent; will be withdrawn */
298# define YYSTYPE_IS_DECLARED 1
299#endif
300
301
302/* Copy the second part of user declarations. */
303
304
305extern int yylex(YYSTYPE* yylval_param, void* yyscanner);
306extern void yyerror(TParseContext* context, const char* reason);
307
308#define FRAG_VERT_ONLY(S, L) { \
Nicolas Capens08ca3c62015-02-13 16:06:45 -0500309 if (context->shaderType != GL_FRAGMENT_SHADER && \
310 context->shaderType != GL_VERTEX_SHADER) { \
John Bauman66b8ab22014-05-06 15:57:45 -0400311 context->error(L, " supported in vertex/fragment shaders only ", S); \
312 context->recover(); \
313 } \
314}
315
316#define VERTEX_ONLY(S, L) { \
Nicolas Capens08ca3c62015-02-13 16:06:45 -0500317 if (context->shaderType != GL_VERTEX_SHADER) { \
John Bauman66b8ab22014-05-06 15:57:45 -0400318 context->error(L, " supported in vertex shaders only ", S); \
319 context->recover(); \
320 } \
321}
322
323#define FRAG_ONLY(S, L) { \
Nicolas Capens08ca3c62015-02-13 16:06:45 -0500324 if (context->shaderType != GL_FRAGMENT_SHADER) { \
John Bauman66b8ab22014-05-06 15:57:45 -0400325 context->error(L, " supported in fragment shaders only ", S); \
326 context->recover(); \
327 } \
328}
329
Nicolas Capensc6841852015-02-15 14:25:37 -0500330#define ES2_ONLY(S, L) { \
331 if (context->shaderVersion != 100) { \
332 context->error(L, " supported in GLSL ES 1.00 only ", S); \
333 context->recover(); \
334 } \
335}
336
337#define ES3_ONLY(S, L) { \
338 if (context->shaderVersion != 300) { \
339 context->error(L, " supported in GLSL ES 3.00 only ", S); \
340 context->recover(); \
341 } \
342}
343
John Bauman66b8ab22014-05-06 15:57:45 -0400344
345
346#ifdef short
347# undef short
348#endif
349
350#ifdef YYTYPE_UINT8
351typedef YYTYPE_UINT8 yytype_uint8;
352#else
353typedef unsigned char yytype_uint8;
354#endif
355
356#ifdef YYTYPE_INT8
357typedef YYTYPE_INT8 yytype_int8;
358#elif (defined __STDC__ || defined __C99__FUNC__ \
359 || defined __cplusplus || defined _MSC_VER)
360typedef signed char yytype_int8;
361#else
362typedef short int yytype_int8;
363#endif
364
365#ifdef YYTYPE_UINT16
366typedef YYTYPE_UINT16 yytype_uint16;
367#else
368typedef unsigned short int yytype_uint16;
369#endif
370
371#ifdef YYTYPE_INT16
372typedef YYTYPE_INT16 yytype_int16;
373#else
374typedef short int yytype_int16;
375#endif
376
377#ifndef YYSIZE_T
378# ifdef __SIZE_TYPE__
379# define YYSIZE_T __SIZE_TYPE__
380# elif defined size_t
381# define YYSIZE_T size_t
382# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
383 || defined __cplusplus || defined _MSC_VER)
384# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
385# define YYSIZE_T size_t
386# else
387# define YYSIZE_T unsigned int
388# endif
389#endif
390
391#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
392
393#ifndef YY_
Nicolas Capense9c5e4f2014-05-28 22:46:43 -0400394# if YYENABLE_NLS
John Bauman66b8ab22014-05-06 15:57:45 -0400395# if ENABLE_NLS
396# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
397# define YY_(msgid) dgettext ("bison-runtime", msgid)
398# endif
399# endif
400# ifndef YY_
401# define YY_(msgid) msgid
402# endif
403#endif
404
405/* Suppress unused-variable warnings by "using" E. */
406#if ! defined lint || defined __GNUC__
407# define YYUSE(e) ((void) (e))
408#else
409# define YYUSE(e) /* empty */
410#endif
411
412/* Identity function, used to suppress warnings about constant conditions. */
413#ifndef lint
414# define YYID(n) (n)
415#else
416#if (defined __STDC__ || defined __C99__FUNC__ \
417 || defined __cplusplus || defined _MSC_VER)
418static int
419YYID (int yyi)
420#else
421static int
422YYID (yyi)
423 int yyi;
424#endif
425{
426 return yyi;
427}
428#endif
429
430#if ! defined yyoverflow || YYERROR_VERBOSE
431
432/* The parser invokes alloca or malloc; define the necessary symbols. */
433
434# ifdef YYSTACK_USE_ALLOCA
435# if YYSTACK_USE_ALLOCA
436# ifdef __GNUC__
437# define YYSTACK_ALLOC __builtin_alloca
438# elif defined __BUILTIN_VA_ARG_INCR
439# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
440# elif defined _AIX
441# define YYSTACK_ALLOC __alloca
442# elif defined _MSC_VER
443# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
444# define alloca _alloca
445# else
446# define YYSTACK_ALLOC alloca
447# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
448 || defined __cplusplus || defined _MSC_VER)
449# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
450# ifndef _STDLIB_H
451# define _STDLIB_H 1
452# endif
453# endif
454# endif
455# endif
456# endif
457
458# ifdef YYSTACK_ALLOC
459 /* Pacify GCC's `empty if-body' warning. */
460# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
461# ifndef YYSTACK_ALLOC_MAXIMUM
462 /* The OS might guarantee only one guard page at the bottom of the stack,
463 and a page size can be as small as 4096 bytes. So we cannot safely
464 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
465 to allow for a few compiler-allocated temporary stack slots. */
466# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
467# endif
468# else
469# define YYSTACK_ALLOC YYMALLOC
470# define YYSTACK_FREE YYFREE
471# ifndef YYSTACK_ALLOC_MAXIMUM
472# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
473# endif
474# if (defined __cplusplus && ! defined _STDLIB_H \
475 && ! ((defined YYMALLOC || defined malloc) \
476 && (defined YYFREE || defined free)))
477# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
478# ifndef _STDLIB_H
479# define _STDLIB_H 1
480# endif
481# endif
482# ifndef YYMALLOC
483# define YYMALLOC malloc
484# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
485 || defined __cplusplus || defined _MSC_VER)
486void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
487# endif
488# endif
489# ifndef YYFREE
490# define YYFREE free
491# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
492 || defined __cplusplus || defined _MSC_VER)
493void free (void *); /* INFRINGES ON USER NAME SPACE */
494# endif
495# endif
496# endif
497#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
498
499
500#if (! defined yyoverflow \
501 && (! defined __cplusplus \
502 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
503
504/* A type that is properly aligned for any stack member. */
505union yyalloc
506{
507 yytype_int16 yyss_alloc;
508 YYSTYPE yyvs_alloc;
509};
510
511/* The size of the maximum gap between one aligned stack and the next. */
512# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
513
514/* The size of an array large to enough to hold all stacks, each with
515 N elements. */
516# define YYSTACK_BYTES(N) \
517 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
518 + YYSTACK_GAP_MAXIMUM)
519
520/* Copy COUNT objects from FROM to TO. The source and destination do
521 not overlap. */
522# ifndef YYCOPY
523# if defined __GNUC__ && 1 < __GNUC__
524# define YYCOPY(To, From, Count) \
525 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
526# else
527# define YYCOPY(To, From, Count) \
528 do \
529 { \
530 YYSIZE_T yyi; \
531 for (yyi = 0; yyi < (Count); yyi++) \
532 (To)[yyi] = (From)[yyi]; \
533 } \
534 while (YYID (0))
535# endif
536# endif
537
538/* Relocate STACK from its old location to the new one. The
539 local variables YYSIZE and YYSTACKSIZE give the old and new number of
540 elements in the stack, and YYPTR gives the new location of the
541 stack. Advance YYPTR to a properly aligned location for the next
542 stack. */
543# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
544 do \
545 { \
546 YYSIZE_T yynewbytes; \
547 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
548 Stack = &yyptr->Stack_alloc; \
549 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
550 yyptr += yynewbytes / sizeof (*yyptr); \
551 } \
552 while (YYID (0))
553
554#endif
555
556/* YYFINAL -- State number of the termination state. */
Alexis Hetub14178b2015-04-13 13:23:20 -0400557#define YYFINAL 103
John Bauman66b8ab22014-05-06 15:57:45 -0400558/* YYLAST -- Last index in YYTABLE. */
Alexis Hetub14178b2015-04-13 13:23:20 -0400559#define YYLAST 2020
John Bauman66b8ab22014-05-06 15:57:45 -0400560
561/* YYNTOKENS -- Number of terminals. */
Alexis Hetub14178b2015-04-13 13:23:20 -0400562#define YYNTOKENS 128
John Bauman66b8ab22014-05-06 15:57:45 -0400563/* YYNNTS -- Number of nonterminals. */
Nicolas Capens7d626792015-02-17 17:58:31 -0500564#define YYNNTS 88
John Bauman66b8ab22014-05-06 15:57:45 -0400565/* YYNRULES -- Number of rules. */
Alexis Hetub14178b2015-04-13 13:23:20 -0400566#define YYNRULES 238
John Bauman66b8ab22014-05-06 15:57:45 -0400567/* YYNRULES -- Number of states. */
Alexis Hetub14178b2015-04-13 13:23:20 -0400568#define YYNSTATES 347
John Bauman66b8ab22014-05-06 15:57:45 -0400569
570/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
571#define YYUNDEFTOK 2
Alexis Hetub14178b2015-04-13 13:23:20 -0400572#define YYMAXUTOK 382
John Bauman66b8ab22014-05-06 15:57:45 -0400573
574#define YYTRANSLATE(YYX) \
575 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
576
577/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
578static const yytype_uint8 yytranslate[] =
579{
580 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
581 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
582 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
583 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
584 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
585 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
586 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
587 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
588 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
589 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
590 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
591 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
592 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
593 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
594 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
595 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
596 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
597 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
598 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
599 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
600 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
601 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
602 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
603 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
604 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
605 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
606 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
607 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
608 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
609 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
610 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
611 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
612 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
613 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
Alexis Hetub027aa92015-01-19 15:56:12 -0500614 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
Nicolas Capens3c20f802015-02-17 17:17:20 -0500615 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
Alexis Hetub14178b2015-04-13 13:23:20 -0400616 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
617 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
618 125, 126, 127
John Bauman66b8ab22014-05-06 15:57:45 -0400619};
620
621#if YYDEBUG
622/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
623 YYRHS. */
624static const yytype_uint16 yyprhs[] =
625{
Nicolas Capens2c1239f2015-02-17 17:30:04 -0500626 0, 0, 3, 5, 7, 9, 11, 13, 15, 19,
627 21, 26, 28, 32, 35, 38, 40, 42, 44, 48,
628 51, 54, 57, 59, 62, 66, 69, 71, 73, 75,
629 77, 80, 83, 86, 88, 90, 92, 94, 98, 102,
630 104, 108, 112, 114, 116, 120, 124, 128, 132, 134,
631 138, 142, 144, 146, 148, 150, 154, 156, 160, 162,
632 166, 168, 174, 176, 180, 182, 184, 186, 188, 190,
633 192, 196, 198, 201, 204, 209, 212, 214, 216, 219,
634 223, 227, 230, 236, 240, 243, 247, 250, 251, 253,
635 255, 257, 259, 261, 265, 271, 278, 284, 286, 289,
636 294, 300, 305, 308, 310, 313, 315, 317, 319, 322,
Nicolas Capens7d626792015-02-17 17:58:31 -0500637 324, 326, 329, 331, 333, 335, 338, 341, 343, 345,
638 348, 350, 352, 354, 359, 361, 365, 367, 371, 375,
639 377, 382, 384, 386, 388, 390, 392, 394, 396, 398,
640 400, 402, 404, 406, 408, 410, 412, 414, 416, 418,
Alexis Hetub14178b2015-04-13 13:23:20 -0400641 420, 422, 424, 426, 428, 430, 432, 434, 436, 438,
642 440, 442, 444, 446, 448, 450, 452, 454, 456, 458,
643 460, 462, 464, 466, 468, 470, 471, 478, 479, 485,
644 487, 490, 494, 496, 500, 502, 507, 509, 511, 513,
645 515, 517, 519, 521, 523, 525, 528, 529, 530, 536,
646 538, 540, 541, 544, 545, 548, 551, 555, 557, 560,
647 562, 565, 571, 575, 577, 579, 584, 585, 592, 593,
648 602, 603, 611, 613, 615, 617, 618, 621, 625, 628,
649 631, 634, 638, 641, 643, 646, 648, 650, 651
John Bauman66b8ab22014-05-06 15:57:45 -0400650};
651
652/* YYRHS -- A `-1'-separated list of the rules' RHS. */
653static const yytype_int16 yyrhs[] =
654{
Alexis Hetub14178b2015-04-13 13:23:20 -0400655 212, 0, -1, 76, -1, 129, -1, 79, -1, 80,
656 -1, 78, -1, 81, -1, 104, 156, 105, -1, 130,
657 -1, 131, 106, 132, 107, -1, 133, -1, 131, 110,
658 82, -1, 131, 85, -1, 131, 86, -1, 156, -1,
659 134, -1, 135, -1, 131, 110, 135, -1, 137, 105,
660 -1, 136, 105, -1, 138, 55, -1, 138, -1, 138,
661 154, -1, 137, 111, 154, -1, 139, 104, -1, 179,
662 -1, 76, -1, 82, -1, 131, -1, 85, 140, -1,
663 86, 140, -1, 141, 140, -1, 118, -1, 116, -1,
664 115, -1, 140, -1, 142, 119, 140, -1, 142, 120,
665 140, -1, 142, -1, 143, 118, 142, -1, 143, 116,
666 142, -1, 143, -1, 144, -1, 145, 122, 144, -1,
667 145, 123, 144, -1, 145, 87, 144, -1, 145, 88,
668 144, -1, 145, -1, 146, 89, 145, -1, 146, 90,
669 145, -1, 146, -1, 147, -1, 148, -1, 149, -1,
670 150, 91, 149, -1, 150, -1, 151, 93, 150, -1,
671 151, -1, 152, 92, 151, -1, 152, -1, 152, 127,
672 156, 112, 154, -1, 153, -1, 140, 155, 154, -1,
673 113, -1, 94, -1, 95, -1, 96, -1, 103, -1,
674 154, -1, 156, 111, 154, -1, 153, -1, 159, 114,
675 -1, 167, 114, -1, 7, 174, 178, 114, -1, 160,
676 105, -1, 162, -1, 161, -1, 162, 164, -1, 161,
677 111, 164, -1, 169, 76, 104, -1, 173, 76, -1,
678 173, 76, 106, 157, 107, -1, 170, 165, 163, -1,
679 165, 163, -1, 170, 165, 166, -1, 165, 166, -1,
680 -1, 40, -1, 41, -1, 42, -1, 173, -1, 168,
681 -1, 167, 111, 76, -1, 167, 111, 76, 106, 107,
682 -1, 167, 111, 76, 106, 157, 107, -1, 167, 111,
683 76, 113, 187, -1, 169, -1, 169, 76, -1, 169,
684 76, 106, 107, -1, 169, 76, 106, 157, 107, -1,
685 169, 76, 113, 187, -1, 3, 76, -1, 173, -1,
686 171, 173, -1, 9, -1, 8, -1, 44, -1, 3,
687 44, -1, 172, -1, 175, -1, 175, 172, -1, 9,
688 -1, 40, -1, 41, -1, 51, 40, -1, 51, 41,
689 -1, 43, -1, 178, -1, 174, 178, -1, 4, -1,
690 5, -1, 6, -1, 75, 104, 176, 105, -1, 177,
691 -1, 176, 111, 177, -1, 76, -1, 76, 113, 79,
692 -1, 76, 113, 80, -1, 179, -1, 179, 106, 157,
693 107, -1, 55, -1, 11, -1, 12, -1, 13, -1,
Nicolas Capens7d626792015-02-17 17:58:31 -0500694 10, -1, 31, -1, 32, -1, 33, -1, 25, -1,
695 26, -1, 27, -1, 28, -1, 29, -1, 30, -1,
696 34, -1, 35, -1, 36, -1, 37, -1, 38, -1,
Alexis Hetub14178b2015-04-13 13:23:20 -0400697 39, -1, 45, -1, 46, -1, 47, -1, 48, -1,
698 49, -1, 50, -1, 57, -1, 58, -1, 59, -1,
699 70, -1, 61, -1, 62, -1, 63, -1, 64, -1,
700 65, -1, 66, -1, 67, -1, 68, -1, 69, -1,
701 72, -1, 73, -1, 74, -1, 180, -1, 77, -1,
702 -1, 54, 76, 108, 181, 183, 109, -1, -1, 54,
703 108, 182, 183, 109, -1, 184, -1, 183, 184, -1,
704 173, 185, 114, -1, 186, -1, 185, 111, 186, -1,
705 76, -1, 76, 106, 157, 107, -1, 154, -1, 158,
706 -1, 191, -1, 190, -1, 188, -1, 200, -1, 201,
707 -1, 204, -1, 211, -1, 108, 109, -1, -1, -1,
708 108, 192, 199, 193, 109, -1, 198, -1, 190, -1,
709 -1, 196, 198, -1, -1, 197, 190, -1, 108, 109,
710 -1, 108, 199, 109, -1, 189, -1, 199, 189, -1,
711 114, -1, 156, 114, -1, 19, 104, 156, 105, 202,
712 -1, 195, 17, 195, -1, 195, -1, 156, -1, 169,
713 76, 113, 187, -1, -1, 56, 104, 205, 203, 105,
714 194, -1, -1, 16, 206, 195, 56, 104, 156, 105,
715 114, -1, -1, 18, 104, 207, 208, 210, 105, 194,
716 -1, 200, -1, 188, -1, 203, -1, -1, 209, 114,
717 -1, 209, 114, 156, -1, 15, 114, -1, 14, 114,
718 -1, 21, 114, -1, 21, 156, 114, -1, 20, 114,
719 -1, 213, -1, 212, 213, -1, 214, -1, 158, -1,
720 -1, 159, 215, 198, -1
John Bauman66b8ab22014-05-06 15:57:45 -0400721};
722
723/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
724static const yytype_uint16 yyrline[] =
725{
Alexis Hetub14178b2015-04-13 13:23:20 -0400726 0, 190, 190, 225, 228, 233, 238, 243, 248, 254,
727 257, 336, 339, 440, 450, 463, 471, 571, 574, 582,
728 586, 593, 597, 604, 610, 619, 627, 696, 703, 713,
729 716, 726, 736, 757, 758, 759, 764, 765, 774, 786,
730 787, 795, 806, 810, 811, 821, 831, 841, 854, 855,
731 865, 878, 882, 886, 890, 891, 904, 905, 918, 919,
732 932, 933, 950, 951, 964, 965, 966, 967, 968, 972,
733 975, 986, 994, 1021, 1026, 1036, 1074, 1077, 1084, 1092,
734 1113, 1134, 1145, 1174, 1179, 1189, 1194, 1204, 1207, 1210,
735 1213, 1219, 1226, 1229, 1251, 1269, 1293, 1316, 1320, 1338,
736 1346, 1378, 1398, 1486, 1495, 1518, 1524, 1531, 1540, 1549,
737 1552, 1556, 1563, 1567, 1572, 1577, 1583, 1589, 1598, 1608,
738 1615, 1618, 1621, 1627, 1634, 1637, 1643, 1646, 1649, 1655,
739 1658, 1673, 1677, 1681, 1685, 1689, 1693, 1698, 1703, 1708,
740 1713, 1718, 1723, 1728, 1733, 1738, 1743, 1748, 1753, 1759,
741 1765, 1771, 1777, 1783, 1789, 1795, 1801, 1807, 1812, 1817,
742 1826, 1831, 1836, 1841, 1846, 1851, 1856, 1861, 1866, 1871,
743 1876, 1881, 1886, 1891, 1896, 1909, 1909, 1923, 1923, 1932,
744 1935, 1950, 1982, 1986, 1992, 2000, 2016, 2020, 2024, 2025,
745 2031, 2032, 2033, 2034, 2035, 2039, 2040, 2040, 2040, 2050,
746 2051, 2055, 2055, 2056, 2056, 2061, 2064, 2074, 2077, 2083,
747 2084, 2088, 2096, 2100, 2110, 2115, 2132, 2132, 2137, 2137,
748 2144, 2144, 2152, 2155, 2161, 2164, 2170, 2174, 2181, 2188,
749 2195, 2202, 2213, 2222, 2226, 2233, 2236, 2242, 2242
John Bauman66b8ab22014-05-06 15:57:45 -0400750};
751#endif
752
753#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
754/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
755 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
756static const char *const yytname[] =
757{
758 "$end", "error", "$undefined", "INVARIANT", "HIGH_PRECISION",
759 "MEDIUM_PRECISION", "LOW_PRECISION", "PRECISION", "ATTRIBUTE",
Nicolas Capens3c20f802015-02-17 17:17:20 -0500760 "CONST_QUAL", "BOOL_TYPE", "FLOAT_TYPE", "INT_TYPE", "UINT_TYPE",
761 "BREAK", "CONTINUE", "DO", "ELSE", "FOR", "IF", "DISCARD", "RETURN",
762 "SWITCH", "CASE", "DEFAULT", "BVEC2", "BVEC3", "BVEC4", "IVEC2", "IVEC3",
Nicolas Capense4b1b1d2015-02-17 17:26:01 -0500763 "IVEC4", "VEC2", "VEC3", "VEC4", "UVEC2", "UVEC3", "UVEC4", "MATRIX2",
764 "MATRIX3", "MATRIX4", "IN_QUAL", "OUT_QUAL", "INOUT_QUAL", "UNIFORM",
Alexis Hetub14178b2015-04-13 13:23:20 -0400765 "VARYING", "MATRIX2x3", "MATRIX3x2", "MATRIX2x4", "MATRIX4x2",
766 "MATRIX3x4", "MATRIX4x3", "CENTROID", "FLAT", "SMOOTH", "STRUCT",
767 "VOID_TYPE", "WHILE", "SAMPLER2D", "SAMPLERCUBE", "SAMPLER_EXTERNAL_OES",
768 "SAMPLER2DRECT", "SAMPLER2DARRAY", "ISAMPLER2D", "ISAMPLER3D",
769 "ISAMPLERCUBE", "ISAMPLER2DARRAY", "USAMPLER2D", "USAMPLER3D",
770 "USAMPLERCUBE", "USAMPLER2DARRAY", "SAMPLER3D", "SAMPLER3DRECT",
771 "SAMPLER2DSHADOW", "SAMPLERCUBESHADOW", "SAMPLER2DARRAYSHADOW", "LAYOUT",
772 "IDENTIFIER", "TYPE_NAME", "FLOATCONSTANT", "INTCONSTANT",
773 "UINTCONSTANT", "BOOLCONSTANT", "FIELD_SELECTION", "LEFT_OP", "RIGHT_OP",
774 "INC_OP", "DEC_OP", "LE_OP", "GE_OP", "EQ_OP", "NE_OP", "AND_OP",
775 "OR_OP", "XOR_OP", "MUL_ASSIGN", "DIV_ASSIGN", "ADD_ASSIGN",
776 "MOD_ASSIGN", "LEFT_ASSIGN", "RIGHT_ASSIGN", "AND_ASSIGN", "XOR_ASSIGN",
777 "OR_ASSIGN", "SUB_ASSIGN", "LEFT_PAREN", "RIGHT_PAREN", "LEFT_BRACKET",
Nicolas Capens2c1239f2015-02-17 17:30:04 -0500778 "RIGHT_BRACKET", "LEFT_BRACE", "RIGHT_BRACE", "DOT", "COMMA", "COLON",
779 "EQUAL", "SEMICOLON", "BANG", "DASH", "TILDE", "PLUS", "STAR", "SLASH",
780 "PERCENT", "LEFT_ANGLE", "RIGHT_ANGLE", "VERTICAL_BAR", "CARET",
781 "AMPERSAND", "QUESTION", "$accept", "variable_identifier",
782 "primary_expression", "postfix_expression", "integer_expression",
783 "function_call", "function_call_or_method", "function_call_generic",
John Bauman66b8ab22014-05-06 15:57:45 -0400784 "function_call_header_no_parameters",
785 "function_call_header_with_parameters", "function_call_header",
786 "function_identifier", "unary_expression", "unary_operator",
787 "multiplicative_expression", "additive_expression", "shift_expression",
788 "relational_expression", "equality_expression", "and_expression",
789 "exclusive_or_expression", "inclusive_or_expression",
790 "logical_and_expression", "logical_xor_expression",
791 "logical_or_expression", "conditional_expression",
792 "assignment_expression", "assignment_operator", "expression",
793 "constant_expression", "declaration", "function_prototype",
794 "function_declarator", "function_header_with_parameters",
795 "function_header", "parameter_declarator", "parameter_declaration",
796 "parameter_qualifier", "parameter_type_specifier",
797 "init_declarator_list", "single_declaration", "fully_specified_type",
Nicolas Capensa6a79ab2015-02-17 12:42:14 -0500798 "parameter_type_qualifier", "type_qualifier", "storage_qualifier",
Nicolas Capens7d626792015-02-17 17:58:31 -0500799 "type_specifier", "precision_qualifier", "layout_qualifier",
800 "layout_qualifier_id_list", "layout_qualifier_id",
801 "type_specifier_no_prec", "type_specifier_nonarray", "struct_specifier",
802 "$@1", "$@2", "struct_declaration_list", "struct_declaration",
John Bauman66b8ab22014-05-06 15:57:45 -0400803 "struct_declarator_list", "struct_declarator", "initializer",
804 "declaration_statement", "statement", "simple_statement",
805 "compound_statement", "$@3", "$@4", "statement_no_new_scope",
806 "statement_with_scope", "$@5", "$@6", "compound_statement_no_new_scope",
807 "statement_list", "expression_statement", "selection_statement",
808 "selection_rest_statement", "condition", "iteration_statement", "$@7",
809 "$@8", "$@9", "for_init_statement", "conditionopt", "for_rest_statement",
810 "jump_statement", "translation_unit", "external_declaration",
811 "function_definition", "$@10", 0
812};
813#endif
814
815# ifdef YYPRINT
816/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
817 token YYLEX-NUM. */
818static const yytype_uint16 yytoknum[] =
819{
820 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
821 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
822 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
823 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
824 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
825 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
826 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
827 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
828 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
Nicolas Capensc6841852015-02-15 14:25:37 -0500829 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
Nicolas Capens7d626792015-02-17 17:58:31 -0500830 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
Alexis Hetub14178b2015-04-13 13:23:20 -0400831 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
832 375, 376, 377, 378, 379, 380, 381, 382
John Bauman66b8ab22014-05-06 15:57:45 -0400833};
834# endif
835
836/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
837static const yytype_uint8 yyr1[] =
838{
Alexis Hetub14178b2015-04-13 13:23:20 -0400839 0, 128, 129, 130, 130, 130, 130, 130, 130, 131,
840 131, 131, 131, 131, 131, 132, 133, 134, 134, 135,
841 135, 136, 136, 137, 137, 138, 139, 139, 139, 140,
842 140, 140, 140, 141, 141, 141, 142, 142, 142, 143,
843 143, 143, 144, 145, 145, 145, 145, 145, 146, 146,
844 146, 147, 148, 149, 150, 150, 151, 151, 152, 152,
845 153, 153, 154, 154, 155, 155, 155, 155, 155, 156,
846 156, 157, 158, 158, 158, 159, 160, 160, 161, 161,
847 162, 163, 163, 164, 164, 164, 164, 165, 165, 165,
848 165, 166, 167, 167, 167, 167, 167, 168, 168, 168,
849 168, 168, 168, 169, 169, 170, 171, 171, 171, 171,
850 171, 171, 172, 172, 172, 172, 172, 172, 173, 173,
851 174, 174, 174, 175, 176, 176, 177, 177, 177, 178,
852 178, 179, 179, 179, 179, 179, 179, 179, 179, 179,
853 179, 179, 179, 179, 179, 179, 179, 179, 179, 179,
854 179, 179, 179, 179, 179, 179, 179, 179, 179, 179,
855 179, 179, 179, 179, 179, 179, 179, 179, 179, 179,
856 179, 179, 179, 179, 179, 181, 180, 182, 180, 183,
857 183, 184, 185, 185, 186, 186, 187, 188, 189, 189,
858 190, 190, 190, 190, 190, 191, 192, 193, 191, 194,
859 194, 196, 195, 197, 195, 198, 198, 199, 199, 200,
860 200, 201, 202, 202, 203, 203, 205, 204, 206, 204,
861 207, 204, 208, 208, 209, 209, 210, 210, 211, 211,
862 211, 211, 211, 212, 212, 213, 213, 215, 214
John Bauman66b8ab22014-05-06 15:57:45 -0400863};
864
865/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
866static const yytype_uint8 yyr2[] =
867{
Nicolas Capens2c1239f2015-02-17 17:30:04 -0500868 0, 2, 1, 1, 1, 1, 1, 1, 3, 1,
869 4, 1, 3, 2, 2, 1, 1, 1, 3, 2,
870 2, 2, 1, 2, 3, 2, 1, 1, 1, 1,
871 2, 2, 2, 1, 1, 1, 1, 3, 3, 1,
872 3, 3, 1, 1, 3, 3, 3, 3, 1, 3,
873 3, 1, 1, 1, 1, 3, 1, 3, 1, 3,
874 1, 5, 1, 3, 1, 1, 1, 1, 1, 1,
875 3, 1, 2, 2, 4, 2, 1, 1, 2, 3,
876 3, 2, 5, 3, 2, 3, 2, 0, 1, 1,
877 1, 1, 1, 3, 5, 6, 5, 1, 2, 4,
878 5, 4, 2, 1, 2, 1, 1, 1, 2, 1,
Nicolas Capens7d626792015-02-17 17:58:31 -0500879 1, 2, 1, 1, 1, 2, 2, 1, 1, 2,
880 1, 1, 1, 4, 1, 3, 1, 3, 3, 1,
881 4, 1, 1, 1, 1, 1, 1, 1, 1, 1,
John Bauman66b8ab22014-05-06 15:57:45 -0400882 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
Alexis Hetub14178b2015-04-13 13:23:20 -0400883 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
884 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
885 1, 1, 1, 1, 1, 0, 6, 0, 5, 1,
886 2, 3, 1, 3, 1, 4, 1, 1, 1, 1,
887 1, 1, 1, 1, 1, 2, 0, 0, 5, 1,
888 1, 0, 2, 0, 2, 2, 3, 1, 2, 1,
889 2, 5, 3, 1, 1, 4, 0, 6, 0, 8,
890 0, 7, 1, 1, 1, 0, 2, 3, 2, 2,
891 2, 3, 2, 1, 2, 1, 1, 0, 3
John Bauman66b8ab22014-05-06 15:57:45 -0400892};
893
894/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
895 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
896 means the default is an error. */
897static const yytype_uint8 yydefact[] =
898{
Nicolas Capens7d626792015-02-17 17:58:31 -0500899 0, 0, 120, 121, 122, 0, 106, 112, 135, 132,
900 133, 134, 139, 140, 141, 142, 143, 144, 136, 137,
901 138, 145, 146, 147, 148, 149, 150, 113, 114, 117,
Alexis Hetub14178b2015-04-13 13:23:20 -0400902 107, 151, 152, 153, 154, 155, 156, 0, 0, 131,
903 157, 158, 159, 161, 162, 163, 164, 165, 166, 167,
904 168, 169, 160, 170, 171, 172, 0, 174, 236, 237,
905 0, 77, 87, 0, 92, 97, 0, 109, 103, 0,
906 110, 118, 129, 173, 0, 233, 235, 108, 102, 0,
907 115, 116, 0, 177, 0, 72, 0, 75, 87, 105,
908 88, 89, 90, 78, 0, 87, 0, 73, 98, 104,
909 119, 111, 0, 1, 234, 0, 175, 0, 126, 0,
910 124, 0, 238, 79, 84, 86, 91, 0, 93, 80,
911 0, 0, 2, 6, 4, 5, 7, 28, 0, 0,
912 0, 35, 34, 33, 3, 9, 29, 11, 16, 17,
913 0, 0, 22, 0, 36, 0, 39, 42, 43, 48,
914 51, 52, 53, 54, 56, 58, 60, 71, 0, 26,
915 74, 0, 0, 0, 179, 0, 123, 0, 0, 0,
916 218, 0, 0, 0, 0, 0, 196, 205, 209, 36,
917 62, 69, 0, 187, 0, 129, 190, 207, 189, 188,
918 0, 191, 192, 193, 194, 81, 83, 85, 0, 0,
919 99, 0, 186, 101, 30, 31, 0, 13, 14, 0,
920 0, 20, 19, 0, 21, 23, 25, 32, 0, 0,
Nicolas Capens3c20f802015-02-17 17:17:20 -0500921 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Alexis Hetub14178b2015-04-13 13:23:20 -0400922 0, 0, 130, 0, 184, 0, 182, 178, 180, 127,
923 128, 125, 229, 228, 203, 220, 0, 232, 230, 0,
924 216, 195, 0, 65, 66, 67, 68, 64, 0, 0,
925 210, 206, 208, 0, 94, 0, 96, 100, 8, 0,
926 15, 27, 12, 18, 24, 37, 38, 41, 40, 46,
927 47, 44, 45, 49, 50, 55, 57, 59, 0, 176,
928 0, 0, 181, 0, 0, 0, 0, 0, 231, 0,
929 197, 63, 70, 0, 95, 10, 0, 0, 183, 0,
930 202, 204, 223, 222, 225, 203, 0, 214, 0, 0,
931 0, 82, 61, 185, 0, 224, 0, 0, 213, 211,
932 0, 0, 198, 0, 226, 0, 203, 0, 200, 217,
933 199, 0, 227, 221, 212, 215, 219
John Bauman66b8ab22014-05-06 15:57:45 -0400934};
935
936/* YYDEFGOTO[NTERM-NUM]. */
937static const yytype_int16 yydefgoto[] =
938{
Alexis Hetub14178b2015-04-13 13:23:20 -0400939 -1, 134, 135, 136, 269, 137, 138, 139, 140, 141,
940 142, 143, 179, 145, 146, 147, 148, 149, 150, 151,
941 152, 153, 154, 155, 156, 180, 181, 258, 182, 158,
942 183, 184, 60, 61, 62, 114, 93, 94, 115, 63,
943 64, 65, 95, 66, 67, 68, 69, 70, 109, 110,
944 71, 159, 73, 161, 107, 163, 164, 235, 236, 203,
945 186, 187, 188, 189, 252, 320, 339, 293, 294, 295,
946 340, 190, 191, 192, 329, 319, 193, 299, 244, 296,
947 314, 326, 327, 194, 74, 75, 76, 86
John Bauman66b8ab22014-05-06 15:57:45 -0400948};
949
950/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
951 STATE-NUM. */
Alexis Hetub14178b2015-04-13 13:23:20 -0400952#define YYPACT_NINF -298
John Bauman66b8ab22014-05-06 15:57:45 -0400953static const yytype_int16 yypact[] =
954{
Alexis Hetub14178b2015-04-13 13:23:20 -0400955 1733, -11, -298, -298, -298, 115, -298, -298, -298, -298,
956 -298, -298, -298, -298, -298, -298, -298, -298, -298, -298,
957 -298, -298, -298, -298, -298, -298, -298, -298, -298, -298,
958 -298, -298, -298, -298, -298, -298, -298, 109, -38, -298,
959 -298, -298, -298, -298, -298, -298, -298, -298, -298, -298,
960 -298, -298, -298, -298, -298, -298, -84, -298, -298, -86,
961 -63, -55, 4, -74, -298, 17, 1807, -298, -298, 1943,
962 7, -298, -30, -298, 1658, -298, -298, -298, -298, 1943,
963 -298, -298, 30, -298, 67, -298, 54, -298, 22, -298,
964 -298, -298, -298, -298, 1807, 105, 88, -298, -15, -298,
965 -298, -298, 1298, -298, -298, 57, -298, 1807, 55, -90,
966 -298, 333, -298, -298, -298, -298, 96, 1807, -72, -298,
967 212, 1298, 69, -298, -298, -298, -298, -298, 1298, 1298,
968 1298, -298, -298, -298, -298, -298, -18, -298, -298, -298,
969 72, -82, 1393, 70, -298, 1298, 32, 6, -298, -62,
970 64, -298, -298, -298, 87, 86, -78, -298, 73, -298,
971 -298, 1807, 106, 1488, -298, 76, -298, 67, 71, 75,
972 -298, 77, 79, 80, 1105, 82, 78, -298, -298, -23,
973 -298, -298, -57, -298, -86, -3, -298, -298, -298, -298,
974 449, -298, -298, -298, -298, 89, -298, -298, 1200, 1298,
975 -298, 91, -298, -298, -298, -298, -9, -298, -298, 1298,
976 1875, -298, -298, 1298, 92, -298, -298, -298, 1298, 1298,
977 1298, 1298, 1298, 1298, 1298, 1298, 1298, 1298, 1298, 1298,
978 1298, 1298, -298, 1573, 93, -36, -298, -298, -298, -298,
979 -298, -298, -298, -298, 85, -298, 1298, -298, -298, 28,
980 -298, -298, 565, -298, -298, -298, -298, -298, 1298, 1298,
981 -298, -298, -298, 1298, -298, 95, -298, -298, -298, 97,
982 94, -298, 99, -298, -298, -298, -298, 32, 32, -298,
983 -298, -298, -298, -62, -62, -298, 87, 86, 46, -298,
984 1298, 106, -298, 128, 54, 797, 913, -1, -298, 1010,
985 565, -298, -298, 100, -298, -298, 1298, 101, -298, 102,
986 -298, -298, -298, -298, 1010, 85, 156, 94, 134, 107,
987 104, -298, -298, -298, 1298, -298, 103, 110, 197, -298,
988 108, 681, -298, 1, 1298, 681, 85, 1298, -298, -298,
989 -298, 112, 94, -298, -298, -298, -298
John Bauman66b8ab22014-05-06 15:57:45 -0400990};
991
992/* YYPGOTO[NTERM-NUM]. */
993static const yytype_int16 yypgoto[] =
994{
Alexis Hetub14178b2015-04-13 13:23:20 -0400995 -298, -298, -298, -298, -298, -298, -298, 18, -298, -298,
996 -298, -298, -93, -298, -61, -298, -109, -60, -298, -298,
997 -298, -12, -2, -10, -298, -98, -118, -298, -123, -115,
998 10, 11, -298, -298, -298, 113, 130, 136, 117, -298,
999 -298, -282, -298, -298, 159, -64, 227, -298, -298, 68,
1000 8, 0, -298, -298, -298, 111, -151, -298, -37, -193,
1001 -43, -182, -276, -298, -298, -298, -99, -297, -298, -298,
1002 -85, 3, -40, -298, -298, -51, -298, -298, -298, -298,
1003 -298, -298, -298, -298, -298, 190, -298, -298
John Bauman66b8ab22014-05-06 15:57:45 -04001004};
1005
1006/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
1007 positive, shift that token. If negative, reduce the rule which
1008 number is the opposite. If zero, do what YYDEFACT says.
1009 If YYTABLE_NINF, syntax error. */
Alexis Hetub14178b2015-04-13 13:23:20 -04001010#define YYTABLE_NINF -202
John Bauman66b8ab22014-05-06 15:57:45 -04001011static const yytype_int16 yytable[] =
1012{
Alexis Hetub14178b2015-04-13 13:23:20 -04001013 72, 112, 99, 202, 157, 201, 266, 206, 262, 144,
1014 58, 59, 238, 89, 230, 166, 7, 318, 328, 311,
1015 84, 167, 157, 212, 215, 222, 223, 144, 85, 213,
1016 116, 89, 318, 77, 198, 204, 205, 96, 82, 344,
1017 97, 199, 87, 162, 90, 91, 92, 27, 28, 231,
1018 29, 249, 217, 116, 259, 338, 88, 260, 37, 338,
1019 224, 225, 90, 91, 92, 78, 72, 207, 208, 72,
1020 83, 253, 254, 255, 72, 291, 102, 100, 292, 72,
1021 256, 202, 238, 265, 58, 59, 270, 105, 209, 119,
1022 257, 120, 210, 98, 72, 274, 268, 162, 121, 162,
1023 157, -26, 259, 102, 315, 144, 341, 72, 288, -76,
1024 259, 185, 259, 279, 280, 281, 282, 72, 262, 2,
1025 3, 4, 220, 297, 221, 275, 276, 144, 144, 144,
1026 144, 144, 144, 144, 144, 144, 144, 144, 106, 259,
1027 301, 302, 298, 108, 345, 90, 91, 92, 303, 80,
1028 81, 218, 219, 226, 227, 239, 240, 259, 306, 277,
1029 278, 72, 111, 72, 118, 157, 283, 284, 165, 162,
1030 144, 160, 195, -27, 216, 307, 317, 211, 228, 229,
1031 232, 245, 234, 246, 309, 242, 250, 251, 322, 243,
1032 185, 317, 157, -201, 247, 263, -131, 144, 267, 290,
1033 77, 333, 304, -28, 305, 259, 324, 321, 323, 310,
1034 330, 342, 331, 332, 336, 335, 285, 334, 113, 202,
1035 287, 337, 8, 9, 10, 11, 346, 286, 273, 101,
1036 196, 117, 79, 72, 197, 241, 343, 12, 13, 14,
1037 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1038 25, 26, 185, 312, 308, 300, 313, 31, 32, 33,
1039 34, 35, 36, 325, 104, 0, 38, 39, 0, 40,
1040 41, 42, 233, 43, 44, 45, 46, 47, 48, 49,
1041 50, 51, 52, 0, 53, 54, 55, 0, 122, 57,
1042 123, 124, 125, 126, 127, 185, 185, 128, 129, 185,
1043 185, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1044 0, 0, 0, 0, 185, 0, 130, 0, 0, 200,
1045 0, 0, 0, 0, 0, 0, 0, 131, 132, 0,
1046 133, 185, 0, 0, 0, 185, 1, 2, 3, 4,
1047 5, 6, 7, 8, 9, 10, 11, 168, 169, 170,
1048 0, 171, 172, 173, 174, 0, 0, 0, 12, 13,
1049 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
1050 24, 25, 26, 27, 28, 0, 29, 30, 31, 32,
1051 33, 34, 35, 36, 37, 0, 0, 38, 39, 175,
1052 40, 41, 42, 0, 43, 44, 45, 46, 47, 48,
1053 49, 50, 51, 52, 0, 53, 54, 55, 56, 122,
1054 57, 123, 124, 125, 126, 127, 0, 0, 128, 129,
1055 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1056 0, 0, 0, 0, 0, 0, 0, 130, 0, 0,
1057 0, 176, 177, 0, 0, 0, 0, 178, 131, 132,
1058 0, 133, 1, 2, 3, 4, 5, 6, 7, 8,
1059 9, 10, 11, 168, 169, 170, 0, 171, 172, 173,
1060 174, 0, 0, 0, 12, 13, 14, 15, 16, 17,
1061 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
1062 28, 0, 29, 30, 31, 32, 33, 34, 35, 36,
1063 37, 0, 0, 38, 39, 175, 40, 41, 42, 0,
1064 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
1065 0, 53, 54, 55, 56, 122, 57, 123, 124, 125,
1066 126, 127, 0, 0, 128, 129, 0, 0, 0, 0,
1067 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1068 0, 0, 0, 130, 0, 0, 0, 176, 261, 0,
1069 0, 0, 0, 178, 131, 132, 0, 133, 1, 2,
1070 3, 4, 5, 6, 7, 8, 9, 10, 11, 168,
1071 169, 170, 0, 171, 172, 173, 174, 0, 0, 0,
Nicolas Capens7d626792015-02-17 17:58:31 -05001072 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
1073 22, 23, 24, 25, 26, 27, 28, 0, 29, 30,
Alexis Hetub14178b2015-04-13 13:23:20 -04001074 31, 32, 33, 34, 35, 36, 37, 0, 0, 38,
1075 39, 175, 40, 41, 42, 0, 43, 44, 45, 46,
1076 47, 48, 49, 50, 51, 52, 0, 53, 54, 55,
1077 56, 122, 57, 123, 124, 125, 126, 127, 0, 0,
1078 128, 129, 0, 0, 0, 0, 0, 0, 0, 0,
1079 0, 0, 0, 0, 0, 0, 0, 0, 0, 130,
1080 0, 0, 0, 176, 0, 0, 0, 0, 0, 178,
1081 131, 132, 0, 133, 1, 2, 3, 4, 5, 6,
1082 7, 8, 9, 10, 11, 168, 169, 170, 0, 171,
1083 172, 173, 174, 0, 0, 0, 12, 13, 14, 15,
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05001084 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
Alexis Hetub14178b2015-04-13 13:23:20 -04001085 26, 27, 28, 0, 29, 30, 31, 32, 33, 34,
1086 35, 36, 37, 0, 0, 38, 39, 175, 40, 41,
1087 42, 0, 43, 44, 45, 46, 47, 48, 49, 50,
1088 51, 52, 0, 53, 54, 55, 56, 122, 57, 123,
1089 124, 125, 126, 127, 0, 0, 128, 129, 0, 0,
Nicolas Capens2c1239f2015-02-17 17:30:04 -05001090 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Alexis Hetub14178b2015-04-13 13:23:20 -04001091 0, 0, 0, 0, 0, 130, 0, 0, 0, 111,
1092 0, 0, 0, 0, 0, 178, 131, 132, 0, 133,
1093 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
1094 11, 168, 169, 170, 0, 171, 172, 173, 174, 0,
Nicolas Capens7d626792015-02-17 17:58:31 -05001095 0, 0, 12, 13, 14, 15, 16, 17, 18, 19,
Alexis Hetub14178b2015-04-13 13:23:20 -04001096 20, 21, 22, 23, 24, 25, 26, 27, 28, 0,
1097 29, 30, 31, 32, 33, 34, 35, 36, 37, 0,
1098 0, 38, 39, 175, 40, 41, 42, 0, 43, 44,
1099 45, 46, 47, 48, 49, 50, 51, 52, 0, 53,
1100 54, 55, 56, 122, 57, 123, 124, 125, 126, 127,
1101 0, 0, 128, 129, 0, 0, 0, 0, 0, 0,
Nicolas Capens7d626792015-02-17 17:58:31 -05001102 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Alexis Hetub14178b2015-04-13 13:23:20 -04001103 0, 130, 0, 0, 0, 0, 0, 0, 0, 0,
1104 0, 178, 131, 132, 0, 133, 1, 2, 3, 4,
1105 5, 6, 7, 8, 9, 10, 11, 0, 0, 0,
1106 0, 0, 0, 0, 0, 0, 0, 0, 12, 13,
1107 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
1108 24, 25, 26, 27, 28, 0, 29, 30, 31, 32,
1109 33, 34, 35, 36, 37, 0, 0, 38, 39, 0,
1110 40, 41, 42, 0, 43, 44, 45, 46, 47, 48,
1111 49, 50, 51, 52, 0, 53, 54, 55, 56, 122,
1112 57, 123, 124, 125, 126, 127, 0, 0, 128, 129,
1113 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1114 0, 0, 0, 316, 2, 3, 4, 130, 6, 7,
1115 8, 9, 10, 11, 0, 0, 0, 178, 131, 132,
1116 0, 133, 0, 0, 0, 12, 13, 14, 15, 16,
1117 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
1118 27, 28, 0, 29, 30, 31, 32, 33, 34, 35,
1119 36, 37, 0, 0, 38, 39, 0, 40, 41, 42,
1120 0, 43, 44, 45, 46, 47, 48, 49, 50, 51,
1121 52, 0, 53, 54, 55, 56, 122, 57, 123, 124,
1122 125, 126, 127, 0, 0, 128, 129, 0, 0, 0,
1123 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1124 0, 0, 0, 0, 130, 8, 9, 10, 11, 0,
1125 0, 0, 0, 0, 0, 131, 132, 0, 133, 0,
Nicolas Capens7d626792015-02-17 17:58:31 -05001126 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
1127 22, 23, 24, 25, 26, 0, 0, 0, 0, 0,
Alexis Hetub14178b2015-04-13 13:23:20 -04001128 31, 32, 33, 34, 35, 36, 0, 0, 0, 38,
1129 39, 0, 40, 41, 42, 0, 43, 44, 45, 46,
1130 47, 48, 49, 50, 51, 52, 0, 53, 54, 55,
1131 0, 122, 57, 123, 124, 125, 126, 127, 0, 0,
1132 128, 129, 0, 0, 0, 0, 0, 0, 0, 0,
1133 0, 0, 0, 0, 0, 0, 0, 0, 0, 130,
1134 8, 9, 10, 11, 0, 0, 0, 0, 0, 248,
1135 131, 132, 0, 133, 0, 12, 13, 14, 15, 16,
1136 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
1137 0, 0, 0, 0, 0, 31, 32, 33, 34, 35,
1138 36, 0, 0, 0, 38, 39, 0, 40, 41, 42,
1139 0, 43, 44, 45, 46, 47, 48, 49, 50, 51,
1140 52, 0, 53, 54, 55, 0, 122, 57, 123, 124,
1141 125, 126, 127, 0, 0, 128, 129, 0, 0, 0,
Nicolas Capens7d626792015-02-17 17:58:31 -05001142 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Alexis Hetub14178b2015-04-13 13:23:20 -04001143 0, 0, 0, 0, 130, 0, 0, 264, 8, 9,
1144 10, 11, 0, 0, 0, 131, 132, 0, 133, 0,
Nicolas Capens2c1239f2015-02-17 17:30:04 -05001145 0, 0, 0, 12, 13, 14, 15, 16, 17, 18,
1146 19, 20, 21, 22, 23, 24, 25, 26, 0, 0,
Alexis Hetub14178b2015-04-13 13:23:20 -04001147 0, 0, 0, 31, 32, 33, 34, 35, 36, 0,
1148 0, 0, 38, 39, 0, 40, 41, 42, 0, 43,
1149 44, 45, 46, 47, 48, 49, 50, 51, 52, 0,
1150 53, 54, 55, 0, 122, 57, 123, 124, 125, 126,
1151 127, 0, 0, 128, 129, 0, 0, 0, 0, 0,
1152 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1153 0, 0, 130, 8, 9, 10, 11, 0, 0, 0,
1154 0, 0, 0, 131, 132, 0, 133, 0, 12, 13,
1155 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
1156 24, 25, 26, 0, 0, 0, 0, 0, 31, 32,
1157 33, 34, 35, 36, 0, 0, 0, 38, 214, 0,
1158 40, 41, 42, 0, 43, 44, 45, 46, 47, 48,
1159 49, 50, 51, 52, 0, 53, 54, 55, 0, 122,
1160 57, 123, 124, 125, 126, 127, 0, 0, 128, 129,
1161 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1162 0, 0, 2, 3, 4, 0, 0, 130, 8, 9,
1163 10, 11, 0, 0, 0, 0, 0, 0, 131, 132,
1164 0, 133, 0, 12, 13, 14, 15, 16, 17, 18,
1165 19, 20, 21, 22, 23, 24, 25, 26, 0, 0,
1166 0, 0, 0, 31, 32, 33, 34, 35, 36, 0,
1167 0, 0, 38, 39, 0, 40, 41, 42, 0, 43,
1168 44, 45, 46, 47, 48, 49, 50, 51, 52, 0,
1169 53, 54, 55, 0, 0, 57, 0, 0, 0, 0,
1170 0, 0, 0, 0, 0, 0, 0, 2, 3, 4,
1171 0, 0, 0, 8, 9, 10, 11, 0, 0, 0,
1172 0, 0, 0, 0, 0, 0, 0, 237, 12, 13,
1173 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
1174 24, 25, 26, 0, 0, 0, 0, 0, 31, 32,
1175 33, 34, 35, 36, 0, 0, 0, 38, 39, 0,
1176 40, 41, 42, 0, 43, 44, 45, 46, 47, 48,
1177 49, 50, 51, 52, 0, 53, 54, 55, 0, 0,
1178 57, 0, 0, 0, 0, 0, 0, 0, 103, 0,
1179 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
1180 10, 11, 0, 0, 0, 0, 0, 0, 0, 0,
1181 0, 0, 289, 12, 13, 14, 15, 16, 17, 18,
1182 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
1183 0, 29, 30, 31, 32, 33, 34, 35, 36, 37,
1184 0, 0, 38, 39, 0, 40, 41, 42, 0, 43,
1185 44, 45, 46, 47, 48, 49, 50, 51, 52, 0,
1186 53, 54, 55, 56, 0, 57, 1, 2, 3, 4,
1187 5, 6, 7, 8, 9, 10, 11, 0, 0, 0,
1188 0, 0, 0, 0, 0, 0, 0, 0, 12, 13,
1189 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
1190 24, 25, 26, 27, 28, 0, 29, 30, 31, 32,
1191 33, 34, 35, 36, 37, 0, 0, 38, 39, 0,
1192 40, 41, 42, 0, 43, 44, 45, 46, 47, 48,
1193 49, 50, 51, 52, 0, 53, 54, 55, 56, 0,
1194 57, 2, 3, 4, 0, 0, 0, 8, 9, 10,
1195 11, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1196 0, 0, 12, 13, 14, 15, 16, 17, 18, 19,
1197 20, 21, 22, 23, 24, 25, 26, 0, 0, 0,
1198 0, 0, 31, 32, 33, 34, 35, 36, 0, 0,
1199 0, 38, 39, 0, 40, 41, 42, 0, 43, 44,
1200 45, 46, 47, 48, 49, 50, 51, 52, 0, 53,
1201 54, 55, 0, 0, 57, 8, 9, 10, 11, 0,
Nicolas Capens2c1239f2015-02-17 17:30:04 -05001202 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1203 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
1204 22, 23, 24, 25, 26, 0, 0, 0, 0, 0,
Alexis Hetub14178b2015-04-13 13:23:20 -04001205 31, 32, 33, 34, 35, 36, 0, 0, 0, 38,
1206 39, 0, 40, 41, 42, 0, 43, 44, 45, 46,
1207 47, 48, 49, 50, 51, 52, 0, 53, 54, 55,
1208 0, 271, 57, 8, 9, 10, 11, 272, 0, 0,
1209 0, 0, 0, 0, 0, 0, 0, 0, 12, 13,
1210 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
1211 24, 25, 26, 0, 0, 0, 0, 0, 31, 32,
1212 33, 34, 35, 36, 0, 0, 0, 38, 39, 0,
1213 40, 41, 42, 0, 43, 44, 45, 46, 47, 48,
1214 49, 50, 51, 52, 0, 53, 54, 55, 0, 0,
1215 57
John Bauman66b8ab22014-05-06 15:57:45 -04001216};
1217
1218static const yytype_int16 yycheck[] =
1219{
Alexis Hetub14178b2015-04-13 13:23:20 -04001220 0, 86, 66, 121, 102, 120, 199, 130, 190, 102,
1221 0, 0, 163, 9, 92, 105, 9, 299, 315, 295,
1222 104, 111, 120, 105, 142, 87, 88, 120, 114, 111,
1223 94, 9, 314, 44, 106, 128, 129, 111, 76, 336,
1224 114, 113, 105, 107, 40, 41, 42, 40, 41, 127,
1225 43, 174, 145, 117, 111, 331, 111, 114, 51, 335,
1226 122, 123, 40, 41, 42, 76, 66, 85, 86, 69,
1227 108, 94, 95, 96, 74, 111, 106, 69, 114, 79,
1228 103, 199, 233, 198, 74, 74, 209, 79, 106, 104,
1229 113, 106, 110, 76, 94, 213, 105, 161, 113, 163,
1230 198, 104, 111, 106, 105, 198, 105, 107, 231, 105,
1231 111, 111, 111, 222, 223, 224, 225, 117, 300, 4,
1232 5, 6, 116, 246, 118, 218, 219, 220, 221, 222,
1233 223, 224, 225, 226, 227, 228, 229, 230, 108, 111,
1234 258, 259, 114, 76, 337, 40, 41, 42, 263, 40,
1235 41, 119, 120, 89, 90, 79, 80, 111, 112, 220,
1236 221, 161, 108, 163, 76, 263, 226, 227, 113, 233,
1237 263, 114, 76, 104, 104, 290, 299, 105, 91, 93,
1238 107, 104, 76, 104, 56, 114, 104, 109, 306, 114,
1239 190, 314, 290, 108, 114, 106, 104, 290, 107, 106,
1240 44, 324, 107, 104, 107, 111, 104, 107, 107, 294,
1241 76, 334, 105, 109, 17, 105, 228, 114, 88, 337,
1242 230, 113, 10, 11, 12, 13, 114, 229, 210, 70,
1243 117, 95, 5, 233, 117, 167, 335, 25, 26, 27,
1244 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
1245 38, 39, 252, 296, 291, 252, 296, 45, 46, 47,
1246 48, 49, 50, 314, 74, -1, 54, 55, -1, 57,
1247 58, 59, 161, 61, 62, 63, 64, 65, 66, 67,
1248 68, 69, 70, -1, 72, 73, 74, -1, 76, 77,
1249 78, 79, 80, 81, 82, 295, 296, 85, 86, 299,
1250 300, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1251 -1, -1, -1, -1, 314, -1, 104, -1, -1, 107,
1252 -1, -1, -1, -1, -1, -1, -1, 115, 116, -1,
1253 118, 331, -1, -1, -1, 335, 3, 4, 5, 6,
1254 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
1255 -1, 18, 19, 20, 21, -1, -1, -1, 25, 26,
1256 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
1257 37, 38, 39, 40, 41, -1, 43, 44, 45, 46,
1258 47, 48, 49, 50, 51, -1, -1, 54, 55, 56,
1259 57, 58, 59, -1, 61, 62, 63, 64, 65, 66,
1260 67, 68, 69, 70, -1, 72, 73, 74, 75, 76,
1261 77, 78, 79, 80, 81, 82, -1, -1, 85, 86,
1262 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1263 -1, -1, -1, -1, -1, -1, -1, 104, -1, -1,
1264 -1, 108, 109, -1, -1, -1, -1, 114, 115, 116,
1265 -1, 118, 3, 4, 5, 6, 7, 8, 9, 10,
1266 11, 12, 13, 14, 15, 16, -1, 18, 19, 20,
1267 21, -1, -1, -1, 25, 26, 27, 28, 29, 30,
1268 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
1269 41, -1, 43, 44, 45, 46, 47, 48, 49, 50,
1270 51, -1, -1, 54, 55, 56, 57, 58, 59, -1,
1271 61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
1272 -1, 72, 73, 74, 75, 76, 77, 78, 79, 80,
1273 81, 82, -1, -1, 85, 86, -1, -1, -1, -1,
1274 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1275 -1, -1, -1, 104, -1, -1, -1, 108, 109, -1,
1276 -1, -1, -1, 114, 115, 116, -1, 118, 3, 4,
Nicolas Capens7d626792015-02-17 17:58:31 -05001277 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1278 15, 16, -1, 18, 19, 20, 21, -1, -1, -1,
1279 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1280 35, 36, 37, 38, 39, 40, 41, -1, 43, 44,
Alexis Hetub14178b2015-04-13 13:23:20 -04001281 45, 46, 47, 48, 49, 50, 51, -1, -1, 54,
1282 55, 56, 57, 58, 59, -1, 61, 62, 63, 64,
1283 65, 66, 67, 68, 69, 70, -1, 72, 73, 74,
1284 75, 76, 77, 78, 79, 80, 81, 82, -1, -1,
1285 85, 86, -1, -1, -1, -1, -1, -1, -1, -1,
1286 -1, -1, -1, -1, -1, -1, -1, -1, -1, 104,
1287 -1, -1, -1, 108, -1, -1, -1, -1, -1, 114,
1288 115, 116, -1, 118, 3, 4, 5, 6, 7, 8,
Nicolas Capens7d626792015-02-17 17:58:31 -05001289 9, 10, 11, 12, 13, 14, 15, 16, -1, 18,
1290 19, 20, 21, -1, -1, -1, 25, 26, 27, 28,
1291 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
Alexis Hetub14178b2015-04-13 13:23:20 -04001292 39, 40, 41, -1, 43, 44, 45, 46, 47, 48,
1293 49, 50, 51, -1, -1, 54, 55, 56, 57, 58,
1294 59, -1, 61, 62, 63, 64, 65, 66, 67, 68,
1295 69, 70, -1, 72, 73, 74, 75, 76, 77, 78,
1296 79, 80, 81, 82, -1, -1, 85, 86, -1, -1,
Nicolas Capens7d626792015-02-17 17:58:31 -05001297 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Alexis Hetub14178b2015-04-13 13:23:20 -04001298 -1, -1, -1, -1, -1, 104, -1, -1, -1, 108,
1299 -1, -1, -1, -1, -1, 114, 115, 116, -1, 118,
1300 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
1301 13, 14, 15, 16, -1, 18, 19, 20, 21, -1,
Nicolas Capens7d626792015-02-17 17:58:31 -05001302 -1, -1, 25, 26, 27, 28, 29, 30, 31, 32,
Alexis Hetub14178b2015-04-13 13:23:20 -04001303 33, 34, 35, 36, 37, 38, 39, 40, 41, -1,
1304 43, 44, 45, 46, 47, 48, 49, 50, 51, -1,
1305 -1, 54, 55, 56, 57, 58, 59, -1, 61, 62,
1306 63, 64, 65, 66, 67, 68, 69, 70, -1, 72,
1307 73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
1308 -1, -1, 85, 86, -1, -1, -1, -1, -1, -1,
Nicolas Capens7d626792015-02-17 17:58:31 -05001309 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Alexis Hetub14178b2015-04-13 13:23:20 -04001310 -1, 104, -1, -1, -1, -1, -1, -1, -1, -1,
1311 -1, 114, 115, 116, -1, 118, 3, 4, 5, 6,
1312 7, 8, 9, 10, 11, 12, 13, -1, -1, -1,
1313 -1, -1, -1, -1, -1, -1, -1, -1, 25, 26,
1314 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
1315 37, 38, 39, 40, 41, -1, 43, 44, 45, 46,
1316 47, 48, 49, 50, 51, -1, -1, 54, 55, -1,
1317 57, 58, 59, -1, 61, 62, 63, 64, 65, 66,
1318 67, 68, 69, 70, -1, 72, 73, 74, 75, 76,
1319 77, 78, 79, 80, 81, 82, -1, -1, 85, 86,
1320 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1321 -1, -1, -1, 3, 4, 5, 6, 104, 8, 9,
1322 10, 11, 12, 13, -1, -1, -1, 114, 115, 116,
1323 -1, 118, -1, -1, -1, 25, 26, 27, 28, 29,
1324 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
1325 40, 41, -1, 43, 44, 45, 46, 47, 48, 49,
1326 50, 51, -1, -1, 54, 55, -1, 57, 58, 59,
1327 -1, 61, 62, 63, 64, 65, 66, 67, 68, 69,
1328 70, -1, 72, 73, 74, 75, 76, 77, 78, 79,
1329 80, 81, 82, -1, -1, 85, 86, -1, -1, -1,
1330 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1331 -1, -1, -1, -1, 104, 10, 11, 12, 13, -1,
1332 -1, -1, -1, -1, -1, 115, 116, -1, 118, -1,
Nicolas Capens7d626792015-02-17 17:58:31 -05001333 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1334 35, 36, 37, 38, 39, -1, -1, -1, -1, -1,
Alexis Hetub14178b2015-04-13 13:23:20 -04001335 45, 46, 47, 48, 49, 50, -1, -1, -1, 54,
1336 55, -1, 57, 58, 59, -1, 61, 62, 63, 64,
1337 65, 66, 67, 68, 69, 70, -1, 72, 73, 74,
1338 -1, 76, 77, 78, 79, 80, 81, 82, -1, -1,
1339 85, 86, -1, -1, -1, -1, -1, -1, -1, -1,
1340 -1, -1, -1, -1, -1, -1, -1, -1, -1, 104,
1341 10, 11, 12, 13, -1, -1, -1, -1, -1, 114,
1342 115, 116, -1, 118, -1, 25, 26, 27, 28, 29,
1343 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
1344 -1, -1, -1, -1, -1, 45, 46, 47, 48, 49,
1345 50, -1, -1, -1, 54, 55, -1, 57, 58, 59,
1346 -1, 61, 62, 63, 64, 65, 66, 67, 68, 69,
1347 70, -1, 72, 73, 74, -1, 76, 77, 78, 79,
1348 80, 81, 82, -1, -1, 85, 86, -1, -1, -1,
Nicolas Capens7d626792015-02-17 17:58:31 -05001349 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Alexis Hetub14178b2015-04-13 13:23:20 -04001350 -1, -1, -1, -1, 104, -1, -1, 107, 10, 11,
1351 12, 13, -1, -1, -1, 115, 116, -1, 118, -1,
Nicolas Capens2c1239f2015-02-17 17:30:04 -05001352 -1, -1, -1, 25, 26, 27, 28, 29, 30, 31,
1353 32, 33, 34, 35, 36, 37, 38, 39, -1, -1,
Alexis Hetub14178b2015-04-13 13:23:20 -04001354 -1, -1, -1, 45, 46, 47, 48, 49, 50, -1,
1355 -1, -1, 54, 55, -1, 57, 58, 59, -1, 61,
1356 62, 63, 64, 65, 66, 67, 68, 69, 70, -1,
1357 72, 73, 74, -1, 76, 77, 78, 79, 80, 81,
1358 82, -1, -1, 85, 86, -1, -1, -1, -1, -1,
1359 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1360 -1, -1, 104, 10, 11, 12, 13, -1, -1, -1,
1361 -1, -1, -1, 115, 116, -1, 118, -1, 25, 26,
1362 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
1363 37, 38, 39, -1, -1, -1, -1, -1, 45, 46,
1364 47, 48, 49, 50, -1, -1, -1, 54, 55, -1,
1365 57, 58, 59, -1, 61, 62, 63, 64, 65, 66,
1366 67, 68, 69, 70, -1, 72, 73, 74, -1, 76,
1367 77, 78, 79, 80, 81, 82, -1, -1, 85, 86,
1368 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1369 -1, -1, 4, 5, 6, -1, -1, 104, 10, 11,
1370 12, 13, -1, -1, -1, -1, -1, -1, 115, 116,
1371 -1, 118, -1, 25, 26, 27, 28, 29, 30, 31,
1372 32, 33, 34, 35, 36, 37, 38, 39, -1, -1,
1373 -1, -1, -1, 45, 46, 47, 48, 49, 50, -1,
1374 -1, -1, 54, 55, -1, 57, 58, 59, -1, 61,
1375 62, 63, 64, 65, 66, 67, 68, 69, 70, -1,
1376 72, 73, 74, -1, -1, 77, -1, -1, -1, -1,
1377 -1, -1, -1, -1, -1, -1, -1, 4, 5, 6,
1378 -1, -1, -1, 10, 11, 12, 13, -1, -1, -1,
1379 -1, -1, -1, -1, -1, -1, -1, 109, 25, 26,
1380 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
1381 37, 38, 39, -1, -1, -1, -1, -1, 45, 46,
1382 47, 48, 49, 50, -1, -1, -1, 54, 55, -1,
1383 57, 58, 59, -1, 61, 62, 63, 64, 65, 66,
1384 67, 68, 69, 70, -1, 72, 73, 74, -1, -1,
1385 77, -1, -1, -1, -1, -1, -1, -1, 0, -1,
1386 -1, 3, 4, 5, 6, 7, 8, 9, 10, 11,
1387 12, 13, -1, -1, -1, -1, -1, -1, -1, -1,
1388 -1, -1, 109, 25, 26, 27, 28, 29, 30, 31,
1389 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
1390 -1, 43, 44, 45, 46, 47, 48, 49, 50, 51,
1391 -1, -1, 54, 55, -1, 57, 58, 59, -1, 61,
1392 62, 63, 64, 65, 66, 67, 68, 69, 70, -1,
1393 72, 73, 74, 75, -1, 77, 3, 4, 5, 6,
1394 7, 8, 9, 10, 11, 12, 13, -1, -1, -1,
1395 -1, -1, -1, -1, -1, -1, -1, -1, 25, 26,
1396 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
1397 37, 38, 39, 40, 41, -1, 43, 44, 45, 46,
1398 47, 48, 49, 50, 51, -1, -1, 54, 55, -1,
1399 57, 58, 59, -1, 61, 62, 63, 64, 65, 66,
1400 67, 68, 69, 70, -1, 72, 73, 74, 75, -1,
1401 77, 4, 5, 6, -1, -1, -1, 10, 11, 12,
1402 13, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1403 -1, -1, 25, 26, 27, 28, 29, 30, 31, 32,
1404 33, 34, 35, 36, 37, 38, 39, -1, -1, -1,
1405 -1, -1, 45, 46, 47, 48, 49, 50, -1, -1,
1406 -1, 54, 55, -1, 57, 58, 59, -1, 61, 62,
1407 63, 64, 65, 66, 67, 68, 69, 70, -1, 72,
1408 73, 74, -1, -1, 77, 10, 11, 12, 13, -1,
Nicolas Capens2c1239f2015-02-17 17:30:04 -05001409 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1410 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1411 35, 36, 37, 38, 39, -1, -1, -1, -1, -1,
Alexis Hetub14178b2015-04-13 13:23:20 -04001412 45, 46, 47, 48, 49, 50, -1, -1, -1, 54,
1413 55, -1, 57, 58, 59, -1, 61, 62, 63, 64,
1414 65, 66, 67, 68, 69, 70, -1, 72, 73, 74,
1415 -1, 76, 77, 10, 11, 12, 13, 82, -1, -1,
1416 -1, -1, -1, -1, -1, -1, -1, -1, 25, 26,
1417 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
1418 37, 38, 39, -1, -1, -1, -1, -1, 45, 46,
1419 47, 48, 49, 50, -1, -1, -1, 54, 55, -1,
1420 57, 58, 59, -1, 61, 62, 63, 64, 65, 66,
1421 67, 68, 69, 70, -1, 72, 73, 74, -1, -1,
1422 77
John Bauman66b8ab22014-05-06 15:57:45 -04001423};
1424
1425/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
1426 symbol of state STATE-NUM. */
1427static const yytype_uint8 yystos[] =
1428{
1429 0, 3, 4, 5, 6, 7, 8, 9, 10, 11,
Nicolas Capens3c20f802015-02-17 17:17:20 -05001430 12, 13, 25, 26, 27, 28, 29, 30, 31, 32,
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05001431 33, 34, 35, 36, 37, 38, 39, 40, 41, 43,
Alexis Hetub14178b2015-04-13 13:23:20 -04001432 44, 45, 46, 47, 48, 49, 50, 51, 54, 55,
1433 57, 58, 59, 61, 62, 63, 64, 65, 66, 67,
1434 68, 69, 70, 72, 73, 74, 75, 77, 158, 159,
1435 160, 161, 162, 167, 168, 169, 171, 172, 173, 174,
1436 175, 178, 179, 180, 212, 213, 214, 44, 76, 174,
1437 40, 41, 76, 108, 104, 114, 215, 105, 111, 9,
1438 40, 41, 42, 164, 165, 170, 111, 114, 76, 173,
1439 178, 172, 106, 0, 213, 178, 108, 182, 76, 176,
1440 177, 108, 198, 164, 163, 166, 173, 165, 76, 104,
1441 106, 113, 76, 78, 79, 80, 81, 82, 85, 86,
1442 104, 115, 116, 118, 129, 130, 131, 133, 134, 135,
1443 136, 137, 138, 139, 140, 141, 142, 143, 144, 145,
1444 146, 147, 148, 149, 150, 151, 152, 153, 157, 179,
1445 114, 181, 173, 183, 184, 113, 105, 111, 14, 15,
1446 16, 18, 19, 20, 21, 56, 108, 109, 114, 140,
1447 153, 154, 156, 158, 159, 179, 188, 189, 190, 191,
1448 199, 200, 201, 204, 211, 76, 163, 166, 106, 113,
1449 107, 157, 154, 187, 140, 140, 156, 85, 86, 106,
1450 110, 105, 105, 111, 55, 154, 104, 140, 119, 120,
1451 116, 118, 87, 88, 122, 123, 89, 90, 91, 93,
1452 92, 127, 107, 183, 76, 185, 186, 109, 184, 79,
1453 80, 177, 114, 114, 206, 104, 104, 114, 114, 156,
1454 104, 109, 192, 94, 95, 96, 103, 113, 155, 111,
1455 114, 109, 189, 106, 107, 157, 187, 107, 105, 132,
1456 156, 76, 82, 135, 154, 140, 140, 142, 142, 144,
1457 144, 144, 144, 145, 145, 149, 150, 151, 156, 109,
1458 106, 111, 114, 195, 196, 197, 207, 156, 114, 205,
1459 199, 154, 154, 157, 107, 107, 112, 157, 186, 56,
1460 198, 190, 188, 200, 208, 105, 3, 156, 169, 203,
1461 193, 107, 154, 107, 104, 203, 209, 210, 195, 202,
1462 76, 105, 109, 156, 114, 105, 17, 113, 190, 194,
1463 198, 105, 156, 194, 195, 187, 114
John Bauman66b8ab22014-05-06 15:57:45 -04001464};
1465
1466#define yyerrok (yyerrstatus = 0)
1467#define yyclearin (yychar = YYEMPTY)
1468#define YYEMPTY (-2)
1469#define YYEOF 0
1470
1471#define YYACCEPT goto yyacceptlab
1472#define YYABORT goto yyabortlab
1473#define YYERROR goto yyerrorlab
1474
1475
1476/* Like YYERROR except do call yyerror. This remains here temporarily
1477 to ease the transition to the new meaning of YYERROR, for GCC.
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04001478 Once GCC version 2 has supplanted version 1, this can go. */
John Bauman66b8ab22014-05-06 15:57:45 -04001479
1480#define YYFAIL goto yyerrlab
John Bauman66b8ab22014-05-06 15:57:45 -04001481
1482#define YYRECOVERING() (!!yyerrstatus)
1483
1484#define YYBACKUP(Token, Value) \
1485do \
1486 if (yychar == YYEMPTY && yylen == 1) \
1487 { \
1488 yychar = (Token); \
1489 yylval = (Value); \
1490 yytoken = YYTRANSLATE (yychar); \
1491 YYPOPSTACK (1); \
1492 goto yybackup; \
1493 } \
1494 else \
1495 { \
1496 yyerror (context, YY_("syntax error: cannot back up")); \
1497 YYERROR; \
1498 } \
1499while (YYID (0))
1500
1501
1502#define YYTERROR 1
1503#define YYERRCODE 256
1504
1505
1506/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
1507 If N is 0, then set CURRENT to the empty location which ends
1508 the previous symbol: RHS[0] (always defined). */
1509
1510#define YYRHSLOC(Rhs, K) ((Rhs)[K])
1511#ifndef YYLLOC_DEFAULT
1512# define YYLLOC_DEFAULT(Current, Rhs, N) \
1513 do \
1514 if (YYID (N)) \
1515 { \
1516 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
1517 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
1518 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
1519 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
1520 } \
1521 else \
1522 { \
1523 (Current).first_line = (Current).last_line = \
1524 YYRHSLOC (Rhs, 0).last_line; \
1525 (Current).first_column = (Current).last_column = \
1526 YYRHSLOC (Rhs, 0).last_column; \
1527 } \
1528 while (YYID (0))
1529#endif
1530
1531
1532/* YY_LOCATION_PRINT -- Print the location on the stream.
1533 This macro was not mandated originally: define only if we know
1534 we won't break user code: when these are the locations we know. */
1535
1536#ifndef YY_LOCATION_PRINT
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04001537# if YYLTYPE_IS_TRIVIAL
John Bauman66b8ab22014-05-06 15:57:45 -04001538# define YY_LOCATION_PRINT(File, Loc) \
1539 fprintf (File, "%d.%d-%d.%d", \
1540 (Loc).first_line, (Loc).first_column, \
1541 (Loc).last_line, (Loc).last_column)
1542# else
1543# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1544# endif
1545#endif
1546
1547
1548/* YYLEX -- calling `yylex' with the right arguments. */
1549
1550#ifdef YYLEX_PARAM
1551# define YYLEX yylex (&yylval, YYLEX_PARAM)
1552#else
1553# define YYLEX yylex (&yylval)
1554#endif
1555
1556/* Enable debugging if requested. */
1557#if YYDEBUG
1558
1559# ifndef YYFPRINTF
1560# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1561# define YYFPRINTF fprintf
1562# endif
1563
1564# define YYDPRINTF(Args) \
1565do { \
1566 if (yydebug) \
1567 YYFPRINTF Args; \
1568} while (YYID (0))
1569
1570# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
1571do { \
1572 if (yydebug) \
1573 { \
1574 YYFPRINTF (stderr, "%s ", Title); \
1575 yy_symbol_print (stderr, \
1576 Type, Value, context); \
1577 YYFPRINTF (stderr, "\n"); \
1578 } \
1579} while (YYID (0))
1580
1581
1582/*--------------------------------.
1583| Print this symbol on YYOUTPUT. |
1584`--------------------------------*/
1585
1586/*ARGSUSED*/
1587#if (defined __STDC__ || defined __C99__FUNC__ \
1588 || defined __cplusplus || defined _MSC_VER)
1589static void
1590yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, TParseContext* context)
1591#else
1592static void
1593yy_symbol_value_print (yyoutput, yytype, yyvaluep, context)
1594 FILE *yyoutput;
1595 int yytype;
1596 YYSTYPE const * const yyvaluep;
1597 TParseContext* context;
1598#endif
1599{
1600 if (!yyvaluep)
1601 return;
1602 YYUSE (context);
1603# ifdef YYPRINT
1604 if (yytype < YYNTOKENS)
1605 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1606# else
1607 YYUSE (yyoutput);
1608# endif
1609 switch (yytype)
1610 {
1611 default:
1612 break;
1613 }
1614}
1615
1616
1617/*--------------------------------.
1618| Print this symbol on YYOUTPUT. |
1619`--------------------------------*/
1620
1621#if (defined __STDC__ || defined __C99__FUNC__ \
1622 || defined __cplusplus || defined _MSC_VER)
1623static void
1624yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, TParseContext* context)
1625#else
1626static void
1627yy_symbol_print (yyoutput, yytype, yyvaluep, context)
1628 FILE *yyoutput;
1629 int yytype;
1630 YYSTYPE const * const yyvaluep;
1631 TParseContext* context;
1632#endif
1633{
1634 if (yytype < YYNTOKENS)
1635 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1636 else
1637 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1638
1639 yy_symbol_value_print (yyoutput, yytype, yyvaluep, context);
1640 YYFPRINTF (yyoutput, ")");
1641}
1642
1643/*------------------------------------------------------------------.
1644| yy_stack_print -- Print the state stack from its BOTTOM up to its |
1645| TOP (included). |
1646`------------------------------------------------------------------*/
1647
1648#if (defined __STDC__ || defined __C99__FUNC__ \
1649 || defined __cplusplus || defined _MSC_VER)
1650static void
1651yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
1652#else
1653static void
1654yy_stack_print (yybottom, yytop)
1655 yytype_int16 *yybottom;
1656 yytype_int16 *yytop;
1657#endif
1658{
1659 YYFPRINTF (stderr, "Stack now");
1660 for (; yybottom <= yytop; yybottom++)
1661 {
1662 int yybot = *yybottom;
1663 YYFPRINTF (stderr, " %d", yybot);
1664 }
1665 YYFPRINTF (stderr, "\n");
1666}
1667
1668# define YY_STACK_PRINT(Bottom, Top) \
1669do { \
1670 if (yydebug) \
1671 yy_stack_print ((Bottom), (Top)); \
1672} while (YYID (0))
1673
1674
1675/*------------------------------------------------.
1676| Report that the YYRULE is going to be reduced. |
1677`------------------------------------------------*/
1678
1679#if (defined __STDC__ || defined __C99__FUNC__ \
1680 || defined __cplusplus || defined _MSC_VER)
1681static void
1682yy_reduce_print (YYSTYPE *yyvsp, int yyrule, TParseContext* context)
1683#else
1684static void
1685yy_reduce_print (yyvsp, yyrule, context)
1686 YYSTYPE *yyvsp;
1687 int yyrule;
1688 TParseContext* context;
1689#endif
1690{
1691 int yynrhs = yyr2[yyrule];
1692 int yyi;
1693 unsigned long int yylno = yyrline[yyrule];
1694 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1695 yyrule - 1, yylno);
1696 /* The symbols being reduced. */
1697 for (yyi = 0; yyi < yynrhs; yyi++)
1698 {
1699 YYFPRINTF (stderr, " $%d = ", yyi + 1);
1700 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1701 &(yyvsp[(yyi + 1) - (yynrhs)])
1702 , context);
1703 YYFPRINTF (stderr, "\n");
1704 }
1705}
1706
1707# define YY_REDUCE_PRINT(Rule) \
1708do { \
1709 if (yydebug) \
1710 yy_reduce_print (yyvsp, Rule, context); \
1711} while (YYID (0))
1712
1713/* Nonzero means print parse trace. It is left uninitialized so that
1714 multiple parsers can coexist. */
1715int yydebug;
1716#else /* !YYDEBUG */
1717# define YYDPRINTF(Args)
1718# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1719# define YY_STACK_PRINT(Bottom, Top)
1720# define YY_REDUCE_PRINT(Rule)
1721#endif /* !YYDEBUG */
1722
1723
1724/* YYINITDEPTH -- initial size of the parser's stacks. */
1725#ifndef YYINITDEPTH
1726# define YYINITDEPTH 200
1727#endif
1728
1729/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1730 if the built-in stack extension method is used).
1731
1732 Do not make this value too large; the results are undefined if
1733 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1734 evaluated with infinite-precision integer arithmetic. */
1735
1736#ifndef YYMAXDEPTH
1737# define YYMAXDEPTH 10000
1738#endif
1739
1740
1741
1742#if YYERROR_VERBOSE
1743
1744# ifndef yystrlen
1745# if defined __GLIBC__ && defined _STRING_H
1746# define yystrlen strlen
1747# else
1748/* Return the length of YYSTR. */
1749#if (defined __STDC__ || defined __C99__FUNC__ \
1750 || defined __cplusplus || defined _MSC_VER)
1751static YYSIZE_T
1752yystrlen (const char *yystr)
1753#else
1754static YYSIZE_T
1755yystrlen (yystr)
1756 const char *yystr;
1757#endif
1758{
1759 YYSIZE_T yylen;
1760 for (yylen = 0; yystr[yylen]; yylen++)
1761 continue;
1762 return yylen;
1763}
1764# endif
1765# endif
1766
1767# ifndef yystpcpy
1768# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1769# define yystpcpy stpcpy
1770# else
1771/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1772 YYDEST. */
1773#if (defined __STDC__ || defined __C99__FUNC__ \
1774 || defined __cplusplus || defined _MSC_VER)
1775static char *
1776yystpcpy (char *yydest, const char *yysrc)
1777#else
1778static char *
1779yystpcpy (yydest, yysrc)
1780 char *yydest;
1781 const char *yysrc;
1782#endif
1783{
1784 char *yyd = yydest;
1785 const char *yys = yysrc;
1786
1787 while ((*yyd++ = *yys++) != '\0')
1788 continue;
1789
1790 return yyd - 1;
1791}
1792# endif
1793# endif
1794
1795# ifndef yytnamerr
1796/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1797 quotes and backslashes, so that it's suitable for yyerror. The
1798 heuristic is that double-quoting is unnecessary unless the string
1799 contains an apostrophe, a comma, or backslash (other than
1800 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1801 null, do not copy; instead, return the length of what the result
1802 would have been. */
1803static YYSIZE_T
1804yytnamerr (char *yyres, const char *yystr)
1805{
1806 if (*yystr == '"')
1807 {
1808 YYSIZE_T yyn = 0;
1809 char const *yyp = yystr;
1810
1811 for (;;)
1812 switch (*++yyp)
1813 {
1814 case '\'':
1815 case ',':
1816 goto do_not_strip_quotes;
1817
1818 case '\\':
1819 if (*++yyp != '\\')
1820 goto do_not_strip_quotes;
1821 /* Fall through. */
1822 default:
1823 if (yyres)
1824 yyres[yyn] = *yyp;
1825 yyn++;
1826 break;
1827
1828 case '"':
1829 if (yyres)
1830 yyres[yyn] = '\0';
1831 return yyn;
1832 }
1833 do_not_strip_quotes: ;
1834 }
1835
1836 if (! yyres)
1837 return yystrlen (yystr);
1838
1839 return yystpcpy (yyres, yystr) - yyres;
1840}
1841# endif
1842
1843/* Copy into YYRESULT an error message about the unexpected token
1844 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1845 including the terminating null byte. If YYRESULT is null, do not
1846 copy anything; just return the number of bytes that would be
1847 copied. As a special case, return 0 if an ordinary "syntax error"
1848 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1849 size calculation. */
1850static YYSIZE_T
1851yysyntax_error (char *yyresult, int yystate, int yychar)
1852{
1853 int yyn = yypact[yystate];
1854
1855 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1856 return 0;
1857 else
1858 {
1859 int yytype = YYTRANSLATE (yychar);
1860 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1861 YYSIZE_T yysize = yysize0;
1862 YYSIZE_T yysize1;
1863 int yysize_overflow = 0;
1864 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1865 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1866 int yyx;
1867
1868# if 0
1869 /* This is so xgettext sees the translatable formats that are
1870 constructed on the fly. */
1871 YY_("syntax error, unexpected %s");
1872 YY_("syntax error, unexpected %s, expecting %s");
1873 YY_("syntax error, unexpected %s, expecting %s or %s");
1874 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1875 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1876# endif
1877 char *yyfmt;
1878 char const *yyf;
1879 static char const yyunexpected[] = "syntax error, unexpected %s";
1880 static char const yyexpecting[] = ", expecting %s";
1881 static char const yyor[] = " or %s";
1882 char yyformat[sizeof yyunexpected
1883 + sizeof yyexpecting - 1
1884 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1885 * (sizeof yyor - 1))];
1886 char const *yyprefix = yyexpecting;
1887
1888 /* Start YYX at -YYN if negative to avoid negative indexes in
1889 YYCHECK. */
1890 int yyxbegin = yyn < 0 ? -yyn : 0;
1891
1892 /* Stay within bounds of both yycheck and yytname. */
1893 int yychecklim = YYLAST - yyn + 1;
1894 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1895 int yycount = 1;
1896
1897 yyarg[0] = yytname[yytype];
1898 yyfmt = yystpcpy (yyformat, yyunexpected);
1899
1900 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1901 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1902 {
1903 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1904 {
1905 yycount = 1;
1906 yysize = yysize0;
1907 yyformat[sizeof yyunexpected - 1] = '\0';
1908 break;
1909 }
1910 yyarg[yycount++] = yytname[yyx];
1911 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1912 yysize_overflow |= (yysize1 < yysize);
1913 yysize = yysize1;
1914 yyfmt = yystpcpy (yyfmt, yyprefix);
1915 yyprefix = yyor;
1916 }
1917
1918 yyf = YY_(yyformat);
1919 yysize1 = yysize + yystrlen (yyf);
1920 yysize_overflow |= (yysize1 < yysize);
1921 yysize = yysize1;
1922
1923 if (yysize_overflow)
1924 return YYSIZE_MAXIMUM;
1925
1926 if (yyresult)
1927 {
1928 /* Avoid sprintf, as that infringes on the user's name space.
1929 Don't have undefined behavior even if the translation
1930 produced a string with the wrong number of "%s"s. */
1931 char *yyp = yyresult;
1932 int yyi = 0;
1933 while ((*yyp = *yyf) != '\0')
1934 {
1935 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1936 {
1937 yyp += yytnamerr (yyp, yyarg[yyi++]);
1938 yyf += 2;
1939 }
1940 else
1941 {
1942 yyp++;
1943 yyf++;
1944 }
1945 }
1946 }
1947 return yysize;
1948 }
1949}
1950#endif /* YYERROR_VERBOSE */
1951
1952
1953/*-----------------------------------------------.
1954| Release the memory associated to this symbol. |
1955`-----------------------------------------------*/
1956
1957/*ARGSUSED*/
1958#if (defined __STDC__ || defined __C99__FUNC__ \
1959 || defined __cplusplus || defined _MSC_VER)
1960static void
1961yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, TParseContext* context)
1962#else
1963static void
1964yydestruct (yymsg, yytype, yyvaluep, context)
1965 const char *yymsg;
1966 int yytype;
1967 YYSTYPE *yyvaluep;
1968 TParseContext* context;
1969#endif
1970{
1971 YYUSE (yyvaluep);
1972 YYUSE (context);
1973
1974 if (!yymsg)
1975 yymsg = "Deleting";
1976 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1977
1978 switch (yytype)
1979 {
1980
1981 default:
1982 break;
1983 }
1984}
1985
1986/* Prevent warnings from -Wmissing-prototypes. */
1987#ifdef YYPARSE_PARAM
1988#if defined __STDC__ || defined __cplusplus
1989int yyparse (void *YYPARSE_PARAM);
1990#else
1991int yyparse ();
1992#endif
1993#else /* ! YYPARSE_PARAM */
1994#if defined __STDC__ || defined __cplusplus
1995int yyparse (TParseContext* context);
1996#else
1997int yyparse ();
1998#endif
1999#endif /* ! YYPARSE_PARAM */
2000
2001
2002
2003
2004
2005/*-------------------------.
2006| yyparse or yypush_parse. |
2007`-------------------------*/
2008
2009#ifdef YYPARSE_PARAM
2010#if (defined __STDC__ || defined __C99__FUNC__ \
2011 || defined __cplusplus || defined _MSC_VER)
2012int
2013yyparse (void *YYPARSE_PARAM)
2014#else
2015int
2016yyparse (YYPARSE_PARAM)
2017 void *YYPARSE_PARAM;
2018#endif
2019#else /* ! YYPARSE_PARAM */
2020#if (defined __STDC__ || defined __C99__FUNC__ \
2021 || defined __cplusplus || defined _MSC_VER)
2022int
2023yyparse (TParseContext* context)
2024#else
2025int
2026yyparse (context)
2027 TParseContext* context;
2028#endif
2029#endif
2030{
2031/* The lookahead symbol. */
2032int yychar;
2033
2034/* The semantic value of the lookahead symbol. */
2035YYSTYPE yylval;
2036
2037 /* Number of syntax errors so far. */
2038 int yynerrs;
2039
2040 int yystate;
2041 /* Number of tokens to shift before error messages enabled. */
2042 int yyerrstatus;
2043
2044 /* The stacks and their tools:
2045 `yyss': related to states.
2046 `yyvs': related to semantic values.
2047
2048 Refer to the stacks thru separate pointers, to allow yyoverflow
2049 to reallocate them elsewhere. */
2050
2051 /* The state stack. */
2052 yytype_int16 yyssa[YYINITDEPTH];
2053 yytype_int16 *yyss;
2054 yytype_int16 *yyssp;
2055
2056 /* The semantic value stack. */
2057 YYSTYPE yyvsa[YYINITDEPTH];
2058 YYSTYPE *yyvs;
2059 YYSTYPE *yyvsp;
2060
2061 YYSIZE_T yystacksize;
2062
2063 int yyn;
2064 int yyresult;
2065 /* Lookahead token as an internal (translated) token number. */
2066 int yytoken;
2067 /* The variables used to return semantic value and location from the
2068 action routines. */
2069 YYSTYPE yyval;
2070
2071#if YYERROR_VERBOSE
2072 /* Buffer for error messages, and its allocated size. */
2073 char yymsgbuf[128];
2074 char *yymsg = yymsgbuf;
2075 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
2076#endif
2077
2078#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
2079
2080 /* The number of symbols on the RHS of the reduced rule.
2081 Keep to zero when no symbol should be popped. */
2082 int yylen = 0;
2083
2084 yytoken = 0;
2085 yyss = yyssa;
2086 yyvs = yyvsa;
2087 yystacksize = YYINITDEPTH;
2088
2089 YYDPRINTF ((stderr, "Starting parse\n"));
2090
2091 yystate = 0;
2092 yyerrstatus = 0;
2093 yynerrs = 0;
2094 yychar = YYEMPTY; /* Cause a token to be read. */
2095
2096 /* Initialize stack pointers.
2097 Waste one element of value and location stack
2098 so that they stay on the same level as the state stack.
2099 The wasted elements are never initialized. */
2100 yyssp = yyss;
2101 yyvsp = yyvs;
2102
2103 goto yysetstate;
2104
2105/*------------------------------------------------------------.
2106| yynewstate -- Push a new state, which is found in yystate. |
2107`------------------------------------------------------------*/
2108 yynewstate:
2109 /* In all cases, when you get here, the value and location stacks
2110 have just been pushed. So pushing a state here evens the stacks. */
2111 yyssp++;
2112
2113 yysetstate:
2114 *yyssp = yystate;
2115
2116 if (yyss + yystacksize - 1 <= yyssp)
2117 {
2118 /* Get the current used size of the three stacks, in elements. */
2119 YYSIZE_T yysize = yyssp - yyss + 1;
2120
2121#ifdef yyoverflow
2122 {
2123 /* Give user a chance to reallocate the stack. Use copies of
2124 these so that the &'s don't force the real ones into
2125 memory. */
2126 YYSTYPE *yyvs1 = yyvs;
2127 yytype_int16 *yyss1 = yyss;
2128
2129 /* Each stack pointer address is followed by the size of the
2130 data in use in that stack, in bytes. This used to be a
2131 conditional around just the two extra args, but that might
2132 be undefined if yyoverflow is a macro. */
2133 yyoverflow (YY_("memory exhausted"),
2134 &yyss1, yysize * sizeof (*yyssp),
2135 &yyvs1, yysize * sizeof (*yyvsp),
2136 &yystacksize);
2137
2138 yyss = yyss1;
2139 yyvs = yyvs1;
2140 }
2141#else /* no yyoverflow */
2142# ifndef YYSTACK_RELOCATE
2143 goto yyexhaustedlab;
2144# else
2145 /* Extend the stack our own way. */
2146 if (YYMAXDEPTH <= yystacksize)
2147 goto yyexhaustedlab;
2148 yystacksize *= 2;
2149 if (YYMAXDEPTH < yystacksize)
2150 yystacksize = YYMAXDEPTH;
2151
2152 {
2153 yytype_int16 *yyss1 = yyss;
2154 union yyalloc *yyptr =
2155 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
2156 if (! yyptr)
2157 goto yyexhaustedlab;
2158 YYSTACK_RELOCATE (yyss_alloc, yyss);
2159 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
2160# undef YYSTACK_RELOCATE
2161 if (yyss1 != yyssa)
2162 YYSTACK_FREE (yyss1);
2163 }
2164# endif
2165#endif /* no yyoverflow */
2166
2167 yyssp = yyss + yysize - 1;
2168 yyvsp = yyvs + yysize - 1;
2169
2170 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
2171 (unsigned long int) yystacksize));
2172
2173 if (yyss + yystacksize - 1 <= yyssp)
2174 YYABORT;
2175 }
2176
2177 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
2178
2179 if (yystate == YYFINAL)
2180 YYACCEPT;
2181
2182 goto yybackup;
2183
2184/*-----------.
2185| yybackup. |
2186`-----------*/
2187yybackup:
2188
2189 /* Do appropriate processing given the current state. Read a
2190 lookahead token if we need one and don't already have one. */
2191
2192 /* First try to decide what to do without reference to lookahead token. */
2193 yyn = yypact[yystate];
2194 if (yyn == YYPACT_NINF)
2195 goto yydefault;
2196
2197 /* Not known => get a lookahead token if don't already have one. */
2198
2199 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
2200 if (yychar == YYEMPTY)
2201 {
2202 YYDPRINTF ((stderr, "Reading a token: "));
2203 yychar = YYLEX;
2204 }
2205
2206 if (yychar <= YYEOF)
2207 {
2208 yychar = yytoken = YYEOF;
2209 YYDPRINTF ((stderr, "Now at end of input.\n"));
2210 }
2211 else
2212 {
2213 yytoken = YYTRANSLATE (yychar);
2214 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
2215 }
2216
2217 /* If the proper action on seeing token YYTOKEN is to reduce or to
2218 detect an error, take that action. */
2219 yyn += yytoken;
2220 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
2221 goto yydefault;
2222 yyn = yytable[yyn];
2223 if (yyn <= 0)
2224 {
2225 if (yyn == 0 || yyn == YYTABLE_NINF)
2226 goto yyerrlab;
2227 yyn = -yyn;
2228 goto yyreduce;
2229 }
2230
2231 /* Count tokens shifted since error; after three, turn off error
2232 status. */
2233 if (yyerrstatus)
2234 yyerrstatus--;
2235
2236 /* Shift the lookahead token. */
2237 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
2238
2239 /* Discard the shifted token. */
2240 yychar = YYEMPTY;
2241
2242 yystate = yyn;
2243 *++yyvsp = yylval;
2244
2245 goto yynewstate;
2246
2247
2248/*-----------------------------------------------------------.
2249| yydefault -- do the default action for the current state. |
2250`-----------------------------------------------------------*/
2251yydefault:
2252 yyn = yydefact[yystate];
2253 if (yyn == 0)
2254 goto yyerrlab;
2255 goto yyreduce;
2256
2257
2258/*-----------------------------.
2259| yyreduce -- Do a reduction. |
2260`-----------------------------*/
2261yyreduce:
2262 /* yyn is the number of a rule to reduce with. */
2263 yylen = yyr2[yyn];
2264
2265 /* If YYLEN is nonzero, implement the default value of the action:
2266 `$$ = $1'.
2267
2268 Otherwise, the following line sets YYVAL to garbage.
2269 This behavior is undocumented and Bison
2270 users should not rely upon it. Assigning to YYVAL
2271 unconditionally makes the parser a bit smaller, and it avoids a
2272 GCC warning that YYVAL may be used uninitialized. */
2273 yyval = yyvsp[1-yylen];
2274
2275
2276 YY_REDUCE_PRINT (yyn);
2277 switch (yyn)
2278 {
2279 case 2:
2280
2281 {
2282 // The symbol table search was done in the lexical phase
2283 const TSymbol* symbol = (yyvsp[(1) - (1)].lex).symbol;
2284 const TVariable* variable;
2285 if (symbol == 0) {
2286 context->error((yyvsp[(1) - (1)].lex).line, "undeclared identifier", (yyvsp[(1) - (1)].lex).string->c_str());
2287 context->recover();
2288 TType type(EbtFloat, EbpUndefined);
2289 TVariable* fakeVariable = new TVariable((yyvsp[(1) - (1)].lex).string, type);
Nicolas Capensd603ecd2015-02-18 14:52:21 -05002290 context->symbolTable.declare(*fakeVariable);
John Bauman66b8ab22014-05-06 15:57:45 -04002291 variable = fakeVariable;
2292 } else {
2293 // This identifier can only be a variable type symbol
2294 if (! symbol->isVariable()) {
2295 context->error((yyvsp[(1) - (1)].lex).line, "variable expected", (yyvsp[(1) - (1)].lex).string->c_str());
2296 context->recover();
2297 }
2298 variable = static_cast<const TVariable*>(symbol);
2299 }
2300
2301 // don't delete $1.string, it's used by error recovery, and the pool
2302 // pop will reclaim the memory
2303
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002304 if (variable->getType().getQualifier() == EvqConstExpr ) {
John Bauman66b8ab22014-05-06 15:57:45 -04002305 ConstantUnion* constArray = variable->getConstPointer();
2306 TType t(variable->getType());
2307 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(constArray, t, (yyvsp[(1) - (1)].lex).line);
2308 } else
2309 (yyval.interm.intermTypedNode) = context->intermediate.addSymbol(variable->getUniqueId(),
2310 variable->getName(),
2311 variable->getType(), (yyvsp[(1) - (1)].lex).line);
2312 }
2313 break;
2314
2315 case 3:
2316
2317 {
2318 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
2319 }
2320 break;
2321
2322 case 4:
2323
2324 {
John Bauman66b8ab22014-05-06 15:57:45 -04002325 ConstantUnion *unionArray = new ConstantUnion[1];
2326 unionArray->setIConst((yyvsp[(1) - (1)].lex).i);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002327 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConstExpr), (yyvsp[(1) - (1)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002328 }
2329 break;
2330
2331 case 5:
2332
2333 {
2334 ConstantUnion *unionArray = new ConstantUnion[1];
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002335 unionArray->setUConst((yyvsp[(1) - (1)].lex).u);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002336 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtUInt, EbpUndefined, EvqConstExpr), (yyvsp[(1) - (1)].lex).line);
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002337 }
2338 break;
2339
2340 case 6:
2341
2342 {
2343 ConstantUnion *unionArray = new ConstantUnion[1];
John Bauman66b8ab22014-05-06 15:57:45 -04002344 unionArray->setFConst((yyvsp[(1) - (1)].lex).f);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002345 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConstExpr), (yyvsp[(1) - (1)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002346 }
2347 break;
2348
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002349 case 7:
John Bauman66b8ab22014-05-06 15:57:45 -04002350
2351 {
2352 ConstantUnion *unionArray = new ConstantUnion[1];
2353 unionArray->setBConst((yyvsp[(1) - (1)].lex).b);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002354 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConstExpr), (yyvsp[(1) - (1)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002355 }
2356 break;
2357
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002358 case 8:
John Bauman66b8ab22014-05-06 15:57:45 -04002359
2360 {
2361 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (3)].interm.intermTypedNode);
2362 }
2363 break;
2364
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002365 case 9:
John Bauman66b8ab22014-05-06 15:57:45 -04002366
2367 {
2368 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
2369 }
2370 break;
2371
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002372 case 10:
John Bauman66b8ab22014-05-06 15:57:45 -04002373
2374 {
2375 if (!(yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isVector()) {
2376 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode())
2377 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());
2378 else
2379 context->error((yyvsp[(2) - (4)].lex).line, " left of '[' is not of type array, matrix, or vector ", "expression");
2380 context->recover();
2381 }
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002382 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConstExpr && (yyvsp[(3) - (4)].interm.intermTypedNode)->getQualifier() == EvqConstExpr) {
John Bauman66b8ab22014-05-06 15:57:45 -04002383 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) { // constant folding for arrays
Nicolas Capens198529d2015-02-10 13:54:19 -05002384 (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 -04002385 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector()) { // constant folding for vectors
2386 TVectorFields fields;
2387 fields.num = 1;
Nicolas Capens198529d2015-02-10 13:54:19 -05002388 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 -04002389 (yyval.interm.intermTypedNode) = context->addConstVectorNode(fields, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2390 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix()) { // constant folding for matrices
Nicolas Capens198529d2015-02-10 13:54:19 -05002391 (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 -04002392 }
2393 } else {
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002394 if ((yyvsp[(3) - (4)].interm.intermTypedNode)->getQualifier() == EvqConstExpr) {
Nicolas Capens198529d2015-02-10 13:54:19 -05002395 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 -04002396 std::stringstream extraInfoStream;
Nicolas Capens198529d2015-02-10 13:54:19 -05002397 extraInfoStream << "field selection out of range '" << (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0) << "'";
John Bauman66b8ab22014-05-06 15:57:45 -04002398 std::string extraInfo = extraInfoStream.str();
2399 context->error((yyvsp[(2) - (4)].lex).line, "", "[", extraInfo.c_str());
2400 context->recover();
2401 } else {
2402 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) {
2403 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize() == 0) {
Nicolas Capens198529d2015-02-10 13:54:19 -05002404 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getMaxArraySize() <= (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0)) {
2405 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 -04002406 context->recover();
2407 } else {
2408 if (context->arraySetMaxSize((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getTypePointer(), 0, false, (yyvsp[(2) - (4)].lex).line))
2409 context->recover();
2410 }
Nicolas Capens198529d2015-02-10 13:54:19 -05002411 } else if ( (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0) >= (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize()) {
John Bauman66b8ab22014-05-06 15:57:45 -04002412 std::stringstream extraInfoStream;
Nicolas Capens198529d2015-02-10 13:54:19 -05002413 extraInfoStream << "array index out of range '" << (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0) << "'";
John Bauman66b8ab22014-05-06 15:57:45 -04002414 std::string extraInfo = extraInfoStream.str();
2415 context->error((yyvsp[(2) - (4)].lex).line, "", "[", extraInfo.c_str());
2416 context->recover();
2417 }
2418 }
2419 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(3) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2420 }
2421 } else {
2422 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize() == 0) {
2423 context->error((yyvsp[(2) - (4)].lex).line, "", "[", "array must be redeclared with a size before being indexed with a variable");
2424 context->recover();
2425 }
2426
2427 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexIndirect, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(3) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2428 }
2429 }
2430 if ((yyval.interm.intermTypedNode) == 0) {
2431 ConstantUnion *unionArray = new ConstantUnion[1];
2432 unionArray->setFConst(0.0f);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002433 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpHigh, EvqConstExpr), (yyvsp[(2) - (4)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002434 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) {
2435 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getStruct())
2436 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getStruct(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getTypeName()));
2437 else
Alexis Hetub14178b2015-04-13 13:23:20 -04002438 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getSecondarySize()));
John Bauman66b8ab22014-05-06 15:57:45 -04002439
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002440 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConstExpr)
2441 (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConstExpr);
2442 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConstExpr)
2443 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqConstExpr, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize()));
John Bauman66b8ab22014-05-06 15:57:45 -04002444 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix())
2445 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize()));
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002446 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConstExpr)
2447 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqConstExpr));
John Bauman66b8ab22014-05-06 15:57:45 -04002448 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector())
2449 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary));
2450 else
2451 (yyval.interm.intermTypedNode)->setType((yyvsp[(1) - (4)].interm.intermTypedNode)->getType());
2452 }
2453 break;
2454
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002455 case 11:
John Bauman66b8ab22014-05-06 15:57:45 -04002456
2457 {
2458 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
2459 }
2460 break;
2461
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002462 case 12:
John Bauman66b8ab22014-05-06 15:57:45 -04002463
2464 {
2465 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isArray()) {
2466 context->error((yyvsp[(3) - (3)].lex).line, "cannot apply dot operator to an array", ".");
2467 context->recover();
2468 }
2469
2470 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isVector()) {
2471 TVectorFields fields;
2472 if (! context->parseVectorFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yyvsp[(3) - (3)].lex).line)) {
2473 fields.num = 1;
2474 fields.offsets[0] = 0;
2475 context->recover();
2476 }
2477
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002478 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConstExpr) { // constant folding for vector fields
John Bauman66b8ab22014-05-06 15:57:45 -04002479 (yyval.interm.intermTypedNode) = context->addConstVectorNode(fields, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].lex).line);
2480 if ((yyval.interm.intermTypedNode) == 0) {
2481 context->recover();
2482 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2483 }
2484 else
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002485 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(), EvqConstExpr, (int) (*(yyvsp[(3) - (3)].lex).string).size()));
John Bauman66b8ab22014-05-06 15:57:45 -04002486 } else {
2487 TString vectorString = *(yyvsp[(3) - (3)].lex).string;
2488 TIntermTyped* index = context->intermediate.addSwizzle(fields, (yyvsp[(3) - (3)].lex).line);
2489 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpVectorSwizzle, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2490 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (int) vectorString.size()));
2491 }
2492 } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isMatrix()) {
2493 TMatrixFields fields;
2494 if (! context->parseMatrixFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yyvsp[(3) - (3)].lex).line)) {
2495 fields.wholeRow = false;
2496 fields.wholeCol = false;
2497 fields.row = 0;
2498 fields.col = 0;
2499 context->recover();
2500 }
2501
2502 if (fields.wholeRow || fields.wholeCol) {
2503 context->error((yyvsp[(2) - (3)].lex).line, " non-scalar fields not implemented yet", ".");
2504 context->recover();
2505 ConstantUnion *unionArray = new ConstantUnion[1];
2506 unionArray->setIConst(0);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002507 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConstExpr), (yyvsp[(3) - (3)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002508 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2509 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(),EvqTemporary, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize()));
2510 } else {
2511 ConstantUnion *unionArray = new ConstantUnion[1];
2512 unionArray->setIConst(fields.col * (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize() + fields.row);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002513 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConstExpr), (yyvsp[(3) - (3)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002514 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2515 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision()));
2516 }
2517 } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType() == EbtStruct) {
2518 bool fieldFound = false;
2519 const TTypeList* fields = (yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getStruct();
2520 if (fields == 0) {
2521 context->error((yyvsp[(2) - (3)].lex).line, "structure has no fields", "Internal Error");
2522 context->recover();
2523 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2524 } else {
2525 unsigned int i;
2526 for (i = 0; i < fields->size(); ++i) {
2527 if ((*fields)[i].type->getFieldName() == *(yyvsp[(3) - (3)].lex).string) {
2528 fieldFound = true;
2529 break;
2530 }
2531 }
2532 if (fieldFound) {
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002533 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConstExpr) {
John Bauman66b8ab22014-05-06 15:57:45 -04002534 (yyval.interm.intermTypedNode) = context->addConstStruct(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
2535 if ((yyval.interm.intermTypedNode) == 0) {
2536 context->recover();
2537 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2538 }
2539 else {
2540 (yyval.interm.intermTypedNode)->setType(*(*fields)[i].type);
2541 // change the qualifier of the return type, not of the structure field
2542 // as the structure definition is shared between various structures.
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002543 (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConstExpr);
John Bauman66b8ab22014-05-06 15:57:45 -04002544 }
2545 } else {
2546 ConstantUnion *unionArray = new ConstantUnion[1];
2547 unionArray->setIConst(i);
2548 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, *(*fields)[i].type, (yyvsp[(3) - (3)].lex).line);
2549 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirectStruct, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2550 (yyval.interm.intermTypedNode)->setType(*(*fields)[i].type);
2551 }
2552 } else {
2553 context->error((yyvsp[(2) - (3)].lex).line, " no such field in structure", (yyvsp[(3) - (3)].lex).string->c_str());
2554 context->recover();
2555 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2556 }
2557 }
2558 } else {
2559 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());
2560 context->recover();
2561 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2562 }
2563 // don't delete $3.string, it's from the pool
2564 }
2565 break;
2566
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002567 case 13:
John Bauman66b8ab22014-05-06 15:57:45 -04002568
2569 {
2570 if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode)))
2571 context->recover();
John Baumand4ae8632014-05-06 16:18:33 -04002572 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostIncrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002573 if ((yyval.interm.intermTypedNode) == 0) {
2574 context->unaryOpError((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
2575 context->recover();
2576 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode);
2577 }
2578 }
2579 break;
2580
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002581 case 14:
John Bauman66b8ab22014-05-06 15:57:45 -04002582
2583 {
2584 if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode)))
2585 context->recover();
John Baumand4ae8632014-05-06 16:18:33 -04002586 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostDecrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002587 if ((yyval.interm.intermTypedNode) == 0) {
2588 context->unaryOpError((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
2589 context->recover();
2590 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode);
2591 }
2592 }
2593 break;
2594
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002595 case 15:
John Bauman66b8ab22014-05-06 15:57:45 -04002596
2597 {
2598 if (context->integerErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode), "[]"))
2599 context->recover();
2600 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
2601 }
2602 break;
2603
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002604 case 16:
John Bauman66b8ab22014-05-06 15:57:45 -04002605
2606 {
2607 TFunction* fnCall = (yyvsp[(1) - (1)].interm).function;
2608 TOperator op = fnCall->getBuiltInOp();
2609
2610 if (op != EOpNull)
2611 {
2612 //
2613 // Then this should be a constructor.
2614 // Don't go through the symbol table for constructors.
2615 // Their parameters will be verified algorithmically.
2616 //
2617 TType type(EbtVoid, EbpUndefined); // use this to get the type back
2618 if (context->constructorErrorCheck((yyvsp[(1) - (1)].interm).line, (yyvsp[(1) - (1)].interm).intermNode, *fnCall, op, &type)) {
2619 (yyval.interm.intermTypedNode) = 0;
2620 } else {
2621 //
2622 // It's a constructor, of type 'type'.
2623 //
2624 (yyval.interm.intermTypedNode) = context->addConstructor((yyvsp[(1) - (1)].interm).intermNode, &type, op, fnCall, (yyvsp[(1) - (1)].interm).line);
2625 }
2626
2627 if ((yyval.interm.intermTypedNode) == 0) {
2628 context->recover();
2629 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator(0, op, (yyvsp[(1) - (1)].interm).line);
2630 }
2631 (yyval.interm.intermTypedNode)->setType(type);
2632 } else {
2633 //
2634 // Not a constructor. Find it in the symbol table.
2635 //
2636 const TFunction* fnCandidate;
2637 bool builtIn;
2638 fnCandidate = context->findFunction((yyvsp[(1) - (1)].interm).line, fnCall, &builtIn);
2639 if (fnCandidate) {
2640 //
2641 // A declared function.
2642 //
2643 if (builtIn && !fnCandidate->getExtension().empty() &&
2644 context->extensionErrorCheck((yyvsp[(1) - (1)].interm).line, fnCandidate->getExtension())) {
2645 context->recover();
2646 }
2647 op = fnCandidate->getBuiltInOp();
2648 if (builtIn && op != EOpNull) {
2649 //
2650 // A function call mapped to a built-in operation.
2651 //
2652 if (fnCandidate->getParamCount() == 1) {
2653 //
2654 // Treat it like a built-in unary operator.
2655 //
John Baumand4ae8632014-05-06 16:18:33 -04002656 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(op, (yyvsp[(1) - (1)].interm).intermNode, 0);
John Bauman66b8ab22014-05-06 15:57:45 -04002657 if ((yyval.interm.intermTypedNode) == 0) {
2658 std::stringstream extraInfoStream;
2659 extraInfoStream << "built in unary operator function. Type: " << static_cast<TIntermTyped*>((yyvsp[(1) - (1)].interm).intermNode)->getCompleteString();
2660 std::string extraInfo = extraInfoStream.str();
2661 context->error((yyvsp[(1) - (1)].interm).intermNode->getLine(), " wrong operand type", "Internal Error", extraInfo.c_str());
2662 YYERROR;
2663 }
2664 } else {
2665 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, op, (yyvsp[(1) - (1)].interm).line);
2666 }
2667 } else {
2668 // This is a real function call
2669
2670 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, EOpFunctionCall, (yyvsp[(1) - (1)].interm).line);
2671 (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType());
2672
2673 // this is how we know whether the given function is a builtIn function or a user defined function
2674 // if builtIn == false, it's a userDefined -> could be an overloaded builtIn function also
2675 // if builtIn == true, it's definitely a builtIn function with EOpNull
2676 if (!builtIn)
2677 (yyval.interm.intermTypedNode)->getAsAggregate()->setUserDefined();
2678 (yyval.interm.intermTypedNode)->getAsAggregate()->setName(fnCandidate->getMangledName());
2679
2680 TQualifier qual;
2681 for (int i = 0; i < fnCandidate->getParamCount(); ++i) {
2682 qual = fnCandidate->getParam(i).type->getQualifier();
2683 if (qual == EvqOut || qual == EvqInOut) {
2684 if (context->lValueErrorCheck((yyval.interm.intermTypedNode)->getLine(), "assign", (yyval.interm.intermTypedNode)->getAsAggregate()->getSequence()[i]->getAsTyped())) {
2685 context->error((yyvsp[(1) - (1)].interm).intermNode->getLine(), "Constant value cannot be passed for 'out' or 'inout' parameters.", "Error");
2686 context->recover();
2687 }
2688 }
2689 }
2690 }
2691 (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType());
2692 } else {
2693 // error message was put out by PaFindFunction()
2694 // Put on a dummy node for error recovery
2695 ConstantUnion *unionArray = new ConstantUnion[1];
2696 unionArray->setFConst(0.0f);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05002697 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConstExpr), (yyvsp[(1) - (1)].interm).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002698 context->recover();
2699 }
2700 }
2701 delete fnCall;
2702 }
2703 break;
2704
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002705 case 17:
John Bauman66b8ab22014-05-06 15:57:45 -04002706
2707 {
2708 (yyval.interm) = (yyvsp[(1) - (1)].interm);
2709 }
2710 break;
2711
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002712 case 18:
John Bauman66b8ab22014-05-06 15:57:45 -04002713
2714 {
2715 context->error((yyvsp[(3) - (3)].interm).line, "methods are not supported", "");
2716 context->recover();
2717 (yyval.interm) = (yyvsp[(3) - (3)].interm);
2718 }
2719 break;
2720
John Bauman66b8ab22014-05-06 15:57:45 -04002721 case 19:
2722
2723 {
2724 (yyval.interm) = (yyvsp[(1) - (2)].interm);
2725 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
2726 }
2727 break;
2728
2729 case 20:
2730
2731 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002732 (yyval.interm) = (yyvsp[(1) - (2)].interm);
2733 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
2734 }
2735 break;
2736
2737 case 21:
2738
2739 {
John Bauman66b8ab22014-05-06 15:57:45 -04002740 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
2741 (yyval.interm).intermNode = 0;
2742 }
2743 break;
2744
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002745 case 22:
John Bauman66b8ab22014-05-06 15:57:45 -04002746
2747 {
2748 (yyval.interm).function = (yyvsp[(1) - (1)].interm.function);
2749 (yyval.interm).intermNode = 0;
2750 }
2751 break;
2752
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002753 case 23:
John Bauman66b8ab22014-05-06 15:57:45 -04002754
2755 {
2756 TParameter param = { 0, new TType((yyvsp[(2) - (2)].interm.intermTypedNode)->getType()) };
2757 (yyvsp[(1) - (2)].interm.function)->addParameter(param);
2758 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
2759 (yyval.interm).intermNode = (yyvsp[(2) - (2)].interm.intermTypedNode);
2760 }
2761 break;
2762
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002763 case 24:
John Bauman66b8ab22014-05-06 15:57:45 -04002764
2765 {
2766 TParameter param = { 0, new TType((yyvsp[(3) - (3)].interm.intermTypedNode)->getType()) };
2767 (yyvsp[(1) - (3)].interm).function->addParameter(param);
2768 (yyval.interm).function = (yyvsp[(1) - (3)].interm).function;
2769 (yyval.interm).intermNode = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermNode, (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
2770 }
2771 break;
2772
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002773 case 25:
John Bauman66b8ab22014-05-06 15:57:45 -04002774
2775 {
2776 (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
2777 }
2778 break;
2779
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002780 case 26:
John Bauman66b8ab22014-05-06 15:57:45 -04002781
2782 {
2783 //
2784 // Constructor
2785 //
2786 TOperator op = EOpNull;
2787 if ((yyvsp[(1) - (1)].interm.type).userDef) {
2788 op = EOpConstructStruct;
2789 } else {
2790 switch ((yyvsp[(1) - (1)].interm.type).type) {
2791 case EbtFloat:
Alexis Hetub14178b2015-04-13 13:23:20 -04002792 switch((yyvsp[(1) - (1)].interm.type).primarySize) {
2793 case 1:
2794 op = EOpConstructFloat; break;
2795 case 2:
2796 switch((yyvsp[(1) - (1)].interm.type).secondarySize) {
2797 case 1: op = EOpConstructVec2; break;
2798 case 2: op = EOpConstructMat2; break;
2799 case 3: op = EOpConstructMat2x3; break;
2800 case 4: op = EOpConstructMat2x4; break;
John Bauman66b8ab22014-05-06 15:57:45 -04002801 }
Alexis Hetub14178b2015-04-13 13:23:20 -04002802 break;
2803 case 3:
2804 switch((yyvsp[(1) - (1)].interm.type).secondarySize) {
2805 case 1: op = EOpConstructVec3; break;
2806 case 2: op = EOpConstructMat3x2; break;
2807 case 3: op = EOpConstructMat3; break;
2808 case 4: op = EOpConstructMat3x4; break;
John Bauman66b8ab22014-05-06 15:57:45 -04002809 }
Alexis Hetub14178b2015-04-13 13:23:20 -04002810 break;
2811 case 4:
2812 switch((yyvsp[(1) - (1)].interm.type).secondarySize) {
2813 case 1: op = EOpConstructVec4; break;
2814 case 2: op = EOpConstructMat4x2; break;
2815 case 3: op = EOpConstructMat4x3; break;
2816 case 4: op = EOpConstructMat4; break;
2817 }
2818 break;
John Bauman66b8ab22014-05-06 15:57:45 -04002819 }
2820 break;
2821 case EbtInt:
Alexis Hetub14178b2015-04-13 13:23:20 -04002822 switch((yyvsp[(1) - (1)].interm.type).primarySize) {
John Bauman66b8ab22014-05-06 15:57:45 -04002823 case 1: op = EOpConstructInt; break;
2824 case 2: FRAG_VERT_ONLY("ivec2", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec2; break;
2825 case 3: FRAG_VERT_ONLY("ivec3", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec3; break;
2826 case 4: FRAG_VERT_ONLY("ivec4", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec4; break;
2827 }
2828 break;
2829 case EbtBool:
Alexis Hetub14178b2015-04-13 13:23:20 -04002830 switch((yyvsp[(1) - (1)].interm.type).primarySize) {
John Bauman66b8ab22014-05-06 15:57:45 -04002831 case 1: op = EOpConstructBool; break;
2832 case 2: FRAG_VERT_ONLY("bvec2", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec2; break;
2833 case 3: FRAG_VERT_ONLY("bvec3", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec3; break;
2834 case 4: FRAG_VERT_ONLY("bvec4", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec4; break;
2835 }
2836 break;
2837 default: break;
2838 }
2839 if (op == EOpNull) {
2840 context->error((yyvsp[(1) - (1)].interm.type).line, "cannot construct this type", getBasicString((yyvsp[(1) - (1)].interm.type).type));
2841 context->recover();
2842 (yyvsp[(1) - (1)].interm.type).type = EbtFloat;
2843 op = EOpConstructFloat;
2844 }
2845 }
2846 TString tempString;
2847 TType type((yyvsp[(1) - (1)].interm.type));
2848 TFunction *function = new TFunction(&tempString, type, op);
2849 (yyval.interm.function) = function;
2850 }
2851 break;
2852
John Bauman66b8ab22014-05-06 15:57:45 -04002853 case 27:
2854
2855 {
2856 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
2857 context->recover();
2858 TType type(EbtVoid, EbpUndefined);
2859 TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type);
2860 (yyval.interm.function) = function;
2861 }
2862 break;
2863
2864 case 28:
2865
2866 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002867 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
2868 context->recover();
2869 TType type(EbtVoid, EbpUndefined);
2870 TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type);
2871 (yyval.interm.function) = function;
John Bauman66b8ab22014-05-06 15:57:45 -04002872 }
2873 break;
2874
2875 case 29:
2876
2877 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002878 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
2879 }
2880 break;
2881
2882 case 30:
2883
2884 {
John Bauman66b8ab22014-05-06 15:57:45 -04002885 if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)))
2886 context->recover();
John Baumand4ae8632014-05-06 16:18:33 -04002887 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreIncrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002888 if ((yyval.interm.intermTypedNode) == 0) {
2889 context->unaryOpError((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2890 context->recover();
2891 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2892 }
2893 }
2894 break;
2895
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002896 case 31:
John Bauman66b8ab22014-05-06 15:57:45 -04002897
2898 {
2899 if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)))
2900 context->recover();
John Baumand4ae8632014-05-06 16:18:33 -04002901 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreDecrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002902 if ((yyval.interm.intermTypedNode) == 0) {
2903 context->unaryOpError((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2904 context->recover();
2905 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2906 }
2907 }
2908 break;
2909
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002910 case 32:
John Bauman66b8ab22014-05-06 15:57:45 -04002911
2912 {
2913 if ((yyvsp[(1) - (2)].interm).op != EOpNull) {
John Baumand4ae8632014-05-06 16:18:33 -04002914 (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 -04002915 if ((yyval.interm.intermTypedNode) == 0) {
2916 const char* errorOp = "";
2917 switch((yyvsp[(1) - (2)].interm).op) {
2918 case EOpNegative: errorOp = "-"; break;
2919 case EOpLogicalNot: errorOp = "!"; break;
2920 default: break;
2921 }
2922 context->unaryOpError((yyvsp[(1) - (2)].interm).line, errorOp, (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2923 context->recover();
2924 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2925 }
2926 } else
2927 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2928 }
2929 break;
2930
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002931 case 33:
John Bauman66b8ab22014-05-06 15:57:45 -04002932
2933 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNull; }
2934 break;
2935
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002936 case 34:
John Bauman66b8ab22014-05-06 15:57:45 -04002937
2938 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNegative; }
2939 break;
2940
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002941 case 35:
John Bauman66b8ab22014-05-06 15:57:45 -04002942
2943 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpLogicalNot; }
2944 break;
2945
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002946 case 36:
John Bauman66b8ab22014-05-06 15:57:45 -04002947
2948 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
2949 break;
2950
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002951 case 37:
John Bauman66b8ab22014-05-06 15:57:45 -04002952
2953 {
2954 FRAG_VERT_ONLY("*", (yyvsp[(2) - (3)].lex).line);
John Baumand4ae8632014-05-06 16:18:33 -04002955 (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 -04002956 if ((yyval.interm.intermTypedNode) == 0) {
2957 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "*", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2958 context->recover();
2959 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2960 }
2961 }
2962 break;
2963
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002964 case 38:
John Bauman66b8ab22014-05-06 15:57:45 -04002965
2966 {
2967 FRAG_VERT_ONLY("/", (yyvsp[(2) - (3)].lex).line);
John Baumand4ae8632014-05-06 16:18:33 -04002968 (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 -04002969 if ((yyval.interm.intermTypedNode) == 0) {
2970 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "/", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2971 context->recover();
2972 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2973 }
2974 }
2975 break;
2976
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002977 case 39:
John Bauman66b8ab22014-05-06 15:57:45 -04002978
2979 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
2980 break;
2981
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002982 case 40:
John Bauman66b8ab22014-05-06 15:57:45 -04002983
2984 {
John Baumand4ae8632014-05-06 16:18:33 -04002985 (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 -04002986 if ((yyval.interm.intermTypedNode) == 0) {
2987 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "+", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2988 context->recover();
2989 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2990 }
2991 }
2992 break;
2993
Nicolas Capens2c1239f2015-02-17 17:30:04 -05002994 case 41:
John Bauman66b8ab22014-05-06 15:57:45 -04002995
2996 {
John Baumand4ae8632014-05-06 16:18:33 -04002997 (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 -04002998 if ((yyval.interm.intermTypedNode) == 0) {
2999 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "-", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3000 context->recover();
3001 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
3002 }
3003 }
3004 break;
3005
John Bauman66b8ab22014-05-06 15:57:45 -04003006 case 42:
3007
3008 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
3009 break;
3010
3011 case 43:
3012
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003013 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
3014 break;
3015
3016 case 44:
3017
John Bauman66b8ab22014-05-06 15:57:45 -04003018 {
John Baumand4ae8632014-05-06 16:18:33 -04003019 (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 -04003020 if ((yyval.interm.intermTypedNode) == 0) {
3021 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3022 context->recover();
3023 ConstantUnion *unionArray = new ConstantUnion[1];
3024 unionArray->setBConst(false);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05003025 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConstExpr), (yyvsp[(2) - (3)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003026 }
3027 }
3028 break;
3029
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003030 case 45:
John Bauman66b8ab22014-05-06 15:57:45 -04003031
3032 {
John Baumand4ae8632014-05-06 16:18:33 -04003033 (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 -04003034 if ((yyval.interm.intermTypedNode) == 0) {
3035 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3036 context->recover();
3037 ConstantUnion *unionArray = new ConstantUnion[1];
3038 unionArray->setBConst(false);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05003039 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConstExpr), (yyvsp[(2) - (3)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003040 }
3041 }
3042 break;
3043
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003044 case 46:
John Bauman66b8ab22014-05-06 15:57:45 -04003045
3046 {
John Baumand4ae8632014-05-06 16:18:33 -04003047 (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 -04003048 if ((yyval.interm.intermTypedNode) == 0) {
3049 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3050 context->recover();
3051 ConstantUnion *unionArray = new ConstantUnion[1];
3052 unionArray->setBConst(false);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05003053 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConstExpr), (yyvsp[(2) - (3)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003054 }
3055 }
3056 break;
3057
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003058 case 47:
John Bauman66b8ab22014-05-06 15:57:45 -04003059
3060 {
John Baumand4ae8632014-05-06 16:18:33 -04003061 (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 -04003062 if ((yyval.interm.intermTypedNode) == 0) {
3063 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3064 context->recover();
3065 ConstantUnion *unionArray = new ConstantUnion[1];
3066 unionArray->setBConst(false);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05003067 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConstExpr), (yyvsp[(2) - (3)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003068 }
3069 }
3070 break;
3071
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003072 case 48:
John Bauman66b8ab22014-05-06 15:57:45 -04003073
3074 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
3075 break;
3076
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003077 case 49:
John Bauman66b8ab22014-05-06 15:57:45 -04003078
3079 {
John Baumand4ae8632014-05-06 16:18:33 -04003080 (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 -04003081 if ((yyval.interm.intermTypedNode) == 0) {
3082 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "==", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3083 context->recover();
3084 ConstantUnion *unionArray = new ConstantUnion[1];
3085 unionArray->setBConst(false);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05003086 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConstExpr), (yyvsp[(2) - (3)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003087 }
3088 }
3089 break;
3090
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003091 case 50:
John Bauman66b8ab22014-05-06 15:57:45 -04003092
3093 {
John Baumand4ae8632014-05-06 16:18:33 -04003094 (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 -04003095 if ((yyval.interm.intermTypedNode) == 0) {
3096 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "!=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3097 context->recover();
3098 ConstantUnion *unionArray = new ConstantUnion[1];
3099 unionArray->setBConst(false);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05003100 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConstExpr), (yyvsp[(2) - (3)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003101 }
3102 }
3103 break;
3104
John Bauman66b8ab22014-05-06 15:57:45 -04003105 case 51:
3106
3107 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
3108 break;
3109
3110 case 52:
3111
3112 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
3113 break;
3114
3115 case 53:
3116
3117 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
3118 break;
3119
3120 case 54:
3121
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003122 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
3123 break;
3124
3125 case 55:
3126
John Bauman66b8ab22014-05-06 15:57:45 -04003127 {
John Baumand4ae8632014-05-06 16:18:33 -04003128 (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 -04003129 if ((yyval.interm.intermTypedNode) == 0) {
3130 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "&&", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3131 context->recover();
3132 ConstantUnion *unionArray = new ConstantUnion[1];
3133 unionArray->setBConst(false);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05003134 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConstExpr), (yyvsp[(2) - (3)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003135 }
3136 }
3137 break;
3138
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003139 case 56:
John Bauman66b8ab22014-05-06 15:57:45 -04003140
3141 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
3142 break;
3143
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003144 case 57:
John Bauman66b8ab22014-05-06 15:57:45 -04003145
3146 {
John Baumand4ae8632014-05-06 16:18:33 -04003147 (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 -04003148 if ((yyval.interm.intermTypedNode) == 0) {
3149 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "^^", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3150 context->recover();
3151 ConstantUnion *unionArray = new ConstantUnion[1];
3152 unionArray->setBConst(false);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05003153 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConstExpr), (yyvsp[(2) - (3)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003154 }
3155 }
3156 break;
3157
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003158 case 58:
John Bauman66b8ab22014-05-06 15:57:45 -04003159
3160 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
3161 break;
3162
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003163 case 59:
John Bauman66b8ab22014-05-06 15:57:45 -04003164
3165 {
John Baumand4ae8632014-05-06 16:18:33 -04003166 (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 -04003167 if ((yyval.interm.intermTypedNode) == 0) {
3168 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "||", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3169 context->recover();
3170 ConstantUnion *unionArray = new ConstantUnion[1];
3171 unionArray->setBConst(false);
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05003172 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConstExpr), (yyvsp[(2) - (3)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003173 }
3174 }
3175 break;
3176
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003177 case 60:
John Bauman66b8ab22014-05-06 15:57:45 -04003178
3179 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
3180 break;
3181
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003182 case 61:
John Bauman66b8ab22014-05-06 15:57:45 -04003183
3184 {
3185 if (context->boolErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.intermTypedNode)))
3186 context->recover();
3187
3188 (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);
3189 if ((yyvsp[(3) - (5)].interm.intermTypedNode)->getType() != (yyvsp[(5) - (5)].interm.intermTypedNode)->getType())
3190 (yyval.interm.intermTypedNode) = 0;
3191
3192 if ((yyval.interm.intermTypedNode) == 0) {
3193 context->binaryOpError((yyvsp[(2) - (5)].lex).line, ":", (yyvsp[(3) - (5)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(5) - (5)].interm.intermTypedNode)->getCompleteString());
3194 context->recover();
3195 (yyval.interm.intermTypedNode) = (yyvsp[(5) - (5)].interm.intermTypedNode);
3196 }
3197 }
3198 break;
3199
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003200 case 62:
John Bauman66b8ab22014-05-06 15:57:45 -04003201
3202 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
3203 break;
3204
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003205 case 63:
John Bauman66b8ab22014-05-06 15:57:45 -04003206
3207 {
3208 if (context->lValueErrorCheck((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)))
3209 context->recover();
3210 (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);
3211 if ((yyval.interm.intermTypedNode) == 0) {
3212 context->assignError((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3213 context->recover();
3214 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
3215 }
3216 }
3217 break;
3218
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003219 case 64:
John Bauman66b8ab22014-05-06 15:57:45 -04003220
3221 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAssign; }
3222 break;
3223
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003224 case 65:
John Bauman66b8ab22014-05-06 15:57:45 -04003225
3226 { FRAG_VERT_ONLY("*=", (yyvsp[(1) - (1)].lex).line); (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpMulAssign; }
3227 break;
3228
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003229 case 66:
John Bauman66b8ab22014-05-06 15:57:45 -04003230
3231 { FRAG_VERT_ONLY("/=", (yyvsp[(1) - (1)].lex).line); (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpDivAssign; }
3232 break;
3233
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003234 case 67:
John Bauman66b8ab22014-05-06 15:57:45 -04003235
3236 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAddAssign; }
3237 break;
3238
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003239 case 68:
John Bauman66b8ab22014-05-06 15:57:45 -04003240
3241 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpSubAssign; }
3242 break;
3243
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003244 case 69:
John Bauman66b8ab22014-05-06 15:57:45 -04003245
3246 {
3247 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
3248 }
3249 break;
3250
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003251 case 70:
John Bauman66b8ab22014-05-06 15:57:45 -04003252
3253 {
3254 (yyval.interm.intermTypedNode) = context->intermediate.addComma((yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
3255 if ((yyval.interm.intermTypedNode) == 0) {
3256 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ",", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3257 context->recover();
3258 (yyval.interm.intermTypedNode) = (yyvsp[(3) - (3)].interm.intermTypedNode);
3259 }
3260 }
3261 break;
3262
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003263 case 71:
John Bauman66b8ab22014-05-06 15:57:45 -04003264
3265 {
3266 if (context->constErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)))
3267 context->recover();
3268 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
3269 }
3270 break;
3271
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003272 case 72:
John Bauman66b8ab22014-05-06 15:57:45 -04003273
3274 {
3275 TFunction &function = *((yyvsp[(1) - (2)].interm).function);
3276
3277 TIntermAggregate *prototype = new TIntermAggregate;
3278 prototype->setType(function.getReturnType());
3279 prototype->setName(function.getName());
3280
3281 for (int i = 0; i < function.getParamCount(); i++)
3282 {
3283 const TParameter &param = function.getParam(i);
3284 if (param.name != 0)
3285 {
John Baumand4ae8632014-05-06 16:18:33 -04003286 TVariable variable(param.name, *param.type);
John Bauman66b8ab22014-05-06 15:57:45 -04003287
John Baumand4ae8632014-05-06 16:18:33 -04003288 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 -04003289 }
3290 else
3291 {
3292 prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (2)].interm).line), (yyvsp[(1) - (2)].interm).line);
3293 }
3294 }
3295
3296 prototype->setOp(EOpPrototype);
3297 (yyval.interm.intermNode) = prototype;
3298
3299 context->symbolTable.pop();
3300 }
3301 break;
3302
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003303 case 73:
John Bauman66b8ab22014-05-06 15:57:45 -04003304
3305 {
3306 if ((yyvsp[(1) - (2)].interm).intermAggregate)
3307 (yyvsp[(1) - (2)].interm).intermAggregate->setOp(EOpDeclaration);
3308 (yyval.interm.intermNode) = (yyvsp[(1) - (2)].interm).intermAggregate;
3309 }
3310 break;
3311
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003312 case 74:
John Bauman66b8ab22014-05-06 15:57:45 -04003313
3314 {
John Baumand4ae8632014-05-06 16:18:33 -04003315 if (!context->symbolTable.setDefaultPrecision( (yyvsp[(3) - (4)].interm.type), (yyvsp[(2) - (4)].interm.precision) )) {
3316 context->error((yyvsp[(1) - (4)].lex).line, "illegal type argument for default precision qualifier", getBasicString((yyvsp[(3) - (4)].interm.type).type));
3317 context->recover();
3318 }
John Bauman66b8ab22014-05-06 15:57:45 -04003319 (yyval.interm.intermNode) = 0;
3320 }
3321 break;
3322
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003323 case 75:
John Bauman66b8ab22014-05-06 15:57:45 -04003324
3325 {
3326 //
3327 // Multiple declarations of the same function are allowed.
3328 //
3329 // If this is a definition, the definition production code will check for redefinitions
3330 // (we don't know at this point if it's a definition or not).
3331 //
3332 // Redeclarations are allowed. But, return types and parameter qualifiers must match.
3333 //
Nicolas Capens0a7f0c22015-02-18 14:47:31 -05003334 TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find((yyvsp[(1) - (2)].interm.function)->getMangledName(), context->shaderVersion));
John Bauman66b8ab22014-05-06 15:57:45 -04003335 if (prevDec) {
3336 if (prevDec->getReturnType() != (yyvsp[(1) - (2)].interm.function)->getReturnType()) {
3337 context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same return type", (yyvsp[(1) - (2)].interm.function)->getReturnType().getBasicString());
3338 context->recover();
3339 }
3340 for (int i = 0; i < prevDec->getParamCount(); ++i) {
3341 if (prevDec->getParam(i).type->getQualifier() != (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifier()) {
3342 context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same parameter qualifiers", (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifierString());
3343 context->recover();
3344 }
3345 }
3346 }
3347
3348 //
3349 // If this is a redeclaration, it could also be a definition,
3350 // in which case, we want to use the variable names from this one, and not the one that's
3351 // being redeclared. So, pass back up this declaration, not the one in the symbol table.
3352 //
3353 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
3354 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
3355
3356 // We're at the inner scope level of the function's arguments and body statement.
3357 // Add the function prototype to the surrounding scope instead.
3358 context->symbolTable.getOuterLevel()->insert(*(yyval.interm).function);
3359 }
3360 break;
3361
John Bauman66b8ab22014-05-06 15:57:45 -04003362 case 76:
3363
3364 {
3365 (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
3366 }
3367 break;
3368
3369 case 77:
3370
3371 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003372 (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
3373 }
3374 break;
3375
3376 case 78:
3377
3378 {
John Bauman66b8ab22014-05-06 15:57:45 -04003379 // Add the parameter
3380 (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
3381 if ((yyvsp[(2) - (2)].interm).param.type->getBasicType() != EbtVoid)
3382 (yyvsp[(1) - (2)].interm.function)->addParameter((yyvsp[(2) - (2)].interm).param);
3383 else
3384 delete (yyvsp[(2) - (2)].interm).param.type;
3385 }
3386 break;
3387
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003388 case 79:
John Bauman66b8ab22014-05-06 15:57:45 -04003389
3390 {
3391 //
3392 // Only first parameter of one-parameter functions can be void
3393 // The check for named parameters not being void is done in parameter_declarator
3394 //
3395 if ((yyvsp[(3) - (3)].interm).param.type->getBasicType() == EbtVoid) {
3396 //
3397 // This parameter > first is void
3398 //
3399 context->error((yyvsp[(2) - (3)].lex).line, "cannot be an argument type except for '(void)'", "void");
3400 context->recover();
3401 delete (yyvsp[(3) - (3)].interm).param.type;
3402 } else {
3403 // Add the parameter
3404 (yyval.interm.function) = (yyvsp[(1) - (3)].interm.function);
3405 (yyvsp[(1) - (3)].interm.function)->addParameter((yyvsp[(3) - (3)].interm).param);
3406 }
3407 }
3408 break;
3409
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003410 case 80:
John Bauman66b8ab22014-05-06 15:57:45 -04003411
3412 {
3413 if ((yyvsp[(1) - (3)].interm.type).qualifier != EvqGlobal && (yyvsp[(1) - (3)].interm.type).qualifier != EvqTemporary) {
3414 context->error((yyvsp[(2) - (3)].lex).line, "no qualifiers allowed for function return", getQualifierString((yyvsp[(1) - (3)].interm.type).qualifier));
3415 context->recover();
3416 }
3417 // make sure a sampler is not involved as well...
3418 if (context->structQualifierErrorCheck((yyvsp[(2) - (3)].lex).line, (yyvsp[(1) - (3)].interm.type)))
3419 context->recover();
3420
3421 // Add the function as a prototype after parsing it (we do not support recursion)
3422 TFunction *function;
3423 TType type((yyvsp[(1) - (3)].interm.type));
3424 function = new TFunction((yyvsp[(2) - (3)].lex).string, type);
3425 (yyval.interm.function) = function;
3426
3427 context->symbolTable.push();
3428 }
3429 break;
3430
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003431 case 81:
John Bauman66b8ab22014-05-06 15:57:45 -04003432
3433 {
3434 if ((yyvsp[(1) - (2)].interm.type).type == EbtVoid) {
3435 context->error((yyvsp[(2) - (2)].lex).line, "illegal use of type 'void'", (yyvsp[(2) - (2)].lex).string->c_str());
3436 context->recover();
3437 }
3438 if (context->reservedErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string))
3439 context->recover();
3440 TParameter param = {(yyvsp[(2) - (2)].lex).string, new TType((yyvsp[(1) - (2)].interm.type))};
3441 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
3442 (yyval.interm).param = param;
3443 }
3444 break;
3445
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003446 case 82:
John Bauman66b8ab22014-05-06 15:57:45 -04003447
3448 {
3449 // Check that we can make an array out of this type
3450 if (context->arrayTypeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
3451 context->recover();
3452
3453 if (context->reservedErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string))
3454 context->recover();
3455
3456 int size;
3457 if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3458 context->recover();
3459 (yyvsp[(1) - (5)].interm.type).setArray(true, size);
3460
3461 TType* type = new TType((yyvsp[(1) - (5)].interm.type));
3462 TParameter param = { (yyvsp[(2) - (5)].lex).string, type };
3463 (yyval.interm).line = (yyvsp[(2) - (5)].lex).line;
3464 (yyval.interm).param = param;
3465 }
3466 break;
3467
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003468 case 83:
John Bauman66b8ab22014-05-06 15:57:45 -04003469
3470 {
3471 (yyval.interm) = (yyvsp[(3) - (3)].interm);
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003472 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 -04003473 context->recover();
3474 }
3475 break;
3476
John Bauman66b8ab22014-05-06 15:57:45 -04003477 case 84:
3478
3479 {
John Bauman66b8ab22014-05-06 15:57:45 -04003480 (yyval.interm) = (yyvsp[(2) - (2)].interm);
3481 if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
3482 context->recover();
3483 if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
3484 context->recover();
3485 }
3486 break;
3487
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003488 case 85:
3489
3490 {
3491 (yyval.interm) = (yyvsp[(3) - (3)].interm);
3492 if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.qualifier), (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
3493 context->recover();
3494 }
3495 break;
3496
John Bauman66b8ab22014-05-06 15:57:45 -04003497 case 86:
3498
3499 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003500 (yyval.interm) = (yyvsp[(2) - (2)].interm);
3501 if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
3502 context->recover();
3503 if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
3504 context->recover();
John Bauman66b8ab22014-05-06 15:57:45 -04003505 }
3506 break;
3507
3508 case 87:
3509
3510 {
3511 (yyval.interm.qualifier) = EvqIn;
3512 }
3513 break;
3514
3515 case 88:
3516
3517 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003518 (yyval.interm.qualifier) = EvqIn;
John Bauman66b8ab22014-05-06 15:57:45 -04003519 }
3520 break;
3521
3522 case 89:
3523
3524 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003525 (yyval.interm.qualifier) = EvqOut;
John Bauman66b8ab22014-05-06 15:57:45 -04003526 }
3527 break;
3528
3529 case 90:
3530
3531 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003532 (yyval.interm.qualifier) = EvqInOut;
3533 }
3534 break;
3535
3536 case 91:
3537
3538 {
John Bauman66b8ab22014-05-06 15:57:45 -04003539 TParameter param = { 0, new TType((yyvsp[(1) - (1)].interm.type)) };
3540 (yyval.interm).param = param;
3541 }
3542 break;
3543
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003544 case 92:
John Bauman66b8ab22014-05-06 15:57:45 -04003545
3546 {
3547 (yyval.interm) = (yyvsp[(1) - (1)].interm);
3548 }
3549 break;
3550
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003551 case 93:
John Bauman66b8ab22014-05-06 15:57:45 -04003552
3553 {
3554 if ((yyvsp[(1) - (3)].interm).type.type == EbtInvariant && !(yyvsp[(3) - (3)].lex).symbol)
3555 {
3556 context->error((yyvsp[(3) - (3)].lex).line, "undeclared identifier declared as invariant", (yyvsp[(3) - (3)].lex).string->c_str());
3557 context->recover();
3558 }
3559
3560 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(3) - (3)].lex).string, TType((yyvsp[(1) - (3)].interm).type), (yyvsp[(3) - (3)].lex).line);
3561 (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermNode, symbol, (yyvsp[(3) - (3)].lex).line);
3562
3563 if (context->structQualifierErrorCheck((yyvsp[(3) - (3)].lex).line, (yyval.interm).type))
3564 context->recover();
3565
3566 if (context->nonInitConstErrorCheck((yyvsp[(3) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyval.interm).type, false))
3567 context->recover();
3568
3569 TVariable* variable = 0;
3570 if (context->nonInitErrorCheck((yyvsp[(3) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyval.interm).type, variable))
3571 context->recover();
3572 if (symbol && variable)
3573 symbol->setId(variable->getUniqueId());
3574 }
3575 break;
3576
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003577 case 94:
John Bauman66b8ab22014-05-06 15:57:45 -04003578
3579 {
3580 if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
3581 context->recover();
3582
3583 if (context->nonInitConstErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, true))
3584 context->recover();
3585
3586 (yyval.interm) = (yyvsp[(1) - (5)].interm);
3587
3588 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))
3589 context->recover();
3590 else {
3591 (yyvsp[(1) - (5)].interm).type.setArray(true);
3592 TVariable* variable;
3593 if (context->arrayErrorCheck((yyvsp[(4) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, variable))
3594 context->recover();
3595 }
3596 }
3597 break;
3598
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003599 case 95:
John Bauman66b8ab22014-05-06 15:57:45 -04003600
3601 {
3602 if (context->structQualifierErrorCheck((yyvsp[(3) - (6)].lex).line, (yyvsp[(1) - (6)].interm).type))
3603 context->recover();
3604
3605 if (context->nonInitConstErrorCheck((yyvsp[(3) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type, true))
3606 context->recover();
3607
3608 (yyval.interm) = (yyvsp[(1) - (6)].interm);
3609
3610 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))
3611 context->recover();
3612 else {
3613 int size;
3614 if (context->arraySizeErrorCheck((yyvsp[(4) - (6)].lex).line, (yyvsp[(5) - (6)].interm.intermTypedNode), size))
3615 context->recover();
3616 (yyvsp[(1) - (6)].interm).type.setArray(true, size);
3617 TVariable* variable = 0;
3618 if (context->arrayErrorCheck((yyvsp[(4) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type, variable))
3619 context->recover();
3620 TType type = TType((yyvsp[(1) - (6)].interm).type);
3621 type.setArraySize(size);
3622 (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);
3623 }
3624 }
3625 break;
3626
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003627 case 96:
John Bauman66b8ab22014-05-06 15:57:45 -04003628
3629 {
3630 if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
3631 context->recover();
3632
3633 (yyval.interm) = (yyvsp[(1) - (5)].interm);
3634
3635 TIntermNode* intermNode;
3636 if (!context->executeInitializer((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, (yyvsp[(5) - (5)].interm.intermTypedNode), intermNode)) {
3637 //
3638 // build the intermediate representation
3639 //
3640 if (intermNode)
3641 (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (5)].interm).intermNode, intermNode, (yyvsp[(4) - (5)].lex).line);
3642 else
3643 (yyval.interm).intermAggregate = (yyvsp[(1) - (5)].interm).intermAggregate;
3644 } else {
3645 context->recover();
3646 (yyval.interm).intermAggregate = 0;
3647 }
3648 }
3649 break;
3650
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003651 case 97:
John Bauman66b8ab22014-05-06 15:57:45 -04003652
3653 {
3654 (yyval.interm).type = (yyvsp[(1) - (1)].interm.type);
3655 (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);
3656 }
3657 break;
3658
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003659 case 98:
John Bauman66b8ab22014-05-06 15:57:45 -04003660
3661 {
3662 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyvsp[(1) - (2)].interm.type)), (yyvsp[(2) - (2)].lex).line);
3663 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (2)].lex).line);
3664
3665 if (context->structQualifierErrorCheck((yyvsp[(2) - (2)].lex).line, (yyval.interm).type))
3666 context->recover();
3667
3668 if (context->nonInitConstErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string, (yyval.interm).type, false))
3669 context->recover();
3670
3671 (yyval.interm).type = (yyvsp[(1) - (2)].interm.type);
3672
3673 TVariable* variable = 0;
3674 if (context->nonInitErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string, (yyval.interm).type, variable))
3675 context->recover();
3676 if (variable && symbol)
3677 symbol->setId(variable->getUniqueId());
3678 }
3679 break;
3680
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003681 case 99:
John Bauman66b8ab22014-05-06 15:57:45 -04003682
3683 {
3684 context->error((yyvsp[(2) - (4)].lex).line, "unsized array declarations not supported", (yyvsp[(2) - (4)].lex).string->c_str());
3685 context->recover();
3686
3687 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (4)].lex).string, TType((yyvsp[(1) - (4)].interm.type)), (yyvsp[(2) - (4)].lex).line);
3688 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (4)].lex).line);
3689 (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
3690 }
3691 break;
3692
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003693 case 100:
John Bauman66b8ab22014-05-06 15:57:45 -04003694
3695 {
3696 TType type = TType((yyvsp[(1) - (5)].interm.type));
3697 int size;
3698 if (context->arraySizeErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3699 context->recover();
3700 type.setArraySize(size);
3701 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (5)].lex).string, type, (yyvsp[(2) - (5)].lex).line);
3702 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (5)].lex).line);
3703
3704 if (context->structQualifierErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
3705 context->recover();
3706
3707 if (context->nonInitConstErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type), true))
3708 context->recover();
3709
3710 (yyval.interm).type = (yyvsp[(1) - (5)].interm.type);
3711
3712 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)))
3713 context->recover();
3714 else {
3715 int size;
3716 if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3717 context->recover();
3718
3719 (yyvsp[(1) - (5)].interm.type).setArray(true, size);
3720 TVariable* variable = 0;
3721 if (context->arrayErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type), variable))
3722 context->recover();
3723 if (variable && symbol)
3724 symbol->setId(variable->getUniqueId());
3725 }
3726 }
3727 break;
3728
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003729 case 101:
John Bauman66b8ab22014-05-06 15:57:45 -04003730
3731 {
3732 if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
3733 context->recover();
3734
3735 (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
3736
3737 TIntermNode* intermNode;
3738 if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode)) {
3739 //
3740 // Build intermediate representation
3741 //
3742 if(intermNode)
3743 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(intermNode, (yyvsp[(3) - (4)].lex).line);
3744 else
3745 (yyval.interm).intermAggregate = 0;
3746 } else {
3747 context->recover();
3748 (yyval.interm).intermAggregate = 0;
3749 }
3750 }
3751 break;
3752
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003753 case 102:
John Bauman66b8ab22014-05-06 15:57:45 -04003754
3755 {
John Bauman66b8ab22014-05-06 15:57:45 -04003756 if (context->globalErrorCheck((yyvsp[(1) - (2)].lex).line, context->symbolTable.atGlobalLevel(), "invariant varying"))
3757 context->recover();
3758 (yyval.interm).type.setBasic(EbtInvariant, EvqInvariantVaryingOut, (yyvsp[(2) - (2)].lex).line);
3759 if (!(yyvsp[(2) - (2)].lex).symbol)
3760 {
3761 context->error((yyvsp[(2) - (2)].lex).line, "undeclared identifier declared as invariant", (yyvsp[(2) - (2)].lex).string->c_str());
3762 context->recover();
3763
3764 (yyval.interm).intermAggregate = 0;
3765 }
3766 else
3767 {
3768 TIntermSymbol *symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyval.interm).type), (yyvsp[(2) - (2)].lex).line);
3769 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (2)].lex).line);
3770 }
3771 }
3772 break;
3773
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003774 case 103:
John Bauman66b8ab22014-05-06 15:57:45 -04003775
3776 {
3777 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3778
3779 if ((yyvsp[(1) - (1)].interm.type).array) {
3780 context->error((yyvsp[(1) - (1)].interm.type).line, "not supported", "first-class array");
3781 context->recover();
3782 (yyvsp[(1) - (1)].interm.type).setArray(false);
3783 }
3784 }
3785 break;
3786
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003787 case 104:
John Bauman66b8ab22014-05-06 15:57:45 -04003788
3789 {
3790 if ((yyvsp[(2) - (2)].interm.type).array) {
3791 context->error((yyvsp[(2) - (2)].interm.type).line, "not supported", "first-class array");
3792 context->recover();
3793 (yyvsp[(2) - (2)].interm.type).setArray(false);
3794 }
3795
3796 if ((yyvsp[(1) - (2)].interm.type).qualifier == EvqAttribute &&
3797 ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
3798 context->error((yyvsp[(2) - (2)].interm.type).line, "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier));
3799 context->recover();
3800 }
3801 if (((yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingIn || (yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingOut) &&
3802 ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
3803 context->error((yyvsp[(2) - (2)].interm.type).line, "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier));
3804 context->recover();
3805 }
3806 (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
3807 (yyval.interm.type).qualifier = (yyvsp[(1) - (2)].interm.type).qualifier;
3808 }
3809 break;
3810
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003811 case 105:
John Bauman66b8ab22014-05-06 15:57:45 -04003812
3813 {
Nicolas Capensb1e911a2015-02-26 13:16:00 -05003814 (yyval.interm.qualifier) = EvqConstReadOnly;
John Bauman66b8ab22014-05-06 15:57:45 -04003815 }
3816 break;
3817
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003818 case 106:
John Bauman66b8ab22014-05-06 15:57:45 -04003819
3820 {
3821 VERTEX_ONLY("attribute", (yyvsp[(1) - (1)].lex).line);
Nicolas Capensc6841852015-02-15 14:25:37 -05003822 ES2_ONLY("attribute", (yyvsp[(1) - (1)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003823 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "attribute"))
3824 context->recover();
3825 (yyval.interm.type).setBasic(EbtVoid, EvqAttribute, (yyvsp[(1) - (1)].lex).line);
3826 }
3827 break;
3828
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003829 case 107:
John Bauman66b8ab22014-05-06 15:57:45 -04003830
3831 {
Nicolas Capensc6841852015-02-15 14:25:37 -05003832 ES2_ONLY("varying", (yyvsp[(1) - (1)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003833 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "varying"))
3834 context->recover();
Nicolas Capens08ca3c62015-02-13 16:06:45 -05003835 if (context->shaderType == GL_VERTEX_SHADER)
John Bauman66b8ab22014-05-06 15:57:45 -04003836 (yyval.interm.type).setBasic(EbtVoid, EvqVaryingOut, (yyvsp[(1) - (1)].lex).line);
3837 else
3838 (yyval.interm.type).setBasic(EbtVoid, EvqVaryingIn, (yyvsp[(1) - (1)].lex).line);
3839 }
3840 break;
3841
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003842 case 108:
John Bauman66b8ab22014-05-06 15:57:45 -04003843
3844 {
Nicolas Capensc6841852015-02-15 14:25:37 -05003845 ES2_ONLY("varying", (yyvsp[(1) - (2)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003846 if (context->globalErrorCheck((yyvsp[(1) - (2)].lex).line, context->symbolTable.atGlobalLevel(), "invariant varying"))
3847 context->recover();
Nicolas Capens08ca3c62015-02-13 16:06:45 -05003848 if (context->shaderType == GL_VERTEX_SHADER)
John Bauman66b8ab22014-05-06 15:57:45 -04003849 (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingOut, (yyvsp[(1) - (2)].lex).line);
3850 else
3851 (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingIn, (yyvsp[(1) - (2)].lex).line);
3852 }
3853 break;
3854
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003855 case 109:
John Bauman66b8ab22014-05-06 15:57:45 -04003856
3857 {
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003858 (yyval.interm.type).setBasic(EbtVoid, (yyvsp[(1) - (1)].interm.type).qualifier, (yyvsp[(1) - (1)].interm.type).line);
John Bauman66b8ab22014-05-06 15:57:45 -04003859 }
3860 break;
3861
Nicolas Capens2c1239f2015-02-17 17:30:04 -05003862 case 110:
John Bauman66b8ab22014-05-06 15:57:45 -04003863
3864 {
Nicolas Capens7d626792015-02-17 17:58:31 -05003865 (yyval.interm.type).qualifier = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3866 (yyval.interm.type).layoutQualifier = (yyvsp[(1) - (1)].interm.layoutQualifier);
3867 }
3868 break;
3869
3870 case 111:
3871
3872 {
3873 (yyval.interm.type).setBasic(EbtVoid, (yyvsp[(2) - (2)].interm.type).qualifier, (yyvsp[(2) - (2)].interm.type).line);
3874 (yyval.interm.type).layoutQualifier = (yyvsp[(1) - (2)].interm.layoutQualifier);
3875 }
3876 break;
3877
3878 case 112:
3879
3880 {
Nicolas Capens31ad2aa2015-02-26 13:14:27 -05003881 (yyval.interm.type).qualifier = EvqConstExpr;
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003882 (yyval.interm.type).line = (yyvsp[(1) - (1)].lex).line;
3883 }
3884 break;
3885
Nicolas Capens7d626792015-02-17 17:58:31 -05003886 case 113:
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003887
3888 {
3889 ES3_ONLY("in", (yyvsp[(1) - (1)].lex).line);
3890 (yyval.interm.type).qualifier = (context->shaderType == GL_FRAGMENT_SHADER) ? EvqVaryingIn : EvqAttribute;
3891 (yyval.interm.type).line = (yyvsp[(1) - (1)].lex).line;
3892 }
3893 break;
3894
Nicolas Capens7d626792015-02-17 17:58:31 -05003895 case 114:
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003896
3897 {
3898 ES3_ONLY("out", (yyvsp[(1) - (1)].lex).line);
3899 (yyval.interm.type).qualifier = (context->shaderType == GL_FRAGMENT_SHADER) ? EvqFragColor : EvqVaryingOut;
3900 (yyval.interm.type).line = (yyvsp[(1) - (1)].lex).line;
3901 }
3902 break;
3903
Nicolas Capens7d626792015-02-17 17:58:31 -05003904 case 115:
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003905
3906 {
3907 ES3_ONLY("in", (yyvsp[(1) - (2)].lex).line);
3908 // FIXME: Handle centroid qualifier
3909 (yyval.interm.type).qualifier = (context->shaderType == GL_FRAGMENT_SHADER) ? EvqVaryingIn : EvqAttribute;
3910 (yyval.interm.type).line = (yyvsp[(2) - (2)].lex).line;
3911 }
3912 break;
3913
Nicolas Capens7d626792015-02-17 17:58:31 -05003914 case 116:
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003915
3916 {
3917 ES3_ONLY("out", (yyvsp[(1) - (2)].lex).line);
3918 // FIXME: Handle centroid qualifier
3919 (yyval.interm.type).qualifier = (context->shaderType == GL_FRAGMENT_SHADER) ? EvqFragColor : EvqVaryingOut;
3920 (yyval.interm.type).line = (yyvsp[(2) - (2)].lex).line;
3921 }
3922 break;
3923
Nicolas Capens7d626792015-02-17 17:58:31 -05003924 case 117:
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003925
3926 {
3927 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "uniform"))
3928 context->recover();
3929 (yyval.interm.type).qualifier = EvqUniform;
3930 (yyval.interm.type).line = (yyvsp[(1) - (1)].lex).line;
3931 }
3932 break;
3933
Nicolas Capens7d626792015-02-17 17:58:31 -05003934 case 118:
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05003935
3936 {
John Bauman66b8ab22014-05-06 15:57:45 -04003937 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3938
3939 if ((yyval.interm.type).precision == EbpUndefined) {
3940 (yyval.interm.type).precision = context->symbolTable.getDefaultPrecision((yyvsp[(1) - (1)].interm.type).type);
3941 if (context->precisionErrorCheck((yyvsp[(1) - (1)].interm.type).line, (yyval.interm.type).precision, (yyvsp[(1) - (1)].interm.type).type)) {
3942 context->recover();
3943 }
3944 }
3945 }
3946 break;
3947
Nicolas Capens7d626792015-02-17 17:58:31 -05003948 case 119:
John Bauman66b8ab22014-05-06 15:57:45 -04003949
3950 {
3951 (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
3952 (yyval.interm.type).precision = (yyvsp[(1) - (2)].interm.precision);
3953 }
3954 break;
3955
Nicolas Capens7d626792015-02-17 17:58:31 -05003956 case 120:
John Bauman66b8ab22014-05-06 15:57:45 -04003957
3958 {
3959 (yyval.interm.precision) = EbpHigh;
3960 }
3961 break;
3962
Nicolas Capens7d626792015-02-17 17:58:31 -05003963 case 121:
John Bauman66b8ab22014-05-06 15:57:45 -04003964
3965 {
3966 (yyval.interm.precision) = EbpMedium;
3967 }
3968 break;
3969
Nicolas Capens7d626792015-02-17 17:58:31 -05003970 case 122:
John Bauman66b8ab22014-05-06 15:57:45 -04003971
3972 {
3973 (yyval.interm.precision) = EbpLow;
3974 }
3975 break;
3976
Nicolas Capens7d626792015-02-17 17:58:31 -05003977 case 123:
3978
3979 {
3980 ES3_ONLY("layout", (yyvsp[(1) - (4)].lex).line);
3981 (yyval.interm.layoutQualifier) = (yyvsp[(3) - (4)].interm.layoutQualifier);
3982 }
3983 break;
3984
3985 case 124:
3986
3987 {
3988 (yyval.interm.layoutQualifier) = (yyvsp[(1) - (1)].interm.layoutQualifier);
3989 }
3990 break;
3991
3992 case 125:
3993
3994 {
3995 (yyval.interm.layoutQualifier) = context->joinLayoutQualifiers((yyvsp[(1) - (3)].interm.layoutQualifier), (yyvsp[(3) - (3)].interm.layoutQualifier));
3996 }
3997 break;
3998
3999 case 126:
4000
4001 {
4002 (yyval.interm.layoutQualifier) = context->parseLayoutQualifier(*(yyvsp[(1) - (1)].lex).string, (yyvsp[(1) - (1)].lex).line);
4003 }
4004 break;
4005
4006 case 127:
4007
4008 {
4009 (yyval.interm.layoutQualifier) = context->parseLayoutQualifier(*(yyvsp[(1) - (3)].lex).string, (yyvsp[(1) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyvsp[(3) - (3)].lex).i, (yyvsp[(3) - (3)].lex).line);
4010 }
4011 break;
4012
4013 case 128:
4014
4015 {
4016 (yyval.interm.layoutQualifier) = context->parseLayoutQualifier(*(yyvsp[(1) - (3)].lex).string, (yyvsp[(1) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyvsp[(3) - (3)].lex).i, (yyvsp[(3) - (3)].lex).line);
4017 }
4018 break;
4019
4020 case 129:
John Bauman66b8ab22014-05-06 15:57:45 -04004021
4022 {
4023 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
4024 }
4025 break;
4026
Nicolas Capens7d626792015-02-17 17:58:31 -05004027 case 130:
John Bauman66b8ab22014-05-06 15:57:45 -04004028
4029 {
4030 (yyval.interm.type) = (yyvsp[(1) - (4)].interm.type);
4031
4032 if (context->arrayTypeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
4033 context->recover();
4034 else {
4035 int size;
4036 if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
4037 context->recover();
4038 (yyval.interm.type).setArray(true, size);
4039 }
4040 }
4041 break;
4042
Nicolas Capens7d626792015-02-17 17:58:31 -05004043 case 131:
John Bauman66b8ab22014-05-06 15:57:45 -04004044
4045 {
4046 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4047 (yyval.interm.type).setBasic(EbtVoid, qual, (yyvsp[(1) - (1)].lex).line);
4048 }
4049 break;
4050
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05004051 case 132:
4052
4053 {
4054 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
Nicolas Capens7d626792015-02-17 17:58:31 -05004055 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05004056 }
4057 break;
4058
4059 case 133:
4060
4061 {
4062 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
Nicolas Capens7d626792015-02-17 17:58:31 -05004063 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05004064 }
4065 break;
4066
4067 case 134:
4068
4069 {
4070 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
Nicolas Capens7d626792015-02-17 17:58:31 -05004071 (yyval.interm.type).setBasic(EbtUInt, qual, (yyvsp[(1) - (1)].lex).line);
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05004072 }
4073 break;
4074
4075 case 135:
4076
4077 {
Nicolas Capens3c20f802015-02-17 17:17:20 -05004078 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
Nicolas Capens7d626792015-02-17 17:58:31 -05004079 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
4080 }
4081 break;
4082
4083 case 136:
4084
4085 {
4086 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4087 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
4088 (yyval.interm.type).setAggregate(2);
4089 }
4090 break;
4091
4092 case 137:
4093
4094 {
4095 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4096 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
4097 (yyval.interm.type).setAggregate(3);
4098 }
4099 break;
4100
4101 case 138:
4102
4103 {
4104 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4105 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
4106 (yyval.interm.type).setAggregate(4);
4107 }
4108 break;
4109
4110 case 139:
4111
4112 {
4113 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4114 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
4115 (yyval.interm.type).setAggregate(2);
4116 }
4117 break;
4118
4119 case 140:
4120
4121 {
4122 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4123 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
4124 (yyval.interm.type).setAggregate(3);
4125 }
4126 break;
4127
4128 case 141:
4129
4130 {
4131 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4132 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
4133 (yyval.interm.type).setAggregate(4);
4134 }
4135 break;
4136
4137 case 142:
4138
4139 {
4140 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4141 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
4142 (yyval.interm.type).setAggregate(2);
4143 }
4144 break;
4145
4146 case 143:
4147
4148 {
4149 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
Nicolas Capens3c20f802015-02-17 17:17:20 -05004150 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004151 (yyval.interm.type).setAggregate(3);
Nicolas Capens3c20f802015-02-17 17:17:20 -05004152 }
4153 break;
4154
Nicolas Capens7d626792015-02-17 17:58:31 -05004155 case 144:
Nicolas Capens3c20f802015-02-17 17:17:20 -05004156
4157 {
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004158 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004159 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
4160 (yyval.interm.type).setAggregate(4);
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004161 }
4162 break;
4163
Nicolas Capens7d626792015-02-17 17:58:31 -05004164 case 145:
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004165
4166 {
4167 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4168 (yyval.interm.type).setBasic(EbtUInt, qual, (yyvsp[(1) - (1)].lex).line);
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004169 (yyval.interm.type).setAggregate(2);
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004170 }
4171 break;
4172
Nicolas Capens7d626792015-02-17 17:58:31 -05004173 case 146:
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004174
4175 {
4176 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4177 (yyval.interm.type).setBasic(EbtUInt, qual, (yyvsp[(1) - (1)].lex).line);
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004178 (yyval.interm.type).setAggregate(3);
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004179 }
4180 break;
4181
Nicolas Capens7d626792015-02-17 17:58:31 -05004182 case 147:
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004183
4184 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004185 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4186 (yyval.interm.type).setBasic(EbtUInt, qual, (yyvsp[(1) - (1)].lex).line);
4187 (yyval.interm.type).setAggregate(4);
4188 }
4189 break;
4190
Nicolas Capens7d626792015-02-17 17:58:31 -05004191 case 148:
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004192
4193 {
John Bauman66b8ab22014-05-06 15:57:45 -04004194 FRAG_VERT_ONLY("mat2", (yyvsp[(1) - (1)].lex).line);
4195 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4196 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
Alexis Hetub14178b2015-04-13 13:23:20 -04004197 (yyval.interm.type).setMatrix(2, 2);
John Bauman66b8ab22014-05-06 15:57:45 -04004198 }
4199 break;
4200
Nicolas Capens7d626792015-02-17 17:58:31 -05004201 case 149:
John Bauman66b8ab22014-05-06 15:57:45 -04004202
4203 {
4204 FRAG_VERT_ONLY("mat3", (yyvsp[(1) - (1)].lex).line);
4205 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4206 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
Alexis Hetub14178b2015-04-13 13:23:20 -04004207 (yyval.interm.type).setMatrix(3, 3);
John Bauman66b8ab22014-05-06 15:57:45 -04004208 }
4209 break;
4210
Nicolas Capens7d626792015-02-17 17:58:31 -05004211 case 150:
John Bauman66b8ab22014-05-06 15:57:45 -04004212
4213 {
4214 FRAG_VERT_ONLY("mat4", (yyvsp[(1) - (1)].lex).line);
4215 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4216 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
Alexis Hetub14178b2015-04-13 13:23:20 -04004217 (yyval.interm.type).setMatrix(4, 4);
John Bauman66b8ab22014-05-06 15:57:45 -04004218 }
4219 break;
4220
Nicolas Capens7d626792015-02-17 17:58:31 -05004221 case 151:
John Bauman66b8ab22014-05-06 15:57:45 -04004222
4223 {
Alexis Hetub14178b2015-04-13 13:23:20 -04004224 FRAG_VERT_ONLY("mat2x3", (yyvsp[(1) - (1)].lex).line);
4225 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4226 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
4227 (yyval.interm.type).setMatrix(2, 3);
4228 }
4229 break;
4230
4231 case 152:
4232
4233 {
4234 FRAG_VERT_ONLY("mat3x2", (yyvsp[(1) - (1)].lex).line);
4235 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4236 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
4237 (yyval.interm.type).setMatrix(3, 2);
4238 }
4239 break;
4240
4241 case 153:
4242
4243 {
4244 FRAG_VERT_ONLY("mat2x4", (yyvsp[(1) - (1)].lex).line);
4245 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4246 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
4247 (yyval.interm.type).setMatrix(2, 4);
4248 }
4249 break;
4250
4251 case 154:
4252
4253 {
4254 FRAG_VERT_ONLY("mat4x2", (yyvsp[(1) - (1)].lex).line);
4255 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4256 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
4257 (yyval.interm.type).setMatrix(4, 2);
4258 }
4259 break;
4260
4261 case 155:
4262
4263 {
4264 FRAG_VERT_ONLY("mat3x4", (yyvsp[(1) - (1)].lex).line);
4265 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4266 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
4267 (yyval.interm.type).setMatrix(3, 4);
4268 }
4269 break;
4270
4271 case 156:
4272
4273 {
4274 FRAG_VERT_ONLY("mat4x3", (yyvsp[(1) - (1)].lex).line);
4275 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4276 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
4277 (yyval.interm.type).setMatrix(4, 3);
4278 }
4279 break;
4280
4281 case 157:
4282
4283 {
John Bauman66b8ab22014-05-06 15:57:45 -04004284 FRAG_VERT_ONLY("sampler2D", (yyvsp[(1) - (1)].lex).line);
4285 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4286 (yyval.interm.type).setBasic(EbtSampler2D, qual, (yyvsp[(1) - (1)].lex).line);
4287 }
4288 break;
4289
Alexis Hetub14178b2015-04-13 13:23:20 -04004290 case 158:
John Bauman66b8ab22014-05-06 15:57:45 -04004291
4292 {
4293 FRAG_VERT_ONLY("samplerCube", (yyvsp[(1) - (1)].lex).line);
4294 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4295 (yyval.interm.type).setBasic(EbtSamplerCube, qual, (yyvsp[(1) - (1)].lex).line);
4296 }
4297 break;
4298
Alexis Hetub14178b2015-04-13 13:23:20 -04004299 case 159:
John Bauman66b8ab22014-05-06 15:57:45 -04004300
4301 {
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04004302 if (!context->supportsExtension("GL_OES_EGL_image_external")) {
4303 context->error((yyvsp[(1) - (1)].lex).line, "unsupported type", "samplerExternalOES", "");
4304 context->recover();
4305 }
4306 FRAG_VERT_ONLY("samplerExternalOES", (yyvsp[(1) - (1)].lex).line);
4307 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4308 (yyval.interm.type).setBasic(EbtSamplerExternalOES, qual, (yyvsp[(1) - (1)].lex).line);
4309 }
4310 break;
4311
Alexis Hetub14178b2015-04-13 13:23:20 -04004312 case 160:
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04004313
4314 {
Alexis Hetub027aa92015-01-19 15:56:12 -05004315 FRAG_VERT_ONLY("sampler3D", (yyvsp[(1) - (1)].lex).line);
4316 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4317 (yyval.interm.type).setBasic(EbtSampler3D, qual, (yyvsp[(1) - (1)].lex).line);
4318 }
4319 break;
4320
Alexis Hetub14178b2015-04-13 13:23:20 -04004321 case 161:
4322
4323 {
4324 FRAG_VERT_ONLY("sampler2DArray", (yyvsp[(1) - (1)].lex).line);
4325 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4326 (yyval.interm.type).setBasic(EbtSampler2DArray, qual, (yyvsp[(1) - (1)].lex).line);
4327 }
4328 break;
4329
4330 case 162:
4331
4332 {
4333 FRAG_VERT_ONLY("isampler2D", (yyvsp[(1) - (1)].lex).line);
4334 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4335 (yyval.interm.type).setBasic(EbtISampler2D, qual, (yyvsp[(1) - (1)].lex).line);
4336 }
4337 break;
4338
4339 case 163:
4340
4341 {
4342 FRAG_VERT_ONLY("isampler3D", (yyvsp[(1) - (1)].lex).line);
4343 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4344 (yyval.interm.type).setBasic(EbtISampler3D, qual, (yyvsp[(1) - (1)].lex).line);
4345 }
4346 break;
4347
4348 case 164:
4349
4350 {
4351 FRAG_VERT_ONLY("isamplerCube", (yyvsp[(1) - (1)].lex).line);
4352 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4353 (yyval.interm.type).setBasic(EbtISamplerCube, qual, (yyvsp[(1) - (1)].lex).line);
4354 }
4355 break;
4356
4357 case 165:
4358
4359 {
4360 FRAG_VERT_ONLY("isampler2DArray", (yyvsp[(1) - (1)].lex).line);
4361 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4362 (yyval.interm.type).setBasic(EbtISampler2DArray, qual, (yyvsp[(1) - (1)].lex).line);
4363 }
4364 break;
4365
4366 case 166:
4367
4368 {
4369 FRAG_VERT_ONLY("usampler2D", (yyvsp[(1) - (1)].lex).line);
4370 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4371 (yyval.interm.type).setBasic(EbtUSampler2D, qual, (yyvsp[(1) - (1)].lex).line);
4372 }
4373 break;
4374
4375 case 167:
4376
4377 {
4378 FRAG_VERT_ONLY("usampler3D", (yyvsp[(1) - (1)].lex).line);
4379 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4380 (yyval.interm.type).setBasic(EbtUSampler3D, qual, (yyvsp[(1) - (1)].lex).line);
4381 }
4382 break;
4383
4384 case 168:
4385
4386 {
4387 FRAG_VERT_ONLY("usamplerCube", (yyvsp[(1) - (1)].lex).line);
4388 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4389 (yyval.interm.type).setBasic(EbtUSamplerCube, qual, (yyvsp[(1) - (1)].lex).line);
4390 }
4391 break;
4392
4393 case 169:
4394
4395 {
4396 FRAG_VERT_ONLY("usampler2DArray", (yyvsp[(1) - (1)].lex).line);
4397 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4398 (yyval.interm.type).setBasic(EbtUSampler2DArray, qual, (yyvsp[(1) - (1)].lex).line);
4399 }
4400 break;
4401
4402 case 170:
4403
4404 {
4405 FRAG_VERT_ONLY("sampler2DShadow", (yyvsp[(1) - (1)].lex).line);
4406 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4407 (yyval.interm.type).setBasic(EbtSampler2DShadow, qual, (yyvsp[(1) - (1)].lex).line);
4408 }
4409 break;
4410
4411 case 171:
4412
4413 {
4414 FRAG_VERT_ONLY("samplerCubeShadow", (yyvsp[(1) - (1)].lex).line);
4415 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4416 (yyval.interm.type).setBasic(EbtSamplerCubeShadow, qual, (yyvsp[(1) - (1)].lex).line);
4417 }
4418 break;
4419
4420 case 172:
4421
4422 {
4423 FRAG_VERT_ONLY("sampler2DArrayShadow", (yyvsp[(1) - (1)].lex).line);
4424 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4425 (yyval.interm.type).setBasic(EbtSampler2DArrayShadow, qual, (yyvsp[(1) - (1)].lex).line);
4426 }
4427 break;
4428
4429 case 173:
Alexis Hetub027aa92015-01-19 15:56:12 -05004430
4431 {
John Bauman66b8ab22014-05-06 15:57:45 -04004432 FRAG_VERT_ONLY("struct", (yyvsp[(1) - (1)].interm.type).line);
4433 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
4434 (yyval.interm.type).qualifier = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4435 }
4436 break;
4437
Alexis Hetub14178b2015-04-13 13:23:20 -04004438 case 174:
John Bauman66b8ab22014-05-06 15:57:45 -04004439
4440 {
4441 //
4442 // This is for user defined type names. The lexical phase looked up the
4443 // type.
4444 //
4445 TType& structure = static_cast<TVariable*>((yyvsp[(1) - (1)].lex).symbol)->getType();
4446 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
4447 (yyval.interm.type).setBasic(EbtStruct, qual, (yyvsp[(1) - (1)].lex).line);
4448 (yyval.interm.type).userDef = &structure;
4449 }
4450 break;
4451
Alexis Hetub14178b2015-04-13 13:23:20 -04004452 case 175:
John Bauman66b8ab22014-05-06 15:57:45 -04004453
4454 { if (context->enterStructDeclaration((yyvsp[(2) - (3)].lex).line, *(yyvsp[(2) - (3)].lex).string)) context->recover(); }
4455 break;
4456
Alexis Hetub14178b2015-04-13 13:23:20 -04004457 case 176:
John Bauman66b8ab22014-05-06 15:57:45 -04004458
4459 {
4460 if (context->reservedErrorCheck((yyvsp[(2) - (6)].lex).line, *(yyvsp[(2) - (6)].lex).string))
4461 context->recover();
4462
4463 TType* structure = new TType((yyvsp[(5) - (6)].interm.typeList), *(yyvsp[(2) - (6)].lex).string);
4464 TVariable* userTypeDef = new TVariable((yyvsp[(2) - (6)].lex).string, *structure, true);
Nicolas Capensd603ecd2015-02-18 14:52:21 -05004465 if (! context->symbolTable.declare(*userTypeDef)) {
John Bauman66b8ab22014-05-06 15:57:45 -04004466 context->error((yyvsp[(2) - (6)].lex).line, "redefinition", (yyvsp[(2) - (6)].lex).string->c_str(), "struct");
4467 context->recover();
4468 }
4469 (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (6)].lex).line);
4470 (yyval.interm.type).userDef = structure;
4471 context->exitStructDeclaration();
4472 }
4473 break;
4474
Alexis Hetub14178b2015-04-13 13:23:20 -04004475 case 177:
John Bauman66b8ab22014-05-06 15:57:45 -04004476
4477 { if (context->enterStructDeclaration((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string)) context->recover(); }
4478 break;
4479
Alexis Hetub14178b2015-04-13 13:23:20 -04004480 case 178:
John Bauman66b8ab22014-05-06 15:57:45 -04004481
4482 {
4483 TType* structure = new TType((yyvsp[(4) - (5)].interm.typeList), TString(""));
4484 (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (5)].lex).line);
4485 (yyval.interm.type).userDef = structure;
4486 context->exitStructDeclaration();
4487 }
4488 break;
4489
Alexis Hetub14178b2015-04-13 13:23:20 -04004490 case 179:
John Bauman66b8ab22014-05-06 15:57:45 -04004491
4492 {
4493 (yyval.interm.typeList) = (yyvsp[(1) - (1)].interm.typeList);
4494 }
4495 break;
4496
Alexis Hetub14178b2015-04-13 13:23:20 -04004497 case 180:
John Bauman66b8ab22014-05-06 15:57:45 -04004498
4499 {
4500 (yyval.interm.typeList) = (yyvsp[(1) - (2)].interm.typeList);
4501 for (unsigned int i = 0; i < (yyvsp[(2) - (2)].interm.typeList)->size(); ++i) {
4502 for (unsigned int j = 0; j < (yyval.interm.typeList)->size(); ++j) {
4503 if ((*(yyval.interm.typeList))[j].type->getFieldName() == (*(yyvsp[(2) - (2)].interm.typeList))[i].type->getFieldName()) {
4504 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());
4505 context->recover();
4506 }
4507 }
4508 (yyval.interm.typeList)->push_back((*(yyvsp[(2) - (2)].interm.typeList))[i]);
4509 }
4510 }
4511 break;
4512
Alexis Hetub14178b2015-04-13 13:23:20 -04004513 case 181:
John Bauman66b8ab22014-05-06 15:57:45 -04004514
4515 {
4516 (yyval.interm.typeList) = (yyvsp[(2) - (3)].interm.typeList);
4517
4518 if (context->voidErrorCheck((yyvsp[(1) - (3)].interm.type).line, (*(yyvsp[(2) - (3)].interm.typeList))[0].type->getFieldName(), (yyvsp[(1) - (3)].interm.type))) {
4519 context->recover();
4520 }
4521 for (unsigned int i = 0; i < (yyval.interm.typeList)->size(); ++i) {
4522 //
4523 // Careful not to replace already known aspects of type, like array-ness
4524 //
4525 TType* type = (*(yyval.interm.typeList))[i].type;
4526 type->setBasicType((yyvsp[(1) - (3)].interm.type).type);
Alexis Hetub14178b2015-04-13 13:23:20 -04004527 type->setNominalSize((yyvsp[(1) - (3)].interm.type).primarySize);
4528 type->setSecondarySize((yyvsp[(1) - (3)].interm.type).secondarySize);
John Bauman66b8ab22014-05-06 15:57:45 -04004529 type->setPrecision((yyvsp[(1) - (3)].interm.type).precision);
4530
4531 // don't allow arrays of arrays
4532 if (type->isArray()) {
4533 if (context->arrayTypeErrorCheck((yyvsp[(1) - (3)].interm.type).line, (yyvsp[(1) - (3)].interm.type)))
4534 context->recover();
4535 }
4536 if ((yyvsp[(1) - (3)].interm.type).array)
4537 type->setArraySize((yyvsp[(1) - (3)].interm.type).arraySize);
4538 if ((yyvsp[(1) - (3)].interm.type).userDef) {
4539 type->setStruct((yyvsp[(1) - (3)].interm.type).userDef->getStruct());
4540 type->setTypeName((yyvsp[(1) - (3)].interm.type).userDef->getTypeName());
4541 }
John Bauman66b8ab22014-05-06 15:57:45 -04004542 }
4543 }
4544 break;
4545
Alexis Hetub14178b2015-04-13 13:23:20 -04004546 case 182:
John Bauman66b8ab22014-05-06 15:57:45 -04004547
4548 {
4549 (yyval.interm.typeList) = NewPoolTTypeList();
4550 (yyval.interm.typeList)->push_back((yyvsp[(1) - (1)].interm.typeLine));
4551 }
4552 break;
4553
Alexis Hetub14178b2015-04-13 13:23:20 -04004554 case 183:
John Bauman66b8ab22014-05-06 15:57:45 -04004555
4556 {
4557 (yyval.interm.typeList)->push_back((yyvsp[(3) - (3)].interm.typeLine));
4558 }
4559 break;
4560
Alexis Hetub14178b2015-04-13 13:23:20 -04004561 case 184:
John Bauman66b8ab22014-05-06 15:57:45 -04004562
4563 {
4564 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
4565 context->recover();
4566
4567 (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
4568 (yyval.interm.typeLine).line = (yyvsp[(1) - (1)].lex).line;
4569 (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (1)].lex).string);
4570 }
4571 break;
4572
Alexis Hetub14178b2015-04-13 13:23:20 -04004573 case 185:
John Bauman66b8ab22014-05-06 15:57:45 -04004574
4575 {
4576 if (context->reservedErrorCheck((yyvsp[(1) - (4)].lex).line, *(yyvsp[(1) - (4)].lex).string))
4577 context->recover();
4578
4579 (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
4580 (yyval.interm.typeLine).line = (yyvsp[(1) - (4)].lex).line;
4581 (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (4)].lex).string);
4582
4583 int size;
4584 if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
4585 context->recover();
4586 (yyval.interm.typeLine).type->setArraySize(size);
4587 }
4588 break;
4589
Alexis Hetub14178b2015-04-13 13:23:20 -04004590 case 186:
John Bauman66b8ab22014-05-06 15:57:45 -04004591
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004592 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04004593 break;
4594
Alexis Hetub14178b2015-04-13 13:23:20 -04004595 case 187:
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004596
Nicolas Capens7d626792015-02-17 17:58:31 -05004597 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004598 break;
4599
Alexis Hetub14178b2015-04-13 13:23:20 -04004600 case 188:
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004601
Nicolas Capens7d626792015-02-17 17:58:31 -05004602 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermAggregate); }
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004603 break;
4604
Alexis Hetub14178b2015-04-13 13:23:20 -04004605 case 189:
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004606
Nicolas Capens7d626792015-02-17 17:58:31 -05004607 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004608 break;
4609
Alexis Hetub14178b2015-04-13 13:23:20 -04004610 case 190:
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004611
Nicolas Capens7d626792015-02-17 17:58:31 -05004612 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
Alexis Hetub027aa92015-01-19 15:56:12 -05004613 break;
4614
Alexis Hetub14178b2015-04-13 13:23:20 -04004615 case 191:
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05004616
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004617 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05004618 break;
4619
Alexis Hetub14178b2015-04-13 13:23:20 -04004620 case 192:
Nicolas Capensa6a79ab2015-02-17 12:42:14 -05004621
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004622 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
Nicolas Capens3c20f802015-02-17 17:17:20 -05004623 break;
4624
Alexis Hetub14178b2015-04-13 13:23:20 -04004625 case 193:
Nicolas Capens3c20f802015-02-17 17:17:20 -05004626
Nicolas Capens7d626792015-02-17 17:58:31 -05004627 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004628 break;
4629
Alexis Hetub14178b2015-04-13 13:23:20 -04004630 case 194:
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004631
Nicolas Capens7d626792015-02-17 17:58:31 -05004632 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004633 break;
4634
Alexis Hetub14178b2015-04-13 13:23:20 -04004635 case 195:
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004636
Nicolas Capens7d626792015-02-17 17:58:31 -05004637 { (yyval.interm.intermAggregate) = 0; }
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004638 break;
4639
Alexis Hetub14178b2015-04-13 13:23:20 -04004640 case 196:
Nicolas Capense4b1b1d2015-02-17 17:26:01 -05004641
Nicolas Capens7d626792015-02-17 17:58:31 -05004642 { context->symbolTable.push(); }
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004643 break;
4644
Alexis Hetub14178b2015-04-13 13:23:20 -04004645 case 197:
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004646
Nicolas Capens7d626792015-02-17 17:58:31 -05004647 { context->symbolTable.pop(); }
4648 break;
4649
Alexis Hetub14178b2015-04-13 13:23:20 -04004650 case 198:
Nicolas Capens7d626792015-02-17 17:58:31 -05004651
4652 {
4653 if ((yyvsp[(3) - (5)].interm.intermAggregate) != 0) {
4654 (yyvsp[(3) - (5)].interm.intermAggregate)->setOp(EOpSequence);
4655 (yyvsp[(3) - (5)].interm.intermAggregate)->setEndLine((yyvsp[(5) - (5)].lex).line);
4656 }
4657 (yyval.interm.intermAggregate) = (yyvsp[(3) - (5)].interm.intermAggregate);
4658 }
4659 break;
4660
Alexis Hetub14178b2015-04-13 13:23:20 -04004661 case 199:
Nicolas Capens7d626792015-02-17 17:58:31 -05004662
4663 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
4664 break;
4665
Alexis Hetub14178b2015-04-13 13:23:20 -04004666 case 200:
Nicolas Capens7d626792015-02-17 17:58:31 -05004667
4668 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
4669 break;
4670
Alexis Hetub14178b2015-04-13 13:23:20 -04004671 case 201:
Nicolas Capens7d626792015-02-17 17:58:31 -05004672
4673 { context->symbolTable.push(); }
4674 break;
4675
Alexis Hetub14178b2015-04-13 13:23:20 -04004676 case 202:
Nicolas Capens7d626792015-02-17 17:58:31 -05004677
4678 { context->symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[(2) - (2)].interm.intermNode); }
4679 break;
4680
Alexis Hetub14178b2015-04-13 13:23:20 -04004681 case 203:
Nicolas Capens7d626792015-02-17 17:58:31 -05004682
4683 { context->symbolTable.push(); }
4684 break;
4685
Alexis Hetub14178b2015-04-13 13:23:20 -04004686 case 204:
Nicolas Capens7d626792015-02-17 17:58:31 -05004687
4688 { context->symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[(2) - (2)].interm.intermNode); }
4689 break;
4690
Alexis Hetub14178b2015-04-13 13:23:20 -04004691 case 205:
Nicolas Capens7d626792015-02-17 17:58:31 -05004692
John Bauman66b8ab22014-05-06 15:57:45 -04004693 {
4694 (yyval.interm.intermNode) = 0;
4695 }
4696 break;
4697
Alexis Hetub14178b2015-04-13 13:23:20 -04004698 case 206:
John Bauman66b8ab22014-05-06 15:57:45 -04004699
4700 {
4701 if ((yyvsp[(2) - (3)].interm.intermAggregate)) {
4702 (yyvsp[(2) - (3)].interm.intermAggregate)->setOp(EOpSequence);
4703 (yyvsp[(2) - (3)].interm.intermAggregate)->setEndLine((yyvsp[(3) - (3)].lex).line);
4704 }
4705 (yyval.interm.intermNode) = (yyvsp[(2) - (3)].interm.intermAggregate);
4706 }
4707 break;
4708
Alexis Hetub14178b2015-04-13 13:23:20 -04004709 case 207:
John Bauman66b8ab22014-05-06 15:57:45 -04004710
4711 {
4712 (yyval.interm.intermAggregate) = context->intermediate.makeAggregate((yyvsp[(1) - (1)].interm.intermNode), 0);
4713 }
4714 break;
4715
Alexis Hetub14178b2015-04-13 13:23:20 -04004716 case 208:
John Bauman66b8ab22014-05-06 15:57:45 -04004717
4718 {
4719 (yyval.interm.intermAggregate) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermAggregate), (yyvsp[(2) - (2)].interm.intermNode), 0);
4720 }
4721 break;
4722
Alexis Hetub14178b2015-04-13 13:23:20 -04004723 case 209:
John Bauman66b8ab22014-05-06 15:57:45 -04004724
4725 { (yyval.interm.intermNode) = 0; }
4726 break;
4727
Alexis Hetub14178b2015-04-13 13:23:20 -04004728 case 210:
John Bauman66b8ab22014-05-06 15:57:45 -04004729
4730 { (yyval.interm.intermNode) = static_cast<TIntermNode*>((yyvsp[(1) - (2)].interm.intermTypedNode)); }
4731 break;
4732
Alexis Hetub14178b2015-04-13 13:23:20 -04004733 case 211:
John Bauman66b8ab22014-05-06 15:57:45 -04004734
4735 {
4736 if (context->boolErrorCheck((yyvsp[(1) - (5)].lex).line, (yyvsp[(3) - (5)].interm.intermTypedNode)))
4737 context->recover();
4738 (yyval.interm.intermNode) = context->intermediate.addSelection((yyvsp[(3) - (5)].interm.intermTypedNode), (yyvsp[(5) - (5)].interm.nodePair), (yyvsp[(1) - (5)].lex).line);
4739 }
4740 break;
4741
Alexis Hetub14178b2015-04-13 13:23:20 -04004742 case 212:
John Bauman66b8ab22014-05-06 15:57:45 -04004743
4744 {
4745 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermNode);
4746 (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermNode);
4747 }
4748 break;
4749
Alexis Hetub14178b2015-04-13 13:23:20 -04004750 case 213:
John Bauman66b8ab22014-05-06 15:57:45 -04004751
4752 {
4753 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (1)].interm.intermNode);
4754 (yyval.interm.nodePair).node2 = 0;
4755 }
4756 break;
4757
Alexis Hetub14178b2015-04-13 13:23:20 -04004758 case 214:
John Bauman66b8ab22014-05-06 15:57:45 -04004759
4760 {
4761 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
4762 if (context->boolErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)->getLine(), (yyvsp[(1) - (1)].interm.intermTypedNode)))
4763 context->recover();
4764 }
4765 break;
4766
Alexis Hetub14178b2015-04-13 13:23:20 -04004767 case 215:
John Bauman66b8ab22014-05-06 15:57:45 -04004768
4769 {
4770 TIntermNode* intermNode;
4771 if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
4772 context->recover();
4773 if (context->boolErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
4774 context->recover();
4775
4776 if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode))
4777 (yyval.interm.intermTypedNode) = (yyvsp[(4) - (4)].interm.intermTypedNode);
4778 else {
4779 context->recover();
4780 (yyval.interm.intermTypedNode) = 0;
4781 }
4782 }
4783 break;
4784
Alexis Hetub14178b2015-04-13 13:23:20 -04004785 case 216:
John Bauman66b8ab22014-05-06 15:57:45 -04004786
4787 { context->symbolTable.push(); ++context->loopNestingLevel; }
4788 break;
4789
Alexis Hetub14178b2015-04-13 13:23:20 -04004790 case 217:
John Bauman66b8ab22014-05-06 15:57:45 -04004791
4792 {
4793 context->symbolTable.pop();
4794 (yyval.interm.intermNode) = context->intermediate.addLoop(ELoopWhile, 0, (yyvsp[(4) - (6)].interm.intermTypedNode), 0, (yyvsp[(6) - (6)].interm.intermNode), (yyvsp[(1) - (6)].lex).line);
4795 --context->loopNestingLevel;
4796 }
4797 break;
4798
Alexis Hetub14178b2015-04-13 13:23:20 -04004799 case 218:
John Bauman66b8ab22014-05-06 15:57:45 -04004800
4801 { ++context->loopNestingLevel; }
4802 break;
4803
Alexis Hetub14178b2015-04-13 13:23:20 -04004804 case 219:
John Bauman66b8ab22014-05-06 15:57:45 -04004805
4806 {
4807 if (context->boolErrorCheck((yyvsp[(8) - (8)].lex).line, (yyvsp[(6) - (8)].interm.intermTypedNode)))
4808 context->recover();
4809
4810 (yyval.interm.intermNode) = context->intermediate.addLoop(ELoopDoWhile, 0, (yyvsp[(6) - (8)].interm.intermTypedNode), 0, (yyvsp[(3) - (8)].interm.intermNode), (yyvsp[(4) - (8)].lex).line);
4811 --context->loopNestingLevel;
4812 }
4813 break;
4814
Alexis Hetub14178b2015-04-13 13:23:20 -04004815 case 220:
John Bauman66b8ab22014-05-06 15:57:45 -04004816
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004817 { context->symbolTable.push(); ++context->loopNestingLevel; }
John Bauman66b8ab22014-05-06 15:57:45 -04004818 break;
4819
Alexis Hetub14178b2015-04-13 13:23:20 -04004820 case 221:
John Bauman66b8ab22014-05-06 15:57:45 -04004821
4822 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004823 context->symbolTable.pop();
4824 (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);
4825 --context->loopNestingLevel;
John Bauman66b8ab22014-05-06 15:57:45 -04004826 }
4827 break;
4828
Alexis Hetub14178b2015-04-13 13:23:20 -04004829 case 222:
John Bauman66b8ab22014-05-06 15:57:45 -04004830
4831 {
Nicolas Capens3c20f802015-02-17 17:17:20 -05004832 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04004833 }
4834 break;
4835
Alexis Hetub14178b2015-04-13 13:23:20 -04004836 case 223:
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04004837
4838 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004839 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
Alexis Hetub027aa92015-01-19 15:56:12 -05004840 }
4841 break;
4842
Alexis Hetub14178b2015-04-13 13:23:20 -04004843 case 224:
Alexis Hetub027aa92015-01-19 15:56:12 -05004844
4845 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004846 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
Nicolas Capens3c20f802015-02-17 17:17:20 -05004847 }
4848 break;
4849
Alexis Hetub14178b2015-04-13 13:23:20 -04004850 case 225:
Nicolas Capens3c20f802015-02-17 17:17:20 -05004851
4852 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004853 (yyval.interm.intermTypedNode) = 0;
4854 }
4855 break;
4856
Alexis Hetub14178b2015-04-13 13:23:20 -04004857 case 226:
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004858
4859 {
John Bauman66b8ab22014-05-06 15:57:45 -04004860 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (2)].interm.intermTypedNode);
4861 (yyval.interm.nodePair).node2 = 0;
4862 }
4863 break;
4864
Alexis Hetub14178b2015-04-13 13:23:20 -04004865 case 227:
John Bauman66b8ab22014-05-06 15:57:45 -04004866
4867 {
4868 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermTypedNode);
4869 (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermTypedNode);
4870 }
4871 break;
4872
Alexis Hetub14178b2015-04-13 13:23:20 -04004873 case 228:
John Bauman66b8ab22014-05-06 15:57:45 -04004874
4875 {
4876 if (context->loopNestingLevel <= 0) {
4877 context->error((yyvsp[(1) - (2)].lex).line, "continue statement only allowed in loops", "");
4878 context->recover();
4879 }
4880 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpContinue, (yyvsp[(1) - (2)].lex).line);
4881 }
4882 break;
4883
Alexis Hetub14178b2015-04-13 13:23:20 -04004884 case 229:
John Bauman66b8ab22014-05-06 15:57:45 -04004885
4886 {
4887 if (context->loopNestingLevel <= 0) {
4888 context->error((yyvsp[(1) - (2)].lex).line, "break statement only allowed in loops", "");
4889 context->recover();
4890 }
4891 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpBreak, (yyvsp[(1) - (2)].lex).line);
4892 }
4893 break;
4894
Alexis Hetub14178b2015-04-13 13:23:20 -04004895 case 230:
John Bauman66b8ab22014-05-06 15:57:45 -04004896
4897 {
4898 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(1) - (2)].lex).line);
4899 if (context->currentFunctionType->getBasicType() != EbtVoid) {
4900 context->error((yyvsp[(1) - (2)].lex).line, "non-void function must return a value", "return");
4901 context->recover();
4902 }
4903 }
4904 break;
4905
Alexis Hetub14178b2015-04-13 13:23:20 -04004906 case 231:
John Bauman66b8ab22014-05-06 15:57:45 -04004907
4908 {
4909 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(2) - (3)].interm.intermTypedNode), (yyvsp[(1) - (3)].lex).line);
4910 context->functionReturnsValue = true;
4911 if (context->currentFunctionType->getBasicType() == EbtVoid) {
4912 context->error((yyvsp[(1) - (3)].lex).line, "void function cannot return a value", "return");
4913 context->recover();
4914 } else if (*(context->currentFunctionType) != (yyvsp[(2) - (3)].interm.intermTypedNode)->getType()) {
4915 context->error((yyvsp[(1) - (3)].lex).line, "function return is not matching type:", "return");
4916 context->recover();
4917 }
4918 }
4919 break;
4920
Alexis Hetub14178b2015-04-13 13:23:20 -04004921 case 232:
John Bauman66b8ab22014-05-06 15:57:45 -04004922
4923 {
4924 FRAG_ONLY("discard", (yyvsp[(1) - (2)].lex).line);
4925 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpKill, (yyvsp[(1) - (2)].lex).line);
4926 }
4927 break;
4928
Alexis Hetub14178b2015-04-13 13:23:20 -04004929 case 233:
John Bauman66b8ab22014-05-06 15:57:45 -04004930
4931 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004932 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
Nicolas Capens3c20f802015-02-17 17:17:20 -05004933 context->treeRoot = (yyval.interm.intermNode);
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04004934 }
4935 break;
4936
Alexis Hetub14178b2015-04-13 13:23:20 -04004937 case 234:
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04004938
4939 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004940 (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermNode), (yyvsp[(2) - (2)].interm.intermNode), 0);
4941 context->treeRoot = (yyval.interm.intermNode);
Alexis Hetub027aa92015-01-19 15:56:12 -05004942 }
4943 break;
4944
Alexis Hetub14178b2015-04-13 13:23:20 -04004945 case 235:
Alexis Hetub027aa92015-01-19 15:56:12 -05004946
4947 {
Nicolas Capens3c20f802015-02-17 17:17:20 -05004948 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
4949 }
4950 break;
4951
Alexis Hetub14178b2015-04-13 13:23:20 -04004952 case 236:
Nicolas Capens3c20f802015-02-17 17:17:20 -05004953
4954 {
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004955 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
4956 }
4957 break;
4958
Alexis Hetub14178b2015-04-13 13:23:20 -04004959 case 237:
Nicolas Capens2c1239f2015-02-17 17:30:04 -05004960
4961 {
John Bauman66b8ab22014-05-06 15:57:45 -04004962 TFunction* function = (yyvsp[(1) - (1)].interm).function;
4963
Nicolas Capens0a7f0c22015-02-18 14:47:31 -05004964 const TSymbol *builtIn = context->symbolTable.findBuiltIn(function->getMangledName(), context->shaderVersion);
John Bauman66b8ab22014-05-06 15:57:45 -04004965
4966 if (builtIn)
4967 {
4968 context->error((yyvsp[(1) - (1)].interm).line, "built-in functions cannot be redefined", function->getName().c_str());
4969 context->recover();
4970 }
4971
Nicolas Capens0a7f0c22015-02-18 14:47:31 -05004972 TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find(function->getMangledName(), context->shaderVersion));
John Bauman66b8ab22014-05-06 15:57:45 -04004973 //
4974 // Note: 'prevDec' could be 'function' if this is the first time we've seen function
4975 // as it would have just been put in the symbol table. Otherwise, we're looking up
4976 // an earlier occurance.
4977 //
4978 if (prevDec->isDefined()) {
4979 //
4980 // Then this function already has a body.
4981 //
4982 context->error((yyvsp[(1) - (1)].interm).line, "function already has a body", function->getName().c_str());
4983 context->recover();
4984 }
4985 prevDec->setDefined();
4986
4987 //
4988 // Raise error message if main function takes any parameters or return anything other than void
4989 //
4990 if (function->getName() == "main") {
4991 if (function->getParamCount() > 0) {
4992 context->error((yyvsp[(1) - (1)].interm).line, "function cannot take any parameter(s)", function->getName().c_str());
4993 context->recover();
4994 }
4995 if (function->getReturnType().getBasicType() != EbtVoid) {
4996 context->error((yyvsp[(1) - (1)].interm).line, "", function->getReturnType().getBasicString(), "main function cannot return a value");
4997 context->recover();
4998 }
4999 }
5000
5001 //
5002 // Remember the return type for later checking for RETURN statements.
5003 //
5004 context->currentFunctionType = &(prevDec->getReturnType());
5005 context->functionReturnsValue = false;
5006
5007 //
5008 // Insert parameters into the symbol table.
5009 // If the parameter has no name, it's not an error, just don't insert it
5010 // (could be used for unused args).
5011 //
5012 // Also, accumulate the list of parameters into the HIL, so lower level code
5013 // knows where to find parameters.
5014 //
5015 TIntermAggregate* paramNodes = new TIntermAggregate;
5016 for (int i = 0; i < function->getParamCount(); i++) {
5017 const TParameter& param = function->getParam(i);
5018 if (param.name != 0) {
5019 TVariable *variable = new TVariable(param.name, *param.type);
5020 //
5021 // Insert the parameters with name in the symbol table.
5022 //
Nicolas Capensd603ecd2015-02-18 14:52:21 -05005023 if (! context->symbolTable.declare(*variable)) {
John Bauman66b8ab22014-05-06 15:57:45 -04005024 context->error((yyvsp[(1) - (1)].interm).line, "redefinition", variable->getName().c_str());
5025 context->recover();
5026 delete variable;
5027 }
5028
5029 //
5030 // Add the parameter to the HIL
5031 //
5032 paramNodes = context->intermediate.growAggregate(
5033 paramNodes,
5034 context->intermediate.addSymbol(variable->getUniqueId(),
5035 variable->getName(),
5036 variable->getType(), (yyvsp[(1) - (1)].interm).line),
5037 (yyvsp[(1) - (1)].interm).line);
5038 } else {
5039 paramNodes = context->intermediate.growAggregate(paramNodes, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (1)].interm).line), (yyvsp[(1) - (1)].interm).line);
5040 }
5041 }
5042 context->intermediate.setAggregateOperator(paramNodes, EOpParameters, (yyvsp[(1) - (1)].interm).line);
5043 (yyvsp[(1) - (1)].interm).intermAggregate = paramNodes;
5044 context->loopNestingLevel = 0;
5045 }
5046 break;
5047
Alexis Hetub14178b2015-04-13 13:23:20 -04005048 case 238:
John Bauman66b8ab22014-05-06 15:57:45 -04005049
5050 {
5051 //?? Check that all paths return a value if return type != void ?
5052 // May be best done as post process phase on intermediate code
5053 if (context->currentFunctionType->getBasicType() != EbtVoid && ! context->functionReturnsValue) {
5054 context->error((yyvsp[(1) - (3)].interm).line, "function does not return a value:", "", (yyvsp[(1) - (3)].interm).function->getName().c_str());
5055 context->recover();
5056 }
5057
5058 (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermAggregate, (yyvsp[(3) - (3)].interm.intermNode), 0);
5059 context->intermediate.setAggregateOperator((yyval.interm.intermNode), EOpFunction, (yyvsp[(1) - (3)].interm).line);
5060 (yyval.interm.intermNode)->getAsAggregate()->setName((yyvsp[(1) - (3)].interm).function->getMangledName().c_str());
5061 (yyval.interm.intermNode)->getAsAggregate()->setType((yyvsp[(1) - (3)].interm).function->getReturnType());
5062
5063 // store the pragma information for debug and optimize and other vendor specific
5064 // information. This information can be queried from the parse tree
5065 (yyval.interm.intermNode)->getAsAggregate()->setOptimize(context->pragma().optimize);
5066 (yyval.interm.intermNode)->getAsAggregate()->setDebug(context->pragma().debug);
5067
5068 if ((yyvsp[(3) - (3)].interm.intermNode) && (yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate())
5069 (yyval.interm.intermNode)->getAsAggregate()->setEndLine((yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate()->getEndLine());
5070
5071 context->symbolTable.pop();
5072 }
5073 break;
5074
5075
5076
5077 default: break;
5078 }
5079 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
5080
5081 YYPOPSTACK (yylen);
5082 yylen = 0;
5083 YY_STACK_PRINT (yyss, yyssp);
5084
5085 *++yyvsp = yyval;
5086
5087 /* Now `shift' the result of the reduction. Determine what state
5088 that goes to, based on the state we popped back to and the rule
5089 number reduced by. */
5090
5091 yyn = yyr1[yyn];
5092
5093 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
5094 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
5095 yystate = yytable[yystate];
5096 else
5097 yystate = yydefgoto[yyn - YYNTOKENS];
5098
5099 goto yynewstate;
5100
5101
5102/*------------------------------------.
5103| yyerrlab -- here on detecting error |
5104`------------------------------------*/
5105yyerrlab:
5106 /* If not already recovering from an error, report this error. */
5107 if (!yyerrstatus)
5108 {
5109 ++yynerrs;
5110#if ! YYERROR_VERBOSE
5111 yyerror (context, YY_("syntax error"));
5112#else
5113 {
5114 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
5115 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
5116 {
5117 YYSIZE_T yyalloc = 2 * yysize;
5118 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
5119 yyalloc = YYSTACK_ALLOC_MAXIMUM;
5120 if (yymsg != yymsgbuf)
5121 YYSTACK_FREE (yymsg);
5122 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
5123 if (yymsg)
5124 yymsg_alloc = yyalloc;
5125 else
5126 {
5127 yymsg = yymsgbuf;
5128 yymsg_alloc = sizeof yymsgbuf;
5129 }
5130 }
5131
5132 if (0 < yysize && yysize <= yymsg_alloc)
5133 {
5134 (void) yysyntax_error (yymsg, yystate, yychar);
5135 yyerror (context, yymsg);
5136 }
5137 else
5138 {
5139 yyerror (context, YY_("syntax error"));
5140 if (yysize != 0)
5141 goto yyexhaustedlab;
5142 }
5143 }
5144#endif
5145 }
5146
5147
5148
5149 if (yyerrstatus == 3)
5150 {
5151 /* If just tried and failed to reuse lookahead token after an
5152 error, discard it. */
5153
5154 if (yychar <= YYEOF)
5155 {
5156 /* Return failure if at end of input. */
5157 if (yychar == YYEOF)
5158 YYABORT;
5159 }
5160 else
5161 {
5162 yydestruct ("Error: discarding",
5163 yytoken, &yylval, context);
5164 yychar = YYEMPTY;
5165 }
5166 }
5167
5168 /* Else will try to reuse lookahead token after shifting the error
5169 token. */
5170 goto yyerrlab1;
5171
5172
5173/*---------------------------------------------------.
5174| yyerrorlab -- error raised explicitly by YYERROR. |
5175`---------------------------------------------------*/
5176yyerrorlab:
5177
5178 /* Pacify compilers like GCC when the user code never invokes
5179 YYERROR and the label yyerrorlab therefore never appears in user
5180 code. */
5181 if (/*CONSTCOND*/ 0)
5182 goto yyerrorlab;
5183
5184 /* Do not reclaim the symbols of the rule which action triggered
5185 this YYERROR. */
5186 YYPOPSTACK (yylen);
5187 yylen = 0;
5188 YY_STACK_PRINT (yyss, yyssp);
5189 yystate = *yyssp;
5190 goto yyerrlab1;
5191
5192
5193/*-------------------------------------------------------------.
5194| yyerrlab1 -- common code for both syntax error and YYERROR. |
5195`-------------------------------------------------------------*/
5196yyerrlab1:
5197 yyerrstatus = 3; /* Each real token shifted decrements this. */
5198
5199 for (;;)
5200 {
5201 yyn = yypact[yystate];
5202 if (yyn != YYPACT_NINF)
5203 {
5204 yyn += YYTERROR;
5205 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
5206 {
5207 yyn = yytable[yyn];
5208 if (0 < yyn)
5209 break;
5210 }
5211 }
5212
5213 /* Pop the current state because it cannot handle the error token. */
5214 if (yyssp == yyss)
5215 YYABORT;
5216
5217
5218 yydestruct ("Error: popping",
5219 yystos[yystate], yyvsp, context);
5220 YYPOPSTACK (1);
5221 yystate = *yyssp;
5222 YY_STACK_PRINT (yyss, yyssp);
5223 }
5224
5225 *++yyvsp = yylval;
5226
5227
5228 /* Shift the error token. */
5229 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
5230
5231 yystate = yyn;
5232 goto yynewstate;
5233
5234
5235/*-------------------------------------.
5236| yyacceptlab -- YYACCEPT comes here. |
5237`-------------------------------------*/
5238yyacceptlab:
5239 yyresult = 0;
5240 goto yyreturn;
5241
5242/*-----------------------------------.
5243| yyabortlab -- YYABORT comes here. |
5244`-----------------------------------*/
5245yyabortlab:
5246 yyresult = 1;
5247 goto yyreturn;
5248
5249#if !defined(yyoverflow) || YYERROR_VERBOSE
5250/*-------------------------------------------------.
5251| yyexhaustedlab -- memory exhaustion comes here. |
5252`-------------------------------------------------*/
5253yyexhaustedlab:
5254 yyerror (context, YY_("memory exhausted"));
5255 yyresult = 2;
5256 /* Fall through. */
5257#endif
5258
5259yyreturn:
5260 if (yychar != YYEMPTY)
5261 yydestruct ("Cleanup: discarding lookahead",
5262 yytoken, &yylval, context);
5263 /* Do not reclaim the symbols of the rule which action triggered
5264 this YYABORT or YYACCEPT. */
5265 YYPOPSTACK (yylen);
5266 YY_STACK_PRINT (yyss, yyssp);
5267 while (yyssp != yyss)
5268 {
5269 yydestruct ("Cleanup: popping",
5270 yystos[*yyssp], yyvsp, context);
5271 YYPOPSTACK (1);
5272 }
5273#ifndef yyoverflow
5274 if (yyss != yyssa)
5275 YYSTACK_FREE (yyss);
5276#endif
5277#if YYERROR_VERBOSE
5278 if (yymsg != yymsgbuf)
5279 YYSTACK_FREE (yymsg);
5280#endif
5281 /* Make sure YYID is used. */
5282 return YYID (yyresult);
5283}
5284
5285
5286
5287
5288
5289int glslang_parse(TParseContext* context) {
5290 return yyparse(context);
5291}
5292