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