blob: 2de25dfbd42c1ac0a44834dcb77e3a6f2fb7f10c [file] [log] [blame]
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001/* A Bison parser, made by GNU Bison 2.4.2. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002
3/* Skeleton implementation for Bison's Yacc-like parsers in C
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004
5 Copyright (C) 1984, 1989-1990, 2000-2006, 2009-2010 Free Software
6 Foundation, Inc.
7
8 This program is free software: you can redistribute it and/or modify
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00009 it under the terms of the GNU General Public License as published by
daniel@transgaming.com05bc2042012-03-09 21:56:58 +000010 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12
alokp@chromium.org044a5cf2010-11-12 15:42:16 +000013 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
daniel@transgaming.com05bc2042012-03-09 21:56:58 +000017
alokp@chromium.org044a5cf2010-11-12 15:42:16 +000018 You should have received a copy of the GNU General Public License
daniel@transgaming.com05bc2042012-03-09 21:56:58 +000019 along with this program. If not, see <http://www.gnu.org/licenses/>. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +000020
21/* As a special exception, you may create a larger work that contains
22 part or all of the Bison parser skeleton and distribute that work
23 under terms of your choice, so long as that work isn't itself a
24 parser generator using the skeleton or a modified version thereof
25 as a parser skeleton. Alternatively, if you modify or redistribute
26 the parser skeleton itself, you may (at your option) remove this
27 special exception, which will cause the skeleton and the resulting
28 Bison output files to be licensed under the GNU General Public
29 License without this special exception.
daniel@transgaming.com05bc2042012-03-09 21:56:58 +000030
alokp@chromium.org044a5cf2010-11-12 15:42:16 +000031 This special exception was added by the Free Software Foundation in
32 version 2.2 of Bison. */
33
34/* C LALR(1) parser skeleton written by Richard Stallman, by
35 simplifying the original so-called "semantic" parser. */
36
37/* All symbols defined below should begin with yy or YY, to avoid
38 infringing on user name space. This should be done even for local
39 variables, as they might otherwise be expanded by user macros.
40 There are some unavoidable exceptions within include files to
41 define necessary library symbols; they are noted "INFRINGES ON
42 USER NAME SPACE" below. */
43
44/* Identify Bison output. */
45#define YYBISON 1
46
47/* Bison version. */
daniel@transgaming.com05bc2042012-03-09 21:56:58 +000048#define YYBISON_VERSION "2.4.2"
alokp@chromium.org044a5cf2010-11-12 15:42:16 +000049
50/* Skeleton name. */
51#define YYSKELETON_NAME "yacc.c"
52
53/* Pure parsers. */
54#define YYPURE 1
55
daniel@transgaming.com05bc2042012-03-09 21:56:58 +000056/* Push parsers. */
57#define YYPUSH 0
58
59/* Pull parsers. */
60#define YYPULL 1
61
alokp@chromium.org044a5cf2010-11-12 15:42:16 +000062/* Using locations. */
63#define YYLSP_NEEDED 0
64
65
66
daniel@transgaming.com05bc2042012-03-09 21:56:58 +000067/* Copy the first part of user declarations. */
68
69
70//
71// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
72// Use of this source code is governed by a BSD-style license that can be
73// found in the LICENSE file.
74//
75
76// This file is auto-generated by generate_parser.sh. DO NOT EDIT!
77
78// Ignore errors in auto-generated code.
79#if defined(__GNUC__)
80#pragma GCC diagnostic ignored "-Wunused-function"
81#pragma GCC diagnostic ignored "-Wunused-variable"
82#pragma GCC diagnostic ignored "-Wswitch-enum"
83#elif defined(_MSC_VER)
84#pragma warning(disable: 4065)
85#pragma warning(disable: 4189)
86#pragma warning(disable: 4505)
87#pragma warning(disable: 4701)
88#endif
89
90#include "compiler/SymbolTable.h"
91#include "compiler/ParseHelper.h"
92#include "GLSLANG/ShaderLang.h"
93
94#define YYLEX_PARAM context->scanner
95
96
97
98/* Enabling traces. */
99#ifndef YYDEBUG
100# define YYDEBUG 0
101#endif
102
103/* Enabling verbose error messages. */
104#ifdef YYERROR_VERBOSE
105# undef YYERROR_VERBOSE
106# define YYERROR_VERBOSE 1
107#else
108# define YYERROR_VERBOSE 0
109#endif
110
111/* Enabling the token table. */
112#ifndef YYTOKEN_TABLE
113# define YYTOKEN_TABLE 0
114#endif
115
116
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000117/* Tokens. */
118#ifndef YYTOKENTYPE
119# define YYTOKENTYPE
120 /* Put the tokens into the symbol table, so that GDB and other debuggers
121 know about them. */
122 enum yytokentype {
123 INVARIANT = 258,
124 HIGH_PRECISION = 259,
125 MEDIUM_PRECISION = 260,
126 LOW_PRECISION = 261,
127 PRECISION = 262,
128 ATTRIBUTE = 263,
129 CONST_QUAL = 264,
130 BOOL_TYPE = 265,
131 FLOAT_TYPE = 266,
132 INT_TYPE = 267,
133 BREAK = 268,
134 CONTINUE = 269,
135 DO = 270,
136 ELSE = 271,
137 FOR = 272,
138 IF = 273,
139 DISCARD = 274,
140 RETURN = 275,
141 BVEC2 = 276,
142 BVEC3 = 277,
143 BVEC4 = 278,
144 IVEC2 = 279,
145 IVEC3 = 280,
146 IVEC4 = 281,
147 VEC2 = 282,
148 VEC3 = 283,
149 VEC4 = 284,
150 MATRIX2 = 285,
151 MATRIX3 = 286,
152 MATRIX4 = 287,
153 IN_QUAL = 288,
154 OUT_QUAL = 289,
155 INOUT_QUAL = 290,
156 UNIFORM = 291,
157 VARYING = 292,
158 STRUCT = 293,
159 VOID_TYPE = 294,
160 WHILE = 295,
161 SAMPLER2D = 296,
162 SAMPLERCUBE = 297,
zmo@google.com09c323a2011-08-12 18:22:25 +0000163 SAMPLER_EXTERNAL_OES = 298,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000164 SAMPLER2DRECT = 299,
165 IDENTIFIER = 300,
166 TYPE_NAME = 301,
167 FLOATCONSTANT = 302,
168 INTCONSTANT = 303,
169 BOOLCONSTANT = 304,
170 FIELD_SELECTION = 305,
171 LEFT_OP = 306,
172 RIGHT_OP = 307,
173 INC_OP = 308,
174 DEC_OP = 309,
175 LE_OP = 310,
176 GE_OP = 311,
177 EQ_OP = 312,
178 NE_OP = 313,
179 AND_OP = 314,
180 OR_OP = 315,
181 XOR_OP = 316,
182 MUL_ASSIGN = 317,
183 DIV_ASSIGN = 318,
184 ADD_ASSIGN = 319,
185 MOD_ASSIGN = 320,
186 LEFT_ASSIGN = 321,
187 RIGHT_ASSIGN = 322,
188 AND_ASSIGN = 323,
189 XOR_ASSIGN = 324,
190 OR_ASSIGN = 325,
191 SUB_ASSIGN = 326,
192 LEFT_PAREN = 327,
193 RIGHT_PAREN = 328,
194 LEFT_BRACKET = 329,
195 RIGHT_BRACKET = 330,
196 LEFT_BRACE = 331,
197 RIGHT_BRACE = 332,
198 DOT = 333,
199 COMMA = 334,
200 COLON = 335,
201 EQUAL = 336,
202 SEMICOLON = 337,
203 BANG = 338,
204 DASH = 339,
205 TILDE = 340,
206 PLUS = 341,
207 STAR = 342,
208 SLASH = 343,
209 PERCENT = 344,
210 LEFT_ANGLE = 345,
211 RIGHT_ANGLE = 346,
212 VERTICAL_BAR = 347,
213 CARET = 348,
214 AMPERSAND = 349,
215 QUESTION = 350
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000216 };
217#endif
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000218
219
220
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000221#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
222typedef union YYSTYPE
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000223{
daniel@transgaming.com05bc2042012-03-09 21:56:58 +0000224
225
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000226 struct {
227 TSourceLoc line;
228 union {
229 TString *string;
230 float f;
231 int i;
232 bool b;
233 };
234 TSymbol* symbol;
235 } lex;
236 struct {
237 TSourceLoc line;
238 TOperator op;
239 union {
240 TIntermNode* intermNode;
241 TIntermNodePair nodePair;
242 TIntermTyped* intermTypedNode;
243 TIntermAggregate* intermAggregate;
244 };
245 union {
246 TPublicType type;
247 TPrecision precision;
248 TQualifier qualifier;
249 TFunction* function;
250 TParameter param;
251 TTypeLine typeLine;
252 TTypeList* typeList;
253 };
254 } interm;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000255
daniel@transgaming.com05bc2042012-03-09 21:56:58 +0000256
257
258} YYSTYPE;
259# define YYSTYPE_IS_TRIVIAL 1
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000260# define yystype YYSTYPE /* obsolescent; will be withdrawn */
261# define YYSTYPE_IS_DECLARED 1
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000262#endif
263
264
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000265/* Copy the second part of user declarations. */
266
267
268extern int yylex(YYSTYPE* yylval_param, void* yyscanner);
269extern void yyerror(TParseContext* context, const char* reason);
270
271#define FRAG_VERT_ONLY(S, L) { \
272 if (context->shaderType != SH_FRAGMENT_SHADER && \
273 context->shaderType != SH_VERTEX_SHADER) { \
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +0000274 context->error(L, " supported in vertex/fragment shaders only ", S); \
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000275 context->recover(); \
276 } \
277}
278
279#define VERTEX_ONLY(S, L) { \
280 if (context->shaderType != SH_VERTEX_SHADER) { \
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +0000281 context->error(L, " supported in vertex shaders only ", S); \
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000282 context->recover(); \
283 } \
284}
285
286#define FRAG_ONLY(S, L) { \
287 if (context->shaderType != SH_FRAGMENT_SHADER) { \
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +0000288 context->error(L, " supported in fragment shaders only ", S); \
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000289 context->recover(); \
290 } \
291}
292
293
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000294
295#ifdef short
296# undef short
297#endif
298
299#ifdef YYTYPE_UINT8
300typedef YYTYPE_UINT8 yytype_uint8;
301#else
302typedef unsigned char yytype_uint8;
303#endif
304
305#ifdef YYTYPE_INT8
306typedef YYTYPE_INT8 yytype_int8;
307#elif (defined __STDC__ || defined __C99__FUNC__ \
308 || defined __cplusplus || defined _MSC_VER)
309typedef signed char yytype_int8;
310#else
311typedef short int yytype_int8;
312#endif
313
314#ifdef YYTYPE_UINT16
315typedef YYTYPE_UINT16 yytype_uint16;
316#else
317typedef unsigned short int yytype_uint16;
318#endif
319
320#ifdef YYTYPE_INT16
321typedef YYTYPE_INT16 yytype_int16;
322#else
323typedef short int yytype_int16;
324#endif
325
326#ifndef YYSIZE_T
327# ifdef __SIZE_TYPE__
328# define YYSIZE_T __SIZE_TYPE__
329# elif defined size_t
330# define YYSIZE_T size_t
331# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
332 || defined __cplusplus || defined _MSC_VER)
333# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
334# define YYSIZE_T size_t
335# else
336# define YYSIZE_T unsigned int
337# endif
338#endif
339
340#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
341
342#ifndef YY_
daniel@transgaming.com05bc2042012-03-09 21:56:58 +0000343# if defined YYENABLE_NLS && YYENABLE_NLS
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000344# if ENABLE_NLS
345# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
346# define YY_(msgid) dgettext ("bison-runtime", msgid)
347# endif
348# endif
349# ifndef YY_
350# define YY_(msgid) msgid
351# endif
352#endif
353
354/* Suppress unused-variable warnings by "using" E. */
355#if ! defined lint || defined __GNUC__
356# define YYUSE(e) ((void) (e))
357#else
358# define YYUSE(e) /* empty */
359#endif
360
361/* Identity function, used to suppress warnings about constant conditions. */
362#ifndef lint
363# define YYID(n) (n)
364#else
365#if (defined __STDC__ || defined __C99__FUNC__ \
366 || defined __cplusplus || defined _MSC_VER)
367static int
daniel@transgaming.com05bc2042012-03-09 21:56:58 +0000368YYID (int yyi)
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000369#else
370static int
daniel@transgaming.com05bc2042012-03-09 21:56:58 +0000371YYID (yyi)
372 int yyi;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000373#endif
374{
daniel@transgaming.com05bc2042012-03-09 21:56:58 +0000375 return yyi;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000376}
377#endif
378
379#if ! defined yyoverflow || YYERROR_VERBOSE
380
381/* The parser invokes alloca or malloc; define the necessary symbols. */
382
383# ifdef YYSTACK_USE_ALLOCA
384# if YYSTACK_USE_ALLOCA
385# ifdef __GNUC__
386# define YYSTACK_ALLOC __builtin_alloca
387# elif defined __BUILTIN_VA_ARG_INCR
388# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
389# elif defined _AIX
390# define YYSTACK_ALLOC __alloca
391# elif defined _MSC_VER
392# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
393# define alloca _alloca
394# else
395# define YYSTACK_ALLOC alloca
396# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
397 || defined __cplusplus || defined _MSC_VER)
398# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
399# ifndef _STDLIB_H
400# define _STDLIB_H 1
401# endif
402# endif
403# endif
404# endif
405# endif
406
407# ifdef YYSTACK_ALLOC
408 /* Pacify GCC's `empty if-body' warning. */
409# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
410# ifndef YYSTACK_ALLOC_MAXIMUM
411 /* The OS might guarantee only one guard page at the bottom of the stack,
412 and a page size can be as small as 4096 bytes. So we cannot safely
413 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
414 to allow for a few compiler-allocated temporary stack slots. */
415# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
416# endif
417# else
418# define YYSTACK_ALLOC YYMALLOC
419# define YYSTACK_FREE YYFREE
420# ifndef YYSTACK_ALLOC_MAXIMUM
421# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
422# endif
423# if (defined __cplusplus && ! defined _STDLIB_H \
424 && ! ((defined YYMALLOC || defined malloc) \
425 && (defined YYFREE || defined free)))
426# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
427# ifndef _STDLIB_H
428# define _STDLIB_H 1
429# endif
430# endif
431# ifndef YYMALLOC
432# define YYMALLOC malloc
433# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
434 || defined __cplusplus || defined _MSC_VER)
435void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
436# endif
437# endif
438# ifndef YYFREE
439# define YYFREE free
440# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
441 || defined __cplusplus || defined _MSC_VER)
442void free (void *); /* INFRINGES ON USER NAME SPACE */
443# endif
444# endif
445# endif
446#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
447
448
449#if (! defined yyoverflow \
450 && (! defined __cplusplus \
451 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
452
453/* A type that is properly aligned for any stack member. */
454union yyalloc
455{
daniel@transgaming.com05bc2042012-03-09 21:56:58 +0000456 yytype_int16 yyss_alloc;
457 YYSTYPE yyvs_alloc;
458};
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000459
460/* The size of the maximum gap between one aligned stack and the next. */
461# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
462
463/* The size of an array large to enough to hold all stacks, each with
464 N elements. */
465# define YYSTACK_BYTES(N) \
466 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
467 + YYSTACK_GAP_MAXIMUM)
468
469/* Copy COUNT objects from FROM to TO. The source and destination do
470 not overlap. */
471# ifndef YYCOPY
472# if defined __GNUC__ && 1 < __GNUC__
473# define YYCOPY(To, From, Count) \
474 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
475# else
476# define YYCOPY(To, From, Count) \
477 do \
478 { \
479 YYSIZE_T yyi; \
480 for (yyi = 0; yyi < (Count); yyi++) \
481 (To)[yyi] = (From)[yyi]; \
482 } \
483 while (YYID (0))
484# endif
485# endif
486
487/* Relocate STACK from its old location to the new one. The
488 local variables YYSIZE and YYSTACKSIZE give the old and new number of
489 elements in the stack, and YYPTR gives the new location of the
490 stack. Advance YYPTR to a properly aligned location for the next
491 stack. */
daniel@transgaming.com05bc2042012-03-09 21:56:58 +0000492# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000493 do \
494 { \
495 YYSIZE_T yynewbytes; \
daniel@transgaming.com05bc2042012-03-09 21:56:58 +0000496 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
497 Stack = &yyptr->Stack_alloc; \
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000498 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
499 yyptr += yynewbytes / sizeof (*yyptr); \
500 } \
501 while (YYID (0))
502
503#endif
504
505/* YYFINAL -- State number of the termination state. */
kbr@chromium.org205fef32011-11-22 20:50:02 +0000506#define YYFINAL 71
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000507/* YYLAST -- Last index in YYTABLE. */
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000508#define YYLAST 1416
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000509
510/* YYNTOKENS -- Number of terminals. */
kbr@chromium.org205fef32011-11-22 20:50:02 +0000511#define YYNTOKENS 96
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000512/* YYNNTS -- Number of nonterminals. */
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000513#define YYNNTS 83
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000514/* YYNRULES -- Number of rules. */
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000515#define YYNRULES 201
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000516/* YYNRULES -- Number of states. */
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000517#define YYNSTATES 304
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000518
519/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
520#define YYUNDEFTOK 2
kbr@chromium.org205fef32011-11-22 20:50:02 +0000521#define YYMAXUTOK 350
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000522
523#define YYTRANSLATE(YYX) \
524 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
525
526/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
527static const yytype_uint8 yytranslate[] =
528{
529 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
530 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
531 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
532 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
533 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
534 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
535 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
536 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
537 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
538 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
539 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
540 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
541 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
542 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
543 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
544 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
545 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
546 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
547 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
548 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
549 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
550 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
551 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
552 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
553 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
554 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
555 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
556 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
557 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
558 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
559 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
560 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
561 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
562 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000563 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
564 95
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000565};
566
567#if YYDEBUG
568/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
569 YYRHS. */
570static const yytype_uint16 yyprhs[] =
571{
572 0, 0, 3, 5, 7, 9, 11, 13, 17, 19,
573 24, 26, 30, 33, 36, 38, 40, 42, 46, 49,
574 52, 55, 57, 60, 64, 67, 69, 71, 73, 75,
575 78, 81, 84, 86, 88, 90, 92, 96, 100, 102,
576 106, 110, 112, 114, 118, 122, 126, 130, 132, 136,
577 140, 142, 144, 146, 148, 152, 154, 158, 160, 164,
578 166, 172, 174, 178, 180, 182, 184, 186, 188, 190,
579 194, 196, 199, 202, 207, 210, 212, 214, 217, 221,
580 225, 228, 234, 238, 241, 245, 248, 249, 251, 253,
581 255, 257, 259, 263, 269, 276, 282, 284, 287, 292,
582 298, 303, 306, 308, 311, 313, 315, 317, 320, 322,
583 324, 327, 329, 331, 333, 335, 340, 342, 344, 346,
584 348, 350, 352, 354, 356, 358, 360, 362, 364, 366,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000585 368, 370, 372, 374, 376, 378, 380, 382, 384, 385,
586 392, 393, 399, 401, 404, 408, 410, 414, 416, 421,
587 423, 425, 427, 429, 431, 433, 435, 437, 439, 442,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000588 443, 444, 450, 452, 454, 455, 458, 459, 462, 465,
589 469, 471, 474, 476, 479, 485, 489, 491, 493, 498,
590 499, 506, 507, 516, 517, 525, 527, 529, 531, 532,
591 535, 539, 542, 545, 548, 552, 555, 557, 560, 562,
592 564, 565
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000593};
594
595/* YYRHS -- A `-1'-separated list of the rules' RHS. */
596static const yytype_int16 yyrhs[] =
597{
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000598 175, 0, -1, 45, -1, 97, -1, 48, -1, 47,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000599 -1, 49, -1, 72, 124, 73, -1, 98, -1, 99,
600 74, 100, 75, -1, 101, -1, 99, 78, 50, -1,
601 99, 53, -1, 99, 54, -1, 124, -1, 102, -1,
602 103, -1, 99, 78, 103, -1, 105, 73, -1, 104,
603 73, -1, 106, 39, -1, 106, -1, 106, 122, -1,
604 105, 79, 122, -1, 107, 72, -1, 142, -1, 45,
605 -1, 50, -1, 99, -1, 53, 108, -1, 54, 108,
606 -1, 109, 108, -1, 86, -1, 84, -1, 83, -1,
607 108, -1, 110, 87, 108, -1, 110, 88, 108, -1,
608 110, -1, 111, 86, 110, -1, 111, 84, 110, -1,
609 111, -1, 112, -1, 113, 90, 112, -1, 113, 91,
610 112, -1, 113, 55, 112, -1, 113, 56, 112, -1,
611 113, -1, 114, 57, 113, -1, 114, 58, 113, -1,
612 114, -1, 115, -1, 116, -1, 117, -1, 118, 59,
613 117, -1, 118, -1, 119, 61, 118, -1, 119, -1,
614 120, 60, 119, -1, 120, -1, 120, 95, 124, 80,
615 122, -1, 121, -1, 108, 123, 122, -1, 81, -1,
616 62, -1, 63, -1, 64, -1, 71, -1, 122, -1,
617 124, 79, 122, -1, 121, -1, 127, 82, -1, 135,
618 82, -1, 7, 140, 141, 82, -1, 128, 73, -1,
619 130, -1, 129, -1, 130, 132, -1, 129, 79, 132,
620 -1, 137, 45, 72, -1, 139, 45, -1, 139, 45,
621 74, 125, 75, -1, 138, 133, 131, -1, 133, 131,
622 -1, 138, 133, 134, -1, 133, 134, -1, -1, 33,
623 -1, 34, -1, 35, -1, 139, -1, 136, -1, 135,
624 79, 45, -1, 135, 79, 45, 74, 75, -1, 135,
625 79, 45, 74, 125, 75, -1, 135, 79, 45, 81,
626 150, -1, 137, -1, 137, 45, -1, 137, 45, 74,
627 75, -1, 137, 45, 74, 125, 75, -1, 137, 45,
628 81, 150, -1, 3, 45, -1, 139, -1, 138, 139,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000629 -1, 9, -1, 8, -1, 37, -1, 3, 37, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000630 36, -1, 141, -1, 140, 141, -1, 4, -1, 5,
631 -1, 6, -1, 142, -1, 142, 74, 125, 75, -1,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000632 39, -1, 11, -1, 12, -1, 10, -1, 27, -1,
633 28, -1, 29, -1, 21, -1, 22, -1, 23, -1,
634 24, -1, 25, -1, 26, -1, 30, -1, 31, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000635 32, -1, 41, -1, 42, -1, 43, -1, 44, -1,
636 143, -1, 46, -1, -1, 38, 45, 76, 144, 146,
637 77, -1, -1, 38, 76, 145, 146, 77, -1, 147,
638 -1, 146, 147, -1, 139, 148, 82, -1, 149, -1,
639 148, 79, 149, -1, 45, -1, 45, 74, 125, 75,
640 -1, 122, -1, 126, -1, 154, -1, 153, -1, 151,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000641 -1, 163, -1, 164, -1, 167, -1, 174, -1, 76,
642 77, -1, -1, -1, 76, 155, 162, 156, 77, -1,
643 161, -1, 153, -1, -1, 159, 161, -1, -1, 160,
644 153, -1, 76, 77, -1, 76, 162, 77, -1, 152,
645 -1, 162, 152, -1, 82, -1, 124, 82, -1, 18,
646 72, 124, 73, 165, -1, 158, 16, 158, -1, 158,
647 -1, 124, -1, 137, 45, 81, 150, -1, -1, 40,
648 72, 168, 166, 73, 157, -1, -1, 15, 169, 158,
649 40, 72, 124, 73, 82, -1, -1, 17, 72, 170,
650 171, 173, 73, 157, -1, 163, -1, 151, -1, 166,
651 -1, -1, 172, 82, -1, 172, 82, 124, -1, 14,
652 82, -1, 13, 82, -1, 20, 82, -1, 20, 124,
653 82, -1, 19, 82, -1, 176, -1, 175, 176, -1,
654 177, -1, 126, -1, -1, 127, 178, 161, -1
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000655};
656
657/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
658static const yytype_uint16 yyrline[] =
659{
apatrick@chromium.orge057c5d2012-01-26 19:18:24 +0000660 0, 165, 165, 200, 203, 216, 221, 226, 232, 235,
alokp@chromium.orgab8c0262012-08-13 17:36:25 +0000661 314, 317, 418, 428, 441, 449, 549, 552, 560, 564,
662 571, 575, 582, 588, 597, 605, 660, 667, 677, 680,
663 690, 700, 721, 722, 723, 728, 729, 738, 750, 751,
664 759, 770, 774, 775, 785, 795, 805, 818, 819, 829,
665 842, 846, 850, 854, 855, 868, 869, 882, 883, 896,
666 897, 914, 915, 928, 929, 930, 931, 932, 936, 939,
667 950, 958, 985, 990, 997, 1035, 1038, 1045, 1053, 1074,
668 1095, 1106, 1135, 1140, 1150, 1155, 1165, 1168, 1171, 1174,
669 1180, 1187, 1190, 1212, 1230, 1254, 1277, 1281, 1299, 1307,
670 1339, 1359, 1448, 1457, 1480, 1483, 1489, 1497, 1505, 1513,
671 1523, 1530, 1533, 1536, 1542, 1545, 1560, 1564, 1568, 1572,
672 1581, 1586, 1591, 1596, 1601, 1606, 1611, 1616, 1621, 1626,
673 1632, 1638, 1644, 1649, 1654, 1663, 1672, 1677, 1690, 1690,
674 1704, 1704, 1713, 1716, 1731, 1767, 1771, 1777, 1785, 1801,
675 1805, 1809, 1810, 1816, 1817, 1818, 1819, 1820, 1824, 1825,
676 1825, 1825, 1835, 1836, 1840, 1840, 1841, 1841, 1846, 1849,
677 1859, 1862, 1868, 1869, 1873, 1881, 1885, 1895, 1900, 1917,
678 1917, 1922, 1922, 1929, 1929, 1937, 1940, 1946, 1949, 1955,
679 1959, 1966, 1973, 1980, 1987, 1998, 2007, 2011, 2018, 2021,
680 2027, 2027
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000681};
682#endif
683
684#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
685/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
686 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
687static const char *const yytname[] =
688{
689 "$end", "error", "$undefined", "INVARIANT", "HIGH_PRECISION",
690 "MEDIUM_PRECISION", "LOW_PRECISION", "PRECISION", "ATTRIBUTE",
691 "CONST_QUAL", "BOOL_TYPE", "FLOAT_TYPE", "INT_TYPE", "BREAK", "CONTINUE",
692 "DO", "ELSE", "FOR", "IF", "DISCARD", "RETURN", "BVEC2", "BVEC3",
693 "BVEC4", "IVEC2", "IVEC3", "IVEC4", "VEC2", "VEC3", "VEC4", "MATRIX2",
694 "MATRIX3", "MATRIX4", "IN_QUAL", "OUT_QUAL", "INOUT_QUAL", "UNIFORM",
695 "VARYING", "STRUCT", "VOID_TYPE", "WHILE", "SAMPLER2D", "SAMPLERCUBE",
kbr@chromium.org205fef32011-11-22 20:50:02 +0000696 "SAMPLER_EXTERNAL_OES", "SAMPLER2DRECT", "IDENTIFIER", "TYPE_NAME",
697 "FLOATCONSTANT", "INTCONSTANT", "BOOLCONSTANT", "FIELD_SELECTION",
698 "LEFT_OP", "RIGHT_OP", "INC_OP", "DEC_OP", "LE_OP", "GE_OP", "EQ_OP",
699 "NE_OP", "AND_OP", "OR_OP", "XOR_OP", "MUL_ASSIGN", "DIV_ASSIGN",
700 "ADD_ASSIGN", "MOD_ASSIGN", "LEFT_ASSIGN", "RIGHT_ASSIGN", "AND_ASSIGN",
701 "XOR_ASSIGN", "OR_ASSIGN", "SUB_ASSIGN", "LEFT_PAREN", "RIGHT_PAREN",
702 "LEFT_BRACKET", "RIGHT_BRACKET", "LEFT_BRACE", "RIGHT_BRACE", "DOT",
703 "COMMA", "COLON", "EQUAL", "SEMICOLON", "BANG", "DASH", "TILDE", "PLUS",
704 "STAR", "SLASH", "PERCENT", "LEFT_ANGLE", "RIGHT_ANGLE", "VERTICAL_BAR",
705 "CARET", "AMPERSAND", "QUESTION", "$accept", "variable_identifier",
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000706 "primary_expression", "postfix_expression", "integer_expression",
707 "function_call", "function_call_or_method", "function_call_generic",
708 "function_call_header_no_parameters",
709 "function_call_header_with_parameters", "function_call_header",
710 "function_identifier", "unary_expression", "unary_operator",
711 "multiplicative_expression", "additive_expression", "shift_expression",
712 "relational_expression", "equality_expression", "and_expression",
713 "exclusive_or_expression", "inclusive_or_expression",
714 "logical_and_expression", "logical_xor_expression",
715 "logical_or_expression", "conditional_expression",
716 "assignment_expression", "assignment_operator", "expression",
717 "constant_expression", "declaration", "function_prototype",
718 "function_declarator", "function_header_with_parameters",
719 "function_header", "parameter_declarator", "parameter_declaration",
720 "parameter_qualifier", "parameter_type_specifier",
721 "init_declarator_list", "single_declaration", "fully_specified_type",
722 "type_qualifier", "type_specifier", "precision_qualifier",
723 "type_specifier_no_prec", "type_specifier_nonarray", "struct_specifier",
daniel@transgaming.com05bc2042012-03-09 21:56:58 +0000724 "$@1", "$@2", "struct_declaration_list", "struct_declaration",
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000725 "struct_declarator_list", "struct_declarator", "initializer",
726 "declaration_statement", "statement", "simple_statement",
daniel@transgaming.com05bc2042012-03-09 21:56:58 +0000727 "compound_statement", "$@3", "$@4", "statement_no_new_scope",
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000728 "statement_with_scope", "$@5", "$@6", "compound_statement_no_new_scope",
729 "statement_list", "expression_statement", "selection_statement",
730 "selection_rest_statement", "condition", "iteration_statement", "$@7",
731 "$@8", "$@9", "for_init_statement", "conditionopt", "for_rest_statement",
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000732 "jump_statement", "translation_unit", "external_declaration",
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000733 "function_definition", "$@10", 0
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000734};
735#endif
736
737# ifdef YYPRINT
738/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
739 token YYLEX-NUM. */
740static const yytype_uint16 yytoknum[] =
741{
742 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
743 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
744 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
745 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
746 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
747 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
748 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
749 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
750 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000751 345, 346, 347, 348, 349, 350
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000752};
753# endif
754
755/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
756static const yytype_uint8 yyr1[] =
757{
kbr@chromium.org205fef32011-11-22 20:50:02 +0000758 0, 96, 97, 98, 98, 98, 98, 98, 99, 99,
759 99, 99, 99, 99, 100, 101, 102, 102, 103, 103,
760 104, 104, 105, 105, 106, 107, 107, 107, 108, 108,
761 108, 108, 109, 109, 109, 110, 110, 110, 111, 111,
762 111, 112, 113, 113, 113, 113, 113, 114, 114, 114,
763 115, 116, 117, 118, 118, 119, 119, 120, 120, 121,
764 121, 122, 122, 123, 123, 123, 123, 123, 124, 124,
765 125, 126, 126, 126, 127, 128, 128, 129, 129, 130,
766 131, 131, 132, 132, 132, 132, 133, 133, 133, 133,
767 134, 135, 135, 135, 135, 135, 136, 136, 136, 136,
768 136, 136, 137, 137, 138, 138, 138, 138, 138, 139,
769 139, 140, 140, 140, 141, 141, 142, 142, 142, 142,
770 142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
771 142, 142, 142, 142, 142, 142, 142, 142, 144, 143,
772 145, 143, 146, 146, 147, 148, 148, 149, 149, 150,
773 151, 152, 152, 153, 153, 153, 153, 153, 154, 155,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000774 156, 154, 157, 157, 159, 158, 160, 158, 161, 161,
775 162, 162, 163, 163, 164, 165, 165, 166, 166, 168,
776 167, 169, 167, 170, 167, 171, 171, 172, 172, 173,
777 173, 174, 174, 174, 174, 174, 175, 175, 176, 176,
778 178, 177
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000779};
780
781/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
782static const yytype_uint8 yyr2[] =
783{
784 0, 2, 1, 1, 1, 1, 1, 3, 1, 4,
785 1, 3, 2, 2, 1, 1, 1, 3, 2, 2,
786 2, 1, 2, 3, 2, 1, 1, 1, 1, 2,
787 2, 2, 1, 1, 1, 1, 3, 3, 1, 3,
788 3, 1, 1, 3, 3, 3, 3, 1, 3, 3,
789 1, 1, 1, 1, 3, 1, 3, 1, 3, 1,
790 5, 1, 3, 1, 1, 1, 1, 1, 1, 3,
791 1, 2, 2, 4, 2, 1, 1, 2, 3, 3,
792 2, 5, 3, 2, 3, 2, 0, 1, 1, 1,
793 1, 1, 3, 5, 6, 5, 1, 2, 4, 5,
794 4, 2, 1, 2, 1, 1, 1, 2, 1, 1,
795 2, 1, 1, 1, 1, 4, 1, 1, 1, 1,
796 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000797 1, 1, 1, 1, 1, 1, 1, 1, 0, 6,
798 0, 5, 1, 2, 3, 1, 3, 1, 4, 1,
799 1, 1, 1, 1, 1, 1, 1, 1, 2, 0,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000800 0, 5, 1, 1, 0, 2, 0, 2, 2, 3,
801 1, 2, 1, 2, 5, 3, 1, 1, 4, 0,
802 6, 0, 8, 0, 7, 1, 1, 1, 0, 2,
803 3, 2, 2, 2, 3, 2, 1, 2, 1, 1,
804 0, 3
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000805};
806
807/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
808 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
809 means the default is an error. */
810static const yytype_uint8 yydefact[] =
811{
812 0, 0, 111, 112, 113, 0, 105, 104, 119, 117,
813 118, 123, 124, 125, 126, 127, 128, 120, 121, 122,
zmo@google.com09c323a2011-08-12 18:22:25 +0000814 129, 130, 131, 108, 106, 0, 116, 132, 133, 134,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000815 135, 137, 199, 200, 0, 76, 86, 0, 91, 96,
816 0, 102, 0, 109, 114, 136, 0, 196, 198, 107,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000817 101, 0, 0, 140, 71, 0, 74, 86, 0, 87,
818 88, 89, 77, 0, 86, 0, 72, 97, 103, 110,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000819 0, 1, 197, 0, 138, 0, 0, 201, 78, 83,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000820 85, 90, 0, 92, 79, 0, 0, 2, 5, 4,
821 6, 27, 0, 0, 0, 34, 33, 32, 3, 8,
822 28, 10, 15, 16, 0, 0, 21, 0, 35, 0,
823 38, 41, 42, 47, 50, 51, 52, 53, 55, 57,
824 59, 70, 0, 25, 73, 0, 0, 0, 142, 0,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000825 0, 181, 0, 0, 0, 0, 0, 159, 168, 172,
826 35, 61, 68, 0, 150, 0, 114, 153, 170, 152,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000827 151, 0, 154, 155, 156, 157, 80, 82, 84, 0,
828 0, 98, 0, 149, 100, 29, 30, 0, 12, 13,
829 0, 0, 19, 18, 0, 20, 22, 24, 31, 0,
kbr@chromium.org476541f2011-10-27 21:14:51 +0000830 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000831 0, 0, 0, 115, 0, 147, 0, 145, 141, 143,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000832 192, 191, 166, 183, 0, 195, 193, 0, 179, 158,
833 0, 64, 65, 66, 67, 63, 0, 0, 173, 169,
834 171, 0, 93, 0, 95, 99, 7, 0, 14, 26,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000835 11, 17, 23, 36, 37, 40, 39, 45, 46, 43,
836 44, 48, 49, 54, 56, 58, 0, 139, 0, 0,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000837 144, 0, 0, 0, 0, 0, 194, 0, 160, 62,
838 69, 0, 94, 9, 0, 0, 146, 0, 165, 167,
839 186, 185, 188, 166, 177, 0, 0, 0, 81, 60,
840 148, 0, 187, 0, 0, 176, 174, 0, 0, 161,
841 0, 189, 0, 166, 0, 163, 180, 162, 0, 190,
842 184, 175, 178, 182
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000843};
844
845/* YYDEFGOTO[NTERM-NUM]. */
846static const yytype_int16 yydefgoto[] =
847{
kbr@chromium.org205fef32011-11-22 20:50:02 +0000848 -1, 98, 99, 100, 227, 101, 102, 103, 104, 105,
849 106, 107, 140, 109, 110, 111, 112, 113, 114, 115,
850 116, 117, 118, 119, 120, 141, 142, 216, 143, 122,
851 144, 145, 34, 35, 36, 79, 62, 63, 80, 37,
852 38, 39, 40, 41, 42, 43, 123, 45, 125, 75,
853 127, 128, 196, 197, 164, 147, 148, 149, 150, 210,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000854 277, 296, 251, 252, 253, 297, 151, 152, 153, 286,
855 276, 154, 257, 202, 254, 272, 283, 284, 155, 46,
856 47, 48, 55
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000857};
858
859/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
860 STATE-NUM. */
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000861#define YYPACT_NINF -266
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000862static const yytype_int16 yypact[] =
863{
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000864 1253, -20, -266, -266, -266, 148, -266, -266, -266, -266,
865 -266, -266, -266, -266, -266, -266, -266, -266, -266, -266,
866 -266, -266, -266, -266, -266, -39, -266, -266, -266, -266,
867 -266, -266, -266, -18, -2, 6, 21, -61, -266, 51,
868 1296, -266, 1370, -266, 25, -266, 1209, -266, -266, -266,
869 -266, 1370, 42, -266, -266, 50, -266, 71, 95, -266,
870 -266, -266, -266, 1296, 123, 105, -266, 9, -266, -266,
871 974, -266, -266, 81, -266, 1296, 290, -266, -266, -266,
872 -266, 125, 1296, -13, -266, 776, 974, 99, -266, -266,
873 -266, -266, 974, 974, 974, -266, -266, -266, -266, -266,
874 35, -266, -266, -266, 100, -6, 1040, 104, -266, 974,
875 36, -64, -266, -21, 102, -266, -266, -266, 113, 117,
876 -51, -266, 108, -266, -266, 1296, 129, 1109, -266, 97,
877 103, -266, 112, 114, 106, 842, 115, 116, -266, -266,
878 39, -266, -266, -43, -266, -18, 47, -266, -266, -266,
879 -266, 374, -266, -266, -266, -266, 118, -266, -266, 908,
880 974, -266, 120, -266, -266, -266, -266, 19, -266, -266,
881 974, 1333, -266, -266, 974, 119, -266, -266, -266, 974,
882 974, 974, 974, 974, 974, 974, 974, 974, 974, 974,
883 974, 974, 974, -266, 1152, 122, -29, -266, -266, -266,
884 -266, -266, 121, -266, 974, -266, -266, 5, -266, -266,
885 458, -266, -266, -266, -266, -266, 974, 974, -266, -266,
886 -266, 974, -266, 137, -266, -266, -266, 138, 111, -266,
887 142, -266, -266, -266, -266, 36, 36, -266, -266, -266,
888 -266, -21, -21, -266, 113, 117, 82, -266, 974, 129,
889 -266, 175, 50, 626, 710, 38, -266, 197, 458, -266,
890 -266, 141, -266, -266, 974, 155, -266, 145, -266, -266,
891 -266, -266, 197, 121, 111, 186, 159, 160, -266, -266,
892 -266, 974, -266, 166, 176, 236, -266, 174, 542, -266,
893 43, 974, 542, 121, 974, -266, -266, -266, 177, 111,
894 -266, -266, -266, -266
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000895};
896
897/* YYPGOTO[NTERM-NUM]. */
898static const yytype_int16 yypgoto[] =
899{
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000900 -266, -266, -266, -266, -266, -266, -266, 85, -266, -266,
901 -266, -266, -44, -266, -15, -266, -55, -19, -266, -266,
902 -266, 72, 70, 73, -266, -66, -83, -266, -92, -73,
903 13, 14, -266, -266, -266, 180, 206, 201, 184, -266,
904 -266, -241, -25, -30, 262, -4, 0, -266, -266, -266,
905 143, -122, -266, 22, -145, 16, -144, -226, -266, -266,
906 -266, -17, -265, -266, -266, -54, 63, 20, -266, -266,
907 4, -266, -266, -266, -266, -266, -266, -266, -266, -266,
908 231, -266, -266
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000909};
910
911/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
912 positive, shift that token. If negative, reduce the rule which
913 number is the opposite. If zero, do what YYDEFACT says.
914 If YYTABLE_NINF, syntax error. */
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000915#define YYTABLE_NINF -165
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000916static const yytype_int16 yytable[] =
917{
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000918 44, 77, 167, 163, 121, 199, 52, 220, 285, 191,
919 68, 64, 162, 32, 33, 224, 275, 49, 65, 121,
920 181, 66, 182, 176, 58, 50, 108, 269, 301, 6,
921 7, 275, 64, 81, 183, 184, 217, 53, 69, 218,
922 44, 108, 44, 207, 192, 126, 44, 73, 165, 166,
923 249, 44, 81, 250, 59, 60, 61, 23, 24, 32,
924 33, 159, 295, 44, 54, 178, 295, 173, 160, 185,
925 186, 56, 199, 174, 58, 44, 146, 163, 228, 6,
926 7, 84, 44, 85, 217, 57, 223, 256, 168, 169,
927 86, 232, 226, 121, -75, 126, 67, 126, 217, 70,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000928 246, 211, 212, 213, 59, 60, 61, 23, 24, 170,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000929 214, 273, 255, 171, 220, 108, 298, 217, 74, -25,
930 215, 70, 217, 179, 180, 44, 76, 44, 237, 238,
931 239, 240, 49, 259, 260, 233, 234, 108, 108, 108,
932 108, 108, 108, 108, 108, 108, 108, 108, 261, 302,
933 83, 146, 2, 3, 4, 121, 59, 60, 61, 187,
934 188, 217, 264, 124, 126, 274, 235, 236, 241, 242,
935 156, -26, 189, 172, 195, 265, 177, 108, 190, 200,
936 274, 279, 121, 193, 203, 201, 204, 208, 205, 290,
937 217, -116, 221, 209, 44, 225, 248, -164, 268, 299,
938 58, 2, 3, 4, 108, 6, 7, 8, 9, 10,
939 146, 163, 262, 263, -27, 267, 278, 281, 11, 12,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000940 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000941 280, 287, 288, 23, 24, 25, 26, 289, 27, 28,
942 29, 30, 87, 31, 88, 89, 90, 91, 291, 292,
943 92, 93, 293, 146, 146, 294, 231, 146, 146, 303,
944 244, 243, 157, 78, 245, 82, 158, 51, 194, 94,
945 270, 266, 146, 258, 271, 300, 282, 72, 0, 0,
946 95, 96, 0, 97, 0, 0, 0, 0, 146, 0,
947 0, 0, 146, 1, 2, 3, 4, 5, 6, 7,
948 8, 9, 10, 129, 130, 131, 0, 132, 133, 134,
949 135, 11, 12, 13, 14, 15, 16, 17, 18, 19,
950 20, 21, 22, 0, 0, 0, 23, 24, 25, 26,
951 136, 27, 28, 29, 30, 87, 31, 88, 89, 90,
952 91, 0, 0, 92, 93, 0, 0, 0, 0, 0,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000953 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000954 0, 0, 94, 0, 0, 0, 137, 138, 0, 0,
955 0, 0, 139, 95, 96, 0, 97, 1, 2, 3,
956 4, 5, 6, 7, 8, 9, 10, 129, 130, 131,
957 0, 132, 133, 134, 135, 11, 12, 13, 14, 15,
958 16, 17, 18, 19, 20, 21, 22, 0, 0, 0,
959 23, 24, 25, 26, 136, 27, 28, 29, 30, 87,
960 31, 88, 89, 90, 91, 0, 0, 92, 93, 0,
kbr@chromium.org476541f2011-10-27 21:14:51 +0000961 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000962 0, 0, 0, 0, 0, 0, 94, 0, 0, 0,
963 137, 219, 0, 0, 0, 0, 139, 95, 96, 0,
964 97, 1, 2, 3, 4, 5, 6, 7, 8, 9,
965 10, 129, 130, 131, 0, 132, 133, 134, 135, 11,
966 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
967 22, 0, 0, 0, 23, 24, 25, 26, 136, 27,
968 28, 29, 30, 87, 31, 88, 89, 90, 91, 0,
969 0, 92, 93, 0, 0, 0, 0, 0, 0, 0,
kbr@chromium.org476541f2011-10-27 21:14:51 +0000970 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000971 94, 0, 0, 0, 137, 0, 0, 0, 0, 0,
972 139, 95, 96, 0, 97, 1, 2, 3, 4, 5,
973 6, 7, 8, 9, 10, 129, 130, 131, 0, 132,
974 133, 134, 135, 11, 12, 13, 14, 15, 16, 17,
975 18, 19, 20, 21, 22, 0, 0, 0, 23, 24,
976 25, 26, 136, 27, 28, 29, 30, 87, 31, 88,
977 89, 90, 91, 0, 0, 92, 93, 0, 0, 0,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000978 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000979 0, 0, 0, 0, 94, 0, 0, 0, 76, 0,
980 0, 0, 0, 0, 139, 95, 96, 0, 97, 1,
981 2, 3, 4, 5, 6, 7, 8, 9, 10, 129,
982 130, 131, 0, 132, 133, 134, 135, 11, 12, 13,
kbr@chromium.org476541f2011-10-27 21:14:51 +0000983 14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000984 0, 0, 23, 24, 25, 26, 136, 27, 28, 29,
985 30, 87, 31, 88, 89, 90, 91, 0, 0, 92,
986 93, 0, 0, 0, 0, 0, 0, 0, 0, 0,
987 0, 0, 0, 0, 0, 0, 0, 0, 94, 0,
988 0, 0, 0, 0, 0, 0, 0, 0, 139, 95,
989 96, 0, 97, 1, 2, 3, 4, 5, 6, 7,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000990 8, 9, 10, 0, 0, 0, 0, 0, 0, 0,
991 0, 11, 12, 13, 14, 15, 16, 17, 18, 19,
992 20, 21, 22, 0, 0, 0, 23, 24, 25, 26,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000993 0, 27, 28, 29, 30, 87, 31, 88, 89, 90,
994 91, 0, 0, 92, 93, 0, 0, 0, 0, 0,
995 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
996 0, 0, 94, 0, 0, 0, 8, 9, 10, 0,
997 0, 0, 139, 95, 96, 0, 97, 11, 12, 13,
998 14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
999 0, 0, 0, 0, 25, 26, 0, 27, 28, 29,
1000 30, 87, 31, 88, 89, 90, 91, 0, 0, 92,
1001 93, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1002 0, 0, 0, 0, 0, 0, 0, 0, 94, 0,
1003 0, 161, 8, 9, 10, 0, 0, 0, 0, 95,
1004 96, 0, 97, 11, 12, 13, 14, 15, 16, 17,
1005 18, 19, 20, 21, 22, 0, 0, 0, 0, 0,
1006 25, 26, 0, 27, 28, 29, 30, 87, 31, 88,
1007 89, 90, 91, 0, 0, 92, 93, 0, 0, 0,
1008 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1009 0, 0, 0, 0, 94, 0, 0, 0, 8, 9,
1010 10, 0, 0, 0, 206, 95, 96, 0, 97, 11,
1011 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
1012 22, 0, 0, 0, 0, 0, 25, 26, 0, 27,
1013 28, 29, 30, 87, 31, 88, 89, 90, 91, 0,
1014 0, 92, 93, 0, 0, 0, 0, 0, 0, 0,
1015 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1016 94, 0, 0, 222, 8, 9, 10, 0, 0, 0,
1017 0, 95, 96, 0, 97, 11, 12, 13, 14, 15,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001018 16, 17, 18, 19, 20, 21, 22, 0, 0, 0,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00001019 0, 0, 25, 26, 0, 27, 28, 29, 30, 87,
1020 31, 88, 89, 90, 91, 0, 0, 92, 93, 0,
1021 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1022 0, 0, 0, 0, 0, 0, 94, 0, 0, 0,
1023 8, 9, 10, 0, 0, 0, 0, 95, 96, 0,
1024 97, 11, 12, 13, 14, 15, 16, 17, 18, 19,
1025 20, 21, 22, 0, 0, 0, 0, 0, 25, 175,
1026 0, 27, 28, 29, 30, 87, 31, 88, 89, 90,
1027 91, 0, 0, 92, 93, 0, 0, 0, 0, 0,
1028 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1029 0, 0, 94, 2, 3, 4, 0, 0, 0, 8,
1030 9, 10, 0, 95, 96, 0, 97, 0, 0, 0,
1031 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
1032 21, 22, 0, 0, 0, 0, 0, 25, 26, 0,
1033 27, 28, 29, 30, 0, 31, 2, 3, 4, 0,
1034 0, 0, 8, 9, 10, 0, 0, 0, 0, 0,
1035 0, 0, 0, 11, 12, 13, 14, 15, 16, 17,
1036 18, 19, 20, 21, 22, 0, 198, 0, 0, 0,
1037 25, 26, 0, 27, 28, 29, 30, 0, 31, 0,
1038 0, 0, 0, 0, 0, 0, 0, 0, 0, 71,
1039 0, 0, 1, 2, 3, 4, 5, 6, 7, 8,
1040 9, 10, 0, 0, 0, 0, 0, 0, 0, 247,
1041 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
1042 21, 22, 0, 0, 0, 23, 24, 25, 26, 0,
1043 27, 28, 29, 30, 0, 31, 1, 2, 3, 4,
1044 5, 6, 7, 8, 9, 10, 0, 0, 0, 0,
1045 0, 0, 0, 0, 11, 12, 13, 14, 15, 16,
1046 17, 18, 19, 20, 21, 22, 0, 0, 0, 23,
1047 24, 25, 26, 0, 27, 28, 29, 30, 0, 31,
1048 2, 3, 4, 0, 0, 0, 8, 9, 10, 0,
1049 0, 0, 0, 0, 0, 0, 0, 11, 12, 13,
1050 14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
1051 0, 0, 0, 0, 25, 26, 0, 27, 28, 29,
1052 30, 0, 31, 8, 9, 10, 0, 0, 0, 0,
1053 0, 0, 0, 0, 11, 12, 13, 14, 15, 16,
1054 17, 18, 19, 20, 21, 22, 0, 0, 0, 0,
1055 0, 25, 26, 0, 27, 28, 29, 30, 229, 31,
1056 8, 9, 10, 230, 0, 0, 0, 0, 0, 0,
1057 0, 11, 12, 13, 14, 15, 16, 17, 18, 19,
1058 20, 21, 22, 0, 0, 0, 0, 0, 25, 26,
1059 0, 27, 28, 29, 30, 0, 31
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001060};
1061
1062static const yytype_int16 yycheck[] =
1063{
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00001064 0, 55, 94, 86, 70, 127, 45, 151, 273, 60,
1065 40, 36, 85, 0, 0, 160, 257, 37, 79, 85,
1066 84, 82, 86, 106, 3, 45, 70, 253, 293, 8,
1067 9, 272, 57, 63, 55, 56, 79, 76, 42, 82,
1068 40, 85, 42, 135, 95, 75, 46, 51, 92, 93,
1069 79, 51, 82, 82, 33, 34, 35, 36, 37, 46,
1070 46, 74, 288, 63, 82, 109, 292, 73, 81, 90,
1071 91, 73, 194, 79, 3, 75, 76, 160, 170, 8,
1072 9, 72, 82, 74, 79, 79, 159, 82, 53, 54,
1073 81, 174, 73, 159, 73, 125, 45, 127, 79, 74,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001074 192, 62, 63, 64, 33, 34, 35, 36, 37, 74,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00001075 71, 73, 204, 78, 258, 159, 73, 79, 76, 72,
1076 81, 74, 79, 87, 88, 125, 76, 127, 183, 184,
1077 185, 186, 37, 216, 217, 179, 180, 181, 182, 183,
1078 184, 185, 186, 187, 188, 189, 190, 191, 221, 294,
1079 45, 151, 4, 5, 6, 221, 33, 34, 35, 57,
1080 58, 79, 80, 82, 194, 257, 181, 182, 187, 188,
1081 45, 72, 59, 73, 45, 248, 72, 221, 61, 82,
1082 272, 264, 248, 75, 72, 82, 72, 72, 82, 281,
1083 79, 72, 74, 77, 194, 75, 74, 76, 252, 291,
1084 3, 4, 5, 6, 248, 8, 9, 10, 11, 12,
1085 210, 294, 75, 75, 72, 40, 75, 72, 21, 22,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001086 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00001087 75, 45, 73, 36, 37, 38, 39, 77, 41, 42,
1088 43, 44, 45, 46, 47, 48, 49, 50, 82, 73,
1089 53, 54, 16, 253, 254, 81, 171, 257, 258, 82,
1090 190, 189, 82, 57, 191, 64, 82, 5, 125, 72,
1091 254, 249, 272, 210, 254, 292, 272, 46, -1, -1,
1092 83, 84, -1, 86, -1, -1, -1, -1, 288, -1,
1093 -1, -1, 292, 3, 4, 5, 6, 7, 8, 9,
1094 10, 11, 12, 13, 14, 15, -1, 17, 18, 19,
1095 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
1096 30, 31, 32, -1, -1, -1, 36, 37, 38, 39,
1097 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
1098 50, -1, -1, 53, 54, -1, -1, -1, -1, -1,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001099 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00001100 -1, -1, 72, -1, -1, -1, 76, 77, -1, -1,
1101 -1, -1, 82, 83, 84, -1, 86, 3, 4, 5,
1102 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
1103 -1, 17, 18, 19, 20, 21, 22, 23, 24, 25,
1104 26, 27, 28, 29, 30, 31, 32, -1, -1, -1,
1105 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
1106 46, 47, 48, 49, 50, -1, -1, 53, 54, -1,
zmo@google.com09c323a2011-08-12 18:22:25 +00001107 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00001108 -1, -1, -1, -1, -1, -1, 72, -1, -1, -1,
1109 76, 77, -1, -1, -1, -1, 82, 83, 84, -1,
1110 86, 3, 4, 5, 6, 7, 8, 9, 10, 11,
1111 12, 13, 14, 15, -1, 17, 18, 19, 20, 21,
1112 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
1113 32, -1, -1, -1, 36, 37, 38, 39, 40, 41,
1114 42, 43, 44, 45, 46, 47, 48, 49, 50, -1,
1115 -1, 53, 54, -1, -1, -1, -1, -1, -1, -1,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001116 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00001117 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
1118 82, 83, 84, -1, 86, 3, 4, 5, 6, 7,
1119 8, 9, 10, 11, 12, 13, 14, 15, -1, 17,
1120 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
1121 28, 29, 30, 31, 32, -1, -1, -1, 36, 37,
1122 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
1123 48, 49, 50, -1, -1, 53, 54, -1, -1, -1,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001124 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00001125 -1, -1, -1, -1, 72, -1, -1, -1, 76, -1,
1126 -1, -1, -1, -1, 82, 83, 84, -1, 86, 3,
1127 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
1128 14, 15, -1, 17, 18, 19, 20, 21, 22, 23,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001129 24, 25, 26, 27, 28, 29, 30, 31, 32, -1,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00001130 -1, -1, 36, 37, 38, 39, 40, 41, 42, 43,
1131 44, 45, 46, 47, 48, 49, 50, -1, -1, 53,
1132 54, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1133 -1, -1, -1, -1, -1, -1, -1, -1, 72, -1,
1134 -1, -1, -1, -1, -1, -1, -1, -1, 82, 83,
1135 84, -1, 86, 3, 4, 5, 6, 7, 8, 9,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001136 10, 11, 12, -1, -1, -1, -1, -1, -1, -1,
1137 -1, 21, 22, 23, 24, 25, 26, 27, 28, 29,
1138 30, 31, 32, -1, -1, -1, 36, 37, 38, 39,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00001139 -1, 41, 42, 43, 44, 45, 46, 47, 48, 49,
1140 50, -1, -1, 53, 54, -1, -1, -1, -1, -1,
1141 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1142 -1, -1, 72, -1, -1, -1, 10, 11, 12, -1,
1143 -1, -1, 82, 83, 84, -1, 86, 21, 22, 23,
1144 24, 25, 26, 27, 28, 29, 30, 31, 32, -1,
1145 -1, -1, -1, -1, 38, 39, -1, 41, 42, 43,
1146 44, 45, 46, 47, 48, 49, 50, -1, -1, 53,
1147 54, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1148 -1, -1, -1, -1, -1, -1, -1, -1, 72, -1,
1149 -1, 75, 10, 11, 12, -1, -1, -1, -1, 83,
1150 84, -1, 86, 21, 22, 23, 24, 25, 26, 27,
1151 28, 29, 30, 31, 32, -1, -1, -1, -1, -1,
1152 38, 39, -1, 41, 42, 43, 44, 45, 46, 47,
1153 48, 49, 50, -1, -1, 53, 54, -1, -1, -1,
1154 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1155 -1, -1, -1, -1, 72, -1, -1, -1, 10, 11,
1156 12, -1, -1, -1, 82, 83, 84, -1, 86, 21,
1157 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
1158 32, -1, -1, -1, -1, -1, 38, 39, -1, 41,
1159 42, 43, 44, 45, 46, 47, 48, 49, 50, -1,
1160 -1, 53, 54, -1, -1, -1, -1, -1, -1, -1,
1161 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1162 72, -1, -1, 75, 10, 11, 12, -1, -1, -1,
1163 -1, 83, 84, -1, 86, 21, 22, 23, 24, 25,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001164 26, 27, 28, 29, 30, 31, 32, -1, -1, -1,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00001165 -1, -1, 38, 39, -1, 41, 42, 43, 44, 45,
1166 46, 47, 48, 49, 50, -1, -1, 53, 54, -1,
1167 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1168 -1, -1, -1, -1, -1, -1, 72, -1, -1, -1,
1169 10, 11, 12, -1, -1, -1, -1, 83, 84, -1,
1170 86, 21, 22, 23, 24, 25, 26, 27, 28, 29,
1171 30, 31, 32, -1, -1, -1, -1, -1, 38, 39,
1172 -1, 41, 42, 43, 44, 45, 46, 47, 48, 49,
1173 50, -1, -1, 53, 54, -1, -1, -1, -1, -1,
1174 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1175 -1, -1, 72, 4, 5, 6, -1, -1, -1, 10,
1176 11, 12, -1, 83, 84, -1, 86, -1, -1, -1,
1177 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
1178 31, 32, -1, -1, -1, -1, -1, 38, 39, -1,
1179 41, 42, 43, 44, -1, 46, 4, 5, 6, -1,
1180 -1, -1, 10, 11, 12, -1, -1, -1, -1, -1,
1181 -1, -1, -1, 21, 22, 23, 24, 25, 26, 27,
1182 28, 29, 30, 31, 32, -1, 77, -1, -1, -1,
1183 38, 39, -1, 41, 42, 43, 44, -1, 46, -1,
1184 -1, -1, -1, -1, -1, -1, -1, -1, -1, 0,
1185 -1, -1, 3, 4, 5, 6, 7, 8, 9, 10,
1186 11, 12, -1, -1, -1, -1, -1, -1, -1, 77,
1187 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
1188 31, 32, -1, -1, -1, 36, 37, 38, 39, -1,
1189 41, 42, 43, 44, -1, 46, 3, 4, 5, 6,
1190 7, 8, 9, 10, 11, 12, -1, -1, -1, -1,
1191 -1, -1, -1, -1, 21, 22, 23, 24, 25, 26,
1192 27, 28, 29, 30, 31, 32, -1, -1, -1, 36,
1193 37, 38, 39, -1, 41, 42, 43, 44, -1, 46,
1194 4, 5, 6, -1, -1, -1, 10, 11, 12, -1,
1195 -1, -1, -1, -1, -1, -1, -1, 21, 22, 23,
1196 24, 25, 26, 27, 28, 29, 30, 31, 32, -1,
1197 -1, -1, -1, -1, 38, 39, -1, 41, 42, 43,
1198 44, -1, 46, 10, 11, 12, -1, -1, -1, -1,
1199 -1, -1, -1, -1, 21, 22, 23, 24, 25, 26,
1200 27, 28, 29, 30, 31, 32, -1, -1, -1, -1,
1201 -1, 38, 39, -1, 41, 42, 43, 44, 45, 46,
1202 10, 11, 12, 50, -1, -1, -1, -1, -1, -1,
1203 -1, 21, 22, 23, 24, 25, 26, 27, 28, 29,
1204 30, 31, 32, -1, -1, -1, -1, -1, 38, 39,
1205 -1, 41, 42, 43, 44, -1, 46
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001206};
1207
1208/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
1209 symbol of state STATE-NUM. */
1210static const yytype_uint8 yystos[] =
1211{
1212 0, 3, 4, 5, 6, 7, 8, 9, 10, 11,
1213 12, 21, 22, 23, 24, 25, 26, 27, 28, 29,
zmo@google.com09c323a2011-08-12 18:22:25 +00001214 30, 31, 32, 36, 37, 38, 39, 41, 42, 43,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001215 44, 46, 126, 127, 128, 129, 130, 135, 136, 137,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00001216 138, 139, 140, 141, 142, 143, 175, 176, 177, 37,
1217 45, 140, 45, 76, 82, 178, 73, 79, 3, 33,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001218 34, 35, 132, 133, 138, 79, 82, 45, 139, 141,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00001219 74, 0, 176, 141, 76, 145, 76, 161, 132, 131,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001220 134, 139, 133, 45, 72, 74, 81, 45, 47, 48,
1221 49, 50, 53, 54, 72, 83, 84, 86, 97, 98,
1222 99, 101, 102, 103, 104, 105, 106, 107, 108, 109,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001223 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001224 120, 121, 125, 142, 82, 144, 139, 146, 147, 13,
1225 14, 15, 17, 18, 19, 20, 40, 76, 77, 82,
1226 108, 121, 122, 124, 126, 127, 142, 151, 152, 153,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00001227 154, 162, 163, 164, 167, 174, 45, 131, 134, 74,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001228 81, 75, 125, 122, 150, 108, 108, 124, 53, 54,
1229 74, 78, 73, 73, 79, 39, 122, 72, 108, 87,
1230 88, 84, 86, 55, 56, 90, 91, 57, 58, 59,
1231 61, 60, 95, 75, 146, 45, 148, 149, 77, 147,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00001232 82, 82, 169, 72, 72, 82, 82, 124, 72, 77,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001233 155, 62, 63, 64, 71, 81, 123, 79, 82, 77,
1234 152, 74, 75, 125, 150, 75, 73, 100, 124, 45,
1235 50, 103, 122, 108, 108, 110, 110, 112, 112, 112,
1236 112, 113, 113, 117, 118, 119, 124, 77, 74, 79,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00001237 82, 158, 159, 160, 170, 124, 82, 168, 162, 122,
1238 122, 125, 75, 75, 80, 125, 149, 40, 161, 153,
1239 151, 163, 171, 73, 124, 137, 166, 156, 75, 122,
1240 75, 72, 166, 172, 173, 158, 165, 45, 73, 77,
1241 124, 82, 73, 16, 81, 153, 157, 161, 73, 124,
1242 157, 158, 150, 82
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001243};
1244
1245#define yyerrok (yyerrstatus = 0)
1246#define yyclearin (yychar = YYEMPTY)
1247#define YYEMPTY (-2)
1248#define YYEOF 0
1249
1250#define YYACCEPT goto yyacceptlab
1251#define YYABORT goto yyabortlab
1252#define YYERROR goto yyerrorlab
1253
1254
1255/* Like YYERROR except do call yyerror. This remains here temporarily
1256 to ease the transition to the new meaning of YYERROR, for GCC.
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001257 Once GCC version 2 has supplanted version 1, this can go. However,
1258 YYFAIL appears to be in use. Nevertheless, it is formally deprecated
1259 in Bison 2.4.2's NEWS entry, where a plan to phase it out is
1260 discussed. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001261
1262#define YYFAIL goto yyerrlab
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001263#if defined YYFAIL
1264 /* This is here to suppress warnings from the GCC cpp's
1265 -Wunused-macros. Normally we don't worry about that warning, but
1266 some users do, and we want to make it easy for users to remove
1267 YYFAIL uses, which will produce warnings from Bison 2.5. */
1268#endif
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001269
1270#define YYRECOVERING() (!!yyerrstatus)
1271
1272#define YYBACKUP(Token, Value) \
1273do \
1274 if (yychar == YYEMPTY && yylen == 1) \
1275 { \
1276 yychar = (Token); \
1277 yylval = (Value); \
1278 yytoken = YYTRANSLATE (yychar); \
1279 YYPOPSTACK (1); \
1280 goto yybackup; \
1281 } \
1282 else \
1283 { \
1284 yyerror (context, YY_("syntax error: cannot back up")); \
1285 YYERROR; \
1286 } \
1287while (YYID (0))
1288
1289
1290#define YYTERROR 1
1291#define YYERRCODE 256
1292
1293
1294/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
1295 If N is 0, then set CURRENT to the empty location which ends
1296 the previous symbol: RHS[0] (always defined). */
1297
1298#define YYRHSLOC(Rhs, K) ((Rhs)[K])
1299#ifndef YYLLOC_DEFAULT
1300# define YYLLOC_DEFAULT(Current, Rhs, N) \
1301 do \
1302 if (YYID (N)) \
1303 { \
1304 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
1305 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
1306 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
1307 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
1308 } \
1309 else \
1310 { \
1311 (Current).first_line = (Current).last_line = \
1312 YYRHSLOC (Rhs, 0).last_line; \
1313 (Current).first_column = (Current).last_column = \
1314 YYRHSLOC (Rhs, 0).last_column; \
1315 } \
1316 while (YYID (0))
1317#endif
1318
1319
1320/* YY_LOCATION_PRINT -- Print the location on the stream.
1321 This macro was not mandated originally: define only if we know
1322 we won't break user code: when these are the locations we know. */
1323
1324#ifndef YY_LOCATION_PRINT
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001325# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001326# define YY_LOCATION_PRINT(File, Loc) \
1327 fprintf (File, "%d.%d-%d.%d", \
1328 (Loc).first_line, (Loc).first_column, \
1329 (Loc).last_line, (Loc).last_column)
1330# else
1331# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1332# endif
1333#endif
1334
1335
1336/* YYLEX -- calling `yylex' with the right arguments. */
1337
1338#ifdef YYLEX_PARAM
1339# define YYLEX yylex (&yylval, YYLEX_PARAM)
1340#else
1341# define YYLEX yylex (&yylval)
1342#endif
1343
1344/* Enable debugging if requested. */
1345#if YYDEBUG
1346
1347# ifndef YYFPRINTF
1348# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1349# define YYFPRINTF fprintf
1350# endif
1351
1352# define YYDPRINTF(Args) \
1353do { \
1354 if (yydebug) \
1355 YYFPRINTF Args; \
1356} while (YYID (0))
1357
1358# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
1359do { \
1360 if (yydebug) \
1361 { \
1362 YYFPRINTF (stderr, "%s ", Title); \
1363 yy_symbol_print (stderr, \
1364 Type, Value, context); \
1365 YYFPRINTF (stderr, "\n"); \
1366 } \
1367} while (YYID (0))
1368
1369
1370/*--------------------------------.
1371| Print this symbol on YYOUTPUT. |
1372`--------------------------------*/
1373
1374/*ARGSUSED*/
1375#if (defined __STDC__ || defined __C99__FUNC__ \
1376 || defined __cplusplus || defined _MSC_VER)
1377static void
1378yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, TParseContext* context)
1379#else
1380static void
1381yy_symbol_value_print (yyoutput, yytype, yyvaluep, context)
1382 FILE *yyoutput;
1383 int yytype;
1384 YYSTYPE const * const yyvaluep;
1385 TParseContext* context;
1386#endif
1387{
1388 if (!yyvaluep)
1389 return;
1390 YYUSE (context);
1391# ifdef YYPRINT
1392 if (yytype < YYNTOKENS)
1393 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1394# else
1395 YYUSE (yyoutput);
1396# endif
1397 switch (yytype)
1398 {
1399 default:
1400 break;
1401 }
1402}
1403
1404
1405/*--------------------------------.
1406| Print this symbol on YYOUTPUT. |
1407`--------------------------------*/
1408
1409#if (defined __STDC__ || defined __C99__FUNC__ \
1410 || defined __cplusplus || defined _MSC_VER)
1411static void
1412yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, TParseContext* context)
1413#else
1414static void
1415yy_symbol_print (yyoutput, yytype, yyvaluep, context)
1416 FILE *yyoutput;
1417 int yytype;
1418 YYSTYPE const * const yyvaluep;
1419 TParseContext* context;
1420#endif
1421{
1422 if (yytype < YYNTOKENS)
1423 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1424 else
1425 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1426
1427 yy_symbol_value_print (yyoutput, yytype, yyvaluep, context);
1428 YYFPRINTF (yyoutput, ")");
1429}
1430
1431/*------------------------------------------------------------------.
1432| yy_stack_print -- Print the state stack from its BOTTOM up to its |
1433| TOP (included). |
1434`------------------------------------------------------------------*/
1435
1436#if (defined __STDC__ || defined __C99__FUNC__ \
1437 || defined __cplusplus || defined _MSC_VER)
1438static void
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001439yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001440#else
1441static void
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001442yy_stack_print (yybottom, yytop)
1443 yytype_int16 *yybottom;
1444 yytype_int16 *yytop;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001445#endif
1446{
1447 YYFPRINTF (stderr, "Stack now");
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001448 for (; yybottom <= yytop; yybottom++)
1449 {
1450 int yybot = *yybottom;
1451 YYFPRINTF (stderr, " %d", yybot);
1452 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001453 YYFPRINTF (stderr, "\n");
1454}
1455
1456# define YY_STACK_PRINT(Bottom, Top) \
1457do { \
1458 if (yydebug) \
1459 yy_stack_print ((Bottom), (Top)); \
1460} while (YYID (0))
1461
1462
1463/*------------------------------------------------.
1464| Report that the YYRULE is going to be reduced. |
1465`------------------------------------------------*/
1466
1467#if (defined __STDC__ || defined __C99__FUNC__ \
1468 || defined __cplusplus || defined _MSC_VER)
1469static void
1470yy_reduce_print (YYSTYPE *yyvsp, int yyrule, TParseContext* context)
1471#else
1472static void
1473yy_reduce_print (yyvsp, yyrule, context)
1474 YYSTYPE *yyvsp;
1475 int yyrule;
1476 TParseContext* context;
1477#endif
1478{
1479 int yynrhs = yyr2[yyrule];
1480 int yyi;
1481 unsigned long int yylno = yyrline[yyrule];
1482 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1483 yyrule - 1, yylno);
1484 /* The symbols being reduced. */
1485 for (yyi = 0; yyi < yynrhs; yyi++)
1486 {
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001487 YYFPRINTF (stderr, " $%d = ", yyi + 1);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001488 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1489 &(yyvsp[(yyi + 1) - (yynrhs)])
1490 , context);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001491 YYFPRINTF (stderr, "\n");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001492 }
1493}
1494
1495# define YY_REDUCE_PRINT(Rule) \
1496do { \
1497 if (yydebug) \
1498 yy_reduce_print (yyvsp, Rule, context); \
1499} while (YYID (0))
1500
1501/* Nonzero means print parse trace. It is left uninitialized so that
1502 multiple parsers can coexist. */
1503int yydebug;
1504#else /* !YYDEBUG */
1505# define YYDPRINTF(Args)
1506# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1507# define YY_STACK_PRINT(Bottom, Top)
1508# define YY_REDUCE_PRINT(Rule)
1509#endif /* !YYDEBUG */
1510
1511
1512/* YYINITDEPTH -- initial size of the parser's stacks. */
1513#ifndef YYINITDEPTH
1514# define YYINITDEPTH 200
1515#endif
1516
1517/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1518 if the built-in stack extension method is used).
1519
1520 Do not make this value too large; the results are undefined if
1521 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1522 evaluated with infinite-precision integer arithmetic. */
1523
1524#ifndef YYMAXDEPTH
1525# define YYMAXDEPTH 10000
1526#endif
1527
1528
1529
1530#if YYERROR_VERBOSE
1531
1532# ifndef yystrlen
1533# if defined __GLIBC__ && defined _STRING_H
1534# define yystrlen strlen
1535# else
1536/* Return the length of YYSTR. */
1537#if (defined __STDC__ || defined __C99__FUNC__ \
1538 || defined __cplusplus || defined _MSC_VER)
1539static YYSIZE_T
1540yystrlen (const char *yystr)
1541#else
1542static YYSIZE_T
1543yystrlen (yystr)
1544 const char *yystr;
1545#endif
1546{
1547 YYSIZE_T yylen;
1548 for (yylen = 0; yystr[yylen]; yylen++)
1549 continue;
1550 return yylen;
1551}
1552# endif
1553# endif
1554
1555# ifndef yystpcpy
1556# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1557# define yystpcpy stpcpy
1558# else
1559/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1560 YYDEST. */
1561#if (defined __STDC__ || defined __C99__FUNC__ \
1562 || defined __cplusplus || defined _MSC_VER)
1563static char *
1564yystpcpy (char *yydest, const char *yysrc)
1565#else
1566static char *
1567yystpcpy (yydest, yysrc)
1568 char *yydest;
1569 const char *yysrc;
1570#endif
1571{
1572 char *yyd = yydest;
1573 const char *yys = yysrc;
1574
1575 while ((*yyd++ = *yys++) != '\0')
1576 continue;
1577
1578 return yyd - 1;
1579}
1580# endif
1581# endif
1582
1583# ifndef yytnamerr
1584/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1585 quotes and backslashes, so that it's suitable for yyerror. The
1586 heuristic is that double-quoting is unnecessary unless the string
1587 contains an apostrophe, a comma, or backslash (other than
1588 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1589 null, do not copy; instead, return the length of what the result
1590 would have been. */
1591static YYSIZE_T
1592yytnamerr (char *yyres, const char *yystr)
1593{
1594 if (*yystr == '"')
1595 {
1596 YYSIZE_T yyn = 0;
1597 char const *yyp = yystr;
1598
1599 for (;;)
1600 switch (*++yyp)
1601 {
1602 case '\'':
1603 case ',':
1604 goto do_not_strip_quotes;
1605
1606 case '\\':
1607 if (*++yyp != '\\')
1608 goto do_not_strip_quotes;
1609 /* Fall through. */
1610 default:
1611 if (yyres)
1612 yyres[yyn] = *yyp;
1613 yyn++;
1614 break;
1615
1616 case '"':
1617 if (yyres)
1618 yyres[yyn] = '\0';
1619 return yyn;
1620 }
1621 do_not_strip_quotes: ;
1622 }
1623
1624 if (! yyres)
1625 return yystrlen (yystr);
1626
1627 return yystpcpy (yyres, yystr) - yyres;
1628}
1629# endif
1630
1631/* Copy into YYRESULT an error message about the unexpected token
1632 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1633 including the terminating null byte. If YYRESULT is null, do not
1634 copy anything; just return the number of bytes that would be
1635 copied. As a special case, return 0 if an ordinary "syntax error"
1636 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1637 size calculation. */
1638static YYSIZE_T
1639yysyntax_error (char *yyresult, int yystate, int yychar)
1640{
1641 int yyn = yypact[yystate];
1642
1643 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1644 return 0;
1645 else
1646 {
1647 int yytype = YYTRANSLATE (yychar);
1648 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1649 YYSIZE_T yysize = yysize0;
1650 YYSIZE_T yysize1;
1651 int yysize_overflow = 0;
1652 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1653 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1654 int yyx;
1655
1656# if 0
1657 /* This is so xgettext sees the translatable formats that are
1658 constructed on the fly. */
1659 YY_("syntax error, unexpected %s");
1660 YY_("syntax error, unexpected %s, expecting %s");
1661 YY_("syntax error, unexpected %s, expecting %s or %s");
1662 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1663 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1664# endif
1665 char *yyfmt;
1666 char const *yyf;
1667 static char const yyunexpected[] = "syntax error, unexpected %s";
1668 static char const yyexpecting[] = ", expecting %s";
1669 static char const yyor[] = " or %s";
1670 char yyformat[sizeof yyunexpected
1671 + sizeof yyexpecting - 1
1672 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1673 * (sizeof yyor - 1))];
1674 char const *yyprefix = yyexpecting;
1675
1676 /* Start YYX at -YYN if negative to avoid negative indexes in
1677 YYCHECK. */
1678 int yyxbegin = yyn < 0 ? -yyn : 0;
1679
1680 /* Stay within bounds of both yycheck and yytname. */
1681 int yychecklim = YYLAST - yyn + 1;
1682 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1683 int yycount = 1;
1684
1685 yyarg[0] = yytname[yytype];
1686 yyfmt = yystpcpy (yyformat, yyunexpected);
1687
1688 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1689 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1690 {
1691 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1692 {
1693 yycount = 1;
1694 yysize = yysize0;
1695 yyformat[sizeof yyunexpected - 1] = '\0';
1696 break;
1697 }
1698 yyarg[yycount++] = yytname[yyx];
1699 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1700 yysize_overflow |= (yysize1 < yysize);
1701 yysize = yysize1;
1702 yyfmt = yystpcpy (yyfmt, yyprefix);
1703 yyprefix = yyor;
1704 }
1705
1706 yyf = YY_(yyformat);
1707 yysize1 = yysize + yystrlen (yyf);
1708 yysize_overflow |= (yysize1 < yysize);
1709 yysize = yysize1;
1710
1711 if (yysize_overflow)
1712 return YYSIZE_MAXIMUM;
1713
1714 if (yyresult)
1715 {
1716 /* Avoid sprintf, as that infringes on the user's name space.
1717 Don't have undefined behavior even if the translation
1718 produced a string with the wrong number of "%s"s. */
1719 char *yyp = yyresult;
1720 int yyi = 0;
1721 while ((*yyp = *yyf) != '\0')
1722 {
1723 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1724 {
1725 yyp += yytnamerr (yyp, yyarg[yyi++]);
1726 yyf += 2;
1727 }
1728 else
1729 {
1730 yyp++;
1731 yyf++;
1732 }
1733 }
1734 }
1735 return yysize;
1736 }
1737}
1738#endif /* YYERROR_VERBOSE */
1739
1740
1741/*-----------------------------------------------.
1742| Release the memory associated to this symbol. |
1743`-----------------------------------------------*/
1744
1745/*ARGSUSED*/
1746#if (defined __STDC__ || defined __C99__FUNC__ \
1747 || defined __cplusplus || defined _MSC_VER)
1748static void
1749yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, TParseContext* context)
1750#else
1751static void
1752yydestruct (yymsg, yytype, yyvaluep, context)
1753 const char *yymsg;
1754 int yytype;
1755 YYSTYPE *yyvaluep;
1756 TParseContext* context;
1757#endif
1758{
1759 YYUSE (yyvaluep);
1760 YYUSE (context);
1761
1762 if (!yymsg)
1763 yymsg = "Deleting";
1764 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1765
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001766 switch (yytype)
1767 {
1768
1769 default:
1770 break;
1771 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001772}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001773
1774/* Prevent warnings from -Wmissing-prototypes. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001775#ifdef YYPARSE_PARAM
1776#if defined __STDC__ || defined __cplusplus
1777int yyparse (void *YYPARSE_PARAM);
1778#else
1779int yyparse ();
1780#endif
1781#else /* ! YYPARSE_PARAM */
1782#if defined __STDC__ || defined __cplusplus
1783int yyparse (TParseContext* context);
1784#else
1785int yyparse ();
1786#endif
1787#endif /* ! YYPARSE_PARAM */
1788
1789
1790
1791
1792
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001793/*-------------------------.
1794| yyparse or yypush_parse. |
1795`-------------------------*/
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001796
1797#ifdef YYPARSE_PARAM
1798#if (defined __STDC__ || defined __C99__FUNC__ \
1799 || defined __cplusplus || defined _MSC_VER)
1800int
1801yyparse (void *YYPARSE_PARAM)
1802#else
1803int
1804yyparse (YYPARSE_PARAM)
1805 void *YYPARSE_PARAM;
1806#endif
1807#else /* ! YYPARSE_PARAM */
1808#if (defined __STDC__ || defined __C99__FUNC__ \
1809 || defined __cplusplus || defined _MSC_VER)
1810int
1811yyparse (TParseContext* context)
1812#else
1813int
1814yyparse (context)
1815 TParseContext* context;
1816#endif
1817#endif
1818{
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001819/* The lookahead symbol. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001820int yychar;
1821
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001822/* The semantic value of the lookahead symbol. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001823YYSTYPE yylval;
1824
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001825 /* Number of syntax errors so far. */
1826 int yynerrs;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001827
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001828 int yystate;
1829 /* Number of tokens to shift before error messages enabled. */
1830 int yyerrstatus;
1831
1832 /* The stacks and their tools:
1833 `yyss': related to states.
1834 `yyvs': related to semantic values.
1835
1836 Refer to the stacks thru separate pointers, to allow yyoverflow
1837 to reallocate them elsewhere. */
1838
1839 /* The state stack. */
1840 yytype_int16 yyssa[YYINITDEPTH];
1841 yytype_int16 *yyss;
1842 yytype_int16 *yyssp;
1843
1844 /* The semantic value stack. */
1845 YYSTYPE yyvsa[YYINITDEPTH];
1846 YYSTYPE *yyvs;
1847 YYSTYPE *yyvsp;
1848
1849 YYSIZE_T yystacksize;
1850
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001851 int yyn;
1852 int yyresult;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001853 /* Lookahead token as an internal (translated) token number. */
1854 int yytoken;
1855 /* The variables used to return semantic value and location from the
1856 action routines. */
1857 YYSTYPE yyval;
1858
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001859#if YYERROR_VERBOSE
1860 /* Buffer for error messages, and its allocated size. */
1861 char yymsgbuf[128];
1862 char *yymsg = yymsgbuf;
1863 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1864#endif
1865
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001866#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1867
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001868 /* The number of symbols on the RHS of the reduced rule.
1869 Keep to zero when no symbol should be popped. */
1870 int yylen = 0;
1871
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001872 yytoken = 0;
1873 yyss = yyssa;
1874 yyvs = yyvsa;
1875 yystacksize = YYINITDEPTH;
1876
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001877 YYDPRINTF ((stderr, "Starting parse\n"));
1878
1879 yystate = 0;
1880 yyerrstatus = 0;
1881 yynerrs = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001882 yychar = YYEMPTY; /* Cause a token to be read. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001883
1884 /* Initialize stack pointers.
1885 Waste one element of value and location stack
1886 so that they stay on the same level as the state stack.
1887 The wasted elements are never initialized. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001888 yyssp = yyss;
1889 yyvsp = yyvs;
1890
1891 goto yysetstate;
1892
1893/*------------------------------------------------------------.
1894| yynewstate -- Push a new state, which is found in yystate. |
1895`------------------------------------------------------------*/
1896 yynewstate:
1897 /* In all cases, when you get here, the value and location stacks
1898 have just been pushed. So pushing a state here evens the stacks. */
1899 yyssp++;
1900
1901 yysetstate:
1902 *yyssp = yystate;
1903
1904 if (yyss + yystacksize - 1 <= yyssp)
1905 {
1906 /* Get the current used size of the three stacks, in elements. */
1907 YYSIZE_T yysize = yyssp - yyss + 1;
1908
1909#ifdef yyoverflow
1910 {
1911 /* Give user a chance to reallocate the stack. Use copies of
1912 these so that the &'s don't force the real ones into
1913 memory. */
1914 YYSTYPE *yyvs1 = yyvs;
1915 yytype_int16 *yyss1 = yyss;
1916
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001917 /* Each stack pointer address is followed by the size of the
1918 data in use in that stack, in bytes. This used to be a
1919 conditional around just the two extra args, but that might
1920 be undefined if yyoverflow is a macro. */
1921 yyoverflow (YY_("memory exhausted"),
1922 &yyss1, yysize * sizeof (*yyssp),
1923 &yyvs1, yysize * sizeof (*yyvsp),
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001924 &yystacksize);
1925
1926 yyss = yyss1;
1927 yyvs = yyvs1;
1928 }
1929#else /* no yyoverflow */
1930# ifndef YYSTACK_RELOCATE
1931 goto yyexhaustedlab;
1932# else
1933 /* Extend the stack our own way. */
1934 if (YYMAXDEPTH <= yystacksize)
1935 goto yyexhaustedlab;
1936 yystacksize *= 2;
1937 if (YYMAXDEPTH < yystacksize)
1938 yystacksize = YYMAXDEPTH;
1939
1940 {
1941 yytype_int16 *yyss1 = yyss;
1942 union yyalloc *yyptr =
1943 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1944 if (! yyptr)
1945 goto yyexhaustedlab;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001946 YYSTACK_RELOCATE (yyss_alloc, yyss);
1947 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001948# undef YYSTACK_RELOCATE
1949 if (yyss1 != yyssa)
1950 YYSTACK_FREE (yyss1);
1951 }
1952# endif
1953#endif /* no yyoverflow */
1954
1955 yyssp = yyss + yysize - 1;
1956 yyvsp = yyvs + yysize - 1;
1957
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001958 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1959 (unsigned long int) yystacksize));
1960
1961 if (yyss + yystacksize - 1 <= yyssp)
1962 YYABORT;
1963 }
1964
1965 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1966
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001967 if (yystate == YYFINAL)
1968 YYACCEPT;
1969
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001970 goto yybackup;
1971
1972/*-----------.
1973| yybackup. |
1974`-----------*/
1975yybackup:
1976
1977 /* Do appropriate processing given the current state. Read a
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001978 lookahead token if we need one and don't already have one. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001979
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001980 /* First try to decide what to do without reference to lookahead token. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001981 yyn = yypact[yystate];
1982 if (yyn == YYPACT_NINF)
1983 goto yydefault;
1984
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001985 /* Not known => get a lookahead token if don't already have one. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001986
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001987 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001988 if (yychar == YYEMPTY)
1989 {
1990 YYDPRINTF ((stderr, "Reading a token: "));
1991 yychar = YYLEX;
1992 }
1993
1994 if (yychar <= YYEOF)
1995 {
1996 yychar = yytoken = YYEOF;
1997 YYDPRINTF ((stderr, "Now at end of input.\n"));
1998 }
1999 else
2000 {
2001 yytoken = YYTRANSLATE (yychar);
2002 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
2003 }
2004
2005 /* If the proper action on seeing token YYTOKEN is to reduce or to
2006 detect an error, take that action. */
2007 yyn += yytoken;
2008 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
2009 goto yydefault;
2010 yyn = yytable[yyn];
2011 if (yyn <= 0)
2012 {
2013 if (yyn == 0 || yyn == YYTABLE_NINF)
2014 goto yyerrlab;
2015 yyn = -yyn;
2016 goto yyreduce;
2017 }
2018
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002019 /* Count tokens shifted since error; after three, turn off error
2020 status. */
2021 if (yyerrstatus)
2022 yyerrstatus--;
2023
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002024 /* Shift the lookahead token. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002025 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
2026
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002027 /* Discard the shifted token. */
2028 yychar = YYEMPTY;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002029
2030 yystate = yyn;
2031 *++yyvsp = yylval;
2032
2033 goto yynewstate;
2034
2035
2036/*-----------------------------------------------------------.
2037| yydefault -- do the default action for the current state. |
2038`-----------------------------------------------------------*/
2039yydefault:
2040 yyn = yydefact[yystate];
2041 if (yyn == 0)
2042 goto yyerrlab;
2043 goto yyreduce;
2044
2045
2046/*-----------------------------.
2047| yyreduce -- Do a reduction. |
2048`-----------------------------*/
2049yyreduce:
2050 /* yyn is the number of a rule to reduce with. */
2051 yylen = yyr2[yyn];
2052
2053 /* If YYLEN is nonzero, implement the default value of the action:
2054 `$$ = $1'.
2055
2056 Otherwise, the following line sets YYVAL to garbage.
2057 This behavior is undocumented and Bison
2058 users should not rely upon it. Assigning to YYVAL
2059 unconditionally makes the parser a bit smaller, and it avoids a
2060 GCC warning that YYVAL may be used uninitialized. */
2061 yyval = yyvsp[1-yylen];
2062
2063
2064 YY_REDUCE_PRINT (yyn);
2065 switch (yyn)
2066 {
2067 case 2:
2068
2069 {
2070 // The symbol table search was done in the lexical phase
2071 const TSymbol* symbol = (yyvsp[(1) - (1)].lex).symbol;
2072 const TVariable* variable;
2073 if (symbol == 0) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00002074 context->error((yyvsp[(1) - (1)].lex).line, "undeclared identifier", (yyvsp[(1) - (1)].lex).string->c_str());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002075 context->recover();
2076 TType type(EbtFloat, EbpUndefined);
2077 TVariable* fakeVariable = new TVariable((yyvsp[(1) - (1)].lex).string, type);
2078 context->symbolTable.insert(*fakeVariable);
2079 variable = fakeVariable;
2080 } else {
2081 // This identifier can only be a variable type symbol
2082 if (! symbol->isVariable()) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00002083 context->error((yyvsp[(1) - (1)].lex).line, "variable expected", (yyvsp[(1) - (1)].lex).string->c_str());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002084 context->recover();
2085 }
2086 variable = static_cast<const TVariable*>(symbol);
2087 }
2088
2089 // don't delete $1.string, it's used by error recovery, and the pool
2090 // pop will reclaim the memory
2091
2092 if (variable->getType().getQualifier() == EvqConst ) {
2093 ConstantUnion* constArray = variable->getConstPointer();
2094 TType t(variable->getType());
2095 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(constArray, t, (yyvsp[(1) - (1)].lex).line);
2096 } else
2097 (yyval.interm.intermTypedNode) = context->intermediate.addSymbol(variable->getUniqueId(),
2098 variable->getName(),
2099 variable->getType(), (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002100 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002101 break;
2102
2103 case 3:
2104
2105 {
2106 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002107 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002108 break;
2109
2110 case 4:
2111
2112 {
2113 //
2114 // INT_TYPE is only 16-bit plus sign bit for vertex/fragment shaders,
2115 // check for overflow for constants
2116 //
2117 if (abs((yyvsp[(1) - (1)].lex).i) >= (1 << 16)) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00002118 context->error((yyvsp[(1) - (1)].lex).line, " integer constant overflow", "");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002119 context->recover();
2120 }
2121 ConstantUnion *unionArray = new ConstantUnion[1];
2122 unionArray->setIConst((yyvsp[(1) - (1)].lex).i);
2123 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002124 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002125 break;
2126
2127 case 5:
2128
2129 {
2130 ConstantUnion *unionArray = new ConstantUnion[1];
2131 unionArray->setFConst((yyvsp[(1) - (1)].lex).f);
2132 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002133 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002134 break;
2135
2136 case 6:
2137
2138 {
2139 ConstantUnion *unionArray = new ConstantUnion[1];
2140 unionArray->setBConst((yyvsp[(1) - (1)].lex).b);
2141 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002142 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002143 break;
2144
2145 case 7:
2146
2147 {
2148 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (3)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002149 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002150 break;
2151
2152 case 8:
2153
2154 {
2155 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002156 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002157 break;
2158
2159 case 9:
2160
2161 {
2162 if (!(yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isVector()) {
2163 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode())
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00002164 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());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002165 else
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00002166 context->error((yyvsp[(2) - (4)].lex).line, " left of '[' is not of type array, matrix, or vector ", "expression");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002167 context->recover();
2168 }
2169 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst && (yyvsp[(3) - (4)].interm.intermTypedNode)->getQualifier() == EvqConst) {
2170 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) { // constant folding for arrays
2171 (yyval.interm.intermTypedNode) = context->addConstArrayNode((yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2172 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector()) { // constant folding for vectors
2173 TVectorFields fields;
2174 fields.num = 1;
2175 fields.offsets[0] = (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(); // need to do it this way because v.xy sends fields integer array
2176 (yyval.interm.intermTypedNode) = context->addConstVectorNode(fields, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2177 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix()) { // constant folding for matrices
2178 (yyval.interm.intermTypedNode) = context->addConstMatrixNode((yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2179 }
2180 } else {
2181 if ((yyvsp[(3) - (4)].interm.intermTypedNode)->getQualifier() == EvqConst) {
2182 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()->getUnionArrayPointer()->getIConst() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() ) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00002183 std::stringstream extraInfoStream;
2184 extraInfoStream << "field selection out of range '" << (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst() << "'";
2185 std::string extraInfo = extraInfoStream.str();
2186 context->error((yyvsp[(2) - (4)].lex).line, "", "[", extraInfo.c_str());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002187 context->recover();
2188 } else {
2189 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) {
2190 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize() == 0) {
2191 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getMaxArraySize() <= (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst()) {
2192 if (context->arraySetMaxSize((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getTypePointer(), (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), true, (yyvsp[(2) - (4)].lex).line))
2193 context->recover();
2194 } else {
2195 if (context->arraySetMaxSize((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getTypePointer(), 0, false, (yyvsp[(2) - (4)].lex).line))
2196 context->recover();
2197 }
2198 } else if ( (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst() >= (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize()) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00002199 std::stringstream extraInfoStream;
2200 extraInfoStream << "array index out of range '" << (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst() << "'";
2201 std::string extraInfo = extraInfoStream.str();
2202 context->error((yyvsp[(2) - (4)].lex).line, "", "[", extraInfo.c_str());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002203 context->recover();
2204 }
2205 }
2206 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(3) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2207 }
2208 } else {
2209 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize() == 0) {
2210 context->error((yyvsp[(2) - (4)].lex).line, "", "[", "array must be redeclared with a size before being indexed with a variable");
2211 context->recover();
2212 }
2213
2214 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexIndirect, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(3) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2215 }
2216 }
2217 if ((yyval.interm.intermTypedNode) == 0) {
2218 ConstantUnion *unionArray = new ConstantUnion[1];
2219 unionArray->setFConst(0.0f);
2220 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpHigh, EvqConst), (yyvsp[(2) - (4)].lex).line);
2221 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) {
2222 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getStruct())
2223 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getStruct(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getTypeName()));
2224 else
2225 (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()));
2226
2227 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst)
2228 (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConst);
2229 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst)
2230 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqConst, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize()));
2231 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix())
2232 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize()));
2233 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst)
2234 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqConst));
2235 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector())
2236 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary));
2237 else
2238 (yyval.interm.intermTypedNode)->setType((yyvsp[(1) - (4)].interm.intermTypedNode)->getType());
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002239 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002240 break;
2241
2242 case 10:
2243
2244 {
2245 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002246 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002247 break;
2248
2249 case 11:
2250
2251 {
2252 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isArray()) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00002253 context->error((yyvsp[(3) - (3)].lex).line, "cannot apply dot operator to an array", ".");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002254 context->recover();
2255 }
2256
2257 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isVector()) {
2258 TVectorFields fields;
2259 if (! context->parseVectorFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yyvsp[(3) - (3)].lex).line)) {
2260 fields.num = 1;
2261 fields.offsets[0] = 0;
2262 context->recover();
2263 }
2264
2265 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) { // constant folding for vector fields
2266 (yyval.interm.intermTypedNode) = context->addConstVectorNode(fields, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].lex).line);
2267 if ((yyval.interm.intermTypedNode) == 0) {
2268 context->recover();
2269 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2270 }
2271 else
2272 (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()));
2273 } else {
alokp@chromium.orgab8c0262012-08-13 17:36:25 +00002274 TString vectorString = *(yyvsp[(3) - (3)].lex).string;
2275 TIntermTyped* index = context->intermediate.addSwizzle(fields, (yyvsp[(3) - (3)].lex).line);
2276 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpVectorSwizzle, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2277 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (int) vectorString.size()));
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002278 }
2279 } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isMatrix()) {
2280 TMatrixFields fields;
2281 if (! context->parseMatrixFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yyvsp[(3) - (3)].lex).line)) {
2282 fields.wholeRow = false;
2283 fields.wholeCol = false;
2284 fields.row = 0;
2285 fields.col = 0;
2286 context->recover();
2287 }
2288
2289 if (fields.wholeRow || fields.wholeCol) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00002290 context->error((yyvsp[(2) - (3)].lex).line, " non-scalar fields not implemented yet", ".");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002291 context->recover();
2292 ConstantUnion *unionArray = new ConstantUnion[1];
2293 unionArray->setIConst(0);
2294 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line);
2295 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2296 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(),EvqTemporary, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize()));
2297 } else {
2298 ConstantUnion *unionArray = new ConstantUnion[1];
2299 unionArray->setIConst(fields.col * (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize() + fields.row);
2300 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line);
2301 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2302 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision()));
2303 }
2304 } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType() == EbtStruct) {
2305 bool fieldFound = false;
2306 const TTypeList* fields = (yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getStruct();
2307 if (fields == 0) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00002308 context->error((yyvsp[(2) - (3)].lex).line, "structure has no fields", "Internal Error");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002309 context->recover();
2310 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2311 } else {
2312 unsigned int i;
2313 for (i = 0; i < fields->size(); ++i) {
2314 if ((*fields)[i].type->getFieldName() == *(yyvsp[(3) - (3)].lex).string) {
2315 fieldFound = true;
2316 break;
2317 }
2318 }
2319 if (fieldFound) {
2320 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) {
2321 (yyval.interm.intermTypedNode) = context->addConstStruct(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
2322 if ((yyval.interm.intermTypedNode) == 0) {
2323 context->recover();
2324 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2325 }
2326 else {
2327 (yyval.interm.intermTypedNode)->setType(*(*fields)[i].type);
2328 // change the qualifier of the return type, not of the structure field
2329 // as the structure definition is shared between various structures.
2330 (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConst);
2331 }
2332 } else {
2333 ConstantUnion *unionArray = new ConstantUnion[1];
2334 unionArray->setIConst(i);
2335 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, *(*fields)[i].type, (yyvsp[(3) - (3)].lex).line);
2336 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirectStruct, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2337 (yyval.interm.intermTypedNode)->setType(*(*fields)[i].type);
2338 }
2339 } else {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00002340 context->error((yyvsp[(2) - (3)].lex).line, " no such field in structure", (yyvsp[(3) - (3)].lex).string->c_str());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002341 context->recover();
2342 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2343 }
2344 }
2345 } else {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00002346 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());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002347 context->recover();
2348 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2349 }
2350 // don't delete $3.string, it's from the pool
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002351 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002352 break;
2353
2354 case 12:
2355
2356 {
2357 if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode)))
2358 context->recover();
2359 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostIncrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line, context->symbolTable);
2360 if ((yyval.interm.intermTypedNode) == 0) {
2361 context->unaryOpError((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
2362 context->recover();
2363 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode);
2364 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002365 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002366 break;
2367
2368 case 13:
2369
2370 {
2371 if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode)))
2372 context->recover();
2373 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostDecrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line, context->symbolTable);
2374 if ((yyval.interm.intermTypedNode) == 0) {
2375 context->unaryOpError((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
2376 context->recover();
2377 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode);
2378 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002379 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002380 break;
2381
2382 case 14:
2383
2384 {
2385 if (context->integerErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode), "[]"))
2386 context->recover();
2387 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002388 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002389 break;
2390
2391 case 15:
2392
2393 {
2394 TFunction* fnCall = (yyvsp[(1) - (1)].interm).function;
2395 TOperator op = fnCall->getBuiltInOp();
2396
2397 if (op != EOpNull)
2398 {
2399 //
2400 // Then this should be a constructor.
2401 // Don't go through the symbol table for constructors.
2402 // Their parameters will be verified algorithmically.
2403 //
2404 TType type(EbtVoid, EbpUndefined); // use this to get the type back
2405 if (context->constructorErrorCheck((yyvsp[(1) - (1)].interm).line, (yyvsp[(1) - (1)].interm).intermNode, *fnCall, op, &type)) {
2406 (yyval.interm.intermTypedNode) = 0;
2407 } else {
2408 //
2409 // It's a constructor, of type 'type'.
2410 //
2411 (yyval.interm.intermTypedNode) = context->addConstructor((yyvsp[(1) - (1)].interm).intermNode, &type, op, fnCall, (yyvsp[(1) - (1)].interm).line);
2412 }
2413
2414 if ((yyval.interm.intermTypedNode) == 0) {
2415 context->recover();
2416 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator(0, op, (yyvsp[(1) - (1)].interm).line);
2417 }
2418 (yyval.interm.intermTypedNode)->setType(type);
2419 } else {
2420 //
2421 // Not a constructor. Find it in the symbol table.
2422 //
2423 const TFunction* fnCandidate;
2424 bool builtIn;
2425 fnCandidate = context->findFunction((yyvsp[(1) - (1)].interm).line, fnCall, &builtIn);
2426 if (fnCandidate) {
2427 //
2428 // A declared function.
2429 //
2430 if (builtIn && !fnCandidate->getExtension().empty() &&
2431 context->extensionErrorCheck((yyvsp[(1) - (1)].interm).line, fnCandidate->getExtension())) {
2432 context->recover();
2433 }
2434 op = fnCandidate->getBuiltInOp();
2435 if (builtIn && op != EOpNull) {
2436 //
2437 // A function call mapped to a built-in operation.
2438 //
2439 if (fnCandidate->getParamCount() == 1) {
2440 //
2441 // Treat it like a built-in unary operator.
2442 //
2443 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(op, (yyvsp[(1) - (1)].interm).intermNode, 0, context->symbolTable);
2444 if ((yyval.interm.intermTypedNode) == 0) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00002445 std::stringstream extraInfoStream;
2446 extraInfoStream << "built in unary operator function. Type: " << static_cast<TIntermTyped*>((yyvsp[(1) - (1)].interm).intermNode)->getCompleteString();
2447 std::string extraInfo = extraInfoStream.str();
2448 context->error((yyvsp[(1) - (1)].interm).intermNode->getLine(), " wrong operand type", "Internal Error", extraInfo.c_str());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002449 YYERROR;
2450 }
2451 } else {
2452 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, op, (yyvsp[(1) - (1)].interm).line);
2453 }
2454 } else {
2455 // This is a real function call
2456
2457 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, EOpFunctionCall, (yyvsp[(1) - (1)].interm).line);
2458 (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType());
2459
2460 // this is how we know whether the given function is a builtIn function or a user defined function
2461 // if builtIn == false, it's a userDefined -> could be an overloaded builtIn function also
2462 // if builtIn == true, it's definitely a builtIn function with EOpNull
2463 if (!builtIn)
2464 (yyval.interm.intermTypedNode)->getAsAggregate()->setUserDefined();
2465 (yyval.interm.intermTypedNode)->getAsAggregate()->setName(fnCandidate->getMangledName());
2466
2467 TQualifier qual;
2468 for (int i = 0; i < fnCandidate->getParamCount(); ++i) {
2469 qual = fnCandidate->getParam(i).type->getQualifier();
2470 if (qual == EvqOut || qual == EvqInOut) {
2471 if (context->lValueErrorCheck((yyval.interm.intermTypedNode)->getLine(), "assign", (yyval.interm.intermTypedNode)->getAsAggregate()->getSequence()[i]->getAsTyped())) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00002472 context->error((yyvsp[(1) - (1)].interm).intermNode->getLine(), "Constant value cannot be passed for 'out' or 'inout' parameters.", "Error");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002473 context->recover();
2474 }
2475 }
2476 }
2477 }
2478 (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType());
2479 } else {
2480 // error message was put out by PaFindFunction()
2481 // Put on a dummy node for error recovery
2482 ConstantUnion *unionArray = new ConstantUnion[1];
2483 unionArray->setFConst(0.0f);
2484 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].interm).line);
2485 context->recover();
2486 }
2487 }
2488 delete fnCall;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002489 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002490 break;
2491
2492 case 16:
2493
2494 {
2495 (yyval.interm) = (yyvsp[(1) - (1)].interm);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002496 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002497 break;
2498
2499 case 17:
2500
2501 {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00002502 context->error((yyvsp[(3) - (3)].interm).line, "methods are not supported", "");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002503 context->recover();
2504 (yyval.interm) = (yyvsp[(3) - (3)].interm);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002505 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002506 break;
2507
2508 case 18:
2509
2510 {
2511 (yyval.interm) = (yyvsp[(1) - (2)].interm);
2512 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002513 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002514 break;
2515
2516 case 19:
2517
2518 {
2519 (yyval.interm) = (yyvsp[(1) - (2)].interm);
2520 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002521 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002522 break;
2523
2524 case 20:
2525
2526 {
2527 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
2528 (yyval.interm).intermNode = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002529 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002530 break;
2531
2532 case 21:
2533
2534 {
2535 (yyval.interm).function = (yyvsp[(1) - (1)].interm.function);
2536 (yyval.interm).intermNode = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002537 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002538 break;
2539
2540 case 22:
2541
2542 {
2543 TParameter param = { 0, new TType((yyvsp[(2) - (2)].interm.intermTypedNode)->getType()) };
2544 (yyvsp[(1) - (2)].interm.function)->addParameter(param);
2545 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
2546 (yyval.interm).intermNode = (yyvsp[(2) - (2)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002547 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002548 break;
2549
2550 case 23:
2551
2552 {
2553 TParameter param = { 0, new TType((yyvsp[(3) - (3)].interm.intermTypedNode)->getType()) };
2554 (yyvsp[(1) - (3)].interm).function->addParameter(param);
2555 (yyval.interm).function = (yyvsp[(1) - (3)].interm).function;
2556 (yyval.interm).intermNode = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermNode, (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002557 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002558 break;
2559
2560 case 24:
2561
2562 {
2563 (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002564 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002565 break;
2566
2567 case 25:
2568
2569 {
2570 //
2571 // Constructor
2572 //
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002573 TOperator op = EOpNull;
2574 if ((yyvsp[(1) - (1)].interm.type).userDef) {
2575 op = EOpConstructStruct;
2576 } else {
2577 switch ((yyvsp[(1) - (1)].interm.type).type) {
2578 case EbtFloat:
2579 if ((yyvsp[(1) - (1)].interm.type).matrix) {
2580 switch((yyvsp[(1) - (1)].interm.type).size) {
2581 case 2: op = EOpConstructMat2; break;
2582 case 3: op = EOpConstructMat3; break;
2583 case 4: op = EOpConstructMat4; break;
2584 }
2585 } else {
2586 switch((yyvsp[(1) - (1)].interm.type).size) {
2587 case 1: op = EOpConstructFloat; break;
2588 case 2: op = EOpConstructVec2; break;
2589 case 3: op = EOpConstructVec3; break;
2590 case 4: op = EOpConstructVec4; break;
2591 }
2592 }
2593 break;
2594 case EbtInt:
2595 switch((yyvsp[(1) - (1)].interm.type).size) {
2596 case 1: op = EOpConstructInt; break;
2597 case 2: FRAG_VERT_ONLY("ivec2", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec2; break;
2598 case 3: FRAG_VERT_ONLY("ivec3", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec3; break;
2599 case 4: FRAG_VERT_ONLY("ivec4", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec4; break;
2600 }
2601 break;
2602 case EbtBool:
2603 switch((yyvsp[(1) - (1)].interm.type).size) {
2604 case 1: op = EOpConstructBool; break;
2605 case 2: FRAG_VERT_ONLY("bvec2", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec2; break;
2606 case 3: FRAG_VERT_ONLY("bvec3", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec3; break;
2607 case 4: FRAG_VERT_ONLY("bvec4", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec4; break;
2608 }
2609 break;
2610 default: break;
2611 }
2612 if (op == EOpNull) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00002613 context->error((yyvsp[(1) - (1)].interm.type).line, "cannot construct this type", getBasicString((yyvsp[(1) - (1)].interm.type).type));
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002614 context->recover();
2615 (yyvsp[(1) - (1)].interm.type).type = EbtFloat;
2616 op = EOpConstructFloat;
2617 }
2618 }
2619 TString tempString;
2620 TType type((yyvsp[(1) - (1)].interm.type));
2621 TFunction *function = new TFunction(&tempString, type, op);
2622 (yyval.interm.function) = function;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002623 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002624 break;
2625
2626 case 26:
2627
2628 {
2629 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
2630 context->recover();
2631 TType type(EbtVoid, EbpUndefined);
2632 TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type);
2633 (yyval.interm.function) = function;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002634 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002635 break;
2636
2637 case 27:
2638
2639 {
2640 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
2641 context->recover();
2642 TType type(EbtVoid, EbpUndefined);
2643 TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type);
2644 (yyval.interm.function) = function;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002645 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002646 break;
2647
2648 case 28:
2649
2650 {
2651 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002652 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002653 break;
2654
2655 case 29:
2656
2657 {
2658 if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)))
2659 context->recover();
2660 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreIncrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line, context->symbolTable);
2661 if ((yyval.interm.intermTypedNode) == 0) {
2662 context->unaryOpError((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2663 context->recover();
2664 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2665 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002666 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002667 break;
2668
2669 case 30:
2670
2671 {
2672 if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)))
2673 context->recover();
2674 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreDecrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line, context->symbolTable);
2675 if ((yyval.interm.intermTypedNode) == 0) {
2676 context->unaryOpError((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2677 context->recover();
2678 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2679 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002680 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002681 break;
2682
2683 case 31:
2684
2685 {
2686 if ((yyvsp[(1) - (2)].interm).op != EOpNull) {
2687 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath((yyvsp[(1) - (2)].interm).op, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].interm).line, context->symbolTable);
2688 if ((yyval.interm.intermTypedNode) == 0) {
2689 const char* errorOp = "";
2690 switch((yyvsp[(1) - (2)].interm).op) {
2691 case EOpNegative: errorOp = "-"; break;
2692 case EOpLogicalNot: errorOp = "!"; break;
2693 default: break;
2694 }
2695 context->unaryOpError((yyvsp[(1) - (2)].interm).line, errorOp, (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2696 context->recover();
2697 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2698 }
2699 } else
2700 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002701 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002702 break;
2703
2704 case 32:
2705
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002706 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNull; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002707 break;
2708
2709 case 33:
2710
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002711 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNegative; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002712 break;
2713
2714 case 34:
2715
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002716 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpLogicalNot; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002717 break;
2718
2719 case 35:
2720
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002721 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002722 break;
2723
2724 case 36:
2725
2726 {
2727 FRAG_VERT_ONLY("*", (yyvsp[(2) - (3)].lex).line);
2728 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpMul, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2729 if ((yyval.interm.intermTypedNode) == 0) {
2730 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "*", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2731 context->recover();
2732 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2733 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002734 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002735 break;
2736
2737 case 37:
2738
2739 {
2740 FRAG_VERT_ONLY("/", (yyvsp[(2) - (3)].lex).line);
2741 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpDiv, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2742 if ((yyval.interm.intermTypedNode) == 0) {
2743 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "/", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2744 context->recover();
2745 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2746 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002747 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002748 break;
2749
2750 case 38:
2751
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002752 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002753 break;
2754
2755 case 39:
2756
2757 {
2758 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpAdd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2759 if ((yyval.interm.intermTypedNode) == 0) {
2760 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "+", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2761 context->recover();
2762 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2763 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002764 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002765 break;
2766
2767 case 40:
2768
2769 {
2770 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpSub, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2771 if ((yyval.interm.intermTypedNode) == 0) {
2772 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "-", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2773 context->recover();
2774 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2775 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002776 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002777 break;
2778
2779 case 41:
2780
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002781 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002782 break;
2783
2784 case 42:
2785
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002786 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002787 break;
2788
2789 case 43:
2790
2791 {
2792 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2793 if ((yyval.interm.intermTypedNode) == 0) {
2794 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2795 context->recover();
2796 ConstantUnion *unionArray = new ConstantUnion[1];
2797 unionArray->setBConst(false);
2798 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2799 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002800 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002801 break;
2802
2803 case 44:
2804
2805 {
2806 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2807 if ((yyval.interm.intermTypedNode) == 0) {
2808 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2809 context->recover();
2810 ConstantUnion *unionArray = new ConstantUnion[1];
2811 unionArray->setBConst(false);
2812 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2813 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002814 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002815 break;
2816
2817 case 45:
2818
2819 {
2820 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2821 if ((yyval.interm.intermTypedNode) == 0) {
2822 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2823 context->recover();
2824 ConstantUnion *unionArray = new ConstantUnion[1];
2825 unionArray->setBConst(false);
2826 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2827 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002828 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002829 break;
2830
2831 case 46:
2832
2833 {
2834 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2835 if ((yyval.interm.intermTypedNode) == 0) {
2836 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2837 context->recover();
2838 ConstantUnion *unionArray = new ConstantUnion[1];
2839 unionArray->setBConst(false);
2840 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2841 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002842 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002843 break;
2844
2845 case 47:
2846
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002847 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002848 break;
2849
2850 case 48:
2851
2852 {
2853 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2854 if ((yyval.interm.intermTypedNode) == 0) {
2855 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "==", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2856 context->recover();
2857 ConstantUnion *unionArray = new ConstantUnion[1];
2858 unionArray->setBConst(false);
2859 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2860 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002861 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002862 break;
2863
2864 case 49:
2865
2866 {
2867 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpNotEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2868 if ((yyval.interm.intermTypedNode) == 0) {
2869 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "!=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2870 context->recover();
2871 ConstantUnion *unionArray = new ConstantUnion[1];
2872 unionArray->setBConst(false);
2873 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2874 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002875 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002876 break;
2877
2878 case 50:
2879
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002880 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002881 break;
2882
2883 case 51:
2884
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002885 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002886 break;
2887
2888 case 52:
2889
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002890 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002891 break;
2892
2893 case 53:
2894
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002895 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002896 break;
2897
2898 case 54:
2899
2900 {
2901 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalAnd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2902 if ((yyval.interm.intermTypedNode) == 0) {
2903 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "&&", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2904 context->recover();
2905 ConstantUnion *unionArray = new ConstantUnion[1];
2906 unionArray->setBConst(false);
2907 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2908 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002909 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002910 break;
2911
2912 case 55:
2913
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002914 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002915 break;
2916
2917 case 56:
2918
2919 {
2920 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalXor, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2921 if ((yyval.interm.intermTypedNode) == 0) {
2922 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "^^", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2923 context->recover();
2924 ConstantUnion *unionArray = new ConstantUnion[1];
2925 unionArray->setBConst(false);
2926 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2927 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002928 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002929 break;
2930
2931 case 57:
2932
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002933 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002934 break;
2935
2936 case 58:
2937
2938 {
2939 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalOr, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2940 if ((yyval.interm.intermTypedNode) == 0) {
2941 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "||", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2942 context->recover();
2943 ConstantUnion *unionArray = new ConstantUnion[1];
2944 unionArray->setBConst(false);
2945 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2946 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002947 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002948 break;
2949
2950 case 59:
2951
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002952 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002953 break;
2954
2955 case 60:
2956
2957 {
2958 if (context->boolErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.intermTypedNode)))
2959 context->recover();
2960
2961 (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);
2962 if ((yyvsp[(3) - (5)].interm.intermTypedNode)->getType() != (yyvsp[(5) - (5)].interm.intermTypedNode)->getType())
2963 (yyval.interm.intermTypedNode) = 0;
2964
2965 if ((yyval.interm.intermTypedNode) == 0) {
2966 context->binaryOpError((yyvsp[(2) - (5)].lex).line, ":", (yyvsp[(3) - (5)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(5) - (5)].interm.intermTypedNode)->getCompleteString());
2967 context->recover();
2968 (yyval.interm.intermTypedNode) = (yyvsp[(5) - (5)].interm.intermTypedNode);
2969 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002970 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002971 break;
2972
2973 case 61:
2974
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002975 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002976 break;
2977
2978 case 62:
2979
2980 {
2981 if (context->lValueErrorCheck((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)))
2982 context->recover();
2983 (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);
2984 if ((yyval.interm.intermTypedNode) == 0) {
2985 context->assignError((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2986 context->recover();
2987 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2988 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002989 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002990 break;
2991
2992 case 63:
2993
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002994 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAssign; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002995 break;
2996
2997 case 64:
2998
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002999 { FRAG_VERT_ONLY("*=", (yyvsp[(1) - (1)].lex).line); (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpMulAssign; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003000 break;
3001
3002 case 65:
3003
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003004 { FRAG_VERT_ONLY("/=", (yyvsp[(1) - (1)].lex).line); (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpDivAssign; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003005 break;
3006
3007 case 66:
3008
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003009 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAddAssign; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003010 break;
3011
3012 case 67:
3013
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003014 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpSubAssign; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003015 break;
3016
3017 case 68:
3018
3019 {
3020 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003021 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003022 break;
3023
3024 case 69:
3025
3026 {
3027 (yyval.interm.intermTypedNode) = context->intermediate.addComma((yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
3028 if ((yyval.interm.intermTypedNode) == 0) {
3029 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ",", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3030 context->recover();
3031 (yyval.interm.intermTypedNode) = (yyvsp[(3) - (3)].interm.intermTypedNode);
3032 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003033 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003034 break;
3035
3036 case 70:
3037
3038 {
3039 if (context->constErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)))
3040 context->recover();
3041 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003042 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003043 break;
3044
3045 case 71:
3046
3047 {
3048 TFunction &function = *((yyvsp[(1) - (2)].interm).function);
3049
3050 TIntermAggregate *prototype = new TIntermAggregate;
3051 prototype->setType(function.getReturnType());
3052 prototype->setName(function.getName());
3053
3054 for (int i = 0; i < function.getParamCount(); i++)
3055 {
3056 const TParameter &param = function.getParam(i);
3057 if (param.name != 0)
3058 {
3059 TVariable *variable = new TVariable(param.name, *param.type);
3060
3061 prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(variable->getUniqueId(), variable->getName(), variable->getType(), (yyvsp[(1) - (2)].interm).line), (yyvsp[(1) - (2)].interm).line);
3062 }
3063 else
3064 {
3065 prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (2)].interm).line), (yyvsp[(1) - (2)].interm).line);
3066 }
3067 }
3068
3069 prototype->setOp(EOpPrototype);
3070 (yyval.interm.intermNode) = prototype;
daniel@transgaming.com5dd6d092012-03-20 20:10:28 +00003071
3072 context->symbolTable.pop();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003073 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003074 break;
3075
3076 case 72:
3077
3078 {
3079 if ((yyvsp[(1) - (2)].interm).intermAggregate)
3080 (yyvsp[(1) - (2)].interm).intermAggregate->setOp(EOpDeclaration);
3081 (yyval.interm.intermNode) = (yyvsp[(1) - (2)].interm).intermAggregate;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003082 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003083 break;
3084
3085 case 73:
3086
3087 {
3088 context->symbolTable.setDefaultPrecision( (yyvsp[(3) - (4)].interm.type).type, (yyvsp[(2) - (4)].interm.precision) );
3089 (yyval.interm.intermNode) = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003090 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003091 break;
3092
3093 case 74:
3094
3095 {
3096 //
3097 // Multiple declarations of the same function are allowed.
3098 //
3099 // If this is a definition, the definition production code will check for redefinitions
3100 // (we don't know at this point if it's a definition or not).
3101 //
3102 // Redeclarations are allowed. But, return types and parameter qualifiers must match.
3103 //
3104 TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find((yyvsp[(1) - (2)].interm.function)->getMangledName()));
3105 if (prevDec) {
3106 if (prevDec->getReturnType() != (yyvsp[(1) - (2)].interm.function)->getReturnType()) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003107 context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same return type", (yyvsp[(1) - (2)].interm.function)->getReturnType().getBasicString());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003108 context->recover();
3109 }
3110 for (int i = 0; i < prevDec->getParamCount(); ++i) {
3111 if (prevDec->getParam(i).type->getQualifier() != (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifier()) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003112 context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same parameter qualifiers", (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifierString());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003113 context->recover();
3114 }
3115 }
3116 }
3117
3118 //
3119 // If this is a redeclaration, it could also be a definition,
3120 // in which case, we want to use the variable names from this one, and not the one that's
3121 // being redeclared. So, pass back up this declaration, not the one in the symbol table.
3122 //
3123 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
3124 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
3125
daniel@transgaming.com5dd6d092012-03-20 20:10:28 +00003126 // We're at the inner scope level of the function's arguments and body statement.
3127 // Add the function prototype to the surrounding scope instead.
3128 context->symbolTable.getOuterLevel()->insert(*(yyval.interm).function);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003129 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003130 break;
3131
3132 case 75:
3133
3134 {
3135 (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003136 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003137 break;
3138
3139 case 76:
3140
3141 {
3142 (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003143 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003144 break;
3145
3146 case 77:
3147
3148 {
3149 // Add the parameter
3150 (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
3151 if ((yyvsp[(2) - (2)].interm).param.type->getBasicType() != EbtVoid)
3152 (yyvsp[(1) - (2)].interm.function)->addParameter((yyvsp[(2) - (2)].interm).param);
3153 else
3154 delete (yyvsp[(2) - (2)].interm).param.type;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003155 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003156 break;
3157
3158 case 78:
3159
3160 {
3161 //
3162 // Only first parameter of one-parameter functions can be void
3163 // The check for named parameters not being void is done in parameter_declarator
3164 //
3165 if ((yyvsp[(3) - (3)].interm).param.type->getBasicType() == EbtVoid) {
3166 //
3167 // This parameter > first is void
3168 //
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003169 context->error((yyvsp[(2) - (3)].lex).line, "cannot be an argument type except for '(void)'", "void");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003170 context->recover();
3171 delete (yyvsp[(3) - (3)].interm).param.type;
3172 } else {
3173 // Add the parameter
3174 (yyval.interm.function) = (yyvsp[(1) - (3)].interm.function);
3175 (yyvsp[(1) - (3)].interm.function)->addParameter((yyvsp[(3) - (3)].interm).param);
3176 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003177 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003178 break;
3179
3180 case 79:
3181
3182 {
3183 if ((yyvsp[(1) - (3)].interm.type).qualifier != EvqGlobal && (yyvsp[(1) - (3)].interm.type).qualifier != EvqTemporary) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003184 context->error((yyvsp[(2) - (3)].lex).line, "no qualifiers allowed for function return", getQualifierString((yyvsp[(1) - (3)].interm.type).qualifier));
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003185 context->recover();
3186 }
3187 // make sure a sampler is not involved as well...
3188 if (context->structQualifierErrorCheck((yyvsp[(2) - (3)].lex).line, (yyvsp[(1) - (3)].interm.type)))
3189 context->recover();
3190
3191 // Add the function as a prototype after parsing it (we do not support recursion)
3192 TFunction *function;
3193 TType type((yyvsp[(1) - (3)].interm.type));
3194 function = new TFunction((yyvsp[(2) - (3)].lex).string, type);
3195 (yyval.interm.function) = function;
daniel@transgaming.com5dd6d092012-03-20 20:10:28 +00003196
3197 context->symbolTable.push();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003198 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003199 break;
3200
3201 case 80:
3202
3203 {
3204 if ((yyvsp[(1) - (2)].interm.type).type == EbtVoid) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003205 context->error((yyvsp[(2) - (2)].lex).line, "illegal use of type 'void'", (yyvsp[(2) - (2)].lex).string->c_str());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003206 context->recover();
3207 }
3208 if (context->reservedErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string))
3209 context->recover();
3210 TParameter param = {(yyvsp[(2) - (2)].lex).string, new TType((yyvsp[(1) - (2)].interm.type))};
3211 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
3212 (yyval.interm).param = param;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003213 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003214 break;
3215
3216 case 81:
3217
3218 {
3219 // Check that we can make an array out of this type
3220 if (context->arrayTypeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
3221 context->recover();
3222
3223 if (context->reservedErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string))
3224 context->recover();
3225
3226 int size;
3227 if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3228 context->recover();
3229 (yyvsp[(1) - (5)].interm.type).setArray(true, size);
3230
3231 TType* type = new TType((yyvsp[(1) - (5)].interm.type));
3232 TParameter param = { (yyvsp[(2) - (5)].lex).string, type };
3233 (yyval.interm).line = (yyvsp[(2) - (5)].lex).line;
3234 (yyval.interm).param = param;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003235 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003236 break;
3237
3238 case 82:
3239
3240 {
3241 (yyval.interm) = (yyvsp[(3) - (3)].interm);
3242 if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
3243 context->recover();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003244 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003245 break;
3246
3247 case 83:
3248
3249 {
3250 (yyval.interm) = (yyvsp[(2) - (2)].interm);
3251 if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
3252 context->recover();
3253 if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
3254 context->recover();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003255 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003256 break;
3257
3258 case 84:
3259
3260 {
3261 (yyval.interm) = (yyvsp[(3) - (3)].interm);
3262 if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
3263 context->recover();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003264 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003265 break;
3266
3267 case 85:
3268
3269 {
3270 (yyval.interm) = (yyvsp[(2) - (2)].interm);
3271 if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
3272 context->recover();
3273 if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
3274 context->recover();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003275 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003276 break;
3277
3278 case 86:
3279
3280 {
3281 (yyval.interm.qualifier) = EvqIn;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003282 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003283 break;
3284
3285 case 87:
3286
3287 {
3288 (yyval.interm.qualifier) = EvqIn;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003289 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003290 break;
3291
3292 case 88:
3293
3294 {
3295 (yyval.interm.qualifier) = EvqOut;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003296 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003297 break;
3298
3299 case 89:
3300
3301 {
3302 (yyval.interm.qualifier) = EvqInOut;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003303 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003304 break;
3305
3306 case 90:
3307
3308 {
3309 TParameter param = { 0, new TType((yyvsp[(1) - (1)].interm.type)) };
3310 (yyval.interm).param = param;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003311 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003312 break;
3313
3314 case 91:
3315
3316 {
3317 (yyval.interm) = (yyvsp[(1) - (1)].interm);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003318 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003319 break;
3320
3321 case 92:
3322
3323 {
daniel@transgaming.comeec8efc2012-03-09 21:57:49 +00003324 if ((yyvsp[(1) - (3)].interm).type.type == EbtInvariant && !(yyvsp[(3) - (3)].lex).symbol)
3325 {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003326 context->error((yyvsp[(3) - (3)].lex).line, "undeclared identifier declared as invariant", (yyvsp[(3) - (3)].lex).string->c_str());
daniel@transgaming.comeec8efc2012-03-09 21:57:49 +00003327 context->recover();
3328 }
3329
zmo@google.comfd747b82011-04-23 01:30:07 +00003330 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(3) - (3)].lex).string, TType((yyvsp[(1) - (3)].interm).type), (yyvsp[(3) - (3)].lex).line);
3331 (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermNode, symbol, (yyvsp[(3) - (3)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003332
3333 if (context->structQualifierErrorCheck((yyvsp[(3) - (3)].lex).line, (yyval.interm).type))
3334 context->recover();
3335
3336 if (context->nonInitConstErrorCheck((yyvsp[(3) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyval.interm).type))
3337 context->recover();
3338
zmo@google.comfd747b82011-04-23 01:30:07 +00003339 TVariable* variable = 0;
3340 if (context->nonInitErrorCheck((yyvsp[(3) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyval.interm).type, variable))
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003341 context->recover();
zmo@google.comfd747b82011-04-23 01:30:07 +00003342 if (symbol && variable)
3343 symbol->setId(variable->getUniqueId());
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003344 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003345 break;
3346
3347 case 93:
3348
3349 {
3350 if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
3351 context->recover();
3352
3353 if (context->nonInitConstErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type))
3354 context->recover();
3355
3356 (yyval.interm) = (yyvsp[(1) - (5)].interm);
3357
3358 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))
3359 context->recover();
3360 else {
3361 (yyvsp[(1) - (5)].interm).type.setArray(true);
3362 TVariable* variable;
3363 if (context->arrayErrorCheck((yyvsp[(4) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, variable))
3364 context->recover();
3365 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003366 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003367 break;
3368
3369 case 94:
3370
3371 {
3372 if (context->structQualifierErrorCheck((yyvsp[(3) - (6)].lex).line, (yyvsp[(1) - (6)].interm).type))
3373 context->recover();
3374
3375 if (context->nonInitConstErrorCheck((yyvsp[(3) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type))
3376 context->recover();
3377
3378 (yyval.interm) = (yyvsp[(1) - (6)].interm);
3379
3380 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))
3381 context->recover();
3382 else {
3383 int size;
3384 if (context->arraySizeErrorCheck((yyvsp[(4) - (6)].lex).line, (yyvsp[(5) - (6)].interm.intermTypedNode), size))
3385 context->recover();
3386 (yyvsp[(1) - (6)].interm).type.setArray(true, size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003387 TVariable* variable = 0;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003388 if (context->arrayErrorCheck((yyvsp[(4) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type, variable))
3389 context->recover();
3390 TType type = TType((yyvsp[(1) - (6)].interm).type);
3391 type.setArraySize(size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003392 (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);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003393 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003394 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003395 break;
3396
3397 case 95:
3398
3399 {
3400 if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
3401 context->recover();
3402
3403 (yyval.interm) = (yyvsp[(1) - (5)].interm);
3404
3405 TIntermNode* intermNode;
3406 if (!context->executeInitializer((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, (yyvsp[(5) - (5)].interm.intermTypedNode), intermNode)) {
3407 //
3408 // build the intermediate representation
3409 //
3410 if (intermNode)
3411 (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (5)].interm).intermNode, intermNode, (yyvsp[(4) - (5)].lex).line);
3412 else
3413 (yyval.interm).intermAggregate = (yyvsp[(1) - (5)].interm).intermAggregate;
3414 } else {
3415 context->recover();
3416 (yyval.interm).intermAggregate = 0;
3417 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003418 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003419 break;
3420
3421 case 96:
3422
3423 {
3424 (yyval.interm).type = (yyvsp[(1) - (1)].interm.type);
3425 (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);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003426 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003427 break;
3428
3429 case 97:
3430
3431 {
zmo@google.comfd747b82011-04-23 01:30:07 +00003432 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyvsp[(1) - (2)].interm.type)), (yyvsp[(2) - (2)].lex).line);
3433 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (2)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003434
3435 if (context->structQualifierErrorCheck((yyvsp[(2) - (2)].lex).line, (yyval.interm).type))
3436 context->recover();
3437
3438 if (context->nonInitConstErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string, (yyval.interm).type))
3439 context->recover();
3440
3441 (yyval.interm).type = (yyvsp[(1) - (2)].interm.type);
3442
zmo@google.comfd747b82011-04-23 01:30:07 +00003443 TVariable* variable = 0;
3444 if (context->nonInitErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string, (yyval.interm).type, variable))
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003445 context->recover();
zmo@google.comfd747b82011-04-23 01:30:07 +00003446 if (variable && symbol)
3447 symbol->setId(variable->getUniqueId());
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003448 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003449 break;
3450
3451 case 98:
3452
3453 {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003454 context->error((yyvsp[(2) - (4)].lex).line, "unsized array declarations not supported", (yyvsp[(2) - (4)].lex).string->c_str());
kbr@chromium.org04277b82011-06-02 18:41:26 +00003455 context->recover();
3456
zmo@google.comfd747b82011-04-23 01:30:07 +00003457 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (4)].lex).string, TType((yyvsp[(1) - (4)].interm.type)), (yyvsp[(2) - (4)].lex).line);
3458 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (4)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003459 (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003460 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003461 break;
3462
3463 case 99:
3464
3465 {
3466 TType type = TType((yyvsp[(1) - (5)].interm.type));
3467 int size;
3468 if (context->arraySizeErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3469 context->recover();
3470 type.setArraySize(size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003471 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (5)].lex).string, type, (yyvsp[(2) - (5)].lex).line);
3472 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (5)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003473
3474 if (context->structQualifierErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
3475 context->recover();
3476
3477 if (context->nonInitConstErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type)))
3478 context->recover();
3479
3480 (yyval.interm).type = (yyvsp[(1) - (5)].interm.type);
3481
3482 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)))
3483 context->recover();
3484 else {
3485 int size;
3486 if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3487 context->recover();
3488
3489 (yyvsp[(1) - (5)].interm.type).setArray(true, size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003490 TVariable* variable = 0;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003491 if (context->arrayErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type), variable))
3492 context->recover();
zmo@google.comfd747b82011-04-23 01:30:07 +00003493 if (variable && symbol)
3494 symbol->setId(variable->getUniqueId());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003495 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003496 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003497 break;
3498
3499 case 100:
3500
3501 {
3502 if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
3503 context->recover();
3504
3505 (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
3506
3507 TIntermNode* intermNode;
3508 if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode)) {
3509 //
3510 // Build intermediate representation
3511 //
3512 if(intermNode)
3513 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(intermNode, (yyvsp[(3) - (4)].lex).line);
3514 else
3515 (yyval.interm).intermAggregate = 0;
3516 } else {
3517 context->recover();
3518 (yyval.interm).intermAggregate = 0;
3519 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003520 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003521 break;
3522
3523 case 101:
3524
3525 {
3526 VERTEX_ONLY("invariant declaration", (yyvsp[(1) - (2)].lex).line);
daniel@transgaming.comeec8efc2012-03-09 21:57:49 +00003527 if (context->globalErrorCheck((yyvsp[(1) - (2)].lex).line, context->symbolTable.atGlobalLevel(), "invariant varying"))
3528 context->recover();
3529 (yyval.interm).type.setBasic(EbtInvariant, EvqInvariantVaryingOut, (yyvsp[(2) - (2)].lex).line);
3530 if (!(yyvsp[(2) - (2)].lex).symbol)
3531 {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003532 context->error((yyvsp[(2) - (2)].lex).line, "undeclared identifier declared as invariant", (yyvsp[(2) - (2)].lex).string->c_str());
daniel@transgaming.comeec8efc2012-03-09 21:57:49 +00003533 context->recover();
3534
3535 (yyval.interm).intermAggregate = 0;
3536 }
3537 else
3538 {
3539 TIntermSymbol *symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyval.interm).type), (yyvsp[(2) - (2)].lex).line);
3540 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (2)].lex).line);
3541 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003542 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003543 break;
3544
3545 case 102:
3546
3547 {
3548 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3549
3550 if ((yyvsp[(1) - (1)].interm.type).array) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003551 context->error((yyvsp[(1) - (1)].interm.type).line, "not supported", "first-class array");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003552 context->recover();
3553 (yyvsp[(1) - (1)].interm.type).setArray(false);
3554 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003555 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003556 break;
3557
3558 case 103:
3559
3560 {
3561 if ((yyvsp[(2) - (2)].interm.type).array) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003562 context->error((yyvsp[(2) - (2)].interm.type).line, "not supported", "first-class array");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003563 context->recover();
3564 (yyvsp[(2) - (2)].interm.type).setArray(false);
3565 }
3566
3567 if ((yyvsp[(1) - (2)].interm.type).qualifier == EvqAttribute &&
3568 ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003569 context->error((yyvsp[(2) - (2)].interm.type).line, "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier));
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003570 context->recover();
3571 }
3572 if (((yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingIn || (yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingOut) &&
3573 ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003574 context->error((yyvsp[(2) - (2)].interm.type).line, "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier));
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003575 context->recover();
3576 }
3577 (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
3578 (yyval.interm.type).qualifier = (yyvsp[(1) - (2)].interm.type).qualifier;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003579 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003580 break;
3581
3582 case 104:
3583
3584 {
3585 (yyval.interm.type).setBasic(EbtVoid, EvqConst, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003586 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003587 break;
3588
3589 case 105:
3590
3591 {
3592 VERTEX_ONLY("attribute", (yyvsp[(1) - (1)].lex).line);
3593 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "attribute"))
3594 context->recover();
3595 (yyval.interm.type).setBasic(EbtVoid, EvqAttribute, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003596 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003597 break;
3598
3599 case 106:
3600
3601 {
3602 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "varying"))
3603 context->recover();
3604 if (context->shaderType == SH_VERTEX_SHADER)
3605 (yyval.interm.type).setBasic(EbtVoid, EvqVaryingOut, (yyvsp[(1) - (1)].lex).line);
3606 else
3607 (yyval.interm.type).setBasic(EbtVoid, EvqVaryingIn, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003608 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003609 break;
3610
3611 case 107:
3612
3613 {
3614 if (context->globalErrorCheck((yyvsp[(1) - (2)].lex).line, context->symbolTable.atGlobalLevel(), "invariant varying"))
3615 context->recover();
3616 if (context->shaderType == SH_VERTEX_SHADER)
3617 (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingOut, (yyvsp[(1) - (2)].lex).line);
3618 else
3619 (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingIn, (yyvsp[(1) - (2)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003620 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003621 break;
3622
3623 case 108:
3624
3625 {
3626 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "uniform"))
3627 context->recover();
3628 (yyval.interm.type).setBasic(EbtVoid, EvqUniform, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003629 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003630 break;
3631
3632 case 109:
3633
3634 {
3635 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
zmo@google.comdc4b4f82011-06-17 00:42:53 +00003636
3637 if ((yyval.interm.type).precision == EbpUndefined) {
3638 (yyval.interm.type).precision = context->symbolTable.getDefaultPrecision((yyvsp[(1) - (1)].interm.type).type);
3639 if (context->precisionErrorCheck((yyvsp[(1) - (1)].interm.type).line, (yyval.interm.type).precision, (yyvsp[(1) - (1)].interm.type).type)) {
3640 context->recover();
3641 }
3642 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003643 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003644 break;
3645
3646 case 110:
3647
3648 {
3649 (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
3650 (yyval.interm.type).precision = (yyvsp[(1) - (2)].interm.precision);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003651 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003652 break;
3653
3654 case 111:
3655
3656 {
3657 (yyval.interm.precision) = EbpHigh;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003658 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003659 break;
3660
3661 case 112:
3662
3663 {
3664 (yyval.interm.precision) = EbpMedium;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003665 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003666 break;
3667
3668 case 113:
3669
3670 {
3671 (yyval.interm.precision) = EbpLow;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003672 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003673 break;
3674
3675 case 114:
3676
3677 {
3678 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003679 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003680 break;
3681
3682 case 115:
3683
3684 {
3685 (yyval.interm.type) = (yyvsp[(1) - (4)].interm.type);
3686
3687 if (context->arrayTypeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
3688 context->recover();
3689 else {
3690 int size;
3691 if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
3692 context->recover();
3693 (yyval.interm.type).setArray(true, size);
3694 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003695 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003696 break;
3697
3698 case 116:
3699
3700 {
3701 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3702 (yyval.interm.type).setBasic(EbtVoid, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003703 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003704 break;
3705
3706 case 117:
3707
3708 {
3709 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3710 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003711 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003712 break;
3713
3714 case 118:
3715
3716 {
3717 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3718 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003719 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003720 break;
3721
3722 case 119:
3723
3724 {
3725 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3726 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003727 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003728 break;
3729
3730 case 120:
3731
3732 {
3733 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3734 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3735 (yyval.interm.type).setAggregate(2);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003736 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003737 break;
3738
3739 case 121:
3740
3741 {
3742 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3743 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3744 (yyval.interm.type).setAggregate(3);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003745 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003746 break;
3747
3748 case 122:
3749
3750 {
3751 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3752 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3753 (yyval.interm.type).setAggregate(4);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003754 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003755 break;
3756
3757 case 123:
3758
3759 {
3760 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3761 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3762 (yyval.interm.type).setAggregate(2);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003763 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003764 break;
3765
3766 case 124:
3767
3768 {
3769 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3770 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3771 (yyval.interm.type).setAggregate(3);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003772 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003773 break;
3774
3775 case 125:
3776
3777 {
3778 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3779 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3780 (yyval.interm.type).setAggregate(4);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003781 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003782 break;
3783
3784 case 126:
3785
3786 {
3787 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3788 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3789 (yyval.interm.type).setAggregate(2);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003790 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003791 break;
3792
3793 case 127:
3794
3795 {
3796 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3797 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3798 (yyval.interm.type).setAggregate(3);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003799 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003800 break;
3801
3802 case 128:
3803
3804 {
3805 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3806 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3807 (yyval.interm.type).setAggregate(4);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003808 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003809 break;
3810
3811 case 129:
3812
3813 {
3814 FRAG_VERT_ONLY("mat2", (yyvsp[(1) - (1)].lex).line);
3815 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3816 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3817 (yyval.interm.type).setAggregate(2, true);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003818 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003819 break;
3820
3821 case 130:
3822
3823 {
3824 FRAG_VERT_ONLY("mat3", (yyvsp[(1) - (1)].lex).line);
3825 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3826 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3827 (yyval.interm.type).setAggregate(3, true);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003828 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003829 break;
3830
3831 case 131:
3832
3833 {
3834 FRAG_VERT_ONLY("mat4", (yyvsp[(1) - (1)].lex).line);
3835 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3836 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3837 (yyval.interm.type).setAggregate(4, true);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003838 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003839 break;
3840
3841 case 132:
3842
3843 {
3844 FRAG_VERT_ONLY("sampler2D", (yyvsp[(1) - (1)].lex).line);
3845 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3846 (yyval.interm.type).setBasic(EbtSampler2D, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003847 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003848 break;
3849
3850 case 133:
3851
3852 {
3853 FRAG_VERT_ONLY("samplerCube", (yyvsp[(1) - (1)].lex).line);
3854 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3855 (yyval.interm.type).setBasic(EbtSamplerCube, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003856 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003857 break;
3858
3859 case 134:
3860
3861 {
zmo@google.com09c323a2011-08-12 18:22:25 +00003862 if (!context->supportsExtension("GL_OES_EGL_image_external")) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003863 context->error((yyvsp[(1) - (1)].lex).line, "unsupported type", "samplerExternalOES");
zmo@google.com09c323a2011-08-12 18:22:25 +00003864 context->recover();
3865 }
3866 FRAG_VERT_ONLY("samplerExternalOES", (yyvsp[(1) - (1)].lex).line);
3867 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3868 (yyval.interm.type).setBasic(EbtSamplerExternalOES, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003869 }
zmo@google.com09c323a2011-08-12 18:22:25 +00003870 break;
3871
3872 case 135:
3873
3874 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00003875 if (!context->supportsExtension("GL_ARB_texture_rectangle")) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003876 context->error((yyvsp[(1) - (1)].lex).line, "unsupported type", "sampler2DRect");
kbr@chromium.org205fef32011-11-22 20:50:02 +00003877 context->recover();
3878 }
3879 FRAG_VERT_ONLY("sampler2DRect", (yyvsp[(1) - (1)].lex).line);
3880 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3881 (yyval.interm.type).setBasic(EbtSampler2DRect, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003882 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003883 break;
3884
zmo@google.com09c323a2011-08-12 18:22:25 +00003885 case 136:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003886
3887 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00003888 FRAG_VERT_ONLY("struct", (yyvsp[(1) - (1)].interm.type).line);
3889 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3890 (yyval.interm.type).qualifier = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003891 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003892 break;
3893
3894 case 137:
3895
3896 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003897 //
3898 // This is for user defined type names. The lexical phase looked up the
3899 // type.
3900 //
3901 TType& structure = static_cast<TVariable*>((yyvsp[(1) - (1)].lex).symbol)->getType();
3902 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3903 (yyval.interm.type).setBasic(EbtStruct, qual, (yyvsp[(1) - (1)].lex).line);
3904 (yyval.interm.type).userDef = &structure;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003905 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003906 break;
3907
zmo@google.com09c323a2011-08-12 18:22:25 +00003908 case 138:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003909
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003910 { if (context->enterStructDeclaration((yyvsp[(2) - (3)].lex).line, *(yyvsp[(2) - (3)].lex).string)) context->recover(); }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003911 break;
3912
3913 case 139:
3914
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003915 {
kbr@chromium.org476541f2011-10-27 21:14:51 +00003916 if (context->reservedErrorCheck((yyvsp[(2) - (6)].lex).line, *(yyvsp[(2) - (6)].lex).string))
3917 context->recover();
3918
3919 TType* structure = new TType((yyvsp[(5) - (6)].interm.typeList), *(yyvsp[(2) - (6)].lex).string);
3920 TVariable* userTypeDef = new TVariable((yyvsp[(2) - (6)].lex).string, *structure, true);
3921 if (! context->symbolTable.insert(*userTypeDef)) {
3922 context->error((yyvsp[(2) - (6)].lex).line, "redefinition", (yyvsp[(2) - (6)].lex).string->c_str(), "struct");
3923 context->recover();
3924 }
3925 (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (6)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003926 (yyval.interm.type).userDef = structure;
kbr@chromium.org476541f2011-10-27 21:14:51 +00003927 context->exitStructDeclaration();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003928 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00003929 break;
3930
3931 case 140:
3932
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003933 { if (context->enterStructDeclaration((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string)) context->recover(); }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003934 break;
3935
3936 case 141:
3937
kbr@chromium.org476541f2011-10-27 21:14:51 +00003938 {
3939 TType* structure = new TType((yyvsp[(4) - (5)].interm.typeList), TString(""));
3940 (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (5)].lex).line);
3941 (yyval.interm.type).userDef = structure;
3942 context->exitStructDeclaration();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003943 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003944 break;
3945
kbr@chromium.org476541f2011-10-27 21:14:51 +00003946 case 142:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003947
3948 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00003949 (yyval.interm.typeList) = (yyvsp[(1) - (1)].interm.typeList);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003950 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003951 break;
3952
3953 case 143:
3954
3955 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003956 (yyval.interm.typeList) = (yyvsp[(1) - (2)].interm.typeList);
3957 for (unsigned int i = 0; i < (yyvsp[(2) - (2)].interm.typeList)->size(); ++i) {
3958 for (unsigned int j = 0; j < (yyval.interm.typeList)->size(); ++j) {
3959 if ((*(yyval.interm.typeList))[j].type->getFieldName() == (*(yyvsp[(2) - (2)].interm.typeList))[i].type->getFieldName()) {
3960 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());
3961 context->recover();
3962 }
3963 }
3964 (yyval.interm.typeList)->push_back((*(yyvsp[(2) - (2)].interm.typeList))[i]);
3965 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003966 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003967 break;
3968
kbr@chromium.org205fef32011-11-22 20:50:02 +00003969 case 144:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003970
3971 {
3972 (yyval.interm.typeList) = (yyvsp[(2) - (3)].interm.typeList);
3973
3974 if (context->voidErrorCheck((yyvsp[(1) - (3)].interm.type).line, (*(yyvsp[(2) - (3)].interm.typeList))[0].type->getFieldName(), (yyvsp[(1) - (3)].interm.type))) {
3975 context->recover();
3976 }
3977 for (unsigned int i = 0; i < (yyval.interm.typeList)->size(); ++i) {
3978 //
3979 // Careful not to replace already known aspects of type, like array-ness
3980 //
3981 TType* type = (*(yyval.interm.typeList))[i].type;
3982 type->setBasicType((yyvsp[(1) - (3)].interm.type).type);
3983 type->setNominalSize((yyvsp[(1) - (3)].interm.type).size);
3984 type->setMatrix((yyvsp[(1) - (3)].interm.type).matrix);
zmo@google.comdc4b4f82011-06-17 00:42:53 +00003985 type->setPrecision((yyvsp[(1) - (3)].interm.type).precision);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003986
3987 // don't allow arrays of arrays
3988 if (type->isArray()) {
3989 if (context->arrayTypeErrorCheck((yyvsp[(1) - (3)].interm.type).line, (yyvsp[(1) - (3)].interm.type)))
3990 context->recover();
3991 }
3992 if ((yyvsp[(1) - (3)].interm.type).array)
3993 type->setArraySize((yyvsp[(1) - (3)].interm.type).arraySize);
3994 if ((yyvsp[(1) - (3)].interm.type).userDef) {
3995 type->setStruct((yyvsp[(1) - (3)].interm.type).userDef->getStruct());
3996 type->setTypeName((yyvsp[(1) - (3)].interm.type).userDef->getTypeName());
3997 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00003998
3999 if (context->structNestingErrorCheck((yyvsp[(1) - (3)].interm.type).line, *type)) {
4000 context->recover();
4001 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004002 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004003 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004004 break;
4005
kbr@chromium.org476541f2011-10-27 21:14:51 +00004006 case 145:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004007
4008 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004009 (yyval.interm.typeList) = NewPoolTTypeList();
4010 (yyval.interm.typeList)->push_back((yyvsp[(1) - (1)].interm.typeLine));
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004011 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004012 break;
4013
kbr@chromium.org476541f2011-10-27 21:14:51 +00004014 case 146:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004015
4016 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004017 (yyval.interm.typeList)->push_back((yyvsp[(3) - (3)].interm.typeLine));
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004018 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004019 break;
4020
4021 case 147:
4022
4023 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004024 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
4025 context->recover();
4026
4027 (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
4028 (yyval.interm.typeLine).line = (yyvsp[(1) - (1)].lex).line;
4029 (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (1)].lex).string);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004030 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004031 break;
4032
kbr@chromium.org205fef32011-11-22 20:50:02 +00004033 case 148:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004034
4035 {
4036 if (context->reservedErrorCheck((yyvsp[(1) - (4)].lex).line, *(yyvsp[(1) - (4)].lex).string))
4037 context->recover();
4038
4039 (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
4040 (yyval.interm.typeLine).line = (yyvsp[(1) - (4)].lex).line;
4041 (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (4)].lex).string);
4042
4043 int size;
4044 if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
4045 context->recover();
4046 (yyval.interm.typeLine).type->setArraySize(size);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004047 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004048 break;
4049
4050 case 149:
4051
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004052 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004053 break;
4054
4055 case 150:
4056
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004057 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004058 break;
4059
4060 case 151:
4061
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004062 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermAggregate); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004063 break;
4064
4065 case 152:
4066
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004067 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004068 break;
4069
4070 case 153:
4071
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004072 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004073 break;
4074
4075 case 154:
4076
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004077 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004078 break;
4079
4080 case 155:
4081
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004082 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004083 break;
4084
4085 case 156:
4086
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004087 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004088 break;
4089
4090 case 157:
4091
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004092 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
zmo@google.com09c323a2011-08-12 18:22:25 +00004093 break;
4094
4095 case 158:
4096
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004097 { (yyval.interm.intermAggregate) = 0; }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004098 break;
4099
4100 case 159:
4101
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004102 { context->symbolTable.push(); }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004103 break;
4104
4105 case 160:
4106
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004107 { context->symbolTable.pop(); }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004108 break;
4109
4110 case 161:
4111
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004112 {
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004113 if ((yyvsp[(3) - (5)].interm.intermAggregate) != 0) {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004114 (yyvsp[(3) - (5)].interm.intermAggregate)->setOp(EOpSequence);
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004115 (yyvsp[(3) - (5)].interm.intermAggregate)->setEndLine((yyvsp[(5) - (5)].lex).line);
4116 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004117 (yyval.interm.intermAggregate) = (yyvsp[(3) - (5)].interm.intermAggregate);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004118 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004119 break;
4120
4121 case 162:
4122
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004123 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004124 break;
4125
4126 case 163:
4127
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004128 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004129 break;
4130
kbr@chromium.org476541f2011-10-27 21:14:51 +00004131 case 164:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004132
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004133 { context->symbolTable.push(); }
4134 break;
4135
4136 case 165:
4137
4138 { context->symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[(2) - (2)].interm.intermNode); }
4139 break;
4140
4141 case 166:
4142
4143 { context->symbolTable.push(); }
4144 break;
4145
4146 case 167:
4147
4148 { context->symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[(2) - (2)].interm.intermNode); }
4149 break;
4150
4151 case 168:
4152
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004153 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004154 (yyval.interm.intermNode) = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004155 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004156 break;
4157
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004158 case 169:
kbr@chromium.org205fef32011-11-22 20:50:02 +00004159
4160 {
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004161 if ((yyvsp[(2) - (3)].interm.intermAggregate)) {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004162 (yyvsp[(2) - (3)].interm.intermAggregate)->setOp(EOpSequence);
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004163 (yyvsp[(2) - (3)].interm.intermAggregate)->setEndLine((yyvsp[(3) - (3)].lex).line);
4164 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004165 (yyval.interm.intermNode) = (yyvsp[(2) - (3)].interm.intermAggregate);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004166 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004167 break;
4168
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004169 case 170:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004170
4171 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004172 (yyval.interm.intermAggregate) = context->intermediate.makeAggregate((yyvsp[(1) - (1)].interm.intermNode), 0);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004173 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004174 break;
4175
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004176 case 171:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004177
kbr@chromium.org205fef32011-11-22 20:50:02 +00004178 {
4179 (yyval.interm.intermAggregate) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermAggregate), (yyvsp[(2) - (2)].interm.intermNode), 0);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004180 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004181 break;
4182
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004183 case 172:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004184
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004185 { (yyval.interm.intermNode) = 0; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004186 break;
4187
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004188 case 173:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004189
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004190 { (yyval.interm.intermNode) = static_cast<TIntermNode*>((yyvsp[(1) - (2)].interm.intermTypedNode)); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004191 break;
4192
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004193 case 174:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004194
4195 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004196 if (context->boolErrorCheck((yyvsp[(1) - (5)].lex).line, (yyvsp[(3) - (5)].interm.intermTypedNode)))
4197 context->recover();
4198 (yyval.interm.intermNode) = context->intermediate.addSelection((yyvsp[(3) - (5)].interm.intermTypedNode), (yyvsp[(5) - (5)].interm.nodePair), (yyvsp[(1) - (5)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004199 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004200 break;
4201
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004202 case 175:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004203
4204 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004205 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermNode);
4206 (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004207 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004208 break;
4209
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004210 case 176:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004211
4212 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004213 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (1)].interm.intermNode);
4214 (yyval.interm.nodePair).node2 = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004215 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004216 break;
4217
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004218 case 177:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004219
4220 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004221 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
4222 if (context->boolErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)->getLine(), (yyvsp[(1) - (1)].interm.intermTypedNode)))
4223 context->recover();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004224 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004225 break;
4226
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004227 case 178:
kbr@chromium.org205fef32011-11-22 20:50:02 +00004228
4229 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004230 TIntermNode* intermNode;
4231 if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
4232 context->recover();
4233 if (context->boolErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
4234 context->recover();
4235
4236 if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode))
4237 (yyval.interm.intermTypedNode) = (yyvsp[(4) - (4)].interm.intermTypedNode);
4238 else {
4239 context->recover();
4240 (yyval.interm.intermTypedNode) = 0;
4241 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004242 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004243 break;
4244
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004245 case 179:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004246
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004247 { context->symbolTable.push(); ++context->loopNestingLevel; }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004248 break;
4249
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004250 case 180:
kbr@chromium.org205fef32011-11-22 20:50:02 +00004251
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004252 {
4253 context->symbolTable.pop();
alokp@chromium.org52813552010-11-16 18:36:09 +00004254 (yyval.interm.intermNode) = context->intermediate.addLoop(ELoopWhile, 0, (yyvsp[(4) - (6)].interm.intermTypedNode), 0, (yyvsp[(6) - (6)].interm.intermNode), (yyvsp[(1) - (6)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004255 --context->loopNestingLevel;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004256 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004257 break;
4258
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004259 case 181:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004260
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004261 { ++context->loopNestingLevel; }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004262 break;
4263
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004264 case 182:
kbr@chromium.org205fef32011-11-22 20:50:02 +00004265
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004266 {
4267 if (context->boolErrorCheck((yyvsp[(8) - (8)].lex).line, (yyvsp[(6) - (8)].interm.intermTypedNode)))
4268 context->recover();
4269
alokp@chromium.org52813552010-11-16 18:36:09 +00004270 (yyval.interm.intermNode) = context->intermediate.addLoop(ELoopDoWhile, 0, (yyvsp[(6) - (8)].interm.intermTypedNode), 0, (yyvsp[(3) - (8)].interm.intermNode), (yyvsp[(4) - (8)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004271 --context->loopNestingLevel;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004272 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004273 break;
4274
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004275 case 183:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004276
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004277 { context->symbolTable.push(); ++context->loopNestingLevel; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004278 break;
4279
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004280 case 184:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004281
4282 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004283 context->symbolTable.pop();
4284 (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);
4285 --context->loopNestingLevel;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004286 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004287 break;
4288
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004289 case 185:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004290
4291 {
kbr@chromium.org476541f2011-10-27 21:14:51 +00004292 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004293 }
zmo@google.com09c323a2011-08-12 18:22:25 +00004294 break;
4295
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004296 case 186:
zmo@google.com09c323a2011-08-12 18:22:25 +00004297
4298 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004299 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004300 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004301 break;
4302
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004303 case 187:
kbr@chromium.org476541f2011-10-27 21:14:51 +00004304
4305 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004306 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004307 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004308 break;
4309
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004310 case 188:
kbr@chromium.org476541f2011-10-27 21:14:51 +00004311
4312 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004313 (yyval.interm.intermTypedNode) = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004314 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004315 break;
4316
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004317 case 189:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004318
4319 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004320 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (2)].interm.intermTypedNode);
4321 (yyval.interm.nodePair).node2 = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004322 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004323 break;
4324
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004325 case 190:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004326
4327 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004328 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermTypedNode);
4329 (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004330 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004331 break;
4332
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004333 case 191:
kbr@chromium.org205fef32011-11-22 20:50:02 +00004334
4335 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004336 if (context->loopNestingLevel <= 0) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00004337 context->error((yyvsp[(1) - (2)].lex).line, "continue statement only allowed in loops", "");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004338 context->recover();
4339 }
4340 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpContinue, (yyvsp[(1) - (2)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004341 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004342 break;
4343
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004344 case 192:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004345
4346 {
4347 if (context->loopNestingLevel <= 0) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00004348 context->error((yyvsp[(1) - (2)].lex).line, "break statement only allowed in loops", "");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004349 context->recover();
4350 }
4351 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpBreak, (yyvsp[(1) - (2)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004352 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004353 break;
4354
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004355 case 193:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004356
4357 {
4358 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(1) - (2)].lex).line);
4359 if (context->currentFunctionType->getBasicType() != EbtVoid) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00004360 context->error((yyvsp[(1) - (2)].lex).line, "non-void function must return a value", "return");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004361 context->recover();
4362 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004363 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004364 break;
4365
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004366 case 194:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004367
4368 {
4369 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(2) - (3)].interm.intermTypedNode), (yyvsp[(1) - (3)].lex).line);
4370 context->functionReturnsValue = true;
4371 if (context->currentFunctionType->getBasicType() == EbtVoid) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00004372 context->error((yyvsp[(1) - (3)].lex).line, "void function cannot return a value", "return");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004373 context->recover();
4374 } else if (*(context->currentFunctionType) != (yyvsp[(2) - (3)].interm.intermTypedNode)->getType()) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00004375 context->error((yyvsp[(1) - (3)].lex).line, "function return is not matching type:", "return");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004376 context->recover();
4377 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004378 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004379 break;
4380
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004381 case 195:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004382
4383 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004384 FRAG_ONLY("discard", (yyvsp[(1) - (2)].lex).line);
4385 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpKill, (yyvsp[(1) - (2)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004386 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004387 break;
4388
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004389 case 196:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004390
4391 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004392 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
zmo@google.com09c323a2011-08-12 18:22:25 +00004393 context->treeRoot = (yyval.interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004394 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004395 break;
4396
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004397 case 197:
zmo@google.com09c323a2011-08-12 18:22:25 +00004398
4399 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004400 (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermNode), (yyvsp[(2) - (2)].interm.intermNode), 0);
4401 context->treeRoot = (yyval.interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004402 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004403 break;
4404
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004405 case 198:
kbr@chromium.org476541f2011-10-27 21:14:51 +00004406
4407 {
4408 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004409 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004410 break;
4411
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004412 case 199:
kbr@chromium.org476541f2011-10-27 21:14:51 +00004413
4414 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004415 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004416 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004417 break;
4418
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004419 case 200:
kbr@chromium.org205fef32011-11-22 20:50:02 +00004420
4421 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004422 TFunction* function = (yyvsp[(1) - (1)].interm).function;
daniel@transgaming.coma8833e92012-07-11 20:37:16 +00004423
4424 const TSymbol *builtIn = context->symbolTable.findBuiltIn(function->getMangledName());
4425
4426 if (builtIn)
4427 {
4428 context->error((yyvsp[(1) - (1)].interm).line, "built-in functions cannot be redefined", function->getName().c_str());
4429 context->recover();
4430 }
4431
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004432 TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find(function->getMangledName()));
4433 //
4434 // Note: 'prevDec' could be 'function' if this is the first time we've seen function
4435 // as it would have just been put in the symbol table. Otherwise, we're looking up
4436 // an earlier occurance.
4437 //
4438 if (prevDec->isDefined()) {
4439 //
4440 // Then this function already has a body.
4441 //
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00004442 context->error((yyvsp[(1) - (1)].interm).line, "function already has a body", function->getName().c_str());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004443 context->recover();
4444 }
4445 prevDec->setDefined();
4446
4447 //
4448 // Raise error message if main function takes any parameters or return anything other than void
4449 //
4450 if (function->getName() == "main") {
4451 if (function->getParamCount() > 0) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00004452 context->error((yyvsp[(1) - (1)].interm).line, "function cannot take any parameter(s)", function->getName().c_str());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004453 context->recover();
4454 }
4455 if (function->getReturnType().getBasicType() != EbtVoid) {
4456 context->error((yyvsp[(1) - (1)].interm).line, "", function->getReturnType().getBasicString(), "main function cannot return a value");
4457 context->recover();
4458 }
4459 }
4460
4461 //
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004462 // Remember the return type for later checking for RETURN statements.
4463 //
4464 context->currentFunctionType = &(prevDec->getReturnType());
4465 context->functionReturnsValue = false;
4466
4467 //
4468 // Insert parameters into the symbol table.
4469 // If the parameter has no name, it's not an error, just don't insert it
4470 // (could be used for unused args).
4471 //
4472 // Also, accumulate the list of parameters into the HIL, so lower level code
4473 // knows where to find parameters.
4474 //
4475 TIntermAggregate* paramNodes = new TIntermAggregate;
4476 for (int i = 0; i < function->getParamCount(); i++) {
4477 const TParameter& param = function->getParam(i);
4478 if (param.name != 0) {
4479 TVariable *variable = new TVariable(param.name, *param.type);
4480 //
4481 // Insert the parameters with name in the symbol table.
4482 //
4483 if (! context->symbolTable.insert(*variable)) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00004484 context->error((yyvsp[(1) - (1)].interm).line, "redefinition", variable->getName().c_str());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004485 context->recover();
4486 delete variable;
4487 }
4488
4489 //
4490 // Add the parameter to the HIL
4491 //
4492 paramNodes = context->intermediate.growAggregate(
4493 paramNodes,
4494 context->intermediate.addSymbol(variable->getUniqueId(),
4495 variable->getName(),
4496 variable->getType(), (yyvsp[(1) - (1)].interm).line),
4497 (yyvsp[(1) - (1)].interm).line);
4498 } else {
4499 paramNodes = context->intermediate.growAggregate(paramNodes, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (1)].interm).line), (yyvsp[(1) - (1)].interm).line);
4500 }
4501 }
4502 context->intermediate.setAggregateOperator(paramNodes, EOpParameters, (yyvsp[(1) - (1)].interm).line);
4503 (yyvsp[(1) - (1)].interm).intermAggregate = paramNodes;
4504 context->loopNestingLevel = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004505 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004506 break;
4507
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004508 case 201:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004509
4510 {
4511 //?? Check that all paths return a value if return type != void ?
4512 // May be best done as post process phase on intermediate code
4513 if (context->currentFunctionType->getBasicType() != EbtVoid && ! context->functionReturnsValue) {
4514 context->error((yyvsp[(1) - (3)].interm).line, "function does not return a value:", "", (yyvsp[(1) - (3)].interm).function->getName().c_str());
4515 context->recover();
4516 }
daniel@transgaming.com5dd6d092012-03-20 20:10:28 +00004517
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004518 (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermAggregate, (yyvsp[(3) - (3)].interm.intermNode), 0);
4519 context->intermediate.setAggregateOperator((yyval.interm.intermNode), EOpFunction, (yyvsp[(1) - (3)].interm).line);
4520 (yyval.interm.intermNode)->getAsAggregate()->setName((yyvsp[(1) - (3)].interm).function->getMangledName().c_str());
4521 (yyval.interm.intermNode)->getAsAggregate()->setType((yyvsp[(1) - (3)].interm).function->getReturnType());
4522
4523 // store the pragma information for debug and optimize and other vendor specific
4524 // information. This information can be queried from the parse tree
alokp@chromium.org8b851c62012-06-15 16:25:11 +00004525 (yyval.interm.intermNode)->getAsAggregate()->setOptimize(context->pragma().optimize);
4526 (yyval.interm.intermNode)->getAsAggregate()->setDebug(context->pragma().debug);
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004527
4528 if ((yyvsp[(3) - (3)].interm.intermNode) && (yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate())
4529 (yyval.interm.intermNode)->getAsAggregate()->setEndLine((yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate()->getEndLine());
daniel@transgaming.com5dd6d092012-03-20 20:10:28 +00004530
4531 context->symbolTable.pop();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004532 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004533 break;
4534
4535
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004536
4537 default: break;
4538 }
4539 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
4540
4541 YYPOPSTACK (yylen);
4542 yylen = 0;
4543 YY_STACK_PRINT (yyss, yyssp);
4544
4545 *++yyvsp = yyval;
4546
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004547 /* Now `shift' the result of the reduction. Determine what state
4548 that goes to, based on the state we popped back to and the rule
4549 number reduced by. */
4550
4551 yyn = yyr1[yyn];
4552
4553 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
4554 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
4555 yystate = yytable[yystate];
4556 else
4557 yystate = yydefgoto[yyn - YYNTOKENS];
4558
4559 goto yynewstate;
4560
4561
4562/*------------------------------------.
4563| yyerrlab -- here on detecting error |
4564`------------------------------------*/
4565yyerrlab:
4566 /* If not already recovering from an error, report this error. */
4567 if (!yyerrstatus)
4568 {
4569 ++yynerrs;
4570#if ! YYERROR_VERBOSE
4571 yyerror (context, YY_("syntax error"));
4572#else
4573 {
4574 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
4575 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
4576 {
4577 YYSIZE_T yyalloc = 2 * yysize;
4578 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
4579 yyalloc = YYSTACK_ALLOC_MAXIMUM;
4580 if (yymsg != yymsgbuf)
4581 YYSTACK_FREE (yymsg);
4582 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
4583 if (yymsg)
4584 yymsg_alloc = yyalloc;
4585 else
4586 {
4587 yymsg = yymsgbuf;
4588 yymsg_alloc = sizeof yymsgbuf;
4589 }
4590 }
4591
4592 if (0 < yysize && yysize <= yymsg_alloc)
4593 {
4594 (void) yysyntax_error (yymsg, yystate, yychar);
4595 yyerror (context, yymsg);
4596 }
4597 else
4598 {
4599 yyerror (context, YY_("syntax error"));
4600 if (yysize != 0)
4601 goto yyexhaustedlab;
4602 }
4603 }
4604#endif
4605 }
4606
4607
4608
4609 if (yyerrstatus == 3)
4610 {
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004611 /* If just tried and failed to reuse lookahead token after an
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004612 error, discard it. */
4613
4614 if (yychar <= YYEOF)
4615 {
4616 /* Return failure if at end of input. */
4617 if (yychar == YYEOF)
4618 YYABORT;
4619 }
4620 else
4621 {
4622 yydestruct ("Error: discarding",
4623 yytoken, &yylval, context);
4624 yychar = YYEMPTY;
4625 }
4626 }
4627
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004628 /* Else will try to reuse lookahead token after shifting the error
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004629 token. */
4630 goto yyerrlab1;
4631
4632
4633/*---------------------------------------------------.
4634| yyerrorlab -- error raised explicitly by YYERROR. |
4635`---------------------------------------------------*/
4636yyerrorlab:
4637
4638 /* Pacify compilers like GCC when the user code never invokes
4639 YYERROR and the label yyerrorlab therefore never appears in user
4640 code. */
4641 if (/*CONSTCOND*/ 0)
4642 goto yyerrorlab;
4643
4644 /* Do not reclaim the symbols of the rule which action triggered
4645 this YYERROR. */
4646 YYPOPSTACK (yylen);
4647 yylen = 0;
4648 YY_STACK_PRINT (yyss, yyssp);
4649 yystate = *yyssp;
4650 goto yyerrlab1;
4651
4652
4653/*-------------------------------------------------------------.
4654| yyerrlab1 -- common code for both syntax error and YYERROR. |
4655`-------------------------------------------------------------*/
4656yyerrlab1:
4657 yyerrstatus = 3; /* Each real token shifted decrements this. */
4658
4659 for (;;)
4660 {
4661 yyn = yypact[yystate];
4662 if (yyn != YYPACT_NINF)
4663 {
4664 yyn += YYTERROR;
4665 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
4666 {
4667 yyn = yytable[yyn];
4668 if (0 < yyn)
4669 break;
4670 }
4671 }
4672
4673 /* Pop the current state because it cannot handle the error token. */
4674 if (yyssp == yyss)
4675 YYABORT;
4676
4677
4678 yydestruct ("Error: popping",
4679 yystos[yystate], yyvsp, context);
4680 YYPOPSTACK (1);
4681 yystate = *yyssp;
4682 YY_STACK_PRINT (yyss, yyssp);
4683 }
4684
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004685 *++yyvsp = yylval;
4686
4687
4688 /* Shift the error token. */
4689 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
4690
4691 yystate = yyn;
4692 goto yynewstate;
4693
4694
4695/*-------------------------------------.
4696| yyacceptlab -- YYACCEPT comes here. |
4697`-------------------------------------*/
4698yyacceptlab:
4699 yyresult = 0;
4700 goto yyreturn;
4701
4702/*-----------------------------------.
4703| yyabortlab -- YYABORT comes here. |
4704`-----------------------------------*/
4705yyabortlab:
4706 yyresult = 1;
4707 goto yyreturn;
4708
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004709#if !defined(yyoverflow) || YYERROR_VERBOSE
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004710/*-------------------------------------------------.
4711| yyexhaustedlab -- memory exhaustion comes here. |
4712`-------------------------------------------------*/
4713yyexhaustedlab:
4714 yyerror (context, YY_("memory exhausted"));
4715 yyresult = 2;
4716 /* Fall through. */
4717#endif
4718
4719yyreturn:
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004720 if (yychar != YYEMPTY)
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004721 yydestruct ("Cleanup: discarding lookahead",
4722 yytoken, &yylval, context);
4723 /* Do not reclaim the symbols of the rule which action triggered
4724 this YYABORT or YYACCEPT. */
4725 YYPOPSTACK (yylen);
4726 YY_STACK_PRINT (yyss, yyssp);
4727 while (yyssp != yyss)
4728 {
4729 yydestruct ("Cleanup: popping",
4730 yystos[*yyssp], yyvsp, context);
4731 YYPOPSTACK (1);
4732 }
4733#ifndef yyoverflow
4734 if (yyss != yyssa)
4735 YYSTACK_FREE (yyss);
4736#endif
4737#if YYERROR_VERBOSE
4738 if (yymsg != yymsgbuf)
4739 YYSTACK_FREE (yymsg);
4740#endif
4741 /* Make sure YYID is used. */
4742 return YYID (yyresult);
4743}
4744
4745
4746
4747
4748
4749int glslang_parse(TParseContext* context) {
4750 return yyparse(context);
4751}
4752
4753