blob: e270f86221c74d82357fd2e65ec17c44ed43421a [file] [log] [blame]
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04001
2/* A Bison parser, made by GNU Bison 2.4.1. */
John Bauman66b8ab22014-05-06 15:57:45 -04003
4/* Skeleton implementation for Bison's Yacc-like parsers in C
5
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04006 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
7 Free Software Foundation, Inc.
John Bauman66b8ab22014-05-06 15:57:45 -04008
9 This program is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
21
22/* As a special exception, you may create a larger work that contains
23 part or all of the Bison parser skeleton and distribute that work
24 under terms of your choice, so long as that work isn't itself a
25 parser generator using the skeleton or a modified version thereof
26 as a parser skeleton. Alternatively, if you modify or redistribute
27 the parser skeleton itself, you may (at your option) remove this
28 special exception, which will cause the skeleton and the resulting
29 Bison output files to be licensed under the GNU General Public
30 License without this special exception.
31
32 This special exception was added by the Free Software Foundation in
33 version 2.2 of Bison. */
34
35/* C LALR(1) parser skeleton written by Richard Stallman, by
36 simplifying the original so-called "semantic" parser. */
37
38/* All symbols defined below should begin with yy or YY, to avoid
39 infringing on user name space. This should be done even for local
40 variables, as they might otherwise be expanded by user macros.
41 There are some unavoidable exceptions within include files to
42 define necessary library symbols; they are noted "INFRINGES ON
43 USER NAME SPACE" below. */
44
45/* Identify Bison output. */
46#define YYBISON 1
47
48/* Bison version. */
Nicolas Capense9c5e4f2014-05-28 22:46:43 -040049#define YYBISON_VERSION "2.4.1"
John Bauman66b8ab22014-05-06 15:57:45 -040050
51/* Skeleton name. */
52#define YYSKELETON_NAME "yacc.c"
53
54/* Pure parsers. */
55#define YYPURE 1
56
57/* Push parsers. */
58#define YYPUSH 0
59
60/* Pull parsers. */
61#define YYPULL 1
62
63/* Using locations. */
64#define YYLSP_NEEDED 0
65
66
67
68/* Copy the first part of user declarations. */
69
70
71//
John Baumand4ae8632014-05-06 16:18:33 -040072// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
John Bauman66b8ab22014-05-06 15:57:45 -040073// Use of this source code is governed by a BSD-style license that can be
74// found in the LICENSE file.
75//
76
77// This file is auto-generated by generate_parser.sh. DO NOT EDIT!
78
79// Ignore errors in auto-generated code.
80#if defined(__GNUC__)
81#pragma GCC diagnostic ignored "-Wunused-function"
82#pragma GCC diagnostic ignored "-Wunused-variable"
83#pragma GCC diagnostic ignored "-Wswitch-enum"
84#elif defined(_MSC_VER)
85#pragma warning(disable: 4065)
86#pragma warning(disable: 4189)
87#pragma warning(disable: 4505)
88#pragma warning(disable: 4701)
89#endif
90
Nicolas Capenscc863da2015-01-21 15:50:55 -050091#include "SymbolTable.h"
92#include "ParseHelper.h"
John Bauman66b8ab22014-05-06 15:57:45 -040093
John Baumand4ae8632014-05-06 16:18:33 -040094#define YYENABLE_NLS 0
95#define YYLTYPE_IS_TRIVIAL 1
96
John Bauman66b8ab22014-05-06 15:57:45 -040097#define YYLEX_PARAM context->scanner
98
99
100
101/* Enabling traces. */
102#ifndef YYDEBUG
103# define YYDEBUG 0
104#endif
105
106/* Enabling verbose error messages. */
107#ifdef YYERROR_VERBOSE
108# undef YYERROR_VERBOSE
109# define YYERROR_VERBOSE 1
110#else
111# define YYERROR_VERBOSE 0
112#endif
113
114/* Enabling the token table. */
115#ifndef YYTOKEN_TABLE
116# define YYTOKEN_TABLE 0
117#endif
118
119
120/* Tokens. */
121#ifndef YYTOKENTYPE
122# define YYTOKENTYPE
123 /* Put the tokens into the symbol table, so that GDB and other debuggers
124 know about them. */
125 enum yytokentype {
126 INVARIANT = 258,
127 HIGH_PRECISION = 259,
128 MEDIUM_PRECISION = 260,
129 LOW_PRECISION = 261,
130 PRECISION = 262,
131 ATTRIBUTE = 263,
132 CONST_QUAL = 264,
133 BOOL_TYPE = 265,
134 FLOAT_TYPE = 266,
135 INT_TYPE = 267,
136 BREAK = 268,
137 CONTINUE = 269,
138 DO = 270,
139 ELSE = 271,
140 FOR = 272,
141 IF = 273,
142 DISCARD = 274,
143 RETURN = 275,
144 BVEC2 = 276,
145 BVEC3 = 277,
146 BVEC4 = 278,
147 IVEC2 = 279,
148 IVEC3 = 280,
149 IVEC4 = 281,
150 VEC2 = 282,
151 VEC3 = 283,
152 VEC4 = 284,
153 MATRIX2 = 285,
154 MATRIX3 = 286,
155 MATRIX4 = 287,
156 IN_QUAL = 288,
157 OUT_QUAL = 289,
158 INOUT_QUAL = 290,
159 UNIFORM = 291,
160 VARYING = 292,
161 STRUCT = 293,
162 VOID_TYPE = 294,
163 WHILE = 295,
164 SAMPLER2D = 296,
165 SAMPLERCUBE = 297,
Nicolas Capense9c5e4f2014-05-28 22:46:43 -0400166 SAMPLER_EXTERNAL_OES = 298,
Alexis Hetub027aa92015-01-19 15:56:12 -0500167 SAMPLER3D = 299,
168 IDENTIFIER = 300,
169 TYPE_NAME = 301,
170 FLOATCONSTANT = 302,
171 INTCONSTANT = 303,
172 BOOLCONSTANT = 304,
173 FIELD_SELECTION = 305,
174 LEFT_OP = 306,
175 RIGHT_OP = 307,
176 INC_OP = 308,
177 DEC_OP = 309,
178 LE_OP = 310,
179 GE_OP = 311,
180 EQ_OP = 312,
181 NE_OP = 313,
182 AND_OP = 314,
183 OR_OP = 315,
184 XOR_OP = 316,
185 MUL_ASSIGN = 317,
186 DIV_ASSIGN = 318,
187 ADD_ASSIGN = 319,
188 MOD_ASSIGN = 320,
189 LEFT_ASSIGN = 321,
190 RIGHT_ASSIGN = 322,
191 AND_ASSIGN = 323,
192 XOR_ASSIGN = 324,
193 OR_ASSIGN = 325,
194 SUB_ASSIGN = 326,
195 LEFT_PAREN = 327,
196 RIGHT_PAREN = 328,
197 LEFT_BRACKET = 329,
198 RIGHT_BRACKET = 330,
199 LEFT_BRACE = 331,
200 RIGHT_BRACE = 332,
201 DOT = 333,
202 COMMA = 334,
203 COLON = 335,
204 EQUAL = 336,
205 SEMICOLON = 337,
206 BANG = 338,
207 DASH = 339,
208 TILDE = 340,
209 PLUS = 341,
210 STAR = 342,
211 SLASH = 343,
212 PERCENT = 344,
213 LEFT_ANGLE = 345,
214 RIGHT_ANGLE = 346,
215 VERTICAL_BAR = 347,
216 CARET = 348,
217 AMPERSAND = 349,
218 QUESTION = 350
John Bauman66b8ab22014-05-06 15:57:45 -0400219 };
220#endif
221
222
223
224#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
225typedef union YYSTYPE
226{
227
228
229 struct {
230 TSourceLoc line;
231 union {
232 TString *string;
233 float f;
234 int i;
235 bool b;
236 };
237 TSymbol* symbol;
238 } lex;
239 struct {
240 TSourceLoc line;
241 TOperator op;
242 union {
243 TIntermNode* intermNode;
244 TIntermNodePair nodePair;
245 TIntermTyped* intermTypedNode;
246 TIntermAggregate* intermAggregate;
247 };
248 union {
249 TPublicType type;
250 TPrecision precision;
251 TQualifier qualifier;
252 TFunction* function;
253 TParameter param;
254 TTypeLine typeLine;
255 TTypeList* typeList;
256 };
257 } interm;
258
259
260
261} YYSTYPE;
262# define YYSTYPE_IS_TRIVIAL 1
263# define yystype YYSTYPE /* obsolescent; will be withdrawn */
264# define YYSTYPE_IS_DECLARED 1
265#endif
266
267
268/* Copy the second part of user declarations. */
269
270
271extern int yylex(YYSTYPE* yylval_param, void* yyscanner);
272extern void yyerror(TParseContext* context, const char* reason);
273
274#define FRAG_VERT_ONLY(S, L) { \
Nicolas Capens08ca3c62015-02-13 16:06:45 -0500275 if (context->shaderType != GL_FRAGMENT_SHADER && \
276 context->shaderType != GL_VERTEX_SHADER) { \
John Bauman66b8ab22014-05-06 15:57:45 -0400277 context->error(L, " supported in vertex/fragment shaders only ", S); \
278 context->recover(); \
279 } \
280}
281
282#define VERTEX_ONLY(S, L) { \
Nicolas Capens08ca3c62015-02-13 16:06:45 -0500283 if (context->shaderType != GL_VERTEX_SHADER) { \
John Bauman66b8ab22014-05-06 15:57:45 -0400284 context->error(L, " supported in vertex shaders only ", S); \
285 context->recover(); \
286 } \
287}
288
289#define FRAG_ONLY(S, L) { \
Nicolas Capens08ca3c62015-02-13 16:06:45 -0500290 if (context->shaderType != GL_FRAGMENT_SHADER) { \
John Bauman66b8ab22014-05-06 15:57:45 -0400291 context->error(L, " supported in fragment shaders only ", S); \
292 context->recover(); \
293 } \
294}
295
296
297
298#ifdef short
299# undef short
300#endif
301
302#ifdef YYTYPE_UINT8
303typedef YYTYPE_UINT8 yytype_uint8;
304#else
305typedef unsigned char yytype_uint8;
306#endif
307
308#ifdef YYTYPE_INT8
309typedef YYTYPE_INT8 yytype_int8;
310#elif (defined __STDC__ || defined __C99__FUNC__ \
311 || defined __cplusplus || defined _MSC_VER)
312typedef signed char yytype_int8;
313#else
314typedef short int yytype_int8;
315#endif
316
317#ifdef YYTYPE_UINT16
318typedef YYTYPE_UINT16 yytype_uint16;
319#else
320typedef unsigned short int yytype_uint16;
321#endif
322
323#ifdef YYTYPE_INT16
324typedef YYTYPE_INT16 yytype_int16;
325#else
326typedef short int yytype_int16;
327#endif
328
329#ifndef YYSIZE_T
330# ifdef __SIZE_TYPE__
331# define YYSIZE_T __SIZE_TYPE__
332# elif defined size_t
333# define YYSIZE_T size_t
334# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
335 || defined __cplusplus || defined _MSC_VER)
336# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
337# define YYSIZE_T size_t
338# else
339# define YYSIZE_T unsigned int
340# endif
341#endif
342
343#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
344
345#ifndef YY_
Nicolas Capense9c5e4f2014-05-28 22:46:43 -0400346# if YYENABLE_NLS
John Bauman66b8ab22014-05-06 15:57:45 -0400347# if ENABLE_NLS
348# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
349# define YY_(msgid) dgettext ("bison-runtime", msgid)
350# endif
351# endif
352# ifndef YY_
353# define YY_(msgid) msgid
354# endif
355#endif
356
357/* Suppress unused-variable warnings by "using" E. */
358#if ! defined lint || defined __GNUC__
359# define YYUSE(e) ((void) (e))
360#else
361# define YYUSE(e) /* empty */
362#endif
363
364/* Identity function, used to suppress warnings about constant conditions. */
365#ifndef lint
366# define YYID(n) (n)
367#else
368#if (defined __STDC__ || defined __C99__FUNC__ \
369 || defined __cplusplus || defined _MSC_VER)
370static int
371YYID (int yyi)
372#else
373static int
374YYID (yyi)
375 int yyi;
376#endif
377{
378 return yyi;
379}
380#endif
381
382#if ! defined yyoverflow || YYERROR_VERBOSE
383
384/* The parser invokes alloca or malloc; define the necessary symbols. */
385
386# ifdef YYSTACK_USE_ALLOCA
387# if YYSTACK_USE_ALLOCA
388# ifdef __GNUC__
389# define YYSTACK_ALLOC __builtin_alloca
390# elif defined __BUILTIN_VA_ARG_INCR
391# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
392# elif defined _AIX
393# define YYSTACK_ALLOC __alloca
394# elif defined _MSC_VER
395# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
396# define alloca _alloca
397# else
398# define YYSTACK_ALLOC alloca
399# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
400 || defined __cplusplus || defined _MSC_VER)
401# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
402# ifndef _STDLIB_H
403# define _STDLIB_H 1
404# endif
405# endif
406# endif
407# endif
408# endif
409
410# ifdef YYSTACK_ALLOC
411 /* Pacify GCC's `empty if-body' warning. */
412# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
413# ifndef YYSTACK_ALLOC_MAXIMUM
414 /* The OS might guarantee only one guard page at the bottom of the stack,
415 and a page size can be as small as 4096 bytes. So we cannot safely
416 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
417 to allow for a few compiler-allocated temporary stack slots. */
418# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
419# endif
420# else
421# define YYSTACK_ALLOC YYMALLOC
422# define YYSTACK_FREE YYFREE
423# ifndef YYSTACK_ALLOC_MAXIMUM
424# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
425# endif
426# if (defined __cplusplus && ! defined _STDLIB_H \
427 && ! ((defined YYMALLOC || defined malloc) \
428 && (defined YYFREE || defined free)))
429# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
430# ifndef _STDLIB_H
431# define _STDLIB_H 1
432# endif
433# endif
434# ifndef YYMALLOC
435# define YYMALLOC malloc
436# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
437 || defined __cplusplus || defined _MSC_VER)
438void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
439# endif
440# endif
441# ifndef YYFREE
442# define YYFREE free
443# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
444 || defined __cplusplus || defined _MSC_VER)
445void free (void *); /* INFRINGES ON USER NAME SPACE */
446# endif
447# endif
448# endif
449#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
450
451
452#if (! defined yyoverflow \
453 && (! defined __cplusplus \
454 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
455
456/* A type that is properly aligned for any stack member. */
457union yyalloc
458{
459 yytype_int16 yyss_alloc;
460 YYSTYPE yyvs_alloc;
461};
462
463/* The size of the maximum gap between one aligned stack and the next. */
464# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
465
466/* The size of an array large to enough to hold all stacks, each with
467 N elements. */
468# define YYSTACK_BYTES(N) \
469 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
470 + YYSTACK_GAP_MAXIMUM)
471
472/* Copy COUNT objects from FROM to TO. The source and destination do
473 not overlap. */
474# ifndef YYCOPY
475# if defined __GNUC__ && 1 < __GNUC__
476# define YYCOPY(To, From, Count) \
477 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
478# else
479# define YYCOPY(To, From, Count) \
480 do \
481 { \
482 YYSIZE_T yyi; \
483 for (yyi = 0; yyi < (Count); yyi++) \
484 (To)[yyi] = (From)[yyi]; \
485 } \
486 while (YYID (0))
487# endif
488# endif
489
490/* Relocate STACK from its old location to the new one. The
491 local variables YYSIZE and YYSTACKSIZE give the old and new number of
492 elements in the stack, and YYPTR gives the new location of the
493 stack. Advance YYPTR to a properly aligned location for the next
494 stack. */
495# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
496 do \
497 { \
498 YYSIZE_T yynewbytes; \
499 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
500 Stack = &yyptr->Stack_alloc; \
501 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
502 yyptr += yynewbytes / sizeof (*yyptr); \
503 } \
504 while (YYID (0))
505
506#endif
507
508/* YYFINAL -- State number of the termination state. */
Alexis Hetub027aa92015-01-19 15:56:12 -0500509#define YYFINAL 71
John Bauman66b8ab22014-05-06 15:57:45 -0400510/* YYLAST -- Last index in YYTABLE. */
Alexis Hetub027aa92015-01-19 15:56:12 -0500511#define YYLAST 1416
John Bauman66b8ab22014-05-06 15:57:45 -0400512
513/* YYNTOKENS -- Number of terminals. */
Alexis Hetub027aa92015-01-19 15:56:12 -0500514#define YYNTOKENS 96
John Bauman66b8ab22014-05-06 15:57:45 -0400515/* YYNNTS -- Number of nonterminals. */
516#define YYNNTS 83
517/* YYNRULES -- Number of rules. */
Alexis Hetub027aa92015-01-19 15:56:12 -0500518#define YYNRULES 201
John Bauman66b8ab22014-05-06 15:57:45 -0400519/* YYNRULES -- Number of states. */
Alexis Hetub027aa92015-01-19 15:56:12 -0500520#define YYNSTATES 304
John Bauman66b8ab22014-05-06 15:57:45 -0400521
522/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
523#define YYUNDEFTOK 2
Alexis Hetub027aa92015-01-19 15:56:12 -0500524#define YYMAXUTOK 350
John Bauman66b8ab22014-05-06 15:57:45 -0400525
526#define YYTRANSLATE(YYX) \
527 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
528
529/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
530static const yytype_uint8 yytranslate[] =
531{
532 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
533 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
534 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
535 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
536 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
537 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
538 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
539 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
540 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
541 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
542 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
543 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
544 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
545 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
546 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
547 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
548 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
549 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
550 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
551 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
552 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
553 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
554 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
555 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
556 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
557 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
558 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
559 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
560 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
561 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
562 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
563 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
564 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
565 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
Alexis Hetub027aa92015-01-19 15:56:12 -0500566 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
567 95
John Bauman66b8ab22014-05-06 15:57:45 -0400568};
569
570#if YYDEBUG
571/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
572 YYRHS. */
573static const yytype_uint16 yyprhs[] =
574{
575 0, 0, 3, 5, 7, 9, 11, 13, 17, 19,
576 24, 26, 30, 33, 36, 38, 40, 42, 46, 49,
577 52, 55, 57, 60, 64, 67, 69, 71, 73, 75,
578 78, 81, 84, 86, 88, 90, 92, 96, 100, 102,
579 106, 110, 112, 114, 118, 122, 126, 130, 132, 136,
580 140, 142, 144, 146, 148, 152, 154, 158, 160, 164,
581 166, 172, 174, 178, 180, 182, 184, 186, 188, 190,
582 194, 196, 199, 202, 207, 210, 212, 214, 217, 221,
583 225, 228, 234, 238, 241, 245, 248, 249, 251, 253,
584 255, 257, 259, 263, 269, 276, 282, 284, 287, 292,
585 298, 303, 306, 308, 311, 313, 315, 317, 320, 322,
586 324, 327, 329, 331, 333, 335, 340, 342, 344, 346,
587 348, 350, 352, 354, 356, 358, 360, 362, 364, 366,
Alexis Hetub027aa92015-01-19 15:56:12 -0500588 368, 370, 372, 374, 376, 378, 380, 382, 384, 385,
589 392, 393, 399, 401, 404, 408, 410, 414, 416, 421,
590 423, 425, 427, 429, 431, 433, 435, 437, 439, 442,
591 443, 444, 450, 452, 454, 455, 458, 459, 462, 465,
592 469, 471, 474, 476, 479, 485, 489, 491, 493, 498,
593 499, 506, 507, 516, 517, 525, 527, 529, 531, 532,
594 535, 539, 542, 545, 548, 552, 555, 557, 560, 562,
595 564, 565
John Bauman66b8ab22014-05-06 15:57:45 -0400596};
597
598/* YYRHS -- A `-1'-separated list of the rules' RHS. */
599static const yytype_int16 yyrhs[] =
600{
Alexis Hetub027aa92015-01-19 15:56:12 -0500601 175, 0, -1, 45, -1, 97, -1, 48, -1, 47,
602 -1, 49, -1, 72, 124, 73, -1, 98, -1, 99,
603 74, 100, 75, -1, 101, -1, 99, 78, 50, -1,
604 99, 53, -1, 99, 54, -1, 124, -1, 102, -1,
605 103, -1, 99, 78, 103, -1, 105, 73, -1, 104,
606 73, -1, 106, 39, -1, 106, -1, 106, 122, -1,
607 105, 79, 122, -1, 107, 72, -1, 142, -1, 45,
608 -1, 50, -1, 99, -1, 53, 108, -1, 54, 108,
609 -1, 109, 108, -1, 86, -1, 84, -1, 83, -1,
610 108, -1, 110, 87, 108, -1, 110, 88, 108, -1,
611 110, -1, 111, 86, 110, -1, 111, 84, 110, -1,
612 111, -1, 112, -1, 113, 90, 112, -1, 113, 91,
613 112, -1, 113, 55, 112, -1, 113, 56, 112, -1,
614 113, -1, 114, 57, 113, -1, 114, 58, 113, -1,
615 114, -1, 115, -1, 116, -1, 117, -1, 118, 59,
616 117, -1, 118, -1, 119, 61, 118, -1, 119, -1,
617 120, 60, 119, -1, 120, -1, 120, 95, 124, 80,
618 122, -1, 121, -1, 108, 123, 122, -1, 81, -1,
619 62, -1, 63, -1, 64, -1, 71, -1, 122, -1,
620 124, 79, 122, -1, 121, -1, 127, 82, -1, 135,
621 82, -1, 7, 140, 141, 82, -1, 128, 73, -1,
622 130, -1, 129, -1, 130, 132, -1, 129, 79, 132,
623 -1, 137, 45, 72, -1, 139, 45, -1, 139, 45,
624 74, 125, 75, -1, 138, 133, 131, -1, 133, 131,
625 -1, 138, 133, 134, -1, 133, 134, -1, -1, 33,
626 -1, 34, -1, 35, -1, 139, -1, 136, -1, 135,
627 79, 45, -1, 135, 79, 45, 74, 75, -1, 135,
628 79, 45, 74, 125, 75, -1, 135, 79, 45, 81,
629 150, -1, 137, -1, 137, 45, -1, 137, 45, 74,
630 75, -1, 137, 45, 74, 125, 75, -1, 137, 45,
631 81, 150, -1, 3, 45, -1, 139, -1, 138, 139,
John Bauman66b8ab22014-05-06 15:57:45 -0400632 -1, 9, -1, 8, -1, 37, -1, 3, 37, -1,
Alexis Hetub027aa92015-01-19 15:56:12 -0500633 36, -1, 141, -1, 140, 141, -1, 4, -1, 5,
634 -1, 6, -1, 142, -1, 142, 74, 125, 75, -1,
John Bauman66b8ab22014-05-06 15:57:45 -0400635 39, -1, 11, -1, 12, -1, 10, -1, 27, -1,
636 28, -1, 29, -1, 21, -1, 22, -1, 23, -1,
637 24, -1, 25, -1, 26, -1, 30, -1, 31, -1,
Alexis Hetub027aa92015-01-19 15:56:12 -0500638 32, -1, 41, -1, 42, -1, 43, -1, 44, -1,
639 143, -1, 46, -1, -1, 38, 45, 76, 144, 146,
640 77, -1, -1, 38, 76, 145, 146, 77, -1, 147,
641 -1, 146, 147, -1, 139, 148, 82, -1, 149, -1,
642 148, 79, 149, -1, 45, -1, 45, 74, 125, 75,
643 -1, 122, -1, 126, -1, 154, -1, 153, -1, 151,
644 -1, 163, -1, 164, -1, 167, -1, 174, -1, 76,
645 77, -1, -1, -1, 76, 155, 162, 156, 77, -1,
646 161, -1, 153, -1, -1, 159, 161, -1, -1, 160,
647 153, -1, 76, 77, -1, 76, 162, 77, -1, 152,
648 -1, 162, 152, -1, 82, -1, 124, 82, -1, 18,
649 72, 124, 73, 165, -1, 158, 16, 158, -1, 158,
650 -1, 124, -1, 137, 45, 81, 150, -1, -1, 40,
651 72, 168, 166, 73, 157, -1, -1, 15, 169, 158,
652 40, 72, 124, 73, 82, -1, -1, 17, 72, 170,
653 171, 173, 73, 157, -1, 163, -1, 151, -1, 166,
654 -1, -1, 172, 82, -1, 172, 82, 124, -1, 14,
655 82, -1, 13, 82, -1, 20, 82, -1, 20, 124,
656 82, -1, 19, 82, -1, 176, -1, 175, 176, -1,
657 177, -1, 126, -1, -1, 127, 178, 161, -1
John Bauman66b8ab22014-05-06 15:57:45 -0400658};
659
660/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
661static const yytype_uint16 yyrline[] =
662{
Nicolas Capens6407fe82015-02-10 16:27:49 -0500663 0, 167, 167, 202, 205, 218, 223, 228, 234, 237,
664 316, 319, 420, 430, 443, 451, 551, 554, 562, 566,
665 573, 577, 584, 590, 599, 607, 662, 669, 679, 682,
666 692, 702, 723, 724, 725, 730, 731, 740, 752, 753,
667 761, 772, 776, 777, 787, 797, 807, 820, 821, 831,
668 844, 848, 852, 856, 857, 870, 871, 884, 885, 898,
669 899, 916, 917, 930, 931, 932, 933, 934, 938, 941,
670 952, 960, 987, 992, 1002, 1040, 1043, 1050, 1058, 1079,
671 1100, 1111, 1140, 1145, 1155, 1160, 1170, 1173, 1176, 1179,
672 1185, 1192, 1195, 1217, 1235, 1259, 1282, 1286, 1304, 1312,
673 1344, 1364, 1452, 1461, 1484, 1487, 1493, 1501, 1509, 1517,
674 1527, 1534, 1537, 1540, 1546, 1549, 1564, 1568, 1572, 1576,
675 1585, 1590, 1595, 1600, 1605, 1610, 1615, 1620, 1625, 1630,
676 1636, 1642, 1648, 1653, 1658, 1667, 1672, 1677, 1690, 1690,
Nicolas Capens08ca3c62015-02-13 16:06:45 -0500677 1704, 1704, 1713, 1716, 1731, 1763, 1767, 1773, 1781, 1797,
678 1801, 1805, 1806, 1812, 1813, 1814, 1815, 1816, 1820, 1821,
679 1821, 1821, 1831, 1832, 1836, 1836, 1837, 1837, 1842, 1845,
680 1855, 1858, 1864, 1865, 1869, 1877, 1881, 1891, 1896, 1913,
681 1913, 1918, 1918, 1925, 1925, 1933, 1936, 1942, 1945, 1951,
682 1955, 1962, 1969, 1976, 1983, 1994, 2003, 2007, 2014, 2017,
683 2023, 2023
John Bauman66b8ab22014-05-06 15:57:45 -0400684};
685#endif
686
687#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
688/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
689 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
690static const char *const yytname[] =
691{
692 "$end", "error", "$undefined", "INVARIANT", "HIGH_PRECISION",
693 "MEDIUM_PRECISION", "LOW_PRECISION", "PRECISION", "ATTRIBUTE",
694 "CONST_QUAL", "BOOL_TYPE", "FLOAT_TYPE", "INT_TYPE", "BREAK", "CONTINUE",
695 "DO", "ELSE", "FOR", "IF", "DISCARD", "RETURN", "BVEC2", "BVEC3",
696 "BVEC4", "IVEC2", "IVEC3", "IVEC4", "VEC2", "VEC3", "VEC4", "MATRIX2",
697 "MATRIX3", "MATRIX4", "IN_QUAL", "OUT_QUAL", "INOUT_QUAL", "UNIFORM",
698 "VARYING", "STRUCT", "VOID_TYPE", "WHILE", "SAMPLER2D", "SAMPLERCUBE",
Alexis Hetub027aa92015-01-19 15:56:12 -0500699 "SAMPLER_EXTERNAL_OES", "SAMPLER3D", "IDENTIFIER", "TYPE_NAME",
700 "FLOATCONSTANT", "INTCONSTANT", "BOOLCONSTANT", "FIELD_SELECTION",
701 "LEFT_OP", "RIGHT_OP", "INC_OP", "DEC_OP", "LE_OP", "GE_OP", "EQ_OP",
702 "NE_OP", "AND_OP", "OR_OP", "XOR_OP", "MUL_ASSIGN", "DIV_ASSIGN",
703 "ADD_ASSIGN", "MOD_ASSIGN", "LEFT_ASSIGN", "RIGHT_ASSIGN", "AND_ASSIGN",
704 "XOR_ASSIGN", "OR_ASSIGN", "SUB_ASSIGN", "LEFT_PAREN", "RIGHT_PAREN",
705 "LEFT_BRACKET", "RIGHT_BRACKET", "LEFT_BRACE", "RIGHT_BRACE", "DOT",
706 "COMMA", "COLON", "EQUAL", "SEMICOLON", "BANG", "DASH", "TILDE", "PLUS",
707 "STAR", "SLASH", "PERCENT", "LEFT_ANGLE", "RIGHT_ANGLE", "VERTICAL_BAR",
708 "CARET", "AMPERSAND", "QUESTION", "$accept", "variable_identifier",
John Bauman66b8ab22014-05-06 15:57:45 -0400709 "primary_expression", "postfix_expression", "integer_expression",
710 "function_call", "function_call_or_method", "function_call_generic",
711 "function_call_header_no_parameters",
712 "function_call_header_with_parameters", "function_call_header",
713 "function_identifier", "unary_expression", "unary_operator",
714 "multiplicative_expression", "additive_expression", "shift_expression",
715 "relational_expression", "equality_expression", "and_expression",
716 "exclusive_or_expression", "inclusive_or_expression",
717 "logical_and_expression", "logical_xor_expression",
718 "logical_or_expression", "conditional_expression",
719 "assignment_expression", "assignment_operator", "expression",
720 "constant_expression", "declaration", "function_prototype",
721 "function_declarator", "function_header_with_parameters",
722 "function_header", "parameter_declarator", "parameter_declaration",
723 "parameter_qualifier", "parameter_type_specifier",
724 "init_declarator_list", "single_declaration", "fully_specified_type",
725 "type_qualifier", "type_specifier", "precision_qualifier",
726 "type_specifier_no_prec", "type_specifier_nonarray", "struct_specifier",
727 "$@1", "$@2", "struct_declaration_list", "struct_declaration",
728 "struct_declarator_list", "struct_declarator", "initializer",
729 "declaration_statement", "statement", "simple_statement",
730 "compound_statement", "$@3", "$@4", "statement_no_new_scope",
731 "statement_with_scope", "$@5", "$@6", "compound_statement_no_new_scope",
732 "statement_list", "expression_statement", "selection_statement",
733 "selection_rest_statement", "condition", "iteration_statement", "$@7",
734 "$@8", "$@9", "for_init_statement", "conditionopt", "for_rest_statement",
735 "jump_statement", "translation_unit", "external_declaration",
736 "function_definition", "$@10", 0
737};
738#endif
739
740# ifdef YYPRINT
741/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
742 token YYLEX-NUM. */
743static const yytype_uint16 yytoknum[] =
744{
745 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
746 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
747 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
748 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
749 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
750 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
751 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
752 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
753 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
Alexis Hetub027aa92015-01-19 15:56:12 -0500754 345, 346, 347, 348, 349, 350
John Bauman66b8ab22014-05-06 15:57:45 -0400755};
756# endif
757
758/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
759static const yytype_uint8 yyr1[] =
760{
Alexis Hetub027aa92015-01-19 15:56:12 -0500761 0, 96, 97, 98, 98, 98, 98, 98, 99, 99,
762 99, 99, 99, 99, 100, 101, 102, 102, 103, 103,
763 104, 104, 105, 105, 106, 107, 107, 107, 108, 108,
764 108, 108, 109, 109, 109, 110, 110, 110, 111, 111,
765 111, 112, 113, 113, 113, 113, 113, 114, 114, 114,
766 115, 116, 117, 118, 118, 119, 119, 120, 120, 121,
767 121, 122, 122, 123, 123, 123, 123, 123, 124, 124,
768 125, 126, 126, 126, 127, 128, 128, 129, 129, 130,
769 131, 131, 132, 132, 132, 132, 133, 133, 133, 133,
770 134, 135, 135, 135, 135, 135, 136, 136, 136, 136,
771 136, 136, 137, 137, 138, 138, 138, 138, 138, 139,
772 139, 140, 140, 140, 141, 141, 142, 142, 142, 142,
773 142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
774 142, 142, 142, 142, 142, 142, 142, 142, 144, 143,
775 145, 143, 146, 146, 147, 148, 148, 149, 149, 150,
776 151, 152, 152, 153, 153, 153, 153, 153, 154, 155,
777 156, 154, 157, 157, 159, 158, 160, 158, 161, 161,
778 162, 162, 163, 163, 164, 165, 165, 166, 166, 168,
779 167, 169, 167, 170, 167, 171, 171, 172, 172, 173,
780 173, 174, 174, 174, 174, 174, 175, 175, 176, 176,
781 178, 177
John Bauman66b8ab22014-05-06 15:57:45 -0400782};
783
784/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
785static const yytype_uint8 yyr2[] =
786{
787 0, 2, 1, 1, 1, 1, 1, 3, 1, 4,
788 1, 3, 2, 2, 1, 1, 1, 3, 2, 2,
789 2, 1, 2, 3, 2, 1, 1, 1, 1, 2,
790 2, 2, 1, 1, 1, 1, 3, 3, 1, 3,
791 3, 1, 1, 3, 3, 3, 3, 1, 3, 3,
792 1, 1, 1, 1, 3, 1, 3, 1, 3, 1,
793 5, 1, 3, 1, 1, 1, 1, 1, 1, 3,
794 1, 2, 2, 4, 2, 1, 1, 2, 3, 3,
795 2, 5, 3, 2, 3, 2, 0, 1, 1, 1,
796 1, 1, 3, 5, 6, 5, 1, 2, 4, 5,
797 4, 2, 1, 2, 1, 1, 1, 2, 1, 1,
798 2, 1, 1, 1, 1, 4, 1, 1, 1, 1,
799 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
Alexis Hetub027aa92015-01-19 15:56:12 -0500800 1, 1, 1, 1, 1, 1, 1, 1, 0, 6,
801 0, 5, 1, 2, 3, 1, 3, 1, 4, 1,
802 1, 1, 1, 1, 1, 1, 1, 1, 2, 0,
803 0, 5, 1, 1, 0, 2, 0, 2, 2, 3,
804 1, 2, 1, 2, 5, 3, 1, 1, 4, 0,
805 6, 0, 8, 0, 7, 1, 1, 1, 0, 2,
806 3, 2, 2, 2, 3, 2, 1, 2, 1, 1,
807 0, 3
John Bauman66b8ab22014-05-06 15:57:45 -0400808};
809
810/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
811 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
812 means the default is an error. */
813static const yytype_uint8 yydefact[] =
814{
815 0, 0, 111, 112, 113, 0, 105, 104, 119, 117,
816 118, 123, 124, 125, 126, 127, 128, 120, 121, 122,
Nicolas Capense9c5e4f2014-05-28 22:46:43 -0400817 129, 130, 131, 108, 106, 0, 116, 132, 133, 134,
Alexis Hetub027aa92015-01-19 15:56:12 -0500818 135, 137, 199, 200, 0, 76, 86, 0, 91, 96,
819 0, 102, 0, 109, 114, 136, 0, 196, 198, 107,
820 101, 0, 0, 140, 71, 0, 74, 86, 0, 87,
821 88, 89, 77, 0, 86, 0, 72, 97, 103, 110,
822 0, 1, 197, 0, 138, 0, 0, 201, 78, 83,
823 85, 90, 0, 92, 79, 0, 0, 2, 5, 4,
824 6, 27, 0, 0, 0, 34, 33, 32, 3, 8,
825 28, 10, 15, 16, 0, 0, 21, 0, 35, 0,
826 38, 41, 42, 47, 50, 51, 52, 53, 55, 57,
827 59, 70, 0, 25, 73, 0, 0, 0, 142, 0,
828 0, 181, 0, 0, 0, 0, 0, 159, 168, 172,
829 35, 61, 68, 0, 150, 0, 114, 153, 170, 152,
830 151, 0, 154, 155, 156, 157, 80, 82, 84, 0,
831 0, 98, 0, 149, 100, 29, 30, 0, 12, 13,
832 0, 0, 19, 18, 0, 20, 22, 24, 31, 0,
John Bauman66b8ab22014-05-06 15:57:45 -0400833 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Alexis Hetub027aa92015-01-19 15:56:12 -0500834 0, 0, 0, 115, 0, 147, 0, 145, 141, 143,
835 192, 191, 166, 183, 0, 195, 193, 0, 179, 158,
836 0, 64, 65, 66, 67, 63, 0, 0, 173, 169,
837 171, 0, 93, 0, 95, 99, 7, 0, 14, 26,
838 11, 17, 23, 36, 37, 40, 39, 45, 46, 43,
839 44, 48, 49, 54, 56, 58, 0, 139, 0, 0,
840 144, 0, 0, 0, 0, 0, 194, 0, 160, 62,
841 69, 0, 94, 9, 0, 0, 146, 0, 165, 167,
842 186, 185, 188, 166, 177, 0, 0, 0, 81, 60,
843 148, 0, 187, 0, 0, 176, 174, 0, 0, 161,
844 0, 189, 0, 166, 0, 163, 180, 162, 0, 190,
845 184, 175, 178, 182
John Bauman66b8ab22014-05-06 15:57:45 -0400846};
847
848/* YYDEFGOTO[NTERM-NUM]. */
849static const yytype_int16 yydefgoto[] =
850{
Alexis Hetub027aa92015-01-19 15:56:12 -0500851 -1, 98, 99, 100, 227, 101, 102, 103, 104, 105,
852 106, 107, 140, 109, 110, 111, 112, 113, 114, 115,
853 116, 117, 118, 119, 120, 141, 142, 216, 143, 122,
854 144, 145, 34, 35, 36, 79, 62, 63, 80, 37,
855 38, 39, 40, 41, 42, 43, 123, 45, 125, 75,
856 127, 128, 196, 197, 164, 147, 148, 149, 150, 210,
857 277, 296, 251, 252, 253, 297, 151, 152, 153, 286,
858 276, 154, 257, 202, 254, 272, 283, 284, 155, 46,
859 47, 48, 55
John Bauman66b8ab22014-05-06 15:57:45 -0400860};
861
862/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
863 STATE-NUM. */
Alexis Hetub027aa92015-01-19 15:56:12 -0500864#define YYPACT_NINF -266
John Bauman66b8ab22014-05-06 15:57:45 -0400865static const yytype_int16 yypact[] =
866{
Alexis Hetub027aa92015-01-19 15:56:12 -0500867 1253, -20, -266, -266, -266, 148, -266, -266, -266, -266,
868 -266, -266, -266, -266, -266, -266, -266, -266, -266, -266,
869 -266, -266, -266, -266, -266, -39, -266, -266, -266, -266,
870 -266, -266, -266, -18, -2, 6, 21, -61, -266, 51,
871 1296, -266, 1370, -266, 25, -266, 1209, -266, -266, -266,
872 -266, 1370, 42, -266, -266, 50, -266, 71, 95, -266,
873 -266, -266, -266, 1296, 123, 105, -266, 9, -266, -266,
874 974, -266, -266, 81, -266, 1296, 290, -266, -266, -266,
875 -266, 125, 1296, -13, -266, 776, 974, 99, -266, -266,
876 -266, -266, 974, 974, 974, -266, -266, -266, -266, -266,
877 35, -266, -266, -266, 100, -6, 1040, 104, -266, 974,
878 36, -64, -266, -21, 102, -266, -266, -266, 113, 117,
879 -51, -266, 108, -266, -266, 1296, 129, 1109, -266, 97,
880 103, -266, 112, 114, 106, 842, 115, 116, -266, -266,
881 39, -266, -266, -43, -266, -18, 47, -266, -266, -266,
882 -266, 374, -266, -266, -266, -266, 118, -266, -266, 908,
883 974, -266, 120, -266, -266, -266, -266, 19, -266, -266,
884 974, 1333, -266, -266, 974, 119, -266, -266, -266, 974,
885 974, 974, 974, 974, 974, 974, 974, 974, 974, 974,
886 974, 974, 974, -266, 1152, 122, -29, -266, -266, -266,
887 -266, -266, 121, -266, 974, -266, -266, 5, -266, -266,
888 458, -266, -266, -266, -266, -266, 974, 974, -266, -266,
889 -266, 974, -266, 137, -266, -266, -266, 138, 111, -266,
890 142, -266, -266, -266, -266, 36, 36, -266, -266, -266,
891 -266, -21, -21, -266, 113, 117, 82, -266, 974, 129,
892 -266, 175, 50, 626, 710, 38, -266, 197, 458, -266,
893 -266, 141, -266, -266, 974, 155, -266, 145, -266, -266,
894 -266, -266, 197, 121, 111, 186, 159, 160, -266, -266,
895 -266, 974, -266, 166, 176, 236, -266, 174, 542, -266,
896 43, 974, 542, 121, 974, -266, -266, -266, 177, 111,
897 -266, -266, -266, -266
John Bauman66b8ab22014-05-06 15:57:45 -0400898};
899
900/* YYPGOTO[NTERM-NUM]. */
901static const yytype_int16 yypgoto[] =
902{
Alexis Hetub027aa92015-01-19 15:56:12 -0500903 -266, -266, -266, -266, -266, -266, -266, 85, -266, -266,
904 -266, -266, -44, -266, -15, -266, -55, -19, -266, -266,
905 -266, 72, 70, 73, -266, -66, -83, -266, -92, -73,
906 13, 14, -266, -266, -266, 180, 206, 201, 184, -266,
907 -266, -241, -25, -30, 262, -4, 0, -266, -266, -266,
908 143, -122, -266, 22, -145, 16, -144, -226, -266, -266,
909 -266, -17, -265, -266, -266, -54, 63, 20, -266, -266,
910 4, -266, -266, -266, -266, -266, -266, -266, -266, -266,
911 231, -266, -266
John Bauman66b8ab22014-05-06 15:57:45 -0400912};
913
914/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
915 positive, shift that token. If negative, reduce the rule which
916 number is the opposite. If zero, do what YYDEFACT says.
917 If YYTABLE_NINF, syntax error. */
Alexis Hetub027aa92015-01-19 15:56:12 -0500918#define YYTABLE_NINF -165
John Bauman66b8ab22014-05-06 15:57:45 -0400919static const yytype_int16 yytable[] =
920{
Alexis Hetub027aa92015-01-19 15:56:12 -0500921 44, 77, 167, 163, 121, 199, 52, 220, 285, 191,
922 68, 64, 162, 32, 33, 224, 275, 49, 65, 121,
923 181, 66, 182, 176, 58, 50, 108, 269, 301, 6,
924 7, 275, 64, 81, 183, 184, 217, 53, 69, 218,
925 44, 108, 44, 207, 192, 126, 44, 73, 165, 166,
926 249, 44, 81, 250, 59, 60, 61, 23, 24, 32,
927 33, 159, 295, 44, 54, 178, 295, 173, 160, 185,
928 186, 56, 199, 174, 58, 44, 146, 163, 228, 6,
929 7, 84, 44, 85, 217, 57, 223, 256, 168, 169,
930 86, 232, 226, 121, -75, 126, 67, 126, 217, 70,
931 246, 211, 212, 213, 59, 60, 61, 23, 24, 170,
932 214, 273, 255, 171, 220, 108, 298, 217, 74, -25,
933 215, 70, 217, 179, 180, 44, 76, 44, 237, 238,
934 239, 240, 49, 259, 260, 233, 234, 108, 108, 108,
935 108, 108, 108, 108, 108, 108, 108, 108, 261, 302,
936 83, 146, 2, 3, 4, 121, 59, 60, 61, 187,
937 188, 217, 264, 124, 126, 274, 235, 236, 241, 242,
938 156, -26, 189, 172, 195, 265, 177, 108, 190, 200,
939 274, 279, 121, 193, 203, 201, 204, 208, 205, 290,
940 217, -116, 221, 209, 44, 225, 248, -164, 268, 299,
941 58, 2, 3, 4, 108, 6, 7, 8, 9, 10,
942 146, 163, 262, 263, -27, 267, 278, 281, 11, 12,
943 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
944 280, 287, 288, 23, 24, 25, 26, 289, 27, 28,
945 29, 30, 87, 31, 88, 89, 90, 91, 291, 292,
946 92, 93, 293, 146, 146, 294, 231, 146, 146, 303,
947 244, 243, 157, 78, 245, 82, 158, 51, 194, 94,
948 270, 266, 146, 258, 271, 300, 282, 72, 0, 0,
949 95, 96, 0, 97, 0, 0, 0, 0, 146, 0,
950 0, 0, 146, 1, 2, 3, 4, 5, 6, 7,
951 8, 9, 10, 129, 130, 131, 0, 132, 133, 134,
952 135, 11, 12, 13, 14, 15, 16, 17, 18, 19,
953 20, 21, 22, 0, 0, 0, 23, 24, 25, 26,
954 136, 27, 28, 29, 30, 87, 31, 88, 89, 90,
955 91, 0, 0, 92, 93, 0, 0, 0, 0, 0,
John Bauman66b8ab22014-05-06 15:57:45 -0400956 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Alexis Hetub027aa92015-01-19 15:56:12 -0500957 0, 0, 94, 0, 0, 0, 137, 138, 0, 0,
958 0, 0, 139, 95, 96, 0, 97, 1, 2, 3,
959 4, 5, 6, 7, 8, 9, 10, 129, 130, 131,
960 0, 132, 133, 134, 135, 11, 12, 13, 14, 15,
John Bauman66b8ab22014-05-06 15:57:45 -0400961 16, 17, 18, 19, 20, 21, 22, 0, 0, 0,
Alexis Hetub027aa92015-01-19 15:56:12 -0500962 23, 24, 25, 26, 136, 27, 28, 29, 30, 87,
963 31, 88, 89, 90, 91, 0, 0, 92, 93, 0,
John Bauman66b8ab22014-05-06 15:57:45 -0400964 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Alexis Hetub027aa92015-01-19 15:56:12 -0500965 0, 0, 0, 0, 0, 0, 94, 0, 0, 0,
966 137, 219, 0, 0, 0, 0, 139, 95, 96, 0,
967 97, 1, 2, 3, 4, 5, 6, 7, 8, 9,
968 10, 129, 130, 131, 0, 132, 133, 134, 135, 11,
John Bauman66b8ab22014-05-06 15:57:45 -0400969 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
Alexis Hetub027aa92015-01-19 15:56:12 -0500970 22, 0, 0, 0, 23, 24, 25, 26, 136, 27,
971 28, 29, 30, 87, 31, 88, 89, 90, 91, 0,
972 0, 92, 93, 0, 0, 0, 0, 0, 0, 0,
973 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
974 94, 0, 0, 0, 137, 0, 0, 0, 0, 0,
975 139, 95, 96, 0, 97, 1, 2, 3, 4, 5,
976 6, 7, 8, 9, 10, 129, 130, 131, 0, 132,
977 133, 134, 135, 11, 12, 13, 14, 15, 16, 17,
978 18, 19, 20, 21, 22, 0, 0, 0, 23, 24,
979 25, 26, 136, 27, 28, 29, 30, 87, 31, 88,
980 89, 90, 91, 0, 0, 92, 93, 0, 0, 0,
981 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
982 0, 0, 0, 0, 94, 0, 0, 0, 76, 0,
983 0, 0, 0, 0, 139, 95, 96, 0, 97, 1,
984 2, 3, 4, 5, 6, 7, 8, 9, 10, 129,
985 130, 131, 0, 132, 133, 134, 135, 11, 12, 13,
986 14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
987 0, 0, 23, 24, 25, 26, 136, 27, 28, 29,
988 30, 87, 31, 88, 89, 90, 91, 0, 0, 92,
989 93, 0, 0, 0, 0, 0, 0, 0, 0, 0,
990 0, 0, 0, 0, 0, 0, 0, 0, 94, 0,
991 0, 0, 0, 0, 0, 0, 0, 0, 139, 95,
992 96, 0, 97, 1, 2, 3, 4, 5, 6, 7,
993 8, 9, 10, 0, 0, 0, 0, 0, 0, 0,
994 0, 11, 12, 13, 14, 15, 16, 17, 18, 19,
995 20, 21, 22, 0, 0, 0, 23, 24, 25, 26,
996 0, 27, 28, 29, 30, 87, 31, 88, 89, 90,
997 91, 0, 0, 92, 93, 0, 0, 0, 0, 0,
998 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
999 0, 0, 94, 0, 0, 0, 8, 9, 10, 0,
1000 0, 0, 139, 95, 96, 0, 97, 11, 12, 13,
1001 14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
1002 0, 0, 0, 0, 25, 26, 0, 27, 28, 29,
1003 30, 87, 31, 88, 89, 90, 91, 0, 0, 92,
1004 93, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1005 0, 0, 0, 0, 0, 0, 0, 0, 94, 0,
1006 0, 161, 8, 9, 10, 0, 0, 0, 0, 95,
1007 96, 0, 97, 11, 12, 13, 14, 15, 16, 17,
1008 18, 19, 20, 21, 22, 0, 0, 0, 0, 0,
1009 25, 26, 0, 27, 28, 29, 30, 87, 31, 88,
1010 89, 90, 91, 0, 0, 92, 93, 0, 0, 0,
1011 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1012 0, 0, 0, 0, 94, 0, 0, 0, 8, 9,
1013 10, 0, 0, 0, 206, 95, 96, 0, 97, 11,
1014 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
1015 22, 0, 0, 0, 0, 0, 25, 26, 0, 27,
1016 28, 29, 30, 87, 31, 88, 89, 90, 91, 0,
1017 0, 92, 93, 0, 0, 0, 0, 0, 0, 0,
1018 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1019 94, 0, 0, 222, 8, 9, 10, 0, 0, 0,
1020 0, 95, 96, 0, 97, 11, 12, 13, 14, 15,
1021 16, 17, 18, 19, 20, 21, 22, 0, 0, 0,
1022 0, 0, 25, 26, 0, 27, 28, 29, 30, 87,
1023 31, 88, 89, 90, 91, 0, 0, 92, 93, 0,
1024 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1025 0, 0, 0, 0, 0, 0, 94, 0, 0, 0,
1026 8, 9, 10, 0, 0, 0, 0, 95, 96, 0,
1027 97, 11, 12, 13, 14, 15, 16, 17, 18, 19,
1028 20, 21, 22, 0, 0, 0, 0, 0, 25, 175,
1029 0, 27, 28, 29, 30, 87, 31, 88, 89, 90,
1030 91, 0, 0, 92, 93, 0, 0, 0, 0, 0,
1031 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1032 0, 0, 94, 2, 3, 4, 0, 0, 0, 8,
1033 9, 10, 0, 95, 96, 0, 97, 0, 0, 0,
John Bauman66b8ab22014-05-06 15:57:45 -04001034 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04001035 21, 22, 0, 0, 0, 0, 0, 25, 26, 0,
Alexis Hetub027aa92015-01-19 15:56:12 -05001036 27, 28, 29, 30, 0, 31, 2, 3, 4, 0,
1037 0, 0, 8, 9, 10, 0, 0, 0, 0, 0,
1038 0, 0, 0, 11, 12, 13, 14, 15, 16, 17,
1039 18, 19, 20, 21, 22, 0, 198, 0, 0, 0,
1040 25, 26, 0, 27, 28, 29, 30, 0, 31, 0,
1041 0, 0, 0, 0, 0, 0, 0, 0, 0, 71,
1042 0, 0, 1, 2, 3, 4, 5, 6, 7, 8,
1043 9, 10, 0, 0, 0, 0, 0, 0, 0, 247,
1044 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
1045 21, 22, 0, 0, 0, 23, 24, 25, 26, 0,
1046 27, 28, 29, 30, 0, 31, 1, 2, 3, 4,
1047 5, 6, 7, 8, 9, 10, 0, 0, 0, 0,
1048 0, 0, 0, 0, 11, 12, 13, 14, 15, 16,
1049 17, 18, 19, 20, 21, 22, 0, 0, 0, 23,
1050 24, 25, 26, 0, 27, 28, 29, 30, 0, 31,
1051 2, 3, 4, 0, 0, 0, 8, 9, 10, 0,
1052 0, 0, 0, 0, 0, 0, 0, 11, 12, 13,
1053 14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
1054 0, 0, 0, 0, 25, 26, 0, 27, 28, 29,
1055 30, 0, 31, 8, 9, 10, 0, 0, 0, 0,
1056 0, 0, 0, 0, 11, 12, 13, 14, 15, 16,
1057 17, 18, 19, 20, 21, 22, 0, 0, 0, 0,
1058 0, 25, 26, 0, 27, 28, 29, 30, 229, 31,
1059 8, 9, 10, 230, 0, 0, 0, 0, 0, 0,
1060 0, 11, 12, 13, 14, 15, 16, 17, 18, 19,
1061 20, 21, 22, 0, 0, 0, 0, 0, 25, 26,
1062 0, 27, 28, 29, 30, 0, 31
John Bauman66b8ab22014-05-06 15:57:45 -04001063};
1064
1065static const yytype_int16 yycheck[] =
1066{
Alexis Hetub027aa92015-01-19 15:56:12 -05001067 0, 55, 94, 86, 70, 127, 45, 151, 273, 60,
1068 40, 36, 85, 0, 0, 160, 257, 37, 79, 85,
1069 84, 82, 86, 106, 3, 45, 70, 253, 293, 8,
1070 9, 272, 57, 63, 55, 56, 79, 76, 42, 82,
1071 40, 85, 42, 135, 95, 75, 46, 51, 92, 93,
1072 79, 51, 82, 82, 33, 34, 35, 36, 37, 46,
1073 46, 74, 288, 63, 82, 109, 292, 73, 81, 90,
1074 91, 73, 194, 79, 3, 75, 76, 160, 170, 8,
1075 9, 72, 82, 74, 79, 79, 159, 82, 53, 54,
1076 81, 174, 73, 159, 73, 125, 45, 127, 79, 74,
1077 192, 62, 63, 64, 33, 34, 35, 36, 37, 74,
1078 71, 73, 204, 78, 258, 159, 73, 79, 76, 72,
1079 81, 74, 79, 87, 88, 125, 76, 127, 183, 184,
1080 185, 186, 37, 216, 217, 179, 180, 181, 182, 183,
1081 184, 185, 186, 187, 188, 189, 190, 191, 221, 294,
1082 45, 151, 4, 5, 6, 221, 33, 34, 35, 57,
1083 58, 79, 80, 82, 194, 257, 181, 182, 187, 188,
1084 45, 72, 59, 73, 45, 248, 72, 221, 61, 82,
1085 272, 264, 248, 75, 72, 82, 72, 72, 82, 281,
1086 79, 72, 74, 77, 194, 75, 74, 76, 252, 291,
1087 3, 4, 5, 6, 248, 8, 9, 10, 11, 12,
1088 210, 294, 75, 75, 72, 40, 75, 72, 21, 22,
1089 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
1090 75, 45, 73, 36, 37, 38, 39, 77, 41, 42,
1091 43, 44, 45, 46, 47, 48, 49, 50, 82, 73,
1092 53, 54, 16, 253, 254, 81, 171, 257, 258, 82,
1093 190, 189, 82, 57, 191, 64, 82, 5, 125, 72,
1094 254, 249, 272, 210, 254, 292, 272, 46, -1, -1,
1095 83, 84, -1, 86, -1, -1, -1, -1, 288, -1,
1096 -1, -1, 292, 3, 4, 5, 6, 7, 8, 9,
1097 10, 11, 12, 13, 14, 15, -1, 17, 18, 19,
1098 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
1099 30, 31, 32, -1, -1, -1, 36, 37, 38, 39,
1100 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
1101 50, -1, -1, 53, 54, -1, -1, -1, -1, -1,
John Bauman66b8ab22014-05-06 15:57:45 -04001102 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Alexis Hetub027aa92015-01-19 15:56:12 -05001103 -1, -1, 72, -1, -1, -1, 76, 77, -1, -1,
1104 -1, -1, 82, 83, 84, -1, 86, 3, 4, 5,
1105 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
1106 -1, 17, 18, 19, 20, 21, 22, 23, 24, 25,
1107 26, 27, 28, 29, 30, 31, 32, -1, -1, -1,
1108 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
1109 46, 47, 48, 49, 50, -1, -1, 53, 54, -1,
1110 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1111 -1, -1, -1, -1, -1, -1, 72, -1, -1, -1,
1112 76, 77, -1, -1, -1, -1, 82, 83, 84, -1,
1113 86, 3, 4, 5, 6, 7, 8, 9, 10, 11,
1114 12, 13, 14, 15, -1, 17, 18, 19, 20, 21,
1115 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
1116 32, -1, -1, -1, 36, 37, 38, 39, 40, 41,
1117 42, 43, 44, 45, 46, 47, 48, 49, 50, -1,
1118 -1, 53, 54, -1, -1, -1, -1, -1, -1, -1,
1119 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1120 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
1121 82, 83, 84, -1, 86, 3, 4, 5, 6, 7,
John Bauman66b8ab22014-05-06 15:57:45 -04001122 8, 9, 10, 11, 12, 13, 14, 15, -1, 17,
1123 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
1124 28, 29, 30, 31, 32, -1, -1, -1, 36, 37,
1125 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
Alexis Hetub027aa92015-01-19 15:56:12 -05001126 48, 49, 50, -1, -1, 53, 54, -1, -1, -1,
John Bauman66b8ab22014-05-06 15:57:45 -04001127 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Alexis Hetub027aa92015-01-19 15:56:12 -05001128 -1, -1, -1, -1, 72, -1, -1, -1, 76, -1,
1129 -1, -1, -1, -1, 82, 83, 84, -1, 86, 3,
1130 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
1131 14, 15, -1, 17, 18, 19, 20, 21, 22, 23,
John Bauman66b8ab22014-05-06 15:57:45 -04001132 24, 25, 26, 27, 28, 29, 30, 31, 32, -1,
Alexis Hetub027aa92015-01-19 15:56:12 -05001133 -1, -1, 36, 37, 38, 39, 40, 41, 42, 43,
1134 44, 45, 46, 47, 48, 49, 50, -1, -1, 53,
1135 54, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1136 -1, -1, -1, -1, -1, -1, -1, -1, 72, -1,
1137 -1, -1, -1, -1, -1, -1, -1, -1, 82, 83,
1138 84, -1, 86, 3, 4, 5, 6, 7, 8, 9,
1139 10, 11, 12, -1, -1, -1, -1, -1, -1, -1,
1140 -1, 21, 22, 23, 24, 25, 26, 27, 28, 29,
1141 30, 31, 32, -1, -1, -1, 36, 37, 38, 39,
1142 -1, 41, 42, 43, 44, 45, 46, 47, 48, 49,
1143 50, -1, -1, 53, 54, -1, -1, -1, -1, -1,
1144 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1145 -1, -1, 72, -1, -1, -1, 10, 11, 12, -1,
1146 -1, -1, 82, 83, 84, -1, 86, 21, 22, 23,
1147 24, 25, 26, 27, 28, 29, 30, 31, 32, -1,
1148 -1, -1, -1, -1, 38, 39, -1, 41, 42, 43,
1149 44, 45, 46, 47, 48, 49, 50, -1, -1, 53,
1150 54, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1151 -1, -1, -1, -1, -1, -1, -1, -1, 72, -1,
1152 -1, 75, 10, 11, 12, -1, -1, -1, -1, 83,
1153 84, -1, 86, 21, 22, 23, 24, 25, 26, 27,
1154 28, 29, 30, 31, 32, -1, -1, -1, -1, -1,
1155 38, 39, -1, 41, 42, 43, 44, 45, 46, 47,
1156 48, 49, 50, -1, -1, 53, 54, -1, -1, -1,
1157 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1158 -1, -1, -1, -1, 72, -1, -1, -1, 10, 11,
1159 12, -1, -1, -1, 82, 83, 84, -1, 86, 21,
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04001160 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
Alexis Hetub027aa92015-01-19 15:56:12 -05001161 32, -1, -1, -1, -1, -1, 38, 39, -1, 41,
1162 42, 43, 44, 45, 46, 47, 48, 49, 50, -1,
1163 -1, 53, 54, -1, -1, -1, -1, -1, -1, -1,
1164 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1165 72, -1, -1, 75, 10, 11, 12, -1, -1, -1,
1166 -1, 83, 84, -1, 86, 21, 22, 23, 24, 25,
1167 26, 27, 28, 29, 30, 31, 32, -1, -1, -1,
1168 -1, -1, 38, 39, -1, 41, 42, 43, 44, 45,
1169 46, 47, 48, 49, 50, -1, -1, 53, 54, -1,
1170 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1171 -1, -1, -1, -1, -1, -1, 72, -1, -1, -1,
1172 10, 11, 12, -1, -1, -1, -1, 83, 84, -1,
1173 86, 21, 22, 23, 24, 25, 26, 27, 28, 29,
1174 30, 31, 32, -1, -1, -1, -1, -1, 38, 39,
1175 -1, 41, 42, 43, 44, 45, 46, 47, 48, 49,
1176 50, -1, -1, 53, 54, -1, -1, -1, -1, -1,
1177 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1178 -1, -1, 72, 4, 5, 6, -1, -1, -1, 10,
1179 11, 12, -1, 83, 84, -1, 86, -1, -1, -1,
John Bauman66b8ab22014-05-06 15:57:45 -04001180 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04001181 31, 32, -1, -1, -1, -1, -1, 38, 39, -1,
Alexis Hetub027aa92015-01-19 15:56:12 -05001182 41, 42, 43, 44, -1, 46, 4, 5, 6, -1,
1183 -1, -1, 10, 11, 12, -1, -1, -1, -1, -1,
1184 -1, -1, -1, 21, 22, 23, 24, 25, 26, 27,
1185 28, 29, 30, 31, 32, -1, 77, -1, -1, -1,
1186 38, 39, -1, 41, 42, 43, 44, -1, 46, -1,
1187 -1, -1, -1, -1, -1, -1, -1, -1, -1, 0,
1188 -1, -1, 3, 4, 5, 6, 7, 8, 9, 10,
1189 11, 12, -1, -1, -1, -1, -1, -1, -1, 77,
1190 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
1191 31, 32, -1, -1, -1, 36, 37, 38, 39, -1,
1192 41, 42, 43, 44, -1, 46, 3, 4, 5, 6,
1193 7, 8, 9, 10, 11, 12, -1, -1, -1, -1,
1194 -1, -1, -1, -1, 21, 22, 23, 24, 25, 26,
1195 27, 28, 29, 30, 31, 32, -1, -1, -1, 36,
1196 37, 38, 39, -1, 41, 42, 43, 44, -1, 46,
1197 4, 5, 6, -1, -1, -1, 10, 11, 12, -1,
1198 -1, -1, -1, -1, -1, -1, -1, 21, 22, 23,
1199 24, 25, 26, 27, 28, 29, 30, 31, 32, -1,
1200 -1, -1, -1, -1, 38, 39, -1, 41, 42, 43,
1201 44, -1, 46, 10, 11, 12, -1, -1, -1, -1,
1202 -1, -1, -1, -1, 21, 22, 23, 24, 25, 26,
1203 27, 28, 29, 30, 31, 32, -1, -1, -1, -1,
1204 -1, 38, 39, -1, 41, 42, 43, 44, 45, 46,
1205 10, 11, 12, 50, -1, -1, -1, -1, -1, -1,
1206 -1, 21, 22, 23, 24, 25, 26, 27, 28, 29,
1207 30, 31, 32, -1, -1, -1, -1, -1, 38, 39,
1208 -1, 41, 42, 43, 44, -1, 46
John Bauman66b8ab22014-05-06 15:57:45 -04001209};
1210
1211/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
1212 symbol of state STATE-NUM. */
1213static const yytype_uint8 yystos[] =
1214{
1215 0, 3, 4, 5, 6, 7, 8, 9, 10, 11,
1216 12, 21, 22, 23, 24, 25, 26, 27, 28, 29,
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04001217 30, 31, 32, 36, 37, 38, 39, 41, 42, 43,
Alexis Hetub027aa92015-01-19 15:56:12 -05001218 44, 46, 126, 127, 128, 129, 130, 135, 136, 137,
1219 138, 139, 140, 141, 142, 143, 175, 176, 177, 37,
1220 45, 140, 45, 76, 82, 178, 73, 79, 3, 33,
1221 34, 35, 132, 133, 138, 79, 82, 45, 139, 141,
1222 74, 0, 176, 141, 76, 145, 76, 161, 132, 131,
1223 134, 139, 133, 45, 72, 74, 81, 45, 47, 48,
1224 49, 50, 53, 54, 72, 83, 84, 86, 97, 98,
1225 99, 101, 102, 103, 104, 105, 106, 107, 108, 109,
John Bauman66b8ab22014-05-06 15:57:45 -04001226 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
Alexis Hetub027aa92015-01-19 15:56:12 -05001227 120, 121, 125, 142, 82, 144, 139, 146, 147, 13,
1228 14, 15, 17, 18, 19, 20, 40, 76, 77, 82,
1229 108, 121, 122, 124, 126, 127, 142, 151, 152, 153,
1230 154, 162, 163, 164, 167, 174, 45, 131, 134, 74,
1231 81, 75, 125, 122, 150, 108, 108, 124, 53, 54,
1232 74, 78, 73, 73, 79, 39, 122, 72, 108, 87,
1233 88, 84, 86, 55, 56, 90, 91, 57, 58, 59,
1234 61, 60, 95, 75, 146, 45, 148, 149, 77, 147,
1235 82, 82, 169, 72, 72, 82, 82, 124, 72, 77,
1236 155, 62, 63, 64, 71, 81, 123, 79, 82, 77,
1237 152, 74, 75, 125, 150, 75, 73, 100, 124, 45,
1238 50, 103, 122, 108, 108, 110, 110, 112, 112, 112,
1239 112, 113, 113, 117, 118, 119, 124, 77, 74, 79,
1240 82, 158, 159, 160, 170, 124, 82, 168, 162, 122,
1241 122, 125, 75, 75, 80, 125, 149, 40, 161, 153,
1242 151, 163, 171, 73, 124, 137, 166, 156, 75, 122,
1243 75, 72, 166, 172, 173, 158, 165, 45, 73, 77,
1244 124, 82, 73, 16, 81, 153, 157, 161, 73, 124,
1245 157, 158, 150, 82
John Bauman66b8ab22014-05-06 15:57:45 -04001246};
1247
1248#define yyerrok (yyerrstatus = 0)
1249#define yyclearin (yychar = YYEMPTY)
1250#define YYEMPTY (-2)
1251#define YYEOF 0
1252
1253#define YYACCEPT goto yyacceptlab
1254#define YYABORT goto yyabortlab
1255#define YYERROR goto yyerrorlab
1256
1257
1258/* Like YYERROR except do call yyerror. This remains here temporarily
1259 to ease the transition to the new meaning of YYERROR, for GCC.
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04001260 Once GCC version 2 has supplanted version 1, this can go. */
John Bauman66b8ab22014-05-06 15:57:45 -04001261
1262#define YYFAIL goto yyerrlab
John Bauman66b8ab22014-05-06 15:57:45 -04001263
1264#define YYRECOVERING() (!!yyerrstatus)
1265
1266#define YYBACKUP(Token, Value) \
1267do \
1268 if (yychar == YYEMPTY && yylen == 1) \
1269 { \
1270 yychar = (Token); \
1271 yylval = (Value); \
1272 yytoken = YYTRANSLATE (yychar); \
1273 YYPOPSTACK (1); \
1274 goto yybackup; \
1275 } \
1276 else \
1277 { \
1278 yyerror (context, YY_("syntax error: cannot back up")); \
1279 YYERROR; \
1280 } \
1281while (YYID (0))
1282
1283
1284#define YYTERROR 1
1285#define YYERRCODE 256
1286
1287
1288/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
1289 If N is 0, then set CURRENT to the empty location which ends
1290 the previous symbol: RHS[0] (always defined). */
1291
1292#define YYRHSLOC(Rhs, K) ((Rhs)[K])
1293#ifndef YYLLOC_DEFAULT
1294# define YYLLOC_DEFAULT(Current, Rhs, N) \
1295 do \
1296 if (YYID (N)) \
1297 { \
1298 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
1299 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
1300 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
1301 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
1302 } \
1303 else \
1304 { \
1305 (Current).first_line = (Current).last_line = \
1306 YYRHSLOC (Rhs, 0).last_line; \
1307 (Current).first_column = (Current).last_column = \
1308 YYRHSLOC (Rhs, 0).last_column; \
1309 } \
1310 while (YYID (0))
1311#endif
1312
1313
1314/* YY_LOCATION_PRINT -- Print the location on the stream.
1315 This macro was not mandated originally: define only if we know
1316 we won't break user code: when these are the locations we know. */
1317
1318#ifndef YY_LOCATION_PRINT
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04001319# if YYLTYPE_IS_TRIVIAL
John Bauman66b8ab22014-05-06 15:57:45 -04001320# define YY_LOCATION_PRINT(File, Loc) \
1321 fprintf (File, "%d.%d-%d.%d", \
1322 (Loc).first_line, (Loc).first_column, \
1323 (Loc).last_line, (Loc).last_column)
1324# else
1325# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1326# endif
1327#endif
1328
1329
1330/* YYLEX -- calling `yylex' with the right arguments. */
1331
1332#ifdef YYLEX_PARAM
1333# define YYLEX yylex (&yylval, YYLEX_PARAM)
1334#else
1335# define YYLEX yylex (&yylval)
1336#endif
1337
1338/* Enable debugging if requested. */
1339#if YYDEBUG
1340
1341# ifndef YYFPRINTF
1342# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1343# define YYFPRINTF fprintf
1344# endif
1345
1346# define YYDPRINTF(Args) \
1347do { \
1348 if (yydebug) \
1349 YYFPRINTF Args; \
1350} while (YYID (0))
1351
1352# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
1353do { \
1354 if (yydebug) \
1355 { \
1356 YYFPRINTF (stderr, "%s ", Title); \
1357 yy_symbol_print (stderr, \
1358 Type, Value, context); \
1359 YYFPRINTF (stderr, "\n"); \
1360 } \
1361} while (YYID (0))
1362
1363
1364/*--------------------------------.
1365| Print this symbol on YYOUTPUT. |
1366`--------------------------------*/
1367
1368/*ARGSUSED*/
1369#if (defined __STDC__ || defined __C99__FUNC__ \
1370 || defined __cplusplus || defined _MSC_VER)
1371static void
1372yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, TParseContext* context)
1373#else
1374static void
1375yy_symbol_value_print (yyoutput, yytype, yyvaluep, context)
1376 FILE *yyoutput;
1377 int yytype;
1378 YYSTYPE const * const yyvaluep;
1379 TParseContext* context;
1380#endif
1381{
1382 if (!yyvaluep)
1383 return;
1384 YYUSE (context);
1385# ifdef YYPRINT
1386 if (yytype < YYNTOKENS)
1387 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1388# else
1389 YYUSE (yyoutput);
1390# endif
1391 switch (yytype)
1392 {
1393 default:
1394 break;
1395 }
1396}
1397
1398
1399/*--------------------------------.
1400| Print this symbol on YYOUTPUT. |
1401`--------------------------------*/
1402
1403#if (defined __STDC__ || defined __C99__FUNC__ \
1404 || defined __cplusplus || defined _MSC_VER)
1405static void
1406yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, TParseContext* context)
1407#else
1408static void
1409yy_symbol_print (yyoutput, yytype, yyvaluep, context)
1410 FILE *yyoutput;
1411 int yytype;
1412 YYSTYPE const * const yyvaluep;
1413 TParseContext* context;
1414#endif
1415{
1416 if (yytype < YYNTOKENS)
1417 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1418 else
1419 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1420
1421 yy_symbol_value_print (yyoutput, yytype, yyvaluep, context);
1422 YYFPRINTF (yyoutput, ")");
1423}
1424
1425/*------------------------------------------------------------------.
1426| yy_stack_print -- Print the state stack from its BOTTOM up to its |
1427| TOP (included). |
1428`------------------------------------------------------------------*/
1429
1430#if (defined __STDC__ || defined __C99__FUNC__ \
1431 || defined __cplusplus || defined _MSC_VER)
1432static void
1433yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
1434#else
1435static void
1436yy_stack_print (yybottom, yytop)
1437 yytype_int16 *yybottom;
1438 yytype_int16 *yytop;
1439#endif
1440{
1441 YYFPRINTF (stderr, "Stack now");
1442 for (; yybottom <= yytop; yybottom++)
1443 {
1444 int yybot = *yybottom;
1445 YYFPRINTF (stderr, " %d", yybot);
1446 }
1447 YYFPRINTF (stderr, "\n");
1448}
1449
1450# define YY_STACK_PRINT(Bottom, Top) \
1451do { \
1452 if (yydebug) \
1453 yy_stack_print ((Bottom), (Top)); \
1454} while (YYID (0))
1455
1456
1457/*------------------------------------------------.
1458| Report that the YYRULE is going to be reduced. |
1459`------------------------------------------------*/
1460
1461#if (defined __STDC__ || defined __C99__FUNC__ \
1462 || defined __cplusplus || defined _MSC_VER)
1463static void
1464yy_reduce_print (YYSTYPE *yyvsp, int yyrule, TParseContext* context)
1465#else
1466static void
1467yy_reduce_print (yyvsp, yyrule, context)
1468 YYSTYPE *yyvsp;
1469 int yyrule;
1470 TParseContext* context;
1471#endif
1472{
1473 int yynrhs = yyr2[yyrule];
1474 int yyi;
1475 unsigned long int yylno = yyrline[yyrule];
1476 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1477 yyrule - 1, yylno);
1478 /* The symbols being reduced. */
1479 for (yyi = 0; yyi < yynrhs; yyi++)
1480 {
1481 YYFPRINTF (stderr, " $%d = ", yyi + 1);
1482 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1483 &(yyvsp[(yyi + 1) - (yynrhs)])
1484 , context);
1485 YYFPRINTF (stderr, "\n");
1486 }
1487}
1488
1489# define YY_REDUCE_PRINT(Rule) \
1490do { \
1491 if (yydebug) \
1492 yy_reduce_print (yyvsp, Rule, context); \
1493} while (YYID (0))
1494
1495/* Nonzero means print parse trace. It is left uninitialized so that
1496 multiple parsers can coexist. */
1497int yydebug;
1498#else /* !YYDEBUG */
1499# define YYDPRINTF(Args)
1500# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1501# define YY_STACK_PRINT(Bottom, Top)
1502# define YY_REDUCE_PRINT(Rule)
1503#endif /* !YYDEBUG */
1504
1505
1506/* YYINITDEPTH -- initial size of the parser's stacks. */
1507#ifndef YYINITDEPTH
1508# define YYINITDEPTH 200
1509#endif
1510
1511/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1512 if the built-in stack extension method is used).
1513
1514 Do not make this value too large; the results are undefined if
1515 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1516 evaluated with infinite-precision integer arithmetic. */
1517
1518#ifndef YYMAXDEPTH
1519# define YYMAXDEPTH 10000
1520#endif
1521
1522
1523
1524#if YYERROR_VERBOSE
1525
1526# ifndef yystrlen
1527# if defined __GLIBC__ && defined _STRING_H
1528# define yystrlen strlen
1529# else
1530/* Return the length of YYSTR. */
1531#if (defined __STDC__ || defined __C99__FUNC__ \
1532 || defined __cplusplus || defined _MSC_VER)
1533static YYSIZE_T
1534yystrlen (const char *yystr)
1535#else
1536static YYSIZE_T
1537yystrlen (yystr)
1538 const char *yystr;
1539#endif
1540{
1541 YYSIZE_T yylen;
1542 for (yylen = 0; yystr[yylen]; yylen++)
1543 continue;
1544 return yylen;
1545}
1546# endif
1547# endif
1548
1549# ifndef yystpcpy
1550# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1551# define yystpcpy stpcpy
1552# else
1553/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1554 YYDEST. */
1555#if (defined __STDC__ || defined __C99__FUNC__ \
1556 || defined __cplusplus || defined _MSC_VER)
1557static char *
1558yystpcpy (char *yydest, const char *yysrc)
1559#else
1560static char *
1561yystpcpy (yydest, yysrc)
1562 char *yydest;
1563 const char *yysrc;
1564#endif
1565{
1566 char *yyd = yydest;
1567 const char *yys = yysrc;
1568
1569 while ((*yyd++ = *yys++) != '\0')
1570 continue;
1571
1572 return yyd - 1;
1573}
1574# endif
1575# endif
1576
1577# ifndef yytnamerr
1578/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1579 quotes and backslashes, so that it's suitable for yyerror. The
1580 heuristic is that double-quoting is unnecessary unless the string
1581 contains an apostrophe, a comma, or backslash (other than
1582 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1583 null, do not copy; instead, return the length of what the result
1584 would have been. */
1585static YYSIZE_T
1586yytnamerr (char *yyres, const char *yystr)
1587{
1588 if (*yystr == '"')
1589 {
1590 YYSIZE_T yyn = 0;
1591 char const *yyp = yystr;
1592
1593 for (;;)
1594 switch (*++yyp)
1595 {
1596 case '\'':
1597 case ',':
1598 goto do_not_strip_quotes;
1599
1600 case '\\':
1601 if (*++yyp != '\\')
1602 goto do_not_strip_quotes;
1603 /* Fall through. */
1604 default:
1605 if (yyres)
1606 yyres[yyn] = *yyp;
1607 yyn++;
1608 break;
1609
1610 case '"':
1611 if (yyres)
1612 yyres[yyn] = '\0';
1613 return yyn;
1614 }
1615 do_not_strip_quotes: ;
1616 }
1617
1618 if (! yyres)
1619 return yystrlen (yystr);
1620
1621 return yystpcpy (yyres, yystr) - yyres;
1622}
1623# endif
1624
1625/* Copy into YYRESULT an error message about the unexpected token
1626 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1627 including the terminating null byte. If YYRESULT is null, do not
1628 copy anything; just return the number of bytes that would be
1629 copied. As a special case, return 0 if an ordinary "syntax error"
1630 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1631 size calculation. */
1632static YYSIZE_T
1633yysyntax_error (char *yyresult, int yystate, int yychar)
1634{
1635 int yyn = yypact[yystate];
1636
1637 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1638 return 0;
1639 else
1640 {
1641 int yytype = YYTRANSLATE (yychar);
1642 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1643 YYSIZE_T yysize = yysize0;
1644 YYSIZE_T yysize1;
1645 int yysize_overflow = 0;
1646 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1647 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1648 int yyx;
1649
1650# if 0
1651 /* This is so xgettext sees the translatable formats that are
1652 constructed on the fly. */
1653 YY_("syntax error, unexpected %s");
1654 YY_("syntax error, unexpected %s, expecting %s");
1655 YY_("syntax error, unexpected %s, expecting %s or %s");
1656 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1657 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1658# endif
1659 char *yyfmt;
1660 char const *yyf;
1661 static char const yyunexpected[] = "syntax error, unexpected %s";
1662 static char const yyexpecting[] = ", expecting %s";
1663 static char const yyor[] = " or %s";
1664 char yyformat[sizeof yyunexpected
1665 + sizeof yyexpecting - 1
1666 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1667 * (sizeof yyor - 1))];
1668 char const *yyprefix = yyexpecting;
1669
1670 /* Start YYX at -YYN if negative to avoid negative indexes in
1671 YYCHECK. */
1672 int yyxbegin = yyn < 0 ? -yyn : 0;
1673
1674 /* Stay within bounds of both yycheck and yytname. */
1675 int yychecklim = YYLAST - yyn + 1;
1676 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1677 int yycount = 1;
1678
1679 yyarg[0] = yytname[yytype];
1680 yyfmt = yystpcpy (yyformat, yyunexpected);
1681
1682 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1683 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1684 {
1685 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1686 {
1687 yycount = 1;
1688 yysize = yysize0;
1689 yyformat[sizeof yyunexpected - 1] = '\0';
1690 break;
1691 }
1692 yyarg[yycount++] = yytname[yyx];
1693 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1694 yysize_overflow |= (yysize1 < yysize);
1695 yysize = yysize1;
1696 yyfmt = yystpcpy (yyfmt, yyprefix);
1697 yyprefix = yyor;
1698 }
1699
1700 yyf = YY_(yyformat);
1701 yysize1 = yysize + yystrlen (yyf);
1702 yysize_overflow |= (yysize1 < yysize);
1703 yysize = yysize1;
1704
1705 if (yysize_overflow)
1706 return YYSIZE_MAXIMUM;
1707
1708 if (yyresult)
1709 {
1710 /* Avoid sprintf, as that infringes on the user's name space.
1711 Don't have undefined behavior even if the translation
1712 produced a string with the wrong number of "%s"s. */
1713 char *yyp = yyresult;
1714 int yyi = 0;
1715 while ((*yyp = *yyf) != '\0')
1716 {
1717 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1718 {
1719 yyp += yytnamerr (yyp, yyarg[yyi++]);
1720 yyf += 2;
1721 }
1722 else
1723 {
1724 yyp++;
1725 yyf++;
1726 }
1727 }
1728 }
1729 return yysize;
1730 }
1731}
1732#endif /* YYERROR_VERBOSE */
1733
1734
1735/*-----------------------------------------------.
1736| Release the memory associated to this symbol. |
1737`-----------------------------------------------*/
1738
1739/*ARGSUSED*/
1740#if (defined __STDC__ || defined __C99__FUNC__ \
1741 || defined __cplusplus || defined _MSC_VER)
1742static void
1743yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, TParseContext* context)
1744#else
1745static void
1746yydestruct (yymsg, yytype, yyvaluep, context)
1747 const char *yymsg;
1748 int yytype;
1749 YYSTYPE *yyvaluep;
1750 TParseContext* context;
1751#endif
1752{
1753 YYUSE (yyvaluep);
1754 YYUSE (context);
1755
1756 if (!yymsg)
1757 yymsg = "Deleting";
1758 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1759
1760 switch (yytype)
1761 {
1762
1763 default:
1764 break;
1765 }
1766}
1767
1768/* Prevent warnings from -Wmissing-prototypes. */
1769#ifdef YYPARSE_PARAM
1770#if defined __STDC__ || defined __cplusplus
1771int yyparse (void *YYPARSE_PARAM);
1772#else
1773int yyparse ();
1774#endif
1775#else /* ! YYPARSE_PARAM */
1776#if defined __STDC__ || defined __cplusplus
1777int yyparse (TParseContext* context);
1778#else
1779int yyparse ();
1780#endif
1781#endif /* ! YYPARSE_PARAM */
1782
1783
1784
1785
1786
1787/*-------------------------.
1788| yyparse or yypush_parse. |
1789`-------------------------*/
1790
1791#ifdef YYPARSE_PARAM
1792#if (defined __STDC__ || defined __C99__FUNC__ \
1793 || defined __cplusplus || defined _MSC_VER)
1794int
1795yyparse (void *YYPARSE_PARAM)
1796#else
1797int
1798yyparse (YYPARSE_PARAM)
1799 void *YYPARSE_PARAM;
1800#endif
1801#else /* ! YYPARSE_PARAM */
1802#if (defined __STDC__ || defined __C99__FUNC__ \
1803 || defined __cplusplus || defined _MSC_VER)
1804int
1805yyparse (TParseContext* context)
1806#else
1807int
1808yyparse (context)
1809 TParseContext* context;
1810#endif
1811#endif
1812{
1813/* The lookahead symbol. */
1814int yychar;
1815
1816/* The semantic value of the lookahead symbol. */
1817YYSTYPE yylval;
1818
1819 /* Number of syntax errors so far. */
1820 int yynerrs;
1821
1822 int yystate;
1823 /* Number of tokens to shift before error messages enabled. */
1824 int yyerrstatus;
1825
1826 /* The stacks and their tools:
1827 `yyss': related to states.
1828 `yyvs': related to semantic values.
1829
1830 Refer to the stacks thru separate pointers, to allow yyoverflow
1831 to reallocate them elsewhere. */
1832
1833 /* The state stack. */
1834 yytype_int16 yyssa[YYINITDEPTH];
1835 yytype_int16 *yyss;
1836 yytype_int16 *yyssp;
1837
1838 /* The semantic value stack. */
1839 YYSTYPE yyvsa[YYINITDEPTH];
1840 YYSTYPE *yyvs;
1841 YYSTYPE *yyvsp;
1842
1843 YYSIZE_T yystacksize;
1844
1845 int yyn;
1846 int yyresult;
1847 /* Lookahead token as an internal (translated) token number. */
1848 int yytoken;
1849 /* The variables used to return semantic value and location from the
1850 action routines. */
1851 YYSTYPE yyval;
1852
1853#if YYERROR_VERBOSE
1854 /* Buffer for error messages, and its allocated size. */
1855 char yymsgbuf[128];
1856 char *yymsg = yymsgbuf;
1857 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1858#endif
1859
1860#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1861
1862 /* The number of symbols on the RHS of the reduced rule.
1863 Keep to zero when no symbol should be popped. */
1864 int yylen = 0;
1865
1866 yytoken = 0;
1867 yyss = yyssa;
1868 yyvs = yyvsa;
1869 yystacksize = YYINITDEPTH;
1870
1871 YYDPRINTF ((stderr, "Starting parse\n"));
1872
1873 yystate = 0;
1874 yyerrstatus = 0;
1875 yynerrs = 0;
1876 yychar = YYEMPTY; /* Cause a token to be read. */
1877
1878 /* Initialize stack pointers.
1879 Waste one element of value and location stack
1880 so that they stay on the same level as the state stack.
1881 The wasted elements are never initialized. */
1882 yyssp = yyss;
1883 yyvsp = yyvs;
1884
1885 goto yysetstate;
1886
1887/*------------------------------------------------------------.
1888| yynewstate -- Push a new state, which is found in yystate. |
1889`------------------------------------------------------------*/
1890 yynewstate:
1891 /* In all cases, when you get here, the value and location stacks
1892 have just been pushed. So pushing a state here evens the stacks. */
1893 yyssp++;
1894
1895 yysetstate:
1896 *yyssp = yystate;
1897
1898 if (yyss + yystacksize - 1 <= yyssp)
1899 {
1900 /* Get the current used size of the three stacks, in elements. */
1901 YYSIZE_T yysize = yyssp - yyss + 1;
1902
1903#ifdef yyoverflow
1904 {
1905 /* Give user a chance to reallocate the stack. Use copies of
1906 these so that the &'s don't force the real ones into
1907 memory. */
1908 YYSTYPE *yyvs1 = yyvs;
1909 yytype_int16 *yyss1 = yyss;
1910
1911 /* Each stack pointer address is followed by the size of the
1912 data in use in that stack, in bytes. This used to be a
1913 conditional around just the two extra args, but that might
1914 be undefined if yyoverflow is a macro. */
1915 yyoverflow (YY_("memory exhausted"),
1916 &yyss1, yysize * sizeof (*yyssp),
1917 &yyvs1, yysize * sizeof (*yyvsp),
1918 &yystacksize);
1919
1920 yyss = yyss1;
1921 yyvs = yyvs1;
1922 }
1923#else /* no yyoverflow */
1924# ifndef YYSTACK_RELOCATE
1925 goto yyexhaustedlab;
1926# else
1927 /* Extend the stack our own way. */
1928 if (YYMAXDEPTH <= yystacksize)
1929 goto yyexhaustedlab;
1930 yystacksize *= 2;
1931 if (YYMAXDEPTH < yystacksize)
1932 yystacksize = YYMAXDEPTH;
1933
1934 {
1935 yytype_int16 *yyss1 = yyss;
1936 union yyalloc *yyptr =
1937 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1938 if (! yyptr)
1939 goto yyexhaustedlab;
1940 YYSTACK_RELOCATE (yyss_alloc, yyss);
1941 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1942# undef YYSTACK_RELOCATE
1943 if (yyss1 != yyssa)
1944 YYSTACK_FREE (yyss1);
1945 }
1946# endif
1947#endif /* no yyoverflow */
1948
1949 yyssp = yyss + yysize - 1;
1950 yyvsp = yyvs + yysize - 1;
1951
1952 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1953 (unsigned long int) yystacksize));
1954
1955 if (yyss + yystacksize - 1 <= yyssp)
1956 YYABORT;
1957 }
1958
1959 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1960
1961 if (yystate == YYFINAL)
1962 YYACCEPT;
1963
1964 goto yybackup;
1965
1966/*-----------.
1967| yybackup. |
1968`-----------*/
1969yybackup:
1970
1971 /* Do appropriate processing given the current state. Read a
1972 lookahead token if we need one and don't already have one. */
1973
1974 /* First try to decide what to do without reference to lookahead token. */
1975 yyn = yypact[yystate];
1976 if (yyn == YYPACT_NINF)
1977 goto yydefault;
1978
1979 /* Not known => get a lookahead token if don't already have one. */
1980
1981 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1982 if (yychar == YYEMPTY)
1983 {
1984 YYDPRINTF ((stderr, "Reading a token: "));
1985 yychar = YYLEX;
1986 }
1987
1988 if (yychar <= YYEOF)
1989 {
1990 yychar = yytoken = YYEOF;
1991 YYDPRINTF ((stderr, "Now at end of input.\n"));
1992 }
1993 else
1994 {
1995 yytoken = YYTRANSLATE (yychar);
1996 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1997 }
1998
1999 /* If the proper action on seeing token YYTOKEN is to reduce or to
2000 detect an error, take that action. */
2001 yyn += yytoken;
2002 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
2003 goto yydefault;
2004 yyn = yytable[yyn];
2005 if (yyn <= 0)
2006 {
2007 if (yyn == 0 || yyn == YYTABLE_NINF)
2008 goto yyerrlab;
2009 yyn = -yyn;
2010 goto yyreduce;
2011 }
2012
2013 /* Count tokens shifted since error; after three, turn off error
2014 status. */
2015 if (yyerrstatus)
2016 yyerrstatus--;
2017
2018 /* Shift the lookahead token. */
2019 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
2020
2021 /* Discard the shifted token. */
2022 yychar = YYEMPTY;
2023
2024 yystate = yyn;
2025 *++yyvsp = yylval;
2026
2027 goto yynewstate;
2028
2029
2030/*-----------------------------------------------------------.
2031| yydefault -- do the default action for the current state. |
2032`-----------------------------------------------------------*/
2033yydefault:
2034 yyn = yydefact[yystate];
2035 if (yyn == 0)
2036 goto yyerrlab;
2037 goto yyreduce;
2038
2039
2040/*-----------------------------.
2041| yyreduce -- Do a reduction. |
2042`-----------------------------*/
2043yyreduce:
2044 /* yyn is the number of a rule to reduce with. */
2045 yylen = yyr2[yyn];
2046
2047 /* If YYLEN is nonzero, implement the default value of the action:
2048 `$$ = $1'.
2049
2050 Otherwise, the following line sets YYVAL to garbage.
2051 This behavior is undocumented and Bison
2052 users should not rely upon it. Assigning to YYVAL
2053 unconditionally makes the parser a bit smaller, and it avoids a
2054 GCC warning that YYVAL may be used uninitialized. */
2055 yyval = yyvsp[1-yylen];
2056
2057
2058 YY_REDUCE_PRINT (yyn);
2059 switch (yyn)
2060 {
2061 case 2:
2062
2063 {
2064 // The symbol table search was done in the lexical phase
2065 const TSymbol* symbol = (yyvsp[(1) - (1)].lex).symbol;
2066 const TVariable* variable;
2067 if (symbol == 0) {
2068 context->error((yyvsp[(1) - (1)].lex).line, "undeclared identifier", (yyvsp[(1) - (1)].lex).string->c_str());
2069 context->recover();
2070 TType type(EbtFloat, EbpUndefined);
2071 TVariable* fakeVariable = new TVariable((yyvsp[(1) - (1)].lex).string, type);
2072 context->symbolTable.insert(*fakeVariable);
2073 variable = fakeVariable;
2074 } else {
2075 // This identifier can only be a variable type symbol
2076 if (! symbol->isVariable()) {
2077 context->error((yyvsp[(1) - (1)].lex).line, "variable expected", (yyvsp[(1) - (1)].lex).string->c_str());
2078 context->recover();
2079 }
2080 variable = static_cast<const TVariable*>(symbol);
2081 }
2082
2083 // don't delete $1.string, it's used by error recovery, and the pool
2084 // pop will reclaim the memory
2085
2086 if (variable->getType().getQualifier() == EvqConst ) {
2087 ConstantUnion* constArray = variable->getConstPointer();
2088 TType t(variable->getType());
2089 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(constArray, t, (yyvsp[(1) - (1)].lex).line);
2090 } else
2091 (yyval.interm.intermTypedNode) = context->intermediate.addSymbol(variable->getUniqueId(),
2092 variable->getName(),
2093 variable->getType(), (yyvsp[(1) - (1)].lex).line);
2094 }
2095 break;
2096
2097 case 3:
2098
2099 {
2100 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
2101 }
2102 break;
2103
2104 case 4:
2105
2106 {
2107 //
2108 // INT_TYPE is only 16-bit plus sign bit for vertex/fragment shaders,
2109 // check for overflow for constants
2110 //
2111 if (abs((yyvsp[(1) - (1)].lex).i) >= (1 << 16)) {
2112 context->error((yyvsp[(1) - (1)].lex).line, " integer constant overflow", "");
2113 context->recover();
2114 }
2115 ConstantUnion *unionArray = new ConstantUnion[1];
2116 unionArray->setIConst((yyvsp[(1) - (1)].lex).i);
2117 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
2118 }
2119 break;
2120
2121 case 5:
2122
2123 {
2124 ConstantUnion *unionArray = new ConstantUnion[1];
2125 unionArray->setFConst((yyvsp[(1) - (1)].lex).f);
2126 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
2127 }
2128 break;
2129
2130 case 6:
2131
2132 {
2133 ConstantUnion *unionArray = new ConstantUnion[1];
2134 unionArray->setBConst((yyvsp[(1) - (1)].lex).b);
2135 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
2136 }
2137 break;
2138
2139 case 7:
2140
2141 {
2142 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (3)].interm.intermTypedNode);
2143 }
2144 break;
2145
2146 case 8:
2147
2148 {
2149 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
2150 }
2151 break;
2152
2153 case 9:
2154
2155 {
2156 if (!(yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isVector()) {
2157 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode())
2158 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());
2159 else
2160 context->error((yyvsp[(2) - (4)].lex).line, " left of '[' is not of type array, matrix, or vector ", "expression");
2161 context->recover();
2162 }
2163 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst && (yyvsp[(3) - (4)].interm.intermTypedNode)->getQualifier() == EvqConst) {
2164 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) { // constant folding for arrays
Nicolas Capens198529d2015-02-10 13:54:19 -05002165 (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 -04002166 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector()) { // constant folding for vectors
2167 TVectorFields fields;
2168 fields.num = 1;
Nicolas Capens198529d2015-02-10 13:54:19 -05002169 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 -04002170 (yyval.interm.intermTypedNode) = context->addConstVectorNode(fields, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2171 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix()) { // constant folding for matrices
Nicolas Capens198529d2015-02-10 13:54:19 -05002172 (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 -04002173 }
2174 } else {
2175 if ((yyvsp[(3) - (4)].interm.intermTypedNode)->getQualifier() == EvqConst) {
Nicolas Capens198529d2015-02-10 13:54:19 -05002176 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 -04002177 std::stringstream extraInfoStream;
Nicolas Capens198529d2015-02-10 13:54:19 -05002178 extraInfoStream << "field selection out of range '" << (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0) << "'";
John Bauman66b8ab22014-05-06 15:57:45 -04002179 std::string extraInfo = extraInfoStream.str();
2180 context->error((yyvsp[(2) - (4)].lex).line, "", "[", extraInfo.c_str());
2181 context->recover();
2182 } else {
2183 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) {
2184 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize() == 0) {
Nicolas Capens198529d2015-02-10 13:54:19 -05002185 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getMaxArraySize() <= (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0)) {
2186 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 -04002187 context->recover();
2188 } else {
2189 if (context->arraySetMaxSize((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getTypePointer(), 0, false, (yyvsp[(2) - (4)].lex).line))
2190 context->recover();
2191 }
Nicolas Capens198529d2015-02-10 13:54:19 -05002192 } else if ( (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0) >= (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize()) {
John Bauman66b8ab22014-05-06 15:57:45 -04002193 std::stringstream extraInfoStream;
Nicolas Capens198529d2015-02-10 13:54:19 -05002194 extraInfoStream << "array index out of range '" << (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0) << "'";
John Bauman66b8ab22014-05-06 15:57:45 -04002195 std::string extraInfo = extraInfoStream.str();
2196 context->error((yyvsp[(2) - (4)].lex).line, "", "[", extraInfo.c_str());
2197 context->recover();
2198 }
2199 }
2200 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(3) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2201 }
2202 } else {
2203 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize() == 0) {
2204 context->error((yyvsp[(2) - (4)].lex).line, "", "[", "array must be redeclared with a size before being indexed with a variable");
2205 context->recover();
2206 }
2207
2208 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexIndirect, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(3) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2209 }
2210 }
2211 if ((yyval.interm.intermTypedNode) == 0) {
2212 ConstantUnion *unionArray = new ConstantUnion[1];
2213 unionArray->setFConst(0.0f);
2214 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpHigh, EvqConst), (yyvsp[(2) - (4)].lex).line);
2215 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) {
2216 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getStruct())
2217 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getStruct(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getTypeName()));
2218 else
2219 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize(), (yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix()));
2220
2221 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst)
2222 (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConst);
2223 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst)
2224 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqConst, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize()));
2225 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix())
2226 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize()));
2227 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst)
2228 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqConst));
2229 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector())
2230 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary));
2231 else
2232 (yyval.interm.intermTypedNode)->setType((yyvsp[(1) - (4)].interm.intermTypedNode)->getType());
2233 }
2234 break;
2235
2236 case 10:
2237
2238 {
2239 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
2240 }
2241 break;
2242
2243 case 11:
2244
2245 {
2246 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isArray()) {
2247 context->error((yyvsp[(3) - (3)].lex).line, "cannot apply dot operator to an array", ".");
2248 context->recover();
2249 }
2250
2251 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isVector()) {
2252 TVectorFields fields;
2253 if (! context->parseVectorFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yyvsp[(3) - (3)].lex).line)) {
2254 fields.num = 1;
2255 fields.offsets[0] = 0;
2256 context->recover();
2257 }
2258
2259 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) { // constant folding for vector fields
2260 (yyval.interm.intermTypedNode) = context->addConstVectorNode(fields, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].lex).line);
2261 if ((yyval.interm.intermTypedNode) == 0) {
2262 context->recover();
2263 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2264 }
2265 else
2266 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(), EvqConst, (int) (*(yyvsp[(3) - (3)].lex).string).size()));
2267 } else {
2268 TString vectorString = *(yyvsp[(3) - (3)].lex).string;
2269 TIntermTyped* index = context->intermediate.addSwizzle(fields, (yyvsp[(3) - (3)].lex).line);
2270 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpVectorSwizzle, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2271 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (int) vectorString.size()));
2272 }
2273 } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isMatrix()) {
2274 TMatrixFields fields;
2275 if (! context->parseMatrixFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yyvsp[(3) - (3)].lex).line)) {
2276 fields.wholeRow = false;
2277 fields.wholeCol = false;
2278 fields.row = 0;
2279 fields.col = 0;
2280 context->recover();
2281 }
2282
2283 if (fields.wholeRow || fields.wholeCol) {
2284 context->error((yyvsp[(2) - (3)].lex).line, " non-scalar fields not implemented yet", ".");
2285 context->recover();
2286 ConstantUnion *unionArray = new ConstantUnion[1];
2287 unionArray->setIConst(0);
2288 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line);
2289 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2290 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(),EvqTemporary, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize()));
2291 } else {
2292 ConstantUnion *unionArray = new ConstantUnion[1];
2293 unionArray->setIConst(fields.col * (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize() + fields.row);
2294 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line);
2295 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2296 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision()));
2297 }
2298 } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType() == EbtStruct) {
2299 bool fieldFound = false;
2300 const TTypeList* fields = (yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getStruct();
2301 if (fields == 0) {
2302 context->error((yyvsp[(2) - (3)].lex).line, "structure has no fields", "Internal Error");
2303 context->recover();
2304 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2305 } else {
2306 unsigned int i;
2307 for (i = 0; i < fields->size(); ++i) {
2308 if ((*fields)[i].type->getFieldName() == *(yyvsp[(3) - (3)].lex).string) {
2309 fieldFound = true;
2310 break;
2311 }
2312 }
2313 if (fieldFound) {
2314 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) {
2315 (yyval.interm.intermTypedNode) = context->addConstStruct(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
2316 if ((yyval.interm.intermTypedNode) == 0) {
2317 context->recover();
2318 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2319 }
2320 else {
2321 (yyval.interm.intermTypedNode)->setType(*(*fields)[i].type);
2322 // change the qualifier of the return type, not of the structure field
2323 // as the structure definition is shared between various structures.
2324 (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConst);
2325 }
2326 } else {
2327 ConstantUnion *unionArray = new ConstantUnion[1];
2328 unionArray->setIConst(i);
2329 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, *(*fields)[i].type, (yyvsp[(3) - (3)].lex).line);
2330 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirectStruct, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2331 (yyval.interm.intermTypedNode)->setType(*(*fields)[i].type);
2332 }
2333 } else {
2334 context->error((yyvsp[(2) - (3)].lex).line, " no such field in structure", (yyvsp[(3) - (3)].lex).string->c_str());
2335 context->recover();
2336 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2337 }
2338 }
2339 } else {
2340 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());
2341 context->recover();
2342 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2343 }
2344 // don't delete $3.string, it's from the pool
2345 }
2346 break;
2347
2348 case 12:
2349
2350 {
2351 if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode)))
2352 context->recover();
John Baumand4ae8632014-05-06 16:18:33 -04002353 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostIncrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002354 if ((yyval.interm.intermTypedNode) == 0) {
2355 context->unaryOpError((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
2356 context->recover();
2357 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode);
2358 }
2359 }
2360 break;
2361
2362 case 13:
2363
2364 {
2365 if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode)))
2366 context->recover();
John Baumand4ae8632014-05-06 16:18:33 -04002367 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostDecrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002368 if ((yyval.interm.intermTypedNode) == 0) {
2369 context->unaryOpError((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
2370 context->recover();
2371 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode);
2372 }
2373 }
2374 break;
2375
2376 case 14:
2377
2378 {
2379 if (context->integerErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode), "[]"))
2380 context->recover();
2381 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
2382 }
2383 break;
2384
2385 case 15:
2386
2387 {
2388 TFunction* fnCall = (yyvsp[(1) - (1)].interm).function;
2389 TOperator op = fnCall->getBuiltInOp();
2390
2391 if (op != EOpNull)
2392 {
2393 //
2394 // Then this should be a constructor.
2395 // Don't go through the symbol table for constructors.
2396 // Their parameters will be verified algorithmically.
2397 //
2398 TType type(EbtVoid, EbpUndefined); // use this to get the type back
2399 if (context->constructorErrorCheck((yyvsp[(1) - (1)].interm).line, (yyvsp[(1) - (1)].interm).intermNode, *fnCall, op, &type)) {
2400 (yyval.interm.intermTypedNode) = 0;
2401 } else {
2402 //
2403 // It's a constructor, of type 'type'.
2404 //
2405 (yyval.interm.intermTypedNode) = context->addConstructor((yyvsp[(1) - (1)].interm).intermNode, &type, op, fnCall, (yyvsp[(1) - (1)].interm).line);
2406 }
2407
2408 if ((yyval.interm.intermTypedNode) == 0) {
2409 context->recover();
2410 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator(0, op, (yyvsp[(1) - (1)].interm).line);
2411 }
2412 (yyval.interm.intermTypedNode)->setType(type);
2413 } else {
2414 //
2415 // Not a constructor. Find it in the symbol table.
2416 //
2417 const TFunction* fnCandidate;
2418 bool builtIn;
2419 fnCandidate = context->findFunction((yyvsp[(1) - (1)].interm).line, fnCall, &builtIn);
2420 if (fnCandidate) {
2421 //
2422 // A declared function.
2423 //
2424 if (builtIn && !fnCandidate->getExtension().empty() &&
2425 context->extensionErrorCheck((yyvsp[(1) - (1)].interm).line, fnCandidate->getExtension())) {
2426 context->recover();
2427 }
2428 op = fnCandidate->getBuiltInOp();
2429 if (builtIn && op != EOpNull) {
2430 //
2431 // A function call mapped to a built-in operation.
2432 //
2433 if (fnCandidate->getParamCount() == 1) {
2434 //
2435 // Treat it like a built-in unary operator.
2436 //
John Baumand4ae8632014-05-06 16:18:33 -04002437 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(op, (yyvsp[(1) - (1)].interm).intermNode, 0);
John Bauman66b8ab22014-05-06 15:57:45 -04002438 if ((yyval.interm.intermTypedNode) == 0) {
2439 std::stringstream extraInfoStream;
2440 extraInfoStream << "built in unary operator function. Type: " << static_cast<TIntermTyped*>((yyvsp[(1) - (1)].interm).intermNode)->getCompleteString();
2441 std::string extraInfo = extraInfoStream.str();
2442 context->error((yyvsp[(1) - (1)].interm).intermNode->getLine(), " wrong operand type", "Internal Error", extraInfo.c_str());
2443 YYERROR;
2444 }
2445 } else {
2446 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, op, (yyvsp[(1) - (1)].interm).line);
2447 }
2448 } else {
2449 // This is a real function call
2450
2451 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, EOpFunctionCall, (yyvsp[(1) - (1)].interm).line);
2452 (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType());
2453
2454 // this is how we know whether the given function is a builtIn function or a user defined function
2455 // if builtIn == false, it's a userDefined -> could be an overloaded builtIn function also
2456 // if builtIn == true, it's definitely a builtIn function with EOpNull
2457 if (!builtIn)
2458 (yyval.interm.intermTypedNode)->getAsAggregate()->setUserDefined();
2459 (yyval.interm.intermTypedNode)->getAsAggregate()->setName(fnCandidate->getMangledName());
2460
2461 TQualifier qual;
2462 for (int i = 0; i < fnCandidate->getParamCount(); ++i) {
2463 qual = fnCandidate->getParam(i).type->getQualifier();
2464 if (qual == EvqOut || qual == EvqInOut) {
2465 if (context->lValueErrorCheck((yyval.interm.intermTypedNode)->getLine(), "assign", (yyval.interm.intermTypedNode)->getAsAggregate()->getSequence()[i]->getAsTyped())) {
2466 context->error((yyvsp[(1) - (1)].interm).intermNode->getLine(), "Constant value cannot be passed for 'out' or 'inout' parameters.", "Error");
2467 context->recover();
2468 }
2469 }
2470 }
2471 }
2472 (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType());
2473 } else {
2474 // error message was put out by PaFindFunction()
2475 // Put on a dummy node for error recovery
2476 ConstantUnion *unionArray = new ConstantUnion[1];
2477 unionArray->setFConst(0.0f);
2478 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].interm).line);
2479 context->recover();
2480 }
2481 }
2482 delete fnCall;
2483 }
2484 break;
2485
2486 case 16:
2487
2488 {
2489 (yyval.interm) = (yyvsp[(1) - (1)].interm);
2490 }
2491 break;
2492
2493 case 17:
2494
2495 {
2496 context->error((yyvsp[(3) - (3)].interm).line, "methods are not supported", "");
2497 context->recover();
2498 (yyval.interm) = (yyvsp[(3) - (3)].interm);
2499 }
2500 break;
2501
2502 case 18:
2503
2504 {
2505 (yyval.interm) = (yyvsp[(1) - (2)].interm);
2506 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
2507 }
2508 break;
2509
2510 case 19:
2511
2512 {
2513 (yyval.interm) = (yyvsp[(1) - (2)].interm);
2514 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
2515 }
2516 break;
2517
2518 case 20:
2519
2520 {
2521 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
2522 (yyval.interm).intermNode = 0;
2523 }
2524 break;
2525
2526 case 21:
2527
2528 {
2529 (yyval.interm).function = (yyvsp[(1) - (1)].interm.function);
2530 (yyval.interm).intermNode = 0;
2531 }
2532 break;
2533
2534 case 22:
2535
2536 {
2537 TParameter param = { 0, new TType((yyvsp[(2) - (2)].interm.intermTypedNode)->getType()) };
2538 (yyvsp[(1) - (2)].interm.function)->addParameter(param);
2539 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
2540 (yyval.interm).intermNode = (yyvsp[(2) - (2)].interm.intermTypedNode);
2541 }
2542 break;
2543
2544 case 23:
2545
2546 {
2547 TParameter param = { 0, new TType((yyvsp[(3) - (3)].interm.intermTypedNode)->getType()) };
2548 (yyvsp[(1) - (3)].interm).function->addParameter(param);
2549 (yyval.interm).function = (yyvsp[(1) - (3)].interm).function;
2550 (yyval.interm).intermNode = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermNode, (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
2551 }
2552 break;
2553
2554 case 24:
2555
2556 {
2557 (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
2558 }
2559 break;
2560
2561 case 25:
2562
2563 {
2564 //
2565 // Constructor
2566 //
2567 TOperator op = EOpNull;
2568 if ((yyvsp[(1) - (1)].interm.type).userDef) {
2569 op = EOpConstructStruct;
2570 } else {
2571 switch ((yyvsp[(1) - (1)].interm.type).type) {
2572 case EbtFloat:
2573 if ((yyvsp[(1) - (1)].interm.type).matrix) {
2574 switch((yyvsp[(1) - (1)].interm.type).size) {
2575 case 2: op = EOpConstructMat2; break;
2576 case 3: op = EOpConstructMat3; break;
2577 case 4: op = EOpConstructMat4; break;
2578 }
2579 } else {
2580 switch((yyvsp[(1) - (1)].interm.type).size) {
2581 case 1: op = EOpConstructFloat; break;
2582 case 2: op = EOpConstructVec2; break;
2583 case 3: op = EOpConstructVec3; break;
2584 case 4: op = EOpConstructVec4; break;
2585 }
2586 }
2587 break;
2588 case EbtInt:
2589 switch((yyvsp[(1) - (1)].interm.type).size) {
2590 case 1: op = EOpConstructInt; break;
2591 case 2: FRAG_VERT_ONLY("ivec2", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec2; break;
2592 case 3: FRAG_VERT_ONLY("ivec3", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec3; break;
2593 case 4: FRAG_VERT_ONLY("ivec4", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec4; break;
2594 }
2595 break;
2596 case EbtBool:
2597 switch((yyvsp[(1) - (1)].interm.type).size) {
2598 case 1: op = EOpConstructBool; break;
2599 case 2: FRAG_VERT_ONLY("bvec2", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec2; break;
2600 case 3: FRAG_VERT_ONLY("bvec3", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec3; break;
2601 case 4: FRAG_VERT_ONLY("bvec4", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec4; break;
2602 }
2603 break;
2604 default: break;
2605 }
2606 if (op == EOpNull) {
2607 context->error((yyvsp[(1) - (1)].interm.type).line, "cannot construct this type", getBasicString((yyvsp[(1) - (1)].interm.type).type));
2608 context->recover();
2609 (yyvsp[(1) - (1)].interm.type).type = EbtFloat;
2610 op = EOpConstructFloat;
2611 }
2612 }
2613 TString tempString;
2614 TType type((yyvsp[(1) - (1)].interm.type));
2615 TFunction *function = new TFunction(&tempString, type, op);
2616 (yyval.interm.function) = function;
2617 }
2618 break;
2619
2620 case 26:
2621
2622 {
2623 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
2624 context->recover();
2625 TType type(EbtVoid, EbpUndefined);
2626 TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type);
2627 (yyval.interm.function) = function;
2628 }
2629 break;
2630
2631 case 27:
2632
2633 {
2634 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
2635 context->recover();
2636 TType type(EbtVoid, EbpUndefined);
2637 TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type);
2638 (yyval.interm.function) = function;
2639 }
2640 break;
2641
2642 case 28:
2643
2644 {
2645 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
2646 }
2647 break;
2648
2649 case 29:
2650
2651 {
2652 if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)))
2653 context->recover();
John Baumand4ae8632014-05-06 16:18:33 -04002654 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreIncrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002655 if ((yyval.interm.intermTypedNode) == 0) {
2656 context->unaryOpError((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2657 context->recover();
2658 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2659 }
2660 }
2661 break;
2662
2663 case 30:
2664
2665 {
2666 if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)))
2667 context->recover();
John Baumand4ae8632014-05-06 16:18:33 -04002668 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreDecrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line);
John Bauman66b8ab22014-05-06 15:57:45 -04002669 if ((yyval.interm.intermTypedNode) == 0) {
2670 context->unaryOpError((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2671 context->recover();
2672 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2673 }
2674 }
2675 break;
2676
2677 case 31:
2678
2679 {
2680 if ((yyvsp[(1) - (2)].interm).op != EOpNull) {
John Baumand4ae8632014-05-06 16:18:33 -04002681 (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 -04002682 if ((yyval.interm.intermTypedNode) == 0) {
2683 const char* errorOp = "";
2684 switch((yyvsp[(1) - (2)].interm).op) {
2685 case EOpNegative: errorOp = "-"; break;
2686 case EOpLogicalNot: errorOp = "!"; break;
2687 default: break;
2688 }
2689 context->unaryOpError((yyvsp[(1) - (2)].interm).line, errorOp, (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2690 context->recover();
2691 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2692 }
2693 } else
2694 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2695 }
2696 break;
2697
2698 case 32:
2699
2700 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNull; }
2701 break;
2702
2703 case 33:
2704
2705 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNegative; }
2706 break;
2707
2708 case 34:
2709
2710 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpLogicalNot; }
2711 break;
2712
2713 case 35:
2714
2715 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
2716 break;
2717
2718 case 36:
2719
2720 {
2721 FRAG_VERT_ONLY("*", (yyvsp[(2) - (3)].lex).line);
John Baumand4ae8632014-05-06 16:18:33 -04002722 (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 -04002723 if ((yyval.interm.intermTypedNode) == 0) {
2724 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "*", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2725 context->recover();
2726 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2727 }
2728 }
2729 break;
2730
2731 case 37:
2732
2733 {
2734 FRAG_VERT_ONLY("/", (yyvsp[(2) - (3)].lex).line);
John Baumand4ae8632014-05-06 16:18:33 -04002735 (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 -04002736 if ((yyval.interm.intermTypedNode) == 0) {
2737 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "/", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2738 context->recover();
2739 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2740 }
2741 }
2742 break;
2743
2744 case 38:
2745
2746 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
2747 break;
2748
2749 case 39:
2750
2751 {
John Baumand4ae8632014-05-06 16:18:33 -04002752 (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 -04002753 if ((yyval.interm.intermTypedNode) == 0) {
2754 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "+", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2755 context->recover();
2756 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2757 }
2758 }
2759 break;
2760
2761 case 40:
2762
2763 {
John Baumand4ae8632014-05-06 16:18:33 -04002764 (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 -04002765 if ((yyval.interm.intermTypedNode) == 0) {
2766 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "-", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2767 context->recover();
2768 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2769 }
2770 }
2771 break;
2772
2773 case 41:
2774
2775 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
2776 break;
2777
2778 case 42:
2779
2780 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
2781 break;
2782
2783 case 43:
2784
2785 {
John Baumand4ae8632014-05-06 16:18:33 -04002786 (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 -04002787 if ((yyval.interm.intermTypedNode) == 0) {
2788 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2789 context->recover();
2790 ConstantUnion *unionArray = new ConstantUnion[1];
2791 unionArray->setBConst(false);
2792 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2793 }
2794 }
2795 break;
2796
2797 case 44:
2798
2799 {
John Baumand4ae8632014-05-06 16:18:33 -04002800 (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 -04002801 if ((yyval.interm.intermTypedNode) == 0) {
2802 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2803 context->recover();
2804 ConstantUnion *unionArray = new ConstantUnion[1];
2805 unionArray->setBConst(false);
2806 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2807 }
2808 }
2809 break;
2810
2811 case 45:
2812
2813 {
John Baumand4ae8632014-05-06 16:18:33 -04002814 (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 -04002815 if ((yyval.interm.intermTypedNode) == 0) {
2816 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2817 context->recover();
2818 ConstantUnion *unionArray = new ConstantUnion[1];
2819 unionArray->setBConst(false);
2820 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2821 }
2822 }
2823 break;
2824
2825 case 46:
2826
2827 {
John Baumand4ae8632014-05-06 16:18:33 -04002828 (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 -04002829 if ((yyval.interm.intermTypedNode) == 0) {
2830 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2831 context->recover();
2832 ConstantUnion *unionArray = new ConstantUnion[1];
2833 unionArray->setBConst(false);
2834 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2835 }
2836 }
2837 break;
2838
2839 case 47:
2840
2841 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
2842 break;
2843
2844 case 48:
2845
2846 {
John Baumand4ae8632014-05-06 16:18:33 -04002847 (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 -04002848 if ((yyval.interm.intermTypedNode) == 0) {
2849 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "==", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2850 context->recover();
2851 ConstantUnion *unionArray = new ConstantUnion[1];
2852 unionArray->setBConst(false);
2853 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2854 }
2855 }
2856 break;
2857
2858 case 49:
2859
2860 {
John Baumand4ae8632014-05-06 16:18:33 -04002861 (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 -04002862 if ((yyval.interm.intermTypedNode) == 0) {
2863 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "!=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2864 context->recover();
2865 ConstantUnion *unionArray = new ConstantUnion[1];
2866 unionArray->setBConst(false);
2867 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2868 }
2869 }
2870 break;
2871
2872 case 50:
2873
2874 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
2875 break;
2876
2877 case 51:
2878
2879 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
2880 break;
2881
2882 case 52:
2883
2884 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
2885 break;
2886
2887 case 53:
2888
2889 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
2890 break;
2891
2892 case 54:
2893
2894 {
John Baumand4ae8632014-05-06 16:18:33 -04002895 (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 -04002896 if ((yyval.interm.intermTypedNode) == 0) {
2897 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "&&", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2898 context->recover();
2899 ConstantUnion *unionArray = new ConstantUnion[1];
2900 unionArray->setBConst(false);
2901 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2902 }
2903 }
2904 break;
2905
2906 case 55:
2907
2908 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
2909 break;
2910
2911 case 56:
2912
2913 {
John Baumand4ae8632014-05-06 16:18:33 -04002914 (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 -04002915 if ((yyval.interm.intermTypedNode) == 0) {
2916 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "^^", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2917 context->recover();
2918 ConstantUnion *unionArray = new ConstantUnion[1];
2919 unionArray->setBConst(false);
2920 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2921 }
2922 }
2923 break;
2924
2925 case 57:
2926
2927 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
2928 break;
2929
2930 case 58:
2931
2932 {
John Baumand4ae8632014-05-06 16:18:33 -04002933 (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 -04002934 if ((yyval.interm.intermTypedNode) == 0) {
2935 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "||", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2936 context->recover();
2937 ConstantUnion *unionArray = new ConstantUnion[1];
2938 unionArray->setBConst(false);
2939 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2940 }
2941 }
2942 break;
2943
2944 case 59:
2945
2946 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
2947 break;
2948
2949 case 60:
2950
2951 {
2952 if (context->boolErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.intermTypedNode)))
2953 context->recover();
2954
2955 (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);
2956 if ((yyvsp[(3) - (5)].interm.intermTypedNode)->getType() != (yyvsp[(5) - (5)].interm.intermTypedNode)->getType())
2957 (yyval.interm.intermTypedNode) = 0;
2958
2959 if ((yyval.interm.intermTypedNode) == 0) {
2960 context->binaryOpError((yyvsp[(2) - (5)].lex).line, ":", (yyvsp[(3) - (5)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(5) - (5)].interm.intermTypedNode)->getCompleteString());
2961 context->recover();
2962 (yyval.interm.intermTypedNode) = (yyvsp[(5) - (5)].interm.intermTypedNode);
2963 }
2964 }
2965 break;
2966
2967 case 61:
2968
2969 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
2970 break;
2971
2972 case 62:
2973
2974 {
2975 if (context->lValueErrorCheck((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)))
2976 context->recover();
2977 (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);
2978 if ((yyval.interm.intermTypedNode) == 0) {
2979 context->assignError((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2980 context->recover();
2981 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2982 }
2983 }
2984 break;
2985
2986 case 63:
2987
2988 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAssign; }
2989 break;
2990
2991 case 64:
2992
2993 { FRAG_VERT_ONLY("*=", (yyvsp[(1) - (1)].lex).line); (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpMulAssign; }
2994 break;
2995
2996 case 65:
2997
2998 { FRAG_VERT_ONLY("/=", (yyvsp[(1) - (1)].lex).line); (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpDivAssign; }
2999 break;
3000
3001 case 66:
3002
3003 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAddAssign; }
3004 break;
3005
3006 case 67:
3007
3008 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpSubAssign; }
3009 break;
3010
3011 case 68:
3012
3013 {
3014 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
3015 }
3016 break;
3017
3018 case 69:
3019
3020 {
3021 (yyval.interm.intermTypedNode) = context->intermediate.addComma((yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
3022 if ((yyval.interm.intermTypedNode) == 0) {
3023 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ",", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3024 context->recover();
3025 (yyval.interm.intermTypedNode) = (yyvsp[(3) - (3)].interm.intermTypedNode);
3026 }
3027 }
3028 break;
3029
3030 case 70:
3031
3032 {
3033 if (context->constErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)))
3034 context->recover();
3035 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
3036 }
3037 break;
3038
3039 case 71:
3040
3041 {
3042 TFunction &function = *((yyvsp[(1) - (2)].interm).function);
3043
3044 TIntermAggregate *prototype = new TIntermAggregate;
3045 prototype->setType(function.getReturnType());
3046 prototype->setName(function.getName());
3047
3048 for (int i = 0; i < function.getParamCount(); i++)
3049 {
3050 const TParameter &param = function.getParam(i);
3051 if (param.name != 0)
3052 {
John Baumand4ae8632014-05-06 16:18:33 -04003053 TVariable variable(param.name, *param.type);
John Bauman66b8ab22014-05-06 15:57:45 -04003054
John Baumand4ae8632014-05-06 16:18:33 -04003055 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 -04003056 }
3057 else
3058 {
3059 prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (2)].interm).line), (yyvsp[(1) - (2)].interm).line);
3060 }
3061 }
3062
3063 prototype->setOp(EOpPrototype);
3064 (yyval.interm.intermNode) = prototype;
3065
3066 context->symbolTable.pop();
3067 }
3068 break;
3069
3070 case 72:
3071
3072 {
3073 if ((yyvsp[(1) - (2)].interm).intermAggregate)
3074 (yyvsp[(1) - (2)].interm).intermAggregate->setOp(EOpDeclaration);
3075 (yyval.interm.intermNode) = (yyvsp[(1) - (2)].interm).intermAggregate;
3076 }
3077 break;
3078
3079 case 73:
3080
3081 {
John Baumand4ae8632014-05-06 16:18:33 -04003082 if (!context->symbolTable.setDefaultPrecision( (yyvsp[(3) - (4)].interm.type), (yyvsp[(2) - (4)].interm.precision) )) {
3083 context->error((yyvsp[(1) - (4)].lex).line, "illegal type argument for default precision qualifier", getBasicString((yyvsp[(3) - (4)].interm.type).type));
3084 context->recover();
3085 }
John Bauman66b8ab22014-05-06 15:57:45 -04003086 (yyval.interm.intermNode) = 0;
3087 }
3088 break;
3089
3090 case 74:
3091
3092 {
3093 //
3094 // Multiple declarations of the same function are allowed.
3095 //
3096 // If this is a definition, the definition production code will check for redefinitions
3097 // (we don't know at this point if it's a definition or not).
3098 //
3099 // Redeclarations are allowed. But, return types and parameter qualifiers must match.
3100 //
3101 TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find((yyvsp[(1) - (2)].interm.function)->getMangledName()));
3102 if (prevDec) {
3103 if (prevDec->getReturnType() != (yyvsp[(1) - (2)].interm.function)->getReturnType()) {
3104 context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same return type", (yyvsp[(1) - (2)].interm.function)->getReturnType().getBasicString());
3105 context->recover();
3106 }
3107 for (int i = 0; i < prevDec->getParamCount(); ++i) {
3108 if (prevDec->getParam(i).type->getQualifier() != (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifier()) {
3109 context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same parameter qualifiers", (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifierString());
3110 context->recover();
3111 }
3112 }
3113 }
3114
3115 //
3116 // If this is a redeclaration, it could also be a definition,
3117 // in which case, we want to use the variable names from this one, and not the one that's
3118 // being redeclared. So, pass back up this declaration, not the one in the symbol table.
3119 //
3120 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
3121 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
3122
3123 // We're at the inner scope level of the function's arguments and body statement.
3124 // Add the function prototype to the surrounding scope instead.
3125 context->symbolTable.getOuterLevel()->insert(*(yyval.interm).function);
3126 }
3127 break;
3128
3129 case 75:
3130
3131 {
3132 (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
3133 }
3134 break;
3135
3136 case 76:
3137
3138 {
3139 (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
3140 }
3141 break;
3142
3143 case 77:
3144
3145 {
3146 // Add the parameter
3147 (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
3148 if ((yyvsp[(2) - (2)].interm).param.type->getBasicType() != EbtVoid)
3149 (yyvsp[(1) - (2)].interm.function)->addParameter((yyvsp[(2) - (2)].interm).param);
3150 else
3151 delete (yyvsp[(2) - (2)].interm).param.type;
3152 }
3153 break;
3154
3155 case 78:
3156
3157 {
3158 //
3159 // Only first parameter of one-parameter functions can be void
3160 // The check for named parameters not being void is done in parameter_declarator
3161 //
3162 if ((yyvsp[(3) - (3)].interm).param.type->getBasicType() == EbtVoid) {
3163 //
3164 // This parameter > first is void
3165 //
3166 context->error((yyvsp[(2) - (3)].lex).line, "cannot be an argument type except for '(void)'", "void");
3167 context->recover();
3168 delete (yyvsp[(3) - (3)].interm).param.type;
3169 } else {
3170 // Add the parameter
3171 (yyval.interm.function) = (yyvsp[(1) - (3)].interm.function);
3172 (yyvsp[(1) - (3)].interm.function)->addParameter((yyvsp[(3) - (3)].interm).param);
3173 }
3174 }
3175 break;
3176
3177 case 79:
3178
3179 {
3180 if ((yyvsp[(1) - (3)].interm.type).qualifier != EvqGlobal && (yyvsp[(1) - (3)].interm.type).qualifier != EvqTemporary) {
3181 context->error((yyvsp[(2) - (3)].lex).line, "no qualifiers allowed for function return", getQualifierString((yyvsp[(1) - (3)].interm.type).qualifier));
3182 context->recover();
3183 }
3184 // make sure a sampler is not involved as well...
3185 if (context->structQualifierErrorCheck((yyvsp[(2) - (3)].lex).line, (yyvsp[(1) - (3)].interm.type)))
3186 context->recover();
3187
3188 // Add the function as a prototype after parsing it (we do not support recursion)
3189 TFunction *function;
3190 TType type((yyvsp[(1) - (3)].interm.type));
3191 function = new TFunction((yyvsp[(2) - (3)].lex).string, type);
3192 (yyval.interm.function) = function;
3193
3194 context->symbolTable.push();
3195 }
3196 break;
3197
3198 case 80:
3199
3200 {
3201 if ((yyvsp[(1) - (2)].interm.type).type == EbtVoid) {
3202 context->error((yyvsp[(2) - (2)].lex).line, "illegal use of type 'void'", (yyvsp[(2) - (2)].lex).string->c_str());
3203 context->recover();
3204 }
3205 if (context->reservedErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string))
3206 context->recover();
3207 TParameter param = {(yyvsp[(2) - (2)].lex).string, new TType((yyvsp[(1) - (2)].interm.type))};
3208 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
3209 (yyval.interm).param = param;
3210 }
3211 break;
3212
3213 case 81:
3214
3215 {
3216 // Check that we can make an array out of this type
3217 if (context->arrayTypeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
3218 context->recover();
3219
3220 if (context->reservedErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string))
3221 context->recover();
3222
3223 int size;
3224 if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3225 context->recover();
3226 (yyvsp[(1) - (5)].interm.type).setArray(true, size);
3227
3228 TType* type = new TType((yyvsp[(1) - (5)].interm.type));
3229 TParameter param = { (yyvsp[(2) - (5)].lex).string, type };
3230 (yyval.interm).line = (yyvsp[(2) - (5)].lex).line;
3231 (yyval.interm).param = param;
3232 }
3233 break;
3234
3235 case 82:
3236
3237 {
3238 (yyval.interm) = (yyvsp[(3) - (3)].interm);
3239 if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
3240 context->recover();
3241 }
3242 break;
3243
3244 case 83:
3245
3246 {
3247 (yyval.interm) = (yyvsp[(2) - (2)].interm);
3248 if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
3249 context->recover();
3250 if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
3251 context->recover();
3252 }
3253 break;
3254
3255 case 84:
3256
3257 {
3258 (yyval.interm) = (yyvsp[(3) - (3)].interm);
3259 if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
3260 context->recover();
3261 }
3262 break;
3263
3264 case 85:
3265
3266 {
3267 (yyval.interm) = (yyvsp[(2) - (2)].interm);
3268 if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
3269 context->recover();
3270 if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
3271 context->recover();
3272 }
3273 break;
3274
3275 case 86:
3276
3277 {
3278 (yyval.interm.qualifier) = EvqIn;
3279 }
3280 break;
3281
3282 case 87:
3283
3284 {
3285 (yyval.interm.qualifier) = EvqIn;
3286 }
3287 break;
3288
3289 case 88:
3290
3291 {
3292 (yyval.interm.qualifier) = EvqOut;
3293 }
3294 break;
3295
3296 case 89:
3297
3298 {
3299 (yyval.interm.qualifier) = EvqInOut;
3300 }
3301 break;
3302
3303 case 90:
3304
3305 {
3306 TParameter param = { 0, new TType((yyvsp[(1) - (1)].interm.type)) };
3307 (yyval.interm).param = param;
3308 }
3309 break;
3310
3311 case 91:
3312
3313 {
3314 (yyval.interm) = (yyvsp[(1) - (1)].interm);
3315 }
3316 break;
3317
3318 case 92:
3319
3320 {
3321 if ((yyvsp[(1) - (3)].interm).type.type == EbtInvariant && !(yyvsp[(3) - (3)].lex).symbol)
3322 {
3323 context->error((yyvsp[(3) - (3)].lex).line, "undeclared identifier declared as invariant", (yyvsp[(3) - (3)].lex).string->c_str());
3324 context->recover();
3325 }
3326
3327 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(3) - (3)].lex).string, TType((yyvsp[(1) - (3)].interm).type), (yyvsp[(3) - (3)].lex).line);
3328 (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermNode, symbol, (yyvsp[(3) - (3)].lex).line);
3329
3330 if (context->structQualifierErrorCheck((yyvsp[(3) - (3)].lex).line, (yyval.interm).type))
3331 context->recover();
3332
3333 if (context->nonInitConstErrorCheck((yyvsp[(3) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyval.interm).type, false))
3334 context->recover();
3335
3336 TVariable* variable = 0;
3337 if (context->nonInitErrorCheck((yyvsp[(3) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyval.interm).type, variable))
3338 context->recover();
3339 if (symbol && variable)
3340 symbol->setId(variable->getUniqueId());
3341 }
3342 break;
3343
3344 case 93:
3345
3346 {
3347 if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
3348 context->recover();
3349
3350 if (context->nonInitConstErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, true))
3351 context->recover();
3352
3353 (yyval.interm) = (yyvsp[(1) - (5)].interm);
3354
3355 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))
3356 context->recover();
3357 else {
3358 (yyvsp[(1) - (5)].interm).type.setArray(true);
3359 TVariable* variable;
3360 if (context->arrayErrorCheck((yyvsp[(4) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, variable))
3361 context->recover();
3362 }
3363 }
3364 break;
3365
3366 case 94:
3367
3368 {
3369 if (context->structQualifierErrorCheck((yyvsp[(3) - (6)].lex).line, (yyvsp[(1) - (6)].interm).type))
3370 context->recover();
3371
3372 if (context->nonInitConstErrorCheck((yyvsp[(3) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type, true))
3373 context->recover();
3374
3375 (yyval.interm) = (yyvsp[(1) - (6)].interm);
3376
3377 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))
3378 context->recover();
3379 else {
3380 int size;
3381 if (context->arraySizeErrorCheck((yyvsp[(4) - (6)].lex).line, (yyvsp[(5) - (6)].interm.intermTypedNode), size))
3382 context->recover();
3383 (yyvsp[(1) - (6)].interm).type.setArray(true, size);
3384 TVariable* variable = 0;
3385 if (context->arrayErrorCheck((yyvsp[(4) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type, variable))
3386 context->recover();
3387 TType type = TType((yyvsp[(1) - (6)].interm).type);
3388 type.setArraySize(size);
3389 (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);
3390 }
3391 }
3392 break;
3393
3394 case 95:
3395
3396 {
3397 if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
3398 context->recover();
3399
3400 (yyval.interm) = (yyvsp[(1) - (5)].interm);
3401
3402 TIntermNode* intermNode;
3403 if (!context->executeInitializer((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, (yyvsp[(5) - (5)].interm.intermTypedNode), intermNode)) {
3404 //
3405 // build the intermediate representation
3406 //
3407 if (intermNode)
3408 (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (5)].interm).intermNode, intermNode, (yyvsp[(4) - (5)].lex).line);
3409 else
3410 (yyval.interm).intermAggregate = (yyvsp[(1) - (5)].interm).intermAggregate;
3411 } else {
3412 context->recover();
3413 (yyval.interm).intermAggregate = 0;
3414 }
3415 }
3416 break;
3417
3418 case 96:
3419
3420 {
3421 (yyval.interm).type = (yyvsp[(1) - (1)].interm.type);
3422 (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);
3423 }
3424 break;
3425
3426 case 97:
3427
3428 {
3429 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyvsp[(1) - (2)].interm.type)), (yyvsp[(2) - (2)].lex).line);
3430 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (2)].lex).line);
3431
3432 if (context->structQualifierErrorCheck((yyvsp[(2) - (2)].lex).line, (yyval.interm).type))
3433 context->recover();
3434
3435 if (context->nonInitConstErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string, (yyval.interm).type, false))
3436 context->recover();
3437
3438 (yyval.interm).type = (yyvsp[(1) - (2)].interm.type);
3439
3440 TVariable* variable = 0;
3441 if (context->nonInitErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string, (yyval.interm).type, variable))
3442 context->recover();
3443 if (variable && symbol)
3444 symbol->setId(variable->getUniqueId());
3445 }
3446 break;
3447
3448 case 98:
3449
3450 {
3451 context->error((yyvsp[(2) - (4)].lex).line, "unsized array declarations not supported", (yyvsp[(2) - (4)].lex).string->c_str());
3452 context->recover();
3453
3454 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (4)].lex).string, TType((yyvsp[(1) - (4)].interm.type)), (yyvsp[(2) - (4)].lex).line);
3455 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (4)].lex).line);
3456 (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
3457 }
3458 break;
3459
3460 case 99:
3461
3462 {
3463 TType type = TType((yyvsp[(1) - (5)].interm.type));
3464 int size;
3465 if (context->arraySizeErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3466 context->recover();
3467 type.setArraySize(size);
3468 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (5)].lex).string, type, (yyvsp[(2) - (5)].lex).line);
3469 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (5)].lex).line);
3470
3471 if (context->structQualifierErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
3472 context->recover();
3473
3474 if (context->nonInitConstErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type), true))
3475 context->recover();
3476
3477 (yyval.interm).type = (yyvsp[(1) - (5)].interm.type);
3478
3479 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)))
3480 context->recover();
3481 else {
3482 int size;
3483 if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3484 context->recover();
3485
3486 (yyvsp[(1) - (5)].interm.type).setArray(true, size);
3487 TVariable* variable = 0;
3488 if (context->arrayErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type), variable))
3489 context->recover();
3490 if (variable && symbol)
3491 symbol->setId(variable->getUniqueId());
3492 }
3493 }
3494 break;
3495
3496 case 100:
3497
3498 {
3499 if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
3500 context->recover();
3501
3502 (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
3503
3504 TIntermNode* intermNode;
3505 if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode)) {
3506 //
3507 // Build intermediate representation
3508 //
3509 if(intermNode)
3510 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(intermNode, (yyvsp[(3) - (4)].lex).line);
3511 else
3512 (yyval.interm).intermAggregate = 0;
3513 } else {
3514 context->recover();
3515 (yyval.interm).intermAggregate = 0;
3516 }
3517 }
3518 break;
3519
3520 case 101:
3521
3522 {
John Bauman66b8ab22014-05-06 15:57:45 -04003523 if (context->globalErrorCheck((yyvsp[(1) - (2)].lex).line, context->symbolTable.atGlobalLevel(), "invariant varying"))
3524 context->recover();
3525 (yyval.interm).type.setBasic(EbtInvariant, EvqInvariantVaryingOut, (yyvsp[(2) - (2)].lex).line);
3526 if (!(yyvsp[(2) - (2)].lex).symbol)
3527 {
3528 context->error((yyvsp[(2) - (2)].lex).line, "undeclared identifier declared as invariant", (yyvsp[(2) - (2)].lex).string->c_str());
3529 context->recover();
3530
3531 (yyval.interm).intermAggregate = 0;
3532 }
3533 else
3534 {
3535 TIntermSymbol *symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyval.interm).type), (yyvsp[(2) - (2)].lex).line);
3536 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (2)].lex).line);
3537 }
3538 }
3539 break;
3540
3541 case 102:
3542
3543 {
3544 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3545
3546 if ((yyvsp[(1) - (1)].interm.type).array) {
3547 context->error((yyvsp[(1) - (1)].interm.type).line, "not supported", "first-class array");
3548 context->recover();
3549 (yyvsp[(1) - (1)].interm.type).setArray(false);
3550 }
3551 }
3552 break;
3553
3554 case 103:
3555
3556 {
3557 if ((yyvsp[(2) - (2)].interm.type).array) {
3558 context->error((yyvsp[(2) - (2)].interm.type).line, "not supported", "first-class array");
3559 context->recover();
3560 (yyvsp[(2) - (2)].interm.type).setArray(false);
3561 }
3562
3563 if ((yyvsp[(1) - (2)].interm.type).qualifier == EvqAttribute &&
3564 ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
3565 context->error((yyvsp[(2) - (2)].interm.type).line, "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier));
3566 context->recover();
3567 }
3568 if (((yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingIn || (yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingOut) &&
3569 ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
3570 context->error((yyvsp[(2) - (2)].interm.type).line, "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier));
3571 context->recover();
3572 }
3573 (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
3574 (yyval.interm.type).qualifier = (yyvsp[(1) - (2)].interm.type).qualifier;
3575 }
3576 break;
3577
3578 case 104:
3579
3580 {
3581 (yyval.interm.type).setBasic(EbtVoid, EvqConst, (yyvsp[(1) - (1)].lex).line);
3582 }
3583 break;
3584
3585 case 105:
3586
3587 {
3588 VERTEX_ONLY("attribute", (yyvsp[(1) - (1)].lex).line);
3589 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "attribute"))
3590 context->recover();
3591 (yyval.interm.type).setBasic(EbtVoid, EvqAttribute, (yyvsp[(1) - (1)].lex).line);
3592 }
3593 break;
3594
3595 case 106:
3596
3597 {
3598 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "varying"))
3599 context->recover();
Nicolas Capens08ca3c62015-02-13 16:06:45 -05003600 if (context->shaderType == GL_VERTEX_SHADER)
John Bauman66b8ab22014-05-06 15:57:45 -04003601 (yyval.interm.type).setBasic(EbtVoid, EvqVaryingOut, (yyvsp[(1) - (1)].lex).line);
3602 else
3603 (yyval.interm.type).setBasic(EbtVoid, EvqVaryingIn, (yyvsp[(1) - (1)].lex).line);
3604 }
3605 break;
3606
3607 case 107:
3608
3609 {
3610 if (context->globalErrorCheck((yyvsp[(1) - (2)].lex).line, context->symbolTable.atGlobalLevel(), "invariant varying"))
3611 context->recover();
Nicolas Capens08ca3c62015-02-13 16:06:45 -05003612 if (context->shaderType == GL_VERTEX_SHADER)
John Bauman66b8ab22014-05-06 15:57:45 -04003613 (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingOut, (yyvsp[(1) - (2)].lex).line);
3614 else
3615 (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingIn, (yyvsp[(1) - (2)].lex).line);
3616 }
3617 break;
3618
3619 case 108:
3620
3621 {
3622 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "uniform"))
3623 context->recover();
3624 (yyval.interm.type).setBasic(EbtVoid, EvqUniform, (yyvsp[(1) - (1)].lex).line);
3625 }
3626 break;
3627
3628 case 109:
3629
3630 {
3631 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3632
3633 if ((yyval.interm.type).precision == EbpUndefined) {
3634 (yyval.interm.type).precision = context->symbolTable.getDefaultPrecision((yyvsp[(1) - (1)].interm.type).type);
3635 if (context->precisionErrorCheck((yyvsp[(1) - (1)].interm.type).line, (yyval.interm.type).precision, (yyvsp[(1) - (1)].interm.type).type)) {
3636 context->recover();
3637 }
3638 }
3639 }
3640 break;
3641
3642 case 110:
3643
3644 {
3645 (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
3646 (yyval.interm.type).precision = (yyvsp[(1) - (2)].interm.precision);
3647 }
3648 break;
3649
3650 case 111:
3651
3652 {
3653 (yyval.interm.precision) = EbpHigh;
3654 }
3655 break;
3656
3657 case 112:
3658
3659 {
3660 (yyval.interm.precision) = EbpMedium;
3661 }
3662 break;
3663
3664 case 113:
3665
3666 {
3667 (yyval.interm.precision) = EbpLow;
3668 }
3669 break;
3670
3671 case 114:
3672
3673 {
3674 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3675 }
3676 break;
3677
3678 case 115:
3679
3680 {
3681 (yyval.interm.type) = (yyvsp[(1) - (4)].interm.type);
3682
3683 if (context->arrayTypeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
3684 context->recover();
3685 else {
3686 int size;
3687 if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
3688 context->recover();
3689 (yyval.interm.type).setArray(true, size);
3690 }
3691 }
3692 break;
3693
3694 case 116:
3695
3696 {
3697 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3698 (yyval.interm.type).setBasic(EbtVoid, qual, (yyvsp[(1) - (1)].lex).line);
3699 }
3700 break;
3701
3702 case 117:
3703
3704 {
3705 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3706 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3707 }
3708 break;
3709
3710 case 118:
3711
3712 {
3713 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3714 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3715 }
3716 break;
3717
3718 case 119:
3719
3720 {
3721 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3722 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3723 }
3724 break;
3725
3726 case 120:
3727
3728 {
3729 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3730 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3731 (yyval.interm.type).setAggregate(2);
3732 }
3733 break;
3734
3735 case 121:
3736
3737 {
3738 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3739 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3740 (yyval.interm.type).setAggregate(3);
3741 }
3742 break;
3743
3744 case 122:
3745
3746 {
3747 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3748 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3749 (yyval.interm.type).setAggregate(4);
3750 }
3751 break;
3752
3753 case 123:
3754
3755 {
3756 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3757 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3758 (yyval.interm.type).setAggregate(2);
3759 }
3760 break;
3761
3762 case 124:
3763
3764 {
3765 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3766 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3767 (yyval.interm.type).setAggregate(3);
3768 }
3769 break;
3770
3771 case 125:
3772
3773 {
3774 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3775 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3776 (yyval.interm.type).setAggregate(4);
3777 }
3778 break;
3779
3780 case 126:
3781
3782 {
3783 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3784 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3785 (yyval.interm.type).setAggregate(2);
3786 }
3787 break;
3788
3789 case 127:
3790
3791 {
3792 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3793 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3794 (yyval.interm.type).setAggregate(3);
3795 }
3796 break;
3797
3798 case 128:
3799
3800 {
3801 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3802 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3803 (yyval.interm.type).setAggregate(4);
3804 }
3805 break;
3806
3807 case 129:
3808
3809 {
3810 FRAG_VERT_ONLY("mat2", (yyvsp[(1) - (1)].lex).line);
3811 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3812 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3813 (yyval.interm.type).setAggregate(2, true);
3814 }
3815 break;
3816
3817 case 130:
3818
3819 {
3820 FRAG_VERT_ONLY("mat3", (yyvsp[(1) - (1)].lex).line);
3821 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3822 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3823 (yyval.interm.type).setAggregate(3, true);
3824 }
3825 break;
3826
3827 case 131:
3828
3829 {
3830 FRAG_VERT_ONLY("mat4", (yyvsp[(1) - (1)].lex).line);
3831 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3832 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3833 (yyval.interm.type).setAggregate(4, true);
3834 }
3835 break;
3836
3837 case 132:
3838
3839 {
3840 FRAG_VERT_ONLY("sampler2D", (yyvsp[(1) - (1)].lex).line);
3841 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3842 (yyval.interm.type).setBasic(EbtSampler2D, qual, (yyvsp[(1) - (1)].lex).line);
3843 }
3844 break;
3845
3846 case 133:
3847
3848 {
3849 FRAG_VERT_ONLY("samplerCube", (yyvsp[(1) - (1)].lex).line);
3850 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3851 (yyval.interm.type).setBasic(EbtSamplerCube, qual, (yyvsp[(1) - (1)].lex).line);
3852 }
3853 break;
3854
3855 case 134:
3856
3857 {
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04003858 if (!context->supportsExtension("GL_OES_EGL_image_external")) {
3859 context->error((yyvsp[(1) - (1)].lex).line, "unsupported type", "samplerExternalOES", "");
3860 context->recover();
3861 }
3862 FRAG_VERT_ONLY("samplerExternalOES", (yyvsp[(1) - (1)].lex).line);
3863 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3864 (yyval.interm.type).setBasic(EbtSamplerExternalOES, qual, (yyvsp[(1) - (1)].lex).line);
3865 }
3866 break;
3867
3868 case 135:
3869
3870 {
Alexis Hetub027aa92015-01-19 15:56:12 -05003871 FRAG_VERT_ONLY("sampler3D", (yyvsp[(1) - (1)].lex).line);
3872 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3873 (yyval.interm.type).setBasic(EbtSampler3D, qual, (yyvsp[(1) - (1)].lex).line);
3874 }
3875 break;
3876
3877 case 136:
3878
3879 {
John Bauman66b8ab22014-05-06 15:57:45 -04003880 FRAG_VERT_ONLY("struct", (yyvsp[(1) - (1)].interm.type).line);
3881 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3882 (yyval.interm.type).qualifier = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3883 }
3884 break;
3885
Alexis Hetub027aa92015-01-19 15:56:12 -05003886 case 137:
John Bauman66b8ab22014-05-06 15:57:45 -04003887
3888 {
3889 //
3890 // This is for user defined type names. The lexical phase looked up the
3891 // type.
3892 //
3893 TType& structure = static_cast<TVariable*>((yyvsp[(1) - (1)].lex).symbol)->getType();
3894 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3895 (yyval.interm.type).setBasic(EbtStruct, qual, (yyvsp[(1) - (1)].lex).line);
3896 (yyval.interm.type).userDef = &structure;
3897 }
3898 break;
3899
Alexis Hetub027aa92015-01-19 15:56:12 -05003900 case 138:
John Bauman66b8ab22014-05-06 15:57:45 -04003901
3902 { if (context->enterStructDeclaration((yyvsp[(2) - (3)].lex).line, *(yyvsp[(2) - (3)].lex).string)) context->recover(); }
3903 break;
3904
Alexis Hetub027aa92015-01-19 15:56:12 -05003905 case 139:
John Bauman66b8ab22014-05-06 15:57:45 -04003906
3907 {
3908 if (context->reservedErrorCheck((yyvsp[(2) - (6)].lex).line, *(yyvsp[(2) - (6)].lex).string))
3909 context->recover();
3910
3911 TType* structure = new TType((yyvsp[(5) - (6)].interm.typeList), *(yyvsp[(2) - (6)].lex).string);
3912 TVariable* userTypeDef = new TVariable((yyvsp[(2) - (6)].lex).string, *structure, true);
3913 if (! context->symbolTable.insert(*userTypeDef)) {
3914 context->error((yyvsp[(2) - (6)].lex).line, "redefinition", (yyvsp[(2) - (6)].lex).string->c_str(), "struct");
3915 context->recover();
3916 }
3917 (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (6)].lex).line);
3918 (yyval.interm.type).userDef = structure;
3919 context->exitStructDeclaration();
3920 }
3921 break;
3922
Alexis Hetub027aa92015-01-19 15:56:12 -05003923 case 140:
John Bauman66b8ab22014-05-06 15:57:45 -04003924
3925 { if (context->enterStructDeclaration((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string)) context->recover(); }
3926 break;
3927
Alexis Hetub027aa92015-01-19 15:56:12 -05003928 case 141:
John Bauman66b8ab22014-05-06 15:57:45 -04003929
3930 {
3931 TType* structure = new TType((yyvsp[(4) - (5)].interm.typeList), TString(""));
3932 (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (5)].lex).line);
3933 (yyval.interm.type).userDef = structure;
3934 context->exitStructDeclaration();
3935 }
3936 break;
3937
Alexis Hetub027aa92015-01-19 15:56:12 -05003938 case 142:
John Bauman66b8ab22014-05-06 15:57:45 -04003939
3940 {
3941 (yyval.interm.typeList) = (yyvsp[(1) - (1)].interm.typeList);
3942 }
3943 break;
3944
Alexis Hetub027aa92015-01-19 15:56:12 -05003945 case 143:
John Bauman66b8ab22014-05-06 15:57:45 -04003946
3947 {
3948 (yyval.interm.typeList) = (yyvsp[(1) - (2)].interm.typeList);
3949 for (unsigned int i = 0; i < (yyvsp[(2) - (2)].interm.typeList)->size(); ++i) {
3950 for (unsigned int j = 0; j < (yyval.interm.typeList)->size(); ++j) {
3951 if ((*(yyval.interm.typeList))[j].type->getFieldName() == (*(yyvsp[(2) - (2)].interm.typeList))[i].type->getFieldName()) {
3952 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());
3953 context->recover();
3954 }
3955 }
3956 (yyval.interm.typeList)->push_back((*(yyvsp[(2) - (2)].interm.typeList))[i]);
3957 }
3958 }
3959 break;
3960
Alexis Hetub027aa92015-01-19 15:56:12 -05003961 case 144:
John Bauman66b8ab22014-05-06 15:57:45 -04003962
3963 {
3964 (yyval.interm.typeList) = (yyvsp[(2) - (3)].interm.typeList);
3965
3966 if (context->voidErrorCheck((yyvsp[(1) - (3)].interm.type).line, (*(yyvsp[(2) - (3)].interm.typeList))[0].type->getFieldName(), (yyvsp[(1) - (3)].interm.type))) {
3967 context->recover();
3968 }
3969 for (unsigned int i = 0; i < (yyval.interm.typeList)->size(); ++i) {
3970 //
3971 // Careful not to replace already known aspects of type, like array-ness
3972 //
3973 TType* type = (*(yyval.interm.typeList))[i].type;
3974 type->setBasicType((yyvsp[(1) - (3)].interm.type).type);
3975 type->setNominalSize((yyvsp[(1) - (3)].interm.type).size);
3976 type->setMatrix((yyvsp[(1) - (3)].interm.type).matrix);
3977 type->setPrecision((yyvsp[(1) - (3)].interm.type).precision);
3978
3979 // don't allow arrays of arrays
3980 if (type->isArray()) {
3981 if (context->arrayTypeErrorCheck((yyvsp[(1) - (3)].interm.type).line, (yyvsp[(1) - (3)].interm.type)))
3982 context->recover();
3983 }
3984 if ((yyvsp[(1) - (3)].interm.type).array)
3985 type->setArraySize((yyvsp[(1) - (3)].interm.type).arraySize);
3986 if ((yyvsp[(1) - (3)].interm.type).userDef) {
3987 type->setStruct((yyvsp[(1) - (3)].interm.type).userDef->getStruct());
3988 type->setTypeName((yyvsp[(1) - (3)].interm.type).userDef->getTypeName());
3989 }
John Bauman66b8ab22014-05-06 15:57:45 -04003990 }
3991 }
3992 break;
3993
Alexis Hetub027aa92015-01-19 15:56:12 -05003994 case 145:
John Bauman66b8ab22014-05-06 15:57:45 -04003995
3996 {
3997 (yyval.interm.typeList) = NewPoolTTypeList();
3998 (yyval.interm.typeList)->push_back((yyvsp[(1) - (1)].interm.typeLine));
3999 }
4000 break;
4001
Alexis Hetub027aa92015-01-19 15:56:12 -05004002 case 146:
John Bauman66b8ab22014-05-06 15:57:45 -04004003
4004 {
4005 (yyval.interm.typeList)->push_back((yyvsp[(3) - (3)].interm.typeLine));
4006 }
4007 break;
4008
Alexis Hetub027aa92015-01-19 15:56:12 -05004009 case 147:
John Bauman66b8ab22014-05-06 15:57:45 -04004010
4011 {
4012 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
4013 context->recover();
4014
4015 (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
4016 (yyval.interm.typeLine).line = (yyvsp[(1) - (1)].lex).line;
4017 (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (1)].lex).string);
4018 }
4019 break;
4020
Alexis Hetub027aa92015-01-19 15:56:12 -05004021 case 148:
John Bauman66b8ab22014-05-06 15:57:45 -04004022
4023 {
4024 if (context->reservedErrorCheck((yyvsp[(1) - (4)].lex).line, *(yyvsp[(1) - (4)].lex).string))
4025 context->recover();
4026
4027 (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
4028 (yyval.interm.typeLine).line = (yyvsp[(1) - (4)].lex).line;
4029 (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (4)].lex).string);
4030
4031 int size;
4032 if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
4033 context->recover();
4034 (yyval.interm.typeLine).type->setArraySize(size);
4035 }
4036 break;
4037
Alexis Hetub027aa92015-01-19 15:56:12 -05004038 case 149:
John Bauman66b8ab22014-05-06 15:57:45 -04004039
4040 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
4041 break;
4042
John Bauman66b8ab22014-05-06 15:57:45 -04004043 case 150:
4044
Alexis Hetub027aa92015-01-19 15:56:12 -05004045 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
John Bauman66b8ab22014-05-06 15:57:45 -04004046 break;
4047
4048 case 151:
4049
Alexis Hetub027aa92015-01-19 15:56:12 -05004050 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermAggregate); }
John Bauman66b8ab22014-05-06 15:57:45 -04004051 break;
4052
4053 case 152:
4054
4055 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
4056 break;
4057
4058 case 153:
4059
4060 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
4061 break;
4062
4063 case 154:
4064
4065 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
4066 break;
4067
4068 case 155:
4069
4070 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
4071 break;
4072
4073 case 156:
4074
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04004075 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
John Bauman66b8ab22014-05-06 15:57:45 -04004076 break;
4077
4078 case 157:
4079
Alexis Hetub027aa92015-01-19 15:56:12 -05004080 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
John Bauman66b8ab22014-05-06 15:57:45 -04004081 break;
4082
4083 case 158:
4084
Alexis Hetub027aa92015-01-19 15:56:12 -05004085 { (yyval.interm.intermAggregate) = 0; }
John Bauman66b8ab22014-05-06 15:57:45 -04004086 break;
4087
4088 case 159:
4089
Alexis Hetub027aa92015-01-19 15:56:12 -05004090 { context->symbolTable.push(); }
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04004091 break;
4092
4093 case 160:
4094
Alexis Hetub027aa92015-01-19 15:56:12 -05004095 { context->symbolTable.pop(); }
4096 break;
4097
4098 case 161:
4099
John Bauman66b8ab22014-05-06 15:57:45 -04004100 {
4101 if ((yyvsp[(3) - (5)].interm.intermAggregate) != 0) {
4102 (yyvsp[(3) - (5)].interm.intermAggregate)->setOp(EOpSequence);
4103 (yyvsp[(3) - (5)].interm.intermAggregate)->setEndLine((yyvsp[(5) - (5)].lex).line);
4104 }
4105 (yyval.interm.intermAggregate) = (yyvsp[(3) - (5)].interm.intermAggregate);
4106 }
4107 break;
4108
John Bauman66b8ab22014-05-06 15:57:45 -04004109 case 162:
4110
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04004111 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
John Bauman66b8ab22014-05-06 15:57:45 -04004112 break;
4113
4114 case 163:
4115
Alexis Hetub027aa92015-01-19 15:56:12 -05004116 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
John Bauman66b8ab22014-05-06 15:57:45 -04004117 break;
4118
4119 case 164:
4120
Alexis Hetub027aa92015-01-19 15:56:12 -05004121 { context->symbolTable.push(); }
John Bauman66b8ab22014-05-06 15:57:45 -04004122 break;
4123
4124 case 165:
4125
Alexis Hetub027aa92015-01-19 15:56:12 -05004126 { context->symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[(2) - (2)].interm.intermNode); }
John Bauman66b8ab22014-05-06 15:57:45 -04004127 break;
4128
4129 case 166:
4130
Alexis Hetub027aa92015-01-19 15:56:12 -05004131 { context->symbolTable.push(); }
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04004132 break;
4133
4134 case 167:
4135
Alexis Hetub027aa92015-01-19 15:56:12 -05004136 { context->symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[(2) - (2)].interm.intermNode); }
4137 break;
4138
4139 case 168:
4140
John Bauman66b8ab22014-05-06 15:57:45 -04004141 {
4142 (yyval.interm.intermNode) = 0;
4143 }
4144 break;
4145
Alexis Hetub027aa92015-01-19 15:56:12 -05004146 case 169:
John Bauman66b8ab22014-05-06 15:57:45 -04004147
4148 {
4149 if ((yyvsp[(2) - (3)].interm.intermAggregate)) {
4150 (yyvsp[(2) - (3)].interm.intermAggregate)->setOp(EOpSequence);
4151 (yyvsp[(2) - (3)].interm.intermAggregate)->setEndLine((yyvsp[(3) - (3)].lex).line);
4152 }
4153 (yyval.interm.intermNode) = (yyvsp[(2) - (3)].interm.intermAggregate);
4154 }
4155 break;
4156
Alexis Hetub027aa92015-01-19 15:56:12 -05004157 case 170:
John Bauman66b8ab22014-05-06 15:57:45 -04004158
4159 {
4160 (yyval.interm.intermAggregate) = context->intermediate.makeAggregate((yyvsp[(1) - (1)].interm.intermNode), 0);
4161 }
4162 break;
4163
Alexis Hetub027aa92015-01-19 15:56:12 -05004164 case 171:
John Bauman66b8ab22014-05-06 15:57:45 -04004165
4166 {
4167 (yyval.interm.intermAggregate) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermAggregate), (yyvsp[(2) - (2)].interm.intermNode), 0);
4168 }
4169 break;
4170
Alexis Hetub027aa92015-01-19 15:56:12 -05004171 case 172:
John Bauman66b8ab22014-05-06 15:57:45 -04004172
4173 { (yyval.interm.intermNode) = 0; }
4174 break;
4175
Alexis Hetub027aa92015-01-19 15:56:12 -05004176 case 173:
John Bauman66b8ab22014-05-06 15:57:45 -04004177
4178 { (yyval.interm.intermNode) = static_cast<TIntermNode*>((yyvsp[(1) - (2)].interm.intermTypedNode)); }
4179 break;
4180
Alexis Hetub027aa92015-01-19 15:56:12 -05004181 case 174:
John Bauman66b8ab22014-05-06 15:57:45 -04004182
4183 {
4184 if (context->boolErrorCheck((yyvsp[(1) - (5)].lex).line, (yyvsp[(3) - (5)].interm.intermTypedNode)))
4185 context->recover();
4186 (yyval.interm.intermNode) = context->intermediate.addSelection((yyvsp[(3) - (5)].interm.intermTypedNode), (yyvsp[(5) - (5)].interm.nodePair), (yyvsp[(1) - (5)].lex).line);
4187 }
4188 break;
4189
Alexis Hetub027aa92015-01-19 15:56:12 -05004190 case 175:
John Bauman66b8ab22014-05-06 15:57:45 -04004191
4192 {
4193 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermNode);
4194 (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermNode);
4195 }
4196 break;
4197
Alexis Hetub027aa92015-01-19 15:56:12 -05004198 case 176:
John Bauman66b8ab22014-05-06 15:57:45 -04004199
4200 {
4201 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (1)].interm.intermNode);
4202 (yyval.interm.nodePair).node2 = 0;
4203 }
4204 break;
4205
Alexis Hetub027aa92015-01-19 15:56:12 -05004206 case 177:
John Bauman66b8ab22014-05-06 15:57:45 -04004207
4208 {
4209 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
4210 if (context->boolErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)->getLine(), (yyvsp[(1) - (1)].interm.intermTypedNode)))
4211 context->recover();
4212 }
4213 break;
4214
Alexis Hetub027aa92015-01-19 15:56:12 -05004215 case 178:
John Bauman66b8ab22014-05-06 15:57:45 -04004216
4217 {
4218 TIntermNode* intermNode;
4219 if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
4220 context->recover();
4221 if (context->boolErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
4222 context->recover();
4223
4224 if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode))
4225 (yyval.interm.intermTypedNode) = (yyvsp[(4) - (4)].interm.intermTypedNode);
4226 else {
4227 context->recover();
4228 (yyval.interm.intermTypedNode) = 0;
4229 }
4230 }
4231 break;
4232
Alexis Hetub027aa92015-01-19 15:56:12 -05004233 case 179:
John Bauman66b8ab22014-05-06 15:57:45 -04004234
4235 { context->symbolTable.push(); ++context->loopNestingLevel; }
4236 break;
4237
Alexis Hetub027aa92015-01-19 15:56:12 -05004238 case 180:
John Bauman66b8ab22014-05-06 15:57:45 -04004239
4240 {
4241 context->symbolTable.pop();
4242 (yyval.interm.intermNode) = context->intermediate.addLoop(ELoopWhile, 0, (yyvsp[(4) - (6)].interm.intermTypedNode), 0, (yyvsp[(6) - (6)].interm.intermNode), (yyvsp[(1) - (6)].lex).line);
4243 --context->loopNestingLevel;
4244 }
4245 break;
4246
Alexis Hetub027aa92015-01-19 15:56:12 -05004247 case 181:
John Bauman66b8ab22014-05-06 15:57:45 -04004248
4249 { ++context->loopNestingLevel; }
4250 break;
4251
Alexis Hetub027aa92015-01-19 15:56:12 -05004252 case 182:
John Bauman66b8ab22014-05-06 15:57:45 -04004253
4254 {
4255 if (context->boolErrorCheck((yyvsp[(8) - (8)].lex).line, (yyvsp[(6) - (8)].interm.intermTypedNode)))
4256 context->recover();
4257
4258 (yyval.interm.intermNode) = context->intermediate.addLoop(ELoopDoWhile, 0, (yyvsp[(6) - (8)].interm.intermTypedNode), 0, (yyvsp[(3) - (8)].interm.intermNode), (yyvsp[(4) - (8)].lex).line);
4259 --context->loopNestingLevel;
4260 }
4261 break;
4262
John Bauman66b8ab22014-05-06 15:57:45 -04004263 case 183:
4264
Alexis Hetub027aa92015-01-19 15:56:12 -05004265 { context->symbolTable.push(); ++context->loopNestingLevel; }
John Bauman66b8ab22014-05-06 15:57:45 -04004266 break;
4267
4268 case 184:
4269
4270 {
Alexis Hetub027aa92015-01-19 15:56:12 -05004271 context->symbolTable.pop();
4272 (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);
4273 --context->loopNestingLevel;
John Bauman66b8ab22014-05-06 15:57:45 -04004274 }
4275 break;
4276
4277 case 185:
4278
4279 {
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04004280 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
John Bauman66b8ab22014-05-06 15:57:45 -04004281 }
4282 break;
4283
4284 case 186:
4285
4286 {
Alexis Hetub027aa92015-01-19 15:56:12 -05004287 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
John Bauman66b8ab22014-05-06 15:57:45 -04004288 }
4289 break;
4290
4291 case 187:
4292
4293 {
Alexis Hetub027aa92015-01-19 15:56:12 -05004294 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04004295 }
4296 break;
4297
4298 case 188:
4299
4300 {
Alexis Hetub027aa92015-01-19 15:56:12 -05004301 (yyval.interm.intermTypedNode) = 0;
4302 }
4303 break;
4304
4305 case 189:
4306
4307 {
John Bauman66b8ab22014-05-06 15:57:45 -04004308 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (2)].interm.intermTypedNode);
4309 (yyval.interm.nodePair).node2 = 0;
4310 }
4311 break;
4312
Alexis Hetub027aa92015-01-19 15:56:12 -05004313 case 190:
John Bauman66b8ab22014-05-06 15:57:45 -04004314
4315 {
4316 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermTypedNode);
4317 (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermTypedNode);
4318 }
4319 break;
4320
Alexis Hetub027aa92015-01-19 15:56:12 -05004321 case 191:
John Bauman66b8ab22014-05-06 15:57:45 -04004322
4323 {
4324 if (context->loopNestingLevel <= 0) {
4325 context->error((yyvsp[(1) - (2)].lex).line, "continue statement only allowed in loops", "");
4326 context->recover();
4327 }
4328 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpContinue, (yyvsp[(1) - (2)].lex).line);
4329 }
4330 break;
4331
Alexis Hetub027aa92015-01-19 15:56:12 -05004332 case 192:
John Bauman66b8ab22014-05-06 15:57:45 -04004333
4334 {
4335 if (context->loopNestingLevel <= 0) {
4336 context->error((yyvsp[(1) - (2)].lex).line, "break statement only allowed in loops", "");
4337 context->recover();
4338 }
4339 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpBreak, (yyvsp[(1) - (2)].lex).line);
4340 }
4341 break;
4342
Alexis Hetub027aa92015-01-19 15:56:12 -05004343 case 193:
John Bauman66b8ab22014-05-06 15:57:45 -04004344
4345 {
4346 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(1) - (2)].lex).line);
4347 if (context->currentFunctionType->getBasicType() != EbtVoid) {
4348 context->error((yyvsp[(1) - (2)].lex).line, "non-void function must return a value", "return");
4349 context->recover();
4350 }
4351 }
4352 break;
4353
Alexis Hetub027aa92015-01-19 15:56:12 -05004354 case 194:
John Bauman66b8ab22014-05-06 15:57:45 -04004355
4356 {
4357 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(2) - (3)].interm.intermTypedNode), (yyvsp[(1) - (3)].lex).line);
4358 context->functionReturnsValue = true;
4359 if (context->currentFunctionType->getBasicType() == EbtVoid) {
4360 context->error((yyvsp[(1) - (3)].lex).line, "void function cannot return a value", "return");
4361 context->recover();
4362 } else if (*(context->currentFunctionType) != (yyvsp[(2) - (3)].interm.intermTypedNode)->getType()) {
4363 context->error((yyvsp[(1) - (3)].lex).line, "function return is not matching type:", "return");
4364 context->recover();
4365 }
4366 }
4367 break;
4368
Alexis Hetub027aa92015-01-19 15:56:12 -05004369 case 195:
John Bauman66b8ab22014-05-06 15:57:45 -04004370
4371 {
4372 FRAG_ONLY("discard", (yyvsp[(1) - (2)].lex).line);
4373 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpKill, (yyvsp[(1) - (2)].lex).line);
4374 }
4375 break;
4376
John Bauman66b8ab22014-05-06 15:57:45 -04004377 case 196:
4378
4379 {
Alexis Hetub027aa92015-01-19 15:56:12 -05004380 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04004381 context->treeRoot = (yyval.interm.intermNode);
John Bauman66b8ab22014-05-06 15:57:45 -04004382 }
4383 break;
4384
4385 case 197:
4386
4387 {
Alexis Hetub027aa92015-01-19 15:56:12 -05004388 (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermNode), (yyvsp[(2) - (2)].interm.intermNode), 0);
4389 context->treeRoot = (yyval.interm.intermNode);
John Bauman66b8ab22014-05-06 15:57:45 -04004390 }
4391 break;
4392
4393 case 198:
4394
4395 {
Nicolas Capense9c5e4f2014-05-28 22:46:43 -04004396 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
4397 }
4398 break;
4399
4400 case 199:
4401
4402 {
Alexis Hetub027aa92015-01-19 15:56:12 -05004403 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
4404 }
4405 break;
4406
4407 case 200:
4408
4409 {
John Bauman66b8ab22014-05-06 15:57:45 -04004410 TFunction* function = (yyvsp[(1) - (1)].interm).function;
4411
4412 const TSymbol *builtIn = context->symbolTable.findBuiltIn(function->getMangledName());
4413
4414 if (builtIn)
4415 {
4416 context->error((yyvsp[(1) - (1)].interm).line, "built-in functions cannot be redefined", function->getName().c_str());
4417 context->recover();
4418 }
4419
4420 TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find(function->getMangledName()));
4421 //
4422 // Note: 'prevDec' could be 'function' if this is the first time we've seen function
4423 // as it would have just been put in the symbol table. Otherwise, we're looking up
4424 // an earlier occurance.
4425 //
4426 if (prevDec->isDefined()) {
4427 //
4428 // Then this function already has a body.
4429 //
4430 context->error((yyvsp[(1) - (1)].interm).line, "function already has a body", function->getName().c_str());
4431 context->recover();
4432 }
4433 prevDec->setDefined();
4434
4435 //
4436 // Raise error message if main function takes any parameters or return anything other than void
4437 //
4438 if (function->getName() == "main") {
4439 if (function->getParamCount() > 0) {
4440 context->error((yyvsp[(1) - (1)].interm).line, "function cannot take any parameter(s)", function->getName().c_str());
4441 context->recover();
4442 }
4443 if (function->getReturnType().getBasicType() != EbtVoid) {
4444 context->error((yyvsp[(1) - (1)].interm).line, "", function->getReturnType().getBasicString(), "main function cannot return a value");
4445 context->recover();
4446 }
4447 }
4448
4449 //
4450 // Remember the return type for later checking for RETURN statements.
4451 //
4452 context->currentFunctionType = &(prevDec->getReturnType());
4453 context->functionReturnsValue = false;
4454
4455 //
4456 // Insert parameters into the symbol table.
4457 // If the parameter has no name, it's not an error, just don't insert it
4458 // (could be used for unused args).
4459 //
4460 // Also, accumulate the list of parameters into the HIL, so lower level code
4461 // knows where to find parameters.
4462 //
4463 TIntermAggregate* paramNodes = new TIntermAggregate;
4464 for (int i = 0; i < function->getParamCount(); i++) {
4465 const TParameter& param = function->getParam(i);
4466 if (param.name != 0) {
4467 TVariable *variable = new TVariable(param.name, *param.type);
4468 //
4469 // Insert the parameters with name in the symbol table.
4470 //
4471 if (! context->symbolTable.insert(*variable)) {
4472 context->error((yyvsp[(1) - (1)].interm).line, "redefinition", variable->getName().c_str());
4473 context->recover();
4474 delete variable;
4475 }
4476
4477 //
4478 // Add the parameter to the HIL
4479 //
4480 paramNodes = context->intermediate.growAggregate(
4481 paramNodes,
4482 context->intermediate.addSymbol(variable->getUniqueId(),
4483 variable->getName(),
4484 variable->getType(), (yyvsp[(1) - (1)].interm).line),
4485 (yyvsp[(1) - (1)].interm).line);
4486 } else {
4487 paramNodes = context->intermediate.growAggregate(paramNodes, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (1)].interm).line), (yyvsp[(1) - (1)].interm).line);
4488 }
4489 }
4490 context->intermediate.setAggregateOperator(paramNodes, EOpParameters, (yyvsp[(1) - (1)].interm).line);
4491 (yyvsp[(1) - (1)].interm).intermAggregate = paramNodes;
4492 context->loopNestingLevel = 0;
4493 }
4494 break;
4495
Alexis Hetub027aa92015-01-19 15:56:12 -05004496 case 201:
John Bauman66b8ab22014-05-06 15:57:45 -04004497
4498 {
4499 //?? Check that all paths return a value if return type != void ?
4500 // May be best done as post process phase on intermediate code
4501 if (context->currentFunctionType->getBasicType() != EbtVoid && ! context->functionReturnsValue) {
4502 context->error((yyvsp[(1) - (3)].interm).line, "function does not return a value:", "", (yyvsp[(1) - (3)].interm).function->getName().c_str());
4503 context->recover();
4504 }
4505
4506 (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermAggregate, (yyvsp[(3) - (3)].interm.intermNode), 0);
4507 context->intermediate.setAggregateOperator((yyval.interm.intermNode), EOpFunction, (yyvsp[(1) - (3)].interm).line);
4508 (yyval.interm.intermNode)->getAsAggregate()->setName((yyvsp[(1) - (3)].interm).function->getMangledName().c_str());
4509 (yyval.interm.intermNode)->getAsAggregate()->setType((yyvsp[(1) - (3)].interm).function->getReturnType());
4510
4511 // store the pragma information for debug and optimize and other vendor specific
4512 // information. This information can be queried from the parse tree
4513 (yyval.interm.intermNode)->getAsAggregate()->setOptimize(context->pragma().optimize);
4514 (yyval.interm.intermNode)->getAsAggregate()->setDebug(context->pragma().debug);
4515
4516 if ((yyvsp[(3) - (3)].interm.intermNode) && (yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate())
4517 (yyval.interm.intermNode)->getAsAggregate()->setEndLine((yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate()->getEndLine());
4518
4519 context->symbolTable.pop();
4520 }
4521 break;
4522
4523
4524
4525 default: break;
4526 }
4527 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
4528
4529 YYPOPSTACK (yylen);
4530 yylen = 0;
4531 YY_STACK_PRINT (yyss, yyssp);
4532
4533 *++yyvsp = yyval;
4534
4535 /* Now `shift' the result of the reduction. Determine what state
4536 that goes to, based on the state we popped back to and the rule
4537 number reduced by. */
4538
4539 yyn = yyr1[yyn];
4540
4541 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
4542 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
4543 yystate = yytable[yystate];
4544 else
4545 yystate = yydefgoto[yyn - YYNTOKENS];
4546
4547 goto yynewstate;
4548
4549
4550/*------------------------------------.
4551| yyerrlab -- here on detecting error |
4552`------------------------------------*/
4553yyerrlab:
4554 /* If not already recovering from an error, report this error. */
4555 if (!yyerrstatus)
4556 {
4557 ++yynerrs;
4558#if ! YYERROR_VERBOSE
4559 yyerror (context, YY_("syntax error"));
4560#else
4561 {
4562 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
4563 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
4564 {
4565 YYSIZE_T yyalloc = 2 * yysize;
4566 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
4567 yyalloc = YYSTACK_ALLOC_MAXIMUM;
4568 if (yymsg != yymsgbuf)
4569 YYSTACK_FREE (yymsg);
4570 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
4571 if (yymsg)
4572 yymsg_alloc = yyalloc;
4573 else
4574 {
4575 yymsg = yymsgbuf;
4576 yymsg_alloc = sizeof yymsgbuf;
4577 }
4578 }
4579
4580 if (0 < yysize && yysize <= yymsg_alloc)
4581 {
4582 (void) yysyntax_error (yymsg, yystate, yychar);
4583 yyerror (context, yymsg);
4584 }
4585 else
4586 {
4587 yyerror (context, YY_("syntax error"));
4588 if (yysize != 0)
4589 goto yyexhaustedlab;
4590 }
4591 }
4592#endif
4593 }
4594
4595
4596
4597 if (yyerrstatus == 3)
4598 {
4599 /* If just tried and failed to reuse lookahead token after an
4600 error, discard it. */
4601
4602 if (yychar <= YYEOF)
4603 {
4604 /* Return failure if at end of input. */
4605 if (yychar == YYEOF)
4606 YYABORT;
4607 }
4608 else
4609 {
4610 yydestruct ("Error: discarding",
4611 yytoken, &yylval, context);
4612 yychar = YYEMPTY;
4613 }
4614 }
4615
4616 /* Else will try to reuse lookahead token after shifting the error
4617 token. */
4618 goto yyerrlab1;
4619
4620
4621/*---------------------------------------------------.
4622| yyerrorlab -- error raised explicitly by YYERROR. |
4623`---------------------------------------------------*/
4624yyerrorlab:
4625
4626 /* Pacify compilers like GCC when the user code never invokes
4627 YYERROR and the label yyerrorlab therefore never appears in user
4628 code. */
4629 if (/*CONSTCOND*/ 0)
4630 goto yyerrorlab;
4631
4632 /* Do not reclaim the symbols of the rule which action triggered
4633 this YYERROR. */
4634 YYPOPSTACK (yylen);
4635 yylen = 0;
4636 YY_STACK_PRINT (yyss, yyssp);
4637 yystate = *yyssp;
4638 goto yyerrlab1;
4639
4640
4641/*-------------------------------------------------------------.
4642| yyerrlab1 -- common code for both syntax error and YYERROR. |
4643`-------------------------------------------------------------*/
4644yyerrlab1:
4645 yyerrstatus = 3; /* Each real token shifted decrements this. */
4646
4647 for (;;)
4648 {
4649 yyn = yypact[yystate];
4650 if (yyn != YYPACT_NINF)
4651 {
4652 yyn += YYTERROR;
4653 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
4654 {
4655 yyn = yytable[yyn];
4656 if (0 < yyn)
4657 break;
4658 }
4659 }
4660
4661 /* Pop the current state because it cannot handle the error token. */
4662 if (yyssp == yyss)
4663 YYABORT;
4664
4665
4666 yydestruct ("Error: popping",
4667 yystos[yystate], yyvsp, context);
4668 YYPOPSTACK (1);
4669 yystate = *yyssp;
4670 YY_STACK_PRINT (yyss, yyssp);
4671 }
4672
4673 *++yyvsp = yylval;
4674
4675
4676 /* Shift the error token. */
4677 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
4678
4679 yystate = yyn;
4680 goto yynewstate;
4681
4682
4683/*-------------------------------------.
4684| yyacceptlab -- YYACCEPT comes here. |
4685`-------------------------------------*/
4686yyacceptlab:
4687 yyresult = 0;
4688 goto yyreturn;
4689
4690/*-----------------------------------.
4691| yyabortlab -- YYABORT comes here. |
4692`-----------------------------------*/
4693yyabortlab:
4694 yyresult = 1;
4695 goto yyreturn;
4696
4697#if !defined(yyoverflow) || YYERROR_VERBOSE
4698/*-------------------------------------------------.
4699| yyexhaustedlab -- memory exhaustion comes here. |
4700`-------------------------------------------------*/
4701yyexhaustedlab:
4702 yyerror (context, YY_("memory exhausted"));
4703 yyresult = 2;
4704 /* Fall through. */
4705#endif
4706
4707yyreturn:
4708 if (yychar != YYEMPTY)
4709 yydestruct ("Cleanup: discarding lookahead",
4710 yytoken, &yylval, context);
4711 /* Do not reclaim the symbols of the rule which action triggered
4712 this YYABORT or YYACCEPT. */
4713 YYPOPSTACK (yylen);
4714 YY_STACK_PRINT (yyss, yyssp);
4715 while (yyssp != yyss)
4716 {
4717 yydestruct ("Cleanup: popping",
4718 yystos[*yyssp], yyvsp, context);
4719 YYPOPSTACK (1);
4720 }
4721#ifndef yyoverflow
4722 if (yyss != yyssa)
4723 YYSTACK_FREE (yyss);
4724#endif
4725#if YYERROR_VERBOSE
4726 if (yymsg != yymsgbuf)
4727 YYSTACK_FREE (yymsg);
4728#endif
4729 /* Make sure YYID is used. */
4730 return YYID (yyresult);
4731}
4732
4733
4734
4735
4736
4737int glslang_parse(TParseContext* context) {
4738 return yyparse(context);
4739}
4740
4741