blob: 4ac10aa35b75755710639719b5e50264ac80b420 [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) { \
274 context->error(L, " supported in vertex/fragment shaders only ", S, "", ""); \
275 context->recover(); \
276 } \
277}
278
279#define VERTEX_ONLY(S, L) { \
280 if (context->shaderType != SH_VERTEX_SHADER) { \
281 context->error(L, " supported in vertex shaders only ", S, "", ""); \
282 context->recover(); \
283 } \
284}
285
286#define FRAG_ONLY(S, L) { \
287 if (context->shaderType != SH_FRAGMENT_SHADER) { \
288 context->error(L, " supported in fragment shaders only ", S, "", ""); \
289 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,
661 308, 311, 420, 430, 443, 451, 550, 553, 561, 565,
662 572, 576, 583, 589, 598, 606, 661, 668, 678, 681,
663 691, 701, 722, 723, 724, 729, 730, 739, 751, 752,
664 760, 771, 775, 776, 786, 796, 806, 819, 820, 830,
665 843, 847, 851, 855, 856, 869, 870, 883, 884, 897,
666 898, 915, 916, 929, 930, 931, 932, 933, 937, 940,
667 951, 959, 984, 989, 996, 1032, 1035, 1042, 1050, 1071,
668 1090, 1101, 1130, 1135, 1145, 1150, 1160, 1163, 1166, 1169,
daniel@transgaming.comeec8efc2012-03-09 21:57:49 +0000669 1175, 1182, 1185, 1207, 1225, 1249, 1272, 1276, 1294, 1302,
670 1334, 1354, 1443, 1452, 1475, 1478, 1484, 1492, 1500, 1508,
671 1518, 1525, 1528, 1531, 1537, 1540, 1555, 1559, 1563, 1567,
672 1576, 1581, 1586, 1591, 1596, 1601, 1606, 1611, 1616, 1621,
673 1627, 1633, 1639, 1644, 1649, 1658, 1667, 1672, 1685, 1685,
674 1699, 1699, 1708, 1711, 1726, 1762, 1766, 1772, 1780, 1796,
675 1800, 1804, 1805, 1811, 1812, 1813, 1814, 1815, 1819, 1820,
676 1820, 1820, 1830, 1831, 1835, 1835, 1836, 1836, 1841, 1844,
677 1854, 1857, 1863, 1864, 1868, 1876, 1880, 1890, 1895, 1912,
678 1912, 1917, 1917, 1924, 1924, 1932, 1935, 1941, 1944, 1950,
679 1954, 1961, 1968, 1975, 1982, 1993, 2002, 2006, 2013, 2016,
680 2022, 2022
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) {
2074 context->error((yyvsp[(1) - (1)].lex).line, "undeclared identifier", (yyvsp[(1) - (1)].lex).string->c_str(), "");
2075 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()) {
2083 context->error((yyvsp[(1) - (1)].lex).line, "variable expected", (yyvsp[(1) - (1)].lex).string->c_str(), "");
2084 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)) {
2118 context->error((yyvsp[(1) - (1)].lex).line, " integer constant overflow", "", "");
2119 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())
2164 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(), "");
2165 else
2166 context->error((yyvsp[(2) - (4)].lex).line, " left of '[' is not of type array, matrix, or vector ", "expression", "");
2167 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() ) {
2183 context->error((yyvsp[(2) - (4)].lex).line, "", "[", "field selection out of range '%d'", (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst());
2184 context->recover();
2185 } else {
2186 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) {
2187 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize() == 0) {
2188 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getMaxArraySize() <= (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst()) {
2189 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))
2190 context->recover();
2191 } else {
2192 if (context->arraySetMaxSize((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getTypePointer(), 0, false, (yyvsp[(2) - (4)].lex).line))
2193 context->recover();
2194 }
2195 } else if ( (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst() >= (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize()) {
2196 context->error((yyvsp[(2) - (4)].lex).line, "", "[", "array index out of range '%d'", (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst());
2197 context->recover();
2198 }
2199 }
2200 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(3) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2201 }
2202 } else {
2203 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize() == 0) {
2204 context->error((yyvsp[(2) - (4)].lex).line, "", "[", "array must be redeclared with a size before being indexed with a variable");
2205 context->recover();
2206 }
2207
2208 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexIndirect, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(3) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2209 }
2210 }
2211 if ((yyval.interm.intermTypedNode) == 0) {
2212 ConstantUnion *unionArray = new ConstantUnion[1];
2213 unionArray->setFConst(0.0f);
2214 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpHigh, EvqConst), (yyvsp[(2) - (4)].lex).line);
2215 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) {
2216 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getStruct())
2217 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getStruct(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getTypeName()));
2218 else
2219 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize(), (yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix()));
2220
2221 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst)
2222 (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConst);
2223 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst)
2224 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqConst, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize()));
2225 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix())
2226 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize()));
2227 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst)
2228 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqConst));
2229 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector())
2230 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary));
2231 else
2232 (yyval.interm.intermTypedNode)->setType((yyvsp[(1) - (4)].interm.intermTypedNode)->getType());
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002233 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002234 break;
2235
2236 case 10:
2237
2238 {
2239 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002240 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002241 break;
2242
2243 case 11:
2244
2245 {
2246 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isArray()) {
2247 context->error((yyvsp[(3) - (3)].lex).line, "cannot apply dot operator to an array", ".", "");
2248 context->recover();
2249 }
2250
2251 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isVector()) {
2252 TVectorFields fields;
2253 if (! context->parseVectorFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yyvsp[(3) - (3)].lex).line)) {
2254 fields.num = 1;
2255 fields.offsets[0] = 0;
2256 context->recover();
2257 }
2258
2259 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) { // constant folding for vector fields
2260 (yyval.interm.intermTypedNode) = context->addConstVectorNode(fields, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].lex).line);
2261 if ((yyval.interm.intermTypedNode) == 0) {
2262 context->recover();
2263 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2264 }
2265 else
2266 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(), EvqConst, (int) (*(yyvsp[(3) - (3)].lex).string).size()));
2267 } else {
2268 if (fields.num == 1) {
2269 ConstantUnion *unionArray = new ConstantUnion[1];
2270 unionArray->setIConst(fields.offsets[0]);
2271 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line);
2272 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2273 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision()));
2274 } else {
2275 TString vectorString = *(yyvsp[(3) - (3)].lex).string;
2276 TIntermTyped* index = context->intermediate.addSwizzle(fields, (yyvsp[(3) - (3)].lex).line);
2277 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpVectorSwizzle, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2278 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (int) vectorString.size()));
2279 }
2280 }
2281 } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isMatrix()) {
2282 TMatrixFields fields;
2283 if (! context->parseMatrixFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yyvsp[(3) - (3)].lex).line)) {
2284 fields.wholeRow = false;
2285 fields.wholeCol = false;
2286 fields.row = 0;
2287 fields.col = 0;
2288 context->recover();
2289 }
2290
2291 if (fields.wholeRow || fields.wholeCol) {
2292 context->error((yyvsp[(2) - (3)].lex).line, " non-scalar fields not implemented yet", ".", "");
2293 context->recover();
2294 ConstantUnion *unionArray = new ConstantUnion[1];
2295 unionArray->setIConst(0);
2296 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line);
2297 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2298 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(),EvqTemporary, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize()));
2299 } else {
2300 ConstantUnion *unionArray = new ConstantUnion[1];
2301 unionArray->setIConst(fields.col * (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize() + fields.row);
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()));
2305 }
2306 } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType() == EbtStruct) {
2307 bool fieldFound = false;
2308 const TTypeList* fields = (yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getStruct();
2309 if (fields == 0) {
2310 context->error((yyvsp[(2) - (3)].lex).line, "structure has no fields", "Internal Error", "");
2311 context->recover();
2312 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2313 } else {
2314 unsigned int i;
2315 for (i = 0; i < fields->size(); ++i) {
2316 if ((*fields)[i].type->getFieldName() == *(yyvsp[(3) - (3)].lex).string) {
2317 fieldFound = true;
2318 break;
2319 }
2320 }
2321 if (fieldFound) {
2322 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) {
2323 (yyval.interm.intermTypedNode) = context->addConstStruct(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
2324 if ((yyval.interm.intermTypedNode) == 0) {
2325 context->recover();
2326 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2327 }
2328 else {
2329 (yyval.interm.intermTypedNode)->setType(*(*fields)[i].type);
2330 // change the qualifier of the return type, not of the structure field
2331 // as the structure definition is shared between various structures.
2332 (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConst);
2333 }
2334 } else {
2335 ConstantUnion *unionArray = new ConstantUnion[1];
2336 unionArray->setIConst(i);
2337 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, *(*fields)[i].type, (yyvsp[(3) - (3)].lex).line);
2338 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirectStruct, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2339 (yyval.interm.intermTypedNode)->setType(*(*fields)[i].type);
2340 }
2341 } else {
2342 context->error((yyvsp[(2) - (3)].lex).line, " no such field in structure", (yyvsp[(3) - (3)].lex).string->c_str(), "");
2343 context->recover();
2344 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2345 }
2346 }
2347 } else {
2348 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(), "");
2349 context->recover();
2350 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2351 }
2352 // don't delete $3.string, it's from the pool
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002353 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002354 break;
2355
2356 case 12:
2357
2358 {
2359 if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode)))
2360 context->recover();
2361 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostIncrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line, context->symbolTable);
2362 if ((yyval.interm.intermTypedNode) == 0) {
2363 context->unaryOpError((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
2364 context->recover();
2365 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode);
2366 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002367 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002368 break;
2369
2370 case 13:
2371
2372 {
2373 if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode)))
2374 context->recover();
2375 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostDecrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line, context->symbolTable);
2376 if ((yyval.interm.intermTypedNode) == 0) {
2377 context->unaryOpError((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
2378 context->recover();
2379 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode);
2380 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002381 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002382 break;
2383
2384 case 14:
2385
2386 {
2387 if (context->integerErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode), "[]"))
2388 context->recover();
2389 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002390 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002391 break;
2392
2393 case 15:
2394
2395 {
2396 TFunction* fnCall = (yyvsp[(1) - (1)].interm).function;
2397 TOperator op = fnCall->getBuiltInOp();
2398
2399 if (op != EOpNull)
2400 {
2401 //
2402 // Then this should be a constructor.
2403 // Don't go through the symbol table for constructors.
2404 // Their parameters will be verified algorithmically.
2405 //
2406 TType type(EbtVoid, EbpUndefined); // use this to get the type back
2407 if (context->constructorErrorCheck((yyvsp[(1) - (1)].interm).line, (yyvsp[(1) - (1)].interm).intermNode, *fnCall, op, &type)) {
2408 (yyval.interm.intermTypedNode) = 0;
2409 } else {
2410 //
2411 // It's a constructor, of type 'type'.
2412 //
2413 (yyval.interm.intermTypedNode) = context->addConstructor((yyvsp[(1) - (1)].interm).intermNode, &type, op, fnCall, (yyvsp[(1) - (1)].interm).line);
2414 }
2415
2416 if ((yyval.interm.intermTypedNode) == 0) {
2417 context->recover();
2418 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator(0, op, (yyvsp[(1) - (1)].interm).line);
2419 }
2420 (yyval.interm.intermTypedNode)->setType(type);
2421 } else {
2422 //
2423 // Not a constructor. Find it in the symbol table.
2424 //
2425 const TFunction* fnCandidate;
2426 bool builtIn;
2427 fnCandidate = context->findFunction((yyvsp[(1) - (1)].interm).line, fnCall, &builtIn);
2428 if (fnCandidate) {
2429 //
2430 // A declared function.
2431 //
2432 if (builtIn && !fnCandidate->getExtension().empty() &&
2433 context->extensionErrorCheck((yyvsp[(1) - (1)].interm).line, fnCandidate->getExtension())) {
2434 context->recover();
2435 }
2436 op = fnCandidate->getBuiltInOp();
2437 if (builtIn && op != EOpNull) {
2438 //
2439 // A function call mapped to a built-in operation.
2440 //
2441 if (fnCandidate->getParamCount() == 1) {
2442 //
2443 // Treat it like a built-in unary operator.
2444 //
2445 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(op, (yyvsp[(1) - (1)].interm).intermNode, 0, context->symbolTable);
2446 if ((yyval.interm.intermTypedNode) == 0) {
2447 context->error((yyvsp[(1) - (1)].interm).intermNode->getLine(), " wrong operand type", "Internal Error",
2448 "built in unary operator function. Type: %s",
2449 static_cast<TIntermTyped*>((yyvsp[(1) - (1)].interm).intermNode)->getCompleteString().c_str());
2450 YYERROR;
2451 }
2452 } else {
2453 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, op, (yyvsp[(1) - (1)].interm).line);
2454 }
2455 } else {
2456 // This is a real function call
2457
2458 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, EOpFunctionCall, (yyvsp[(1) - (1)].interm).line);
2459 (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType());
2460
2461 // this is how we know whether the given function is a builtIn function or a user defined function
2462 // if builtIn == false, it's a userDefined -> could be an overloaded builtIn function also
2463 // if builtIn == true, it's definitely a builtIn function with EOpNull
2464 if (!builtIn)
2465 (yyval.interm.intermTypedNode)->getAsAggregate()->setUserDefined();
2466 (yyval.interm.intermTypedNode)->getAsAggregate()->setName(fnCandidate->getMangledName());
2467
2468 TQualifier qual;
2469 for (int i = 0; i < fnCandidate->getParamCount(); ++i) {
2470 qual = fnCandidate->getParam(i).type->getQualifier();
2471 if (qual == EvqOut || qual == EvqInOut) {
2472 if (context->lValueErrorCheck((yyval.interm.intermTypedNode)->getLine(), "assign", (yyval.interm.intermTypedNode)->getAsAggregate()->getSequence()[i]->getAsTyped())) {
2473 context->error((yyvsp[(1) - (1)].interm).intermNode->getLine(), "Constant value cannot be passed for 'out' or 'inout' parameters.", "Error", "");
2474 context->recover();
2475 }
2476 }
2477 }
2478 }
2479 (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType());
2480 } else {
2481 // error message was put out by PaFindFunction()
2482 // Put on a dummy node for error recovery
2483 ConstantUnion *unionArray = new ConstantUnion[1];
2484 unionArray->setFConst(0.0f);
2485 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].interm).line);
2486 context->recover();
2487 }
2488 }
2489 delete fnCall;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002490 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002491 break;
2492
2493 case 16:
2494
2495 {
2496 (yyval.interm) = (yyvsp[(1) - (1)].interm);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002497 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002498 break;
2499
2500 case 17:
2501
2502 {
2503 context->error((yyvsp[(3) - (3)].interm).line, "methods are not supported", "", "");
2504 context->recover();
2505 (yyval.interm) = (yyvsp[(3) - (3)].interm);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002506 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002507 break;
2508
2509 case 18:
2510
2511 {
2512 (yyval.interm) = (yyvsp[(1) - (2)].interm);
2513 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002514 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002515 break;
2516
2517 case 19:
2518
2519 {
2520 (yyval.interm) = (yyvsp[(1) - (2)].interm);
2521 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002522 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002523 break;
2524
2525 case 20:
2526
2527 {
2528 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
2529 (yyval.interm).intermNode = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002530 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002531 break;
2532
2533 case 21:
2534
2535 {
2536 (yyval.interm).function = (yyvsp[(1) - (1)].interm.function);
2537 (yyval.interm).intermNode = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002538 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002539 break;
2540
2541 case 22:
2542
2543 {
2544 TParameter param = { 0, new TType((yyvsp[(2) - (2)].interm.intermTypedNode)->getType()) };
2545 (yyvsp[(1) - (2)].interm.function)->addParameter(param);
2546 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
2547 (yyval.interm).intermNode = (yyvsp[(2) - (2)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002548 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002549 break;
2550
2551 case 23:
2552
2553 {
2554 TParameter param = { 0, new TType((yyvsp[(3) - (3)].interm.intermTypedNode)->getType()) };
2555 (yyvsp[(1) - (3)].interm).function->addParameter(param);
2556 (yyval.interm).function = (yyvsp[(1) - (3)].interm).function;
2557 (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 +00002558 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002559 break;
2560
2561 case 24:
2562
2563 {
2564 (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002565 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002566 break;
2567
2568 case 25:
2569
2570 {
2571 //
2572 // Constructor
2573 //
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002574 TOperator op = EOpNull;
2575 if ((yyvsp[(1) - (1)].interm.type).userDef) {
2576 op = EOpConstructStruct;
2577 } else {
2578 switch ((yyvsp[(1) - (1)].interm.type).type) {
2579 case EbtFloat:
2580 if ((yyvsp[(1) - (1)].interm.type).matrix) {
2581 switch((yyvsp[(1) - (1)].interm.type).size) {
2582 case 2: op = EOpConstructMat2; break;
2583 case 3: op = EOpConstructMat3; break;
2584 case 4: op = EOpConstructMat4; break;
2585 }
2586 } else {
2587 switch((yyvsp[(1) - (1)].interm.type).size) {
2588 case 1: op = EOpConstructFloat; break;
2589 case 2: op = EOpConstructVec2; break;
2590 case 3: op = EOpConstructVec3; break;
2591 case 4: op = EOpConstructVec4; break;
2592 }
2593 }
2594 break;
2595 case EbtInt:
2596 switch((yyvsp[(1) - (1)].interm.type).size) {
2597 case 1: op = EOpConstructInt; break;
2598 case 2: FRAG_VERT_ONLY("ivec2", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec2; break;
2599 case 3: FRAG_VERT_ONLY("ivec3", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec3; break;
2600 case 4: FRAG_VERT_ONLY("ivec4", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec4; break;
2601 }
2602 break;
2603 case EbtBool:
2604 switch((yyvsp[(1) - (1)].interm.type).size) {
2605 case 1: op = EOpConstructBool; break;
2606 case 2: FRAG_VERT_ONLY("bvec2", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec2; break;
2607 case 3: FRAG_VERT_ONLY("bvec3", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec3; break;
2608 case 4: FRAG_VERT_ONLY("bvec4", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec4; break;
2609 }
2610 break;
2611 default: break;
2612 }
2613 if (op == EOpNull) {
2614 context->error((yyvsp[(1) - (1)].interm.type).line, "cannot construct this type", getBasicString((yyvsp[(1) - (1)].interm.type).type), "");
2615 context->recover();
2616 (yyvsp[(1) - (1)].interm.type).type = EbtFloat;
2617 op = EOpConstructFloat;
2618 }
2619 }
2620 TString tempString;
2621 TType type((yyvsp[(1) - (1)].interm.type));
2622 TFunction *function = new TFunction(&tempString, type, op);
2623 (yyval.interm.function) = function;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002624 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002625 break;
2626
2627 case 26:
2628
2629 {
2630 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
2631 context->recover();
2632 TType type(EbtVoid, EbpUndefined);
2633 TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type);
2634 (yyval.interm.function) = function;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002635 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002636 break;
2637
2638 case 27:
2639
2640 {
2641 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
2642 context->recover();
2643 TType type(EbtVoid, EbpUndefined);
2644 TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type);
2645 (yyval.interm.function) = function;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002646 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002647 break;
2648
2649 case 28:
2650
2651 {
2652 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002653 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002654 break;
2655
2656 case 29:
2657
2658 {
2659 if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)))
2660 context->recover();
2661 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreIncrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line, context->symbolTable);
2662 if ((yyval.interm.intermTypedNode) == 0) {
2663 context->unaryOpError((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2664 context->recover();
2665 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2666 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002667 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002668 break;
2669
2670 case 30:
2671
2672 {
2673 if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)))
2674 context->recover();
2675 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreDecrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line, context->symbolTable);
2676 if ((yyval.interm.intermTypedNode) == 0) {
2677 context->unaryOpError((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2678 context->recover();
2679 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2680 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002681 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002682 break;
2683
2684 case 31:
2685
2686 {
2687 if ((yyvsp[(1) - (2)].interm).op != EOpNull) {
2688 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath((yyvsp[(1) - (2)].interm).op, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].interm).line, context->symbolTable);
2689 if ((yyval.interm.intermTypedNode) == 0) {
2690 const char* errorOp = "";
2691 switch((yyvsp[(1) - (2)].interm).op) {
2692 case EOpNegative: errorOp = "-"; break;
2693 case EOpLogicalNot: errorOp = "!"; break;
2694 default: break;
2695 }
2696 context->unaryOpError((yyvsp[(1) - (2)].interm).line, errorOp, (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2697 context->recover();
2698 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2699 }
2700 } else
2701 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002702 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002703 break;
2704
2705 case 32:
2706
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002707 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNull; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002708 break;
2709
2710 case 33:
2711
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002712 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNegative; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002713 break;
2714
2715 case 34:
2716
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002717 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpLogicalNot; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002718 break;
2719
2720 case 35:
2721
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002722 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002723 break;
2724
2725 case 36:
2726
2727 {
2728 FRAG_VERT_ONLY("*", (yyvsp[(2) - (3)].lex).line);
2729 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpMul, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2730 if ((yyval.interm.intermTypedNode) == 0) {
2731 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "*", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2732 context->recover();
2733 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2734 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002735 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002736 break;
2737
2738 case 37:
2739
2740 {
2741 FRAG_VERT_ONLY("/", (yyvsp[(2) - (3)].lex).line);
2742 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpDiv, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2743 if ((yyval.interm.intermTypedNode) == 0) {
2744 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "/", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2745 context->recover();
2746 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2747 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002748 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002749 break;
2750
2751 case 38:
2752
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002753 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002754 break;
2755
2756 case 39:
2757
2758 {
2759 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpAdd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2760 if ((yyval.interm.intermTypedNode) == 0) {
2761 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "+", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2762 context->recover();
2763 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2764 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002765 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002766 break;
2767
2768 case 40:
2769
2770 {
2771 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpSub, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2772 if ((yyval.interm.intermTypedNode) == 0) {
2773 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "-", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2774 context->recover();
2775 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2776 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002777 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002778 break;
2779
2780 case 41:
2781
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002782 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002783 break;
2784
2785 case 42:
2786
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002787 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002788 break;
2789
2790 case 43:
2791
2792 {
2793 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2794 if ((yyval.interm.intermTypedNode) == 0) {
2795 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2796 context->recover();
2797 ConstantUnion *unionArray = new ConstantUnion[1];
2798 unionArray->setBConst(false);
2799 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2800 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002801 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002802 break;
2803
2804 case 44:
2805
2806 {
2807 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2808 if ((yyval.interm.intermTypedNode) == 0) {
2809 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2810 context->recover();
2811 ConstantUnion *unionArray = new ConstantUnion[1];
2812 unionArray->setBConst(false);
2813 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2814 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002815 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002816 break;
2817
2818 case 45:
2819
2820 {
2821 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2822 if ((yyval.interm.intermTypedNode) == 0) {
2823 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2824 context->recover();
2825 ConstantUnion *unionArray = new ConstantUnion[1];
2826 unionArray->setBConst(false);
2827 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2828 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002829 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002830 break;
2831
2832 case 46:
2833
2834 {
2835 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2836 if ((yyval.interm.intermTypedNode) == 0) {
2837 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2838 context->recover();
2839 ConstantUnion *unionArray = new ConstantUnion[1];
2840 unionArray->setBConst(false);
2841 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2842 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002843 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002844 break;
2845
2846 case 47:
2847
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002848 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002849 break;
2850
2851 case 48:
2852
2853 {
2854 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2855 if ((yyval.interm.intermTypedNode) == 0) {
2856 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "==", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2857 context->recover();
2858 ConstantUnion *unionArray = new ConstantUnion[1];
2859 unionArray->setBConst(false);
2860 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2861 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002862 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002863 break;
2864
2865 case 49:
2866
2867 {
2868 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpNotEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2869 if ((yyval.interm.intermTypedNode) == 0) {
2870 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "!=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2871 context->recover();
2872 ConstantUnion *unionArray = new ConstantUnion[1];
2873 unionArray->setBConst(false);
2874 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2875 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002876 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002877 break;
2878
2879 case 50:
2880
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002881 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002882 break;
2883
2884 case 51:
2885
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002886 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002887 break;
2888
2889 case 52:
2890
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002891 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002892 break;
2893
2894 case 53:
2895
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002896 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002897 break;
2898
2899 case 54:
2900
2901 {
2902 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalAnd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2903 if ((yyval.interm.intermTypedNode) == 0) {
2904 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "&&", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2905 context->recover();
2906 ConstantUnion *unionArray = new ConstantUnion[1];
2907 unionArray->setBConst(false);
2908 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2909 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002910 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002911 break;
2912
2913 case 55:
2914
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002915 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002916 break;
2917
2918 case 56:
2919
2920 {
2921 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalXor, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2922 if ((yyval.interm.intermTypedNode) == 0) {
2923 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "^^", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2924 context->recover();
2925 ConstantUnion *unionArray = new ConstantUnion[1];
2926 unionArray->setBConst(false);
2927 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2928 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002929 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002930 break;
2931
2932 case 57:
2933
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002934 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002935 break;
2936
2937 case 58:
2938
2939 {
2940 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalOr, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2941 if ((yyval.interm.intermTypedNode) == 0) {
2942 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "||", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2943 context->recover();
2944 ConstantUnion *unionArray = new ConstantUnion[1];
2945 unionArray->setBConst(false);
2946 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2947 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002948 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002949 break;
2950
2951 case 59:
2952
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002953 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002954 break;
2955
2956 case 60:
2957
2958 {
2959 if (context->boolErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.intermTypedNode)))
2960 context->recover();
2961
2962 (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);
2963 if ((yyvsp[(3) - (5)].interm.intermTypedNode)->getType() != (yyvsp[(5) - (5)].interm.intermTypedNode)->getType())
2964 (yyval.interm.intermTypedNode) = 0;
2965
2966 if ((yyval.interm.intermTypedNode) == 0) {
2967 context->binaryOpError((yyvsp[(2) - (5)].lex).line, ":", (yyvsp[(3) - (5)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(5) - (5)].interm.intermTypedNode)->getCompleteString());
2968 context->recover();
2969 (yyval.interm.intermTypedNode) = (yyvsp[(5) - (5)].interm.intermTypedNode);
2970 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002971 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002972 break;
2973
2974 case 61:
2975
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002976 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002977 break;
2978
2979 case 62:
2980
2981 {
2982 if (context->lValueErrorCheck((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)))
2983 context->recover();
2984 (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);
2985 if ((yyval.interm.intermTypedNode) == 0) {
2986 context->assignError((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2987 context->recover();
2988 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2989 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002990 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002991 break;
2992
2993 case 63:
2994
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002995 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAssign; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002996 break;
2997
2998 case 64:
2999
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003000 { 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 +00003001 break;
3002
3003 case 65:
3004
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003005 { 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 +00003006 break;
3007
3008 case 66:
3009
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003010 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAddAssign; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003011 break;
3012
3013 case 67:
3014
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003015 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpSubAssign; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003016 break;
3017
3018 case 68:
3019
3020 {
3021 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003022 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003023 break;
3024
3025 case 69:
3026
3027 {
3028 (yyval.interm.intermTypedNode) = context->intermediate.addComma((yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
3029 if ((yyval.interm.intermTypedNode) == 0) {
3030 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ",", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3031 context->recover();
3032 (yyval.interm.intermTypedNode) = (yyvsp[(3) - (3)].interm.intermTypedNode);
3033 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003034 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003035 break;
3036
3037 case 70:
3038
3039 {
3040 if (context->constErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)))
3041 context->recover();
3042 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003043 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003044 break;
3045
3046 case 71:
3047
3048 {
3049 TFunction &function = *((yyvsp[(1) - (2)].interm).function);
3050
3051 TIntermAggregate *prototype = new TIntermAggregate;
3052 prototype->setType(function.getReturnType());
3053 prototype->setName(function.getName());
3054
3055 for (int i = 0; i < function.getParamCount(); i++)
3056 {
3057 const TParameter &param = function.getParam(i);
3058 if (param.name != 0)
3059 {
3060 TVariable *variable = new TVariable(param.name, *param.type);
3061
3062 prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(variable->getUniqueId(), variable->getName(), variable->getType(), (yyvsp[(1) - (2)].interm).line), (yyvsp[(1) - (2)].interm).line);
3063 }
3064 else
3065 {
3066 prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (2)].interm).line), (yyvsp[(1) - (2)].interm).line);
3067 }
3068 }
3069
3070 prototype->setOp(EOpPrototype);
3071 (yyval.interm.intermNode) = prototype;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003072 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003073 break;
3074
3075 case 72:
3076
3077 {
3078 if ((yyvsp[(1) - (2)].interm).intermAggregate)
3079 (yyvsp[(1) - (2)].interm).intermAggregate->setOp(EOpDeclaration);
3080 (yyval.interm.intermNode) = (yyvsp[(1) - (2)].interm).intermAggregate;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003081 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003082 break;
3083
3084 case 73:
3085
3086 {
3087 context->symbolTable.setDefaultPrecision( (yyvsp[(3) - (4)].interm.type).type, (yyvsp[(2) - (4)].interm.precision) );
3088 (yyval.interm.intermNode) = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003089 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003090 break;
3091
3092 case 74:
3093
3094 {
3095 //
3096 // Multiple declarations of the same function are allowed.
3097 //
3098 // If this is a definition, the definition production code will check for redefinitions
3099 // (we don't know at this point if it's a definition or not).
3100 //
3101 // Redeclarations are allowed. But, return types and parameter qualifiers must match.
3102 //
3103 TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find((yyvsp[(1) - (2)].interm.function)->getMangledName()));
3104 if (prevDec) {
3105 if (prevDec->getReturnType() != (yyvsp[(1) - (2)].interm.function)->getReturnType()) {
3106 context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same return type", (yyvsp[(1) - (2)].interm.function)->getReturnType().getBasicString(), "");
3107 context->recover();
3108 }
3109 for (int i = 0; i < prevDec->getParamCount(); ++i) {
3110 if (prevDec->getParam(i).type->getQualifier() != (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifier()) {
3111 context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same parameter qualifiers", (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifierString(), "");
3112 context->recover();
3113 }
3114 }
3115 }
3116
3117 //
3118 // If this is a redeclaration, it could also be a definition,
3119 // in which case, we want to use the variable names from this one, and not the one that's
3120 // being redeclared. So, pass back up this declaration, not the one in the symbol table.
3121 //
3122 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
3123 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
3124
3125 context->symbolTable.insert(*(yyval.interm).function);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003126 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003127 break;
3128
3129 case 75:
3130
3131 {
3132 (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003133 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003134 break;
3135
3136 case 76:
3137
3138 {
3139 (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003140 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003141 break;
3142
3143 case 77:
3144
3145 {
3146 // Add the parameter
3147 (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
3148 if ((yyvsp[(2) - (2)].interm).param.type->getBasicType() != EbtVoid)
3149 (yyvsp[(1) - (2)].interm.function)->addParameter((yyvsp[(2) - (2)].interm).param);
3150 else
3151 delete (yyvsp[(2) - (2)].interm).param.type;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003152 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003153 break;
3154
3155 case 78:
3156
3157 {
3158 //
3159 // Only first parameter of one-parameter functions can be void
3160 // The check for named parameters not being void is done in parameter_declarator
3161 //
3162 if ((yyvsp[(3) - (3)].interm).param.type->getBasicType() == EbtVoid) {
3163 //
3164 // This parameter > first is void
3165 //
3166 context->error((yyvsp[(2) - (3)].lex).line, "cannot be an argument type except for '(void)'", "void", "");
3167 context->recover();
3168 delete (yyvsp[(3) - (3)].interm).param.type;
3169 } else {
3170 // Add the parameter
3171 (yyval.interm.function) = (yyvsp[(1) - (3)].interm.function);
3172 (yyvsp[(1) - (3)].interm.function)->addParameter((yyvsp[(3) - (3)].interm).param);
3173 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003174 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003175 break;
3176
3177 case 79:
3178
3179 {
3180 if ((yyvsp[(1) - (3)].interm.type).qualifier != EvqGlobal && (yyvsp[(1) - (3)].interm.type).qualifier != EvqTemporary) {
3181 context->error((yyvsp[(2) - (3)].lex).line, "no qualifiers allowed for function return", getQualifierString((yyvsp[(1) - (3)].interm.type).qualifier), "");
3182 context->recover();
3183 }
3184 // make sure a sampler is not involved as well...
3185 if (context->structQualifierErrorCheck((yyvsp[(2) - (3)].lex).line, (yyvsp[(1) - (3)].interm.type)))
3186 context->recover();
3187
3188 // Add the function as a prototype after parsing it (we do not support recursion)
3189 TFunction *function;
3190 TType type((yyvsp[(1) - (3)].interm.type));
3191 function = new TFunction((yyvsp[(2) - (3)].lex).string, type);
3192 (yyval.interm.function) = function;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003193 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003194 break;
3195
3196 case 80:
3197
3198 {
3199 if ((yyvsp[(1) - (2)].interm.type).type == EbtVoid) {
3200 context->error((yyvsp[(2) - (2)].lex).line, "illegal use of type 'void'", (yyvsp[(2) - (2)].lex).string->c_str(), "");
3201 context->recover();
3202 }
3203 if (context->reservedErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string))
3204 context->recover();
3205 TParameter param = {(yyvsp[(2) - (2)].lex).string, new TType((yyvsp[(1) - (2)].interm.type))};
3206 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
3207 (yyval.interm).param = param;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003208 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003209 break;
3210
3211 case 81:
3212
3213 {
3214 // Check that we can make an array out of this type
3215 if (context->arrayTypeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
3216 context->recover();
3217
3218 if (context->reservedErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string))
3219 context->recover();
3220
3221 int size;
3222 if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3223 context->recover();
3224 (yyvsp[(1) - (5)].interm.type).setArray(true, size);
3225
3226 TType* type = new TType((yyvsp[(1) - (5)].interm.type));
3227 TParameter param = { (yyvsp[(2) - (5)].lex).string, type };
3228 (yyval.interm).line = (yyvsp[(2) - (5)].lex).line;
3229 (yyval.interm).param = param;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003230 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003231 break;
3232
3233 case 82:
3234
3235 {
3236 (yyval.interm) = (yyvsp[(3) - (3)].interm);
3237 if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
3238 context->recover();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003239 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003240 break;
3241
3242 case 83:
3243
3244 {
3245 (yyval.interm) = (yyvsp[(2) - (2)].interm);
3246 if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
3247 context->recover();
3248 if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
3249 context->recover();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003250 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003251 break;
3252
3253 case 84:
3254
3255 {
3256 (yyval.interm) = (yyvsp[(3) - (3)].interm);
3257 if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
3258 context->recover();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003259 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003260 break;
3261
3262 case 85:
3263
3264 {
3265 (yyval.interm) = (yyvsp[(2) - (2)].interm);
3266 if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
3267 context->recover();
3268 if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
3269 context->recover();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003270 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003271 break;
3272
3273 case 86:
3274
3275 {
3276 (yyval.interm.qualifier) = EvqIn;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003277 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003278 break;
3279
3280 case 87:
3281
3282 {
3283 (yyval.interm.qualifier) = EvqIn;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003284 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003285 break;
3286
3287 case 88:
3288
3289 {
3290 (yyval.interm.qualifier) = EvqOut;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003291 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003292 break;
3293
3294 case 89:
3295
3296 {
3297 (yyval.interm.qualifier) = EvqInOut;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003298 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003299 break;
3300
3301 case 90:
3302
3303 {
3304 TParameter param = { 0, new TType((yyvsp[(1) - (1)].interm.type)) };
3305 (yyval.interm).param = param;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003306 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003307 break;
3308
3309 case 91:
3310
3311 {
3312 (yyval.interm) = (yyvsp[(1) - (1)].interm);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003313 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003314 break;
3315
3316 case 92:
3317
3318 {
daniel@transgaming.comeec8efc2012-03-09 21:57:49 +00003319 if ((yyvsp[(1) - (3)].interm).type.type == EbtInvariant && !(yyvsp[(3) - (3)].lex).symbol)
3320 {
3321 context->error((yyvsp[(3) - (3)].lex).line, "undeclared identifier declared as invariant", (yyvsp[(3) - (3)].lex).string->c_str(), "");
3322 context->recover();
3323 }
3324
zmo@google.comfd747b82011-04-23 01:30:07 +00003325 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(3) - (3)].lex).string, TType((yyvsp[(1) - (3)].interm).type), (yyvsp[(3) - (3)].lex).line);
3326 (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 +00003327
3328 if (context->structQualifierErrorCheck((yyvsp[(3) - (3)].lex).line, (yyval.interm).type))
3329 context->recover();
3330
3331 if (context->nonInitConstErrorCheck((yyvsp[(3) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyval.interm).type))
3332 context->recover();
3333
zmo@google.comfd747b82011-04-23 01:30:07 +00003334 TVariable* variable = 0;
3335 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 +00003336 context->recover();
zmo@google.comfd747b82011-04-23 01:30:07 +00003337 if (symbol && variable)
3338 symbol->setId(variable->getUniqueId());
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003339 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003340 break;
3341
3342 case 93:
3343
3344 {
3345 if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
3346 context->recover();
3347
3348 if (context->nonInitConstErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type))
3349 context->recover();
3350
3351 (yyval.interm) = (yyvsp[(1) - (5)].interm);
3352
3353 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))
3354 context->recover();
3355 else {
3356 (yyvsp[(1) - (5)].interm).type.setArray(true);
3357 TVariable* variable;
3358 if (context->arrayErrorCheck((yyvsp[(4) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, variable))
3359 context->recover();
3360 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003361 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003362 break;
3363
3364 case 94:
3365
3366 {
3367 if (context->structQualifierErrorCheck((yyvsp[(3) - (6)].lex).line, (yyvsp[(1) - (6)].interm).type))
3368 context->recover();
3369
3370 if (context->nonInitConstErrorCheck((yyvsp[(3) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type))
3371 context->recover();
3372
3373 (yyval.interm) = (yyvsp[(1) - (6)].interm);
3374
3375 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))
3376 context->recover();
3377 else {
3378 int size;
3379 if (context->arraySizeErrorCheck((yyvsp[(4) - (6)].lex).line, (yyvsp[(5) - (6)].interm.intermTypedNode), size))
3380 context->recover();
3381 (yyvsp[(1) - (6)].interm).type.setArray(true, size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003382 TVariable* variable = 0;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003383 if (context->arrayErrorCheck((yyvsp[(4) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type, variable))
3384 context->recover();
3385 TType type = TType((yyvsp[(1) - (6)].interm).type);
3386 type.setArraySize(size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003387 (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 +00003388 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003389 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003390 break;
3391
3392 case 95:
3393
3394 {
3395 if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
3396 context->recover();
3397
3398 (yyval.interm) = (yyvsp[(1) - (5)].interm);
3399
3400 TIntermNode* intermNode;
3401 if (!context->executeInitializer((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, (yyvsp[(5) - (5)].interm.intermTypedNode), intermNode)) {
3402 //
3403 // build the intermediate representation
3404 //
3405 if (intermNode)
3406 (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (5)].interm).intermNode, intermNode, (yyvsp[(4) - (5)].lex).line);
3407 else
3408 (yyval.interm).intermAggregate = (yyvsp[(1) - (5)].interm).intermAggregate;
3409 } else {
3410 context->recover();
3411 (yyval.interm).intermAggregate = 0;
3412 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003413 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003414 break;
3415
3416 case 96:
3417
3418 {
3419 (yyval.interm).type = (yyvsp[(1) - (1)].interm.type);
3420 (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 +00003421 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003422 break;
3423
3424 case 97:
3425
3426 {
zmo@google.comfd747b82011-04-23 01:30:07 +00003427 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyvsp[(1) - (2)].interm.type)), (yyvsp[(2) - (2)].lex).line);
3428 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (2)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003429
3430 if (context->structQualifierErrorCheck((yyvsp[(2) - (2)].lex).line, (yyval.interm).type))
3431 context->recover();
3432
3433 if (context->nonInitConstErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string, (yyval.interm).type))
3434 context->recover();
3435
3436 (yyval.interm).type = (yyvsp[(1) - (2)].interm.type);
3437
zmo@google.comfd747b82011-04-23 01:30:07 +00003438 TVariable* variable = 0;
3439 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 +00003440 context->recover();
zmo@google.comfd747b82011-04-23 01:30:07 +00003441 if (variable && symbol)
3442 symbol->setId(variable->getUniqueId());
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003443 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003444 break;
3445
3446 case 98:
3447
3448 {
kbr@chromium.org04277b82011-06-02 18:41:26 +00003449 context->error((yyvsp[(2) - (4)].lex).line, "unsized array declarations not supported", (yyvsp[(2) - (4)].lex).string->c_str(), "");
3450 context->recover();
3451
zmo@google.comfd747b82011-04-23 01:30:07 +00003452 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (4)].lex).string, TType((yyvsp[(1) - (4)].interm.type)), (yyvsp[(2) - (4)].lex).line);
3453 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (4)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003454 (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003455 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003456 break;
3457
3458 case 99:
3459
3460 {
3461 TType type = TType((yyvsp[(1) - (5)].interm.type));
3462 int size;
3463 if (context->arraySizeErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3464 context->recover();
3465 type.setArraySize(size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003466 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (5)].lex).string, type, (yyvsp[(2) - (5)].lex).line);
3467 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (5)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003468
3469 if (context->structQualifierErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
3470 context->recover();
3471
3472 if (context->nonInitConstErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type)))
3473 context->recover();
3474
3475 (yyval.interm).type = (yyvsp[(1) - (5)].interm.type);
3476
3477 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)))
3478 context->recover();
3479 else {
3480 int size;
3481 if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3482 context->recover();
3483
3484 (yyvsp[(1) - (5)].interm.type).setArray(true, size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003485 TVariable* variable = 0;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003486 if (context->arrayErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type), variable))
3487 context->recover();
zmo@google.comfd747b82011-04-23 01:30:07 +00003488 if (variable && symbol)
3489 symbol->setId(variable->getUniqueId());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003490 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003491 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003492 break;
3493
3494 case 100:
3495
3496 {
3497 if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
3498 context->recover();
3499
3500 (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
3501
3502 TIntermNode* intermNode;
3503 if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode)) {
3504 //
3505 // Build intermediate representation
3506 //
3507 if(intermNode)
3508 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(intermNode, (yyvsp[(3) - (4)].lex).line);
3509 else
3510 (yyval.interm).intermAggregate = 0;
3511 } else {
3512 context->recover();
3513 (yyval.interm).intermAggregate = 0;
3514 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003515 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003516 break;
3517
3518 case 101:
3519
3520 {
3521 VERTEX_ONLY("invariant declaration", (yyvsp[(1) - (2)].lex).line);
daniel@transgaming.comeec8efc2012-03-09 21:57:49 +00003522 if (context->globalErrorCheck((yyvsp[(1) - (2)].lex).line, context->symbolTable.atGlobalLevel(), "invariant varying"))
3523 context->recover();
3524 (yyval.interm).type.setBasic(EbtInvariant, EvqInvariantVaryingOut, (yyvsp[(2) - (2)].lex).line);
3525 if (!(yyvsp[(2) - (2)].lex).symbol)
3526 {
3527 context->error((yyvsp[(2) - (2)].lex).line, "undeclared identifier declared as invariant", (yyvsp[(2) - (2)].lex).string->c_str(), "");
3528 context->recover();
3529
3530 (yyval.interm).intermAggregate = 0;
3531 }
3532 else
3533 {
3534 TIntermSymbol *symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyval.interm).type), (yyvsp[(2) - (2)].lex).line);
3535 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (2)].lex).line);
3536 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003537 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003538 break;
3539
3540 case 102:
3541
3542 {
3543 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3544
3545 if ((yyvsp[(1) - (1)].interm.type).array) {
3546 context->error((yyvsp[(1) - (1)].interm.type).line, "not supported", "first-class array", "");
3547 context->recover();
3548 (yyvsp[(1) - (1)].interm.type).setArray(false);
3549 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003550 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003551 break;
3552
3553 case 103:
3554
3555 {
3556 if ((yyvsp[(2) - (2)].interm.type).array) {
3557 context->error((yyvsp[(2) - (2)].interm.type).line, "not supported", "first-class array", "");
3558 context->recover();
3559 (yyvsp[(2) - (2)].interm.type).setArray(false);
3560 }
3561
3562 if ((yyvsp[(1) - (2)].interm.type).qualifier == EvqAttribute &&
3563 ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
3564 context->error((yyvsp[(2) - (2)].interm.type).line, "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier), "");
3565 context->recover();
3566 }
3567 if (((yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingIn || (yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingOut) &&
3568 ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
3569 context->error((yyvsp[(2) - (2)].interm.type).line, "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier), "");
3570 context->recover();
3571 }
3572 (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
3573 (yyval.interm.type).qualifier = (yyvsp[(1) - (2)].interm.type).qualifier;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003574 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003575 break;
3576
3577 case 104:
3578
3579 {
3580 (yyval.interm.type).setBasic(EbtVoid, EvqConst, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003581 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003582 break;
3583
3584 case 105:
3585
3586 {
3587 VERTEX_ONLY("attribute", (yyvsp[(1) - (1)].lex).line);
3588 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "attribute"))
3589 context->recover();
3590 (yyval.interm.type).setBasic(EbtVoid, EvqAttribute, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003591 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003592 break;
3593
3594 case 106:
3595
3596 {
3597 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "varying"))
3598 context->recover();
3599 if (context->shaderType == SH_VERTEX_SHADER)
3600 (yyval.interm.type).setBasic(EbtVoid, EvqVaryingOut, (yyvsp[(1) - (1)].lex).line);
3601 else
3602 (yyval.interm.type).setBasic(EbtVoid, EvqVaryingIn, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003603 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003604 break;
3605
3606 case 107:
3607
3608 {
3609 if (context->globalErrorCheck((yyvsp[(1) - (2)].lex).line, context->symbolTable.atGlobalLevel(), "invariant varying"))
3610 context->recover();
3611 if (context->shaderType == SH_VERTEX_SHADER)
3612 (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingOut, (yyvsp[(1) - (2)].lex).line);
3613 else
3614 (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingIn, (yyvsp[(1) - (2)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003615 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003616 break;
3617
3618 case 108:
3619
3620 {
3621 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "uniform"))
3622 context->recover();
3623 (yyval.interm.type).setBasic(EbtVoid, EvqUniform, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003624 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003625 break;
3626
3627 case 109:
3628
3629 {
3630 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
zmo@google.comdc4b4f82011-06-17 00:42:53 +00003631
3632 if ((yyval.interm.type).precision == EbpUndefined) {
3633 (yyval.interm.type).precision = context->symbolTable.getDefaultPrecision((yyvsp[(1) - (1)].interm.type).type);
3634 if (context->precisionErrorCheck((yyvsp[(1) - (1)].interm.type).line, (yyval.interm.type).precision, (yyvsp[(1) - (1)].interm.type).type)) {
3635 context->recover();
3636 }
3637 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003638 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003639 break;
3640
3641 case 110:
3642
3643 {
3644 (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
3645 (yyval.interm.type).precision = (yyvsp[(1) - (2)].interm.precision);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003646 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003647 break;
3648
3649 case 111:
3650
3651 {
3652 (yyval.interm.precision) = EbpHigh;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003653 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003654 break;
3655
3656 case 112:
3657
3658 {
3659 (yyval.interm.precision) = EbpMedium;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003660 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003661 break;
3662
3663 case 113:
3664
3665 {
3666 (yyval.interm.precision) = EbpLow;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003667 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003668 break;
3669
3670 case 114:
3671
3672 {
3673 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003674 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003675 break;
3676
3677 case 115:
3678
3679 {
3680 (yyval.interm.type) = (yyvsp[(1) - (4)].interm.type);
3681
3682 if (context->arrayTypeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
3683 context->recover();
3684 else {
3685 int size;
3686 if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
3687 context->recover();
3688 (yyval.interm.type).setArray(true, size);
3689 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003690 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003691 break;
3692
3693 case 116:
3694
3695 {
3696 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3697 (yyval.interm.type).setBasic(EbtVoid, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003698 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003699 break;
3700
3701 case 117:
3702
3703 {
3704 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3705 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003706 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003707 break;
3708
3709 case 118:
3710
3711 {
3712 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3713 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003714 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003715 break;
3716
3717 case 119:
3718
3719 {
3720 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3721 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003722 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003723 break;
3724
3725 case 120:
3726
3727 {
3728 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3729 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3730 (yyval.interm.type).setAggregate(2);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003731 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003732 break;
3733
3734 case 121:
3735
3736 {
3737 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3738 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3739 (yyval.interm.type).setAggregate(3);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003740 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003741 break;
3742
3743 case 122:
3744
3745 {
3746 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3747 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3748 (yyval.interm.type).setAggregate(4);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003749 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003750 break;
3751
3752 case 123:
3753
3754 {
3755 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3756 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3757 (yyval.interm.type).setAggregate(2);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003758 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003759 break;
3760
3761 case 124:
3762
3763 {
3764 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3765 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3766 (yyval.interm.type).setAggregate(3);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003767 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003768 break;
3769
3770 case 125:
3771
3772 {
3773 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3774 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3775 (yyval.interm.type).setAggregate(4);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003776 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003777 break;
3778
3779 case 126:
3780
3781 {
3782 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3783 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3784 (yyval.interm.type).setAggregate(2);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003785 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003786 break;
3787
3788 case 127:
3789
3790 {
3791 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3792 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3793 (yyval.interm.type).setAggregate(3);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003794 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003795 break;
3796
3797 case 128:
3798
3799 {
3800 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3801 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3802 (yyval.interm.type).setAggregate(4);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003803 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003804 break;
3805
3806 case 129:
3807
3808 {
3809 FRAG_VERT_ONLY("mat2", (yyvsp[(1) - (1)].lex).line);
3810 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3811 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3812 (yyval.interm.type).setAggregate(2, true);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003813 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003814 break;
3815
3816 case 130:
3817
3818 {
3819 FRAG_VERT_ONLY("mat3", (yyvsp[(1) - (1)].lex).line);
3820 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3821 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3822 (yyval.interm.type).setAggregate(3, true);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003823 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003824 break;
3825
3826 case 131:
3827
3828 {
3829 FRAG_VERT_ONLY("mat4", (yyvsp[(1) - (1)].lex).line);
3830 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3831 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3832 (yyval.interm.type).setAggregate(4, true);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003833 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003834 break;
3835
3836 case 132:
3837
3838 {
3839 FRAG_VERT_ONLY("sampler2D", (yyvsp[(1) - (1)].lex).line);
3840 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3841 (yyval.interm.type).setBasic(EbtSampler2D, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003842 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003843 break;
3844
3845 case 133:
3846
3847 {
3848 FRAG_VERT_ONLY("samplerCube", (yyvsp[(1) - (1)].lex).line);
3849 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3850 (yyval.interm.type).setBasic(EbtSamplerCube, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003851 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003852 break;
3853
3854 case 134:
3855
3856 {
zmo@google.com09c323a2011-08-12 18:22:25 +00003857 if (!context->supportsExtension("GL_OES_EGL_image_external")) {
3858 context->error((yyvsp[(1) - (1)].lex).line, "unsupported type", "samplerExternalOES", "");
3859 context->recover();
3860 }
3861 FRAG_VERT_ONLY("samplerExternalOES", (yyvsp[(1) - (1)].lex).line);
3862 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3863 (yyval.interm.type).setBasic(EbtSamplerExternalOES, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003864 }
zmo@google.com09c323a2011-08-12 18:22:25 +00003865 break;
3866
3867 case 135:
3868
3869 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00003870 if (!context->supportsExtension("GL_ARB_texture_rectangle")) {
3871 context->error((yyvsp[(1) - (1)].lex).line, "unsupported type", "sampler2DRect", "");
3872 context->recover();
3873 }
3874 FRAG_VERT_ONLY("sampler2DRect", (yyvsp[(1) - (1)].lex).line);
3875 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3876 (yyval.interm.type).setBasic(EbtSampler2DRect, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003877 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003878 break;
3879
zmo@google.com09c323a2011-08-12 18:22:25 +00003880 case 136:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003881
3882 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00003883 FRAG_VERT_ONLY("struct", (yyvsp[(1) - (1)].interm.type).line);
3884 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3885 (yyval.interm.type).qualifier = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003886 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003887 break;
3888
3889 case 137:
3890
3891 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003892 //
3893 // This is for user defined type names. The lexical phase looked up the
3894 // type.
3895 //
3896 TType& structure = static_cast<TVariable*>((yyvsp[(1) - (1)].lex).symbol)->getType();
3897 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3898 (yyval.interm.type).setBasic(EbtStruct, qual, (yyvsp[(1) - (1)].lex).line);
3899 (yyval.interm.type).userDef = &structure;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003900 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003901 break;
3902
zmo@google.com09c323a2011-08-12 18:22:25 +00003903 case 138:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003904
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003905 { if (context->enterStructDeclaration((yyvsp[(2) - (3)].lex).line, *(yyvsp[(2) - (3)].lex).string)) context->recover(); }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003906 break;
3907
3908 case 139:
3909
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003910 {
kbr@chromium.org476541f2011-10-27 21:14:51 +00003911 if (context->reservedErrorCheck((yyvsp[(2) - (6)].lex).line, *(yyvsp[(2) - (6)].lex).string))
3912 context->recover();
3913
3914 TType* structure = new TType((yyvsp[(5) - (6)].interm.typeList), *(yyvsp[(2) - (6)].lex).string);
3915 TVariable* userTypeDef = new TVariable((yyvsp[(2) - (6)].lex).string, *structure, true);
3916 if (! context->symbolTable.insert(*userTypeDef)) {
3917 context->error((yyvsp[(2) - (6)].lex).line, "redefinition", (yyvsp[(2) - (6)].lex).string->c_str(), "struct");
3918 context->recover();
3919 }
3920 (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (6)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003921 (yyval.interm.type).userDef = structure;
kbr@chromium.org476541f2011-10-27 21:14:51 +00003922 context->exitStructDeclaration();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003923 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00003924 break;
3925
3926 case 140:
3927
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003928 { if (context->enterStructDeclaration((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string)) context->recover(); }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003929 break;
3930
3931 case 141:
3932
kbr@chromium.org476541f2011-10-27 21:14:51 +00003933 {
3934 TType* structure = new TType((yyvsp[(4) - (5)].interm.typeList), TString(""));
3935 (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (5)].lex).line);
3936 (yyval.interm.type).userDef = structure;
3937 context->exitStructDeclaration();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003938 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003939 break;
3940
kbr@chromium.org476541f2011-10-27 21:14:51 +00003941 case 142:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003942
3943 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00003944 (yyval.interm.typeList) = (yyvsp[(1) - (1)].interm.typeList);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003945 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003946 break;
3947
3948 case 143:
3949
3950 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003951 (yyval.interm.typeList) = (yyvsp[(1) - (2)].interm.typeList);
3952 for (unsigned int i = 0; i < (yyvsp[(2) - (2)].interm.typeList)->size(); ++i) {
3953 for (unsigned int j = 0; j < (yyval.interm.typeList)->size(); ++j) {
3954 if ((*(yyval.interm.typeList))[j].type->getFieldName() == (*(yyvsp[(2) - (2)].interm.typeList))[i].type->getFieldName()) {
3955 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());
3956 context->recover();
3957 }
3958 }
3959 (yyval.interm.typeList)->push_back((*(yyvsp[(2) - (2)].interm.typeList))[i]);
3960 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003961 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003962 break;
3963
kbr@chromium.org205fef32011-11-22 20:50:02 +00003964 case 144:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003965
3966 {
3967 (yyval.interm.typeList) = (yyvsp[(2) - (3)].interm.typeList);
3968
3969 if (context->voidErrorCheck((yyvsp[(1) - (3)].interm.type).line, (*(yyvsp[(2) - (3)].interm.typeList))[0].type->getFieldName(), (yyvsp[(1) - (3)].interm.type))) {
3970 context->recover();
3971 }
3972 for (unsigned int i = 0; i < (yyval.interm.typeList)->size(); ++i) {
3973 //
3974 // Careful not to replace already known aspects of type, like array-ness
3975 //
3976 TType* type = (*(yyval.interm.typeList))[i].type;
3977 type->setBasicType((yyvsp[(1) - (3)].interm.type).type);
3978 type->setNominalSize((yyvsp[(1) - (3)].interm.type).size);
3979 type->setMatrix((yyvsp[(1) - (3)].interm.type).matrix);
zmo@google.comdc4b4f82011-06-17 00:42:53 +00003980 type->setPrecision((yyvsp[(1) - (3)].interm.type).precision);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003981
3982 // don't allow arrays of arrays
3983 if (type->isArray()) {
3984 if (context->arrayTypeErrorCheck((yyvsp[(1) - (3)].interm.type).line, (yyvsp[(1) - (3)].interm.type)))
3985 context->recover();
3986 }
3987 if ((yyvsp[(1) - (3)].interm.type).array)
3988 type->setArraySize((yyvsp[(1) - (3)].interm.type).arraySize);
3989 if ((yyvsp[(1) - (3)].interm.type).userDef) {
3990 type->setStruct((yyvsp[(1) - (3)].interm.type).userDef->getStruct());
3991 type->setTypeName((yyvsp[(1) - (3)].interm.type).userDef->getTypeName());
3992 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00003993
3994 if (context->structNestingErrorCheck((yyvsp[(1) - (3)].interm.type).line, *type)) {
3995 context->recover();
3996 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003997 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003998 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003999 break;
4000
kbr@chromium.org476541f2011-10-27 21:14:51 +00004001 case 145:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004002
4003 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004004 (yyval.interm.typeList) = NewPoolTTypeList();
4005 (yyval.interm.typeList)->push_back((yyvsp[(1) - (1)].interm.typeLine));
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004006 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004007 break;
4008
kbr@chromium.org476541f2011-10-27 21:14:51 +00004009 case 146:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004010
4011 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004012 (yyval.interm.typeList)->push_back((yyvsp[(3) - (3)].interm.typeLine));
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004013 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004014 break;
4015
4016 case 147:
4017
4018 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004019 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
4020 context->recover();
4021
4022 (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
4023 (yyval.interm.typeLine).line = (yyvsp[(1) - (1)].lex).line;
4024 (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (1)].lex).string);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004025 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004026 break;
4027
kbr@chromium.org205fef32011-11-22 20:50:02 +00004028 case 148:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004029
4030 {
4031 if (context->reservedErrorCheck((yyvsp[(1) - (4)].lex).line, *(yyvsp[(1) - (4)].lex).string))
4032 context->recover();
4033
4034 (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
4035 (yyval.interm.typeLine).line = (yyvsp[(1) - (4)].lex).line;
4036 (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (4)].lex).string);
4037
4038 int size;
4039 if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
4040 context->recover();
4041 (yyval.interm.typeLine).type->setArraySize(size);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004042 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004043 break;
4044
4045 case 149:
4046
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004047 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004048 break;
4049
4050 case 150:
4051
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004052 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004053 break;
4054
4055 case 151:
4056
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004057 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermAggregate); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004058 break;
4059
4060 case 152:
4061
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004062 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004063 break;
4064
4065 case 153:
4066
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004067 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004068 break;
4069
4070 case 154:
4071
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004072 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004073 break;
4074
4075 case 155:
4076
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004077 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004078 break;
4079
4080 case 156:
4081
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004082 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004083 break;
4084
4085 case 157:
4086
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004087 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
zmo@google.com09c323a2011-08-12 18:22:25 +00004088 break;
4089
4090 case 158:
4091
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004092 { (yyval.interm.intermAggregate) = 0; }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004093 break;
4094
4095 case 159:
4096
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004097 { context->symbolTable.push(); }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004098 break;
4099
4100 case 160:
4101
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004102 { context->symbolTable.pop(); }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004103 break;
4104
4105 case 161:
4106
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004107 {
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004108 if ((yyvsp[(3) - (5)].interm.intermAggregate) != 0) {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004109 (yyvsp[(3) - (5)].interm.intermAggregate)->setOp(EOpSequence);
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004110 (yyvsp[(3) - (5)].interm.intermAggregate)->setEndLine((yyvsp[(5) - (5)].lex).line);
4111 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004112 (yyval.interm.intermAggregate) = (yyvsp[(3) - (5)].interm.intermAggregate);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004113 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004114 break;
4115
4116 case 162:
4117
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004118 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004119 break;
4120
4121 case 163:
4122
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004123 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004124 break;
4125
kbr@chromium.org476541f2011-10-27 21:14:51 +00004126 case 164:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004127
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004128 { context->symbolTable.push(); }
4129 break;
4130
4131 case 165:
4132
4133 { context->symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[(2) - (2)].interm.intermNode); }
4134 break;
4135
4136 case 166:
4137
4138 { context->symbolTable.push(); }
4139 break;
4140
4141 case 167:
4142
4143 { context->symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[(2) - (2)].interm.intermNode); }
4144 break;
4145
4146 case 168:
4147
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004148 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004149 (yyval.interm.intermNode) = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004150 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004151 break;
4152
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004153 case 169:
kbr@chromium.org205fef32011-11-22 20:50:02 +00004154
4155 {
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004156 if ((yyvsp[(2) - (3)].interm.intermAggregate)) {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004157 (yyvsp[(2) - (3)].interm.intermAggregate)->setOp(EOpSequence);
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004158 (yyvsp[(2) - (3)].interm.intermAggregate)->setEndLine((yyvsp[(3) - (3)].lex).line);
4159 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004160 (yyval.interm.intermNode) = (yyvsp[(2) - (3)].interm.intermAggregate);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004161 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004162 break;
4163
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004164 case 170:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004165
4166 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004167 (yyval.interm.intermAggregate) = context->intermediate.makeAggregate((yyvsp[(1) - (1)].interm.intermNode), 0);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004168 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004169 break;
4170
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004171 case 171:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004172
kbr@chromium.org205fef32011-11-22 20:50:02 +00004173 {
4174 (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 +00004175 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004176 break;
4177
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004178 case 172:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004179
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004180 { (yyval.interm.intermNode) = 0; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004181 break;
4182
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004183 case 173:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004184
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004185 { (yyval.interm.intermNode) = static_cast<TIntermNode*>((yyvsp[(1) - (2)].interm.intermTypedNode)); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004186 break;
4187
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004188 case 174:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004189
4190 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004191 if (context->boolErrorCheck((yyvsp[(1) - (5)].lex).line, (yyvsp[(3) - (5)].interm.intermTypedNode)))
4192 context->recover();
4193 (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 +00004194 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004195 break;
4196
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004197 case 175:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004198
4199 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004200 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermNode);
4201 (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004202 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004203 break;
4204
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004205 case 176:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004206
4207 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004208 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (1)].interm.intermNode);
4209 (yyval.interm.nodePair).node2 = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004210 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004211 break;
4212
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004213 case 177:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004214
4215 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004216 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
4217 if (context->boolErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)->getLine(), (yyvsp[(1) - (1)].interm.intermTypedNode)))
4218 context->recover();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004219 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004220 break;
4221
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004222 case 178:
kbr@chromium.org205fef32011-11-22 20:50:02 +00004223
4224 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004225 TIntermNode* intermNode;
4226 if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
4227 context->recover();
4228 if (context->boolErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
4229 context->recover();
4230
4231 if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode))
4232 (yyval.interm.intermTypedNode) = (yyvsp[(4) - (4)].interm.intermTypedNode);
4233 else {
4234 context->recover();
4235 (yyval.interm.intermTypedNode) = 0;
4236 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004237 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004238 break;
4239
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004240 case 179:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004241
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004242 { context->symbolTable.push(); ++context->loopNestingLevel; }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004243 break;
4244
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004245 case 180:
kbr@chromium.org205fef32011-11-22 20:50:02 +00004246
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004247 {
4248 context->symbolTable.pop();
alokp@chromium.org52813552010-11-16 18:36:09 +00004249 (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 +00004250 --context->loopNestingLevel;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004251 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004252 break;
4253
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004254 case 181:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004255
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004256 { ++context->loopNestingLevel; }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004257 break;
4258
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004259 case 182:
kbr@chromium.org205fef32011-11-22 20:50:02 +00004260
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004261 {
4262 if (context->boolErrorCheck((yyvsp[(8) - (8)].lex).line, (yyvsp[(6) - (8)].interm.intermTypedNode)))
4263 context->recover();
4264
alokp@chromium.org52813552010-11-16 18:36:09 +00004265 (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 +00004266 --context->loopNestingLevel;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004267 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004268 break;
4269
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004270 case 183:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004271
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004272 { context->symbolTable.push(); ++context->loopNestingLevel; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004273 break;
4274
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004275 case 184:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004276
4277 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004278 context->symbolTable.pop();
4279 (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);
4280 --context->loopNestingLevel;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004281 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004282 break;
4283
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004284 case 185:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004285
4286 {
kbr@chromium.org476541f2011-10-27 21:14:51 +00004287 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004288 }
zmo@google.com09c323a2011-08-12 18:22:25 +00004289 break;
4290
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004291 case 186:
zmo@google.com09c323a2011-08-12 18:22:25 +00004292
4293 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004294 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004295 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004296 break;
4297
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004298 case 187:
kbr@chromium.org476541f2011-10-27 21:14:51 +00004299
4300 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004301 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004302 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004303 break;
4304
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004305 case 188:
kbr@chromium.org476541f2011-10-27 21:14:51 +00004306
4307 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004308 (yyval.interm.intermTypedNode) = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004309 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004310 break;
4311
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004312 case 189:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004313
4314 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004315 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (2)].interm.intermTypedNode);
4316 (yyval.interm.nodePair).node2 = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004317 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004318 break;
4319
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004320 case 190:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004321
4322 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004323 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermTypedNode);
4324 (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004325 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004326 break;
4327
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004328 case 191:
kbr@chromium.org205fef32011-11-22 20:50:02 +00004329
4330 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004331 if (context->loopNestingLevel <= 0) {
4332 context->error((yyvsp[(1) - (2)].lex).line, "continue statement only allowed in loops", "", "");
4333 context->recover();
4334 }
4335 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpContinue, (yyvsp[(1) - (2)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004336 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004337 break;
4338
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004339 case 192:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004340
4341 {
4342 if (context->loopNestingLevel <= 0) {
4343 context->error((yyvsp[(1) - (2)].lex).line, "break statement only allowed in loops", "", "");
4344 context->recover();
4345 }
4346 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpBreak, (yyvsp[(1) - (2)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004347 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004348 break;
4349
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004350 case 193:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004351
4352 {
4353 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(1) - (2)].lex).line);
4354 if (context->currentFunctionType->getBasicType() != EbtVoid) {
4355 context->error((yyvsp[(1) - (2)].lex).line, "non-void function must return a value", "return", "");
4356 context->recover();
4357 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004358 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004359 break;
4360
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004361 case 194:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004362
4363 {
4364 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(2) - (3)].interm.intermTypedNode), (yyvsp[(1) - (3)].lex).line);
4365 context->functionReturnsValue = true;
4366 if (context->currentFunctionType->getBasicType() == EbtVoid) {
4367 context->error((yyvsp[(1) - (3)].lex).line, "void function cannot return a value", "return", "");
4368 context->recover();
4369 } else if (*(context->currentFunctionType) != (yyvsp[(2) - (3)].interm.intermTypedNode)->getType()) {
4370 context->error((yyvsp[(1) - (3)].lex).line, "function return is not matching type:", "return", "");
4371 context->recover();
4372 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004373 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004374 break;
4375
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004376 case 195:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004377
4378 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004379 FRAG_ONLY("discard", (yyvsp[(1) - (2)].lex).line);
4380 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpKill, (yyvsp[(1) - (2)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004381 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004382 break;
4383
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004384 case 196:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004385
4386 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004387 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
zmo@google.com09c323a2011-08-12 18:22:25 +00004388 context->treeRoot = (yyval.interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004389 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004390 break;
4391
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004392 case 197:
zmo@google.com09c323a2011-08-12 18:22:25 +00004393
4394 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004395 (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermNode), (yyvsp[(2) - (2)].interm.intermNode), 0);
4396 context->treeRoot = (yyval.interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004397 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004398 break;
4399
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004400 case 198:
kbr@chromium.org476541f2011-10-27 21:14:51 +00004401
4402 {
4403 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004404 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004405 break;
4406
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004407 case 199:
kbr@chromium.org476541f2011-10-27 21:14:51 +00004408
4409 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004410 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004411 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004412 break;
4413
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004414 case 200:
kbr@chromium.org205fef32011-11-22 20:50:02 +00004415
4416 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004417 TFunction* function = (yyvsp[(1) - (1)].interm).function;
4418 TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find(function->getMangledName()));
4419 //
4420 // Note: 'prevDec' could be 'function' if this is the first time we've seen function
4421 // as it would have just been put in the symbol table. Otherwise, we're looking up
4422 // an earlier occurance.
4423 //
4424 if (prevDec->isDefined()) {
4425 //
4426 // Then this function already has a body.
4427 //
4428 context->error((yyvsp[(1) - (1)].interm).line, "function already has a body", function->getName().c_str(), "");
4429 context->recover();
4430 }
4431 prevDec->setDefined();
4432
4433 //
4434 // Raise error message if main function takes any parameters or return anything other than void
4435 //
4436 if (function->getName() == "main") {
4437 if (function->getParamCount() > 0) {
4438 context->error((yyvsp[(1) - (1)].interm).line, "function cannot take any parameter(s)", function->getName().c_str(), "");
4439 context->recover();
4440 }
4441 if (function->getReturnType().getBasicType() != EbtVoid) {
4442 context->error((yyvsp[(1) - (1)].interm).line, "", function->getReturnType().getBasicString(), "main function cannot return a value");
4443 context->recover();
4444 }
4445 }
4446
4447 //
4448 // New symbol table scope for body of function plus its arguments
4449 //
4450 context->symbolTable.push();
4451
4452 //
4453 // Remember the return type for later checking for RETURN statements.
4454 //
4455 context->currentFunctionType = &(prevDec->getReturnType());
4456 context->functionReturnsValue = false;
4457
4458 //
4459 // Insert parameters into the symbol table.
4460 // If the parameter has no name, it's not an error, just don't insert it
4461 // (could be used for unused args).
4462 //
4463 // Also, accumulate the list of parameters into the HIL, so lower level code
4464 // knows where to find parameters.
4465 //
4466 TIntermAggregate* paramNodes = new TIntermAggregate;
4467 for (int i = 0; i < function->getParamCount(); i++) {
4468 const TParameter& param = function->getParam(i);
4469 if (param.name != 0) {
4470 TVariable *variable = new TVariable(param.name, *param.type);
4471 //
4472 // Insert the parameters with name in the symbol table.
4473 //
4474 if (! context->symbolTable.insert(*variable)) {
4475 context->error((yyvsp[(1) - (1)].interm).line, "redefinition", variable->getName().c_str(), "");
4476 context->recover();
4477 delete variable;
4478 }
4479
4480 //
4481 // Add the parameter to the HIL
4482 //
4483 paramNodes = context->intermediate.growAggregate(
4484 paramNodes,
4485 context->intermediate.addSymbol(variable->getUniqueId(),
4486 variable->getName(),
4487 variable->getType(), (yyvsp[(1) - (1)].interm).line),
4488 (yyvsp[(1) - (1)].interm).line);
4489 } else {
4490 paramNodes = context->intermediate.growAggregate(paramNodes, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (1)].interm).line), (yyvsp[(1) - (1)].interm).line);
4491 }
4492 }
4493 context->intermediate.setAggregateOperator(paramNodes, EOpParameters, (yyvsp[(1) - (1)].interm).line);
4494 (yyvsp[(1) - (1)].interm).intermAggregate = paramNodes;
4495 context->loopNestingLevel = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004496 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004497 break;
4498
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004499 case 201:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004500
4501 {
4502 //?? Check that all paths return a value if return type != void ?
4503 // May be best done as post process phase on intermediate code
4504 if (context->currentFunctionType->getBasicType() != EbtVoid && ! context->functionReturnsValue) {
4505 context->error((yyvsp[(1) - (3)].interm).line, "function does not return a value:", "", (yyvsp[(1) - (3)].interm).function->getName().c_str());
4506 context->recover();
4507 }
4508 context->symbolTable.pop();
4509 (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermAggregate, (yyvsp[(3) - (3)].interm.intermNode), 0);
4510 context->intermediate.setAggregateOperator((yyval.interm.intermNode), EOpFunction, (yyvsp[(1) - (3)].interm).line);
4511 (yyval.interm.intermNode)->getAsAggregate()->setName((yyvsp[(1) - (3)].interm).function->getMangledName().c_str());
4512 (yyval.interm.intermNode)->getAsAggregate()->setType((yyvsp[(1) - (3)].interm).function->getReturnType());
4513
4514 // store the pragma information for debug and optimize and other vendor specific
4515 // information. This information can be queried from the parse tree
4516 (yyval.interm.intermNode)->getAsAggregate()->setOptimize(context->contextPragma.optimize);
4517 (yyval.interm.intermNode)->getAsAggregate()->setDebug(context->contextPragma.debug);
4518 (yyval.interm.intermNode)->getAsAggregate()->addToPragmaTable(context->contextPragma.pragmaTable);
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004519
4520 if ((yyvsp[(3) - (3)].interm.intermNode) && (yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate())
4521 (yyval.interm.intermNode)->getAsAggregate()->setEndLine((yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate()->getEndLine());
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004522 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004523 break;
4524
4525
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004526
4527 default: break;
4528 }
4529 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
4530
4531 YYPOPSTACK (yylen);
4532 yylen = 0;
4533 YY_STACK_PRINT (yyss, yyssp);
4534
4535 *++yyvsp = yyval;
4536
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004537 /* Now `shift' the result of the reduction. Determine what state
4538 that goes to, based on the state we popped back to and the rule
4539 number reduced by. */
4540
4541 yyn = yyr1[yyn];
4542
4543 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
4544 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
4545 yystate = yytable[yystate];
4546 else
4547 yystate = yydefgoto[yyn - YYNTOKENS];
4548
4549 goto yynewstate;
4550
4551
4552/*------------------------------------.
4553| yyerrlab -- here on detecting error |
4554`------------------------------------*/
4555yyerrlab:
4556 /* If not already recovering from an error, report this error. */
4557 if (!yyerrstatus)
4558 {
4559 ++yynerrs;
4560#if ! YYERROR_VERBOSE
4561 yyerror (context, YY_("syntax error"));
4562#else
4563 {
4564 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
4565 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
4566 {
4567 YYSIZE_T yyalloc = 2 * yysize;
4568 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
4569 yyalloc = YYSTACK_ALLOC_MAXIMUM;
4570 if (yymsg != yymsgbuf)
4571 YYSTACK_FREE (yymsg);
4572 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
4573 if (yymsg)
4574 yymsg_alloc = yyalloc;
4575 else
4576 {
4577 yymsg = yymsgbuf;
4578 yymsg_alloc = sizeof yymsgbuf;
4579 }
4580 }
4581
4582 if (0 < yysize && yysize <= yymsg_alloc)
4583 {
4584 (void) yysyntax_error (yymsg, yystate, yychar);
4585 yyerror (context, yymsg);
4586 }
4587 else
4588 {
4589 yyerror (context, YY_("syntax error"));
4590 if (yysize != 0)
4591 goto yyexhaustedlab;
4592 }
4593 }
4594#endif
4595 }
4596
4597
4598
4599 if (yyerrstatus == 3)
4600 {
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004601 /* If just tried and failed to reuse lookahead token after an
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004602 error, discard it. */
4603
4604 if (yychar <= YYEOF)
4605 {
4606 /* Return failure if at end of input. */
4607 if (yychar == YYEOF)
4608 YYABORT;
4609 }
4610 else
4611 {
4612 yydestruct ("Error: discarding",
4613 yytoken, &yylval, context);
4614 yychar = YYEMPTY;
4615 }
4616 }
4617
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004618 /* Else will try to reuse lookahead token after shifting the error
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004619 token. */
4620 goto yyerrlab1;
4621
4622
4623/*---------------------------------------------------.
4624| yyerrorlab -- error raised explicitly by YYERROR. |
4625`---------------------------------------------------*/
4626yyerrorlab:
4627
4628 /* Pacify compilers like GCC when the user code never invokes
4629 YYERROR and the label yyerrorlab therefore never appears in user
4630 code. */
4631 if (/*CONSTCOND*/ 0)
4632 goto yyerrorlab;
4633
4634 /* Do not reclaim the symbols of the rule which action triggered
4635 this YYERROR. */
4636 YYPOPSTACK (yylen);
4637 yylen = 0;
4638 YY_STACK_PRINT (yyss, yyssp);
4639 yystate = *yyssp;
4640 goto yyerrlab1;
4641
4642
4643/*-------------------------------------------------------------.
4644| yyerrlab1 -- common code for both syntax error and YYERROR. |
4645`-------------------------------------------------------------*/
4646yyerrlab1:
4647 yyerrstatus = 3; /* Each real token shifted decrements this. */
4648
4649 for (;;)
4650 {
4651 yyn = yypact[yystate];
4652 if (yyn != YYPACT_NINF)
4653 {
4654 yyn += YYTERROR;
4655 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
4656 {
4657 yyn = yytable[yyn];
4658 if (0 < yyn)
4659 break;
4660 }
4661 }
4662
4663 /* Pop the current state because it cannot handle the error token. */
4664 if (yyssp == yyss)
4665 YYABORT;
4666
4667
4668 yydestruct ("Error: popping",
4669 yystos[yystate], yyvsp, context);
4670 YYPOPSTACK (1);
4671 yystate = *yyssp;
4672 YY_STACK_PRINT (yyss, yyssp);
4673 }
4674
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004675 *++yyvsp = yylval;
4676
4677
4678 /* Shift the error token. */
4679 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
4680
4681 yystate = yyn;
4682 goto yynewstate;
4683
4684
4685/*-------------------------------------.
4686| yyacceptlab -- YYACCEPT comes here. |
4687`-------------------------------------*/
4688yyacceptlab:
4689 yyresult = 0;
4690 goto yyreturn;
4691
4692/*-----------------------------------.
4693| yyabortlab -- YYABORT comes here. |
4694`-----------------------------------*/
4695yyabortlab:
4696 yyresult = 1;
4697 goto yyreturn;
4698
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004699#if !defined(yyoverflow) || YYERROR_VERBOSE
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004700/*-------------------------------------------------.
4701| yyexhaustedlab -- memory exhaustion comes here. |
4702`-------------------------------------------------*/
4703yyexhaustedlab:
4704 yyerror (context, YY_("memory exhausted"));
4705 yyresult = 2;
4706 /* Fall through. */
4707#endif
4708
4709yyreturn:
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004710 if (yychar != YYEMPTY)
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004711 yydestruct ("Cleanup: discarding lookahead",
4712 yytoken, &yylval, context);
4713 /* Do not reclaim the symbols of the rule which action triggered
4714 this YYABORT or YYACCEPT. */
4715 YYPOPSTACK (yylen);
4716 YY_STACK_PRINT (yyss, yyssp);
4717 while (yyssp != yyss)
4718 {
4719 yydestruct ("Cleanup: popping",
4720 yystos[*yyssp], yyvsp, context);
4721 YYPOPSTACK (1);
4722 }
4723#ifndef yyoverflow
4724 if (yyss != yyssa)
4725 YYSTACK_FREE (yyss);
4726#endif
4727#if YYERROR_VERBOSE
4728 if (yymsg != yymsgbuf)
4729 YYSTACK_FREE (yymsg);
4730#endif
4731 /* Make sure YYID is used. */
4732 return YYID (yyresult);
4733}
4734
4735
4736
4737
4738
4739int glslang_parse(TParseContext* context) {
4740 return yyparse(context);
4741}
4742
4743