blob: 056e9a4ce5bf9c8c0fc72aed4e0fc7b38979a865 [file] [log] [blame]
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001/* A Bison parser, made by GNU Bison 2.4.2. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002
3/* Skeleton implementation for Bison's Yacc-like parsers in C
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004
5 Copyright (C) 1984, 1989-1990, 2000-2006, 2009-2010 Free Software
6 Foundation, Inc.
7
8 This program is free software: you can redistribute it and/or modify
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00009 it under the terms of the GNU General Public License as published by
daniel@transgaming.com05bc2042012-03-09 21:56:58 +000010 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12
alokp@chromium.org044a5cf2010-11-12 15:42:16 +000013 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
daniel@transgaming.com05bc2042012-03-09 21:56:58 +000017
alokp@chromium.org044a5cf2010-11-12 15:42:16 +000018 You should have received a copy of the GNU General Public License
daniel@transgaming.com05bc2042012-03-09 21:56:58 +000019 along with this program. If not, see <http://www.gnu.org/licenses/>. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +000020
21/* As a special exception, you may create a larger work that contains
22 part or all of the Bison parser skeleton and distribute that work
23 under terms of your choice, so long as that work isn't itself a
24 parser generator using the skeleton or a modified version thereof
25 as a parser skeleton. Alternatively, if you modify or redistribute
26 the parser skeleton itself, you may (at your option) remove this
27 special exception, which will cause the skeleton and the resulting
28 Bison output files to be licensed under the GNU General Public
29 License without this special exception.
daniel@transgaming.com05bc2042012-03-09 21:56:58 +000030
alokp@chromium.org044a5cf2010-11-12 15:42:16 +000031 This special exception was added by the Free Software Foundation in
32 version 2.2 of Bison. */
33
34/* C LALR(1) parser skeleton written by Richard Stallman, by
35 simplifying the original so-called "semantic" parser. */
36
37/* All symbols defined below should begin with yy or YY, to avoid
38 infringing on user name space. This should be done even for local
39 variables, as they might otherwise be expanded by user macros.
40 There are some unavoidable exceptions within include files to
41 define necessary library symbols; they are noted "INFRINGES ON
42 USER NAME SPACE" below. */
43
44/* Identify Bison output. */
45#define YYBISON 1
46
47/* Bison version. */
daniel@transgaming.com05bc2042012-03-09 21:56:58 +000048#define YYBISON_VERSION "2.4.2"
alokp@chromium.org044a5cf2010-11-12 15:42:16 +000049
50/* Skeleton name. */
51#define YYSKELETON_NAME "yacc.c"
52
53/* Pure parsers. */
54#define YYPURE 1
55
daniel@transgaming.com05bc2042012-03-09 21:56:58 +000056/* Push parsers. */
57#define YYPUSH 0
58
59/* Pull parsers. */
60#define YYPULL 1
61
alokp@chromium.org044a5cf2010-11-12 15:42:16 +000062/* Using locations. */
63#define YYLSP_NEEDED 0
64
65
66
daniel@transgaming.com05bc2042012-03-09 21:56:58 +000067/* Copy the first part of user declarations. */
68
69
70//
71// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
72// Use of this source code is governed by a BSD-style license that can be
73// found in the LICENSE file.
74//
75
76// This file is auto-generated by generate_parser.sh. DO NOT EDIT!
77
78// Ignore errors in auto-generated code.
79#if defined(__GNUC__)
80#pragma GCC diagnostic ignored "-Wunused-function"
81#pragma GCC diagnostic ignored "-Wunused-variable"
82#pragma GCC diagnostic ignored "-Wswitch-enum"
83#elif defined(_MSC_VER)
84#pragma warning(disable: 4065)
85#pragma warning(disable: 4189)
86#pragma warning(disable: 4505)
87#pragma warning(disable: 4701)
88#endif
89
90#include "compiler/SymbolTable.h"
91#include "compiler/ParseHelper.h"
92#include "GLSLANG/ShaderLang.h"
93
94#define YYLEX_PARAM context->scanner
95
96
97
98/* Enabling traces. */
99#ifndef YYDEBUG
100# define YYDEBUG 0
101#endif
102
103/* Enabling verbose error messages. */
104#ifdef YYERROR_VERBOSE
105# undef YYERROR_VERBOSE
106# define YYERROR_VERBOSE 1
107#else
108# define YYERROR_VERBOSE 0
109#endif
110
111/* Enabling the token table. */
112#ifndef YYTOKEN_TABLE
113# define YYTOKEN_TABLE 0
114#endif
115
116
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000117/* Tokens. */
118#ifndef YYTOKENTYPE
119# define YYTOKENTYPE
120 /* Put the tokens into the symbol table, so that GDB and other debuggers
121 know about them. */
122 enum yytokentype {
123 INVARIANT = 258,
124 HIGH_PRECISION = 259,
125 MEDIUM_PRECISION = 260,
126 LOW_PRECISION = 261,
127 PRECISION = 262,
128 ATTRIBUTE = 263,
129 CONST_QUAL = 264,
130 BOOL_TYPE = 265,
131 FLOAT_TYPE = 266,
132 INT_TYPE = 267,
133 BREAK = 268,
134 CONTINUE = 269,
135 DO = 270,
136 ELSE = 271,
137 FOR = 272,
138 IF = 273,
139 DISCARD = 274,
140 RETURN = 275,
141 BVEC2 = 276,
142 BVEC3 = 277,
143 BVEC4 = 278,
144 IVEC2 = 279,
145 IVEC3 = 280,
146 IVEC4 = 281,
147 VEC2 = 282,
148 VEC3 = 283,
149 VEC4 = 284,
150 MATRIX2 = 285,
151 MATRIX3 = 286,
152 MATRIX4 = 287,
153 IN_QUAL = 288,
154 OUT_QUAL = 289,
155 INOUT_QUAL = 290,
156 UNIFORM = 291,
157 VARYING = 292,
158 STRUCT = 293,
159 VOID_TYPE = 294,
160 WHILE = 295,
161 SAMPLER2D = 296,
162 SAMPLERCUBE = 297,
zmo@google.com09c323a2011-08-12 18:22:25 +0000163 SAMPLER_EXTERNAL_OES = 298,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000164 SAMPLER2DRECT = 299,
165 IDENTIFIER = 300,
166 TYPE_NAME = 301,
167 FLOATCONSTANT = 302,
168 INTCONSTANT = 303,
169 BOOLCONSTANT = 304,
170 FIELD_SELECTION = 305,
171 LEFT_OP = 306,
172 RIGHT_OP = 307,
173 INC_OP = 308,
174 DEC_OP = 309,
175 LE_OP = 310,
176 GE_OP = 311,
177 EQ_OP = 312,
178 NE_OP = 313,
179 AND_OP = 314,
180 OR_OP = 315,
181 XOR_OP = 316,
182 MUL_ASSIGN = 317,
183 DIV_ASSIGN = 318,
184 ADD_ASSIGN = 319,
185 MOD_ASSIGN = 320,
186 LEFT_ASSIGN = 321,
187 RIGHT_ASSIGN = 322,
188 AND_ASSIGN = 323,
189 XOR_ASSIGN = 324,
190 OR_ASSIGN = 325,
191 SUB_ASSIGN = 326,
192 LEFT_PAREN = 327,
193 RIGHT_PAREN = 328,
194 LEFT_BRACKET = 329,
195 RIGHT_BRACKET = 330,
196 LEFT_BRACE = 331,
197 RIGHT_BRACE = 332,
198 DOT = 333,
199 COMMA = 334,
200 COLON = 335,
201 EQUAL = 336,
202 SEMICOLON = 337,
203 BANG = 338,
204 DASH = 339,
205 TILDE = 340,
206 PLUS = 341,
207 STAR = 342,
208 SLASH = 343,
209 PERCENT = 344,
210 LEFT_ANGLE = 345,
211 RIGHT_ANGLE = 346,
212 VERTICAL_BAR = 347,
213 CARET = 348,
214 AMPERSAND = 349,
215 QUESTION = 350
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000216 };
217#endif
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000218
219
220
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000221#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
222typedef union YYSTYPE
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000223{
daniel@transgaming.com05bc2042012-03-09 21:56:58 +0000224
225
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000226 struct {
227 TSourceLoc line;
228 union {
229 TString *string;
230 float f;
231 int i;
232 bool b;
233 };
234 TSymbol* symbol;
235 } lex;
236 struct {
237 TSourceLoc line;
238 TOperator op;
239 union {
240 TIntermNode* intermNode;
241 TIntermNodePair nodePair;
242 TIntermTyped* intermTypedNode;
243 TIntermAggregate* intermAggregate;
244 };
245 union {
246 TPublicType type;
247 TPrecision precision;
248 TQualifier qualifier;
249 TFunction* function;
250 TParameter param;
251 TTypeLine typeLine;
252 TTypeList* typeList;
253 };
254 } interm;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000255
daniel@transgaming.com05bc2042012-03-09 21:56:58 +0000256
257
258} YYSTYPE;
259# define YYSTYPE_IS_TRIVIAL 1
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000260# define yystype YYSTYPE /* obsolescent; will be withdrawn */
261# define YYSTYPE_IS_DECLARED 1
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000262#endif
263
264
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000265/* Copy the second part of user declarations. */
266
267
268extern int yylex(YYSTYPE* yylval_param, void* yyscanner);
269extern void yyerror(TParseContext* context, const char* reason);
270
271#define FRAG_VERT_ONLY(S, L) { \
272 if (context->shaderType != SH_FRAGMENT_SHADER && \
273 context->shaderType != SH_VERTEX_SHADER) { \
274 context->error(L, " supported in vertex/fragment shaders only ", S, "", ""); \
275 context->recover(); \
276 } \
277}
278
279#define VERTEX_ONLY(S, L) { \
280 if (context->shaderType != SH_VERTEX_SHADER) { \
281 context->error(L, " supported in vertex shaders only ", S, "", ""); \
282 context->recover(); \
283 } \
284}
285
286#define FRAG_ONLY(S, L) { \
287 if (context->shaderType != SH_FRAGMENT_SHADER) { \
288 context->error(L, " supported in fragment shaders only ", S, "", ""); \
289 context->recover(); \
290 } \
291}
292
293
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000294
295#ifdef short
296# undef short
297#endif
298
299#ifdef YYTYPE_UINT8
300typedef YYTYPE_UINT8 yytype_uint8;
301#else
302typedef unsigned char yytype_uint8;
303#endif
304
305#ifdef YYTYPE_INT8
306typedef YYTYPE_INT8 yytype_int8;
307#elif (defined __STDC__ || defined __C99__FUNC__ \
308 || defined __cplusplus || defined _MSC_VER)
309typedef signed char yytype_int8;
310#else
311typedef short int yytype_int8;
312#endif
313
314#ifdef YYTYPE_UINT16
315typedef YYTYPE_UINT16 yytype_uint16;
316#else
317typedef unsigned short int yytype_uint16;
318#endif
319
320#ifdef YYTYPE_INT16
321typedef YYTYPE_INT16 yytype_int16;
322#else
323typedef short int yytype_int16;
324#endif
325
326#ifndef YYSIZE_T
327# ifdef __SIZE_TYPE__
328# define YYSIZE_T __SIZE_TYPE__
329# elif defined size_t
330# define YYSIZE_T size_t
331# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
332 || defined __cplusplus || defined _MSC_VER)
333# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
334# define YYSIZE_T size_t
335# else
336# define YYSIZE_T unsigned int
337# endif
338#endif
339
340#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
341
342#ifndef YY_
daniel@transgaming.com05bc2042012-03-09 21:56:58 +0000343# if defined YYENABLE_NLS && YYENABLE_NLS
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000344# if ENABLE_NLS
345# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
346# define YY_(msgid) dgettext ("bison-runtime", msgid)
347# endif
348# endif
349# ifndef YY_
350# define YY_(msgid) msgid
351# endif
352#endif
353
354/* Suppress unused-variable warnings by "using" E. */
355#if ! defined lint || defined __GNUC__
356# define YYUSE(e) ((void) (e))
357#else
358# define YYUSE(e) /* empty */
359#endif
360
361/* Identity function, used to suppress warnings about constant conditions. */
362#ifndef lint
363# define YYID(n) (n)
364#else
365#if (defined __STDC__ || defined __C99__FUNC__ \
366 || defined __cplusplus || defined _MSC_VER)
367static int
daniel@transgaming.com05bc2042012-03-09 21:56:58 +0000368YYID (int yyi)
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000369#else
370static int
daniel@transgaming.com05bc2042012-03-09 21:56:58 +0000371YYID (yyi)
372 int yyi;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000373#endif
374{
daniel@transgaming.com05bc2042012-03-09 21:56:58 +0000375 return yyi;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000376}
377#endif
378
379#if ! defined yyoverflow || YYERROR_VERBOSE
380
381/* The parser invokes alloca or malloc; define the necessary symbols. */
382
383# ifdef YYSTACK_USE_ALLOCA
384# if YYSTACK_USE_ALLOCA
385# ifdef __GNUC__
386# define YYSTACK_ALLOC __builtin_alloca
387# elif defined __BUILTIN_VA_ARG_INCR
388# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
389# elif defined _AIX
390# define YYSTACK_ALLOC __alloca
391# elif defined _MSC_VER
392# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
393# define alloca _alloca
394# else
395# define YYSTACK_ALLOC alloca
396# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
397 || defined __cplusplus || defined _MSC_VER)
398# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
399# ifndef _STDLIB_H
400# define _STDLIB_H 1
401# endif
402# endif
403# endif
404# endif
405# endif
406
407# ifdef YYSTACK_ALLOC
408 /* Pacify GCC's `empty if-body' warning. */
409# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
410# ifndef YYSTACK_ALLOC_MAXIMUM
411 /* The OS might guarantee only one guard page at the bottom of the stack,
412 and a page size can be as small as 4096 bytes. So we cannot safely
413 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
414 to allow for a few compiler-allocated temporary stack slots. */
415# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
416# endif
417# else
418# define YYSTACK_ALLOC YYMALLOC
419# define YYSTACK_FREE YYFREE
420# ifndef YYSTACK_ALLOC_MAXIMUM
421# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
422# endif
423# if (defined __cplusplus && ! defined _STDLIB_H \
424 && ! ((defined YYMALLOC || defined malloc) \
425 && (defined YYFREE || defined free)))
426# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
427# ifndef _STDLIB_H
428# define _STDLIB_H 1
429# endif
430# endif
431# ifndef YYMALLOC
432# define YYMALLOC malloc
433# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
434 || defined __cplusplus || defined _MSC_VER)
435void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
436# endif
437# endif
438# ifndef YYFREE
439# define YYFREE free
440# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
441 || defined __cplusplus || defined _MSC_VER)
442void free (void *); /* INFRINGES ON USER NAME SPACE */
443# endif
444# endif
445# endif
446#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
447
448
449#if (! defined yyoverflow \
450 && (! defined __cplusplus \
451 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
452
453/* A type that is properly aligned for any stack member. */
454union yyalloc
455{
daniel@transgaming.com05bc2042012-03-09 21:56:58 +0000456 yytype_int16 yyss_alloc;
457 YYSTYPE yyvs_alloc;
458};
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000459
460/* The size of the maximum gap between one aligned stack and the next. */
461# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
462
463/* The size of an array large to enough to hold all stacks, each with
464 N elements. */
465# define YYSTACK_BYTES(N) \
466 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
467 + YYSTACK_GAP_MAXIMUM)
468
469/* Copy COUNT objects from FROM to TO. The source and destination do
470 not overlap. */
471# ifndef YYCOPY
472# if defined __GNUC__ && 1 < __GNUC__
473# define YYCOPY(To, From, Count) \
474 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
475# else
476# define YYCOPY(To, From, Count) \
477 do \
478 { \
479 YYSIZE_T yyi; \
480 for (yyi = 0; yyi < (Count); yyi++) \
481 (To)[yyi] = (From)[yyi]; \
482 } \
483 while (YYID (0))
484# endif
485# endif
486
487/* Relocate STACK from its old location to the new one. The
488 local variables YYSIZE and YYSTACKSIZE give the old and new number of
489 elements in the stack, and YYPTR gives the new location of the
490 stack. Advance YYPTR to a properly aligned location for the next
491 stack. */
daniel@transgaming.com05bc2042012-03-09 21:56:58 +0000492# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000493 do \
494 { \
495 YYSIZE_T yynewbytes; \
daniel@transgaming.com05bc2042012-03-09 21:56:58 +0000496 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
497 Stack = &yyptr->Stack_alloc; \
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000498 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
499 yyptr += yynewbytes / sizeof (*yyptr); \
500 } \
501 while (YYID (0))
502
503#endif
504
505/* YYFINAL -- State number of the termination state. */
kbr@chromium.org205fef32011-11-22 20:50:02 +0000506#define YYFINAL 71
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000507/* YYLAST -- Last index in YYTABLE. */
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000508#define YYLAST 1416
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000509
510/* YYNTOKENS -- Number of terminals. */
kbr@chromium.org205fef32011-11-22 20:50:02 +0000511#define YYNTOKENS 96
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000512/* YYNNTS -- Number of nonterminals. */
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000513#define YYNNTS 83
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000514/* YYNRULES -- Number of rules. */
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000515#define YYNRULES 201
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000516/* YYNRULES -- Number of states. */
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000517#define YYNSTATES 304
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000518
519/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
520#define YYUNDEFTOK 2
kbr@chromium.org205fef32011-11-22 20:50:02 +0000521#define YYMAXUTOK 350
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000522
523#define YYTRANSLATE(YYX) \
524 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
525
526/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
527static const yytype_uint8 yytranslate[] =
528{
529 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
530 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
531 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
532 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
533 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
534 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
535 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
536 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
537 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
538 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
539 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
540 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
541 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
542 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
543 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
544 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
545 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
546 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
547 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
548 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
549 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
550 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
551 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
552 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
553 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
554 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
555 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
556 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
557 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
558 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
559 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
560 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
561 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
562 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000563 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
564 95
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000565};
566
567#if YYDEBUG
568/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
569 YYRHS. */
570static const yytype_uint16 yyprhs[] =
571{
572 0, 0, 3, 5, 7, 9, 11, 13, 17, 19,
573 24, 26, 30, 33, 36, 38, 40, 42, 46, 49,
574 52, 55, 57, 60, 64, 67, 69, 71, 73, 75,
575 78, 81, 84, 86, 88, 90, 92, 96, 100, 102,
576 106, 110, 112, 114, 118, 122, 126, 130, 132, 136,
577 140, 142, 144, 146, 148, 152, 154, 158, 160, 164,
578 166, 172, 174, 178, 180, 182, 184, 186, 188, 190,
579 194, 196, 199, 202, 207, 210, 212, 214, 217, 221,
580 225, 228, 234, 238, 241, 245, 248, 249, 251, 253,
581 255, 257, 259, 263, 269, 276, 282, 284, 287, 292,
582 298, 303, 306, 308, 311, 313, 315, 317, 320, 322,
583 324, 327, 329, 331, 333, 335, 340, 342, 344, 346,
584 348, 350, 352, 354, 356, 358, 360, 362, 364, 366,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000585 368, 370, 372, 374, 376, 378, 380, 382, 384, 385,
586 392, 393, 399, 401, 404, 408, 410, 414, 416, 421,
587 423, 425, 427, 429, 431, 433, 435, 437, 439, 442,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000588 443, 444, 450, 452, 454, 455, 458, 459, 462, 465,
589 469, 471, 474, 476, 479, 485, 489, 491, 493, 498,
590 499, 506, 507, 516, 517, 525, 527, 529, 531, 532,
591 535, 539, 542, 545, 548, 552, 555, 557, 560, 562,
592 564, 565
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000593};
594
595/* YYRHS -- A `-1'-separated list of the rules' RHS. */
596static const yytype_int16 yyrhs[] =
597{
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000598 175, 0, -1, 45, -1, 97, -1, 48, -1, 47,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000599 -1, 49, -1, 72, 124, 73, -1, 98, -1, 99,
600 74, 100, 75, -1, 101, -1, 99, 78, 50, -1,
601 99, 53, -1, 99, 54, -1, 124, -1, 102, -1,
602 103, -1, 99, 78, 103, -1, 105, 73, -1, 104,
603 73, -1, 106, 39, -1, 106, -1, 106, 122, -1,
604 105, 79, 122, -1, 107, 72, -1, 142, -1, 45,
605 -1, 50, -1, 99, -1, 53, 108, -1, 54, 108,
606 -1, 109, 108, -1, 86, -1, 84, -1, 83, -1,
607 108, -1, 110, 87, 108, -1, 110, 88, 108, -1,
608 110, -1, 111, 86, 110, -1, 111, 84, 110, -1,
609 111, -1, 112, -1, 113, 90, 112, -1, 113, 91,
610 112, -1, 113, 55, 112, -1, 113, 56, 112, -1,
611 113, -1, 114, 57, 113, -1, 114, 58, 113, -1,
612 114, -1, 115, -1, 116, -1, 117, -1, 118, 59,
613 117, -1, 118, -1, 119, 61, 118, -1, 119, -1,
614 120, 60, 119, -1, 120, -1, 120, 95, 124, 80,
615 122, -1, 121, -1, 108, 123, 122, -1, 81, -1,
616 62, -1, 63, -1, 64, -1, 71, -1, 122, -1,
617 124, 79, 122, -1, 121, -1, 127, 82, -1, 135,
618 82, -1, 7, 140, 141, 82, -1, 128, 73, -1,
619 130, -1, 129, -1, 130, 132, -1, 129, 79, 132,
620 -1, 137, 45, 72, -1, 139, 45, -1, 139, 45,
621 74, 125, 75, -1, 138, 133, 131, -1, 133, 131,
622 -1, 138, 133, 134, -1, 133, 134, -1, -1, 33,
623 -1, 34, -1, 35, -1, 139, -1, 136, -1, 135,
624 79, 45, -1, 135, 79, 45, 74, 75, -1, 135,
625 79, 45, 74, 125, 75, -1, 135, 79, 45, 81,
626 150, -1, 137, -1, 137, 45, -1, 137, 45, 74,
627 75, -1, 137, 45, 74, 125, 75, -1, 137, 45,
628 81, 150, -1, 3, 45, -1, 139, -1, 138, 139,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000629 -1, 9, -1, 8, -1, 37, -1, 3, 37, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000630 36, -1, 141, -1, 140, 141, -1, 4, -1, 5,
631 -1, 6, -1, 142, -1, 142, 74, 125, 75, -1,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000632 39, -1, 11, -1, 12, -1, 10, -1, 27, -1,
633 28, -1, 29, -1, 21, -1, 22, -1, 23, -1,
634 24, -1, 25, -1, 26, -1, 30, -1, 31, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000635 32, -1, 41, -1, 42, -1, 43, -1, 44, -1,
636 143, -1, 46, -1, -1, 38, 45, 76, 144, 146,
637 77, -1, -1, 38, 76, 145, 146, 77, -1, 147,
638 -1, 146, 147, -1, 139, 148, 82, -1, 149, -1,
639 148, 79, 149, -1, 45, -1, 45, 74, 125, 75,
640 -1, 122, -1, 126, -1, 154, -1, 153, -1, 151,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000641 -1, 163, -1, 164, -1, 167, -1, 174, -1, 76,
642 77, -1, -1, -1, 76, 155, 162, 156, 77, -1,
643 161, -1, 153, -1, -1, 159, 161, -1, -1, 160,
644 153, -1, 76, 77, -1, 76, 162, 77, -1, 152,
645 -1, 162, 152, -1, 82, -1, 124, 82, -1, 18,
646 72, 124, 73, 165, -1, 158, 16, 158, -1, 158,
647 -1, 124, -1, 137, 45, 81, 150, -1, -1, 40,
648 72, 168, 166, 73, 157, -1, -1, 15, 169, 158,
649 40, 72, 124, 73, 82, -1, -1, 17, 72, 170,
650 171, 173, 73, 157, -1, 163, -1, 151, -1, 166,
651 -1, -1, 172, 82, -1, 172, 82, 124, -1, 14,
652 82, -1, 13, 82, -1, 20, 82, -1, 20, 124,
653 82, -1, 19, 82, -1, 176, -1, 175, 176, -1,
654 177, -1, 126, -1, -1, 127, 178, 161, -1
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000655};
656
657/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
658static const yytype_uint16 yyrline[] =
659{
apatrick@chromium.orge057c5d2012-01-26 19:18:24 +0000660 0, 165, 165, 200, 203, 216, 221, 226, 232, 235,
661 308, 311, 420, 430, 443, 451, 550, 553, 561, 565,
662 572, 576, 583, 589, 598, 606, 661, 668, 678, 681,
663 691, 701, 722, 723, 724, 729, 730, 739, 751, 752,
664 760, 771, 775, 776, 786, 796, 806, 819, 820, 830,
665 843, 847, 851, 855, 856, 869, 870, 883, 884, 897,
666 898, 915, 916, 929, 930, 931, 932, 933, 937, 940,
667 951, 959, 984, 989, 996, 1032, 1035, 1042, 1050, 1071,
668 1090, 1101, 1130, 1135, 1145, 1150, 1160, 1163, 1166, 1169,
669 1175, 1182, 1185, 1201, 1219, 1243, 1266, 1270, 1288, 1296,
670 1328, 1348, 1424, 1433, 1456, 1459, 1465, 1473, 1481, 1489,
671 1499, 1506, 1509, 1512, 1518, 1521, 1536, 1540, 1544, 1548,
672 1557, 1562, 1567, 1572, 1577, 1582, 1587, 1592, 1597, 1602,
673 1608, 1614, 1620, 1625, 1630, 1639, 1648, 1653, 1666, 1666,
674 1680, 1680, 1689, 1692, 1707, 1743, 1747, 1753, 1761, 1777,
675 1781, 1785, 1786, 1792, 1793, 1794, 1795, 1796, 1800, 1801,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000676 1801, 1801, 1811, 1812, 1816, 1816, 1817, 1817, 1822, 1825,
677 1835, 1838, 1844, 1845, 1849, 1857, 1861, 1871, 1876, 1893,
678 1893, 1898, 1898, 1905, 1905, 1913, 1916, 1922, 1925, 1931,
679 1935, 1942, 1949, 1956, 1963, 1974, 1983, 1987, 1994, 1997,
680 2003, 2003
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000681};
682#endif
683
684#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
685/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
686 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
687static const char *const yytname[] =
688{
689 "$end", "error", "$undefined", "INVARIANT", "HIGH_PRECISION",
690 "MEDIUM_PRECISION", "LOW_PRECISION", "PRECISION", "ATTRIBUTE",
691 "CONST_QUAL", "BOOL_TYPE", "FLOAT_TYPE", "INT_TYPE", "BREAK", "CONTINUE",
692 "DO", "ELSE", "FOR", "IF", "DISCARD", "RETURN", "BVEC2", "BVEC3",
693 "BVEC4", "IVEC2", "IVEC3", "IVEC4", "VEC2", "VEC3", "VEC4", "MATRIX2",
694 "MATRIX3", "MATRIX4", "IN_QUAL", "OUT_QUAL", "INOUT_QUAL", "UNIFORM",
695 "VARYING", "STRUCT", "VOID_TYPE", "WHILE", "SAMPLER2D", "SAMPLERCUBE",
kbr@chromium.org205fef32011-11-22 20:50:02 +0000696 "SAMPLER_EXTERNAL_OES", "SAMPLER2DRECT", "IDENTIFIER", "TYPE_NAME",
697 "FLOATCONSTANT", "INTCONSTANT", "BOOLCONSTANT", "FIELD_SELECTION",
698 "LEFT_OP", "RIGHT_OP", "INC_OP", "DEC_OP", "LE_OP", "GE_OP", "EQ_OP",
699 "NE_OP", "AND_OP", "OR_OP", "XOR_OP", "MUL_ASSIGN", "DIV_ASSIGN",
700 "ADD_ASSIGN", "MOD_ASSIGN", "LEFT_ASSIGN", "RIGHT_ASSIGN", "AND_ASSIGN",
701 "XOR_ASSIGN", "OR_ASSIGN", "SUB_ASSIGN", "LEFT_PAREN", "RIGHT_PAREN",
702 "LEFT_BRACKET", "RIGHT_BRACKET", "LEFT_BRACE", "RIGHT_BRACE", "DOT",
703 "COMMA", "COLON", "EQUAL", "SEMICOLON", "BANG", "DASH", "TILDE", "PLUS",
704 "STAR", "SLASH", "PERCENT", "LEFT_ANGLE", "RIGHT_ANGLE", "VERTICAL_BAR",
705 "CARET", "AMPERSAND", "QUESTION", "$accept", "variable_identifier",
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000706 "primary_expression", "postfix_expression", "integer_expression",
707 "function_call", "function_call_or_method", "function_call_generic",
708 "function_call_header_no_parameters",
709 "function_call_header_with_parameters", "function_call_header",
710 "function_identifier", "unary_expression", "unary_operator",
711 "multiplicative_expression", "additive_expression", "shift_expression",
712 "relational_expression", "equality_expression", "and_expression",
713 "exclusive_or_expression", "inclusive_or_expression",
714 "logical_and_expression", "logical_xor_expression",
715 "logical_or_expression", "conditional_expression",
716 "assignment_expression", "assignment_operator", "expression",
717 "constant_expression", "declaration", "function_prototype",
718 "function_declarator", "function_header_with_parameters",
719 "function_header", "parameter_declarator", "parameter_declaration",
720 "parameter_qualifier", "parameter_type_specifier",
721 "init_declarator_list", "single_declaration", "fully_specified_type",
722 "type_qualifier", "type_specifier", "precision_qualifier",
723 "type_specifier_no_prec", "type_specifier_nonarray", "struct_specifier",
daniel@transgaming.com05bc2042012-03-09 21:56:58 +0000724 "$@1", "$@2", "struct_declaration_list", "struct_declaration",
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000725 "struct_declarator_list", "struct_declarator", "initializer",
726 "declaration_statement", "statement", "simple_statement",
daniel@transgaming.com05bc2042012-03-09 21:56:58 +0000727 "compound_statement", "$@3", "$@4", "statement_no_new_scope",
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000728 "statement_with_scope", "$@5", "$@6", "compound_statement_no_new_scope",
729 "statement_list", "expression_statement", "selection_statement",
730 "selection_rest_statement", "condition", "iteration_statement", "$@7",
731 "$@8", "$@9", "for_init_statement", "conditionopt", "for_rest_statement",
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000732 "jump_statement", "translation_unit", "external_declaration",
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000733 "function_definition", "$@10", 0
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000734};
735#endif
736
737# ifdef YYPRINT
738/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
739 token YYLEX-NUM. */
740static const yytype_uint16 yytoknum[] =
741{
742 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
743 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
744 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
745 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
746 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
747 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
748 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
749 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
750 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000751 345, 346, 347, 348, 349, 350
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000752};
753# endif
754
755/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
756static const yytype_uint8 yyr1[] =
757{
kbr@chromium.org205fef32011-11-22 20:50:02 +0000758 0, 96, 97, 98, 98, 98, 98, 98, 99, 99,
759 99, 99, 99, 99, 100, 101, 102, 102, 103, 103,
760 104, 104, 105, 105, 106, 107, 107, 107, 108, 108,
761 108, 108, 109, 109, 109, 110, 110, 110, 111, 111,
762 111, 112, 113, 113, 113, 113, 113, 114, 114, 114,
763 115, 116, 117, 118, 118, 119, 119, 120, 120, 121,
764 121, 122, 122, 123, 123, 123, 123, 123, 124, 124,
765 125, 126, 126, 126, 127, 128, 128, 129, 129, 130,
766 131, 131, 132, 132, 132, 132, 133, 133, 133, 133,
767 134, 135, 135, 135, 135, 135, 136, 136, 136, 136,
768 136, 136, 137, 137, 138, 138, 138, 138, 138, 139,
769 139, 140, 140, 140, 141, 141, 142, 142, 142, 142,
770 142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
771 142, 142, 142, 142, 142, 142, 142, 142, 144, 143,
772 145, 143, 146, 146, 147, 148, 148, 149, 149, 150,
773 151, 152, 152, 153, 153, 153, 153, 153, 154, 155,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000774 156, 154, 157, 157, 159, 158, 160, 158, 161, 161,
775 162, 162, 163, 163, 164, 165, 165, 166, 166, 168,
776 167, 169, 167, 170, 167, 171, 171, 172, 172, 173,
777 173, 174, 174, 174, 174, 174, 175, 175, 176, 176,
778 178, 177
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000779};
780
781/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
782static const yytype_uint8 yyr2[] =
783{
784 0, 2, 1, 1, 1, 1, 1, 3, 1, 4,
785 1, 3, 2, 2, 1, 1, 1, 3, 2, 2,
786 2, 1, 2, 3, 2, 1, 1, 1, 1, 2,
787 2, 2, 1, 1, 1, 1, 3, 3, 1, 3,
788 3, 1, 1, 3, 3, 3, 3, 1, 3, 3,
789 1, 1, 1, 1, 3, 1, 3, 1, 3, 1,
790 5, 1, 3, 1, 1, 1, 1, 1, 1, 3,
791 1, 2, 2, 4, 2, 1, 1, 2, 3, 3,
792 2, 5, 3, 2, 3, 2, 0, 1, 1, 1,
793 1, 1, 3, 5, 6, 5, 1, 2, 4, 5,
794 4, 2, 1, 2, 1, 1, 1, 2, 1, 1,
795 2, 1, 1, 1, 1, 4, 1, 1, 1, 1,
796 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000797 1, 1, 1, 1, 1, 1, 1, 1, 0, 6,
798 0, 5, 1, 2, 3, 1, 3, 1, 4, 1,
799 1, 1, 1, 1, 1, 1, 1, 1, 2, 0,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000800 0, 5, 1, 1, 0, 2, 0, 2, 2, 3,
801 1, 2, 1, 2, 5, 3, 1, 1, 4, 0,
802 6, 0, 8, 0, 7, 1, 1, 1, 0, 2,
803 3, 2, 2, 2, 3, 2, 1, 2, 1, 1,
804 0, 3
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000805};
806
807/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
808 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
809 means the default is an error. */
810static const yytype_uint8 yydefact[] =
811{
812 0, 0, 111, 112, 113, 0, 105, 104, 119, 117,
813 118, 123, 124, 125, 126, 127, 128, 120, 121, 122,
zmo@google.com09c323a2011-08-12 18:22:25 +0000814 129, 130, 131, 108, 106, 0, 116, 132, 133, 134,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000815 135, 137, 199, 200, 0, 76, 86, 0, 91, 96,
816 0, 102, 0, 109, 114, 136, 0, 196, 198, 107,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000817 101, 0, 0, 140, 71, 0, 74, 86, 0, 87,
818 88, 89, 77, 0, 86, 0, 72, 97, 103, 110,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000819 0, 1, 197, 0, 138, 0, 0, 201, 78, 83,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000820 85, 90, 0, 92, 79, 0, 0, 2, 5, 4,
821 6, 27, 0, 0, 0, 34, 33, 32, 3, 8,
822 28, 10, 15, 16, 0, 0, 21, 0, 35, 0,
823 38, 41, 42, 47, 50, 51, 52, 53, 55, 57,
824 59, 70, 0, 25, 73, 0, 0, 0, 142, 0,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000825 0, 181, 0, 0, 0, 0, 0, 159, 168, 172,
826 35, 61, 68, 0, 150, 0, 114, 153, 170, 152,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000827 151, 0, 154, 155, 156, 157, 80, 82, 84, 0,
828 0, 98, 0, 149, 100, 29, 30, 0, 12, 13,
829 0, 0, 19, 18, 0, 20, 22, 24, 31, 0,
kbr@chromium.org476541f2011-10-27 21:14:51 +0000830 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000831 0, 0, 0, 115, 0, 147, 0, 145, 141, 143,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000832 192, 191, 166, 183, 0, 195, 193, 0, 179, 158,
833 0, 64, 65, 66, 67, 63, 0, 0, 173, 169,
834 171, 0, 93, 0, 95, 99, 7, 0, 14, 26,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000835 11, 17, 23, 36, 37, 40, 39, 45, 46, 43,
836 44, 48, 49, 54, 56, 58, 0, 139, 0, 0,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000837 144, 0, 0, 0, 0, 0, 194, 0, 160, 62,
838 69, 0, 94, 9, 0, 0, 146, 0, 165, 167,
839 186, 185, 188, 166, 177, 0, 0, 0, 81, 60,
840 148, 0, 187, 0, 0, 176, 174, 0, 0, 161,
841 0, 189, 0, 166, 0, 163, 180, 162, 0, 190,
842 184, 175, 178, 182
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000843};
844
845/* YYDEFGOTO[NTERM-NUM]. */
846static const yytype_int16 yydefgoto[] =
847{
kbr@chromium.org205fef32011-11-22 20:50:02 +0000848 -1, 98, 99, 100, 227, 101, 102, 103, 104, 105,
849 106, 107, 140, 109, 110, 111, 112, 113, 114, 115,
850 116, 117, 118, 119, 120, 141, 142, 216, 143, 122,
851 144, 145, 34, 35, 36, 79, 62, 63, 80, 37,
852 38, 39, 40, 41, 42, 43, 123, 45, 125, 75,
853 127, 128, 196, 197, 164, 147, 148, 149, 150, 210,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000854 277, 296, 251, 252, 253, 297, 151, 152, 153, 286,
855 276, 154, 257, 202, 254, 272, 283, 284, 155, 46,
856 47, 48, 55
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000857};
858
859/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
860 STATE-NUM. */
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000861#define YYPACT_NINF -266
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000862static const yytype_int16 yypact[] =
863{
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000864 1253, -20, -266, -266, -266, 148, -266, -266, -266, -266,
865 -266, -266, -266, -266, -266, -266, -266, -266, -266, -266,
866 -266, -266, -266, -266, -266, -39, -266, -266, -266, -266,
867 -266, -266, -266, -18, -2, 6, 21, -61, -266, 51,
868 1296, -266, 1370, -266, 25, -266, 1209, -266, -266, -266,
869 -266, 1370, 42, -266, -266, 50, -266, 71, 95, -266,
870 -266, -266, -266, 1296, 123, 105, -266, 9, -266, -266,
871 974, -266, -266, 81, -266, 1296, 290, -266, -266, -266,
872 -266, 125, 1296, -13, -266, 776, 974, 99, -266, -266,
873 -266, -266, 974, 974, 974, -266, -266, -266, -266, -266,
874 35, -266, -266, -266, 100, -6, 1040, 104, -266, 974,
875 36, -64, -266, -21, 102, -266, -266, -266, 113, 117,
876 -51, -266, 108, -266, -266, 1296, 129, 1109, -266, 97,
877 103, -266, 112, 114, 106, 842, 115, 116, -266, -266,
878 39, -266, -266, -43, -266, -18, 47, -266, -266, -266,
879 -266, 374, -266, -266, -266, -266, 118, -266, -266, 908,
880 974, -266, 120, -266, -266, -266, -266, 19, -266, -266,
881 974, 1333, -266, -266, 974, 119, -266, -266, -266, 974,
882 974, 974, 974, 974, 974, 974, 974, 974, 974, 974,
883 974, 974, 974, -266, 1152, 122, -29, -266, -266, -266,
884 -266, -266, 121, -266, 974, -266, -266, 5, -266, -266,
885 458, -266, -266, -266, -266, -266, 974, 974, -266, -266,
886 -266, 974, -266, 137, -266, -266, -266, 138, 111, -266,
887 142, -266, -266, -266, -266, 36, 36, -266, -266, -266,
888 -266, -21, -21, -266, 113, 117, 82, -266, 974, 129,
889 -266, 175, 50, 626, 710, 38, -266, 197, 458, -266,
890 -266, 141, -266, -266, 974, 155, -266, 145, -266, -266,
891 -266, -266, 197, 121, 111, 186, 159, 160, -266, -266,
892 -266, 974, -266, 166, 176, 236, -266, 174, 542, -266,
893 43, 974, 542, 121, 974, -266, -266, -266, 177, 111,
894 -266, -266, -266, -266
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000895};
896
897/* YYPGOTO[NTERM-NUM]. */
898static const yytype_int16 yypgoto[] =
899{
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000900 -266, -266, -266, -266, -266, -266, -266, 85, -266, -266,
901 -266, -266, -44, -266, -15, -266, -55, -19, -266, -266,
902 -266, 72, 70, 73, -266, -66, -83, -266, -92, -73,
903 13, 14, -266, -266, -266, 180, 206, 201, 184, -266,
904 -266, -241, -25, -30, 262, -4, 0, -266, -266, -266,
905 143, -122, -266, 22, -145, 16, -144, -226, -266, -266,
906 -266, -17, -265, -266, -266, -54, 63, 20, -266, -266,
907 4, -266, -266, -266, -266, -266, -266, -266, -266, -266,
908 231, -266, -266
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000909};
910
911/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
912 positive, shift that token. If negative, reduce the rule which
913 number is the opposite. If zero, do what YYDEFACT says.
914 If YYTABLE_NINF, syntax error. */
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000915#define YYTABLE_NINF -165
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000916static const yytype_int16 yytable[] =
917{
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000918 44, 77, 167, 163, 121, 199, 52, 220, 285, 191,
919 68, 64, 162, 32, 33, 224, 275, 49, 65, 121,
920 181, 66, 182, 176, 58, 50, 108, 269, 301, 6,
921 7, 275, 64, 81, 183, 184, 217, 53, 69, 218,
922 44, 108, 44, 207, 192, 126, 44, 73, 165, 166,
923 249, 44, 81, 250, 59, 60, 61, 23, 24, 32,
924 33, 159, 295, 44, 54, 178, 295, 173, 160, 185,
925 186, 56, 199, 174, 58, 44, 146, 163, 228, 6,
926 7, 84, 44, 85, 217, 57, 223, 256, 168, 169,
927 86, 232, 226, 121, -75, 126, 67, 126, 217, 70,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000928 246, 211, 212, 213, 59, 60, 61, 23, 24, 170,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000929 214, 273, 255, 171, 220, 108, 298, 217, 74, -25,
930 215, 70, 217, 179, 180, 44, 76, 44, 237, 238,
931 239, 240, 49, 259, 260, 233, 234, 108, 108, 108,
932 108, 108, 108, 108, 108, 108, 108, 108, 261, 302,
933 83, 146, 2, 3, 4, 121, 59, 60, 61, 187,
934 188, 217, 264, 124, 126, 274, 235, 236, 241, 242,
935 156, -26, 189, 172, 195, 265, 177, 108, 190, 200,
936 274, 279, 121, 193, 203, 201, 204, 208, 205, 290,
937 217, -116, 221, 209, 44, 225, 248, -164, 268, 299,
938 58, 2, 3, 4, 108, 6, 7, 8, 9, 10,
939 146, 163, 262, 263, -27, 267, 278, 281, 11, 12,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000940 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000941 280, 287, 288, 23, 24, 25, 26, 289, 27, 28,
942 29, 30, 87, 31, 88, 89, 90, 91, 291, 292,
943 92, 93, 293, 146, 146, 294, 231, 146, 146, 303,
944 244, 243, 157, 78, 245, 82, 158, 51, 194, 94,
945 270, 266, 146, 258, 271, 300, 282, 72, 0, 0,
946 95, 96, 0, 97, 0, 0, 0, 0, 146, 0,
947 0, 0, 146, 1, 2, 3, 4, 5, 6, 7,
948 8, 9, 10, 129, 130, 131, 0, 132, 133, 134,
949 135, 11, 12, 13, 14, 15, 16, 17, 18, 19,
950 20, 21, 22, 0, 0, 0, 23, 24, 25, 26,
951 136, 27, 28, 29, 30, 87, 31, 88, 89, 90,
952 91, 0, 0, 92, 93, 0, 0, 0, 0, 0,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000953 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000954 0, 0, 94, 0, 0, 0, 137, 138, 0, 0,
955 0, 0, 139, 95, 96, 0, 97, 1, 2, 3,
956 4, 5, 6, 7, 8, 9, 10, 129, 130, 131,
957 0, 132, 133, 134, 135, 11, 12, 13, 14, 15,
958 16, 17, 18, 19, 20, 21, 22, 0, 0, 0,
959 23, 24, 25, 26, 136, 27, 28, 29, 30, 87,
960 31, 88, 89, 90, 91, 0, 0, 92, 93, 0,
kbr@chromium.org476541f2011-10-27 21:14:51 +0000961 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000962 0, 0, 0, 0, 0, 0, 94, 0, 0, 0,
963 137, 219, 0, 0, 0, 0, 139, 95, 96, 0,
964 97, 1, 2, 3, 4, 5, 6, 7, 8, 9,
965 10, 129, 130, 131, 0, 132, 133, 134, 135, 11,
966 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
967 22, 0, 0, 0, 23, 24, 25, 26, 136, 27,
968 28, 29, 30, 87, 31, 88, 89, 90, 91, 0,
969 0, 92, 93, 0, 0, 0, 0, 0, 0, 0,
kbr@chromium.org476541f2011-10-27 21:14:51 +0000970 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000971 94, 0, 0, 0, 137, 0, 0, 0, 0, 0,
972 139, 95, 96, 0, 97, 1, 2, 3, 4, 5,
973 6, 7, 8, 9, 10, 129, 130, 131, 0, 132,
974 133, 134, 135, 11, 12, 13, 14, 15, 16, 17,
975 18, 19, 20, 21, 22, 0, 0, 0, 23, 24,
976 25, 26, 136, 27, 28, 29, 30, 87, 31, 88,
977 89, 90, 91, 0, 0, 92, 93, 0, 0, 0,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000978 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000979 0, 0, 0, 0, 94, 0, 0, 0, 76, 0,
980 0, 0, 0, 0, 139, 95, 96, 0, 97, 1,
981 2, 3, 4, 5, 6, 7, 8, 9, 10, 129,
982 130, 131, 0, 132, 133, 134, 135, 11, 12, 13,
kbr@chromium.org476541f2011-10-27 21:14:51 +0000983 14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000984 0, 0, 23, 24, 25, 26, 136, 27, 28, 29,
985 30, 87, 31, 88, 89, 90, 91, 0, 0, 92,
986 93, 0, 0, 0, 0, 0, 0, 0, 0, 0,
987 0, 0, 0, 0, 0, 0, 0, 0, 94, 0,
988 0, 0, 0, 0, 0, 0, 0, 0, 139, 95,
989 96, 0, 97, 1, 2, 3, 4, 5, 6, 7,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000990 8, 9, 10, 0, 0, 0, 0, 0, 0, 0,
991 0, 11, 12, 13, 14, 15, 16, 17, 18, 19,
992 20, 21, 22, 0, 0, 0, 23, 24, 25, 26,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000993 0, 27, 28, 29, 30, 87, 31, 88, 89, 90,
994 91, 0, 0, 92, 93, 0, 0, 0, 0, 0,
995 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
996 0, 0, 94, 0, 0, 0, 8, 9, 10, 0,
997 0, 0, 139, 95, 96, 0, 97, 11, 12, 13,
998 14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
999 0, 0, 0, 0, 25, 26, 0, 27, 28, 29,
1000 30, 87, 31, 88, 89, 90, 91, 0, 0, 92,
1001 93, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1002 0, 0, 0, 0, 0, 0, 0, 0, 94, 0,
1003 0, 161, 8, 9, 10, 0, 0, 0, 0, 95,
1004 96, 0, 97, 11, 12, 13, 14, 15, 16, 17,
1005 18, 19, 20, 21, 22, 0, 0, 0, 0, 0,
1006 25, 26, 0, 27, 28, 29, 30, 87, 31, 88,
1007 89, 90, 91, 0, 0, 92, 93, 0, 0, 0,
1008 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1009 0, 0, 0, 0, 94, 0, 0, 0, 8, 9,
1010 10, 0, 0, 0, 206, 95, 96, 0, 97, 11,
1011 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
1012 22, 0, 0, 0, 0, 0, 25, 26, 0, 27,
1013 28, 29, 30, 87, 31, 88, 89, 90, 91, 0,
1014 0, 92, 93, 0, 0, 0, 0, 0, 0, 0,
1015 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1016 94, 0, 0, 222, 8, 9, 10, 0, 0, 0,
1017 0, 95, 96, 0, 97, 11, 12, 13, 14, 15,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001018 16, 17, 18, 19, 20, 21, 22, 0, 0, 0,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00001019 0, 0, 25, 26, 0, 27, 28, 29, 30, 87,
1020 31, 88, 89, 90, 91, 0, 0, 92, 93, 0,
1021 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1022 0, 0, 0, 0, 0, 0, 94, 0, 0, 0,
1023 8, 9, 10, 0, 0, 0, 0, 95, 96, 0,
1024 97, 11, 12, 13, 14, 15, 16, 17, 18, 19,
1025 20, 21, 22, 0, 0, 0, 0, 0, 25, 175,
1026 0, 27, 28, 29, 30, 87, 31, 88, 89, 90,
1027 91, 0, 0, 92, 93, 0, 0, 0, 0, 0,
1028 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1029 0, 0, 94, 2, 3, 4, 0, 0, 0, 8,
1030 9, 10, 0, 95, 96, 0, 97, 0, 0, 0,
1031 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
1032 21, 22, 0, 0, 0, 0, 0, 25, 26, 0,
1033 27, 28, 29, 30, 0, 31, 2, 3, 4, 0,
1034 0, 0, 8, 9, 10, 0, 0, 0, 0, 0,
1035 0, 0, 0, 11, 12, 13, 14, 15, 16, 17,
1036 18, 19, 20, 21, 22, 0, 198, 0, 0, 0,
1037 25, 26, 0, 27, 28, 29, 30, 0, 31, 0,
1038 0, 0, 0, 0, 0, 0, 0, 0, 0, 71,
1039 0, 0, 1, 2, 3, 4, 5, 6, 7, 8,
1040 9, 10, 0, 0, 0, 0, 0, 0, 0, 247,
1041 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
1042 21, 22, 0, 0, 0, 23, 24, 25, 26, 0,
1043 27, 28, 29, 30, 0, 31, 1, 2, 3, 4,
1044 5, 6, 7, 8, 9, 10, 0, 0, 0, 0,
1045 0, 0, 0, 0, 11, 12, 13, 14, 15, 16,
1046 17, 18, 19, 20, 21, 22, 0, 0, 0, 23,
1047 24, 25, 26, 0, 27, 28, 29, 30, 0, 31,
1048 2, 3, 4, 0, 0, 0, 8, 9, 10, 0,
1049 0, 0, 0, 0, 0, 0, 0, 11, 12, 13,
1050 14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
1051 0, 0, 0, 0, 25, 26, 0, 27, 28, 29,
1052 30, 0, 31, 8, 9, 10, 0, 0, 0, 0,
1053 0, 0, 0, 0, 11, 12, 13, 14, 15, 16,
1054 17, 18, 19, 20, 21, 22, 0, 0, 0, 0,
1055 0, 25, 26, 0, 27, 28, 29, 30, 229, 31,
1056 8, 9, 10, 230, 0, 0, 0, 0, 0, 0,
1057 0, 11, 12, 13, 14, 15, 16, 17, 18, 19,
1058 20, 21, 22, 0, 0, 0, 0, 0, 25, 26,
1059 0, 27, 28, 29, 30, 0, 31
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001060};
1061
1062static const yytype_int16 yycheck[] =
1063{
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00001064 0, 55, 94, 86, 70, 127, 45, 151, 273, 60,
1065 40, 36, 85, 0, 0, 160, 257, 37, 79, 85,
1066 84, 82, 86, 106, 3, 45, 70, 253, 293, 8,
1067 9, 272, 57, 63, 55, 56, 79, 76, 42, 82,
1068 40, 85, 42, 135, 95, 75, 46, 51, 92, 93,
1069 79, 51, 82, 82, 33, 34, 35, 36, 37, 46,
1070 46, 74, 288, 63, 82, 109, 292, 73, 81, 90,
1071 91, 73, 194, 79, 3, 75, 76, 160, 170, 8,
1072 9, 72, 82, 74, 79, 79, 159, 82, 53, 54,
1073 81, 174, 73, 159, 73, 125, 45, 127, 79, 74,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001074 192, 62, 63, 64, 33, 34, 35, 36, 37, 74,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00001075 71, 73, 204, 78, 258, 159, 73, 79, 76, 72,
1076 81, 74, 79, 87, 88, 125, 76, 127, 183, 184,
1077 185, 186, 37, 216, 217, 179, 180, 181, 182, 183,
1078 184, 185, 186, 187, 188, 189, 190, 191, 221, 294,
1079 45, 151, 4, 5, 6, 221, 33, 34, 35, 57,
1080 58, 79, 80, 82, 194, 257, 181, 182, 187, 188,
1081 45, 72, 59, 73, 45, 248, 72, 221, 61, 82,
1082 272, 264, 248, 75, 72, 82, 72, 72, 82, 281,
1083 79, 72, 74, 77, 194, 75, 74, 76, 252, 291,
1084 3, 4, 5, 6, 248, 8, 9, 10, 11, 12,
1085 210, 294, 75, 75, 72, 40, 75, 72, 21, 22,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001086 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00001087 75, 45, 73, 36, 37, 38, 39, 77, 41, 42,
1088 43, 44, 45, 46, 47, 48, 49, 50, 82, 73,
1089 53, 54, 16, 253, 254, 81, 171, 257, 258, 82,
1090 190, 189, 82, 57, 191, 64, 82, 5, 125, 72,
1091 254, 249, 272, 210, 254, 292, 272, 46, -1, -1,
1092 83, 84, -1, 86, -1, -1, -1, -1, 288, -1,
1093 -1, -1, 292, 3, 4, 5, 6, 7, 8, 9,
1094 10, 11, 12, 13, 14, 15, -1, 17, 18, 19,
1095 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
1096 30, 31, 32, -1, -1, -1, 36, 37, 38, 39,
1097 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
1098 50, -1, -1, 53, 54, -1, -1, -1, -1, -1,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001099 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00001100 -1, -1, 72, -1, -1, -1, 76, 77, -1, -1,
1101 -1, -1, 82, 83, 84, -1, 86, 3, 4, 5,
1102 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
1103 -1, 17, 18, 19, 20, 21, 22, 23, 24, 25,
1104 26, 27, 28, 29, 30, 31, 32, -1, -1, -1,
1105 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
1106 46, 47, 48, 49, 50, -1, -1, 53, 54, -1,
zmo@google.com09c323a2011-08-12 18:22:25 +00001107 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00001108 -1, -1, -1, -1, -1, -1, 72, -1, -1, -1,
1109 76, 77, -1, -1, -1, -1, 82, 83, 84, -1,
1110 86, 3, 4, 5, 6, 7, 8, 9, 10, 11,
1111 12, 13, 14, 15, -1, 17, 18, 19, 20, 21,
1112 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
1113 32, -1, -1, -1, 36, 37, 38, 39, 40, 41,
1114 42, 43, 44, 45, 46, 47, 48, 49, 50, -1,
1115 -1, 53, 54, -1, -1, -1, -1, -1, -1, -1,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001116 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00001117 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
1118 82, 83, 84, -1, 86, 3, 4, 5, 6, 7,
1119 8, 9, 10, 11, 12, 13, 14, 15, -1, 17,
1120 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
1121 28, 29, 30, 31, 32, -1, -1, -1, 36, 37,
1122 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
1123 48, 49, 50, -1, -1, 53, 54, -1, -1, -1,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001124 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00001125 -1, -1, -1, -1, 72, -1, -1, -1, 76, -1,
1126 -1, -1, -1, -1, 82, 83, 84, -1, 86, 3,
1127 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
1128 14, 15, -1, 17, 18, 19, 20, 21, 22, 23,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001129 24, 25, 26, 27, 28, 29, 30, 31, 32, -1,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00001130 -1, -1, 36, 37, 38, 39, 40, 41, 42, 43,
1131 44, 45, 46, 47, 48, 49, 50, -1, -1, 53,
1132 54, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1133 -1, -1, -1, -1, -1, -1, -1, -1, 72, -1,
1134 -1, -1, -1, -1, -1, -1, -1, -1, 82, 83,
1135 84, -1, 86, 3, 4, 5, 6, 7, 8, 9,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001136 10, 11, 12, -1, -1, -1, -1, -1, -1, -1,
1137 -1, 21, 22, 23, 24, 25, 26, 27, 28, 29,
1138 30, 31, 32, -1, -1, -1, 36, 37, 38, 39,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00001139 -1, 41, 42, 43, 44, 45, 46, 47, 48, 49,
1140 50, -1, -1, 53, 54, -1, -1, -1, -1, -1,
1141 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1142 -1, -1, 72, -1, -1, -1, 10, 11, 12, -1,
1143 -1, -1, 82, 83, 84, -1, 86, 21, 22, 23,
1144 24, 25, 26, 27, 28, 29, 30, 31, 32, -1,
1145 -1, -1, -1, -1, 38, 39, -1, 41, 42, 43,
1146 44, 45, 46, 47, 48, 49, 50, -1, -1, 53,
1147 54, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1148 -1, -1, -1, -1, -1, -1, -1, -1, 72, -1,
1149 -1, 75, 10, 11, 12, -1, -1, -1, -1, 83,
1150 84, -1, 86, 21, 22, 23, 24, 25, 26, 27,
1151 28, 29, 30, 31, 32, -1, -1, -1, -1, -1,
1152 38, 39, -1, 41, 42, 43, 44, 45, 46, 47,
1153 48, 49, 50, -1, -1, 53, 54, -1, -1, -1,
1154 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1155 -1, -1, -1, -1, 72, -1, -1, -1, 10, 11,
1156 12, -1, -1, -1, 82, 83, 84, -1, 86, 21,
1157 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
1158 32, -1, -1, -1, -1, -1, 38, 39, -1, 41,
1159 42, 43, 44, 45, 46, 47, 48, 49, 50, -1,
1160 -1, 53, 54, -1, -1, -1, -1, -1, -1, -1,
1161 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1162 72, -1, -1, 75, 10, 11, 12, -1, -1, -1,
1163 -1, 83, 84, -1, 86, 21, 22, 23, 24, 25,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001164 26, 27, 28, 29, 30, 31, 32, -1, -1, -1,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00001165 -1, -1, 38, 39, -1, 41, 42, 43, 44, 45,
1166 46, 47, 48, 49, 50, -1, -1, 53, 54, -1,
1167 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1168 -1, -1, -1, -1, -1, -1, 72, -1, -1, -1,
1169 10, 11, 12, -1, -1, -1, -1, 83, 84, -1,
1170 86, 21, 22, 23, 24, 25, 26, 27, 28, 29,
1171 30, 31, 32, -1, -1, -1, -1, -1, 38, 39,
1172 -1, 41, 42, 43, 44, 45, 46, 47, 48, 49,
1173 50, -1, -1, 53, 54, -1, -1, -1, -1, -1,
1174 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1175 -1, -1, 72, 4, 5, 6, -1, -1, -1, 10,
1176 11, 12, -1, 83, 84, -1, 86, -1, -1, -1,
1177 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
1178 31, 32, -1, -1, -1, -1, -1, 38, 39, -1,
1179 41, 42, 43, 44, -1, 46, 4, 5, 6, -1,
1180 -1, -1, 10, 11, 12, -1, -1, -1, -1, -1,
1181 -1, -1, -1, 21, 22, 23, 24, 25, 26, 27,
1182 28, 29, 30, 31, 32, -1, 77, -1, -1, -1,
1183 38, 39, -1, 41, 42, 43, 44, -1, 46, -1,
1184 -1, -1, -1, -1, -1, -1, -1, -1, -1, 0,
1185 -1, -1, 3, 4, 5, 6, 7, 8, 9, 10,
1186 11, 12, -1, -1, -1, -1, -1, -1, -1, 77,
1187 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
1188 31, 32, -1, -1, -1, 36, 37, 38, 39, -1,
1189 41, 42, 43, 44, -1, 46, 3, 4, 5, 6,
1190 7, 8, 9, 10, 11, 12, -1, -1, -1, -1,
1191 -1, -1, -1, -1, 21, 22, 23, 24, 25, 26,
1192 27, 28, 29, 30, 31, 32, -1, -1, -1, 36,
1193 37, 38, 39, -1, 41, 42, 43, 44, -1, 46,
1194 4, 5, 6, -1, -1, -1, 10, 11, 12, -1,
1195 -1, -1, -1, -1, -1, -1, -1, 21, 22, 23,
1196 24, 25, 26, 27, 28, 29, 30, 31, 32, -1,
1197 -1, -1, -1, -1, 38, 39, -1, 41, 42, 43,
1198 44, -1, 46, 10, 11, 12, -1, -1, -1, -1,
1199 -1, -1, -1, -1, 21, 22, 23, 24, 25, 26,
1200 27, 28, 29, 30, 31, 32, -1, -1, -1, -1,
1201 -1, 38, 39, -1, 41, 42, 43, 44, 45, 46,
1202 10, 11, 12, 50, -1, -1, -1, -1, -1, -1,
1203 -1, 21, 22, 23, 24, 25, 26, 27, 28, 29,
1204 30, 31, 32, -1, -1, -1, -1, -1, 38, 39,
1205 -1, 41, 42, 43, 44, -1, 46
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001206};
1207
1208/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
1209 symbol of state STATE-NUM. */
1210static const yytype_uint8 yystos[] =
1211{
1212 0, 3, 4, 5, 6, 7, 8, 9, 10, 11,
1213 12, 21, 22, 23, 24, 25, 26, 27, 28, 29,
zmo@google.com09c323a2011-08-12 18:22:25 +00001214 30, 31, 32, 36, 37, 38, 39, 41, 42, 43,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001215 44, 46, 126, 127, 128, 129, 130, 135, 136, 137,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00001216 138, 139, 140, 141, 142, 143, 175, 176, 177, 37,
1217 45, 140, 45, 76, 82, 178, 73, 79, 3, 33,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001218 34, 35, 132, 133, 138, 79, 82, 45, 139, 141,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00001219 74, 0, 176, 141, 76, 145, 76, 161, 132, 131,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001220 134, 139, 133, 45, 72, 74, 81, 45, 47, 48,
1221 49, 50, 53, 54, 72, 83, 84, 86, 97, 98,
1222 99, 101, 102, 103, 104, 105, 106, 107, 108, 109,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001223 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001224 120, 121, 125, 142, 82, 144, 139, 146, 147, 13,
1225 14, 15, 17, 18, 19, 20, 40, 76, 77, 82,
1226 108, 121, 122, 124, 126, 127, 142, 151, 152, 153,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00001227 154, 162, 163, 164, 167, 174, 45, 131, 134, 74,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001228 81, 75, 125, 122, 150, 108, 108, 124, 53, 54,
1229 74, 78, 73, 73, 79, 39, 122, 72, 108, 87,
1230 88, 84, 86, 55, 56, 90, 91, 57, 58, 59,
1231 61, 60, 95, 75, 146, 45, 148, 149, 77, 147,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00001232 82, 82, 169, 72, 72, 82, 82, 124, 72, 77,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001233 155, 62, 63, 64, 71, 81, 123, 79, 82, 77,
1234 152, 74, 75, 125, 150, 75, 73, 100, 124, 45,
1235 50, 103, 122, 108, 108, 110, 110, 112, 112, 112,
1236 112, 113, 113, 117, 118, 119, 124, 77, 74, 79,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00001237 82, 158, 159, 160, 170, 124, 82, 168, 162, 122,
1238 122, 125, 75, 75, 80, 125, 149, 40, 161, 153,
1239 151, 163, 171, 73, 124, 137, 166, 156, 75, 122,
1240 75, 72, 166, 172, 173, 158, 165, 45, 73, 77,
1241 124, 82, 73, 16, 81, 153, 157, 161, 73, 124,
1242 157, 158, 150, 82
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001243};
1244
1245#define yyerrok (yyerrstatus = 0)
1246#define yyclearin (yychar = YYEMPTY)
1247#define YYEMPTY (-2)
1248#define YYEOF 0
1249
1250#define YYACCEPT goto yyacceptlab
1251#define YYABORT goto yyabortlab
1252#define YYERROR goto yyerrorlab
1253
1254
1255/* Like YYERROR except do call yyerror. This remains here temporarily
1256 to ease the transition to the new meaning of YYERROR, for GCC.
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001257 Once GCC version 2 has supplanted version 1, this can go. However,
1258 YYFAIL appears to be in use. Nevertheless, it is formally deprecated
1259 in Bison 2.4.2's NEWS entry, where a plan to phase it out is
1260 discussed. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001261
1262#define YYFAIL goto yyerrlab
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001263#if defined YYFAIL
1264 /* This is here to suppress warnings from the GCC cpp's
1265 -Wunused-macros. Normally we don't worry about that warning, but
1266 some users do, and we want to make it easy for users to remove
1267 YYFAIL uses, which will produce warnings from Bison 2.5. */
1268#endif
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001269
1270#define YYRECOVERING() (!!yyerrstatus)
1271
1272#define YYBACKUP(Token, Value) \
1273do \
1274 if (yychar == YYEMPTY && yylen == 1) \
1275 { \
1276 yychar = (Token); \
1277 yylval = (Value); \
1278 yytoken = YYTRANSLATE (yychar); \
1279 YYPOPSTACK (1); \
1280 goto yybackup; \
1281 } \
1282 else \
1283 { \
1284 yyerror (context, YY_("syntax error: cannot back up")); \
1285 YYERROR; \
1286 } \
1287while (YYID (0))
1288
1289
1290#define YYTERROR 1
1291#define YYERRCODE 256
1292
1293
1294/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
1295 If N is 0, then set CURRENT to the empty location which ends
1296 the previous symbol: RHS[0] (always defined). */
1297
1298#define YYRHSLOC(Rhs, K) ((Rhs)[K])
1299#ifndef YYLLOC_DEFAULT
1300# define YYLLOC_DEFAULT(Current, Rhs, N) \
1301 do \
1302 if (YYID (N)) \
1303 { \
1304 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
1305 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
1306 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
1307 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
1308 } \
1309 else \
1310 { \
1311 (Current).first_line = (Current).last_line = \
1312 YYRHSLOC (Rhs, 0).last_line; \
1313 (Current).first_column = (Current).last_column = \
1314 YYRHSLOC (Rhs, 0).last_column; \
1315 } \
1316 while (YYID (0))
1317#endif
1318
1319
1320/* YY_LOCATION_PRINT -- Print the location on the stream.
1321 This macro was not mandated originally: define only if we know
1322 we won't break user code: when these are the locations we know. */
1323
1324#ifndef YY_LOCATION_PRINT
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001325# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001326# define YY_LOCATION_PRINT(File, Loc) \
1327 fprintf (File, "%d.%d-%d.%d", \
1328 (Loc).first_line, (Loc).first_column, \
1329 (Loc).last_line, (Loc).last_column)
1330# else
1331# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1332# endif
1333#endif
1334
1335
1336/* YYLEX -- calling `yylex' with the right arguments. */
1337
1338#ifdef YYLEX_PARAM
1339# define YYLEX yylex (&yylval, YYLEX_PARAM)
1340#else
1341# define YYLEX yylex (&yylval)
1342#endif
1343
1344/* Enable debugging if requested. */
1345#if YYDEBUG
1346
1347# ifndef YYFPRINTF
1348# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1349# define YYFPRINTF fprintf
1350# endif
1351
1352# define YYDPRINTF(Args) \
1353do { \
1354 if (yydebug) \
1355 YYFPRINTF Args; \
1356} while (YYID (0))
1357
1358# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
1359do { \
1360 if (yydebug) \
1361 { \
1362 YYFPRINTF (stderr, "%s ", Title); \
1363 yy_symbol_print (stderr, \
1364 Type, Value, context); \
1365 YYFPRINTF (stderr, "\n"); \
1366 } \
1367} while (YYID (0))
1368
1369
1370/*--------------------------------.
1371| Print this symbol on YYOUTPUT. |
1372`--------------------------------*/
1373
1374/*ARGSUSED*/
1375#if (defined __STDC__ || defined __C99__FUNC__ \
1376 || defined __cplusplus || defined _MSC_VER)
1377static void
1378yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, TParseContext* context)
1379#else
1380static void
1381yy_symbol_value_print (yyoutput, yytype, yyvaluep, context)
1382 FILE *yyoutput;
1383 int yytype;
1384 YYSTYPE const * const yyvaluep;
1385 TParseContext* context;
1386#endif
1387{
1388 if (!yyvaluep)
1389 return;
1390 YYUSE (context);
1391# ifdef YYPRINT
1392 if (yytype < YYNTOKENS)
1393 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1394# else
1395 YYUSE (yyoutput);
1396# endif
1397 switch (yytype)
1398 {
1399 default:
1400 break;
1401 }
1402}
1403
1404
1405/*--------------------------------.
1406| Print this symbol on YYOUTPUT. |
1407`--------------------------------*/
1408
1409#if (defined __STDC__ || defined __C99__FUNC__ \
1410 || defined __cplusplus || defined _MSC_VER)
1411static void
1412yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, TParseContext* context)
1413#else
1414static void
1415yy_symbol_print (yyoutput, yytype, yyvaluep, context)
1416 FILE *yyoutput;
1417 int yytype;
1418 YYSTYPE const * const yyvaluep;
1419 TParseContext* context;
1420#endif
1421{
1422 if (yytype < YYNTOKENS)
1423 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1424 else
1425 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1426
1427 yy_symbol_value_print (yyoutput, yytype, yyvaluep, context);
1428 YYFPRINTF (yyoutput, ")");
1429}
1430
1431/*------------------------------------------------------------------.
1432| yy_stack_print -- Print the state stack from its BOTTOM up to its |
1433| TOP (included). |
1434`------------------------------------------------------------------*/
1435
1436#if (defined __STDC__ || defined __C99__FUNC__ \
1437 || defined __cplusplus || defined _MSC_VER)
1438static void
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001439yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001440#else
1441static void
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001442yy_stack_print (yybottom, yytop)
1443 yytype_int16 *yybottom;
1444 yytype_int16 *yytop;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001445#endif
1446{
1447 YYFPRINTF (stderr, "Stack now");
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001448 for (; yybottom <= yytop; yybottom++)
1449 {
1450 int yybot = *yybottom;
1451 YYFPRINTF (stderr, " %d", yybot);
1452 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001453 YYFPRINTF (stderr, "\n");
1454}
1455
1456# define YY_STACK_PRINT(Bottom, Top) \
1457do { \
1458 if (yydebug) \
1459 yy_stack_print ((Bottom), (Top)); \
1460} while (YYID (0))
1461
1462
1463/*------------------------------------------------.
1464| Report that the YYRULE is going to be reduced. |
1465`------------------------------------------------*/
1466
1467#if (defined __STDC__ || defined __C99__FUNC__ \
1468 || defined __cplusplus || defined _MSC_VER)
1469static void
1470yy_reduce_print (YYSTYPE *yyvsp, int yyrule, TParseContext* context)
1471#else
1472static void
1473yy_reduce_print (yyvsp, yyrule, context)
1474 YYSTYPE *yyvsp;
1475 int yyrule;
1476 TParseContext* context;
1477#endif
1478{
1479 int yynrhs = yyr2[yyrule];
1480 int yyi;
1481 unsigned long int yylno = yyrline[yyrule];
1482 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1483 yyrule - 1, yylno);
1484 /* The symbols being reduced. */
1485 for (yyi = 0; yyi < yynrhs; yyi++)
1486 {
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001487 YYFPRINTF (stderr, " $%d = ", yyi + 1);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001488 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1489 &(yyvsp[(yyi + 1) - (yynrhs)])
1490 , context);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001491 YYFPRINTF (stderr, "\n");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001492 }
1493}
1494
1495# define YY_REDUCE_PRINT(Rule) \
1496do { \
1497 if (yydebug) \
1498 yy_reduce_print (yyvsp, Rule, context); \
1499} while (YYID (0))
1500
1501/* Nonzero means print parse trace. It is left uninitialized so that
1502 multiple parsers can coexist. */
1503int yydebug;
1504#else /* !YYDEBUG */
1505# define YYDPRINTF(Args)
1506# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1507# define YY_STACK_PRINT(Bottom, Top)
1508# define YY_REDUCE_PRINT(Rule)
1509#endif /* !YYDEBUG */
1510
1511
1512/* YYINITDEPTH -- initial size of the parser's stacks. */
1513#ifndef YYINITDEPTH
1514# define YYINITDEPTH 200
1515#endif
1516
1517/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1518 if the built-in stack extension method is used).
1519
1520 Do not make this value too large; the results are undefined if
1521 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1522 evaluated with infinite-precision integer arithmetic. */
1523
1524#ifndef YYMAXDEPTH
1525# define YYMAXDEPTH 10000
1526#endif
1527
1528
1529
1530#if YYERROR_VERBOSE
1531
1532# ifndef yystrlen
1533# if defined __GLIBC__ && defined _STRING_H
1534# define yystrlen strlen
1535# else
1536/* Return the length of YYSTR. */
1537#if (defined __STDC__ || defined __C99__FUNC__ \
1538 || defined __cplusplus || defined _MSC_VER)
1539static YYSIZE_T
1540yystrlen (const char *yystr)
1541#else
1542static YYSIZE_T
1543yystrlen (yystr)
1544 const char *yystr;
1545#endif
1546{
1547 YYSIZE_T yylen;
1548 for (yylen = 0; yystr[yylen]; yylen++)
1549 continue;
1550 return yylen;
1551}
1552# endif
1553# endif
1554
1555# ifndef yystpcpy
1556# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1557# define yystpcpy stpcpy
1558# else
1559/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1560 YYDEST. */
1561#if (defined __STDC__ || defined __C99__FUNC__ \
1562 || defined __cplusplus || defined _MSC_VER)
1563static char *
1564yystpcpy (char *yydest, const char *yysrc)
1565#else
1566static char *
1567yystpcpy (yydest, yysrc)
1568 char *yydest;
1569 const char *yysrc;
1570#endif
1571{
1572 char *yyd = yydest;
1573 const char *yys = yysrc;
1574
1575 while ((*yyd++ = *yys++) != '\0')
1576 continue;
1577
1578 return yyd - 1;
1579}
1580# endif
1581# endif
1582
1583# ifndef yytnamerr
1584/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1585 quotes and backslashes, so that it's suitable for yyerror. The
1586 heuristic is that double-quoting is unnecessary unless the string
1587 contains an apostrophe, a comma, or backslash (other than
1588 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1589 null, do not copy; instead, return the length of what the result
1590 would have been. */
1591static YYSIZE_T
1592yytnamerr (char *yyres, const char *yystr)
1593{
1594 if (*yystr == '"')
1595 {
1596 YYSIZE_T yyn = 0;
1597 char const *yyp = yystr;
1598
1599 for (;;)
1600 switch (*++yyp)
1601 {
1602 case '\'':
1603 case ',':
1604 goto do_not_strip_quotes;
1605
1606 case '\\':
1607 if (*++yyp != '\\')
1608 goto do_not_strip_quotes;
1609 /* Fall through. */
1610 default:
1611 if (yyres)
1612 yyres[yyn] = *yyp;
1613 yyn++;
1614 break;
1615
1616 case '"':
1617 if (yyres)
1618 yyres[yyn] = '\0';
1619 return yyn;
1620 }
1621 do_not_strip_quotes: ;
1622 }
1623
1624 if (! yyres)
1625 return yystrlen (yystr);
1626
1627 return yystpcpy (yyres, yystr) - yyres;
1628}
1629# endif
1630
1631/* Copy into YYRESULT an error message about the unexpected token
1632 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1633 including the terminating null byte. If YYRESULT is null, do not
1634 copy anything; just return the number of bytes that would be
1635 copied. As a special case, return 0 if an ordinary "syntax error"
1636 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1637 size calculation. */
1638static YYSIZE_T
1639yysyntax_error (char *yyresult, int yystate, int yychar)
1640{
1641 int yyn = yypact[yystate];
1642
1643 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1644 return 0;
1645 else
1646 {
1647 int yytype = YYTRANSLATE (yychar);
1648 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1649 YYSIZE_T yysize = yysize0;
1650 YYSIZE_T yysize1;
1651 int yysize_overflow = 0;
1652 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1653 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1654 int yyx;
1655
1656# if 0
1657 /* This is so xgettext sees the translatable formats that are
1658 constructed on the fly. */
1659 YY_("syntax error, unexpected %s");
1660 YY_("syntax error, unexpected %s, expecting %s");
1661 YY_("syntax error, unexpected %s, expecting %s or %s");
1662 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1663 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1664# endif
1665 char *yyfmt;
1666 char const *yyf;
1667 static char const yyunexpected[] = "syntax error, unexpected %s";
1668 static char const yyexpecting[] = ", expecting %s";
1669 static char const yyor[] = " or %s";
1670 char yyformat[sizeof yyunexpected
1671 + sizeof yyexpecting - 1
1672 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1673 * (sizeof yyor - 1))];
1674 char const *yyprefix = yyexpecting;
1675
1676 /* Start YYX at -YYN if negative to avoid negative indexes in
1677 YYCHECK. */
1678 int yyxbegin = yyn < 0 ? -yyn : 0;
1679
1680 /* Stay within bounds of both yycheck and yytname. */
1681 int yychecklim = YYLAST - yyn + 1;
1682 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1683 int yycount = 1;
1684
1685 yyarg[0] = yytname[yytype];
1686 yyfmt = yystpcpy (yyformat, yyunexpected);
1687
1688 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1689 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1690 {
1691 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1692 {
1693 yycount = 1;
1694 yysize = yysize0;
1695 yyformat[sizeof yyunexpected - 1] = '\0';
1696 break;
1697 }
1698 yyarg[yycount++] = yytname[yyx];
1699 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1700 yysize_overflow |= (yysize1 < yysize);
1701 yysize = yysize1;
1702 yyfmt = yystpcpy (yyfmt, yyprefix);
1703 yyprefix = yyor;
1704 }
1705
1706 yyf = YY_(yyformat);
1707 yysize1 = yysize + yystrlen (yyf);
1708 yysize_overflow |= (yysize1 < yysize);
1709 yysize = yysize1;
1710
1711 if (yysize_overflow)
1712 return YYSIZE_MAXIMUM;
1713
1714 if (yyresult)
1715 {
1716 /* Avoid sprintf, as that infringes on the user's name space.
1717 Don't have undefined behavior even if the translation
1718 produced a string with the wrong number of "%s"s. */
1719 char *yyp = yyresult;
1720 int yyi = 0;
1721 while ((*yyp = *yyf) != '\0')
1722 {
1723 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1724 {
1725 yyp += yytnamerr (yyp, yyarg[yyi++]);
1726 yyf += 2;
1727 }
1728 else
1729 {
1730 yyp++;
1731 yyf++;
1732 }
1733 }
1734 }
1735 return yysize;
1736 }
1737}
1738#endif /* YYERROR_VERBOSE */
1739
1740
1741/*-----------------------------------------------.
1742| Release the memory associated to this symbol. |
1743`-----------------------------------------------*/
1744
1745/*ARGSUSED*/
1746#if (defined __STDC__ || defined __C99__FUNC__ \
1747 || defined __cplusplus || defined _MSC_VER)
1748static void
1749yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, TParseContext* context)
1750#else
1751static void
1752yydestruct (yymsg, yytype, yyvaluep, context)
1753 const char *yymsg;
1754 int yytype;
1755 YYSTYPE *yyvaluep;
1756 TParseContext* context;
1757#endif
1758{
1759 YYUSE (yyvaluep);
1760 YYUSE (context);
1761
1762 if (!yymsg)
1763 yymsg = "Deleting";
1764 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1765
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001766 switch (yytype)
1767 {
1768
1769 default:
1770 break;
1771 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001772}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001773
1774/* Prevent warnings from -Wmissing-prototypes. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001775#ifdef YYPARSE_PARAM
1776#if defined __STDC__ || defined __cplusplus
1777int yyparse (void *YYPARSE_PARAM);
1778#else
1779int yyparse ();
1780#endif
1781#else /* ! YYPARSE_PARAM */
1782#if defined __STDC__ || defined __cplusplus
1783int yyparse (TParseContext* context);
1784#else
1785int yyparse ();
1786#endif
1787#endif /* ! YYPARSE_PARAM */
1788
1789
1790
1791
1792
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001793/*-------------------------.
1794| yyparse or yypush_parse. |
1795`-------------------------*/
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001796
1797#ifdef YYPARSE_PARAM
1798#if (defined __STDC__ || defined __C99__FUNC__ \
1799 || defined __cplusplus || defined _MSC_VER)
1800int
1801yyparse (void *YYPARSE_PARAM)
1802#else
1803int
1804yyparse (YYPARSE_PARAM)
1805 void *YYPARSE_PARAM;
1806#endif
1807#else /* ! YYPARSE_PARAM */
1808#if (defined __STDC__ || defined __C99__FUNC__ \
1809 || defined __cplusplus || defined _MSC_VER)
1810int
1811yyparse (TParseContext* context)
1812#else
1813int
1814yyparse (context)
1815 TParseContext* context;
1816#endif
1817#endif
1818{
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001819/* The lookahead symbol. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001820int yychar;
1821
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001822/* The semantic value of the lookahead symbol. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001823YYSTYPE yylval;
1824
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001825 /* Number of syntax errors so far. */
1826 int yynerrs;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001827
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001828 int yystate;
1829 /* Number of tokens to shift before error messages enabled. */
1830 int yyerrstatus;
1831
1832 /* The stacks and their tools:
1833 `yyss': related to states.
1834 `yyvs': related to semantic values.
1835
1836 Refer to the stacks thru separate pointers, to allow yyoverflow
1837 to reallocate them elsewhere. */
1838
1839 /* The state stack. */
1840 yytype_int16 yyssa[YYINITDEPTH];
1841 yytype_int16 *yyss;
1842 yytype_int16 *yyssp;
1843
1844 /* The semantic value stack. */
1845 YYSTYPE yyvsa[YYINITDEPTH];
1846 YYSTYPE *yyvs;
1847 YYSTYPE *yyvsp;
1848
1849 YYSIZE_T yystacksize;
1850
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001851 int yyn;
1852 int yyresult;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001853 /* Lookahead token as an internal (translated) token number. */
1854 int yytoken;
1855 /* The variables used to return semantic value and location from the
1856 action routines. */
1857 YYSTYPE yyval;
1858
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001859#if YYERROR_VERBOSE
1860 /* Buffer for error messages, and its allocated size. */
1861 char yymsgbuf[128];
1862 char *yymsg = yymsgbuf;
1863 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1864#endif
1865
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001866#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1867
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001868 /* The number of symbols on the RHS of the reduced rule.
1869 Keep to zero when no symbol should be popped. */
1870 int yylen = 0;
1871
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001872 yytoken = 0;
1873 yyss = yyssa;
1874 yyvs = yyvsa;
1875 yystacksize = YYINITDEPTH;
1876
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001877 YYDPRINTF ((stderr, "Starting parse\n"));
1878
1879 yystate = 0;
1880 yyerrstatus = 0;
1881 yynerrs = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001882 yychar = YYEMPTY; /* Cause a token to be read. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001883
1884 /* Initialize stack pointers.
1885 Waste one element of value and location stack
1886 so that they stay on the same level as the state stack.
1887 The wasted elements are never initialized. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001888 yyssp = yyss;
1889 yyvsp = yyvs;
1890
1891 goto yysetstate;
1892
1893/*------------------------------------------------------------.
1894| yynewstate -- Push a new state, which is found in yystate. |
1895`------------------------------------------------------------*/
1896 yynewstate:
1897 /* In all cases, when you get here, the value and location stacks
1898 have just been pushed. So pushing a state here evens the stacks. */
1899 yyssp++;
1900
1901 yysetstate:
1902 *yyssp = yystate;
1903
1904 if (yyss + yystacksize - 1 <= yyssp)
1905 {
1906 /* Get the current used size of the three stacks, in elements. */
1907 YYSIZE_T yysize = yyssp - yyss + 1;
1908
1909#ifdef yyoverflow
1910 {
1911 /* Give user a chance to reallocate the stack. Use copies of
1912 these so that the &'s don't force the real ones into
1913 memory. */
1914 YYSTYPE *yyvs1 = yyvs;
1915 yytype_int16 *yyss1 = yyss;
1916
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001917 /* Each stack pointer address is followed by the size of the
1918 data in use in that stack, in bytes. This used to be a
1919 conditional around just the two extra args, but that might
1920 be undefined if yyoverflow is a macro. */
1921 yyoverflow (YY_("memory exhausted"),
1922 &yyss1, yysize * sizeof (*yyssp),
1923 &yyvs1, yysize * sizeof (*yyvsp),
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001924 &yystacksize);
1925
1926 yyss = yyss1;
1927 yyvs = yyvs1;
1928 }
1929#else /* no yyoverflow */
1930# ifndef YYSTACK_RELOCATE
1931 goto yyexhaustedlab;
1932# else
1933 /* Extend the stack our own way. */
1934 if (YYMAXDEPTH <= yystacksize)
1935 goto yyexhaustedlab;
1936 yystacksize *= 2;
1937 if (YYMAXDEPTH < yystacksize)
1938 yystacksize = YYMAXDEPTH;
1939
1940 {
1941 yytype_int16 *yyss1 = yyss;
1942 union yyalloc *yyptr =
1943 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1944 if (! yyptr)
1945 goto yyexhaustedlab;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001946 YYSTACK_RELOCATE (yyss_alloc, yyss);
1947 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001948# undef YYSTACK_RELOCATE
1949 if (yyss1 != yyssa)
1950 YYSTACK_FREE (yyss1);
1951 }
1952# endif
1953#endif /* no yyoverflow */
1954
1955 yyssp = yyss + yysize - 1;
1956 yyvsp = yyvs + yysize - 1;
1957
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001958 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1959 (unsigned long int) yystacksize));
1960
1961 if (yyss + yystacksize - 1 <= yyssp)
1962 YYABORT;
1963 }
1964
1965 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1966
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001967 if (yystate == YYFINAL)
1968 YYACCEPT;
1969
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001970 goto yybackup;
1971
1972/*-----------.
1973| yybackup. |
1974`-----------*/
1975yybackup:
1976
1977 /* Do appropriate processing given the current state. Read a
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001978 lookahead token if we need one and don't already have one. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001979
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001980 /* First try to decide what to do without reference to lookahead token. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001981 yyn = yypact[yystate];
1982 if (yyn == YYPACT_NINF)
1983 goto yydefault;
1984
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001985 /* Not known => get a lookahead token if don't already have one. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001986
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001987 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001988 if (yychar == YYEMPTY)
1989 {
1990 YYDPRINTF ((stderr, "Reading a token: "));
1991 yychar = YYLEX;
1992 }
1993
1994 if (yychar <= YYEOF)
1995 {
1996 yychar = yytoken = YYEOF;
1997 YYDPRINTF ((stderr, "Now at end of input.\n"));
1998 }
1999 else
2000 {
2001 yytoken = YYTRANSLATE (yychar);
2002 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
2003 }
2004
2005 /* If the proper action on seeing token YYTOKEN is to reduce or to
2006 detect an error, take that action. */
2007 yyn += yytoken;
2008 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
2009 goto yydefault;
2010 yyn = yytable[yyn];
2011 if (yyn <= 0)
2012 {
2013 if (yyn == 0 || yyn == YYTABLE_NINF)
2014 goto yyerrlab;
2015 yyn = -yyn;
2016 goto yyreduce;
2017 }
2018
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002019 /* Count tokens shifted since error; after three, turn off error
2020 status. */
2021 if (yyerrstatus)
2022 yyerrstatus--;
2023
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002024 /* Shift the lookahead token. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002025 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
2026
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002027 /* Discard the shifted token. */
2028 yychar = YYEMPTY;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002029
2030 yystate = yyn;
2031 *++yyvsp = yylval;
2032
2033 goto yynewstate;
2034
2035
2036/*-----------------------------------------------------------.
2037| yydefault -- do the default action for the current state. |
2038`-----------------------------------------------------------*/
2039yydefault:
2040 yyn = yydefact[yystate];
2041 if (yyn == 0)
2042 goto yyerrlab;
2043 goto yyreduce;
2044
2045
2046/*-----------------------------.
2047| yyreduce -- Do a reduction. |
2048`-----------------------------*/
2049yyreduce:
2050 /* yyn is the number of a rule to reduce with. */
2051 yylen = yyr2[yyn];
2052
2053 /* If YYLEN is nonzero, implement the default value of the action:
2054 `$$ = $1'.
2055
2056 Otherwise, the following line sets YYVAL to garbage.
2057 This behavior is undocumented and Bison
2058 users should not rely upon it. Assigning to YYVAL
2059 unconditionally makes the parser a bit smaller, and it avoids a
2060 GCC warning that YYVAL may be used uninitialized. */
2061 yyval = yyvsp[1-yylen];
2062
2063
2064 YY_REDUCE_PRINT (yyn);
2065 switch (yyn)
2066 {
2067 case 2:
2068
2069 {
2070 // The symbol table search was done in the lexical phase
2071 const TSymbol* symbol = (yyvsp[(1) - (1)].lex).symbol;
2072 const TVariable* variable;
2073 if (symbol == 0) {
2074 context->error((yyvsp[(1) - (1)].lex).line, "undeclared identifier", (yyvsp[(1) - (1)].lex).string->c_str(), "");
2075 context->recover();
2076 TType type(EbtFloat, EbpUndefined);
2077 TVariable* fakeVariable = new TVariable((yyvsp[(1) - (1)].lex).string, type);
2078 context->symbolTable.insert(*fakeVariable);
2079 variable = fakeVariable;
2080 } else {
2081 // This identifier can only be a variable type symbol
2082 if (! symbol->isVariable()) {
2083 context->error((yyvsp[(1) - (1)].lex).line, "variable expected", (yyvsp[(1) - (1)].lex).string->c_str(), "");
2084 context->recover();
2085 }
2086 variable = static_cast<const TVariable*>(symbol);
2087 }
2088
2089 // don't delete $1.string, it's used by error recovery, and the pool
2090 // pop will reclaim the memory
2091
2092 if (variable->getType().getQualifier() == EvqConst ) {
2093 ConstantUnion* constArray = variable->getConstPointer();
2094 TType t(variable->getType());
2095 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(constArray, t, (yyvsp[(1) - (1)].lex).line);
2096 } else
2097 (yyval.interm.intermTypedNode) = context->intermediate.addSymbol(variable->getUniqueId(),
2098 variable->getName(),
2099 variable->getType(), (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002100 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002101 break;
2102
2103 case 3:
2104
2105 {
2106 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002107 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002108 break;
2109
2110 case 4:
2111
2112 {
2113 //
2114 // INT_TYPE is only 16-bit plus sign bit for vertex/fragment shaders,
2115 // check for overflow for constants
2116 //
2117 if (abs((yyvsp[(1) - (1)].lex).i) >= (1 << 16)) {
2118 context->error((yyvsp[(1) - (1)].lex).line, " integer constant overflow", "", "");
2119 context->recover();
2120 }
2121 ConstantUnion *unionArray = new ConstantUnion[1];
2122 unionArray->setIConst((yyvsp[(1) - (1)].lex).i);
2123 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002124 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002125 break;
2126
2127 case 5:
2128
2129 {
2130 ConstantUnion *unionArray = new ConstantUnion[1];
2131 unionArray->setFConst((yyvsp[(1) - (1)].lex).f);
2132 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002133 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002134 break;
2135
2136 case 6:
2137
2138 {
2139 ConstantUnion *unionArray = new ConstantUnion[1];
2140 unionArray->setBConst((yyvsp[(1) - (1)].lex).b);
2141 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002142 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002143 break;
2144
2145 case 7:
2146
2147 {
2148 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (3)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002149 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002150 break;
2151
2152 case 8:
2153
2154 {
2155 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002156 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002157 break;
2158
2159 case 9:
2160
2161 {
2162 if (!(yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isVector()) {
2163 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode())
2164 context->error((yyvsp[(2) - (4)].lex).line, " left of '[' is not of type array, matrix, or vector ", (yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode()->getSymbol().c_str(), "");
2165 else
2166 context->error((yyvsp[(2) - (4)].lex).line, " left of '[' is not of type array, matrix, or vector ", "expression", "");
2167 context->recover();
2168 }
2169 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst && (yyvsp[(3) - (4)].interm.intermTypedNode)->getQualifier() == EvqConst) {
2170 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) { // constant folding for arrays
2171 (yyval.interm.intermTypedNode) = context->addConstArrayNode((yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2172 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector()) { // constant folding for vectors
2173 TVectorFields fields;
2174 fields.num = 1;
2175 fields.offsets[0] = (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(); // need to do it this way because v.xy sends fields integer array
2176 (yyval.interm.intermTypedNode) = context->addConstVectorNode(fields, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2177 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix()) { // constant folding for matrices
2178 (yyval.interm.intermTypedNode) = context->addConstMatrixNode((yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2179 }
2180 } else {
2181 if ((yyvsp[(3) - (4)].interm.intermTypedNode)->getQualifier() == EvqConst) {
2182 if (((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector() || (yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix()) && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getNominalSize() <= (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() ) {
2183 context->error((yyvsp[(2) - (4)].lex).line, "", "[", "field selection out of range '%d'", (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst());
2184 context->recover();
2185 } else {
2186 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) {
2187 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize() == 0) {
2188 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getMaxArraySize() <= (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst()) {
2189 if (context->arraySetMaxSize((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getTypePointer(), (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), true, (yyvsp[(2) - (4)].lex).line))
2190 context->recover();
2191 } else {
2192 if (context->arraySetMaxSize((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getTypePointer(), 0, false, (yyvsp[(2) - (4)].lex).line))
2193 context->recover();
2194 }
2195 } else if ( (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst() >= (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize()) {
2196 context->error((yyvsp[(2) - (4)].lex).line, "", "[", "array index out of range '%d'", (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst());
2197 context->recover();
2198 }
2199 }
2200 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(3) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2201 }
2202 } else {
2203 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize() == 0) {
2204 context->error((yyvsp[(2) - (4)].lex).line, "", "[", "array must be redeclared with a size before being indexed with a variable");
2205 context->recover();
2206 }
2207
2208 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexIndirect, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(3) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2209 }
2210 }
2211 if ((yyval.interm.intermTypedNode) == 0) {
2212 ConstantUnion *unionArray = new ConstantUnion[1];
2213 unionArray->setFConst(0.0f);
2214 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpHigh, EvqConst), (yyvsp[(2) - (4)].lex).line);
2215 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) {
2216 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getStruct())
2217 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getStruct(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getTypeName()));
2218 else
2219 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize(), (yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix()));
2220
2221 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst)
2222 (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConst);
2223 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst)
2224 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqConst, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize()));
2225 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix())
2226 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize()));
2227 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst)
2228 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqConst));
2229 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector())
2230 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary));
2231 else
2232 (yyval.interm.intermTypedNode)->setType((yyvsp[(1) - (4)].interm.intermTypedNode)->getType());
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002233 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002234 break;
2235
2236 case 10:
2237
2238 {
2239 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002240 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002241 break;
2242
2243 case 11:
2244
2245 {
2246 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isArray()) {
2247 context->error((yyvsp[(3) - (3)].lex).line, "cannot apply dot operator to an array", ".", "");
2248 context->recover();
2249 }
2250
2251 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isVector()) {
2252 TVectorFields fields;
2253 if (! context->parseVectorFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yyvsp[(3) - (3)].lex).line)) {
2254 fields.num = 1;
2255 fields.offsets[0] = 0;
2256 context->recover();
2257 }
2258
2259 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) { // constant folding for vector fields
2260 (yyval.interm.intermTypedNode) = context->addConstVectorNode(fields, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].lex).line);
2261 if ((yyval.interm.intermTypedNode) == 0) {
2262 context->recover();
2263 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2264 }
2265 else
2266 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(), EvqConst, (int) (*(yyvsp[(3) - (3)].lex).string).size()));
2267 } else {
2268 if (fields.num == 1) {
2269 ConstantUnion *unionArray = new ConstantUnion[1];
2270 unionArray->setIConst(fields.offsets[0]);
2271 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line);
2272 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2273 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision()));
2274 } else {
2275 TString vectorString = *(yyvsp[(3) - (3)].lex).string;
2276 TIntermTyped* index = context->intermediate.addSwizzle(fields, (yyvsp[(3) - (3)].lex).line);
2277 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpVectorSwizzle, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2278 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (int) vectorString.size()));
2279 }
2280 }
2281 } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isMatrix()) {
2282 TMatrixFields fields;
2283 if (! context->parseMatrixFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yyvsp[(3) - (3)].lex).line)) {
2284 fields.wholeRow = false;
2285 fields.wholeCol = false;
2286 fields.row = 0;
2287 fields.col = 0;
2288 context->recover();
2289 }
2290
2291 if (fields.wholeRow || fields.wholeCol) {
2292 context->error((yyvsp[(2) - (3)].lex).line, " non-scalar fields not implemented yet", ".", "");
2293 context->recover();
2294 ConstantUnion *unionArray = new ConstantUnion[1];
2295 unionArray->setIConst(0);
2296 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line);
2297 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2298 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(),EvqTemporary, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize()));
2299 } else {
2300 ConstantUnion *unionArray = new ConstantUnion[1];
2301 unionArray->setIConst(fields.col * (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize() + fields.row);
2302 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line);
2303 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2304 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision()));
2305 }
2306 } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType() == EbtStruct) {
2307 bool fieldFound = false;
2308 const TTypeList* fields = (yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getStruct();
2309 if (fields == 0) {
2310 context->error((yyvsp[(2) - (3)].lex).line, "structure has no fields", "Internal Error", "");
2311 context->recover();
2312 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2313 } else {
2314 unsigned int i;
2315 for (i = 0; i < fields->size(); ++i) {
2316 if ((*fields)[i].type->getFieldName() == *(yyvsp[(3) - (3)].lex).string) {
2317 fieldFound = true;
2318 break;
2319 }
2320 }
2321 if (fieldFound) {
2322 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) {
2323 (yyval.interm.intermTypedNode) = context->addConstStruct(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
2324 if ((yyval.interm.intermTypedNode) == 0) {
2325 context->recover();
2326 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2327 }
2328 else {
2329 (yyval.interm.intermTypedNode)->setType(*(*fields)[i].type);
2330 // change the qualifier of the return type, not of the structure field
2331 // as the structure definition is shared between various structures.
2332 (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConst);
2333 }
2334 } else {
2335 ConstantUnion *unionArray = new ConstantUnion[1];
2336 unionArray->setIConst(i);
2337 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, *(*fields)[i].type, (yyvsp[(3) - (3)].lex).line);
2338 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirectStruct, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2339 (yyval.interm.intermTypedNode)->setType(*(*fields)[i].type);
2340 }
2341 } else {
2342 context->error((yyvsp[(2) - (3)].lex).line, " no such field in structure", (yyvsp[(3) - (3)].lex).string->c_str(), "");
2343 context->recover();
2344 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2345 }
2346 }
2347 } else {
2348 context->error((yyvsp[(2) - (3)].lex).line, " field selection requires structure, vector, or matrix on left hand side", (yyvsp[(3) - (3)].lex).string->c_str(), "");
2349 context->recover();
2350 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2351 }
2352 // don't delete $3.string, it's from the pool
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002353 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002354 break;
2355
2356 case 12:
2357
2358 {
2359 if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode)))
2360 context->recover();
2361 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostIncrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line, context->symbolTable);
2362 if ((yyval.interm.intermTypedNode) == 0) {
2363 context->unaryOpError((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
2364 context->recover();
2365 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode);
2366 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002367 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002368 break;
2369
2370 case 13:
2371
2372 {
2373 if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode)))
2374 context->recover();
2375 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostDecrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line, context->symbolTable);
2376 if ((yyval.interm.intermTypedNode) == 0) {
2377 context->unaryOpError((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
2378 context->recover();
2379 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode);
2380 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002381 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002382 break;
2383
2384 case 14:
2385
2386 {
2387 if (context->integerErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode), "[]"))
2388 context->recover();
2389 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002390 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002391 break;
2392
2393 case 15:
2394
2395 {
2396 TFunction* fnCall = (yyvsp[(1) - (1)].interm).function;
2397 TOperator op = fnCall->getBuiltInOp();
2398
2399 if (op != EOpNull)
2400 {
2401 //
2402 // Then this should be a constructor.
2403 // Don't go through the symbol table for constructors.
2404 // Their parameters will be verified algorithmically.
2405 //
2406 TType type(EbtVoid, EbpUndefined); // use this to get the type back
2407 if (context->constructorErrorCheck((yyvsp[(1) - (1)].interm).line, (yyvsp[(1) - (1)].interm).intermNode, *fnCall, op, &type)) {
2408 (yyval.interm.intermTypedNode) = 0;
2409 } else {
2410 //
2411 // It's a constructor, of type 'type'.
2412 //
2413 (yyval.interm.intermTypedNode) = context->addConstructor((yyvsp[(1) - (1)].interm).intermNode, &type, op, fnCall, (yyvsp[(1) - (1)].interm).line);
2414 }
2415
2416 if ((yyval.interm.intermTypedNode) == 0) {
2417 context->recover();
2418 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator(0, op, (yyvsp[(1) - (1)].interm).line);
2419 }
2420 (yyval.interm.intermTypedNode)->setType(type);
2421 } else {
2422 //
2423 // Not a constructor. Find it in the symbol table.
2424 //
2425 const TFunction* fnCandidate;
2426 bool builtIn;
2427 fnCandidate = context->findFunction((yyvsp[(1) - (1)].interm).line, fnCall, &builtIn);
2428 if (fnCandidate) {
2429 //
2430 // A declared function.
2431 //
2432 if (builtIn && !fnCandidate->getExtension().empty() &&
2433 context->extensionErrorCheck((yyvsp[(1) - (1)].interm).line, fnCandidate->getExtension())) {
2434 context->recover();
2435 }
2436 op = fnCandidate->getBuiltInOp();
2437 if (builtIn && op != EOpNull) {
2438 //
2439 // A function call mapped to a built-in operation.
2440 //
2441 if (fnCandidate->getParamCount() == 1) {
2442 //
2443 // Treat it like a built-in unary operator.
2444 //
2445 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(op, (yyvsp[(1) - (1)].interm).intermNode, 0, context->symbolTable);
2446 if ((yyval.interm.intermTypedNode) == 0) {
2447 context->error((yyvsp[(1) - (1)].interm).intermNode->getLine(), " wrong operand type", "Internal Error",
2448 "built in unary operator function. Type: %s",
2449 static_cast<TIntermTyped*>((yyvsp[(1) - (1)].interm).intermNode)->getCompleteString().c_str());
2450 YYERROR;
2451 }
2452 } else {
2453 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, op, (yyvsp[(1) - (1)].interm).line);
2454 }
2455 } else {
2456 // This is a real function call
2457
2458 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, EOpFunctionCall, (yyvsp[(1) - (1)].interm).line);
2459 (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType());
2460
2461 // this is how we know whether the given function is a builtIn function or a user defined function
2462 // if builtIn == false, it's a userDefined -> could be an overloaded builtIn function also
2463 // if builtIn == true, it's definitely a builtIn function with EOpNull
2464 if (!builtIn)
2465 (yyval.interm.intermTypedNode)->getAsAggregate()->setUserDefined();
2466 (yyval.interm.intermTypedNode)->getAsAggregate()->setName(fnCandidate->getMangledName());
2467
2468 TQualifier qual;
2469 for (int i = 0; i < fnCandidate->getParamCount(); ++i) {
2470 qual = fnCandidate->getParam(i).type->getQualifier();
2471 if (qual == EvqOut || qual == EvqInOut) {
2472 if (context->lValueErrorCheck((yyval.interm.intermTypedNode)->getLine(), "assign", (yyval.interm.intermTypedNode)->getAsAggregate()->getSequence()[i]->getAsTyped())) {
2473 context->error((yyvsp[(1) - (1)].interm).intermNode->getLine(), "Constant value cannot be passed for 'out' or 'inout' parameters.", "Error", "");
2474 context->recover();
2475 }
2476 }
2477 }
2478 }
2479 (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType());
2480 } else {
2481 // error message was put out by PaFindFunction()
2482 // Put on a dummy node for error recovery
2483 ConstantUnion *unionArray = new ConstantUnion[1];
2484 unionArray->setFConst(0.0f);
2485 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].interm).line);
2486 context->recover();
2487 }
2488 }
2489 delete fnCall;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002490 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002491 break;
2492
2493 case 16:
2494
2495 {
2496 (yyval.interm) = (yyvsp[(1) - (1)].interm);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002497 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002498 break;
2499
2500 case 17:
2501
2502 {
2503 context->error((yyvsp[(3) - (3)].interm).line, "methods are not supported", "", "");
2504 context->recover();
2505 (yyval.interm) = (yyvsp[(3) - (3)].interm);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002506 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002507 break;
2508
2509 case 18:
2510
2511 {
2512 (yyval.interm) = (yyvsp[(1) - (2)].interm);
2513 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002514 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002515 break;
2516
2517 case 19:
2518
2519 {
2520 (yyval.interm) = (yyvsp[(1) - (2)].interm);
2521 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002522 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002523 break;
2524
2525 case 20:
2526
2527 {
2528 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
2529 (yyval.interm).intermNode = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002530 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002531 break;
2532
2533 case 21:
2534
2535 {
2536 (yyval.interm).function = (yyvsp[(1) - (1)].interm.function);
2537 (yyval.interm).intermNode = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002538 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002539 break;
2540
2541 case 22:
2542
2543 {
2544 TParameter param = { 0, new TType((yyvsp[(2) - (2)].interm.intermTypedNode)->getType()) };
2545 (yyvsp[(1) - (2)].interm.function)->addParameter(param);
2546 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
2547 (yyval.interm).intermNode = (yyvsp[(2) - (2)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002548 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002549 break;
2550
2551 case 23:
2552
2553 {
2554 TParameter param = { 0, new TType((yyvsp[(3) - (3)].interm.intermTypedNode)->getType()) };
2555 (yyvsp[(1) - (3)].interm).function->addParameter(param);
2556 (yyval.interm).function = (yyvsp[(1) - (3)].interm).function;
2557 (yyval.interm).intermNode = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermNode, (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002558 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002559 break;
2560
2561 case 24:
2562
2563 {
2564 (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002565 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002566 break;
2567
2568 case 25:
2569
2570 {
2571 //
2572 // Constructor
2573 //
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002574 TOperator op = EOpNull;
2575 if ((yyvsp[(1) - (1)].interm.type).userDef) {
2576 op = EOpConstructStruct;
2577 } else {
2578 switch ((yyvsp[(1) - (1)].interm.type).type) {
2579 case EbtFloat:
2580 if ((yyvsp[(1) - (1)].interm.type).matrix) {
2581 switch((yyvsp[(1) - (1)].interm.type).size) {
2582 case 2: op = EOpConstructMat2; break;
2583 case 3: op = EOpConstructMat3; break;
2584 case 4: op = EOpConstructMat4; break;
2585 }
2586 } else {
2587 switch((yyvsp[(1) - (1)].interm.type).size) {
2588 case 1: op = EOpConstructFloat; break;
2589 case 2: op = EOpConstructVec2; break;
2590 case 3: op = EOpConstructVec3; break;
2591 case 4: op = EOpConstructVec4; break;
2592 }
2593 }
2594 break;
2595 case EbtInt:
2596 switch((yyvsp[(1) - (1)].interm.type).size) {
2597 case 1: op = EOpConstructInt; break;
2598 case 2: FRAG_VERT_ONLY("ivec2", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec2; break;
2599 case 3: FRAG_VERT_ONLY("ivec3", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec3; break;
2600 case 4: FRAG_VERT_ONLY("ivec4", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec4; break;
2601 }
2602 break;
2603 case EbtBool:
2604 switch((yyvsp[(1) - (1)].interm.type).size) {
2605 case 1: op = EOpConstructBool; break;
2606 case 2: FRAG_VERT_ONLY("bvec2", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec2; break;
2607 case 3: FRAG_VERT_ONLY("bvec3", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec3; break;
2608 case 4: FRAG_VERT_ONLY("bvec4", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec4; break;
2609 }
2610 break;
2611 default: break;
2612 }
2613 if (op == EOpNull) {
2614 context->error((yyvsp[(1) - (1)].interm.type).line, "cannot construct this type", getBasicString((yyvsp[(1) - (1)].interm.type).type), "");
2615 context->recover();
2616 (yyvsp[(1) - (1)].interm.type).type = EbtFloat;
2617 op = EOpConstructFloat;
2618 }
2619 }
2620 TString tempString;
2621 TType type((yyvsp[(1) - (1)].interm.type));
2622 TFunction *function = new TFunction(&tempString, type, op);
2623 (yyval.interm.function) = function;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002624 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002625 break;
2626
2627 case 26:
2628
2629 {
2630 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
2631 context->recover();
2632 TType type(EbtVoid, EbpUndefined);
2633 TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type);
2634 (yyval.interm.function) = function;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002635 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002636 break;
2637
2638 case 27:
2639
2640 {
2641 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
2642 context->recover();
2643 TType type(EbtVoid, EbpUndefined);
2644 TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type);
2645 (yyval.interm.function) = function;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002646 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002647 break;
2648
2649 case 28:
2650
2651 {
2652 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002653 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002654 break;
2655
2656 case 29:
2657
2658 {
2659 if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)))
2660 context->recover();
2661 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreIncrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line, context->symbolTable);
2662 if ((yyval.interm.intermTypedNode) == 0) {
2663 context->unaryOpError((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2664 context->recover();
2665 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2666 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002667 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002668 break;
2669
2670 case 30:
2671
2672 {
2673 if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)))
2674 context->recover();
2675 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreDecrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line, context->symbolTable);
2676 if ((yyval.interm.intermTypedNode) == 0) {
2677 context->unaryOpError((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2678 context->recover();
2679 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2680 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002681 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002682 break;
2683
2684 case 31:
2685
2686 {
2687 if ((yyvsp[(1) - (2)].interm).op != EOpNull) {
2688 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath((yyvsp[(1) - (2)].interm).op, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].interm).line, context->symbolTable);
2689 if ((yyval.interm.intermTypedNode) == 0) {
2690 const char* errorOp = "";
2691 switch((yyvsp[(1) - (2)].interm).op) {
2692 case EOpNegative: errorOp = "-"; break;
2693 case EOpLogicalNot: errorOp = "!"; break;
2694 default: break;
2695 }
2696 context->unaryOpError((yyvsp[(1) - (2)].interm).line, errorOp, (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2697 context->recover();
2698 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2699 }
2700 } else
2701 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002702 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002703 break;
2704
2705 case 32:
2706
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002707 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNull; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002708 break;
2709
2710 case 33:
2711
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002712 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNegative; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002713 break;
2714
2715 case 34:
2716
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002717 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpLogicalNot; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002718 break;
2719
2720 case 35:
2721
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002722 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002723 break;
2724
2725 case 36:
2726
2727 {
2728 FRAG_VERT_ONLY("*", (yyvsp[(2) - (3)].lex).line);
2729 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpMul, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2730 if ((yyval.interm.intermTypedNode) == 0) {
2731 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "*", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2732 context->recover();
2733 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2734 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002735 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002736 break;
2737
2738 case 37:
2739
2740 {
2741 FRAG_VERT_ONLY("/", (yyvsp[(2) - (3)].lex).line);
2742 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpDiv, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2743 if ((yyval.interm.intermTypedNode) == 0) {
2744 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "/", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2745 context->recover();
2746 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2747 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002748 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002749 break;
2750
2751 case 38:
2752
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002753 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002754 break;
2755
2756 case 39:
2757
2758 {
2759 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpAdd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2760 if ((yyval.interm.intermTypedNode) == 0) {
2761 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "+", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2762 context->recover();
2763 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2764 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002765 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002766 break;
2767
2768 case 40:
2769
2770 {
2771 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpSub, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2772 if ((yyval.interm.intermTypedNode) == 0) {
2773 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "-", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2774 context->recover();
2775 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2776 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002777 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002778 break;
2779
2780 case 41:
2781
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002782 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002783 break;
2784
2785 case 42:
2786
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002787 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002788 break;
2789
2790 case 43:
2791
2792 {
2793 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2794 if ((yyval.interm.intermTypedNode) == 0) {
2795 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2796 context->recover();
2797 ConstantUnion *unionArray = new ConstantUnion[1];
2798 unionArray->setBConst(false);
2799 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2800 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002801 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002802 break;
2803
2804 case 44:
2805
2806 {
2807 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2808 if ((yyval.interm.intermTypedNode) == 0) {
2809 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2810 context->recover();
2811 ConstantUnion *unionArray = new ConstantUnion[1];
2812 unionArray->setBConst(false);
2813 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2814 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002815 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002816 break;
2817
2818 case 45:
2819
2820 {
2821 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2822 if ((yyval.interm.intermTypedNode) == 0) {
2823 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2824 context->recover();
2825 ConstantUnion *unionArray = new ConstantUnion[1];
2826 unionArray->setBConst(false);
2827 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2828 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002829 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002830 break;
2831
2832 case 46:
2833
2834 {
2835 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2836 if ((yyval.interm.intermTypedNode) == 0) {
2837 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2838 context->recover();
2839 ConstantUnion *unionArray = new ConstantUnion[1];
2840 unionArray->setBConst(false);
2841 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2842 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002843 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002844 break;
2845
2846 case 47:
2847
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002848 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002849 break;
2850
2851 case 48:
2852
2853 {
2854 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2855 if ((yyval.interm.intermTypedNode) == 0) {
2856 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "==", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2857 context->recover();
2858 ConstantUnion *unionArray = new ConstantUnion[1];
2859 unionArray->setBConst(false);
2860 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2861 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002862 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002863 break;
2864
2865 case 49:
2866
2867 {
2868 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpNotEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2869 if ((yyval.interm.intermTypedNode) == 0) {
2870 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "!=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2871 context->recover();
2872 ConstantUnion *unionArray = new ConstantUnion[1];
2873 unionArray->setBConst(false);
2874 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2875 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002876 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002877 break;
2878
2879 case 50:
2880
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002881 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002882 break;
2883
2884 case 51:
2885
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002886 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002887 break;
2888
2889 case 52:
2890
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002891 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002892 break;
2893
2894 case 53:
2895
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002896 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002897 break;
2898
2899 case 54:
2900
2901 {
2902 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalAnd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2903 if ((yyval.interm.intermTypedNode) == 0) {
2904 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "&&", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2905 context->recover();
2906 ConstantUnion *unionArray = new ConstantUnion[1];
2907 unionArray->setBConst(false);
2908 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2909 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002910 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002911 break;
2912
2913 case 55:
2914
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002915 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002916 break;
2917
2918 case 56:
2919
2920 {
2921 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalXor, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2922 if ((yyval.interm.intermTypedNode) == 0) {
2923 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "^^", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2924 context->recover();
2925 ConstantUnion *unionArray = new ConstantUnion[1];
2926 unionArray->setBConst(false);
2927 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2928 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002929 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002930 break;
2931
2932 case 57:
2933
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002934 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002935 break;
2936
2937 case 58:
2938
2939 {
2940 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalOr, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2941 if ((yyval.interm.intermTypedNode) == 0) {
2942 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "||", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2943 context->recover();
2944 ConstantUnion *unionArray = new ConstantUnion[1];
2945 unionArray->setBConst(false);
2946 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2947 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002948 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002949 break;
2950
2951 case 59:
2952
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002953 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002954 break;
2955
2956 case 60:
2957
2958 {
2959 if (context->boolErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.intermTypedNode)))
2960 context->recover();
2961
2962 (yyval.interm.intermTypedNode) = context->intermediate.addSelection((yyvsp[(1) - (5)].interm.intermTypedNode), (yyvsp[(3) - (5)].interm.intermTypedNode), (yyvsp[(5) - (5)].interm.intermTypedNode), (yyvsp[(2) - (5)].lex).line);
2963 if ((yyvsp[(3) - (5)].interm.intermTypedNode)->getType() != (yyvsp[(5) - (5)].interm.intermTypedNode)->getType())
2964 (yyval.interm.intermTypedNode) = 0;
2965
2966 if ((yyval.interm.intermTypedNode) == 0) {
2967 context->binaryOpError((yyvsp[(2) - (5)].lex).line, ":", (yyvsp[(3) - (5)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(5) - (5)].interm.intermTypedNode)->getCompleteString());
2968 context->recover();
2969 (yyval.interm.intermTypedNode) = (yyvsp[(5) - (5)].interm.intermTypedNode);
2970 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002971 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002972 break;
2973
2974 case 61:
2975
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002976 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002977 break;
2978
2979 case 62:
2980
2981 {
2982 if (context->lValueErrorCheck((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)))
2983 context->recover();
2984 (yyval.interm.intermTypedNode) = context->intermediate.addAssign((yyvsp[(2) - (3)].interm).op, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].interm).line);
2985 if ((yyval.interm.intermTypedNode) == 0) {
2986 context->assignError((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2987 context->recover();
2988 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2989 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002990 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002991 break;
2992
2993 case 63:
2994
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002995 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAssign; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002996 break;
2997
2998 case 64:
2999
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003000 { FRAG_VERT_ONLY("*=", (yyvsp[(1) - (1)].lex).line); (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpMulAssign; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003001 break;
3002
3003 case 65:
3004
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003005 { FRAG_VERT_ONLY("/=", (yyvsp[(1) - (1)].lex).line); (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpDivAssign; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003006 break;
3007
3008 case 66:
3009
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003010 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAddAssign; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003011 break;
3012
3013 case 67:
3014
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003015 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpSubAssign; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003016 break;
3017
3018 case 68:
3019
3020 {
3021 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003022 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003023 break;
3024
3025 case 69:
3026
3027 {
3028 (yyval.interm.intermTypedNode) = context->intermediate.addComma((yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
3029 if ((yyval.interm.intermTypedNode) == 0) {
3030 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ",", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3031 context->recover();
3032 (yyval.interm.intermTypedNode) = (yyvsp[(3) - (3)].interm.intermTypedNode);
3033 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003034 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003035 break;
3036
3037 case 70:
3038
3039 {
3040 if (context->constErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)))
3041 context->recover();
3042 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003043 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003044 break;
3045
3046 case 71:
3047
3048 {
3049 TFunction &function = *((yyvsp[(1) - (2)].interm).function);
3050
3051 TIntermAggregate *prototype = new TIntermAggregate;
3052 prototype->setType(function.getReturnType());
3053 prototype->setName(function.getName());
3054
3055 for (int i = 0; i < function.getParamCount(); i++)
3056 {
3057 const TParameter &param = function.getParam(i);
3058 if (param.name != 0)
3059 {
3060 TVariable *variable = new TVariable(param.name, *param.type);
3061
3062 prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(variable->getUniqueId(), variable->getName(), variable->getType(), (yyvsp[(1) - (2)].interm).line), (yyvsp[(1) - (2)].interm).line);
3063 }
3064 else
3065 {
3066 prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (2)].interm).line), (yyvsp[(1) - (2)].interm).line);
3067 }
3068 }
3069
3070 prototype->setOp(EOpPrototype);
3071 (yyval.interm.intermNode) = prototype;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003072 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003073 break;
3074
3075 case 72:
3076
3077 {
3078 if ((yyvsp[(1) - (2)].interm).intermAggregate)
3079 (yyvsp[(1) - (2)].interm).intermAggregate->setOp(EOpDeclaration);
3080 (yyval.interm.intermNode) = (yyvsp[(1) - (2)].interm).intermAggregate;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003081 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003082 break;
3083
3084 case 73:
3085
3086 {
3087 context->symbolTable.setDefaultPrecision( (yyvsp[(3) - (4)].interm.type).type, (yyvsp[(2) - (4)].interm.precision) );
3088 (yyval.interm.intermNode) = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003089 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003090 break;
3091
3092 case 74:
3093
3094 {
3095 //
3096 // Multiple declarations of the same function are allowed.
3097 //
3098 // If this is a definition, the definition production code will check for redefinitions
3099 // (we don't know at this point if it's a definition or not).
3100 //
3101 // Redeclarations are allowed. But, return types and parameter qualifiers must match.
3102 //
3103 TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find((yyvsp[(1) - (2)].interm.function)->getMangledName()));
3104 if (prevDec) {
3105 if (prevDec->getReturnType() != (yyvsp[(1) - (2)].interm.function)->getReturnType()) {
3106 context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same return type", (yyvsp[(1) - (2)].interm.function)->getReturnType().getBasicString(), "");
3107 context->recover();
3108 }
3109 for (int i = 0; i < prevDec->getParamCount(); ++i) {
3110 if (prevDec->getParam(i).type->getQualifier() != (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifier()) {
3111 context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same parameter qualifiers", (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifierString(), "");
3112 context->recover();
3113 }
3114 }
3115 }
3116
3117 //
3118 // If this is a redeclaration, it could also be a definition,
3119 // in which case, we want to use the variable names from this one, and not the one that's
3120 // being redeclared. So, pass back up this declaration, not the one in the symbol table.
3121 //
3122 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
3123 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
3124
3125 context->symbolTable.insert(*(yyval.interm).function);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003126 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003127 break;
3128
3129 case 75:
3130
3131 {
3132 (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003133 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003134 break;
3135
3136 case 76:
3137
3138 {
3139 (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003140 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003141 break;
3142
3143 case 77:
3144
3145 {
3146 // Add the parameter
3147 (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
3148 if ((yyvsp[(2) - (2)].interm).param.type->getBasicType() != EbtVoid)
3149 (yyvsp[(1) - (2)].interm.function)->addParameter((yyvsp[(2) - (2)].interm).param);
3150 else
3151 delete (yyvsp[(2) - (2)].interm).param.type;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003152 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003153 break;
3154
3155 case 78:
3156
3157 {
3158 //
3159 // Only first parameter of one-parameter functions can be void
3160 // The check for named parameters not being void is done in parameter_declarator
3161 //
3162 if ((yyvsp[(3) - (3)].interm).param.type->getBasicType() == EbtVoid) {
3163 //
3164 // This parameter > first is void
3165 //
3166 context->error((yyvsp[(2) - (3)].lex).line, "cannot be an argument type except for '(void)'", "void", "");
3167 context->recover();
3168 delete (yyvsp[(3) - (3)].interm).param.type;
3169 } else {
3170 // Add the parameter
3171 (yyval.interm.function) = (yyvsp[(1) - (3)].interm.function);
3172 (yyvsp[(1) - (3)].interm.function)->addParameter((yyvsp[(3) - (3)].interm).param);
3173 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003174 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003175 break;
3176
3177 case 79:
3178
3179 {
3180 if ((yyvsp[(1) - (3)].interm.type).qualifier != EvqGlobal && (yyvsp[(1) - (3)].interm.type).qualifier != EvqTemporary) {
3181 context->error((yyvsp[(2) - (3)].lex).line, "no qualifiers allowed for function return", getQualifierString((yyvsp[(1) - (3)].interm.type).qualifier), "");
3182 context->recover();
3183 }
3184 // make sure a sampler is not involved as well...
3185 if (context->structQualifierErrorCheck((yyvsp[(2) - (3)].lex).line, (yyvsp[(1) - (3)].interm.type)))
3186 context->recover();
3187
3188 // Add the function as a prototype after parsing it (we do not support recursion)
3189 TFunction *function;
3190 TType type((yyvsp[(1) - (3)].interm.type));
3191 function = new TFunction((yyvsp[(2) - (3)].lex).string, type);
3192 (yyval.interm.function) = function;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003193 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003194 break;
3195
3196 case 80:
3197
3198 {
3199 if ((yyvsp[(1) - (2)].interm.type).type == EbtVoid) {
3200 context->error((yyvsp[(2) - (2)].lex).line, "illegal use of type 'void'", (yyvsp[(2) - (2)].lex).string->c_str(), "");
3201 context->recover();
3202 }
3203 if (context->reservedErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string))
3204 context->recover();
3205 TParameter param = {(yyvsp[(2) - (2)].lex).string, new TType((yyvsp[(1) - (2)].interm.type))};
3206 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
3207 (yyval.interm).param = param;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003208 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003209 break;
3210
3211 case 81:
3212
3213 {
3214 // Check that we can make an array out of this type
3215 if (context->arrayTypeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
3216 context->recover();
3217
3218 if (context->reservedErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string))
3219 context->recover();
3220
3221 int size;
3222 if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3223 context->recover();
3224 (yyvsp[(1) - (5)].interm.type).setArray(true, size);
3225
3226 TType* type = new TType((yyvsp[(1) - (5)].interm.type));
3227 TParameter param = { (yyvsp[(2) - (5)].lex).string, type };
3228 (yyval.interm).line = (yyvsp[(2) - (5)].lex).line;
3229 (yyval.interm).param = param;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003230 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003231 break;
3232
3233 case 82:
3234
3235 {
3236 (yyval.interm) = (yyvsp[(3) - (3)].interm);
3237 if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
3238 context->recover();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003239 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003240 break;
3241
3242 case 83:
3243
3244 {
3245 (yyval.interm) = (yyvsp[(2) - (2)].interm);
3246 if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
3247 context->recover();
3248 if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
3249 context->recover();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003250 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003251 break;
3252
3253 case 84:
3254
3255 {
3256 (yyval.interm) = (yyvsp[(3) - (3)].interm);
3257 if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
3258 context->recover();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003259 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003260 break;
3261
3262 case 85:
3263
3264 {
3265 (yyval.interm) = (yyvsp[(2) - (2)].interm);
3266 if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
3267 context->recover();
3268 if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
3269 context->recover();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003270 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003271 break;
3272
3273 case 86:
3274
3275 {
3276 (yyval.interm.qualifier) = EvqIn;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003277 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003278 break;
3279
3280 case 87:
3281
3282 {
3283 (yyval.interm.qualifier) = EvqIn;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003284 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003285 break;
3286
3287 case 88:
3288
3289 {
3290 (yyval.interm.qualifier) = EvqOut;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003291 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003292 break;
3293
3294 case 89:
3295
3296 {
3297 (yyval.interm.qualifier) = EvqInOut;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003298 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003299 break;
3300
3301 case 90:
3302
3303 {
3304 TParameter param = { 0, new TType((yyvsp[(1) - (1)].interm.type)) };
3305 (yyval.interm).param = param;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003306 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003307 break;
3308
3309 case 91:
3310
3311 {
3312 (yyval.interm) = (yyvsp[(1) - (1)].interm);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003313 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003314 break;
3315
3316 case 92:
3317
3318 {
zmo@google.comfd747b82011-04-23 01:30:07 +00003319 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(3) - (3)].lex).string, TType((yyvsp[(1) - (3)].interm).type), (yyvsp[(3) - (3)].lex).line);
3320 (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 +00003321
3322 if (context->structQualifierErrorCheck((yyvsp[(3) - (3)].lex).line, (yyval.interm).type))
3323 context->recover();
3324
3325 if (context->nonInitConstErrorCheck((yyvsp[(3) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyval.interm).type))
3326 context->recover();
3327
zmo@google.comfd747b82011-04-23 01:30:07 +00003328 TVariable* variable = 0;
3329 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 +00003330 context->recover();
zmo@google.comfd747b82011-04-23 01:30:07 +00003331 if (symbol && variable)
3332 symbol->setId(variable->getUniqueId());
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003333 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003334 break;
3335
3336 case 93:
3337
3338 {
3339 if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
3340 context->recover();
3341
3342 if (context->nonInitConstErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type))
3343 context->recover();
3344
3345 (yyval.interm) = (yyvsp[(1) - (5)].interm);
3346
3347 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))
3348 context->recover();
3349 else {
3350 (yyvsp[(1) - (5)].interm).type.setArray(true);
3351 TVariable* variable;
3352 if (context->arrayErrorCheck((yyvsp[(4) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, variable))
3353 context->recover();
3354 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003355 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003356 break;
3357
3358 case 94:
3359
3360 {
3361 if (context->structQualifierErrorCheck((yyvsp[(3) - (6)].lex).line, (yyvsp[(1) - (6)].interm).type))
3362 context->recover();
3363
3364 if (context->nonInitConstErrorCheck((yyvsp[(3) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type))
3365 context->recover();
3366
3367 (yyval.interm) = (yyvsp[(1) - (6)].interm);
3368
3369 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))
3370 context->recover();
3371 else {
3372 int size;
3373 if (context->arraySizeErrorCheck((yyvsp[(4) - (6)].lex).line, (yyvsp[(5) - (6)].interm.intermTypedNode), size))
3374 context->recover();
3375 (yyvsp[(1) - (6)].interm).type.setArray(true, size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003376 TVariable* variable = 0;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003377 if (context->arrayErrorCheck((yyvsp[(4) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type, variable))
3378 context->recover();
3379 TType type = TType((yyvsp[(1) - (6)].interm).type);
3380 type.setArraySize(size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003381 (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 +00003382 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003383 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003384 break;
3385
3386 case 95:
3387
3388 {
3389 if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
3390 context->recover();
3391
3392 (yyval.interm) = (yyvsp[(1) - (5)].interm);
3393
3394 TIntermNode* intermNode;
3395 if (!context->executeInitializer((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, (yyvsp[(5) - (5)].interm.intermTypedNode), intermNode)) {
3396 //
3397 // build the intermediate representation
3398 //
3399 if (intermNode)
3400 (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (5)].interm).intermNode, intermNode, (yyvsp[(4) - (5)].lex).line);
3401 else
3402 (yyval.interm).intermAggregate = (yyvsp[(1) - (5)].interm).intermAggregate;
3403 } else {
3404 context->recover();
3405 (yyval.interm).intermAggregate = 0;
3406 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003407 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003408 break;
3409
3410 case 96:
3411
3412 {
3413 (yyval.interm).type = (yyvsp[(1) - (1)].interm.type);
3414 (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 +00003415 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003416 break;
3417
3418 case 97:
3419
3420 {
zmo@google.comfd747b82011-04-23 01:30:07 +00003421 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyvsp[(1) - (2)].interm.type)), (yyvsp[(2) - (2)].lex).line);
3422 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (2)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003423
3424 if (context->structQualifierErrorCheck((yyvsp[(2) - (2)].lex).line, (yyval.interm).type))
3425 context->recover();
3426
3427 if (context->nonInitConstErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string, (yyval.interm).type))
3428 context->recover();
3429
3430 (yyval.interm).type = (yyvsp[(1) - (2)].interm.type);
3431
zmo@google.comfd747b82011-04-23 01:30:07 +00003432 TVariable* variable = 0;
3433 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 +00003434 context->recover();
zmo@google.comfd747b82011-04-23 01:30:07 +00003435 if (variable && symbol)
3436 symbol->setId(variable->getUniqueId());
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003437 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003438 break;
3439
3440 case 98:
3441
3442 {
kbr@chromium.org04277b82011-06-02 18:41:26 +00003443 context->error((yyvsp[(2) - (4)].lex).line, "unsized array declarations not supported", (yyvsp[(2) - (4)].lex).string->c_str(), "");
3444 context->recover();
3445
zmo@google.comfd747b82011-04-23 01:30:07 +00003446 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (4)].lex).string, TType((yyvsp[(1) - (4)].interm.type)), (yyvsp[(2) - (4)].lex).line);
3447 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (4)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003448 (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003449 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003450 break;
3451
3452 case 99:
3453
3454 {
3455 TType type = TType((yyvsp[(1) - (5)].interm.type));
3456 int size;
3457 if (context->arraySizeErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3458 context->recover();
3459 type.setArraySize(size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003460 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (5)].lex).string, type, (yyvsp[(2) - (5)].lex).line);
3461 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (5)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003462
3463 if (context->structQualifierErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
3464 context->recover();
3465
3466 if (context->nonInitConstErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type)))
3467 context->recover();
3468
3469 (yyval.interm).type = (yyvsp[(1) - (5)].interm.type);
3470
3471 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)))
3472 context->recover();
3473 else {
3474 int size;
3475 if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3476 context->recover();
3477
3478 (yyvsp[(1) - (5)].interm.type).setArray(true, size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003479 TVariable* variable = 0;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003480 if (context->arrayErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type), variable))
3481 context->recover();
zmo@google.comfd747b82011-04-23 01:30:07 +00003482 if (variable && symbol)
3483 symbol->setId(variable->getUniqueId());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003484 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003485 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003486 break;
3487
3488 case 100:
3489
3490 {
3491 if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
3492 context->recover();
3493
3494 (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
3495
3496 TIntermNode* intermNode;
3497 if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode)) {
3498 //
3499 // Build intermediate representation
3500 //
3501 if(intermNode)
3502 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(intermNode, (yyvsp[(3) - (4)].lex).line);
3503 else
3504 (yyval.interm).intermAggregate = 0;
3505 } else {
3506 context->recover();
3507 (yyval.interm).intermAggregate = 0;
3508 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003509 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003510 break;
3511
3512 case 101:
3513
3514 {
3515 VERTEX_ONLY("invariant declaration", (yyvsp[(1) - (2)].lex).line);
3516 (yyval.interm).qualifier = EvqInvariantVaryingOut;
3517 (yyval.interm).intermAggregate = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003518 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003519 break;
3520
3521 case 102:
3522
3523 {
3524 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3525
3526 if ((yyvsp[(1) - (1)].interm.type).array) {
3527 context->error((yyvsp[(1) - (1)].interm.type).line, "not supported", "first-class array", "");
3528 context->recover();
3529 (yyvsp[(1) - (1)].interm.type).setArray(false);
3530 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003531 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003532 break;
3533
3534 case 103:
3535
3536 {
3537 if ((yyvsp[(2) - (2)].interm.type).array) {
3538 context->error((yyvsp[(2) - (2)].interm.type).line, "not supported", "first-class array", "");
3539 context->recover();
3540 (yyvsp[(2) - (2)].interm.type).setArray(false);
3541 }
3542
3543 if ((yyvsp[(1) - (2)].interm.type).qualifier == EvqAttribute &&
3544 ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
3545 context->error((yyvsp[(2) - (2)].interm.type).line, "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier), "");
3546 context->recover();
3547 }
3548 if (((yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingIn || (yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingOut) &&
3549 ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
3550 context->error((yyvsp[(2) - (2)].interm.type).line, "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier), "");
3551 context->recover();
3552 }
3553 (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
3554 (yyval.interm.type).qualifier = (yyvsp[(1) - (2)].interm.type).qualifier;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003555 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003556 break;
3557
3558 case 104:
3559
3560 {
3561 (yyval.interm.type).setBasic(EbtVoid, EvqConst, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003562 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003563 break;
3564
3565 case 105:
3566
3567 {
3568 VERTEX_ONLY("attribute", (yyvsp[(1) - (1)].lex).line);
3569 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "attribute"))
3570 context->recover();
3571 (yyval.interm.type).setBasic(EbtVoid, EvqAttribute, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003572 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003573 break;
3574
3575 case 106:
3576
3577 {
3578 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "varying"))
3579 context->recover();
3580 if (context->shaderType == SH_VERTEX_SHADER)
3581 (yyval.interm.type).setBasic(EbtVoid, EvqVaryingOut, (yyvsp[(1) - (1)].lex).line);
3582 else
3583 (yyval.interm.type).setBasic(EbtVoid, EvqVaryingIn, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003584 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003585 break;
3586
3587 case 107:
3588
3589 {
3590 if (context->globalErrorCheck((yyvsp[(1) - (2)].lex).line, context->symbolTable.atGlobalLevel(), "invariant varying"))
3591 context->recover();
3592 if (context->shaderType == SH_VERTEX_SHADER)
3593 (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingOut, (yyvsp[(1) - (2)].lex).line);
3594 else
3595 (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingIn, (yyvsp[(1) - (2)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003596 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003597 break;
3598
3599 case 108:
3600
3601 {
3602 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "uniform"))
3603 context->recover();
3604 (yyval.interm.type).setBasic(EbtVoid, EvqUniform, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003605 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003606 break;
3607
3608 case 109:
3609
3610 {
3611 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
zmo@google.comdc4b4f82011-06-17 00:42:53 +00003612
3613 if ((yyval.interm.type).precision == EbpUndefined) {
3614 (yyval.interm.type).precision = context->symbolTable.getDefaultPrecision((yyvsp[(1) - (1)].interm.type).type);
3615 if (context->precisionErrorCheck((yyvsp[(1) - (1)].interm.type).line, (yyval.interm.type).precision, (yyvsp[(1) - (1)].interm.type).type)) {
3616 context->recover();
3617 }
3618 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003619 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003620 break;
3621
3622 case 110:
3623
3624 {
3625 (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
3626 (yyval.interm.type).precision = (yyvsp[(1) - (2)].interm.precision);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003627 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003628 break;
3629
3630 case 111:
3631
3632 {
3633 (yyval.interm.precision) = EbpHigh;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003634 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003635 break;
3636
3637 case 112:
3638
3639 {
3640 (yyval.interm.precision) = EbpMedium;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003641 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003642 break;
3643
3644 case 113:
3645
3646 {
3647 (yyval.interm.precision) = EbpLow;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003648 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003649 break;
3650
3651 case 114:
3652
3653 {
3654 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003655 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003656 break;
3657
3658 case 115:
3659
3660 {
3661 (yyval.interm.type) = (yyvsp[(1) - (4)].interm.type);
3662
3663 if (context->arrayTypeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
3664 context->recover();
3665 else {
3666 int size;
3667 if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
3668 context->recover();
3669 (yyval.interm.type).setArray(true, size);
3670 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003671 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003672 break;
3673
3674 case 116:
3675
3676 {
3677 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3678 (yyval.interm.type).setBasic(EbtVoid, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003679 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003680 break;
3681
3682 case 117:
3683
3684 {
3685 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3686 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003687 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003688 break;
3689
3690 case 118:
3691
3692 {
3693 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3694 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003695 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003696 break;
3697
3698 case 119:
3699
3700 {
3701 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3702 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003703 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003704 break;
3705
3706 case 120:
3707
3708 {
3709 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3710 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3711 (yyval.interm.type).setAggregate(2);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003712 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003713 break;
3714
3715 case 121:
3716
3717 {
3718 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3719 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3720 (yyval.interm.type).setAggregate(3);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003721 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003722 break;
3723
3724 case 122:
3725
3726 {
3727 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3728 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3729 (yyval.interm.type).setAggregate(4);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003730 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003731 break;
3732
3733 case 123:
3734
3735 {
3736 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3737 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3738 (yyval.interm.type).setAggregate(2);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003739 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003740 break;
3741
3742 case 124:
3743
3744 {
3745 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3746 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3747 (yyval.interm.type).setAggregate(3);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003748 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003749 break;
3750
3751 case 125:
3752
3753 {
3754 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3755 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3756 (yyval.interm.type).setAggregate(4);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003757 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003758 break;
3759
3760 case 126:
3761
3762 {
3763 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3764 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3765 (yyval.interm.type).setAggregate(2);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003766 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003767 break;
3768
3769 case 127:
3770
3771 {
3772 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3773 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3774 (yyval.interm.type).setAggregate(3);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003775 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003776 break;
3777
3778 case 128:
3779
3780 {
3781 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3782 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3783 (yyval.interm.type).setAggregate(4);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003784 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003785 break;
3786
3787 case 129:
3788
3789 {
3790 FRAG_VERT_ONLY("mat2", (yyvsp[(1) - (1)].lex).line);
3791 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3792 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3793 (yyval.interm.type).setAggregate(2, true);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003794 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003795 break;
3796
3797 case 130:
3798
3799 {
3800 FRAG_VERT_ONLY("mat3", (yyvsp[(1) - (1)].lex).line);
3801 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3802 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3803 (yyval.interm.type).setAggregate(3, true);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003804 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003805 break;
3806
3807 case 131:
3808
3809 {
3810 FRAG_VERT_ONLY("mat4", (yyvsp[(1) - (1)].lex).line);
3811 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3812 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3813 (yyval.interm.type).setAggregate(4, true);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003814 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003815 break;
3816
3817 case 132:
3818
3819 {
3820 FRAG_VERT_ONLY("sampler2D", (yyvsp[(1) - (1)].lex).line);
3821 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3822 (yyval.interm.type).setBasic(EbtSampler2D, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003823 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003824 break;
3825
3826 case 133:
3827
3828 {
3829 FRAG_VERT_ONLY("samplerCube", (yyvsp[(1) - (1)].lex).line);
3830 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3831 (yyval.interm.type).setBasic(EbtSamplerCube, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003832 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003833 break;
3834
3835 case 134:
3836
3837 {
zmo@google.com09c323a2011-08-12 18:22:25 +00003838 if (!context->supportsExtension("GL_OES_EGL_image_external")) {
3839 context->error((yyvsp[(1) - (1)].lex).line, "unsupported type", "samplerExternalOES", "");
3840 context->recover();
3841 }
3842 FRAG_VERT_ONLY("samplerExternalOES", (yyvsp[(1) - (1)].lex).line);
3843 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3844 (yyval.interm.type).setBasic(EbtSamplerExternalOES, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003845 }
zmo@google.com09c323a2011-08-12 18:22:25 +00003846 break;
3847
3848 case 135:
3849
3850 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00003851 if (!context->supportsExtension("GL_ARB_texture_rectangle")) {
3852 context->error((yyvsp[(1) - (1)].lex).line, "unsupported type", "sampler2DRect", "");
3853 context->recover();
3854 }
3855 FRAG_VERT_ONLY("sampler2DRect", (yyvsp[(1) - (1)].lex).line);
3856 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3857 (yyval.interm.type).setBasic(EbtSampler2DRect, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003858 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003859 break;
3860
zmo@google.com09c323a2011-08-12 18:22:25 +00003861 case 136:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003862
3863 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00003864 FRAG_VERT_ONLY("struct", (yyvsp[(1) - (1)].interm.type).line);
3865 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3866 (yyval.interm.type).qualifier = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003867 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003868 break;
3869
3870 case 137:
3871
3872 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003873 //
3874 // This is for user defined type names. The lexical phase looked up the
3875 // type.
3876 //
3877 TType& structure = static_cast<TVariable*>((yyvsp[(1) - (1)].lex).symbol)->getType();
3878 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3879 (yyval.interm.type).setBasic(EbtStruct, qual, (yyvsp[(1) - (1)].lex).line);
3880 (yyval.interm.type).userDef = &structure;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003881 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003882 break;
3883
zmo@google.com09c323a2011-08-12 18:22:25 +00003884 case 138:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003885
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003886 { if (context->enterStructDeclaration((yyvsp[(2) - (3)].lex).line, *(yyvsp[(2) - (3)].lex).string)) context->recover(); }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003887 break;
3888
3889 case 139:
3890
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003891 {
kbr@chromium.org476541f2011-10-27 21:14:51 +00003892 if (context->reservedErrorCheck((yyvsp[(2) - (6)].lex).line, *(yyvsp[(2) - (6)].lex).string))
3893 context->recover();
3894
3895 TType* structure = new TType((yyvsp[(5) - (6)].interm.typeList), *(yyvsp[(2) - (6)].lex).string);
3896 TVariable* userTypeDef = new TVariable((yyvsp[(2) - (6)].lex).string, *structure, true);
3897 if (! context->symbolTable.insert(*userTypeDef)) {
3898 context->error((yyvsp[(2) - (6)].lex).line, "redefinition", (yyvsp[(2) - (6)].lex).string->c_str(), "struct");
3899 context->recover();
3900 }
3901 (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (6)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003902 (yyval.interm.type).userDef = structure;
kbr@chromium.org476541f2011-10-27 21:14:51 +00003903 context->exitStructDeclaration();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003904 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00003905 break;
3906
3907 case 140:
3908
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003909 { if (context->enterStructDeclaration((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string)) context->recover(); }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003910 break;
3911
3912 case 141:
3913
kbr@chromium.org476541f2011-10-27 21:14:51 +00003914 {
3915 TType* structure = new TType((yyvsp[(4) - (5)].interm.typeList), TString(""));
3916 (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (5)].lex).line);
3917 (yyval.interm.type).userDef = structure;
3918 context->exitStructDeclaration();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003919 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003920 break;
3921
kbr@chromium.org476541f2011-10-27 21:14:51 +00003922 case 142:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003923
3924 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00003925 (yyval.interm.typeList) = (yyvsp[(1) - (1)].interm.typeList);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003926 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003927 break;
3928
3929 case 143:
3930
3931 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003932 (yyval.interm.typeList) = (yyvsp[(1) - (2)].interm.typeList);
3933 for (unsigned int i = 0; i < (yyvsp[(2) - (2)].interm.typeList)->size(); ++i) {
3934 for (unsigned int j = 0; j < (yyval.interm.typeList)->size(); ++j) {
3935 if ((*(yyval.interm.typeList))[j].type->getFieldName() == (*(yyvsp[(2) - (2)].interm.typeList))[i].type->getFieldName()) {
3936 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());
3937 context->recover();
3938 }
3939 }
3940 (yyval.interm.typeList)->push_back((*(yyvsp[(2) - (2)].interm.typeList))[i]);
3941 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003942 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003943 break;
3944
kbr@chromium.org205fef32011-11-22 20:50:02 +00003945 case 144:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003946
3947 {
3948 (yyval.interm.typeList) = (yyvsp[(2) - (3)].interm.typeList);
3949
3950 if (context->voidErrorCheck((yyvsp[(1) - (3)].interm.type).line, (*(yyvsp[(2) - (3)].interm.typeList))[0].type->getFieldName(), (yyvsp[(1) - (3)].interm.type))) {
3951 context->recover();
3952 }
3953 for (unsigned int i = 0; i < (yyval.interm.typeList)->size(); ++i) {
3954 //
3955 // Careful not to replace already known aspects of type, like array-ness
3956 //
3957 TType* type = (*(yyval.interm.typeList))[i].type;
3958 type->setBasicType((yyvsp[(1) - (3)].interm.type).type);
3959 type->setNominalSize((yyvsp[(1) - (3)].interm.type).size);
3960 type->setMatrix((yyvsp[(1) - (3)].interm.type).matrix);
zmo@google.comdc4b4f82011-06-17 00:42:53 +00003961 type->setPrecision((yyvsp[(1) - (3)].interm.type).precision);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003962
3963 // don't allow arrays of arrays
3964 if (type->isArray()) {
3965 if (context->arrayTypeErrorCheck((yyvsp[(1) - (3)].interm.type).line, (yyvsp[(1) - (3)].interm.type)))
3966 context->recover();
3967 }
3968 if ((yyvsp[(1) - (3)].interm.type).array)
3969 type->setArraySize((yyvsp[(1) - (3)].interm.type).arraySize);
3970 if ((yyvsp[(1) - (3)].interm.type).userDef) {
3971 type->setStruct((yyvsp[(1) - (3)].interm.type).userDef->getStruct());
3972 type->setTypeName((yyvsp[(1) - (3)].interm.type).userDef->getTypeName());
3973 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00003974
3975 if (context->structNestingErrorCheck((yyvsp[(1) - (3)].interm.type).line, *type)) {
3976 context->recover();
3977 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003978 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003979 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003980 break;
3981
kbr@chromium.org476541f2011-10-27 21:14:51 +00003982 case 145:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003983
3984 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00003985 (yyval.interm.typeList) = NewPoolTTypeList();
3986 (yyval.interm.typeList)->push_back((yyvsp[(1) - (1)].interm.typeLine));
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003987 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003988 break;
3989
kbr@chromium.org476541f2011-10-27 21:14:51 +00003990 case 146:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003991
3992 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00003993 (yyval.interm.typeList)->push_back((yyvsp[(3) - (3)].interm.typeLine));
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003994 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003995 break;
3996
3997 case 147:
3998
3999 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004000 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
4001 context->recover();
4002
4003 (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
4004 (yyval.interm.typeLine).line = (yyvsp[(1) - (1)].lex).line;
4005 (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (1)].lex).string);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004006 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004007 break;
4008
kbr@chromium.org205fef32011-11-22 20:50:02 +00004009 case 148:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004010
4011 {
4012 if (context->reservedErrorCheck((yyvsp[(1) - (4)].lex).line, *(yyvsp[(1) - (4)].lex).string))
4013 context->recover();
4014
4015 (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
4016 (yyval.interm.typeLine).line = (yyvsp[(1) - (4)].lex).line;
4017 (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (4)].lex).string);
4018
4019 int size;
4020 if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
4021 context->recover();
4022 (yyval.interm.typeLine).type->setArraySize(size);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004023 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004024 break;
4025
4026 case 149:
4027
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004028 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004029 break;
4030
4031 case 150:
4032
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004033 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004034 break;
4035
4036 case 151:
4037
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004038 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermAggregate); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004039 break;
4040
4041 case 152:
4042
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004043 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004044 break;
4045
4046 case 153:
4047
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004048 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004049 break;
4050
4051 case 154:
4052
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004053 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004054 break;
4055
4056 case 155:
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 156:
4062
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004063 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004064 break;
4065
4066 case 157:
4067
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004068 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
zmo@google.com09c323a2011-08-12 18:22:25 +00004069 break;
4070
4071 case 158:
4072
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004073 { (yyval.interm.intermAggregate) = 0; }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004074 break;
4075
4076 case 159:
4077
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004078 { context->symbolTable.push(); }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004079 break;
4080
4081 case 160:
4082
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004083 { context->symbolTable.pop(); }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004084 break;
4085
4086 case 161:
4087
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004088 {
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004089 if ((yyvsp[(3) - (5)].interm.intermAggregate) != 0) {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004090 (yyvsp[(3) - (5)].interm.intermAggregate)->setOp(EOpSequence);
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004091 (yyvsp[(3) - (5)].interm.intermAggregate)->setEndLine((yyvsp[(5) - (5)].lex).line);
4092 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004093 (yyval.interm.intermAggregate) = (yyvsp[(3) - (5)].interm.intermAggregate);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004094 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004095 break;
4096
4097 case 162:
4098
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004099 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004100 break;
4101
4102 case 163:
4103
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004104 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004105 break;
4106
kbr@chromium.org476541f2011-10-27 21:14:51 +00004107 case 164:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004108
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004109 { context->symbolTable.push(); }
4110 break;
4111
4112 case 165:
4113
4114 { context->symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[(2) - (2)].interm.intermNode); }
4115 break;
4116
4117 case 166:
4118
4119 { context->symbolTable.push(); }
4120 break;
4121
4122 case 167:
4123
4124 { context->symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[(2) - (2)].interm.intermNode); }
4125 break;
4126
4127 case 168:
4128
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004129 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004130 (yyval.interm.intermNode) = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004131 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004132 break;
4133
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004134 case 169:
kbr@chromium.org205fef32011-11-22 20:50:02 +00004135
4136 {
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004137 if ((yyvsp[(2) - (3)].interm.intermAggregate)) {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004138 (yyvsp[(2) - (3)].interm.intermAggregate)->setOp(EOpSequence);
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004139 (yyvsp[(2) - (3)].interm.intermAggregate)->setEndLine((yyvsp[(3) - (3)].lex).line);
4140 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004141 (yyval.interm.intermNode) = (yyvsp[(2) - (3)].interm.intermAggregate);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004142 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004143 break;
4144
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004145 case 170:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004146
4147 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004148 (yyval.interm.intermAggregate) = context->intermediate.makeAggregate((yyvsp[(1) - (1)].interm.intermNode), 0);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004149 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004150 break;
4151
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004152 case 171:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004153
kbr@chromium.org205fef32011-11-22 20:50:02 +00004154 {
4155 (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 +00004156 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004157 break;
4158
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004159 case 172:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004160
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004161 { (yyval.interm.intermNode) = 0; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004162 break;
4163
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004164 case 173:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004165
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004166 { (yyval.interm.intermNode) = static_cast<TIntermNode*>((yyvsp[(1) - (2)].interm.intermTypedNode)); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004167 break;
4168
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004169 case 174:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004170
4171 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004172 if (context->boolErrorCheck((yyvsp[(1) - (5)].lex).line, (yyvsp[(3) - (5)].interm.intermTypedNode)))
4173 context->recover();
4174 (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 +00004175 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004176 break;
4177
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004178 case 175:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004179
4180 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004181 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermNode);
4182 (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004183 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004184 break;
4185
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004186 case 176:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004187
4188 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004189 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (1)].interm.intermNode);
4190 (yyval.interm.nodePair).node2 = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004191 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004192 break;
4193
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004194 case 177:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004195
4196 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004197 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
4198 if (context->boolErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)->getLine(), (yyvsp[(1) - (1)].interm.intermTypedNode)))
4199 context->recover();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004200 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004201 break;
4202
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004203 case 178:
kbr@chromium.org205fef32011-11-22 20:50:02 +00004204
4205 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004206 TIntermNode* intermNode;
4207 if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
4208 context->recover();
4209 if (context->boolErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
4210 context->recover();
4211
4212 if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode))
4213 (yyval.interm.intermTypedNode) = (yyvsp[(4) - (4)].interm.intermTypedNode);
4214 else {
4215 context->recover();
4216 (yyval.interm.intermTypedNode) = 0;
4217 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004218 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004219 break;
4220
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004221 case 179:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004222
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004223 { context->symbolTable.push(); ++context->loopNestingLevel; }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004224 break;
4225
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004226 case 180:
kbr@chromium.org205fef32011-11-22 20:50:02 +00004227
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004228 {
4229 context->symbolTable.pop();
alokp@chromium.org52813552010-11-16 18:36:09 +00004230 (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 +00004231 --context->loopNestingLevel;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004232 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004233 break;
4234
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004235 case 181:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004236
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004237 { ++context->loopNestingLevel; }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004238 break;
4239
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004240 case 182:
kbr@chromium.org205fef32011-11-22 20:50:02 +00004241
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004242 {
4243 if (context->boolErrorCheck((yyvsp[(8) - (8)].lex).line, (yyvsp[(6) - (8)].interm.intermTypedNode)))
4244 context->recover();
4245
alokp@chromium.org52813552010-11-16 18:36:09 +00004246 (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 +00004247 --context->loopNestingLevel;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004248 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004249 break;
4250
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004251 case 183:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004252
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004253 { context->symbolTable.push(); ++context->loopNestingLevel; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004254 break;
4255
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004256 case 184:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004257
4258 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004259 context->symbolTable.pop();
4260 (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);
4261 --context->loopNestingLevel;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004262 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004263 break;
4264
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004265 case 185:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004266
4267 {
kbr@chromium.org476541f2011-10-27 21:14:51 +00004268 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004269 }
zmo@google.com09c323a2011-08-12 18:22:25 +00004270 break;
4271
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004272 case 186:
zmo@google.com09c323a2011-08-12 18:22:25 +00004273
4274 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004275 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004276 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004277 break;
4278
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004279 case 187:
kbr@chromium.org476541f2011-10-27 21:14:51 +00004280
4281 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004282 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004283 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004284 break;
4285
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004286 case 188:
kbr@chromium.org476541f2011-10-27 21:14:51 +00004287
4288 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004289 (yyval.interm.intermTypedNode) = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004290 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004291 break;
4292
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004293 case 189:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004294
4295 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004296 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (2)].interm.intermTypedNode);
4297 (yyval.interm.nodePair).node2 = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004298 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004299 break;
4300
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004301 case 190:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004302
4303 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004304 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermTypedNode);
4305 (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004306 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004307 break;
4308
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004309 case 191:
kbr@chromium.org205fef32011-11-22 20:50:02 +00004310
4311 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004312 if (context->loopNestingLevel <= 0) {
4313 context->error((yyvsp[(1) - (2)].lex).line, "continue statement only allowed in loops", "", "");
4314 context->recover();
4315 }
4316 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpContinue, (yyvsp[(1) - (2)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004317 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004318 break;
4319
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004320 case 192:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004321
4322 {
4323 if (context->loopNestingLevel <= 0) {
4324 context->error((yyvsp[(1) - (2)].lex).line, "break statement only allowed in loops", "", "");
4325 context->recover();
4326 }
4327 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpBreak, (yyvsp[(1) - (2)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004328 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004329 break;
4330
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004331 case 193:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004332
4333 {
4334 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(1) - (2)].lex).line);
4335 if (context->currentFunctionType->getBasicType() != EbtVoid) {
4336 context->error((yyvsp[(1) - (2)].lex).line, "non-void function must return a value", "return", "");
4337 context->recover();
4338 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004339 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004340 break;
4341
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004342 case 194:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004343
4344 {
4345 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(2) - (3)].interm.intermTypedNode), (yyvsp[(1) - (3)].lex).line);
4346 context->functionReturnsValue = true;
4347 if (context->currentFunctionType->getBasicType() == EbtVoid) {
4348 context->error((yyvsp[(1) - (3)].lex).line, "void function cannot return a value", "return", "");
4349 context->recover();
4350 } else if (*(context->currentFunctionType) != (yyvsp[(2) - (3)].interm.intermTypedNode)->getType()) {
4351 context->error((yyvsp[(1) - (3)].lex).line, "function return is not matching type:", "return", "");
4352 context->recover();
4353 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004354 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004355 break;
4356
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004357 case 195:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004358
4359 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004360 FRAG_ONLY("discard", (yyvsp[(1) - (2)].lex).line);
4361 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpKill, (yyvsp[(1) - (2)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004362 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004363 break;
4364
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004365 case 196:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004366
4367 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004368 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
zmo@google.com09c323a2011-08-12 18:22:25 +00004369 context->treeRoot = (yyval.interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004370 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004371 break;
4372
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004373 case 197:
zmo@google.com09c323a2011-08-12 18:22:25 +00004374
4375 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004376 (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermNode), (yyvsp[(2) - (2)].interm.intermNode), 0);
4377 context->treeRoot = (yyval.interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004378 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004379 break;
4380
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004381 case 198:
kbr@chromium.org476541f2011-10-27 21:14:51 +00004382
4383 {
4384 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004385 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004386 break;
4387
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004388 case 199:
kbr@chromium.org476541f2011-10-27 21:14:51 +00004389
4390 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004391 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004392 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004393 break;
4394
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004395 case 200:
kbr@chromium.org205fef32011-11-22 20:50:02 +00004396
4397 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004398 TFunction* function = (yyvsp[(1) - (1)].interm).function;
4399 TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find(function->getMangledName()));
4400 //
4401 // Note: 'prevDec' could be 'function' if this is the first time we've seen function
4402 // as it would have just been put in the symbol table. Otherwise, we're looking up
4403 // an earlier occurance.
4404 //
4405 if (prevDec->isDefined()) {
4406 //
4407 // Then this function already has a body.
4408 //
4409 context->error((yyvsp[(1) - (1)].interm).line, "function already has a body", function->getName().c_str(), "");
4410 context->recover();
4411 }
4412 prevDec->setDefined();
4413
4414 //
4415 // Raise error message if main function takes any parameters or return anything other than void
4416 //
4417 if (function->getName() == "main") {
4418 if (function->getParamCount() > 0) {
4419 context->error((yyvsp[(1) - (1)].interm).line, "function cannot take any parameter(s)", function->getName().c_str(), "");
4420 context->recover();
4421 }
4422 if (function->getReturnType().getBasicType() != EbtVoid) {
4423 context->error((yyvsp[(1) - (1)].interm).line, "", function->getReturnType().getBasicString(), "main function cannot return a value");
4424 context->recover();
4425 }
4426 }
4427
4428 //
4429 // New symbol table scope for body of function plus its arguments
4430 //
4431 context->symbolTable.push();
4432
4433 //
4434 // Remember the return type for later checking for RETURN statements.
4435 //
4436 context->currentFunctionType = &(prevDec->getReturnType());
4437 context->functionReturnsValue = false;
4438
4439 //
4440 // Insert parameters into the symbol table.
4441 // If the parameter has no name, it's not an error, just don't insert it
4442 // (could be used for unused args).
4443 //
4444 // Also, accumulate the list of parameters into the HIL, so lower level code
4445 // knows where to find parameters.
4446 //
4447 TIntermAggregate* paramNodes = new TIntermAggregate;
4448 for (int i = 0; i < function->getParamCount(); i++) {
4449 const TParameter& param = function->getParam(i);
4450 if (param.name != 0) {
4451 TVariable *variable = new TVariable(param.name, *param.type);
4452 //
4453 // Insert the parameters with name in the symbol table.
4454 //
4455 if (! context->symbolTable.insert(*variable)) {
4456 context->error((yyvsp[(1) - (1)].interm).line, "redefinition", variable->getName().c_str(), "");
4457 context->recover();
4458 delete variable;
4459 }
4460
4461 //
4462 // Add the parameter to the HIL
4463 //
4464 paramNodes = context->intermediate.growAggregate(
4465 paramNodes,
4466 context->intermediate.addSymbol(variable->getUniqueId(),
4467 variable->getName(),
4468 variable->getType(), (yyvsp[(1) - (1)].interm).line),
4469 (yyvsp[(1) - (1)].interm).line);
4470 } else {
4471 paramNodes = context->intermediate.growAggregate(paramNodes, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (1)].interm).line), (yyvsp[(1) - (1)].interm).line);
4472 }
4473 }
4474 context->intermediate.setAggregateOperator(paramNodes, EOpParameters, (yyvsp[(1) - (1)].interm).line);
4475 (yyvsp[(1) - (1)].interm).intermAggregate = paramNodes;
4476 context->loopNestingLevel = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004477 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004478 break;
4479
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004480 case 201:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004481
4482 {
4483 //?? Check that all paths return a value if return type != void ?
4484 // May be best done as post process phase on intermediate code
4485 if (context->currentFunctionType->getBasicType() != EbtVoid && ! context->functionReturnsValue) {
4486 context->error((yyvsp[(1) - (3)].interm).line, "function does not return a value:", "", (yyvsp[(1) - (3)].interm).function->getName().c_str());
4487 context->recover();
4488 }
4489 context->symbolTable.pop();
4490 (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermAggregate, (yyvsp[(3) - (3)].interm.intermNode), 0);
4491 context->intermediate.setAggregateOperator((yyval.interm.intermNode), EOpFunction, (yyvsp[(1) - (3)].interm).line);
4492 (yyval.interm.intermNode)->getAsAggregate()->setName((yyvsp[(1) - (3)].interm).function->getMangledName().c_str());
4493 (yyval.interm.intermNode)->getAsAggregate()->setType((yyvsp[(1) - (3)].interm).function->getReturnType());
4494
4495 // store the pragma information for debug and optimize and other vendor specific
4496 // information. This information can be queried from the parse tree
4497 (yyval.interm.intermNode)->getAsAggregate()->setOptimize(context->contextPragma.optimize);
4498 (yyval.interm.intermNode)->getAsAggregate()->setDebug(context->contextPragma.debug);
4499 (yyval.interm.intermNode)->getAsAggregate()->addToPragmaTable(context->contextPragma.pragmaTable);
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004500
4501 if ((yyvsp[(3) - (3)].interm.intermNode) && (yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate())
4502 (yyval.interm.intermNode)->getAsAggregate()->setEndLine((yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate()->getEndLine());
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004503 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004504 break;
4505
4506
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004507
4508 default: break;
4509 }
4510 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
4511
4512 YYPOPSTACK (yylen);
4513 yylen = 0;
4514 YY_STACK_PRINT (yyss, yyssp);
4515
4516 *++yyvsp = yyval;
4517
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004518 /* Now `shift' the result of the reduction. Determine what state
4519 that goes to, based on the state we popped back to and the rule
4520 number reduced by. */
4521
4522 yyn = yyr1[yyn];
4523
4524 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
4525 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
4526 yystate = yytable[yystate];
4527 else
4528 yystate = yydefgoto[yyn - YYNTOKENS];
4529
4530 goto yynewstate;
4531
4532
4533/*------------------------------------.
4534| yyerrlab -- here on detecting error |
4535`------------------------------------*/
4536yyerrlab:
4537 /* If not already recovering from an error, report this error. */
4538 if (!yyerrstatus)
4539 {
4540 ++yynerrs;
4541#if ! YYERROR_VERBOSE
4542 yyerror (context, YY_("syntax error"));
4543#else
4544 {
4545 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
4546 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
4547 {
4548 YYSIZE_T yyalloc = 2 * yysize;
4549 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
4550 yyalloc = YYSTACK_ALLOC_MAXIMUM;
4551 if (yymsg != yymsgbuf)
4552 YYSTACK_FREE (yymsg);
4553 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
4554 if (yymsg)
4555 yymsg_alloc = yyalloc;
4556 else
4557 {
4558 yymsg = yymsgbuf;
4559 yymsg_alloc = sizeof yymsgbuf;
4560 }
4561 }
4562
4563 if (0 < yysize && yysize <= yymsg_alloc)
4564 {
4565 (void) yysyntax_error (yymsg, yystate, yychar);
4566 yyerror (context, yymsg);
4567 }
4568 else
4569 {
4570 yyerror (context, YY_("syntax error"));
4571 if (yysize != 0)
4572 goto yyexhaustedlab;
4573 }
4574 }
4575#endif
4576 }
4577
4578
4579
4580 if (yyerrstatus == 3)
4581 {
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004582 /* If just tried and failed to reuse lookahead token after an
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004583 error, discard it. */
4584
4585 if (yychar <= YYEOF)
4586 {
4587 /* Return failure if at end of input. */
4588 if (yychar == YYEOF)
4589 YYABORT;
4590 }
4591 else
4592 {
4593 yydestruct ("Error: discarding",
4594 yytoken, &yylval, context);
4595 yychar = YYEMPTY;
4596 }
4597 }
4598
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004599 /* Else will try to reuse lookahead token after shifting the error
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004600 token. */
4601 goto yyerrlab1;
4602
4603
4604/*---------------------------------------------------.
4605| yyerrorlab -- error raised explicitly by YYERROR. |
4606`---------------------------------------------------*/
4607yyerrorlab:
4608
4609 /* Pacify compilers like GCC when the user code never invokes
4610 YYERROR and the label yyerrorlab therefore never appears in user
4611 code. */
4612 if (/*CONSTCOND*/ 0)
4613 goto yyerrorlab;
4614
4615 /* Do not reclaim the symbols of the rule which action triggered
4616 this YYERROR. */
4617 YYPOPSTACK (yylen);
4618 yylen = 0;
4619 YY_STACK_PRINT (yyss, yyssp);
4620 yystate = *yyssp;
4621 goto yyerrlab1;
4622
4623
4624/*-------------------------------------------------------------.
4625| yyerrlab1 -- common code for both syntax error and YYERROR. |
4626`-------------------------------------------------------------*/
4627yyerrlab1:
4628 yyerrstatus = 3; /* Each real token shifted decrements this. */
4629
4630 for (;;)
4631 {
4632 yyn = yypact[yystate];
4633 if (yyn != YYPACT_NINF)
4634 {
4635 yyn += YYTERROR;
4636 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
4637 {
4638 yyn = yytable[yyn];
4639 if (0 < yyn)
4640 break;
4641 }
4642 }
4643
4644 /* Pop the current state because it cannot handle the error token. */
4645 if (yyssp == yyss)
4646 YYABORT;
4647
4648
4649 yydestruct ("Error: popping",
4650 yystos[yystate], yyvsp, context);
4651 YYPOPSTACK (1);
4652 yystate = *yyssp;
4653 YY_STACK_PRINT (yyss, yyssp);
4654 }
4655
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004656 *++yyvsp = yylval;
4657
4658
4659 /* Shift the error token. */
4660 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
4661
4662 yystate = yyn;
4663 goto yynewstate;
4664
4665
4666/*-------------------------------------.
4667| yyacceptlab -- YYACCEPT comes here. |
4668`-------------------------------------*/
4669yyacceptlab:
4670 yyresult = 0;
4671 goto yyreturn;
4672
4673/*-----------------------------------.
4674| yyabortlab -- YYABORT comes here. |
4675`-----------------------------------*/
4676yyabortlab:
4677 yyresult = 1;
4678 goto yyreturn;
4679
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004680#if !defined(yyoverflow) || YYERROR_VERBOSE
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004681/*-------------------------------------------------.
4682| yyexhaustedlab -- memory exhaustion comes here. |
4683`-------------------------------------------------*/
4684yyexhaustedlab:
4685 yyerror (context, YY_("memory exhausted"));
4686 yyresult = 2;
4687 /* Fall through. */
4688#endif
4689
4690yyreturn:
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004691 if (yychar != YYEMPTY)
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004692 yydestruct ("Cleanup: discarding lookahead",
4693 yytoken, &yylval, context);
4694 /* Do not reclaim the symbols of the rule which action triggered
4695 this YYABORT or YYACCEPT. */
4696 YYPOPSTACK (yylen);
4697 YY_STACK_PRINT (yyss, yyssp);
4698 while (yyssp != yyss)
4699 {
4700 yydestruct ("Cleanup: popping",
4701 yystos[*yyssp], yyvsp, context);
4702 YYPOPSTACK (1);
4703 }
4704#ifndef yyoverflow
4705 if (yyss != yyssa)
4706 YYSTACK_FREE (yyss);
4707#endif
4708#if YYERROR_VERBOSE
4709 if (yymsg != yymsgbuf)
4710 YYSTACK_FREE (yymsg);
4711#endif
4712 /* Make sure YYID is used. */
4713 return YYID (yyresult);
4714}
4715
4716
4717
4718
4719
4720int glslang_parse(TParseContext* context) {
4721 return yyparse(context);
4722}
4723
4724