blob: b7ce945c81f864046ac0fdfc8dcd39853c450483 [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,
daniel@transgaming.com5dd6d092012-03-20 20:10:28 +0000667 951, 959, 986, 991, 998, 1036, 1039, 1046, 1054, 1075,
668 1096, 1107, 1136, 1141, 1151, 1156, 1166, 1169, 1172, 1175,
669 1181, 1188, 1191, 1213, 1231, 1255, 1278, 1282, 1300, 1308,
670 1340, 1360, 1449, 1458, 1481, 1484, 1490, 1498, 1506, 1514,
671 1524, 1531, 1534, 1537, 1543, 1546, 1561, 1565, 1569, 1573,
672 1582, 1587, 1592, 1597, 1602, 1607, 1612, 1617, 1622, 1627,
673 1633, 1639, 1645, 1650, 1655, 1664, 1673, 1678, 1691, 1691,
674 1705, 1705, 1714, 1717, 1732, 1768, 1772, 1778, 1786, 1802,
675 1806, 1810, 1811, 1817, 1818, 1819, 1820, 1821, 1825, 1826,
676 1826, 1826, 1836, 1837, 1841, 1841, 1842, 1842, 1847, 1850,
677 1860, 1863, 1869, 1870, 1874, 1882, 1886, 1896, 1901, 1918,
678 1918, 1923, 1923, 1930, 1930, 1938, 1941, 1947, 1950, 1956,
679 1960, 1967, 1974, 1981, 1988, 1999, 2008, 2012, 2019, 2022,
680 2028, 2028
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.com5dd6d092012-03-20 20:10:28 +00003072
3073 context->symbolTable.pop();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003074 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003075 break;
3076
3077 case 72:
3078
3079 {
3080 if ((yyvsp[(1) - (2)].interm).intermAggregate)
3081 (yyvsp[(1) - (2)].interm).intermAggregate->setOp(EOpDeclaration);
3082 (yyval.interm.intermNode) = (yyvsp[(1) - (2)].interm).intermAggregate;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003083 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003084 break;
3085
3086 case 73:
3087
3088 {
3089 context->symbolTable.setDefaultPrecision( (yyvsp[(3) - (4)].interm.type).type, (yyvsp[(2) - (4)].interm.precision) );
3090 (yyval.interm.intermNode) = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003091 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003092 break;
3093
3094 case 74:
3095
3096 {
3097 //
3098 // Multiple declarations of the same function are allowed.
3099 //
3100 // If this is a definition, the definition production code will check for redefinitions
3101 // (we don't know at this point if it's a definition or not).
3102 //
3103 // Redeclarations are allowed. But, return types and parameter qualifiers must match.
3104 //
3105 TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find((yyvsp[(1) - (2)].interm.function)->getMangledName()));
3106 if (prevDec) {
3107 if (prevDec->getReturnType() != (yyvsp[(1) - (2)].interm.function)->getReturnType()) {
3108 context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same return type", (yyvsp[(1) - (2)].interm.function)->getReturnType().getBasicString(), "");
3109 context->recover();
3110 }
3111 for (int i = 0; i < prevDec->getParamCount(); ++i) {
3112 if (prevDec->getParam(i).type->getQualifier() != (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifier()) {
3113 context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same parameter qualifiers", (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifierString(), "");
3114 context->recover();
3115 }
3116 }
3117 }
3118
3119 //
3120 // If this is a redeclaration, it could also be a definition,
3121 // in which case, we want to use the variable names from this one, and not the one that's
3122 // being redeclared. So, pass back up this declaration, not the one in the symbol table.
3123 //
3124 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
3125 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
3126
daniel@transgaming.com5dd6d092012-03-20 20:10:28 +00003127 // We're at the inner scope level of the function's arguments and body statement.
3128 // Add the function prototype to the surrounding scope instead.
3129 context->symbolTable.getOuterLevel()->insert(*(yyval.interm).function);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003130 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003131 break;
3132
3133 case 75:
3134
3135 {
3136 (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003137 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003138 break;
3139
3140 case 76:
3141
3142 {
3143 (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003144 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003145 break;
3146
3147 case 77:
3148
3149 {
3150 // Add the parameter
3151 (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
3152 if ((yyvsp[(2) - (2)].interm).param.type->getBasicType() != EbtVoid)
3153 (yyvsp[(1) - (2)].interm.function)->addParameter((yyvsp[(2) - (2)].interm).param);
3154 else
3155 delete (yyvsp[(2) - (2)].interm).param.type;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003156 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003157 break;
3158
3159 case 78:
3160
3161 {
3162 //
3163 // Only first parameter of one-parameter functions can be void
3164 // The check for named parameters not being void is done in parameter_declarator
3165 //
3166 if ((yyvsp[(3) - (3)].interm).param.type->getBasicType() == EbtVoid) {
3167 //
3168 // This parameter > first is void
3169 //
3170 context->error((yyvsp[(2) - (3)].lex).line, "cannot be an argument type except for '(void)'", "void", "");
3171 context->recover();
3172 delete (yyvsp[(3) - (3)].interm).param.type;
3173 } else {
3174 // Add the parameter
3175 (yyval.interm.function) = (yyvsp[(1) - (3)].interm.function);
3176 (yyvsp[(1) - (3)].interm.function)->addParameter((yyvsp[(3) - (3)].interm).param);
3177 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003178 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003179 break;
3180
3181 case 79:
3182
3183 {
3184 if ((yyvsp[(1) - (3)].interm.type).qualifier != EvqGlobal && (yyvsp[(1) - (3)].interm.type).qualifier != EvqTemporary) {
3185 context->error((yyvsp[(2) - (3)].lex).line, "no qualifiers allowed for function return", getQualifierString((yyvsp[(1) - (3)].interm.type).qualifier), "");
3186 context->recover();
3187 }
3188 // make sure a sampler is not involved as well...
3189 if (context->structQualifierErrorCheck((yyvsp[(2) - (3)].lex).line, (yyvsp[(1) - (3)].interm.type)))
3190 context->recover();
3191
3192 // Add the function as a prototype after parsing it (we do not support recursion)
3193 TFunction *function;
3194 TType type((yyvsp[(1) - (3)].interm.type));
3195 function = new TFunction((yyvsp[(2) - (3)].lex).string, type);
3196 (yyval.interm.function) = function;
daniel@transgaming.com5dd6d092012-03-20 20:10:28 +00003197
3198 context->symbolTable.push();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003199 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003200 break;
3201
3202 case 80:
3203
3204 {
3205 if ((yyvsp[(1) - (2)].interm.type).type == EbtVoid) {
3206 context->error((yyvsp[(2) - (2)].lex).line, "illegal use of type 'void'", (yyvsp[(2) - (2)].lex).string->c_str(), "");
3207 context->recover();
3208 }
3209 if (context->reservedErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string))
3210 context->recover();
3211 TParameter param = {(yyvsp[(2) - (2)].lex).string, new TType((yyvsp[(1) - (2)].interm.type))};
3212 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
3213 (yyval.interm).param = param;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003214 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003215 break;
3216
3217 case 81:
3218
3219 {
3220 // Check that we can make an array out of this type
3221 if (context->arrayTypeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
3222 context->recover();
3223
3224 if (context->reservedErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string))
3225 context->recover();
3226
3227 int size;
3228 if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3229 context->recover();
3230 (yyvsp[(1) - (5)].interm.type).setArray(true, size);
3231
3232 TType* type = new TType((yyvsp[(1) - (5)].interm.type));
3233 TParameter param = { (yyvsp[(2) - (5)].lex).string, type };
3234 (yyval.interm).line = (yyvsp[(2) - (5)].lex).line;
3235 (yyval.interm).param = param;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003236 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003237 break;
3238
3239 case 82:
3240
3241 {
3242 (yyval.interm) = (yyvsp[(3) - (3)].interm);
3243 if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
3244 context->recover();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003245 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003246 break;
3247
3248 case 83:
3249
3250 {
3251 (yyval.interm) = (yyvsp[(2) - (2)].interm);
3252 if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
3253 context->recover();
3254 if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
3255 context->recover();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003256 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003257 break;
3258
3259 case 84:
3260
3261 {
3262 (yyval.interm) = (yyvsp[(3) - (3)].interm);
3263 if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
3264 context->recover();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003265 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003266 break;
3267
3268 case 85:
3269
3270 {
3271 (yyval.interm) = (yyvsp[(2) - (2)].interm);
3272 if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
3273 context->recover();
3274 if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
3275 context->recover();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003276 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003277 break;
3278
3279 case 86:
3280
3281 {
3282 (yyval.interm.qualifier) = EvqIn;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003283 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003284 break;
3285
3286 case 87:
3287
3288 {
3289 (yyval.interm.qualifier) = EvqIn;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003290 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003291 break;
3292
3293 case 88:
3294
3295 {
3296 (yyval.interm.qualifier) = EvqOut;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003297 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003298 break;
3299
3300 case 89:
3301
3302 {
3303 (yyval.interm.qualifier) = EvqInOut;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003304 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003305 break;
3306
3307 case 90:
3308
3309 {
3310 TParameter param = { 0, new TType((yyvsp[(1) - (1)].interm.type)) };
3311 (yyval.interm).param = param;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003312 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003313 break;
3314
3315 case 91:
3316
3317 {
3318 (yyval.interm) = (yyvsp[(1) - (1)].interm);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003319 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003320 break;
3321
3322 case 92:
3323
3324 {
daniel@transgaming.comeec8efc2012-03-09 21:57:49 +00003325 if ((yyvsp[(1) - (3)].interm).type.type == EbtInvariant && !(yyvsp[(3) - (3)].lex).symbol)
3326 {
3327 context->error((yyvsp[(3) - (3)].lex).line, "undeclared identifier declared as invariant", (yyvsp[(3) - (3)].lex).string->c_str(), "");
3328 context->recover();
3329 }
3330
zmo@google.comfd747b82011-04-23 01:30:07 +00003331 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(3) - (3)].lex).string, TType((yyvsp[(1) - (3)].interm).type), (yyvsp[(3) - (3)].lex).line);
3332 (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 +00003333
3334 if (context->structQualifierErrorCheck((yyvsp[(3) - (3)].lex).line, (yyval.interm).type))
3335 context->recover();
3336
3337 if (context->nonInitConstErrorCheck((yyvsp[(3) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyval.interm).type))
3338 context->recover();
3339
zmo@google.comfd747b82011-04-23 01:30:07 +00003340 TVariable* variable = 0;
3341 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 +00003342 context->recover();
zmo@google.comfd747b82011-04-23 01:30:07 +00003343 if (symbol && variable)
3344 symbol->setId(variable->getUniqueId());
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003345 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003346 break;
3347
3348 case 93:
3349
3350 {
3351 if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
3352 context->recover();
3353
3354 if (context->nonInitConstErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type))
3355 context->recover();
3356
3357 (yyval.interm) = (yyvsp[(1) - (5)].interm);
3358
3359 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))
3360 context->recover();
3361 else {
3362 (yyvsp[(1) - (5)].interm).type.setArray(true);
3363 TVariable* variable;
3364 if (context->arrayErrorCheck((yyvsp[(4) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, variable))
3365 context->recover();
3366 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003367 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003368 break;
3369
3370 case 94:
3371
3372 {
3373 if (context->structQualifierErrorCheck((yyvsp[(3) - (6)].lex).line, (yyvsp[(1) - (6)].interm).type))
3374 context->recover();
3375
3376 if (context->nonInitConstErrorCheck((yyvsp[(3) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type))
3377 context->recover();
3378
3379 (yyval.interm) = (yyvsp[(1) - (6)].interm);
3380
3381 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))
3382 context->recover();
3383 else {
3384 int size;
3385 if (context->arraySizeErrorCheck((yyvsp[(4) - (6)].lex).line, (yyvsp[(5) - (6)].interm.intermTypedNode), size))
3386 context->recover();
3387 (yyvsp[(1) - (6)].interm).type.setArray(true, size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003388 TVariable* variable = 0;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003389 if (context->arrayErrorCheck((yyvsp[(4) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type, variable))
3390 context->recover();
3391 TType type = TType((yyvsp[(1) - (6)].interm).type);
3392 type.setArraySize(size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003393 (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 +00003394 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003395 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003396 break;
3397
3398 case 95:
3399
3400 {
3401 if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
3402 context->recover();
3403
3404 (yyval.interm) = (yyvsp[(1) - (5)].interm);
3405
3406 TIntermNode* intermNode;
3407 if (!context->executeInitializer((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, (yyvsp[(5) - (5)].interm.intermTypedNode), intermNode)) {
3408 //
3409 // build the intermediate representation
3410 //
3411 if (intermNode)
3412 (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (5)].interm).intermNode, intermNode, (yyvsp[(4) - (5)].lex).line);
3413 else
3414 (yyval.interm).intermAggregate = (yyvsp[(1) - (5)].interm).intermAggregate;
3415 } else {
3416 context->recover();
3417 (yyval.interm).intermAggregate = 0;
3418 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003419 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003420 break;
3421
3422 case 96:
3423
3424 {
3425 (yyval.interm).type = (yyvsp[(1) - (1)].interm.type);
3426 (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 +00003427 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003428 break;
3429
3430 case 97:
3431
3432 {
zmo@google.comfd747b82011-04-23 01:30:07 +00003433 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyvsp[(1) - (2)].interm.type)), (yyvsp[(2) - (2)].lex).line);
3434 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (2)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003435
3436 if (context->structQualifierErrorCheck((yyvsp[(2) - (2)].lex).line, (yyval.interm).type))
3437 context->recover();
3438
3439 if (context->nonInitConstErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string, (yyval.interm).type))
3440 context->recover();
3441
3442 (yyval.interm).type = (yyvsp[(1) - (2)].interm.type);
3443
zmo@google.comfd747b82011-04-23 01:30:07 +00003444 TVariable* variable = 0;
3445 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 +00003446 context->recover();
zmo@google.comfd747b82011-04-23 01:30:07 +00003447 if (variable && symbol)
3448 symbol->setId(variable->getUniqueId());
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003449 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003450 break;
3451
3452 case 98:
3453
3454 {
kbr@chromium.org04277b82011-06-02 18:41:26 +00003455 context->error((yyvsp[(2) - (4)].lex).line, "unsized array declarations not supported", (yyvsp[(2) - (4)].lex).string->c_str(), "");
3456 context->recover();
3457
zmo@google.comfd747b82011-04-23 01:30:07 +00003458 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (4)].lex).string, TType((yyvsp[(1) - (4)].interm.type)), (yyvsp[(2) - (4)].lex).line);
3459 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (4)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003460 (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003461 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003462 break;
3463
3464 case 99:
3465
3466 {
3467 TType type = TType((yyvsp[(1) - (5)].interm.type));
3468 int size;
3469 if (context->arraySizeErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3470 context->recover();
3471 type.setArraySize(size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003472 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (5)].lex).string, type, (yyvsp[(2) - (5)].lex).line);
3473 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (5)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003474
3475 if (context->structQualifierErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
3476 context->recover();
3477
3478 if (context->nonInitConstErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type)))
3479 context->recover();
3480
3481 (yyval.interm).type = (yyvsp[(1) - (5)].interm.type);
3482
3483 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)))
3484 context->recover();
3485 else {
3486 int size;
3487 if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3488 context->recover();
3489
3490 (yyvsp[(1) - (5)].interm.type).setArray(true, size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003491 TVariable* variable = 0;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003492 if (context->arrayErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type), variable))
3493 context->recover();
zmo@google.comfd747b82011-04-23 01:30:07 +00003494 if (variable && symbol)
3495 symbol->setId(variable->getUniqueId());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003496 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003497 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003498 break;
3499
3500 case 100:
3501
3502 {
3503 if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
3504 context->recover();
3505
3506 (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
3507
3508 TIntermNode* intermNode;
3509 if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode)) {
3510 //
3511 // Build intermediate representation
3512 //
3513 if(intermNode)
3514 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(intermNode, (yyvsp[(3) - (4)].lex).line);
3515 else
3516 (yyval.interm).intermAggregate = 0;
3517 } else {
3518 context->recover();
3519 (yyval.interm).intermAggregate = 0;
3520 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003521 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003522 break;
3523
3524 case 101:
3525
3526 {
3527 VERTEX_ONLY("invariant declaration", (yyvsp[(1) - (2)].lex).line);
daniel@transgaming.comeec8efc2012-03-09 21:57:49 +00003528 if (context->globalErrorCheck((yyvsp[(1) - (2)].lex).line, context->symbolTable.atGlobalLevel(), "invariant varying"))
3529 context->recover();
3530 (yyval.interm).type.setBasic(EbtInvariant, EvqInvariantVaryingOut, (yyvsp[(2) - (2)].lex).line);
3531 if (!(yyvsp[(2) - (2)].lex).symbol)
3532 {
3533 context->error((yyvsp[(2) - (2)].lex).line, "undeclared identifier declared as invariant", (yyvsp[(2) - (2)].lex).string->c_str(), "");
3534 context->recover();
3535
3536 (yyval.interm).intermAggregate = 0;
3537 }
3538 else
3539 {
3540 TIntermSymbol *symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyval.interm).type), (yyvsp[(2) - (2)].lex).line);
3541 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (2)].lex).line);
3542 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003543 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003544 break;
3545
3546 case 102:
3547
3548 {
3549 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3550
3551 if ((yyvsp[(1) - (1)].interm.type).array) {
3552 context->error((yyvsp[(1) - (1)].interm.type).line, "not supported", "first-class array", "");
3553 context->recover();
3554 (yyvsp[(1) - (1)].interm.type).setArray(false);
3555 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003556 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003557 break;
3558
3559 case 103:
3560
3561 {
3562 if ((yyvsp[(2) - (2)].interm.type).array) {
3563 context->error((yyvsp[(2) - (2)].interm.type).line, "not supported", "first-class array", "");
3564 context->recover();
3565 (yyvsp[(2) - (2)].interm.type).setArray(false);
3566 }
3567
3568 if ((yyvsp[(1) - (2)].interm.type).qualifier == EvqAttribute &&
3569 ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
3570 context->error((yyvsp[(2) - (2)].interm.type).line, "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier), "");
3571 context->recover();
3572 }
3573 if (((yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingIn || (yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingOut) &&
3574 ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
3575 context->error((yyvsp[(2) - (2)].interm.type).line, "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier), "");
3576 context->recover();
3577 }
3578 (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
3579 (yyval.interm.type).qualifier = (yyvsp[(1) - (2)].interm.type).qualifier;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003580 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003581 break;
3582
3583 case 104:
3584
3585 {
3586 (yyval.interm.type).setBasic(EbtVoid, EvqConst, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003587 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003588 break;
3589
3590 case 105:
3591
3592 {
3593 VERTEX_ONLY("attribute", (yyvsp[(1) - (1)].lex).line);
3594 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "attribute"))
3595 context->recover();
3596 (yyval.interm.type).setBasic(EbtVoid, EvqAttribute, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003597 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003598 break;
3599
3600 case 106:
3601
3602 {
3603 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "varying"))
3604 context->recover();
3605 if (context->shaderType == SH_VERTEX_SHADER)
3606 (yyval.interm.type).setBasic(EbtVoid, EvqVaryingOut, (yyvsp[(1) - (1)].lex).line);
3607 else
3608 (yyval.interm.type).setBasic(EbtVoid, EvqVaryingIn, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003609 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003610 break;
3611
3612 case 107:
3613
3614 {
3615 if (context->globalErrorCheck((yyvsp[(1) - (2)].lex).line, context->symbolTable.atGlobalLevel(), "invariant varying"))
3616 context->recover();
3617 if (context->shaderType == SH_VERTEX_SHADER)
3618 (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingOut, (yyvsp[(1) - (2)].lex).line);
3619 else
3620 (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingIn, (yyvsp[(1) - (2)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003621 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003622 break;
3623
3624 case 108:
3625
3626 {
3627 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "uniform"))
3628 context->recover();
3629 (yyval.interm.type).setBasic(EbtVoid, EvqUniform, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003630 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003631 break;
3632
3633 case 109:
3634
3635 {
3636 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
zmo@google.comdc4b4f82011-06-17 00:42:53 +00003637
3638 if ((yyval.interm.type).precision == EbpUndefined) {
3639 (yyval.interm.type).precision = context->symbolTable.getDefaultPrecision((yyvsp[(1) - (1)].interm.type).type);
3640 if (context->precisionErrorCheck((yyvsp[(1) - (1)].interm.type).line, (yyval.interm.type).precision, (yyvsp[(1) - (1)].interm.type).type)) {
3641 context->recover();
3642 }
3643 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003644 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003645 break;
3646
3647 case 110:
3648
3649 {
3650 (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
3651 (yyval.interm.type).precision = (yyvsp[(1) - (2)].interm.precision);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003652 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003653 break;
3654
3655 case 111:
3656
3657 {
3658 (yyval.interm.precision) = EbpHigh;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003659 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003660 break;
3661
3662 case 112:
3663
3664 {
3665 (yyval.interm.precision) = EbpMedium;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003666 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003667 break;
3668
3669 case 113:
3670
3671 {
3672 (yyval.interm.precision) = EbpLow;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003673 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003674 break;
3675
3676 case 114:
3677
3678 {
3679 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003680 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003681 break;
3682
3683 case 115:
3684
3685 {
3686 (yyval.interm.type) = (yyvsp[(1) - (4)].interm.type);
3687
3688 if (context->arrayTypeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
3689 context->recover();
3690 else {
3691 int size;
3692 if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
3693 context->recover();
3694 (yyval.interm.type).setArray(true, size);
3695 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003696 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003697 break;
3698
3699 case 116:
3700
3701 {
3702 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3703 (yyval.interm.type).setBasic(EbtVoid, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003704 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003705 break;
3706
3707 case 117:
3708
3709 {
3710 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3711 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003712 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003713 break;
3714
3715 case 118:
3716
3717 {
3718 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3719 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003720 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003721 break;
3722
3723 case 119:
3724
3725 {
3726 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3727 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003728 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003729 break;
3730
3731 case 120:
3732
3733 {
3734 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3735 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3736 (yyval.interm.type).setAggregate(2);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003737 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003738 break;
3739
3740 case 121:
3741
3742 {
3743 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3744 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3745 (yyval.interm.type).setAggregate(3);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003746 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003747 break;
3748
3749 case 122:
3750
3751 {
3752 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3753 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3754 (yyval.interm.type).setAggregate(4);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003755 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003756 break;
3757
3758 case 123:
3759
3760 {
3761 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3762 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3763 (yyval.interm.type).setAggregate(2);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003764 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003765 break;
3766
3767 case 124:
3768
3769 {
3770 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3771 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3772 (yyval.interm.type).setAggregate(3);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003773 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003774 break;
3775
3776 case 125:
3777
3778 {
3779 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3780 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3781 (yyval.interm.type).setAggregate(4);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003782 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003783 break;
3784
3785 case 126:
3786
3787 {
3788 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3789 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3790 (yyval.interm.type).setAggregate(2);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003791 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003792 break;
3793
3794 case 127:
3795
3796 {
3797 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3798 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3799 (yyval.interm.type).setAggregate(3);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003800 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003801 break;
3802
3803 case 128:
3804
3805 {
3806 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3807 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3808 (yyval.interm.type).setAggregate(4);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003809 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003810 break;
3811
3812 case 129:
3813
3814 {
3815 FRAG_VERT_ONLY("mat2", (yyvsp[(1) - (1)].lex).line);
3816 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3817 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3818 (yyval.interm.type).setAggregate(2, true);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003819 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003820 break;
3821
3822 case 130:
3823
3824 {
3825 FRAG_VERT_ONLY("mat3", (yyvsp[(1) - (1)].lex).line);
3826 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3827 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3828 (yyval.interm.type).setAggregate(3, true);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003829 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003830 break;
3831
3832 case 131:
3833
3834 {
3835 FRAG_VERT_ONLY("mat4", (yyvsp[(1) - (1)].lex).line);
3836 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3837 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3838 (yyval.interm.type).setAggregate(4, true);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003839 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003840 break;
3841
3842 case 132:
3843
3844 {
3845 FRAG_VERT_ONLY("sampler2D", (yyvsp[(1) - (1)].lex).line);
3846 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3847 (yyval.interm.type).setBasic(EbtSampler2D, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003848 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003849 break;
3850
3851 case 133:
3852
3853 {
3854 FRAG_VERT_ONLY("samplerCube", (yyvsp[(1) - (1)].lex).line);
3855 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3856 (yyval.interm.type).setBasic(EbtSamplerCube, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003857 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003858 break;
3859
3860 case 134:
3861
3862 {
zmo@google.com09c323a2011-08-12 18:22:25 +00003863 if (!context->supportsExtension("GL_OES_EGL_image_external")) {
3864 context->error((yyvsp[(1) - (1)].lex).line, "unsupported type", "samplerExternalOES", "");
3865 context->recover();
3866 }
3867 FRAG_VERT_ONLY("samplerExternalOES", (yyvsp[(1) - (1)].lex).line);
3868 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3869 (yyval.interm.type).setBasic(EbtSamplerExternalOES, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003870 }
zmo@google.com09c323a2011-08-12 18:22:25 +00003871 break;
3872
3873 case 135:
3874
3875 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00003876 if (!context->supportsExtension("GL_ARB_texture_rectangle")) {
3877 context->error((yyvsp[(1) - (1)].lex).line, "unsupported type", "sampler2DRect", "");
3878 context->recover();
3879 }
3880 FRAG_VERT_ONLY("sampler2DRect", (yyvsp[(1) - (1)].lex).line);
3881 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3882 (yyval.interm.type).setBasic(EbtSampler2DRect, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003883 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003884 break;
3885
zmo@google.com09c323a2011-08-12 18:22:25 +00003886 case 136:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003887
3888 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00003889 FRAG_VERT_ONLY("struct", (yyvsp[(1) - (1)].interm.type).line);
3890 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3891 (yyval.interm.type).qualifier = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003892 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003893 break;
3894
3895 case 137:
3896
3897 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003898 //
3899 // This is for user defined type names. The lexical phase looked up the
3900 // type.
3901 //
3902 TType& structure = static_cast<TVariable*>((yyvsp[(1) - (1)].lex).symbol)->getType();
3903 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3904 (yyval.interm.type).setBasic(EbtStruct, qual, (yyvsp[(1) - (1)].lex).line);
3905 (yyval.interm.type).userDef = &structure;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003906 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003907 break;
3908
zmo@google.com09c323a2011-08-12 18:22:25 +00003909 case 138:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003910
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003911 { if (context->enterStructDeclaration((yyvsp[(2) - (3)].lex).line, *(yyvsp[(2) - (3)].lex).string)) context->recover(); }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003912 break;
3913
3914 case 139:
3915
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003916 {
kbr@chromium.org476541f2011-10-27 21:14:51 +00003917 if (context->reservedErrorCheck((yyvsp[(2) - (6)].lex).line, *(yyvsp[(2) - (6)].lex).string))
3918 context->recover();
3919
3920 TType* structure = new TType((yyvsp[(5) - (6)].interm.typeList), *(yyvsp[(2) - (6)].lex).string);
3921 TVariable* userTypeDef = new TVariable((yyvsp[(2) - (6)].lex).string, *structure, true);
3922 if (! context->symbolTable.insert(*userTypeDef)) {
3923 context->error((yyvsp[(2) - (6)].lex).line, "redefinition", (yyvsp[(2) - (6)].lex).string->c_str(), "struct");
3924 context->recover();
3925 }
3926 (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (6)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003927 (yyval.interm.type).userDef = structure;
kbr@chromium.org476541f2011-10-27 21:14:51 +00003928 context->exitStructDeclaration();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003929 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00003930 break;
3931
3932 case 140:
3933
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003934 { if (context->enterStructDeclaration((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string)) context->recover(); }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003935 break;
3936
3937 case 141:
3938
kbr@chromium.org476541f2011-10-27 21:14:51 +00003939 {
3940 TType* structure = new TType((yyvsp[(4) - (5)].interm.typeList), TString(""));
3941 (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (5)].lex).line);
3942 (yyval.interm.type).userDef = structure;
3943 context->exitStructDeclaration();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003944 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003945 break;
3946
kbr@chromium.org476541f2011-10-27 21:14:51 +00003947 case 142:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003948
3949 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00003950 (yyval.interm.typeList) = (yyvsp[(1) - (1)].interm.typeList);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003951 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003952 break;
3953
3954 case 143:
3955
3956 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003957 (yyval.interm.typeList) = (yyvsp[(1) - (2)].interm.typeList);
3958 for (unsigned int i = 0; i < (yyvsp[(2) - (2)].interm.typeList)->size(); ++i) {
3959 for (unsigned int j = 0; j < (yyval.interm.typeList)->size(); ++j) {
3960 if ((*(yyval.interm.typeList))[j].type->getFieldName() == (*(yyvsp[(2) - (2)].interm.typeList))[i].type->getFieldName()) {
3961 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());
3962 context->recover();
3963 }
3964 }
3965 (yyval.interm.typeList)->push_back((*(yyvsp[(2) - (2)].interm.typeList))[i]);
3966 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003967 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003968 break;
3969
kbr@chromium.org205fef32011-11-22 20:50:02 +00003970 case 144:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003971
3972 {
3973 (yyval.interm.typeList) = (yyvsp[(2) - (3)].interm.typeList);
3974
3975 if (context->voidErrorCheck((yyvsp[(1) - (3)].interm.type).line, (*(yyvsp[(2) - (3)].interm.typeList))[0].type->getFieldName(), (yyvsp[(1) - (3)].interm.type))) {
3976 context->recover();
3977 }
3978 for (unsigned int i = 0; i < (yyval.interm.typeList)->size(); ++i) {
3979 //
3980 // Careful not to replace already known aspects of type, like array-ness
3981 //
3982 TType* type = (*(yyval.interm.typeList))[i].type;
3983 type->setBasicType((yyvsp[(1) - (3)].interm.type).type);
3984 type->setNominalSize((yyvsp[(1) - (3)].interm.type).size);
3985 type->setMatrix((yyvsp[(1) - (3)].interm.type).matrix);
zmo@google.comdc4b4f82011-06-17 00:42:53 +00003986 type->setPrecision((yyvsp[(1) - (3)].interm.type).precision);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003987
3988 // don't allow arrays of arrays
3989 if (type->isArray()) {
3990 if (context->arrayTypeErrorCheck((yyvsp[(1) - (3)].interm.type).line, (yyvsp[(1) - (3)].interm.type)))
3991 context->recover();
3992 }
3993 if ((yyvsp[(1) - (3)].interm.type).array)
3994 type->setArraySize((yyvsp[(1) - (3)].interm.type).arraySize);
3995 if ((yyvsp[(1) - (3)].interm.type).userDef) {
3996 type->setStruct((yyvsp[(1) - (3)].interm.type).userDef->getStruct());
3997 type->setTypeName((yyvsp[(1) - (3)].interm.type).userDef->getTypeName());
3998 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00003999
4000 if (context->structNestingErrorCheck((yyvsp[(1) - (3)].interm.type).line, *type)) {
4001 context->recover();
4002 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004003 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004004 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004005 break;
4006
kbr@chromium.org476541f2011-10-27 21:14:51 +00004007 case 145:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004008
4009 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004010 (yyval.interm.typeList) = NewPoolTTypeList();
4011 (yyval.interm.typeList)->push_back((yyvsp[(1) - (1)].interm.typeLine));
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004012 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004013 break;
4014
kbr@chromium.org476541f2011-10-27 21:14:51 +00004015 case 146:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004016
4017 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004018 (yyval.interm.typeList)->push_back((yyvsp[(3) - (3)].interm.typeLine));
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004019 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004020 break;
4021
4022 case 147:
4023
4024 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004025 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
4026 context->recover();
4027
4028 (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
4029 (yyval.interm.typeLine).line = (yyvsp[(1) - (1)].lex).line;
4030 (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (1)].lex).string);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004031 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004032 break;
4033
kbr@chromium.org205fef32011-11-22 20:50:02 +00004034 case 148:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004035
4036 {
4037 if (context->reservedErrorCheck((yyvsp[(1) - (4)].lex).line, *(yyvsp[(1) - (4)].lex).string))
4038 context->recover();
4039
4040 (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
4041 (yyval.interm.typeLine).line = (yyvsp[(1) - (4)].lex).line;
4042 (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (4)].lex).string);
4043
4044 int size;
4045 if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
4046 context->recover();
4047 (yyval.interm.typeLine).type->setArraySize(size);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004048 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004049 break;
4050
4051 case 149:
4052
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004053 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004054 break;
4055
4056 case 150:
4057
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004058 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004059 break;
4060
4061 case 151:
4062
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004063 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermAggregate); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004064 break;
4065
4066 case 152:
4067
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004068 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004069 break;
4070
4071 case 153:
4072
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004073 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004074 break;
4075
4076 case 154:
4077
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004078 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004079 break;
4080
4081 case 155:
4082
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004083 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004084 break;
4085
4086 case 156:
4087
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004088 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004089 break;
4090
4091 case 157:
4092
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004093 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
zmo@google.com09c323a2011-08-12 18:22:25 +00004094 break;
4095
4096 case 158:
4097
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004098 { (yyval.interm.intermAggregate) = 0; }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004099 break;
4100
4101 case 159:
4102
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004103 { context->symbolTable.push(); }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004104 break;
4105
4106 case 160:
4107
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004108 { context->symbolTable.pop(); }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004109 break;
4110
4111 case 161:
4112
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004113 {
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004114 if ((yyvsp[(3) - (5)].interm.intermAggregate) != 0) {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004115 (yyvsp[(3) - (5)].interm.intermAggregate)->setOp(EOpSequence);
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004116 (yyvsp[(3) - (5)].interm.intermAggregate)->setEndLine((yyvsp[(5) - (5)].lex).line);
4117 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004118 (yyval.interm.intermAggregate) = (yyvsp[(3) - (5)].interm.intermAggregate);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004119 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004120 break;
4121
4122 case 162:
4123
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004124 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004125 break;
4126
4127 case 163:
4128
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004129 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004130 break;
4131
kbr@chromium.org476541f2011-10-27 21:14:51 +00004132 case 164:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004133
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004134 { context->symbolTable.push(); }
4135 break;
4136
4137 case 165:
4138
4139 { context->symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[(2) - (2)].interm.intermNode); }
4140 break;
4141
4142 case 166:
4143
4144 { context->symbolTable.push(); }
4145 break;
4146
4147 case 167:
4148
4149 { context->symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[(2) - (2)].interm.intermNode); }
4150 break;
4151
4152 case 168:
4153
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004154 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004155 (yyval.interm.intermNode) = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004156 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004157 break;
4158
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004159 case 169:
kbr@chromium.org205fef32011-11-22 20:50:02 +00004160
4161 {
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004162 if ((yyvsp[(2) - (3)].interm.intermAggregate)) {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004163 (yyvsp[(2) - (3)].interm.intermAggregate)->setOp(EOpSequence);
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004164 (yyvsp[(2) - (3)].interm.intermAggregate)->setEndLine((yyvsp[(3) - (3)].lex).line);
4165 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004166 (yyval.interm.intermNode) = (yyvsp[(2) - (3)].interm.intermAggregate);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004167 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004168 break;
4169
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004170 case 170:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004171
4172 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004173 (yyval.interm.intermAggregate) = context->intermediate.makeAggregate((yyvsp[(1) - (1)].interm.intermNode), 0);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004174 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004175 break;
4176
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004177 case 171:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004178
kbr@chromium.org205fef32011-11-22 20:50:02 +00004179 {
4180 (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 +00004181 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004182 break;
4183
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004184 case 172:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004185
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004186 { (yyval.interm.intermNode) = 0; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004187 break;
4188
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004189 case 173:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004190
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004191 { (yyval.interm.intermNode) = static_cast<TIntermNode*>((yyvsp[(1) - (2)].interm.intermTypedNode)); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004192 break;
4193
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004194 case 174:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004195
4196 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004197 if (context->boolErrorCheck((yyvsp[(1) - (5)].lex).line, (yyvsp[(3) - (5)].interm.intermTypedNode)))
4198 context->recover();
4199 (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 +00004200 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004201 break;
4202
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004203 case 175:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004204
4205 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004206 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermNode);
4207 (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004208 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004209 break;
4210
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004211 case 176:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004212
4213 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004214 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (1)].interm.intermNode);
4215 (yyval.interm.nodePair).node2 = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004216 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004217 break;
4218
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004219 case 177:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004220
4221 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004222 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
4223 if (context->boolErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)->getLine(), (yyvsp[(1) - (1)].interm.intermTypedNode)))
4224 context->recover();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004225 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004226 break;
4227
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004228 case 178:
kbr@chromium.org205fef32011-11-22 20:50:02 +00004229
4230 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004231 TIntermNode* intermNode;
4232 if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
4233 context->recover();
4234 if (context->boolErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
4235 context->recover();
4236
4237 if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode))
4238 (yyval.interm.intermTypedNode) = (yyvsp[(4) - (4)].interm.intermTypedNode);
4239 else {
4240 context->recover();
4241 (yyval.interm.intermTypedNode) = 0;
4242 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004243 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004244 break;
4245
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004246 case 179:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004247
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004248 { context->symbolTable.push(); ++context->loopNestingLevel; }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004249 break;
4250
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004251 case 180:
kbr@chromium.org205fef32011-11-22 20:50:02 +00004252
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004253 {
4254 context->symbolTable.pop();
alokp@chromium.org52813552010-11-16 18:36:09 +00004255 (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 +00004256 --context->loopNestingLevel;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004257 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004258 break;
4259
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004260 case 181:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004261
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004262 { ++context->loopNestingLevel; }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004263 break;
4264
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004265 case 182:
kbr@chromium.org205fef32011-11-22 20:50:02 +00004266
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004267 {
4268 if (context->boolErrorCheck((yyvsp[(8) - (8)].lex).line, (yyvsp[(6) - (8)].interm.intermTypedNode)))
4269 context->recover();
4270
alokp@chromium.org52813552010-11-16 18:36:09 +00004271 (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 +00004272 --context->loopNestingLevel;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004273 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004274 break;
4275
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004276 case 183:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004277
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004278 { context->symbolTable.push(); ++context->loopNestingLevel; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004279 break;
4280
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004281 case 184:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004282
4283 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004284 context->symbolTable.pop();
4285 (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);
4286 --context->loopNestingLevel;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004287 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004288 break;
4289
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004290 case 185:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004291
4292 {
kbr@chromium.org476541f2011-10-27 21:14:51 +00004293 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004294 }
zmo@google.com09c323a2011-08-12 18:22:25 +00004295 break;
4296
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004297 case 186:
zmo@google.com09c323a2011-08-12 18:22:25 +00004298
4299 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004300 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004301 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004302 break;
4303
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004304 case 187:
kbr@chromium.org476541f2011-10-27 21:14:51 +00004305
4306 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004307 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004308 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004309 break;
4310
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004311 case 188:
kbr@chromium.org476541f2011-10-27 21:14:51 +00004312
4313 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004314 (yyval.interm.intermTypedNode) = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004315 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004316 break;
4317
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004318 case 189:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004319
4320 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004321 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (2)].interm.intermTypedNode);
4322 (yyval.interm.nodePair).node2 = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004323 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004324 break;
4325
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004326 case 190:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004327
4328 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004329 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermTypedNode);
4330 (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004331 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004332 break;
4333
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004334 case 191:
kbr@chromium.org205fef32011-11-22 20:50:02 +00004335
4336 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004337 if (context->loopNestingLevel <= 0) {
4338 context->error((yyvsp[(1) - (2)].lex).line, "continue statement only allowed in loops", "", "");
4339 context->recover();
4340 }
4341 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpContinue, (yyvsp[(1) - (2)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004342 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004343 break;
4344
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004345 case 192:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004346
4347 {
4348 if (context->loopNestingLevel <= 0) {
4349 context->error((yyvsp[(1) - (2)].lex).line, "break statement only allowed in loops", "", "");
4350 context->recover();
4351 }
4352 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpBreak, (yyvsp[(1) - (2)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004353 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004354 break;
4355
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004356 case 193:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004357
4358 {
4359 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(1) - (2)].lex).line);
4360 if (context->currentFunctionType->getBasicType() != EbtVoid) {
4361 context->error((yyvsp[(1) - (2)].lex).line, "non-void function must return a value", "return", "");
4362 context->recover();
4363 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004364 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004365 break;
4366
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004367 case 194:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004368
4369 {
4370 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(2) - (3)].interm.intermTypedNode), (yyvsp[(1) - (3)].lex).line);
4371 context->functionReturnsValue = true;
4372 if (context->currentFunctionType->getBasicType() == EbtVoid) {
4373 context->error((yyvsp[(1) - (3)].lex).line, "void function cannot return a value", "return", "");
4374 context->recover();
4375 } else if (*(context->currentFunctionType) != (yyvsp[(2) - (3)].interm.intermTypedNode)->getType()) {
4376 context->error((yyvsp[(1) - (3)].lex).line, "function return is not matching type:", "return", "");
4377 context->recover();
4378 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004379 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004380 break;
4381
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004382 case 195:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004383
4384 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004385 FRAG_ONLY("discard", (yyvsp[(1) - (2)].lex).line);
4386 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpKill, (yyvsp[(1) - (2)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004387 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004388 break;
4389
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004390 case 196:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004391
4392 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004393 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
zmo@google.com09c323a2011-08-12 18:22:25 +00004394 context->treeRoot = (yyval.interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004395 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004396 break;
4397
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004398 case 197:
zmo@google.com09c323a2011-08-12 18:22:25 +00004399
4400 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004401 (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermNode), (yyvsp[(2) - (2)].interm.intermNode), 0);
4402 context->treeRoot = (yyval.interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004403 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004404 break;
4405
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004406 case 198:
kbr@chromium.org476541f2011-10-27 21:14:51 +00004407
4408 {
4409 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004410 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004411 break;
4412
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004413 case 199:
kbr@chromium.org476541f2011-10-27 21:14:51 +00004414
4415 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004416 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004417 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004418 break;
4419
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004420 case 200:
kbr@chromium.org205fef32011-11-22 20:50:02 +00004421
4422 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004423 TFunction* function = (yyvsp[(1) - (1)].interm).function;
4424 TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find(function->getMangledName()));
4425 //
4426 // Note: 'prevDec' could be 'function' if this is the first time we've seen function
4427 // as it would have just been put in the symbol table. Otherwise, we're looking up
4428 // an earlier occurance.
4429 //
4430 if (prevDec->isDefined()) {
4431 //
4432 // Then this function already has a body.
4433 //
4434 context->error((yyvsp[(1) - (1)].interm).line, "function already has a body", function->getName().c_str(), "");
4435 context->recover();
4436 }
4437 prevDec->setDefined();
4438
4439 //
4440 // Raise error message if main function takes any parameters or return anything other than void
4441 //
4442 if (function->getName() == "main") {
4443 if (function->getParamCount() > 0) {
4444 context->error((yyvsp[(1) - (1)].interm).line, "function cannot take any parameter(s)", function->getName().c_str(), "");
4445 context->recover();
4446 }
4447 if (function->getReturnType().getBasicType() != EbtVoid) {
4448 context->error((yyvsp[(1) - (1)].interm).line, "", function->getReturnType().getBasicString(), "main function cannot return a value");
4449 context->recover();
4450 }
4451 }
4452
4453 //
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004454 // Remember the return type for later checking for RETURN statements.
4455 //
4456 context->currentFunctionType = &(prevDec->getReturnType());
4457 context->functionReturnsValue = false;
4458
4459 //
4460 // Insert parameters into the symbol table.
4461 // If the parameter has no name, it's not an error, just don't insert it
4462 // (could be used for unused args).
4463 //
4464 // Also, accumulate the list of parameters into the HIL, so lower level code
4465 // knows where to find parameters.
4466 //
4467 TIntermAggregate* paramNodes = new TIntermAggregate;
4468 for (int i = 0; i < function->getParamCount(); i++) {
4469 const TParameter& param = function->getParam(i);
4470 if (param.name != 0) {
4471 TVariable *variable = new TVariable(param.name, *param.type);
4472 //
4473 // Insert the parameters with name in the symbol table.
4474 //
4475 if (! context->symbolTable.insert(*variable)) {
4476 context->error((yyvsp[(1) - (1)].interm).line, "redefinition", variable->getName().c_str(), "");
4477 context->recover();
4478 delete variable;
4479 }
4480
4481 //
4482 // Add the parameter to the HIL
4483 //
4484 paramNodes = context->intermediate.growAggregate(
4485 paramNodes,
4486 context->intermediate.addSymbol(variable->getUniqueId(),
4487 variable->getName(),
4488 variable->getType(), (yyvsp[(1) - (1)].interm).line),
4489 (yyvsp[(1) - (1)].interm).line);
4490 } else {
4491 paramNodes = context->intermediate.growAggregate(paramNodes, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (1)].interm).line), (yyvsp[(1) - (1)].interm).line);
4492 }
4493 }
4494 context->intermediate.setAggregateOperator(paramNodes, EOpParameters, (yyvsp[(1) - (1)].interm).line);
4495 (yyvsp[(1) - (1)].interm).intermAggregate = paramNodes;
4496 context->loopNestingLevel = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004497 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004498 break;
4499
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004500 case 201:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004501
4502 {
4503 //?? Check that all paths return a value if return type != void ?
4504 // May be best done as post process phase on intermediate code
4505 if (context->currentFunctionType->getBasicType() != EbtVoid && ! context->functionReturnsValue) {
4506 context->error((yyvsp[(1) - (3)].interm).line, "function does not return a value:", "", (yyvsp[(1) - (3)].interm).function->getName().c_str());
4507 context->recover();
4508 }
daniel@transgaming.com5dd6d092012-03-20 20:10:28 +00004509
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004510 (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermAggregate, (yyvsp[(3) - (3)].interm.intermNode), 0);
4511 context->intermediate.setAggregateOperator((yyval.interm.intermNode), EOpFunction, (yyvsp[(1) - (3)].interm).line);
4512 (yyval.interm.intermNode)->getAsAggregate()->setName((yyvsp[(1) - (3)].interm).function->getMangledName().c_str());
4513 (yyval.interm.intermNode)->getAsAggregate()->setType((yyvsp[(1) - (3)].interm).function->getReturnType());
4514
4515 // store the pragma information for debug and optimize and other vendor specific
4516 // information. This information can be queried from the parse tree
4517 (yyval.interm.intermNode)->getAsAggregate()->setOptimize(context->contextPragma.optimize);
4518 (yyval.interm.intermNode)->getAsAggregate()->setDebug(context->contextPragma.debug);
4519 (yyval.interm.intermNode)->getAsAggregate()->addToPragmaTable(context->contextPragma.pragmaTable);
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004520
4521 if ((yyvsp[(3) - (3)].interm.intermNode) && (yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate())
4522 (yyval.interm.intermNode)->getAsAggregate()->setEndLine((yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate()->getEndLine());
daniel@transgaming.com5dd6d092012-03-20 20:10:28 +00004523
4524 context->symbolTable.pop();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004525 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004526 break;
4527
4528
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004529
4530 default: break;
4531 }
4532 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
4533
4534 YYPOPSTACK (yylen);
4535 yylen = 0;
4536 YY_STACK_PRINT (yyss, yyssp);
4537
4538 *++yyvsp = yyval;
4539
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004540 /* Now `shift' the result of the reduction. Determine what state
4541 that goes to, based on the state we popped back to and the rule
4542 number reduced by. */
4543
4544 yyn = yyr1[yyn];
4545
4546 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
4547 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
4548 yystate = yytable[yystate];
4549 else
4550 yystate = yydefgoto[yyn - YYNTOKENS];
4551
4552 goto yynewstate;
4553
4554
4555/*------------------------------------.
4556| yyerrlab -- here on detecting error |
4557`------------------------------------*/
4558yyerrlab:
4559 /* If not already recovering from an error, report this error. */
4560 if (!yyerrstatus)
4561 {
4562 ++yynerrs;
4563#if ! YYERROR_VERBOSE
4564 yyerror (context, YY_("syntax error"));
4565#else
4566 {
4567 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
4568 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
4569 {
4570 YYSIZE_T yyalloc = 2 * yysize;
4571 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
4572 yyalloc = YYSTACK_ALLOC_MAXIMUM;
4573 if (yymsg != yymsgbuf)
4574 YYSTACK_FREE (yymsg);
4575 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
4576 if (yymsg)
4577 yymsg_alloc = yyalloc;
4578 else
4579 {
4580 yymsg = yymsgbuf;
4581 yymsg_alloc = sizeof yymsgbuf;
4582 }
4583 }
4584
4585 if (0 < yysize && yysize <= yymsg_alloc)
4586 {
4587 (void) yysyntax_error (yymsg, yystate, yychar);
4588 yyerror (context, yymsg);
4589 }
4590 else
4591 {
4592 yyerror (context, YY_("syntax error"));
4593 if (yysize != 0)
4594 goto yyexhaustedlab;
4595 }
4596 }
4597#endif
4598 }
4599
4600
4601
4602 if (yyerrstatus == 3)
4603 {
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004604 /* If just tried and failed to reuse lookahead token after an
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004605 error, discard it. */
4606
4607 if (yychar <= YYEOF)
4608 {
4609 /* Return failure if at end of input. */
4610 if (yychar == YYEOF)
4611 YYABORT;
4612 }
4613 else
4614 {
4615 yydestruct ("Error: discarding",
4616 yytoken, &yylval, context);
4617 yychar = YYEMPTY;
4618 }
4619 }
4620
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004621 /* Else will try to reuse lookahead token after shifting the error
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004622 token. */
4623 goto yyerrlab1;
4624
4625
4626/*---------------------------------------------------.
4627| yyerrorlab -- error raised explicitly by YYERROR. |
4628`---------------------------------------------------*/
4629yyerrorlab:
4630
4631 /* Pacify compilers like GCC when the user code never invokes
4632 YYERROR and the label yyerrorlab therefore never appears in user
4633 code. */
4634 if (/*CONSTCOND*/ 0)
4635 goto yyerrorlab;
4636
4637 /* Do not reclaim the symbols of the rule which action triggered
4638 this YYERROR. */
4639 YYPOPSTACK (yylen);
4640 yylen = 0;
4641 YY_STACK_PRINT (yyss, yyssp);
4642 yystate = *yyssp;
4643 goto yyerrlab1;
4644
4645
4646/*-------------------------------------------------------------.
4647| yyerrlab1 -- common code for both syntax error and YYERROR. |
4648`-------------------------------------------------------------*/
4649yyerrlab1:
4650 yyerrstatus = 3; /* Each real token shifted decrements this. */
4651
4652 for (;;)
4653 {
4654 yyn = yypact[yystate];
4655 if (yyn != YYPACT_NINF)
4656 {
4657 yyn += YYTERROR;
4658 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
4659 {
4660 yyn = yytable[yyn];
4661 if (0 < yyn)
4662 break;
4663 }
4664 }
4665
4666 /* Pop the current state because it cannot handle the error token. */
4667 if (yyssp == yyss)
4668 YYABORT;
4669
4670
4671 yydestruct ("Error: popping",
4672 yystos[yystate], yyvsp, context);
4673 YYPOPSTACK (1);
4674 yystate = *yyssp;
4675 YY_STACK_PRINT (yyss, yyssp);
4676 }
4677
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004678 *++yyvsp = yylval;
4679
4680
4681 /* Shift the error token. */
4682 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
4683
4684 yystate = yyn;
4685 goto yynewstate;
4686
4687
4688/*-------------------------------------.
4689| yyacceptlab -- YYACCEPT comes here. |
4690`-------------------------------------*/
4691yyacceptlab:
4692 yyresult = 0;
4693 goto yyreturn;
4694
4695/*-----------------------------------.
4696| yyabortlab -- YYABORT comes here. |
4697`-----------------------------------*/
4698yyabortlab:
4699 yyresult = 1;
4700 goto yyreturn;
4701
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004702#if !defined(yyoverflow) || YYERROR_VERBOSE
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004703/*-------------------------------------------------.
4704| yyexhaustedlab -- memory exhaustion comes here. |
4705`-------------------------------------------------*/
4706yyexhaustedlab:
4707 yyerror (context, YY_("memory exhausted"));
4708 yyresult = 2;
4709 /* Fall through. */
4710#endif
4711
4712yyreturn:
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004713 if (yychar != YYEMPTY)
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004714 yydestruct ("Cleanup: discarding lookahead",
4715 yytoken, &yylval, context);
4716 /* Do not reclaim the symbols of the rule which action triggered
4717 this YYABORT or YYACCEPT. */
4718 YYPOPSTACK (yylen);
4719 YY_STACK_PRINT (yyss, yyssp);
4720 while (yyssp != yyss)
4721 {
4722 yydestruct ("Cleanup: popping",
4723 yystos[*yyssp], yyvsp, context);
4724 YYPOPSTACK (1);
4725 }
4726#ifndef yyoverflow
4727 if (yyss != yyssa)
4728 YYSTACK_FREE (yyss);
4729#endif
4730#if YYERROR_VERBOSE
4731 if (yymsg != yymsgbuf)
4732 YYSTACK_FREE (yymsg);
4733#endif
4734 /* Make sure YYID is used. */
4735 return YYID (yyresult);
4736}
4737
4738
4739
4740
4741
4742int glslang_parse(TParseContext* context) {
4743 return yyparse(context);
4744}
4745
4746