blob: d58536d073d1a45fd9bf524dea06a44b3c8bf30f [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,
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +0000661 314, 317, 426, 436, 449, 457, 557, 560, 568, 572,
662 579, 583, 590, 596, 605, 613, 668, 675, 685, 688,
663 698, 708, 729, 730, 731, 736, 737, 746, 758, 759,
664 767, 778, 782, 783, 793, 803, 813, 826, 827, 837,
665 850, 854, 858, 862, 863, 876, 877, 890, 891, 904,
666 905, 922, 923, 936, 937, 938, 939, 940, 944, 947,
667 958, 966, 993, 998, 1005, 1043, 1046, 1053, 1061, 1082,
668 1103, 1114, 1143, 1148, 1158, 1163, 1173, 1176, 1179, 1182,
669 1188, 1195, 1198, 1220, 1238, 1262, 1285, 1289, 1307, 1315,
670 1347, 1367, 1456, 1465, 1488, 1491, 1497, 1505, 1513, 1521,
671 1531, 1538, 1541, 1544, 1550, 1553, 1568, 1572, 1576, 1580,
672 1589, 1594, 1599, 1604, 1609, 1614, 1619, 1624, 1629, 1634,
673 1640, 1646, 1652, 1657, 1662, 1671, 1680, 1685, 1698, 1698,
674 1712, 1712, 1721, 1724, 1739, 1775, 1779, 1785, 1793, 1809,
675 1813, 1817, 1818, 1824, 1825, 1826, 1827, 1828, 1832, 1833,
676 1833, 1833, 1843, 1844, 1848, 1848, 1849, 1849, 1854, 1857,
677 1867, 1870, 1876, 1877, 1881, 1889, 1893, 1903, 1908, 1925,
678 1925, 1930, 1930, 1937, 1937, 1945, 1948, 1954, 1957, 1963,
679 1967, 1974, 1981, 1988, 1995, 2006, 2015, 2019, 2026, 2029,
680 2035, 2035
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 {
2274 if (fields.num == 1) {
2275 ConstantUnion *unionArray = new ConstantUnion[1];
2276 unionArray->setIConst(fields.offsets[0]);
2277 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line);
2278 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2279 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision()));
2280 } else {
2281 TString vectorString = *(yyvsp[(3) - (3)].lex).string;
2282 TIntermTyped* index = context->intermediate.addSwizzle(fields, (yyvsp[(3) - (3)].lex).line);
2283 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpVectorSwizzle, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2284 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (int) vectorString.size()));
2285 }
2286 }
2287 } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isMatrix()) {
2288 TMatrixFields fields;
2289 if (! context->parseMatrixFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yyvsp[(3) - (3)].lex).line)) {
2290 fields.wholeRow = false;
2291 fields.wholeCol = false;
2292 fields.row = 0;
2293 fields.col = 0;
2294 context->recover();
2295 }
2296
2297 if (fields.wholeRow || fields.wholeCol) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00002298 context->error((yyvsp[(2) - (3)].lex).line, " non-scalar fields not implemented yet", ".");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002299 context->recover();
2300 ConstantUnion *unionArray = new ConstantUnion[1];
2301 unionArray->setIConst(0);
2302 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line);
2303 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2304 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(),EvqTemporary, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize()));
2305 } else {
2306 ConstantUnion *unionArray = new ConstantUnion[1];
2307 unionArray->setIConst(fields.col * (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize() + fields.row);
2308 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line);
2309 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2310 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision()));
2311 }
2312 } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType() == EbtStruct) {
2313 bool fieldFound = false;
2314 const TTypeList* fields = (yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getStruct();
2315 if (fields == 0) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00002316 context->error((yyvsp[(2) - (3)].lex).line, "structure has no fields", "Internal Error");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002317 context->recover();
2318 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2319 } else {
2320 unsigned int i;
2321 for (i = 0; i < fields->size(); ++i) {
2322 if ((*fields)[i].type->getFieldName() == *(yyvsp[(3) - (3)].lex).string) {
2323 fieldFound = true;
2324 break;
2325 }
2326 }
2327 if (fieldFound) {
2328 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) {
2329 (yyval.interm.intermTypedNode) = context->addConstStruct(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
2330 if ((yyval.interm.intermTypedNode) == 0) {
2331 context->recover();
2332 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2333 }
2334 else {
2335 (yyval.interm.intermTypedNode)->setType(*(*fields)[i].type);
2336 // change the qualifier of the return type, not of the structure field
2337 // as the structure definition is shared between various structures.
2338 (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConst);
2339 }
2340 } else {
2341 ConstantUnion *unionArray = new ConstantUnion[1];
2342 unionArray->setIConst(i);
2343 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, *(*fields)[i].type, (yyvsp[(3) - (3)].lex).line);
2344 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirectStruct, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2345 (yyval.interm.intermTypedNode)->setType(*(*fields)[i].type);
2346 }
2347 } else {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00002348 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 +00002349 context->recover();
2350 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2351 }
2352 }
2353 } else {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00002354 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 +00002355 context->recover();
2356 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2357 }
2358 // don't delete $3.string, it's from the pool
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002359 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002360 break;
2361
2362 case 12:
2363
2364 {
2365 if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode)))
2366 context->recover();
2367 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostIncrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line, context->symbolTable);
2368 if ((yyval.interm.intermTypedNode) == 0) {
2369 context->unaryOpError((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
2370 context->recover();
2371 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode);
2372 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002373 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002374 break;
2375
2376 case 13:
2377
2378 {
2379 if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode)))
2380 context->recover();
2381 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostDecrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line, context->symbolTable);
2382 if ((yyval.interm.intermTypedNode) == 0) {
2383 context->unaryOpError((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
2384 context->recover();
2385 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode);
2386 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002387 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002388 break;
2389
2390 case 14:
2391
2392 {
2393 if (context->integerErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode), "[]"))
2394 context->recover();
2395 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002396 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002397 break;
2398
2399 case 15:
2400
2401 {
2402 TFunction* fnCall = (yyvsp[(1) - (1)].interm).function;
2403 TOperator op = fnCall->getBuiltInOp();
2404
2405 if (op != EOpNull)
2406 {
2407 //
2408 // Then this should be a constructor.
2409 // Don't go through the symbol table for constructors.
2410 // Their parameters will be verified algorithmically.
2411 //
2412 TType type(EbtVoid, EbpUndefined); // use this to get the type back
2413 if (context->constructorErrorCheck((yyvsp[(1) - (1)].interm).line, (yyvsp[(1) - (1)].interm).intermNode, *fnCall, op, &type)) {
2414 (yyval.interm.intermTypedNode) = 0;
2415 } else {
2416 //
2417 // It's a constructor, of type 'type'.
2418 //
2419 (yyval.interm.intermTypedNode) = context->addConstructor((yyvsp[(1) - (1)].interm).intermNode, &type, op, fnCall, (yyvsp[(1) - (1)].interm).line);
2420 }
2421
2422 if ((yyval.interm.intermTypedNode) == 0) {
2423 context->recover();
2424 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator(0, op, (yyvsp[(1) - (1)].interm).line);
2425 }
2426 (yyval.interm.intermTypedNode)->setType(type);
2427 } else {
2428 //
2429 // Not a constructor. Find it in the symbol table.
2430 //
2431 const TFunction* fnCandidate;
2432 bool builtIn;
2433 fnCandidate = context->findFunction((yyvsp[(1) - (1)].interm).line, fnCall, &builtIn);
2434 if (fnCandidate) {
2435 //
2436 // A declared function.
2437 //
2438 if (builtIn && !fnCandidate->getExtension().empty() &&
2439 context->extensionErrorCheck((yyvsp[(1) - (1)].interm).line, fnCandidate->getExtension())) {
2440 context->recover();
2441 }
2442 op = fnCandidate->getBuiltInOp();
2443 if (builtIn && op != EOpNull) {
2444 //
2445 // A function call mapped to a built-in operation.
2446 //
2447 if (fnCandidate->getParamCount() == 1) {
2448 //
2449 // Treat it like a built-in unary operator.
2450 //
2451 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(op, (yyvsp[(1) - (1)].interm).intermNode, 0, context->symbolTable);
2452 if ((yyval.interm.intermTypedNode) == 0) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00002453 std::stringstream extraInfoStream;
2454 extraInfoStream << "built in unary operator function. Type: " << static_cast<TIntermTyped*>((yyvsp[(1) - (1)].interm).intermNode)->getCompleteString();
2455 std::string extraInfo = extraInfoStream.str();
2456 context->error((yyvsp[(1) - (1)].interm).intermNode->getLine(), " wrong operand type", "Internal Error", extraInfo.c_str());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002457 YYERROR;
2458 }
2459 } else {
2460 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, op, (yyvsp[(1) - (1)].interm).line);
2461 }
2462 } else {
2463 // This is a real function call
2464
2465 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, EOpFunctionCall, (yyvsp[(1) - (1)].interm).line);
2466 (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType());
2467
2468 // this is how we know whether the given function is a builtIn function or a user defined function
2469 // if builtIn == false, it's a userDefined -> could be an overloaded builtIn function also
2470 // if builtIn == true, it's definitely a builtIn function with EOpNull
2471 if (!builtIn)
2472 (yyval.interm.intermTypedNode)->getAsAggregate()->setUserDefined();
2473 (yyval.interm.intermTypedNode)->getAsAggregate()->setName(fnCandidate->getMangledName());
2474
2475 TQualifier qual;
2476 for (int i = 0; i < fnCandidate->getParamCount(); ++i) {
2477 qual = fnCandidate->getParam(i).type->getQualifier();
2478 if (qual == EvqOut || qual == EvqInOut) {
2479 if (context->lValueErrorCheck((yyval.interm.intermTypedNode)->getLine(), "assign", (yyval.interm.intermTypedNode)->getAsAggregate()->getSequence()[i]->getAsTyped())) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00002480 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 +00002481 context->recover();
2482 }
2483 }
2484 }
2485 }
2486 (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType());
2487 } else {
2488 // error message was put out by PaFindFunction()
2489 // Put on a dummy node for error recovery
2490 ConstantUnion *unionArray = new ConstantUnion[1];
2491 unionArray->setFConst(0.0f);
2492 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].interm).line);
2493 context->recover();
2494 }
2495 }
2496 delete fnCall;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002497 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002498 break;
2499
2500 case 16:
2501
2502 {
2503 (yyval.interm) = (yyvsp[(1) - (1)].interm);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002504 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002505 break;
2506
2507 case 17:
2508
2509 {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00002510 context->error((yyvsp[(3) - (3)].interm).line, "methods are not supported", "");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002511 context->recover();
2512 (yyval.interm) = (yyvsp[(3) - (3)].interm);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002513 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002514 break;
2515
2516 case 18:
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 19:
2525
2526 {
2527 (yyval.interm) = (yyvsp[(1) - (2)].interm);
2528 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002529 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002530 break;
2531
2532 case 20:
2533
2534 {
2535 (yyval.interm).function = (yyvsp[(1) - (2)].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 21:
2541
2542 {
2543 (yyval.interm).function = (yyvsp[(1) - (1)].interm.function);
2544 (yyval.interm).intermNode = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002545 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002546 break;
2547
2548 case 22:
2549
2550 {
2551 TParameter param = { 0, new TType((yyvsp[(2) - (2)].interm.intermTypedNode)->getType()) };
2552 (yyvsp[(1) - (2)].interm.function)->addParameter(param);
2553 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
2554 (yyval.interm).intermNode = (yyvsp[(2) - (2)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002555 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002556 break;
2557
2558 case 23:
2559
2560 {
2561 TParameter param = { 0, new TType((yyvsp[(3) - (3)].interm.intermTypedNode)->getType()) };
2562 (yyvsp[(1) - (3)].interm).function->addParameter(param);
2563 (yyval.interm).function = (yyvsp[(1) - (3)].interm).function;
2564 (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 +00002565 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002566 break;
2567
2568 case 24:
2569
2570 {
2571 (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002572 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002573 break;
2574
2575 case 25:
2576
2577 {
2578 //
2579 // Constructor
2580 //
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002581 TOperator op = EOpNull;
2582 if ((yyvsp[(1) - (1)].interm.type).userDef) {
2583 op = EOpConstructStruct;
2584 } else {
2585 switch ((yyvsp[(1) - (1)].interm.type).type) {
2586 case EbtFloat:
2587 if ((yyvsp[(1) - (1)].interm.type).matrix) {
2588 switch((yyvsp[(1) - (1)].interm.type).size) {
2589 case 2: op = EOpConstructMat2; break;
2590 case 3: op = EOpConstructMat3; break;
2591 case 4: op = EOpConstructMat4; break;
2592 }
2593 } else {
2594 switch((yyvsp[(1) - (1)].interm.type).size) {
2595 case 1: op = EOpConstructFloat; break;
2596 case 2: op = EOpConstructVec2; break;
2597 case 3: op = EOpConstructVec3; break;
2598 case 4: op = EOpConstructVec4; break;
2599 }
2600 }
2601 break;
2602 case EbtInt:
2603 switch((yyvsp[(1) - (1)].interm.type).size) {
2604 case 1: op = EOpConstructInt; break;
2605 case 2: FRAG_VERT_ONLY("ivec2", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec2; break;
2606 case 3: FRAG_VERT_ONLY("ivec3", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec3; break;
2607 case 4: FRAG_VERT_ONLY("ivec4", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec4; break;
2608 }
2609 break;
2610 case EbtBool:
2611 switch((yyvsp[(1) - (1)].interm.type).size) {
2612 case 1: op = EOpConstructBool; break;
2613 case 2: FRAG_VERT_ONLY("bvec2", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec2; break;
2614 case 3: FRAG_VERT_ONLY("bvec3", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec3; break;
2615 case 4: FRAG_VERT_ONLY("bvec4", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec4; break;
2616 }
2617 break;
2618 default: break;
2619 }
2620 if (op == EOpNull) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00002621 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 +00002622 context->recover();
2623 (yyvsp[(1) - (1)].interm.type).type = EbtFloat;
2624 op = EOpConstructFloat;
2625 }
2626 }
2627 TString tempString;
2628 TType type((yyvsp[(1) - (1)].interm.type));
2629 TFunction *function = new TFunction(&tempString, type, op);
2630 (yyval.interm.function) = function;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002631 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002632 break;
2633
2634 case 26:
2635
2636 {
2637 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
2638 context->recover();
2639 TType type(EbtVoid, EbpUndefined);
2640 TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type);
2641 (yyval.interm.function) = function;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002642 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002643 break;
2644
2645 case 27:
2646
2647 {
2648 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
2649 context->recover();
2650 TType type(EbtVoid, EbpUndefined);
2651 TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type);
2652 (yyval.interm.function) = function;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002653 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002654 break;
2655
2656 case 28:
2657
2658 {
2659 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002660 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002661 break;
2662
2663 case 29:
2664
2665 {
2666 if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)))
2667 context->recover();
2668 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreIncrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line, context->symbolTable);
2669 if ((yyval.interm.intermTypedNode) == 0) {
2670 context->unaryOpError((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2671 context->recover();
2672 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2673 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002674 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002675 break;
2676
2677 case 30:
2678
2679 {
2680 if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)))
2681 context->recover();
2682 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreDecrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line, context->symbolTable);
2683 if ((yyval.interm.intermTypedNode) == 0) {
2684 context->unaryOpError((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2685 context->recover();
2686 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2687 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002688 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002689 break;
2690
2691 case 31:
2692
2693 {
2694 if ((yyvsp[(1) - (2)].interm).op != EOpNull) {
2695 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath((yyvsp[(1) - (2)].interm).op, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].interm).line, context->symbolTable);
2696 if ((yyval.interm.intermTypedNode) == 0) {
2697 const char* errorOp = "";
2698 switch((yyvsp[(1) - (2)].interm).op) {
2699 case EOpNegative: errorOp = "-"; break;
2700 case EOpLogicalNot: errorOp = "!"; break;
2701 default: break;
2702 }
2703 context->unaryOpError((yyvsp[(1) - (2)].interm).line, errorOp, (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2704 context->recover();
2705 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2706 }
2707 } else
2708 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002709 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002710 break;
2711
2712 case 32:
2713
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002714 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNull; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002715 break;
2716
2717 case 33:
2718
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002719 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNegative; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002720 break;
2721
2722 case 34:
2723
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002724 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpLogicalNot; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002725 break;
2726
2727 case 35:
2728
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002729 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002730 break;
2731
2732 case 36:
2733
2734 {
2735 FRAG_VERT_ONLY("*", (yyvsp[(2) - (3)].lex).line);
2736 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpMul, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2737 if ((yyval.interm.intermTypedNode) == 0) {
2738 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "*", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2739 context->recover();
2740 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2741 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002742 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002743 break;
2744
2745 case 37:
2746
2747 {
2748 FRAG_VERT_ONLY("/", (yyvsp[(2) - (3)].lex).line);
2749 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpDiv, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2750 if ((yyval.interm.intermTypedNode) == 0) {
2751 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "/", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2752 context->recover();
2753 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2754 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002755 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002756 break;
2757
2758 case 38:
2759
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002760 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002761 break;
2762
2763 case 39:
2764
2765 {
2766 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpAdd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2767 if ((yyval.interm.intermTypedNode) == 0) {
2768 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "+", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2769 context->recover();
2770 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2771 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002772 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002773 break;
2774
2775 case 40:
2776
2777 {
2778 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpSub, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2779 if ((yyval.interm.intermTypedNode) == 0) {
2780 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "-", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2781 context->recover();
2782 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2783 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002784 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002785 break;
2786
2787 case 41:
2788
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002789 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002790 break;
2791
2792 case 42:
2793
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002794 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002795 break;
2796
2797 case 43:
2798
2799 {
2800 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2801 if ((yyval.interm.intermTypedNode) == 0) {
2802 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2803 context->recover();
2804 ConstantUnion *unionArray = new ConstantUnion[1];
2805 unionArray->setBConst(false);
2806 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2807 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002808 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002809 break;
2810
2811 case 44:
2812
2813 {
2814 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2815 if ((yyval.interm.intermTypedNode) == 0) {
2816 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2817 context->recover();
2818 ConstantUnion *unionArray = new ConstantUnion[1];
2819 unionArray->setBConst(false);
2820 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2821 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002822 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002823 break;
2824
2825 case 45:
2826
2827 {
2828 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2829 if ((yyval.interm.intermTypedNode) == 0) {
2830 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2831 context->recover();
2832 ConstantUnion *unionArray = new ConstantUnion[1];
2833 unionArray->setBConst(false);
2834 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2835 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002836 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002837 break;
2838
2839 case 46:
2840
2841 {
2842 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2843 if ((yyval.interm.intermTypedNode) == 0) {
2844 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2845 context->recover();
2846 ConstantUnion *unionArray = new ConstantUnion[1];
2847 unionArray->setBConst(false);
2848 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2849 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002850 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002851 break;
2852
2853 case 47:
2854
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002855 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002856 break;
2857
2858 case 48:
2859
2860 {
2861 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2862 if ((yyval.interm.intermTypedNode) == 0) {
2863 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "==", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2864 context->recover();
2865 ConstantUnion *unionArray = new ConstantUnion[1];
2866 unionArray->setBConst(false);
2867 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2868 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002869 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002870 break;
2871
2872 case 49:
2873
2874 {
2875 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpNotEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2876 if ((yyval.interm.intermTypedNode) == 0) {
2877 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "!=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2878 context->recover();
2879 ConstantUnion *unionArray = new ConstantUnion[1];
2880 unionArray->setBConst(false);
2881 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2882 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002883 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002884 break;
2885
2886 case 50:
2887
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002888 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002889 break;
2890
2891 case 51:
2892
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002893 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002894 break;
2895
2896 case 52:
2897
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002898 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002899 break;
2900
2901 case 53:
2902
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002903 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002904 break;
2905
2906 case 54:
2907
2908 {
2909 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalAnd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2910 if ((yyval.interm.intermTypedNode) == 0) {
2911 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "&&", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2912 context->recover();
2913 ConstantUnion *unionArray = new ConstantUnion[1];
2914 unionArray->setBConst(false);
2915 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2916 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002917 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002918 break;
2919
2920 case 55:
2921
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002922 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002923 break;
2924
2925 case 56:
2926
2927 {
2928 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalXor, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2929 if ((yyval.interm.intermTypedNode) == 0) {
2930 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "^^", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2931 context->recover();
2932 ConstantUnion *unionArray = new ConstantUnion[1];
2933 unionArray->setBConst(false);
2934 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2935 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002936 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002937 break;
2938
2939 case 57:
2940
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002941 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002942 break;
2943
2944 case 58:
2945
2946 {
2947 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalOr, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2948 if ((yyval.interm.intermTypedNode) == 0) {
2949 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "||", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2950 context->recover();
2951 ConstantUnion *unionArray = new ConstantUnion[1];
2952 unionArray->setBConst(false);
2953 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2954 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002955 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002956 break;
2957
2958 case 59:
2959
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002960 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002961 break;
2962
2963 case 60:
2964
2965 {
2966 if (context->boolErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.intermTypedNode)))
2967 context->recover();
2968
2969 (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);
2970 if ((yyvsp[(3) - (5)].interm.intermTypedNode)->getType() != (yyvsp[(5) - (5)].interm.intermTypedNode)->getType())
2971 (yyval.interm.intermTypedNode) = 0;
2972
2973 if ((yyval.interm.intermTypedNode) == 0) {
2974 context->binaryOpError((yyvsp[(2) - (5)].lex).line, ":", (yyvsp[(3) - (5)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(5) - (5)].interm.intermTypedNode)->getCompleteString());
2975 context->recover();
2976 (yyval.interm.intermTypedNode) = (yyvsp[(5) - (5)].interm.intermTypedNode);
2977 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002978 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002979 break;
2980
2981 case 61:
2982
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002983 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002984 break;
2985
2986 case 62:
2987
2988 {
2989 if (context->lValueErrorCheck((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)))
2990 context->recover();
2991 (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);
2992 if ((yyval.interm.intermTypedNode) == 0) {
2993 context->assignError((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2994 context->recover();
2995 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2996 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002997 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002998 break;
2999
3000 case 63:
3001
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003002 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAssign; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003003 break;
3004
3005 case 64:
3006
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003007 { 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 +00003008 break;
3009
3010 case 65:
3011
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003012 { 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 +00003013 break;
3014
3015 case 66:
3016
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003017 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAddAssign; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003018 break;
3019
3020 case 67:
3021
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003022 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpSubAssign; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003023 break;
3024
3025 case 68:
3026
3027 {
3028 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003029 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003030 break;
3031
3032 case 69:
3033
3034 {
3035 (yyval.interm.intermTypedNode) = context->intermediate.addComma((yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
3036 if ((yyval.interm.intermTypedNode) == 0) {
3037 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ",", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3038 context->recover();
3039 (yyval.interm.intermTypedNode) = (yyvsp[(3) - (3)].interm.intermTypedNode);
3040 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003041 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003042 break;
3043
3044 case 70:
3045
3046 {
3047 if (context->constErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)))
3048 context->recover();
3049 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003050 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003051 break;
3052
3053 case 71:
3054
3055 {
3056 TFunction &function = *((yyvsp[(1) - (2)].interm).function);
3057
3058 TIntermAggregate *prototype = new TIntermAggregate;
3059 prototype->setType(function.getReturnType());
3060 prototype->setName(function.getName());
3061
3062 for (int i = 0; i < function.getParamCount(); i++)
3063 {
3064 const TParameter &param = function.getParam(i);
3065 if (param.name != 0)
3066 {
3067 TVariable *variable = new TVariable(param.name, *param.type);
3068
3069 prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(variable->getUniqueId(), variable->getName(), variable->getType(), (yyvsp[(1) - (2)].interm).line), (yyvsp[(1) - (2)].interm).line);
3070 }
3071 else
3072 {
3073 prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (2)].interm).line), (yyvsp[(1) - (2)].interm).line);
3074 }
3075 }
3076
3077 prototype->setOp(EOpPrototype);
3078 (yyval.interm.intermNode) = prototype;
daniel@transgaming.com5dd6d092012-03-20 20:10:28 +00003079
3080 context->symbolTable.pop();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003081 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003082 break;
3083
3084 case 72:
3085
3086 {
3087 if ((yyvsp[(1) - (2)].interm).intermAggregate)
3088 (yyvsp[(1) - (2)].interm).intermAggregate->setOp(EOpDeclaration);
3089 (yyval.interm.intermNode) = (yyvsp[(1) - (2)].interm).intermAggregate;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003090 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003091 break;
3092
3093 case 73:
3094
3095 {
3096 context->symbolTable.setDefaultPrecision( (yyvsp[(3) - (4)].interm.type).type, (yyvsp[(2) - (4)].interm.precision) );
3097 (yyval.interm.intermNode) = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003098 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003099 break;
3100
3101 case 74:
3102
3103 {
3104 //
3105 // Multiple declarations of the same function are allowed.
3106 //
3107 // If this is a definition, the definition production code will check for redefinitions
3108 // (we don't know at this point if it's a definition or not).
3109 //
3110 // Redeclarations are allowed. But, return types and parameter qualifiers must match.
3111 //
3112 TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find((yyvsp[(1) - (2)].interm.function)->getMangledName()));
3113 if (prevDec) {
3114 if (prevDec->getReturnType() != (yyvsp[(1) - (2)].interm.function)->getReturnType()) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003115 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 +00003116 context->recover();
3117 }
3118 for (int i = 0; i < prevDec->getParamCount(); ++i) {
3119 if (prevDec->getParam(i).type->getQualifier() != (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifier()) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003120 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 +00003121 context->recover();
3122 }
3123 }
3124 }
3125
3126 //
3127 // If this is a redeclaration, it could also be a definition,
3128 // in which case, we want to use the variable names from this one, and not the one that's
3129 // being redeclared. So, pass back up this declaration, not the one in the symbol table.
3130 //
3131 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
3132 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
3133
daniel@transgaming.com5dd6d092012-03-20 20:10:28 +00003134 // We're at the inner scope level of the function's arguments and body statement.
3135 // Add the function prototype to the surrounding scope instead.
3136 context->symbolTable.getOuterLevel()->insert(*(yyval.interm).function);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003137 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003138 break;
3139
3140 case 75:
3141
3142 {
3143 (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003144 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003145 break;
3146
3147 case 76:
3148
3149 {
3150 (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003151 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003152 break;
3153
3154 case 77:
3155
3156 {
3157 // Add the parameter
3158 (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
3159 if ((yyvsp[(2) - (2)].interm).param.type->getBasicType() != EbtVoid)
3160 (yyvsp[(1) - (2)].interm.function)->addParameter((yyvsp[(2) - (2)].interm).param);
3161 else
3162 delete (yyvsp[(2) - (2)].interm).param.type;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003163 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003164 break;
3165
3166 case 78:
3167
3168 {
3169 //
3170 // Only first parameter of one-parameter functions can be void
3171 // The check for named parameters not being void is done in parameter_declarator
3172 //
3173 if ((yyvsp[(3) - (3)].interm).param.type->getBasicType() == EbtVoid) {
3174 //
3175 // This parameter > first is void
3176 //
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003177 context->error((yyvsp[(2) - (3)].lex).line, "cannot be an argument type except for '(void)'", "void");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003178 context->recover();
3179 delete (yyvsp[(3) - (3)].interm).param.type;
3180 } else {
3181 // Add the parameter
3182 (yyval.interm.function) = (yyvsp[(1) - (3)].interm.function);
3183 (yyvsp[(1) - (3)].interm.function)->addParameter((yyvsp[(3) - (3)].interm).param);
3184 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003185 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003186 break;
3187
3188 case 79:
3189
3190 {
3191 if ((yyvsp[(1) - (3)].interm.type).qualifier != EvqGlobal && (yyvsp[(1) - (3)].interm.type).qualifier != EvqTemporary) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003192 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 +00003193 context->recover();
3194 }
3195 // make sure a sampler is not involved as well...
3196 if (context->structQualifierErrorCheck((yyvsp[(2) - (3)].lex).line, (yyvsp[(1) - (3)].interm.type)))
3197 context->recover();
3198
3199 // Add the function as a prototype after parsing it (we do not support recursion)
3200 TFunction *function;
3201 TType type((yyvsp[(1) - (3)].interm.type));
3202 function = new TFunction((yyvsp[(2) - (3)].lex).string, type);
3203 (yyval.interm.function) = function;
daniel@transgaming.com5dd6d092012-03-20 20:10:28 +00003204
3205 context->symbolTable.push();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003206 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003207 break;
3208
3209 case 80:
3210
3211 {
3212 if ((yyvsp[(1) - (2)].interm.type).type == EbtVoid) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003213 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 +00003214 context->recover();
3215 }
3216 if (context->reservedErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string))
3217 context->recover();
3218 TParameter param = {(yyvsp[(2) - (2)].lex).string, new TType((yyvsp[(1) - (2)].interm.type))};
3219 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
3220 (yyval.interm).param = param;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003221 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003222 break;
3223
3224 case 81:
3225
3226 {
3227 // Check that we can make an array out of this type
3228 if (context->arrayTypeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
3229 context->recover();
3230
3231 if (context->reservedErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string))
3232 context->recover();
3233
3234 int size;
3235 if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3236 context->recover();
3237 (yyvsp[(1) - (5)].interm.type).setArray(true, size);
3238
3239 TType* type = new TType((yyvsp[(1) - (5)].interm.type));
3240 TParameter param = { (yyvsp[(2) - (5)].lex).string, type };
3241 (yyval.interm).line = (yyvsp[(2) - (5)].lex).line;
3242 (yyval.interm).param = param;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003243 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003244 break;
3245
3246 case 82:
3247
3248 {
3249 (yyval.interm) = (yyvsp[(3) - (3)].interm);
3250 if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
3251 context->recover();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003252 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003253 break;
3254
3255 case 83:
3256
3257 {
3258 (yyval.interm) = (yyvsp[(2) - (2)].interm);
3259 if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
3260 context->recover();
3261 if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
3262 context->recover();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003263 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003264 break;
3265
3266 case 84:
3267
3268 {
3269 (yyval.interm) = (yyvsp[(3) - (3)].interm);
3270 if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
3271 context->recover();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003272 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003273 break;
3274
3275 case 85:
3276
3277 {
3278 (yyval.interm) = (yyvsp[(2) - (2)].interm);
3279 if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
3280 context->recover();
3281 if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
3282 context->recover();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003283 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003284 break;
3285
3286 case 86:
3287
3288 {
3289 (yyval.interm.qualifier) = EvqIn;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003290 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003291 break;
3292
3293 case 87:
3294
3295 {
3296 (yyval.interm.qualifier) = EvqIn;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003297 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003298 break;
3299
3300 case 88:
3301
3302 {
3303 (yyval.interm.qualifier) = EvqOut;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003304 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003305 break;
3306
3307 case 89:
3308
3309 {
3310 (yyval.interm.qualifier) = EvqInOut;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003311 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003312 break;
3313
3314 case 90:
3315
3316 {
3317 TParameter param = { 0, new TType((yyvsp[(1) - (1)].interm.type)) };
3318 (yyval.interm).param = param;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003319 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003320 break;
3321
3322 case 91:
3323
3324 {
3325 (yyval.interm) = (yyvsp[(1) - (1)].interm);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003326 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003327 break;
3328
3329 case 92:
3330
3331 {
daniel@transgaming.comeec8efc2012-03-09 21:57:49 +00003332 if ((yyvsp[(1) - (3)].interm).type.type == EbtInvariant && !(yyvsp[(3) - (3)].lex).symbol)
3333 {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003334 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 +00003335 context->recover();
3336 }
3337
zmo@google.comfd747b82011-04-23 01:30:07 +00003338 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(3) - (3)].lex).string, TType((yyvsp[(1) - (3)].interm).type), (yyvsp[(3) - (3)].lex).line);
3339 (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 +00003340
3341 if (context->structQualifierErrorCheck((yyvsp[(3) - (3)].lex).line, (yyval.interm).type))
3342 context->recover();
3343
3344 if (context->nonInitConstErrorCheck((yyvsp[(3) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyval.interm).type))
3345 context->recover();
3346
zmo@google.comfd747b82011-04-23 01:30:07 +00003347 TVariable* variable = 0;
3348 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 +00003349 context->recover();
zmo@google.comfd747b82011-04-23 01:30:07 +00003350 if (symbol && variable)
3351 symbol->setId(variable->getUniqueId());
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003352 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003353 break;
3354
3355 case 93:
3356
3357 {
3358 if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
3359 context->recover();
3360
3361 if (context->nonInitConstErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type))
3362 context->recover();
3363
3364 (yyval.interm) = (yyvsp[(1) - (5)].interm);
3365
3366 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))
3367 context->recover();
3368 else {
3369 (yyvsp[(1) - (5)].interm).type.setArray(true);
3370 TVariable* variable;
3371 if (context->arrayErrorCheck((yyvsp[(4) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, variable))
3372 context->recover();
3373 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003374 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003375 break;
3376
3377 case 94:
3378
3379 {
3380 if (context->structQualifierErrorCheck((yyvsp[(3) - (6)].lex).line, (yyvsp[(1) - (6)].interm).type))
3381 context->recover();
3382
3383 if (context->nonInitConstErrorCheck((yyvsp[(3) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type))
3384 context->recover();
3385
3386 (yyval.interm) = (yyvsp[(1) - (6)].interm);
3387
3388 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))
3389 context->recover();
3390 else {
3391 int size;
3392 if (context->arraySizeErrorCheck((yyvsp[(4) - (6)].lex).line, (yyvsp[(5) - (6)].interm.intermTypedNode), size))
3393 context->recover();
3394 (yyvsp[(1) - (6)].interm).type.setArray(true, size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003395 TVariable* variable = 0;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003396 if (context->arrayErrorCheck((yyvsp[(4) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type, variable))
3397 context->recover();
3398 TType type = TType((yyvsp[(1) - (6)].interm).type);
3399 type.setArraySize(size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003400 (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 +00003401 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003402 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003403 break;
3404
3405 case 95:
3406
3407 {
3408 if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
3409 context->recover();
3410
3411 (yyval.interm) = (yyvsp[(1) - (5)].interm);
3412
3413 TIntermNode* intermNode;
3414 if (!context->executeInitializer((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, (yyvsp[(5) - (5)].interm.intermTypedNode), intermNode)) {
3415 //
3416 // build the intermediate representation
3417 //
3418 if (intermNode)
3419 (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (5)].interm).intermNode, intermNode, (yyvsp[(4) - (5)].lex).line);
3420 else
3421 (yyval.interm).intermAggregate = (yyvsp[(1) - (5)].interm).intermAggregate;
3422 } else {
3423 context->recover();
3424 (yyval.interm).intermAggregate = 0;
3425 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003426 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003427 break;
3428
3429 case 96:
3430
3431 {
3432 (yyval.interm).type = (yyvsp[(1) - (1)].interm.type);
3433 (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 +00003434 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003435 break;
3436
3437 case 97:
3438
3439 {
zmo@google.comfd747b82011-04-23 01:30:07 +00003440 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyvsp[(1) - (2)].interm.type)), (yyvsp[(2) - (2)].lex).line);
3441 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (2)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003442
3443 if (context->structQualifierErrorCheck((yyvsp[(2) - (2)].lex).line, (yyval.interm).type))
3444 context->recover();
3445
3446 if (context->nonInitConstErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string, (yyval.interm).type))
3447 context->recover();
3448
3449 (yyval.interm).type = (yyvsp[(1) - (2)].interm.type);
3450
zmo@google.comfd747b82011-04-23 01:30:07 +00003451 TVariable* variable = 0;
3452 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 +00003453 context->recover();
zmo@google.comfd747b82011-04-23 01:30:07 +00003454 if (variable && symbol)
3455 symbol->setId(variable->getUniqueId());
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003456 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003457 break;
3458
3459 case 98:
3460
3461 {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003462 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 +00003463 context->recover();
3464
zmo@google.comfd747b82011-04-23 01:30:07 +00003465 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (4)].lex).string, TType((yyvsp[(1) - (4)].interm.type)), (yyvsp[(2) - (4)].lex).line);
3466 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (4)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003467 (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003468 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003469 break;
3470
3471 case 99:
3472
3473 {
3474 TType type = TType((yyvsp[(1) - (5)].interm.type));
3475 int size;
3476 if (context->arraySizeErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3477 context->recover();
3478 type.setArraySize(size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003479 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (5)].lex).string, type, (yyvsp[(2) - (5)].lex).line);
3480 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (5)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003481
3482 if (context->structQualifierErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
3483 context->recover();
3484
3485 if (context->nonInitConstErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type)))
3486 context->recover();
3487
3488 (yyval.interm).type = (yyvsp[(1) - (5)].interm.type);
3489
3490 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)))
3491 context->recover();
3492 else {
3493 int size;
3494 if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3495 context->recover();
3496
3497 (yyvsp[(1) - (5)].interm.type).setArray(true, size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003498 TVariable* variable = 0;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003499 if (context->arrayErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type), variable))
3500 context->recover();
zmo@google.comfd747b82011-04-23 01:30:07 +00003501 if (variable && symbol)
3502 symbol->setId(variable->getUniqueId());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003503 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003504 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003505 break;
3506
3507 case 100:
3508
3509 {
3510 if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
3511 context->recover();
3512
3513 (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
3514
3515 TIntermNode* intermNode;
3516 if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode)) {
3517 //
3518 // Build intermediate representation
3519 //
3520 if(intermNode)
3521 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(intermNode, (yyvsp[(3) - (4)].lex).line);
3522 else
3523 (yyval.interm).intermAggregate = 0;
3524 } else {
3525 context->recover();
3526 (yyval.interm).intermAggregate = 0;
3527 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003528 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003529 break;
3530
3531 case 101:
3532
3533 {
3534 VERTEX_ONLY("invariant declaration", (yyvsp[(1) - (2)].lex).line);
daniel@transgaming.comeec8efc2012-03-09 21:57:49 +00003535 if (context->globalErrorCheck((yyvsp[(1) - (2)].lex).line, context->symbolTable.atGlobalLevel(), "invariant varying"))
3536 context->recover();
3537 (yyval.interm).type.setBasic(EbtInvariant, EvqInvariantVaryingOut, (yyvsp[(2) - (2)].lex).line);
3538 if (!(yyvsp[(2) - (2)].lex).symbol)
3539 {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003540 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 +00003541 context->recover();
3542
3543 (yyval.interm).intermAggregate = 0;
3544 }
3545 else
3546 {
3547 TIntermSymbol *symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyval.interm).type), (yyvsp[(2) - (2)].lex).line);
3548 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (2)].lex).line);
3549 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003550 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003551 break;
3552
3553 case 102:
3554
3555 {
3556 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3557
3558 if ((yyvsp[(1) - (1)].interm.type).array) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003559 context->error((yyvsp[(1) - (1)].interm.type).line, "not supported", "first-class array");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003560 context->recover();
3561 (yyvsp[(1) - (1)].interm.type).setArray(false);
3562 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003563 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003564 break;
3565
3566 case 103:
3567
3568 {
3569 if ((yyvsp[(2) - (2)].interm.type).array) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003570 context->error((yyvsp[(2) - (2)].interm.type).line, "not supported", "first-class array");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003571 context->recover();
3572 (yyvsp[(2) - (2)].interm.type).setArray(false);
3573 }
3574
3575 if ((yyvsp[(1) - (2)].interm.type).qualifier == EvqAttribute &&
3576 ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003577 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 +00003578 context->recover();
3579 }
3580 if (((yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingIn || (yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingOut) &&
3581 ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003582 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 +00003583 context->recover();
3584 }
3585 (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
3586 (yyval.interm.type).qualifier = (yyvsp[(1) - (2)].interm.type).qualifier;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003587 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003588 break;
3589
3590 case 104:
3591
3592 {
3593 (yyval.interm.type).setBasic(EbtVoid, EvqConst, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003594 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003595 break;
3596
3597 case 105:
3598
3599 {
3600 VERTEX_ONLY("attribute", (yyvsp[(1) - (1)].lex).line);
3601 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "attribute"))
3602 context->recover();
3603 (yyval.interm.type).setBasic(EbtVoid, EvqAttribute, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003604 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003605 break;
3606
3607 case 106:
3608
3609 {
3610 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "varying"))
3611 context->recover();
3612 if (context->shaderType == SH_VERTEX_SHADER)
3613 (yyval.interm.type).setBasic(EbtVoid, EvqVaryingOut, (yyvsp[(1) - (1)].lex).line);
3614 else
3615 (yyval.interm.type).setBasic(EbtVoid, EvqVaryingIn, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003616 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003617 break;
3618
3619 case 107:
3620
3621 {
3622 if (context->globalErrorCheck((yyvsp[(1) - (2)].lex).line, context->symbolTable.atGlobalLevel(), "invariant varying"))
3623 context->recover();
3624 if (context->shaderType == SH_VERTEX_SHADER)
3625 (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingOut, (yyvsp[(1) - (2)].lex).line);
3626 else
3627 (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingIn, (yyvsp[(1) - (2)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003628 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003629 break;
3630
3631 case 108:
3632
3633 {
3634 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "uniform"))
3635 context->recover();
3636 (yyval.interm.type).setBasic(EbtVoid, EvqUniform, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003637 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003638 break;
3639
3640 case 109:
3641
3642 {
3643 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
zmo@google.comdc4b4f82011-06-17 00:42:53 +00003644
3645 if ((yyval.interm.type).precision == EbpUndefined) {
3646 (yyval.interm.type).precision = context->symbolTable.getDefaultPrecision((yyvsp[(1) - (1)].interm.type).type);
3647 if (context->precisionErrorCheck((yyvsp[(1) - (1)].interm.type).line, (yyval.interm.type).precision, (yyvsp[(1) - (1)].interm.type).type)) {
3648 context->recover();
3649 }
3650 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003651 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003652 break;
3653
3654 case 110:
3655
3656 {
3657 (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
3658 (yyval.interm.type).precision = (yyvsp[(1) - (2)].interm.precision);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003659 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003660 break;
3661
3662 case 111:
3663
3664 {
3665 (yyval.interm.precision) = EbpHigh;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003666 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003667 break;
3668
3669 case 112:
3670
3671 {
3672 (yyval.interm.precision) = EbpMedium;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003673 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003674 break;
3675
3676 case 113:
3677
3678 {
3679 (yyval.interm.precision) = EbpLow;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003680 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003681 break;
3682
3683 case 114:
3684
3685 {
3686 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003687 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003688 break;
3689
3690 case 115:
3691
3692 {
3693 (yyval.interm.type) = (yyvsp[(1) - (4)].interm.type);
3694
3695 if (context->arrayTypeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
3696 context->recover();
3697 else {
3698 int size;
3699 if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
3700 context->recover();
3701 (yyval.interm.type).setArray(true, size);
3702 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003703 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003704 break;
3705
3706 case 116:
3707
3708 {
3709 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3710 (yyval.interm.type).setBasic(EbtVoid, 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 117:
3715
3716 {
3717 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3718 (yyval.interm.type).setBasic(EbtFloat, 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 118:
3723
3724 {
3725 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3726 (yyval.interm.type).setBasic(EbtInt, 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 119:
3731
3732 {
3733 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3734 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003735 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003736 break;
3737
3738 case 120:
3739
3740 {
3741 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3742 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3743 (yyval.interm.type).setAggregate(2);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003744 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003745 break;
3746
3747 case 121:
3748
3749 {
3750 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3751 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3752 (yyval.interm.type).setAggregate(3);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003753 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003754 break;
3755
3756 case 122:
3757
3758 {
3759 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3760 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3761 (yyval.interm.type).setAggregate(4);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003762 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003763 break;
3764
3765 case 123:
3766
3767 {
3768 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3769 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3770 (yyval.interm.type).setAggregate(2);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003771 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003772 break;
3773
3774 case 124:
3775
3776 {
3777 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3778 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3779 (yyval.interm.type).setAggregate(3);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003780 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003781 break;
3782
3783 case 125:
3784
3785 {
3786 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3787 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3788 (yyval.interm.type).setAggregate(4);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003789 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003790 break;
3791
3792 case 126:
3793
3794 {
3795 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3796 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3797 (yyval.interm.type).setAggregate(2);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003798 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003799 break;
3800
3801 case 127:
3802
3803 {
3804 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3805 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3806 (yyval.interm.type).setAggregate(3);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003807 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003808 break;
3809
3810 case 128:
3811
3812 {
3813 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3814 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3815 (yyval.interm.type).setAggregate(4);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003816 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003817 break;
3818
3819 case 129:
3820
3821 {
3822 FRAG_VERT_ONLY("mat2", (yyvsp[(1) - (1)].lex).line);
3823 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3824 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3825 (yyval.interm.type).setAggregate(2, true);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003826 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003827 break;
3828
3829 case 130:
3830
3831 {
3832 FRAG_VERT_ONLY("mat3", (yyvsp[(1) - (1)].lex).line);
3833 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3834 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3835 (yyval.interm.type).setAggregate(3, true);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003836 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003837 break;
3838
3839 case 131:
3840
3841 {
3842 FRAG_VERT_ONLY("mat4", (yyvsp[(1) - (1)].lex).line);
3843 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3844 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3845 (yyval.interm.type).setAggregate(4, true);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003846 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003847 break;
3848
3849 case 132:
3850
3851 {
3852 FRAG_VERT_ONLY("sampler2D", (yyvsp[(1) - (1)].lex).line);
3853 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3854 (yyval.interm.type).setBasic(EbtSampler2D, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003855 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003856 break;
3857
3858 case 133:
3859
3860 {
3861 FRAG_VERT_ONLY("samplerCube", (yyvsp[(1) - (1)].lex).line);
3862 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3863 (yyval.interm.type).setBasic(EbtSamplerCube, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003864 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003865 break;
3866
3867 case 134:
3868
3869 {
zmo@google.com09c323a2011-08-12 18:22:25 +00003870 if (!context->supportsExtension("GL_OES_EGL_image_external")) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003871 context->error((yyvsp[(1) - (1)].lex).line, "unsupported type", "samplerExternalOES");
zmo@google.com09c323a2011-08-12 18:22:25 +00003872 context->recover();
3873 }
3874 FRAG_VERT_ONLY("samplerExternalOES", (yyvsp[(1) - (1)].lex).line);
3875 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3876 (yyval.interm.type).setBasic(EbtSamplerExternalOES, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003877 }
zmo@google.com09c323a2011-08-12 18:22:25 +00003878 break;
3879
3880 case 135:
3881
3882 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00003883 if (!context->supportsExtension("GL_ARB_texture_rectangle")) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003884 context->error((yyvsp[(1) - (1)].lex).line, "unsupported type", "sampler2DRect");
kbr@chromium.org205fef32011-11-22 20:50:02 +00003885 context->recover();
3886 }
3887 FRAG_VERT_ONLY("sampler2DRect", (yyvsp[(1) - (1)].lex).line);
3888 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3889 (yyval.interm.type).setBasic(EbtSampler2DRect, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003890 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003891 break;
3892
zmo@google.com09c323a2011-08-12 18:22:25 +00003893 case 136:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003894
3895 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00003896 FRAG_VERT_ONLY("struct", (yyvsp[(1) - (1)].interm.type).line);
3897 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3898 (yyval.interm.type).qualifier = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003899 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003900 break;
3901
3902 case 137:
3903
3904 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003905 //
3906 // This is for user defined type names. The lexical phase looked up the
3907 // type.
3908 //
3909 TType& structure = static_cast<TVariable*>((yyvsp[(1) - (1)].lex).symbol)->getType();
3910 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3911 (yyval.interm.type).setBasic(EbtStruct, qual, (yyvsp[(1) - (1)].lex).line);
3912 (yyval.interm.type).userDef = &structure;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003913 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003914 break;
3915
zmo@google.com09c323a2011-08-12 18:22:25 +00003916 case 138:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003917
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003918 { if (context->enterStructDeclaration((yyvsp[(2) - (3)].lex).line, *(yyvsp[(2) - (3)].lex).string)) context->recover(); }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003919 break;
3920
3921 case 139:
3922
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003923 {
kbr@chromium.org476541f2011-10-27 21:14:51 +00003924 if (context->reservedErrorCheck((yyvsp[(2) - (6)].lex).line, *(yyvsp[(2) - (6)].lex).string))
3925 context->recover();
3926
3927 TType* structure = new TType((yyvsp[(5) - (6)].interm.typeList), *(yyvsp[(2) - (6)].lex).string);
3928 TVariable* userTypeDef = new TVariable((yyvsp[(2) - (6)].lex).string, *structure, true);
3929 if (! context->symbolTable.insert(*userTypeDef)) {
3930 context->error((yyvsp[(2) - (6)].lex).line, "redefinition", (yyvsp[(2) - (6)].lex).string->c_str(), "struct");
3931 context->recover();
3932 }
3933 (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (6)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003934 (yyval.interm.type).userDef = structure;
kbr@chromium.org476541f2011-10-27 21:14:51 +00003935 context->exitStructDeclaration();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003936 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00003937 break;
3938
3939 case 140:
3940
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003941 { if (context->enterStructDeclaration((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string)) context->recover(); }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003942 break;
3943
3944 case 141:
3945
kbr@chromium.org476541f2011-10-27 21:14:51 +00003946 {
3947 TType* structure = new TType((yyvsp[(4) - (5)].interm.typeList), TString(""));
3948 (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (5)].lex).line);
3949 (yyval.interm.type).userDef = structure;
3950 context->exitStructDeclaration();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003951 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003952 break;
3953
kbr@chromium.org476541f2011-10-27 21:14:51 +00003954 case 142:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003955
3956 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00003957 (yyval.interm.typeList) = (yyvsp[(1) - (1)].interm.typeList);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003958 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003959 break;
3960
3961 case 143:
3962
3963 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003964 (yyval.interm.typeList) = (yyvsp[(1) - (2)].interm.typeList);
3965 for (unsigned int i = 0; i < (yyvsp[(2) - (2)].interm.typeList)->size(); ++i) {
3966 for (unsigned int j = 0; j < (yyval.interm.typeList)->size(); ++j) {
3967 if ((*(yyval.interm.typeList))[j].type->getFieldName() == (*(yyvsp[(2) - (2)].interm.typeList))[i].type->getFieldName()) {
3968 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());
3969 context->recover();
3970 }
3971 }
3972 (yyval.interm.typeList)->push_back((*(yyvsp[(2) - (2)].interm.typeList))[i]);
3973 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003974 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003975 break;
3976
kbr@chromium.org205fef32011-11-22 20:50:02 +00003977 case 144:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003978
3979 {
3980 (yyval.interm.typeList) = (yyvsp[(2) - (3)].interm.typeList);
3981
3982 if (context->voidErrorCheck((yyvsp[(1) - (3)].interm.type).line, (*(yyvsp[(2) - (3)].interm.typeList))[0].type->getFieldName(), (yyvsp[(1) - (3)].interm.type))) {
3983 context->recover();
3984 }
3985 for (unsigned int i = 0; i < (yyval.interm.typeList)->size(); ++i) {
3986 //
3987 // Careful not to replace already known aspects of type, like array-ness
3988 //
3989 TType* type = (*(yyval.interm.typeList))[i].type;
3990 type->setBasicType((yyvsp[(1) - (3)].interm.type).type);
3991 type->setNominalSize((yyvsp[(1) - (3)].interm.type).size);
3992 type->setMatrix((yyvsp[(1) - (3)].interm.type).matrix);
zmo@google.comdc4b4f82011-06-17 00:42:53 +00003993 type->setPrecision((yyvsp[(1) - (3)].interm.type).precision);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003994
3995 // don't allow arrays of arrays
3996 if (type->isArray()) {
3997 if (context->arrayTypeErrorCheck((yyvsp[(1) - (3)].interm.type).line, (yyvsp[(1) - (3)].interm.type)))
3998 context->recover();
3999 }
4000 if ((yyvsp[(1) - (3)].interm.type).array)
4001 type->setArraySize((yyvsp[(1) - (3)].interm.type).arraySize);
4002 if ((yyvsp[(1) - (3)].interm.type).userDef) {
4003 type->setStruct((yyvsp[(1) - (3)].interm.type).userDef->getStruct());
4004 type->setTypeName((yyvsp[(1) - (3)].interm.type).userDef->getTypeName());
4005 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004006
4007 if (context->structNestingErrorCheck((yyvsp[(1) - (3)].interm.type).line, *type)) {
4008 context->recover();
4009 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004010 }
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 145:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004015
4016 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004017 (yyval.interm.typeList) = NewPoolTTypeList();
4018 (yyval.interm.typeList)->push_back((yyvsp[(1) - (1)].interm.typeLine));
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004019 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004020 break;
4021
kbr@chromium.org476541f2011-10-27 21:14:51 +00004022 case 146:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004023
4024 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004025 (yyval.interm.typeList)->push_back((yyvsp[(3) - (3)].interm.typeLine));
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004026 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004027 break;
4028
4029 case 147:
4030
4031 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004032 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
4033 context->recover();
4034
4035 (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
4036 (yyval.interm.typeLine).line = (yyvsp[(1) - (1)].lex).line;
4037 (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (1)].lex).string);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004038 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004039 break;
4040
kbr@chromium.org205fef32011-11-22 20:50:02 +00004041 case 148:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004042
4043 {
4044 if (context->reservedErrorCheck((yyvsp[(1) - (4)].lex).line, *(yyvsp[(1) - (4)].lex).string))
4045 context->recover();
4046
4047 (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
4048 (yyval.interm.typeLine).line = (yyvsp[(1) - (4)].lex).line;
4049 (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (4)].lex).string);
4050
4051 int size;
4052 if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
4053 context->recover();
4054 (yyval.interm.typeLine).type->setArraySize(size);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004055 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004056 break;
4057
4058 case 149:
4059
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004060 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004061 break;
4062
4063 case 150:
4064
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004065 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004066 break;
4067
4068 case 151:
4069
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004070 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermAggregate); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004071 break;
4072
4073 case 152:
4074
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004075 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004076 break;
4077
4078 case 153:
4079
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004080 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004081 break;
4082
4083 case 154:
4084
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004085 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004086 break;
4087
4088 case 155:
4089
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004090 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004091 break;
4092
4093 case 156:
4094
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004095 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004096 break;
4097
4098 case 157:
4099
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004100 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
zmo@google.com09c323a2011-08-12 18:22:25 +00004101 break;
4102
4103 case 158:
4104
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004105 { (yyval.interm.intermAggregate) = 0; }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004106 break;
4107
4108 case 159:
4109
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004110 { context->symbolTable.push(); }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004111 break;
4112
4113 case 160:
4114
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004115 { context->symbolTable.pop(); }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004116 break;
4117
4118 case 161:
4119
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004120 {
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004121 if ((yyvsp[(3) - (5)].interm.intermAggregate) != 0) {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004122 (yyvsp[(3) - (5)].interm.intermAggregate)->setOp(EOpSequence);
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004123 (yyvsp[(3) - (5)].interm.intermAggregate)->setEndLine((yyvsp[(5) - (5)].lex).line);
4124 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004125 (yyval.interm.intermAggregate) = (yyvsp[(3) - (5)].interm.intermAggregate);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004126 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004127 break;
4128
4129 case 162:
4130
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004131 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004132 break;
4133
4134 case 163:
4135
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004136 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004137 break;
4138
kbr@chromium.org476541f2011-10-27 21:14:51 +00004139 case 164:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004140
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004141 { context->symbolTable.push(); }
4142 break;
4143
4144 case 165:
4145
4146 { context->symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[(2) - (2)].interm.intermNode); }
4147 break;
4148
4149 case 166:
4150
4151 { context->symbolTable.push(); }
4152 break;
4153
4154 case 167:
4155
4156 { context->symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[(2) - (2)].interm.intermNode); }
4157 break;
4158
4159 case 168:
4160
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004161 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004162 (yyval.interm.intermNode) = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004163 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004164 break;
4165
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004166 case 169:
kbr@chromium.org205fef32011-11-22 20:50:02 +00004167
4168 {
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004169 if ((yyvsp[(2) - (3)].interm.intermAggregate)) {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004170 (yyvsp[(2) - (3)].interm.intermAggregate)->setOp(EOpSequence);
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004171 (yyvsp[(2) - (3)].interm.intermAggregate)->setEndLine((yyvsp[(3) - (3)].lex).line);
4172 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004173 (yyval.interm.intermNode) = (yyvsp[(2) - (3)].interm.intermAggregate);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004174 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004175 break;
4176
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004177 case 170:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004178
4179 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004180 (yyval.interm.intermAggregate) = context->intermediate.makeAggregate((yyvsp[(1) - (1)].interm.intermNode), 0);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004181 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004182 break;
4183
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004184 case 171:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004185
kbr@chromium.org205fef32011-11-22 20:50:02 +00004186 {
4187 (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 +00004188 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004189 break;
4190
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004191 case 172:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004192
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004193 { (yyval.interm.intermNode) = 0; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004194 break;
4195
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004196 case 173:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004197
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004198 { (yyval.interm.intermNode) = static_cast<TIntermNode*>((yyvsp[(1) - (2)].interm.intermTypedNode)); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004199 break;
4200
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004201 case 174:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004202
4203 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004204 if (context->boolErrorCheck((yyvsp[(1) - (5)].lex).line, (yyvsp[(3) - (5)].interm.intermTypedNode)))
4205 context->recover();
4206 (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 +00004207 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004208 break;
4209
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004210 case 175:
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) - (3)].interm.intermNode);
4214 (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermNode);
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 176:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004219
4220 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004221 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (1)].interm.intermNode);
4222 (yyval.interm.nodePair).node2 = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004223 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004224 break;
4225
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004226 case 177:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004227
4228 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004229 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
4230 if (context->boolErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)->getLine(), (yyvsp[(1) - (1)].interm.intermTypedNode)))
4231 context->recover();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004232 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004233 break;
4234
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004235 case 178:
kbr@chromium.org205fef32011-11-22 20:50:02 +00004236
4237 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004238 TIntermNode* intermNode;
4239 if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
4240 context->recover();
4241 if (context->boolErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
4242 context->recover();
4243
4244 if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode))
4245 (yyval.interm.intermTypedNode) = (yyvsp[(4) - (4)].interm.intermTypedNode);
4246 else {
4247 context->recover();
4248 (yyval.interm.intermTypedNode) = 0;
4249 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004250 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004251 break;
4252
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004253 case 179:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004254
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004255 { context->symbolTable.push(); ++context->loopNestingLevel; }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004256 break;
4257
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004258 case 180:
kbr@chromium.org205fef32011-11-22 20:50:02 +00004259
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004260 {
4261 context->symbolTable.pop();
alokp@chromium.org52813552010-11-16 18:36:09 +00004262 (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 +00004263 --context->loopNestingLevel;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004264 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004265 break;
4266
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004267 case 181:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004268
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004269 { ++context->loopNestingLevel; }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004270 break;
4271
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004272 case 182:
kbr@chromium.org205fef32011-11-22 20:50:02 +00004273
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004274 {
4275 if (context->boolErrorCheck((yyvsp[(8) - (8)].lex).line, (yyvsp[(6) - (8)].interm.intermTypedNode)))
4276 context->recover();
4277
alokp@chromium.org52813552010-11-16 18:36:09 +00004278 (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 +00004279 --context->loopNestingLevel;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004280 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004281 break;
4282
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004283 case 183:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004284
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004285 { context->symbolTable.push(); ++context->loopNestingLevel; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004286 break;
4287
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004288 case 184:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004289
4290 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004291 context->symbolTable.pop();
4292 (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);
4293 --context->loopNestingLevel;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004294 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004295 break;
4296
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004297 case 185:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004298
4299 {
kbr@chromium.org476541f2011-10-27 21:14:51 +00004300 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004301 }
zmo@google.com09c323a2011-08-12 18:22:25 +00004302 break;
4303
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004304 case 186:
zmo@google.com09c323a2011-08-12 18:22:25 +00004305
4306 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004307 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004308 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004309 break;
4310
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004311 case 187:
kbr@chromium.org476541f2011-10-27 21:14:51 +00004312
4313 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004314 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004315 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004316 break;
4317
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004318 case 188:
kbr@chromium.org476541f2011-10-27 21:14:51 +00004319
4320 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004321 (yyval.interm.intermTypedNode) = 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 189:
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) - (2)].interm.intermTypedNode);
4329 (yyval.interm.nodePair).node2 = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004330 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004331 break;
4332
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004333 case 190:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004334
4335 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004336 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermTypedNode);
4337 (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004338 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004339 break;
4340
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004341 case 191:
kbr@chromium.org205fef32011-11-22 20:50:02 +00004342
4343 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004344 if (context->loopNestingLevel <= 0) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00004345 context->error((yyvsp[(1) - (2)].lex).line, "continue statement only allowed in loops", "");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004346 context->recover();
4347 }
4348 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpContinue, (yyvsp[(1) - (2)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004349 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004350 break;
4351
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004352 case 192:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004353
4354 {
4355 if (context->loopNestingLevel <= 0) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00004356 context->error((yyvsp[(1) - (2)].lex).line, "break statement only allowed in loops", "");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004357 context->recover();
4358 }
4359 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpBreak, (yyvsp[(1) - (2)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004360 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004361 break;
4362
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004363 case 193:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004364
4365 {
4366 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(1) - (2)].lex).line);
4367 if (context->currentFunctionType->getBasicType() != EbtVoid) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00004368 context->error((yyvsp[(1) - (2)].lex).line, "non-void function must return a value", "return");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004369 context->recover();
4370 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004371 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004372 break;
4373
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004374 case 194:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004375
4376 {
4377 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(2) - (3)].interm.intermTypedNode), (yyvsp[(1) - (3)].lex).line);
4378 context->functionReturnsValue = true;
4379 if (context->currentFunctionType->getBasicType() == EbtVoid) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00004380 context->error((yyvsp[(1) - (3)].lex).line, "void function cannot return a value", "return");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004381 context->recover();
4382 } else if (*(context->currentFunctionType) != (yyvsp[(2) - (3)].interm.intermTypedNode)->getType()) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00004383 context->error((yyvsp[(1) - (3)].lex).line, "function return is not matching type:", "return");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004384 context->recover();
4385 }
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 195:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004390
4391 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004392 FRAG_ONLY("discard", (yyvsp[(1) - (2)].lex).line);
4393 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpKill, (yyvsp[(1) - (2)].lex).line);
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 196:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004398
4399 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004400 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
zmo@google.com09c323a2011-08-12 18:22:25 +00004401 context->treeRoot = (yyval.interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004402 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004403 break;
4404
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004405 case 197:
zmo@google.com09c323a2011-08-12 18:22:25 +00004406
4407 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004408 (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermNode), (yyvsp[(2) - (2)].interm.intermNode), 0);
4409 context->treeRoot = (yyval.interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004410 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004411 break;
4412
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004413 case 198:
kbr@chromium.org476541f2011-10-27 21:14:51 +00004414
4415 {
4416 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004417 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004418 break;
4419
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004420 case 199:
kbr@chromium.org476541f2011-10-27 21:14:51 +00004421
4422 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004423 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004424 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004425 break;
4426
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004427 case 200:
kbr@chromium.org205fef32011-11-22 20:50:02 +00004428
4429 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004430 TFunction* function = (yyvsp[(1) - (1)].interm).function;
4431 TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find(function->getMangledName()));
4432 //
4433 // Note: 'prevDec' could be 'function' if this is the first time we've seen function
4434 // as it would have just been put in the symbol table. Otherwise, we're looking up
4435 // an earlier occurance.
4436 //
4437 if (prevDec->isDefined()) {
4438 //
4439 // Then this function already has a body.
4440 //
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00004441 context->error((yyvsp[(1) - (1)].interm).line, "function already has a body", function->getName().c_str());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004442 context->recover();
4443 }
4444 prevDec->setDefined();
4445
4446 //
4447 // Raise error message if main function takes any parameters or return anything other than void
4448 //
4449 if (function->getName() == "main") {
4450 if (function->getParamCount() > 0) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00004451 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 +00004452 context->recover();
4453 }
4454 if (function->getReturnType().getBasicType() != EbtVoid) {
4455 context->error((yyvsp[(1) - (1)].interm).line, "", function->getReturnType().getBasicString(), "main function cannot return a value");
4456 context->recover();
4457 }
4458 }
4459
4460 //
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004461 // Remember the return type for later checking for RETURN statements.
4462 //
4463 context->currentFunctionType = &(prevDec->getReturnType());
4464 context->functionReturnsValue = false;
4465
4466 //
4467 // Insert parameters into the symbol table.
4468 // If the parameter has no name, it's not an error, just don't insert it
4469 // (could be used for unused args).
4470 //
4471 // Also, accumulate the list of parameters into the HIL, so lower level code
4472 // knows where to find parameters.
4473 //
4474 TIntermAggregate* paramNodes = new TIntermAggregate;
4475 for (int i = 0; i < function->getParamCount(); i++) {
4476 const TParameter& param = function->getParam(i);
4477 if (param.name != 0) {
4478 TVariable *variable = new TVariable(param.name, *param.type);
4479 //
4480 // Insert the parameters with name in the symbol table.
4481 //
4482 if (! context->symbolTable.insert(*variable)) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00004483 context->error((yyvsp[(1) - (1)].interm).line, "redefinition", variable->getName().c_str());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004484 context->recover();
4485 delete variable;
4486 }
4487
4488 //
4489 // Add the parameter to the HIL
4490 //
4491 paramNodes = context->intermediate.growAggregate(
4492 paramNodes,
4493 context->intermediate.addSymbol(variable->getUniqueId(),
4494 variable->getName(),
4495 variable->getType(), (yyvsp[(1) - (1)].interm).line),
4496 (yyvsp[(1) - (1)].interm).line);
4497 } else {
4498 paramNodes = context->intermediate.growAggregate(paramNodes, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (1)].interm).line), (yyvsp[(1) - (1)].interm).line);
4499 }
4500 }
4501 context->intermediate.setAggregateOperator(paramNodes, EOpParameters, (yyvsp[(1) - (1)].interm).line);
4502 (yyvsp[(1) - (1)].interm).intermAggregate = paramNodes;
4503 context->loopNestingLevel = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004504 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004505 break;
4506
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004507 case 201:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004508
4509 {
4510 //?? Check that all paths return a value if return type != void ?
4511 // May be best done as post process phase on intermediate code
4512 if (context->currentFunctionType->getBasicType() != EbtVoid && ! context->functionReturnsValue) {
4513 context->error((yyvsp[(1) - (3)].interm).line, "function does not return a value:", "", (yyvsp[(1) - (3)].interm).function->getName().c_str());
4514 context->recover();
4515 }
daniel@transgaming.com5dd6d092012-03-20 20:10:28 +00004516
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004517 (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermAggregate, (yyvsp[(3) - (3)].interm.intermNode), 0);
4518 context->intermediate.setAggregateOperator((yyval.interm.intermNode), EOpFunction, (yyvsp[(1) - (3)].interm).line);
4519 (yyval.interm.intermNode)->getAsAggregate()->setName((yyvsp[(1) - (3)].interm).function->getMangledName().c_str());
4520 (yyval.interm.intermNode)->getAsAggregate()->setType((yyvsp[(1) - (3)].interm).function->getReturnType());
4521
4522 // store the pragma information for debug and optimize and other vendor specific
4523 // information. This information can be queried from the parse tree
alokp@chromium.org8b851c62012-06-15 16:25:11 +00004524 (yyval.interm.intermNode)->getAsAggregate()->setOptimize(context->pragma().optimize);
4525 (yyval.interm.intermNode)->getAsAggregate()->setDebug(context->pragma().debug);
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004526
4527 if ((yyvsp[(3) - (3)].interm.intermNode) && (yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate())
4528 (yyval.interm.intermNode)->getAsAggregate()->setEndLine((yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate()->getEndLine());
daniel@transgaming.com5dd6d092012-03-20 20:10:28 +00004529
4530 context->symbolTable.pop();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004531 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004532 break;
4533
4534
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004535
4536 default: break;
4537 }
4538 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
4539
4540 YYPOPSTACK (yylen);
4541 yylen = 0;
4542 YY_STACK_PRINT (yyss, yyssp);
4543
4544 *++yyvsp = yyval;
4545
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004546 /* Now `shift' the result of the reduction. Determine what state
4547 that goes to, based on the state we popped back to and the rule
4548 number reduced by. */
4549
4550 yyn = yyr1[yyn];
4551
4552 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
4553 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
4554 yystate = yytable[yystate];
4555 else
4556 yystate = yydefgoto[yyn - YYNTOKENS];
4557
4558 goto yynewstate;
4559
4560
4561/*------------------------------------.
4562| yyerrlab -- here on detecting error |
4563`------------------------------------*/
4564yyerrlab:
4565 /* If not already recovering from an error, report this error. */
4566 if (!yyerrstatus)
4567 {
4568 ++yynerrs;
4569#if ! YYERROR_VERBOSE
4570 yyerror (context, YY_("syntax error"));
4571#else
4572 {
4573 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
4574 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
4575 {
4576 YYSIZE_T yyalloc = 2 * yysize;
4577 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
4578 yyalloc = YYSTACK_ALLOC_MAXIMUM;
4579 if (yymsg != yymsgbuf)
4580 YYSTACK_FREE (yymsg);
4581 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
4582 if (yymsg)
4583 yymsg_alloc = yyalloc;
4584 else
4585 {
4586 yymsg = yymsgbuf;
4587 yymsg_alloc = sizeof yymsgbuf;
4588 }
4589 }
4590
4591 if (0 < yysize && yysize <= yymsg_alloc)
4592 {
4593 (void) yysyntax_error (yymsg, yystate, yychar);
4594 yyerror (context, yymsg);
4595 }
4596 else
4597 {
4598 yyerror (context, YY_("syntax error"));
4599 if (yysize != 0)
4600 goto yyexhaustedlab;
4601 }
4602 }
4603#endif
4604 }
4605
4606
4607
4608 if (yyerrstatus == 3)
4609 {
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004610 /* If just tried and failed to reuse lookahead token after an
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004611 error, discard it. */
4612
4613 if (yychar <= YYEOF)
4614 {
4615 /* Return failure if at end of input. */
4616 if (yychar == YYEOF)
4617 YYABORT;
4618 }
4619 else
4620 {
4621 yydestruct ("Error: discarding",
4622 yytoken, &yylval, context);
4623 yychar = YYEMPTY;
4624 }
4625 }
4626
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004627 /* Else will try to reuse lookahead token after shifting the error
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004628 token. */
4629 goto yyerrlab1;
4630
4631
4632/*---------------------------------------------------.
4633| yyerrorlab -- error raised explicitly by YYERROR. |
4634`---------------------------------------------------*/
4635yyerrorlab:
4636
4637 /* Pacify compilers like GCC when the user code never invokes
4638 YYERROR and the label yyerrorlab therefore never appears in user
4639 code. */
4640 if (/*CONSTCOND*/ 0)
4641 goto yyerrorlab;
4642
4643 /* Do not reclaim the symbols of the rule which action triggered
4644 this YYERROR. */
4645 YYPOPSTACK (yylen);
4646 yylen = 0;
4647 YY_STACK_PRINT (yyss, yyssp);
4648 yystate = *yyssp;
4649 goto yyerrlab1;
4650
4651
4652/*-------------------------------------------------------------.
4653| yyerrlab1 -- common code for both syntax error and YYERROR. |
4654`-------------------------------------------------------------*/
4655yyerrlab1:
4656 yyerrstatus = 3; /* Each real token shifted decrements this. */
4657
4658 for (;;)
4659 {
4660 yyn = yypact[yystate];
4661 if (yyn != YYPACT_NINF)
4662 {
4663 yyn += YYTERROR;
4664 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
4665 {
4666 yyn = yytable[yyn];
4667 if (0 < yyn)
4668 break;
4669 }
4670 }
4671
4672 /* Pop the current state because it cannot handle the error token. */
4673 if (yyssp == yyss)
4674 YYABORT;
4675
4676
4677 yydestruct ("Error: popping",
4678 yystos[yystate], yyvsp, context);
4679 YYPOPSTACK (1);
4680 yystate = *yyssp;
4681 YY_STACK_PRINT (yyss, yyssp);
4682 }
4683
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004684 *++yyvsp = yylval;
4685
4686
4687 /* Shift the error token. */
4688 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
4689
4690 yystate = yyn;
4691 goto yynewstate;
4692
4693
4694/*-------------------------------------.
4695| yyacceptlab -- YYACCEPT comes here. |
4696`-------------------------------------*/
4697yyacceptlab:
4698 yyresult = 0;
4699 goto yyreturn;
4700
4701/*-----------------------------------.
4702| yyabortlab -- YYABORT comes here. |
4703`-----------------------------------*/
4704yyabortlab:
4705 yyresult = 1;
4706 goto yyreturn;
4707
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004708#if !defined(yyoverflow) || YYERROR_VERBOSE
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004709/*-------------------------------------------------.
4710| yyexhaustedlab -- memory exhaustion comes here. |
4711`-------------------------------------------------*/
4712yyexhaustedlab:
4713 yyerror (context, YY_("memory exhausted"));
4714 yyresult = 2;
4715 /* Fall through. */
4716#endif
4717
4718yyreturn:
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004719 if (yychar != YYEMPTY)
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004720 yydestruct ("Cleanup: discarding lookahead",
4721 yytoken, &yylval, context);
4722 /* Do not reclaim the symbols of the rule which action triggered
4723 this YYABORT or YYACCEPT. */
4724 YYPOPSTACK (yylen);
4725 YY_STACK_PRINT (yyss, yyssp);
4726 while (yyssp != yyss)
4727 {
4728 yydestruct ("Cleanup: popping",
4729 yystos[*yyssp], yyvsp, context);
4730 YYPOPSTACK (1);
4731 }
4732#ifndef yyoverflow
4733 if (yyss != yyssa)
4734 YYSTACK_FREE (yyss);
4735#endif
4736#if YYERROR_VERBOSE
4737 if (yymsg != yymsgbuf)
4738 YYSTACK_FREE (yymsg);
4739#endif
4740 /* Make sure YYID is used. */
4741 return YYID (yyresult);
4742}
4743
4744
4745
4746
4747
4748int glslang_parse(TParseContext* context) {
4749 return yyparse(context);
4750}
4751
4752