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