blob: e116562cc3693d57a1adcb30b89d96e24b551e8c [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. */
kbr@chromium.org205fef32011-11-22 20:50:02 +0000508#define YYLAST 1370
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. */
kbr@chromium.org476541f2011-10-27 21:14:51 +0000513#define YYNNTS 80
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000514/* YYNRULES -- Number of rules. */
kbr@chromium.org205fef32011-11-22 20:50:02 +0000515#define YYNRULES 197
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000516/* YYNRULES -- Number of states. */
kbr@chromium.org205fef32011-11-22 20:50:02 +0000517#define YYNSTATES 300
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,
588 443, 444, 450, 452, 454, 457, 461, 463, 466, 468,
589 471, 477, 481, 483, 485, 490, 491, 498, 499, 508,
590 509, 517, 519, 521, 523, 524, 527, 531, 534, 537,
591 540, 544, 547, 549, 552, 554, 556, 557
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000592};
593
594/* YYRHS -- A `-1'-separated list of the rules' RHS. */
595static const yytype_int16 yyrhs[] =
596{
kbr@chromium.org205fef32011-11-22 20:50:02 +0000597 172, 0, -1, 45, -1, 97, -1, 48, -1, 47,
598 -1, 49, -1, 72, 124, 73, -1, 98, -1, 99,
599 74, 100, 75, -1, 101, -1, 99, 78, 50, -1,
600 99, 53, -1, 99, 54, -1, 124, -1, 102, -1,
601 103, -1, 99, 78, 103, -1, 105, 73, -1, 104,
602 73, -1, 106, 39, -1, 106, -1, 106, 122, -1,
603 105, 79, 122, -1, 107, 72, -1, 142, -1, 45,
604 -1, 50, -1, 99, -1, 53, 108, -1, 54, 108,
605 -1, 109, 108, -1, 86, -1, 84, -1, 83, -1,
606 108, -1, 110, 87, 108, -1, 110, 88, 108, -1,
607 110, -1, 111, 86, 110, -1, 111, 84, 110, -1,
608 111, -1, 112, -1, 113, 90, 112, -1, 113, 91,
609 112, -1, 113, 55, 112, -1, 113, 56, 112, -1,
610 113, -1, 114, 57, 113, -1, 114, 58, 113, -1,
611 114, -1, 115, -1, 116, -1, 117, -1, 118, 59,
612 117, -1, 118, -1, 119, 61, 118, -1, 119, -1,
613 120, 60, 119, -1, 120, -1, 120, 95, 124, 80,
614 122, -1, 121, -1, 108, 123, 122, -1, 81, -1,
615 62, -1, 63, -1, 64, -1, 71, -1, 122, -1,
616 124, 79, 122, -1, 121, -1, 127, 82, -1, 135,
617 82, -1, 7, 140, 141, 82, -1, 128, 73, -1,
618 130, -1, 129, -1, 130, 132, -1, 129, 79, 132,
619 -1, 137, 45, 72, -1, 139, 45, -1, 139, 45,
620 74, 125, 75, -1, 138, 133, 131, -1, 133, 131,
621 -1, 138, 133, 134, -1, 133, 134, -1, -1, 33,
622 -1, 34, -1, 35, -1, 139, -1, 136, -1, 135,
623 79, 45, -1, 135, 79, 45, 74, 75, -1, 135,
624 79, 45, 74, 125, 75, -1, 135, 79, 45, 81,
625 150, -1, 137, -1, 137, 45, -1, 137, 45, 74,
626 75, -1, 137, 45, 74, 125, 75, -1, 137, 45,
627 81, 150, -1, 3, 45, -1, 139, -1, 138, 139,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000628 -1, 9, -1, 8, -1, 37, -1, 3, 37, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000629 36, -1, 141, -1, 140, 141, -1, 4, -1, 5,
630 -1, 6, -1, 142, -1, 142, 74, 125, 75, -1,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000631 39, -1, 11, -1, 12, -1, 10, -1, 27, -1,
632 28, -1, 29, -1, 21, -1, 22, -1, 23, -1,
633 24, -1, 25, -1, 26, -1, 30, -1, 31, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000634 32, -1, 41, -1, 42, -1, 43, -1, 44, -1,
635 143, -1, 46, -1, -1, 38, 45, 76, 144, 146,
636 77, -1, -1, 38, 76, 145, 146, 77, -1, 147,
637 -1, 146, 147, -1, 139, 148, 82, -1, 149, -1,
638 148, 79, 149, -1, 45, -1, 45, 74, 125, 75,
639 -1, 122, -1, 126, -1, 154, -1, 153, -1, 151,
640 -1, 160, -1, 161, -1, 164, -1, 171, -1, 76,
641 77, -1, -1, -1, 76, 155, 159, 156, 77, -1,
642 158, -1, 153, -1, 76, 77, -1, 76, 159, 77,
643 -1, 152, -1, 159, 152, -1, 82, -1, 124, 82,
644 -1, 18, 72, 124, 73, 162, -1, 152, 16, 152,
645 -1, 152, -1, 124, -1, 137, 45, 81, 150, -1,
646 -1, 40, 72, 165, 163, 73, 157, -1, -1, 15,
647 166, 152, 40, 72, 124, 73, 82, -1, -1, 17,
648 72, 167, 168, 170, 73, 157, -1, 160, -1, 151,
649 -1, 163, -1, -1, 169, 82, -1, 169, 82, 124,
650 -1, 14, 82, -1, 13, 82, -1, 20, 82, -1,
651 20, 124, 82, -1, 19, 82, -1, 173, -1, 172,
652 173, -1, 174, -1, 126, -1, -1, 127, 175, 158,
653 -1
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000654};
655
656/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
657static const yytype_uint16 yyrline[] =
658{
apatrick@chromium.orge057c5d2012-01-26 19:18:24 +0000659 0, 165, 165, 200, 203, 216, 221, 226, 232, 235,
660 308, 311, 420, 430, 443, 451, 550, 553, 561, 565,
661 572, 576, 583, 589, 598, 606, 661, 668, 678, 681,
662 691, 701, 722, 723, 724, 729, 730, 739, 751, 752,
663 760, 771, 775, 776, 786, 796, 806, 819, 820, 830,
664 843, 847, 851, 855, 856, 869, 870, 883, 884, 897,
665 898, 915, 916, 929, 930, 931, 932, 933, 937, 940,
666 951, 959, 984, 989, 996, 1032, 1035, 1042, 1050, 1071,
667 1090, 1101, 1130, 1135, 1145, 1150, 1160, 1163, 1166, 1169,
668 1175, 1182, 1185, 1201, 1219, 1243, 1266, 1270, 1288, 1296,
669 1328, 1348, 1424, 1433, 1456, 1459, 1465, 1473, 1481, 1489,
670 1499, 1506, 1509, 1512, 1518, 1521, 1536, 1540, 1544, 1548,
671 1557, 1562, 1567, 1572, 1577, 1582, 1587, 1592, 1597, 1602,
672 1608, 1614, 1620, 1625, 1630, 1639, 1648, 1653, 1666, 1666,
673 1680, 1680, 1689, 1692, 1707, 1743, 1747, 1753, 1761, 1777,
674 1781, 1785, 1786, 1792, 1793, 1794, 1795, 1796, 1800, 1801,
675 1801, 1801, 1811, 1812, 1817, 1820, 1830, 1833, 1839, 1840,
676 1844, 1852, 1856, 1866, 1871, 1888, 1888, 1893, 1893, 1900,
677 1900, 1908, 1911, 1917, 1920, 1926, 1930, 1937, 1944, 1951,
678 1958, 1969, 1978, 1982, 1989, 1992, 1998, 1998
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000679};
680#endif
681
682#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
683/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
684 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
685static const char *const yytname[] =
686{
687 "$end", "error", "$undefined", "INVARIANT", "HIGH_PRECISION",
688 "MEDIUM_PRECISION", "LOW_PRECISION", "PRECISION", "ATTRIBUTE",
689 "CONST_QUAL", "BOOL_TYPE", "FLOAT_TYPE", "INT_TYPE", "BREAK", "CONTINUE",
690 "DO", "ELSE", "FOR", "IF", "DISCARD", "RETURN", "BVEC2", "BVEC3",
691 "BVEC4", "IVEC2", "IVEC3", "IVEC4", "VEC2", "VEC3", "VEC4", "MATRIX2",
692 "MATRIX3", "MATRIX4", "IN_QUAL", "OUT_QUAL", "INOUT_QUAL", "UNIFORM",
693 "VARYING", "STRUCT", "VOID_TYPE", "WHILE", "SAMPLER2D", "SAMPLERCUBE",
kbr@chromium.org205fef32011-11-22 20:50:02 +0000694 "SAMPLER_EXTERNAL_OES", "SAMPLER2DRECT", "IDENTIFIER", "TYPE_NAME",
695 "FLOATCONSTANT", "INTCONSTANT", "BOOLCONSTANT", "FIELD_SELECTION",
696 "LEFT_OP", "RIGHT_OP", "INC_OP", "DEC_OP", "LE_OP", "GE_OP", "EQ_OP",
697 "NE_OP", "AND_OP", "OR_OP", "XOR_OP", "MUL_ASSIGN", "DIV_ASSIGN",
698 "ADD_ASSIGN", "MOD_ASSIGN", "LEFT_ASSIGN", "RIGHT_ASSIGN", "AND_ASSIGN",
699 "XOR_ASSIGN", "OR_ASSIGN", "SUB_ASSIGN", "LEFT_PAREN", "RIGHT_PAREN",
700 "LEFT_BRACKET", "RIGHT_BRACKET", "LEFT_BRACE", "RIGHT_BRACE", "DOT",
701 "COMMA", "COLON", "EQUAL", "SEMICOLON", "BANG", "DASH", "TILDE", "PLUS",
702 "STAR", "SLASH", "PERCENT", "LEFT_ANGLE", "RIGHT_ANGLE", "VERTICAL_BAR",
703 "CARET", "AMPERSAND", "QUESTION", "$accept", "variable_identifier",
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000704 "primary_expression", "postfix_expression", "integer_expression",
705 "function_call", "function_call_or_method", "function_call_generic",
706 "function_call_header_no_parameters",
707 "function_call_header_with_parameters", "function_call_header",
708 "function_identifier", "unary_expression", "unary_operator",
709 "multiplicative_expression", "additive_expression", "shift_expression",
710 "relational_expression", "equality_expression", "and_expression",
711 "exclusive_or_expression", "inclusive_or_expression",
712 "logical_and_expression", "logical_xor_expression",
713 "logical_or_expression", "conditional_expression",
714 "assignment_expression", "assignment_operator", "expression",
715 "constant_expression", "declaration", "function_prototype",
716 "function_declarator", "function_header_with_parameters",
717 "function_header", "parameter_declarator", "parameter_declaration",
718 "parameter_qualifier", "parameter_type_specifier",
719 "init_declarator_list", "single_declaration", "fully_specified_type",
720 "type_qualifier", "type_specifier", "precision_qualifier",
721 "type_specifier_no_prec", "type_specifier_nonarray", "struct_specifier",
daniel@transgaming.com05bc2042012-03-09 21:56:58 +0000722 "$@1", "$@2", "struct_declaration_list", "struct_declaration",
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000723 "struct_declarator_list", "struct_declarator", "initializer",
724 "declaration_statement", "statement", "simple_statement",
daniel@transgaming.com05bc2042012-03-09 21:56:58 +0000725 "compound_statement", "$@3", "$@4", "statement_no_new_scope",
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000726 "compound_statement_no_new_scope", "statement_list",
727 "expression_statement", "selection_statement",
daniel@transgaming.com05bc2042012-03-09 21:56:58 +0000728 "selection_rest_statement", "condition", "iteration_statement", "$@5",
729 "$@6", "$@7", "for_init_statement", "conditionopt", "for_rest_statement",
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000730 "jump_statement", "translation_unit", "external_declaration",
daniel@transgaming.com05bc2042012-03-09 21:56:58 +0000731 "function_definition", "$@8", 0
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000732};
733#endif
734
735# ifdef YYPRINT
736/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
737 token YYLEX-NUM. */
738static const yytype_uint16 yytoknum[] =
739{
740 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
741 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
742 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
743 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
744 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
745 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
746 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
747 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
748 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000749 345, 346, 347, 348, 349, 350
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000750};
751# endif
752
753/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
754static const yytype_uint8 yyr1[] =
755{
kbr@chromium.org205fef32011-11-22 20:50:02 +0000756 0, 96, 97, 98, 98, 98, 98, 98, 99, 99,
757 99, 99, 99, 99, 100, 101, 102, 102, 103, 103,
758 104, 104, 105, 105, 106, 107, 107, 107, 108, 108,
759 108, 108, 109, 109, 109, 110, 110, 110, 111, 111,
760 111, 112, 113, 113, 113, 113, 113, 114, 114, 114,
761 115, 116, 117, 118, 118, 119, 119, 120, 120, 121,
762 121, 122, 122, 123, 123, 123, 123, 123, 124, 124,
763 125, 126, 126, 126, 127, 128, 128, 129, 129, 130,
764 131, 131, 132, 132, 132, 132, 133, 133, 133, 133,
765 134, 135, 135, 135, 135, 135, 136, 136, 136, 136,
766 136, 136, 137, 137, 138, 138, 138, 138, 138, 139,
767 139, 140, 140, 140, 141, 141, 142, 142, 142, 142,
768 142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
769 142, 142, 142, 142, 142, 142, 142, 142, 144, 143,
770 145, 143, 146, 146, 147, 148, 148, 149, 149, 150,
771 151, 152, 152, 153, 153, 153, 153, 153, 154, 155,
772 156, 154, 157, 157, 158, 158, 159, 159, 160, 160,
773 161, 162, 162, 163, 163, 165, 164, 166, 164, 167,
774 164, 168, 168, 169, 169, 170, 170, 171, 171, 171,
775 171, 171, 172, 172, 173, 173, 175, 174
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000776};
777
778/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
779static const yytype_uint8 yyr2[] =
780{
781 0, 2, 1, 1, 1, 1, 1, 3, 1, 4,
782 1, 3, 2, 2, 1, 1, 1, 3, 2, 2,
783 2, 1, 2, 3, 2, 1, 1, 1, 1, 2,
784 2, 2, 1, 1, 1, 1, 3, 3, 1, 3,
785 3, 1, 1, 3, 3, 3, 3, 1, 3, 3,
786 1, 1, 1, 1, 3, 1, 3, 1, 3, 1,
787 5, 1, 3, 1, 1, 1, 1, 1, 1, 3,
788 1, 2, 2, 4, 2, 1, 1, 2, 3, 3,
789 2, 5, 3, 2, 3, 2, 0, 1, 1, 1,
790 1, 1, 3, 5, 6, 5, 1, 2, 4, 5,
791 4, 2, 1, 2, 1, 1, 1, 2, 1, 1,
792 2, 1, 1, 1, 1, 4, 1, 1, 1, 1,
793 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000794 1, 1, 1, 1, 1, 1, 1, 1, 0, 6,
795 0, 5, 1, 2, 3, 1, 3, 1, 4, 1,
796 1, 1, 1, 1, 1, 1, 1, 1, 2, 0,
797 0, 5, 1, 1, 2, 3, 1, 2, 1, 2,
798 5, 3, 1, 1, 4, 0, 6, 0, 8, 0,
799 7, 1, 1, 1, 0, 2, 3, 2, 2, 2,
800 3, 2, 1, 2, 1, 1, 0, 3
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000801};
802
803/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
804 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
805 means the default is an error. */
806static const yytype_uint8 yydefact[] =
807{
808 0, 0, 111, 112, 113, 0, 105, 104, 119, 117,
809 118, 123, 124, 125, 126, 127, 128, 120, 121, 122,
zmo@google.com09c323a2011-08-12 18:22:25 +0000810 129, 130, 131, 108, 106, 0, 116, 132, 133, 134,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000811 135, 137, 195, 196, 0, 76, 86, 0, 91, 96,
812 0, 102, 0, 109, 114, 136, 0, 192, 194, 107,
813 101, 0, 0, 140, 71, 0, 74, 86, 0, 87,
814 88, 89, 77, 0, 86, 0, 72, 97, 103, 110,
815 0, 1, 193, 0, 138, 0, 0, 197, 78, 83,
816 85, 90, 0, 92, 79, 0, 0, 2, 5, 4,
817 6, 27, 0, 0, 0, 34, 33, 32, 3, 8,
818 28, 10, 15, 16, 0, 0, 21, 0, 35, 0,
819 38, 41, 42, 47, 50, 51, 52, 53, 55, 57,
820 59, 70, 0, 25, 73, 0, 0, 0, 142, 0,
821 0, 177, 0, 0, 0, 0, 0, 159, 164, 168,
822 35, 61, 68, 0, 150, 0, 114, 153, 166, 152,
823 151, 0, 154, 155, 156, 157, 80, 82, 84, 0,
824 0, 98, 0, 149, 100, 29, 30, 0, 12, 13,
825 0, 0, 19, 18, 0, 20, 22, 24, 31, 0,
kbr@chromium.org476541f2011-10-27 21:14:51 +0000826 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000827 0, 0, 0, 115, 0, 147, 0, 145, 141, 143,
828 188, 187, 0, 179, 0, 191, 189, 0, 175, 158,
829 0, 64, 65, 66, 67, 63, 0, 0, 169, 165,
830 167, 0, 93, 0, 95, 99, 7, 0, 14, 26,
831 11, 17, 23, 36, 37, 40, 39, 45, 46, 43,
832 44, 48, 49, 54, 56, 58, 0, 139, 0, 0,
833 144, 0, 0, 0, 190, 0, 160, 62, 69, 0,
834 94, 9, 0, 0, 146, 0, 182, 181, 184, 0,
835 173, 0, 0, 0, 81, 60, 148, 0, 183, 0,
836 0, 172, 170, 0, 0, 161, 0, 185, 0, 0,
837 0, 163, 176, 162, 0, 186, 180, 171, 174, 178
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000838};
839
840/* YYDEFGOTO[NTERM-NUM]. */
841static const yytype_int16 yydefgoto[] =
842{
kbr@chromium.org205fef32011-11-22 20:50:02 +0000843 -1, 98, 99, 100, 227, 101, 102, 103, 104, 105,
844 106, 107, 140, 109, 110, 111, 112, 113, 114, 115,
845 116, 117, 118, 119, 120, 141, 142, 216, 143, 122,
846 144, 145, 34, 35, 36, 79, 62, 63, 80, 37,
847 38, 39, 40, 41, 42, 43, 123, 45, 125, 75,
848 127, 128, 196, 197, 164, 147, 148, 149, 150, 210,
849 273, 292, 293, 151, 152, 153, 282, 272, 154, 255,
850 202, 252, 268, 279, 280, 155, 46, 47, 48, 55
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000851};
852
853/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
854 STATE-NUM. */
kbr@chromium.org205fef32011-11-22 20:50:02 +0000855#define YYPACT_NINF -251
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000856static const yytype_int16 yypact[] =
857{
kbr@chromium.org205fef32011-11-22 20:50:02 +0000858 1250, -17, -251, -251, -251, 113, -251, -251, -251, -251,
859 -251, -251, -251, -251, -251, -251, -251, -251, -251, -251,
860 -251, -251, -251, -251, -251, -39, -251, -251, -251, -251,
861 -251, -251, -251, -65, -34, -10, 21, -32, -251, 28,
862 207, -251, 1324, -251, 56, -251, 1206, -251, -251, -251,
863 -251, 1324, 74, -251, -251, 86, -251, 71, 95, -251,
864 -251, -251, -251, 207, 119, 120, -251, -56, -251, -251,
865 971, -251, -251, 84, -251, 207, 287, -251, -251, -251,
866 -251, 124, 207, -59, -251, 773, 971, 98, -251, -251,
867 -251, -251, 971, 971, 971, -251, -251, -251, -251, -251,
868 35, -251, -251, -251, 100, -9, 1037, 102, -251, 971,
869 -27, -1, -251, -24, 99, -251, -251, -251, 112, 111,
870 -51, -251, 103, -251, -251, 207, 135, 1106, -251, 101,
871 104, -251, 109, 115, 106, 839, 117, 107, -251, -251,
872 39, -251, -251, -11, -251, -65, 54, -251, -251, -251,
873 -251, 371, -251, -251, -251, -251, 116, -251, -251, 905,
874 971, -251, 118, -251, -251, -251, -251, 8, -251, -251,
875 971, 1287, -251, -251, 971, 125, -251, -251, -251, 971,
876 971, 971, 971, 971, 971, 971, 971, 971, 971, 971,
877 971, 971, 971, -251, 1149, 122, 17, -251, -251, -251,
878 -251, -251, 455, -251, 971, -251, -251, 32, -251, -251,
879 455, -251, -251, -251, -251, -251, 971, 971, -251, -251,
880 -251, 971, -251, 123, -251, -251, -251, 126, 121, -251,
881 127, -251, -251, -251, -251, -27, -27, -251, -251, -251,
882 -251, -24, -24, -251, 112, 111, 79, -251, 971, 135,
883 -251, 151, 623, 11, -251, 707, 455, -251, -251, 128,
884 -251, -251, 971, 130, -251, 134, -251, -251, 707, 455,
885 121, 147, 136, 131, -251, -251, -251, 971, -251, 132,
886 142, 200, -251, 139, 539, -251, 19, 971, 539, 455,
887 971, -251, -251, -251, 140, 121, -251, -251, -251, -251
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000888};
889
890/* YYPGOTO[NTERM-NUM]. */
891static const yytype_int16 yypgoto[] =
892{
kbr@chromium.org205fef32011-11-22 20:50:02 +0000893 -251, -251, -251, -251, -251, -251, -251, 50, -251, -251,
894 -251, -251, -44, -251, -21, -251, -62, -20, -251, -251,
895 -251, 34, 36, 33, -251, -66, -83, -251, -92, -73,
896 7, 13, -251, -251, -251, 143, 170, 176, 159, -251,
897 -251, -247, -22, -30, 237, -15, 0, -251, -251, -251,
898 129, -122, -251, -6, -159, -8, -140, -250, -251, -251,
899 -251, -41, 202, 48, 9, -251, -251, -5, -251, -251,
900 -251, -251, -251, -251, -251, -251, -251, 213, -251, -251
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000901};
902
903/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
904 positive, shift that token. If negative, reduce the rule which
905 number is the opposite. If zero, do what YYDEFACT says.
906 If YYTABLE_NINF, syntax error. */
zmo@google.comdc4b4f82011-06-17 00:42:53 +0000907#define YYTABLE_NINF -117
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000908static const yytype_int16 yytable[] =
909{
kbr@chromium.org205fef32011-11-22 20:50:02 +0000910 44, 224, 167, 163, 121, 199, 52, 32, 271, 191,
911 68, 220, 162, 33, 64, 159, 84, 54, 85, 121,
912 49, 271, 160, 176, 58, 86, 108, 69, 50, 6,
913 7, 183, 184, 81, 291, 64, 73, 53, 291, 56,
914 44, 108, 44, 207, 192, 126, 44, 65, 165, 166,
915 66, 44, 81, 32, 59, 60, 61, 23, 24, 33,
916 179, 180, 251, 44, 173, 178, 185, 186, 217, 57,
917 174, 218, 199, 67, 58, 44, 146, 163, 228, 6,
918 7, 226, 44, 181, 269, 182, 223, 217, 168, 169,
919 217, 232, 294, 121, -75, 126, 249, 126, 217, 250,
920 246, 211, 212, 213, 59, 60, 61, 23, 24, 170,
921 214, 217, 253, 171, 254, 108, 220, 2, 3, 4,
922 215, 237, 238, 239, 240, 44, -25, 44, 70, 281,
923 70, 298, 49, 257, 258, 233, 234, 108, 108, 108,
924 108, 108, 108, 108, 108, 108, 108, 108, 259, 297,
925 74, 146, 59, 60, 61, 121, 187, 188, 217, 262,
926 235, 236, 76, 270, 126, 83, 124, 241, 242, 156,
927 -26, 189, 190, 172, 177, 263, 270, 108, 193, 275,
928 195, 203, 121, 200, 209, 286, 201, 204, 205, 208,
929 221, 265, 283, 225, 44, 295, 248, -116, 260, -27,
930 217, 261, 146, 274, 108, 276, 277, 163, 285, 284,
931 146, 2, 3, 4, 287, 288, 289, 8, 9, 10,
932 290, 231, 299, 243, 245, 157, 244, 78, 11, 12,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000933 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000934 82, 158, 51, 264, 266, 25, 26, 296, 27, 28,
935 29, 30, 146, 31, 194, 146, 146, 77, 256, 72,
936 0, 267, 0, 278, 0, 0, 0, 0, 146, 146,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000937 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000938 0, 0, 0, 0, 146, 0, 0, 0, 146, 146,
939 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
940 129, 130, 131, 0, 132, 133, 134, 135, 11, 12,
941 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
942 0, 0, 0, 23, 24, 25, 26, 136, 27, 28,
943 29, 30, 87, 31, 88, 89, 90, 91, 0, 0,
944 92, 93, 0, 0, 0, 0, 0, 0, 0, 0,
945 0, 0, 0, 0, 0, 0, 0, 0, 0, 94,
946 0, 0, 0, 137, 138, 0, 0, 0, 0, 139,
947 95, 96, 0, 97, 1, 2, 3, 4, 5, 6,
948 7, 8, 9, 10, 129, 130, 131, 0, 132, 133,
949 134, 135, 11, 12, 13, 14, 15, 16, 17, 18,
kbr@chromium.org476541f2011-10-27 21:14:51 +0000950 19, 20, 21, 22, 0, 0, 0, 23, 24, 25,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000951 26, 136, 27, 28, 29, 30, 87, 31, 88, 89,
952 90, 91, 0, 0, 92, 93, 0, 0, 0, 0,
kbr@chromium.org476541f2011-10-27 21:14:51 +0000953 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000954 0, 0, 0, 94, 0, 0, 0, 137, 219, 0,
955 0, 0, 0, 139, 95, 96, 0, 97, 1, 2,
956 3, 4, 5, 6, 7, 8, 9, 10, 129, 130,
957 131, 0, 132, 133, 134, 135, 11, 12, 13, 14,
958 15, 16, 17, 18, 19, 20, 21, 22, 0, 0,
959 0, 23, 24, 25, 26, 136, 27, 28, 29, 30,
960 87, 31, 88, 89, 90, 91, 0, 0, 92, 93,
kbr@chromium.org476541f2011-10-27 21:14:51 +0000961 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000962 0, 0, 0, 0, 0, 0, 0, 94, 0, 0,
963 0, 137, 0, 0, 0, 0, 0, 139, 95, 96,
964 0, 97, 1, 2, 3, 4, 5, 6, 7, 8,
965 9, 10, 129, 130, 131, 0, 132, 133, 134, 135,
966 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
967 21, 22, 0, 0, 0, 23, 24, 25, 26, 136,
968 27, 28, 29, 30, 87, 31, 88, 89, 90, 91,
969 0, 0, 92, 93, 0, 0, 0, 0, 0, 0,
970 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
971 0, 94, 0, 0, 0, 76, 0, 0, 0, 0,
972 0, 139, 95, 96, 0, 97, 1, 2, 3, 4,
973 5, 6, 7, 8, 9, 10, 0, 0, 0, 0,
974 0, 0, 0, 0, 11, 12, 13, 14, 15, 16,
975 17, 18, 19, 20, 21, 22, 0, 0, 0, 23,
976 24, 25, 26, 0, 27, 28, 29, 30, 87, 31,
977 88, 89, 90, 91, 0, 0, 92, 93, 0, 0,
978 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
979 0, 0, 0, 0, 0, 94, 0, 0, 0, 0,
980 0, 0, 0, 0, 0, 139, 95, 96, 0, 97,
981 58, 2, 3, 4, 0, 6, 7, 8, 9, 10,
982 0, 0, 0, 0, 0, 0, 0, 0, 11, 12,
983 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
984 0, 0, 0, 23, 24, 25, 26, 0, 27, 28,
985 29, 30, 87, 31, 88, 89, 90, 91, 0, 0,
986 92, 93, 0, 0, 0, 0, 0, 0, 0, 0,
987 0, 0, 0, 0, 0, 0, 0, 0, 0, 94,
988 0, 0, 0, 8, 9, 10, 0, 0, 0, 0,
989 95, 96, 0, 97, 11, 12, 13, 14, 15, 16,
990 17, 18, 19, 20, 21, 22, 0, 0, 0, 0,
991 0, 25, 26, 0, 27, 28, 29, 30, 87, 31,
992 88, 89, 90, 91, 0, 0, 92, 93, 0, 0,
993 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
994 0, 0, 0, 0, 0, 94, 0, 0, 161, 8,
995 9, 10, 0, 0, 0, 0, 95, 96, 0, 97,
996 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
997 21, 22, 0, 0, 0, 0, 0, 25, 26, 0,
998 27, 28, 29, 30, 87, 31, 88, 89, 90, 91,
999 0, 0, 92, 93, 0, 0, 0, 0, 0, 0,
1000 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1001 0, 94, 0, 0, 0, 8, 9, 10, 0, 0,
1002 0, 206, 95, 96, 0, 97, 11, 12, 13, 14,
1003 15, 16, 17, 18, 19, 20, 21, 22, 0, 0,
1004 0, 0, 0, 25, 26, 0, 27, 28, 29, 30,
1005 87, 31, 88, 89, 90, 91, 0, 0, 92, 93,
1006 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1007 0, 0, 0, 0, 0, 0, 0, 94, 0, 0,
1008 222, 8, 9, 10, 0, 0, 0, 0, 95, 96,
1009 0, 97, 11, 12, 13, 14, 15, 16, 17, 18,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001010 19, 20, 21, 22, 0, 0, 0, 0, 0, 25,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001011 26, 0, 27, 28, 29, 30, 87, 31, 88, 89,
1012 90, 91, 0, 0, 92, 93, 0, 0, 0, 0,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001013 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001014 0, 0, 0, 94, 0, 0, 0, 8, 9, 10,
1015 0, 0, 0, 0, 95, 96, 0, 97, 11, 12,
1016 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
1017 0, 0, 0, 0, 0, 25, 175, 0, 27, 28,
1018 29, 30, 87, 31, 88, 89, 90, 91, 0, 0,
1019 92, 93, 0, 0, 0, 0, 0, 0, 0, 0,
1020 0, 0, 0, 0, 0, 0, 0, 0, 0, 94,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001021 2, 3, 4, 0, 0, 0, 8, 9, 10, 0,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001022 95, 96, 0, 97, 0, 0, 0, 11, 12, 13,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001023 14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001024 0, 0, 0, 0, 25, 26, 0, 27, 28, 29,
1025 30, 0, 31, 2, 3, 4, 0, 0, 0, 8,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001026 9, 10, 0, 0, 0, 0, 0, 0, 0, 0,
1027 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001028 21, 22, 0, 198, 0, 0, 0, 25, 26, 0,
1029 27, 28, 29, 30, 0, 31, 0, 0, 0, 0,
1030 0, 0, 0, 0, 0, 0, 71, 0, 0, 1,
1031 2, 3, 4, 5, 6, 7, 8, 9, 10, 0,
1032 0, 0, 0, 0, 0, 0, 247, 11, 12, 13,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001033 14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001034 0, 0, 23, 24, 25, 26, 0, 27, 28, 29,
1035 30, 0, 31, 1, 2, 3, 4, 5, 6, 7,
1036 8, 9, 10, 0, 0, 0, 0, 0, 0, 0,
1037 0, 11, 12, 13, 14, 15, 16, 17, 18, 19,
1038 20, 21, 22, 0, 0, 0, 23, 24, 25, 26,
1039 0, 27, 28, 29, 30, 0, 31, 8, 9, 10,
1040 0, 0, 0, 0, 0, 0, 0, 0, 11, 12,
1041 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
1042 0, 0, 0, 0, 0, 25, 26, 0, 27, 28,
1043 29, 30, 229, 31, 8, 9, 10, 230, 0, 0,
1044 0, 0, 0, 0, 0, 11, 12, 13, 14, 15,
1045 16, 17, 18, 19, 20, 21, 22, 0, 0, 0,
1046 0, 0, 25, 26, 0, 27, 28, 29, 30, 0,
1047 31
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001048};
1049
1050static const yytype_int16 yycheck[] =
1051{
kbr@chromium.org205fef32011-11-22 20:50:02 +00001052 0, 160, 94, 86, 70, 127, 45, 0, 255, 60,
1053 40, 151, 85, 0, 36, 74, 72, 82, 74, 85,
1054 37, 268, 81, 106, 3, 81, 70, 42, 45, 8,
1055 9, 55, 56, 63, 284, 57, 51, 76, 288, 73,
1056 40, 85, 42, 135, 95, 75, 46, 79, 92, 93,
1057 82, 51, 82, 46, 33, 34, 35, 36, 37, 46,
1058 87, 88, 202, 63, 73, 109, 90, 91, 79, 79,
1059 79, 82, 194, 45, 3, 75, 76, 160, 170, 8,
1060 9, 73, 82, 84, 73, 86, 159, 79, 53, 54,
1061 79, 174, 73, 159, 73, 125, 79, 127, 79, 82,
1062 192, 62, 63, 64, 33, 34, 35, 36, 37, 74,
1063 71, 79, 204, 78, 82, 159, 256, 4, 5, 6,
1064 81, 183, 184, 185, 186, 125, 72, 127, 74, 269,
1065 74, 290, 37, 216, 217, 179, 180, 181, 182, 183,
1066 184, 185, 186, 187, 188, 189, 190, 191, 221, 289,
1067 76, 151, 33, 34, 35, 221, 57, 58, 79, 80,
1068 181, 182, 76, 255, 194, 45, 82, 187, 188, 45,
1069 72, 59, 61, 73, 72, 248, 268, 221, 75, 262,
1070 45, 72, 248, 82, 77, 277, 82, 72, 82, 72,
1071 74, 40, 45, 75, 194, 287, 74, 72, 75, 72,
1072 79, 75, 202, 75, 248, 75, 72, 290, 77, 73,
1073 210, 4, 5, 6, 82, 73, 16, 10, 11, 12,
1074 81, 171, 82, 189, 191, 82, 190, 57, 21, 22,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001075 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001076 64, 82, 5, 249, 252, 38, 39, 288, 41, 42,
1077 43, 44, 252, 46, 125, 255, 256, 55, 210, 46,
1078 -1, 252, -1, 268, -1, -1, -1, -1, 268, 269,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001079 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001080 -1, -1, -1, -1, 284, -1, -1, -1, 288, 289,
1081 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
1082 13, 14, 15, -1, 17, 18, 19, 20, 21, 22,
1083 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
1084 -1, -1, -1, 36, 37, 38, 39, 40, 41, 42,
1085 43, 44, 45, 46, 47, 48, 49, 50, -1, -1,
1086 53, 54, -1, -1, -1, -1, -1, -1, -1, -1,
1087 -1, -1, -1, -1, -1, -1, -1, -1, -1, 72,
1088 -1, -1, -1, 76, 77, -1, -1, -1, -1, 82,
1089 83, 84, -1, 86, 3, 4, 5, 6, 7, 8,
1090 9, 10, 11, 12, 13, 14, 15, -1, 17, 18,
1091 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
1092 29, 30, 31, 32, -1, -1, -1, 36, 37, 38,
1093 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
1094 49, 50, -1, -1, 53, 54, -1, -1, -1, -1,
zmo@google.com09c323a2011-08-12 18:22:25 +00001095 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001096 -1, -1, -1, 72, -1, -1, -1, 76, 77, -1,
1097 -1, -1, -1, 82, 83, 84, -1, 86, 3, 4,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001098 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1099 15, -1, 17, 18, 19, 20, 21, 22, 23, 24,
zmo@google.com09c323a2011-08-12 18:22:25 +00001100 25, 26, 27, 28, 29, 30, 31, 32, -1, -1,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001101 -1, 36, 37, 38, 39, 40, 41, 42, 43, 44,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001102 45, 46, 47, 48, 49, 50, -1, -1, 53, 54,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001103 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001104 -1, -1, -1, -1, -1, -1, -1, 72, -1, -1,
1105 -1, 76, -1, -1, -1, -1, -1, 82, 83, 84,
1106 -1, 86, 3, 4, 5, 6, 7, 8, 9, 10,
1107 11, 12, 13, 14, 15, -1, 17, 18, 19, 20,
1108 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
1109 31, 32, -1, -1, -1, 36, 37, 38, 39, 40,
1110 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
1111 -1, -1, 53, 54, -1, -1, -1, -1, -1, -1,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001112 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001113 -1, 72, -1, -1, -1, 76, -1, -1, -1, -1,
1114 -1, 82, 83, 84, -1, 86, 3, 4, 5, 6,
1115 7, 8, 9, 10, 11, 12, -1, -1, -1, -1,
1116 -1, -1, -1, -1, 21, 22, 23, 24, 25, 26,
1117 27, 28, 29, 30, 31, 32, -1, -1, -1, 36,
1118 37, 38, 39, -1, 41, 42, 43, 44, 45, 46,
1119 47, 48, 49, 50, -1, -1, 53, 54, -1, -1,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001120 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001121 -1, -1, -1, -1, -1, 72, -1, -1, -1, -1,
1122 -1, -1, -1, -1, -1, 82, 83, 84, -1, 86,
1123 3, 4, 5, 6, -1, 8, 9, 10, 11, 12,
1124 -1, -1, -1, -1, -1, -1, -1, -1, 21, 22,
1125 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
1126 -1, -1, -1, 36, 37, 38, 39, -1, 41, 42,
1127 43, 44, 45, 46, 47, 48, 49, 50, -1, -1,
1128 53, 54, -1, -1, -1, -1, -1, -1, -1, -1,
1129 -1, -1, -1, -1, -1, -1, -1, -1, -1, 72,
1130 -1, -1, -1, 10, 11, 12, -1, -1, -1, -1,
1131 83, 84, -1, 86, 21, 22, 23, 24, 25, 26,
1132 27, 28, 29, 30, 31, 32, -1, -1, -1, -1,
1133 -1, 38, 39, -1, 41, 42, 43, 44, 45, 46,
1134 47, 48, 49, 50, -1, -1, 53, 54, -1, -1,
1135 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1136 -1, -1, -1, -1, -1, 72, -1, -1, 75, 10,
1137 11, 12, -1, -1, -1, -1, 83, 84, -1, 86,
1138 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
1139 31, 32, -1, -1, -1, -1, -1, 38, 39, -1,
1140 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
1141 -1, -1, 53, 54, -1, -1, -1, -1, -1, -1,
1142 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1143 -1, 72, -1, -1, -1, 10, 11, 12, -1, -1,
1144 -1, 82, 83, 84, -1, 86, 21, 22, 23, 24,
1145 25, 26, 27, 28, 29, 30, 31, 32, -1, -1,
1146 -1, -1, -1, 38, 39, -1, 41, 42, 43, 44,
1147 45, 46, 47, 48, 49, 50, -1, -1, 53, 54,
1148 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1149 -1, -1, -1, -1, -1, -1, -1, 72, -1, -1,
1150 75, 10, 11, 12, -1, -1, -1, -1, 83, 84,
1151 -1, 86, 21, 22, 23, 24, 25, 26, 27, 28,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001152 29, 30, 31, 32, -1, -1, -1, -1, -1, 38,
1153 39, -1, 41, 42, 43, 44, 45, 46, 47, 48,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001154 49, 50, -1, -1, 53, 54, -1, -1, -1, -1,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001155 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001156 -1, -1, -1, 72, -1, -1, -1, 10, 11, 12,
1157 -1, -1, -1, -1, 83, 84, -1, 86, 21, 22,
1158 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
1159 -1, -1, -1, -1, -1, 38, 39, -1, 41, 42,
1160 43, 44, 45, 46, 47, 48, 49, 50, -1, -1,
1161 53, 54, -1, -1, -1, -1, -1, -1, -1, -1,
1162 -1, -1, -1, -1, -1, -1, -1, -1, -1, 72,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001163 4, 5, 6, -1, -1, -1, 10, 11, 12, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001164 83, 84, -1, 86, -1, -1, -1, 21, 22, 23,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001165 24, 25, 26, 27, 28, 29, 30, 31, 32, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001166 -1, -1, -1, -1, 38, 39, -1, 41, 42, 43,
1167 44, -1, 46, 4, 5, 6, -1, -1, -1, 10,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001168 11, 12, -1, -1, -1, -1, -1, -1, -1, -1,
1169 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001170 31, 32, -1, 77, -1, -1, -1, 38, 39, -1,
1171 41, 42, 43, 44, -1, 46, -1, -1, -1, -1,
1172 -1, -1, -1, -1, -1, -1, 0, -1, -1, 3,
1173 4, 5, 6, 7, 8, 9, 10, 11, 12, -1,
1174 -1, -1, -1, -1, -1, -1, 77, 21, 22, 23,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001175 24, 25, 26, 27, 28, 29, 30, 31, 32, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001176 -1, -1, 36, 37, 38, 39, -1, 41, 42, 43,
1177 44, -1, 46, 3, 4, 5, 6, 7, 8, 9,
1178 10, 11, 12, -1, -1, -1, -1, -1, -1, -1,
1179 -1, 21, 22, 23, 24, 25, 26, 27, 28, 29,
1180 30, 31, 32, -1, -1, -1, 36, 37, 38, 39,
1181 -1, 41, 42, 43, 44, -1, 46, 10, 11, 12,
1182 -1, -1, -1, -1, -1, -1, -1, -1, 21, 22,
1183 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
1184 -1, -1, -1, -1, -1, 38, 39, -1, 41, 42,
1185 43, 44, 45, 46, 10, 11, 12, 50, -1, -1,
1186 -1, -1, -1, -1, -1, 21, 22, 23, 24, 25,
1187 26, 27, 28, 29, 30, 31, 32, -1, -1, -1,
1188 -1, -1, 38, 39, -1, 41, 42, 43, 44, -1,
1189 46
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001190};
1191
1192/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
1193 symbol of state STATE-NUM. */
1194static const yytype_uint8 yystos[] =
1195{
1196 0, 3, 4, 5, 6, 7, 8, 9, 10, 11,
1197 12, 21, 22, 23, 24, 25, 26, 27, 28, 29,
zmo@google.com09c323a2011-08-12 18:22:25 +00001198 30, 31, 32, 36, 37, 38, 39, 41, 42, 43,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001199 44, 46, 126, 127, 128, 129, 130, 135, 136, 137,
1200 138, 139, 140, 141, 142, 143, 172, 173, 174, 37,
1201 45, 140, 45, 76, 82, 175, 73, 79, 3, 33,
1202 34, 35, 132, 133, 138, 79, 82, 45, 139, 141,
1203 74, 0, 173, 141, 76, 145, 76, 158, 132, 131,
1204 134, 139, 133, 45, 72, 74, 81, 45, 47, 48,
1205 49, 50, 53, 54, 72, 83, 84, 86, 97, 98,
1206 99, 101, 102, 103, 104, 105, 106, 107, 108, 109,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001207 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001208 120, 121, 125, 142, 82, 144, 139, 146, 147, 13,
1209 14, 15, 17, 18, 19, 20, 40, 76, 77, 82,
1210 108, 121, 122, 124, 126, 127, 142, 151, 152, 153,
1211 154, 159, 160, 161, 164, 171, 45, 131, 134, 74,
1212 81, 75, 125, 122, 150, 108, 108, 124, 53, 54,
1213 74, 78, 73, 73, 79, 39, 122, 72, 108, 87,
1214 88, 84, 86, 55, 56, 90, 91, 57, 58, 59,
1215 61, 60, 95, 75, 146, 45, 148, 149, 77, 147,
1216 82, 82, 166, 72, 72, 82, 82, 124, 72, 77,
1217 155, 62, 63, 64, 71, 81, 123, 79, 82, 77,
1218 152, 74, 75, 125, 150, 75, 73, 100, 124, 45,
1219 50, 103, 122, 108, 108, 110, 110, 112, 112, 112,
1220 112, 113, 113, 117, 118, 119, 124, 77, 74, 79,
1221 82, 152, 167, 124, 82, 165, 159, 122, 122, 125,
1222 75, 75, 80, 125, 149, 40, 151, 160, 168, 73,
1223 124, 137, 163, 156, 75, 122, 75, 72, 163, 169,
1224 170, 152, 162, 45, 73, 77, 124, 82, 73, 16,
1225 81, 153, 157, 158, 73, 124, 157, 152, 150, 82
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001226};
1227
1228#define yyerrok (yyerrstatus = 0)
1229#define yyclearin (yychar = YYEMPTY)
1230#define YYEMPTY (-2)
1231#define YYEOF 0
1232
1233#define YYACCEPT goto yyacceptlab
1234#define YYABORT goto yyabortlab
1235#define YYERROR goto yyerrorlab
1236
1237
1238/* Like YYERROR except do call yyerror. This remains here temporarily
1239 to ease the transition to the new meaning of YYERROR, for GCC.
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001240 Once GCC version 2 has supplanted version 1, this can go. However,
1241 YYFAIL appears to be in use. Nevertheless, it is formally deprecated
1242 in Bison 2.4.2's NEWS entry, where a plan to phase it out is
1243 discussed. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001244
1245#define YYFAIL goto yyerrlab
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001246#if defined YYFAIL
1247 /* This is here to suppress warnings from the GCC cpp's
1248 -Wunused-macros. Normally we don't worry about that warning, but
1249 some users do, and we want to make it easy for users to remove
1250 YYFAIL uses, which will produce warnings from Bison 2.5. */
1251#endif
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001252
1253#define YYRECOVERING() (!!yyerrstatus)
1254
1255#define YYBACKUP(Token, Value) \
1256do \
1257 if (yychar == YYEMPTY && yylen == 1) \
1258 { \
1259 yychar = (Token); \
1260 yylval = (Value); \
1261 yytoken = YYTRANSLATE (yychar); \
1262 YYPOPSTACK (1); \
1263 goto yybackup; \
1264 } \
1265 else \
1266 { \
1267 yyerror (context, YY_("syntax error: cannot back up")); \
1268 YYERROR; \
1269 } \
1270while (YYID (0))
1271
1272
1273#define YYTERROR 1
1274#define YYERRCODE 256
1275
1276
1277/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
1278 If N is 0, then set CURRENT to the empty location which ends
1279 the previous symbol: RHS[0] (always defined). */
1280
1281#define YYRHSLOC(Rhs, K) ((Rhs)[K])
1282#ifndef YYLLOC_DEFAULT
1283# define YYLLOC_DEFAULT(Current, Rhs, N) \
1284 do \
1285 if (YYID (N)) \
1286 { \
1287 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
1288 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
1289 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
1290 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
1291 } \
1292 else \
1293 { \
1294 (Current).first_line = (Current).last_line = \
1295 YYRHSLOC (Rhs, 0).last_line; \
1296 (Current).first_column = (Current).last_column = \
1297 YYRHSLOC (Rhs, 0).last_column; \
1298 } \
1299 while (YYID (0))
1300#endif
1301
1302
1303/* YY_LOCATION_PRINT -- Print the location on the stream.
1304 This macro was not mandated originally: define only if we know
1305 we won't break user code: when these are the locations we know. */
1306
1307#ifndef YY_LOCATION_PRINT
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001308# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001309# define YY_LOCATION_PRINT(File, Loc) \
1310 fprintf (File, "%d.%d-%d.%d", \
1311 (Loc).first_line, (Loc).first_column, \
1312 (Loc).last_line, (Loc).last_column)
1313# else
1314# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1315# endif
1316#endif
1317
1318
1319/* YYLEX -- calling `yylex' with the right arguments. */
1320
1321#ifdef YYLEX_PARAM
1322# define YYLEX yylex (&yylval, YYLEX_PARAM)
1323#else
1324# define YYLEX yylex (&yylval)
1325#endif
1326
1327/* Enable debugging if requested. */
1328#if YYDEBUG
1329
1330# ifndef YYFPRINTF
1331# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1332# define YYFPRINTF fprintf
1333# endif
1334
1335# define YYDPRINTF(Args) \
1336do { \
1337 if (yydebug) \
1338 YYFPRINTF Args; \
1339} while (YYID (0))
1340
1341# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
1342do { \
1343 if (yydebug) \
1344 { \
1345 YYFPRINTF (stderr, "%s ", Title); \
1346 yy_symbol_print (stderr, \
1347 Type, Value, context); \
1348 YYFPRINTF (stderr, "\n"); \
1349 } \
1350} while (YYID (0))
1351
1352
1353/*--------------------------------.
1354| Print this symbol on YYOUTPUT. |
1355`--------------------------------*/
1356
1357/*ARGSUSED*/
1358#if (defined __STDC__ || defined __C99__FUNC__ \
1359 || defined __cplusplus || defined _MSC_VER)
1360static void
1361yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, TParseContext* context)
1362#else
1363static void
1364yy_symbol_value_print (yyoutput, yytype, yyvaluep, context)
1365 FILE *yyoutput;
1366 int yytype;
1367 YYSTYPE const * const yyvaluep;
1368 TParseContext* context;
1369#endif
1370{
1371 if (!yyvaluep)
1372 return;
1373 YYUSE (context);
1374# ifdef YYPRINT
1375 if (yytype < YYNTOKENS)
1376 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1377# else
1378 YYUSE (yyoutput);
1379# endif
1380 switch (yytype)
1381 {
1382 default:
1383 break;
1384 }
1385}
1386
1387
1388/*--------------------------------.
1389| Print this symbol on YYOUTPUT. |
1390`--------------------------------*/
1391
1392#if (defined __STDC__ || defined __C99__FUNC__ \
1393 || defined __cplusplus || defined _MSC_VER)
1394static void
1395yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, TParseContext* context)
1396#else
1397static void
1398yy_symbol_print (yyoutput, yytype, yyvaluep, context)
1399 FILE *yyoutput;
1400 int yytype;
1401 YYSTYPE const * const yyvaluep;
1402 TParseContext* context;
1403#endif
1404{
1405 if (yytype < YYNTOKENS)
1406 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1407 else
1408 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1409
1410 yy_symbol_value_print (yyoutput, yytype, yyvaluep, context);
1411 YYFPRINTF (yyoutput, ")");
1412}
1413
1414/*------------------------------------------------------------------.
1415| yy_stack_print -- Print the state stack from its BOTTOM up to its |
1416| TOP (included). |
1417`------------------------------------------------------------------*/
1418
1419#if (defined __STDC__ || defined __C99__FUNC__ \
1420 || defined __cplusplus || defined _MSC_VER)
1421static void
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001422yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001423#else
1424static void
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001425yy_stack_print (yybottom, yytop)
1426 yytype_int16 *yybottom;
1427 yytype_int16 *yytop;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001428#endif
1429{
1430 YYFPRINTF (stderr, "Stack now");
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001431 for (; yybottom <= yytop; yybottom++)
1432 {
1433 int yybot = *yybottom;
1434 YYFPRINTF (stderr, " %d", yybot);
1435 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001436 YYFPRINTF (stderr, "\n");
1437}
1438
1439# define YY_STACK_PRINT(Bottom, Top) \
1440do { \
1441 if (yydebug) \
1442 yy_stack_print ((Bottom), (Top)); \
1443} while (YYID (0))
1444
1445
1446/*------------------------------------------------.
1447| Report that the YYRULE is going to be reduced. |
1448`------------------------------------------------*/
1449
1450#if (defined __STDC__ || defined __C99__FUNC__ \
1451 || defined __cplusplus || defined _MSC_VER)
1452static void
1453yy_reduce_print (YYSTYPE *yyvsp, int yyrule, TParseContext* context)
1454#else
1455static void
1456yy_reduce_print (yyvsp, yyrule, context)
1457 YYSTYPE *yyvsp;
1458 int yyrule;
1459 TParseContext* context;
1460#endif
1461{
1462 int yynrhs = yyr2[yyrule];
1463 int yyi;
1464 unsigned long int yylno = yyrline[yyrule];
1465 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1466 yyrule - 1, yylno);
1467 /* The symbols being reduced. */
1468 for (yyi = 0; yyi < yynrhs; yyi++)
1469 {
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001470 YYFPRINTF (stderr, " $%d = ", yyi + 1);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001471 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1472 &(yyvsp[(yyi + 1) - (yynrhs)])
1473 , context);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001474 YYFPRINTF (stderr, "\n");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001475 }
1476}
1477
1478# define YY_REDUCE_PRINT(Rule) \
1479do { \
1480 if (yydebug) \
1481 yy_reduce_print (yyvsp, Rule, context); \
1482} while (YYID (0))
1483
1484/* Nonzero means print parse trace. It is left uninitialized so that
1485 multiple parsers can coexist. */
1486int yydebug;
1487#else /* !YYDEBUG */
1488# define YYDPRINTF(Args)
1489# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1490# define YY_STACK_PRINT(Bottom, Top)
1491# define YY_REDUCE_PRINT(Rule)
1492#endif /* !YYDEBUG */
1493
1494
1495/* YYINITDEPTH -- initial size of the parser's stacks. */
1496#ifndef YYINITDEPTH
1497# define YYINITDEPTH 200
1498#endif
1499
1500/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1501 if the built-in stack extension method is used).
1502
1503 Do not make this value too large; the results are undefined if
1504 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1505 evaluated with infinite-precision integer arithmetic. */
1506
1507#ifndef YYMAXDEPTH
1508# define YYMAXDEPTH 10000
1509#endif
1510
1511
1512
1513#if YYERROR_VERBOSE
1514
1515# ifndef yystrlen
1516# if defined __GLIBC__ && defined _STRING_H
1517# define yystrlen strlen
1518# else
1519/* Return the length of YYSTR. */
1520#if (defined __STDC__ || defined __C99__FUNC__ \
1521 || defined __cplusplus || defined _MSC_VER)
1522static YYSIZE_T
1523yystrlen (const char *yystr)
1524#else
1525static YYSIZE_T
1526yystrlen (yystr)
1527 const char *yystr;
1528#endif
1529{
1530 YYSIZE_T yylen;
1531 for (yylen = 0; yystr[yylen]; yylen++)
1532 continue;
1533 return yylen;
1534}
1535# endif
1536# endif
1537
1538# ifndef yystpcpy
1539# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1540# define yystpcpy stpcpy
1541# else
1542/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1543 YYDEST. */
1544#if (defined __STDC__ || defined __C99__FUNC__ \
1545 || defined __cplusplus || defined _MSC_VER)
1546static char *
1547yystpcpy (char *yydest, const char *yysrc)
1548#else
1549static char *
1550yystpcpy (yydest, yysrc)
1551 char *yydest;
1552 const char *yysrc;
1553#endif
1554{
1555 char *yyd = yydest;
1556 const char *yys = yysrc;
1557
1558 while ((*yyd++ = *yys++) != '\0')
1559 continue;
1560
1561 return yyd - 1;
1562}
1563# endif
1564# endif
1565
1566# ifndef yytnamerr
1567/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1568 quotes and backslashes, so that it's suitable for yyerror. The
1569 heuristic is that double-quoting is unnecessary unless the string
1570 contains an apostrophe, a comma, or backslash (other than
1571 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1572 null, do not copy; instead, return the length of what the result
1573 would have been. */
1574static YYSIZE_T
1575yytnamerr (char *yyres, const char *yystr)
1576{
1577 if (*yystr == '"')
1578 {
1579 YYSIZE_T yyn = 0;
1580 char const *yyp = yystr;
1581
1582 for (;;)
1583 switch (*++yyp)
1584 {
1585 case '\'':
1586 case ',':
1587 goto do_not_strip_quotes;
1588
1589 case '\\':
1590 if (*++yyp != '\\')
1591 goto do_not_strip_quotes;
1592 /* Fall through. */
1593 default:
1594 if (yyres)
1595 yyres[yyn] = *yyp;
1596 yyn++;
1597 break;
1598
1599 case '"':
1600 if (yyres)
1601 yyres[yyn] = '\0';
1602 return yyn;
1603 }
1604 do_not_strip_quotes: ;
1605 }
1606
1607 if (! yyres)
1608 return yystrlen (yystr);
1609
1610 return yystpcpy (yyres, yystr) - yyres;
1611}
1612# endif
1613
1614/* Copy into YYRESULT an error message about the unexpected token
1615 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1616 including the terminating null byte. If YYRESULT is null, do not
1617 copy anything; just return the number of bytes that would be
1618 copied. As a special case, return 0 if an ordinary "syntax error"
1619 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1620 size calculation. */
1621static YYSIZE_T
1622yysyntax_error (char *yyresult, int yystate, int yychar)
1623{
1624 int yyn = yypact[yystate];
1625
1626 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1627 return 0;
1628 else
1629 {
1630 int yytype = YYTRANSLATE (yychar);
1631 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1632 YYSIZE_T yysize = yysize0;
1633 YYSIZE_T yysize1;
1634 int yysize_overflow = 0;
1635 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1636 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1637 int yyx;
1638
1639# if 0
1640 /* This is so xgettext sees the translatable formats that are
1641 constructed on the fly. */
1642 YY_("syntax error, unexpected %s");
1643 YY_("syntax error, unexpected %s, expecting %s");
1644 YY_("syntax error, unexpected %s, expecting %s or %s");
1645 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1646 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1647# endif
1648 char *yyfmt;
1649 char const *yyf;
1650 static char const yyunexpected[] = "syntax error, unexpected %s";
1651 static char const yyexpecting[] = ", expecting %s";
1652 static char const yyor[] = " or %s";
1653 char yyformat[sizeof yyunexpected
1654 + sizeof yyexpecting - 1
1655 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1656 * (sizeof yyor - 1))];
1657 char const *yyprefix = yyexpecting;
1658
1659 /* Start YYX at -YYN if negative to avoid negative indexes in
1660 YYCHECK. */
1661 int yyxbegin = yyn < 0 ? -yyn : 0;
1662
1663 /* Stay within bounds of both yycheck and yytname. */
1664 int yychecklim = YYLAST - yyn + 1;
1665 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1666 int yycount = 1;
1667
1668 yyarg[0] = yytname[yytype];
1669 yyfmt = yystpcpy (yyformat, yyunexpected);
1670
1671 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1672 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1673 {
1674 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1675 {
1676 yycount = 1;
1677 yysize = yysize0;
1678 yyformat[sizeof yyunexpected - 1] = '\0';
1679 break;
1680 }
1681 yyarg[yycount++] = yytname[yyx];
1682 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1683 yysize_overflow |= (yysize1 < yysize);
1684 yysize = yysize1;
1685 yyfmt = yystpcpy (yyfmt, yyprefix);
1686 yyprefix = yyor;
1687 }
1688
1689 yyf = YY_(yyformat);
1690 yysize1 = yysize + yystrlen (yyf);
1691 yysize_overflow |= (yysize1 < yysize);
1692 yysize = yysize1;
1693
1694 if (yysize_overflow)
1695 return YYSIZE_MAXIMUM;
1696
1697 if (yyresult)
1698 {
1699 /* Avoid sprintf, as that infringes on the user's name space.
1700 Don't have undefined behavior even if the translation
1701 produced a string with the wrong number of "%s"s. */
1702 char *yyp = yyresult;
1703 int yyi = 0;
1704 while ((*yyp = *yyf) != '\0')
1705 {
1706 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1707 {
1708 yyp += yytnamerr (yyp, yyarg[yyi++]);
1709 yyf += 2;
1710 }
1711 else
1712 {
1713 yyp++;
1714 yyf++;
1715 }
1716 }
1717 }
1718 return yysize;
1719 }
1720}
1721#endif /* YYERROR_VERBOSE */
1722
1723
1724/*-----------------------------------------------.
1725| Release the memory associated to this symbol. |
1726`-----------------------------------------------*/
1727
1728/*ARGSUSED*/
1729#if (defined __STDC__ || defined __C99__FUNC__ \
1730 || defined __cplusplus || defined _MSC_VER)
1731static void
1732yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, TParseContext* context)
1733#else
1734static void
1735yydestruct (yymsg, yytype, yyvaluep, context)
1736 const char *yymsg;
1737 int yytype;
1738 YYSTYPE *yyvaluep;
1739 TParseContext* context;
1740#endif
1741{
1742 YYUSE (yyvaluep);
1743 YYUSE (context);
1744
1745 if (!yymsg)
1746 yymsg = "Deleting";
1747 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1748
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001749 switch (yytype)
1750 {
1751
1752 default:
1753 break;
1754 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001755}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001756
1757/* Prevent warnings from -Wmissing-prototypes. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001758#ifdef YYPARSE_PARAM
1759#if defined __STDC__ || defined __cplusplus
1760int yyparse (void *YYPARSE_PARAM);
1761#else
1762int yyparse ();
1763#endif
1764#else /* ! YYPARSE_PARAM */
1765#if defined __STDC__ || defined __cplusplus
1766int yyparse (TParseContext* context);
1767#else
1768int yyparse ();
1769#endif
1770#endif /* ! YYPARSE_PARAM */
1771
1772
1773
1774
1775
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001776/*-------------------------.
1777| yyparse or yypush_parse. |
1778`-------------------------*/
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001779
1780#ifdef YYPARSE_PARAM
1781#if (defined __STDC__ || defined __C99__FUNC__ \
1782 || defined __cplusplus || defined _MSC_VER)
1783int
1784yyparse (void *YYPARSE_PARAM)
1785#else
1786int
1787yyparse (YYPARSE_PARAM)
1788 void *YYPARSE_PARAM;
1789#endif
1790#else /* ! YYPARSE_PARAM */
1791#if (defined __STDC__ || defined __C99__FUNC__ \
1792 || defined __cplusplus || defined _MSC_VER)
1793int
1794yyparse (TParseContext* context)
1795#else
1796int
1797yyparse (context)
1798 TParseContext* context;
1799#endif
1800#endif
1801{
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001802/* The lookahead symbol. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001803int yychar;
1804
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001805/* The semantic value of the lookahead symbol. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001806YYSTYPE yylval;
1807
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001808 /* Number of syntax errors so far. */
1809 int yynerrs;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001810
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001811 int yystate;
1812 /* Number of tokens to shift before error messages enabled. */
1813 int yyerrstatus;
1814
1815 /* The stacks and their tools:
1816 `yyss': related to states.
1817 `yyvs': related to semantic values.
1818
1819 Refer to the stacks thru separate pointers, to allow yyoverflow
1820 to reallocate them elsewhere. */
1821
1822 /* The state stack. */
1823 yytype_int16 yyssa[YYINITDEPTH];
1824 yytype_int16 *yyss;
1825 yytype_int16 *yyssp;
1826
1827 /* The semantic value stack. */
1828 YYSTYPE yyvsa[YYINITDEPTH];
1829 YYSTYPE *yyvs;
1830 YYSTYPE *yyvsp;
1831
1832 YYSIZE_T yystacksize;
1833
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001834 int yyn;
1835 int yyresult;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001836 /* Lookahead token as an internal (translated) token number. */
1837 int yytoken;
1838 /* The variables used to return semantic value and location from the
1839 action routines. */
1840 YYSTYPE yyval;
1841
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001842#if YYERROR_VERBOSE
1843 /* Buffer for error messages, and its allocated size. */
1844 char yymsgbuf[128];
1845 char *yymsg = yymsgbuf;
1846 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1847#endif
1848
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001849#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1850
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001851 /* The number of symbols on the RHS of the reduced rule.
1852 Keep to zero when no symbol should be popped. */
1853 int yylen = 0;
1854
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001855 yytoken = 0;
1856 yyss = yyssa;
1857 yyvs = yyvsa;
1858 yystacksize = YYINITDEPTH;
1859
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001860 YYDPRINTF ((stderr, "Starting parse\n"));
1861
1862 yystate = 0;
1863 yyerrstatus = 0;
1864 yynerrs = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001865 yychar = YYEMPTY; /* Cause a token to be read. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001866
1867 /* Initialize stack pointers.
1868 Waste one element of value and location stack
1869 so that they stay on the same level as the state stack.
1870 The wasted elements are never initialized. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001871 yyssp = yyss;
1872 yyvsp = yyvs;
1873
1874 goto yysetstate;
1875
1876/*------------------------------------------------------------.
1877| yynewstate -- Push a new state, which is found in yystate. |
1878`------------------------------------------------------------*/
1879 yynewstate:
1880 /* In all cases, when you get here, the value and location stacks
1881 have just been pushed. So pushing a state here evens the stacks. */
1882 yyssp++;
1883
1884 yysetstate:
1885 *yyssp = yystate;
1886
1887 if (yyss + yystacksize - 1 <= yyssp)
1888 {
1889 /* Get the current used size of the three stacks, in elements. */
1890 YYSIZE_T yysize = yyssp - yyss + 1;
1891
1892#ifdef yyoverflow
1893 {
1894 /* Give user a chance to reallocate the stack. Use copies of
1895 these so that the &'s don't force the real ones into
1896 memory. */
1897 YYSTYPE *yyvs1 = yyvs;
1898 yytype_int16 *yyss1 = yyss;
1899
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001900 /* Each stack pointer address is followed by the size of the
1901 data in use in that stack, in bytes. This used to be a
1902 conditional around just the two extra args, but that might
1903 be undefined if yyoverflow is a macro. */
1904 yyoverflow (YY_("memory exhausted"),
1905 &yyss1, yysize * sizeof (*yyssp),
1906 &yyvs1, yysize * sizeof (*yyvsp),
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001907 &yystacksize);
1908
1909 yyss = yyss1;
1910 yyvs = yyvs1;
1911 }
1912#else /* no yyoverflow */
1913# ifndef YYSTACK_RELOCATE
1914 goto yyexhaustedlab;
1915# else
1916 /* Extend the stack our own way. */
1917 if (YYMAXDEPTH <= yystacksize)
1918 goto yyexhaustedlab;
1919 yystacksize *= 2;
1920 if (YYMAXDEPTH < yystacksize)
1921 yystacksize = YYMAXDEPTH;
1922
1923 {
1924 yytype_int16 *yyss1 = yyss;
1925 union yyalloc *yyptr =
1926 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1927 if (! yyptr)
1928 goto yyexhaustedlab;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001929 YYSTACK_RELOCATE (yyss_alloc, yyss);
1930 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001931# undef YYSTACK_RELOCATE
1932 if (yyss1 != yyssa)
1933 YYSTACK_FREE (yyss1);
1934 }
1935# endif
1936#endif /* no yyoverflow */
1937
1938 yyssp = yyss + yysize - 1;
1939 yyvsp = yyvs + yysize - 1;
1940
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001941 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1942 (unsigned long int) yystacksize));
1943
1944 if (yyss + yystacksize - 1 <= yyssp)
1945 YYABORT;
1946 }
1947
1948 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1949
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001950 if (yystate == YYFINAL)
1951 YYACCEPT;
1952
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001953 goto yybackup;
1954
1955/*-----------.
1956| yybackup. |
1957`-----------*/
1958yybackup:
1959
1960 /* Do appropriate processing given the current state. Read a
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001961 lookahead token if we need one and don't already have one. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001962
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001963 /* First try to decide what to do without reference to lookahead token. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001964 yyn = yypact[yystate];
1965 if (yyn == YYPACT_NINF)
1966 goto yydefault;
1967
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001968 /* Not known => get a lookahead token if don't already have one. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001969
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001970 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001971 if (yychar == YYEMPTY)
1972 {
1973 YYDPRINTF ((stderr, "Reading a token: "));
1974 yychar = YYLEX;
1975 }
1976
1977 if (yychar <= YYEOF)
1978 {
1979 yychar = yytoken = YYEOF;
1980 YYDPRINTF ((stderr, "Now at end of input.\n"));
1981 }
1982 else
1983 {
1984 yytoken = YYTRANSLATE (yychar);
1985 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1986 }
1987
1988 /* If the proper action on seeing token YYTOKEN is to reduce or to
1989 detect an error, take that action. */
1990 yyn += yytoken;
1991 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1992 goto yydefault;
1993 yyn = yytable[yyn];
1994 if (yyn <= 0)
1995 {
1996 if (yyn == 0 || yyn == YYTABLE_NINF)
1997 goto yyerrlab;
1998 yyn = -yyn;
1999 goto yyreduce;
2000 }
2001
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002002 /* Count tokens shifted since error; after three, turn off error
2003 status. */
2004 if (yyerrstatus)
2005 yyerrstatus--;
2006
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002007 /* Shift the lookahead token. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002008 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
2009
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002010 /* Discard the shifted token. */
2011 yychar = YYEMPTY;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002012
2013 yystate = yyn;
2014 *++yyvsp = yylval;
2015
2016 goto yynewstate;
2017
2018
2019/*-----------------------------------------------------------.
2020| yydefault -- do the default action for the current state. |
2021`-----------------------------------------------------------*/
2022yydefault:
2023 yyn = yydefact[yystate];
2024 if (yyn == 0)
2025 goto yyerrlab;
2026 goto yyreduce;
2027
2028
2029/*-----------------------------.
2030| yyreduce -- Do a reduction. |
2031`-----------------------------*/
2032yyreduce:
2033 /* yyn is the number of a rule to reduce with. */
2034 yylen = yyr2[yyn];
2035
2036 /* If YYLEN is nonzero, implement the default value of the action:
2037 `$$ = $1'.
2038
2039 Otherwise, the following line sets YYVAL to garbage.
2040 This behavior is undocumented and Bison
2041 users should not rely upon it. Assigning to YYVAL
2042 unconditionally makes the parser a bit smaller, and it avoids a
2043 GCC warning that YYVAL may be used uninitialized. */
2044 yyval = yyvsp[1-yylen];
2045
2046
2047 YY_REDUCE_PRINT (yyn);
2048 switch (yyn)
2049 {
2050 case 2:
2051
2052 {
2053 // The symbol table search was done in the lexical phase
2054 const TSymbol* symbol = (yyvsp[(1) - (1)].lex).symbol;
2055 const TVariable* variable;
2056 if (symbol == 0) {
2057 context->error((yyvsp[(1) - (1)].lex).line, "undeclared identifier", (yyvsp[(1) - (1)].lex).string->c_str(), "");
2058 context->recover();
2059 TType type(EbtFloat, EbpUndefined);
2060 TVariable* fakeVariable = new TVariable((yyvsp[(1) - (1)].lex).string, type);
2061 context->symbolTable.insert(*fakeVariable);
2062 variable = fakeVariable;
2063 } else {
2064 // This identifier can only be a variable type symbol
2065 if (! symbol->isVariable()) {
2066 context->error((yyvsp[(1) - (1)].lex).line, "variable expected", (yyvsp[(1) - (1)].lex).string->c_str(), "");
2067 context->recover();
2068 }
2069 variable = static_cast<const TVariable*>(symbol);
2070 }
2071
2072 // don't delete $1.string, it's used by error recovery, and the pool
2073 // pop will reclaim the memory
2074
2075 if (variable->getType().getQualifier() == EvqConst ) {
2076 ConstantUnion* constArray = variable->getConstPointer();
2077 TType t(variable->getType());
2078 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(constArray, t, (yyvsp[(1) - (1)].lex).line);
2079 } else
2080 (yyval.interm.intermTypedNode) = context->intermediate.addSymbol(variable->getUniqueId(),
2081 variable->getName(),
2082 variable->getType(), (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002083 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002084 break;
2085
2086 case 3:
2087
2088 {
2089 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002090 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002091 break;
2092
2093 case 4:
2094
2095 {
2096 //
2097 // INT_TYPE is only 16-bit plus sign bit for vertex/fragment shaders,
2098 // check for overflow for constants
2099 //
2100 if (abs((yyvsp[(1) - (1)].lex).i) >= (1 << 16)) {
2101 context->error((yyvsp[(1) - (1)].lex).line, " integer constant overflow", "", "");
2102 context->recover();
2103 }
2104 ConstantUnion *unionArray = new ConstantUnion[1];
2105 unionArray->setIConst((yyvsp[(1) - (1)].lex).i);
2106 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002107 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002108 break;
2109
2110 case 5:
2111
2112 {
2113 ConstantUnion *unionArray = new ConstantUnion[1];
2114 unionArray->setFConst((yyvsp[(1) - (1)].lex).f);
2115 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002116 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002117 break;
2118
2119 case 6:
2120
2121 {
2122 ConstantUnion *unionArray = new ConstantUnion[1];
2123 unionArray->setBConst((yyvsp[(1) - (1)].lex).b);
2124 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002125 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002126 break;
2127
2128 case 7:
2129
2130 {
2131 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (3)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002132 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002133 break;
2134
2135 case 8:
2136
2137 {
2138 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002139 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002140 break;
2141
2142 case 9:
2143
2144 {
2145 if (!(yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isVector()) {
2146 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode())
2147 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(), "");
2148 else
2149 context->error((yyvsp[(2) - (4)].lex).line, " left of '[' is not of type array, matrix, or vector ", "expression", "");
2150 context->recover();
2151 }
2152 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst && (yyvsp[(3) - (4)].interm.intermTypedNode)->getQualifier() == EvqConst) {
2153 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) { // constant folding for arrays
2154 (yyval.interm.intermTypedNode) = context->addConstArrayNode((yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2155 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector()) { // constant folding for vectors
2156 TVectorFields fields;
2157 fields.num = 1;
2158 fields.offsets[0] = (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(); // need to do it this way because v.xy sends fields integer array
2159 (yyval.interm.intermTypedNode) = context->addConstVectorNode(fields, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2160 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix()) { // constant folding for matrices
2161 (yyval.interm.intermTypedNode) = context->addConstMatrixNode((yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2162 }
2163 } else {
2164 if ((yyvsp[(3) - (4)].interm.intermTypedNode)->getQualifier() == EvqConst) {
2165 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() ) {
2166 context->error((yyvsp[(2) - (4)].lex).line, "", "[", "field selection out of range '%d'", (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst());
2167 context->recover();
2168 } else {
2169 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) {
2170 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize() == 0) {
2171 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getMaxArraySize() <= (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst()) {
2172 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))
2173 context->recover();
2174 } else {
2175 if (context->arraySetMaxSize((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getTypePointer(), 0, false, (yyvsp[(2) - (4)].lex).line))
2176 context->recover();
2177 }
2178 } else if ( (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst() >= (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize()) {
2179 context->error((yyvsp[(2) - (4)].lex).line, "", "[", "array index out of range '%d'", (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst());
2180 context->recover();
2181 }
2182 }
2183 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(3) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2184 }
2185 } else {
2186 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize() == 0) {
2187 context->error((yyvsp[(2) - (4)].lex).line, "", "[", "array must be redeclared with a size before being indexed with a variable");
2188 context->recover();
2189 }
2190
2191 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexIndirect, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(3) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2192 }
2193 }
2194 if ((yyval.interm.intermTypedNode) == 0) {
2195 ConstantUnion *unionArray = new ConstantUnion[1];
2196 unionArray->setFConst(0.0f);
2197 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpHigh, EvqConst), (yyvsp[(2) - (4)].lex).line);
2198 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) {
2199 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getStruct())
2200 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getStruct(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getTypeName()));
2201 else
2202 (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()));
2203
2204 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst)
2205 (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConst);
2206 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst)
2207 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqConst, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize()));
2208 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix())
2209 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize()));
2210 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst)
2211 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqConst));
2212 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector())
2213 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary));
2214 else
2215 (yyval.interm.intermTypedNode)->setType((yyvsp[(1) - (4)].interm.intermTypedNode)->getType());
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002216 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002217 break;
2218
2219 case 10:
2220
2221 {
2222 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002223 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002224 break;
2225
2226 case 11:
2227
2228 {
2229 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isArray()) {
2230 context->error((yyvsp[(3) - (3)].lex).line, "cannot apply dot operator to an array", ".", "");
2231 context->recover();
2232 }
2233
2234 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isVector()) {
2235 TVectorFields fields;
2236 if (! context->parseVectorFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yyvsp[(3) - (3)].lex).line)) {
2237 fields.num = 1;
2238 fields.offsets[0] = 0;
2239 context->recover();
2240 }
2241
2242 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) { // constant folding for vector fields
2243 (yyval.interm.intermTypedNode) = context->addConstVectorNode(fields, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].lex).line);
2244 if ((yyval.interm.intermTypedNode) == 0) {
2245 context->recover();
2246 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2247 }
2248 else
2249 (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()));
2250 } else {
2251 if (fields.num == 1) {
2252 ConstantUnion *unionArray = new ConstantUnion[1];
2253 unionArray->setIConst(fields.offsets[0]);
2254 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line);
2255 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2256 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision()));
2257 } else {
2258 TString vectorString = *(yyvsp[(3) - (3)].lex).string;
2259 TIntermTyped* index = context->intermediate.addSwizzle(fields, (yyvsp[(3) - (3)].lex).line);
2260 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpVectorSwizzle, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2261 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (int) vectorString.size()));
2262 }
2263 }
2264 } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isMatrix()) {
2265 TMatrixFields fields;
2266 if (! context->parseMatrixFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yyvsp[(3) - (3)].lex).line)) {
2267 fields.wholeRow = false;
2268 fields.wholeCol = false;
2269 fields.row = 0;
2270 fields.col = 0;
2271 context->recover();
2272 }
2273
2274 if (fields.wholeRow || fields.wholeCol) {
2275 context->error((yyvsp[(2) - (3)].lex).line, " non-scalar fields not implemented yet", ".", "");
2276 context->recover();
2277 ConstantUnion *unionArray = new ConstantUnion[1];
2278 unionArray->setIConst(0);
2279 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line);
2280 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2281 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(),EvqTemporary, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize()));
2282 } else {
2283 ConstantUnion *unionArray = new ConstantUnion[1];
2284 unionArray->setIConst(fields.col * (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize() + fields.row);
2285 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line);
2286 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2287 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision()));
2288 }
2289 } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType() == EbtStruct) {
2290 bool fieldFound = false;
2291 const TTypeList* fields = (yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getStruct();
2292 if (fields == 0) {
2293 context->error((yyvsp[(2) - (3)].lex).line, "structure has no fields", "Internal Error", "");
2294 context->recover();
2295 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2296 } else {
2297 unsigned int i;
2298 for (i = 0; i < fields->size(); ++i) {
2299 if ((*fields)[i].type->getFieldName() == *(yyvsp[(3) - (3)].lex).string) {
2300 fieldFound = true;
2301 break;
2302 }
2303 }
2304 if (fieldFound) {
2305 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) {
2306 (yyval.interm.intermTypedNode) = context->addConstStruct(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
2307 if ((yyval.interm.intermTypedNode) == 0) {
2308 context->recover();
2309 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2310 }
2311 else {
2312 (yyval.interm.intermTypedNode)->setType(*(*fields)[i].type);
2313 // change the qualifier of the return type, not of the structure field
2314 // as the structure definition is shared between various structures.
2315 (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConst);
2316 }
2317 } else {
2318 ConstantUnion *unionArray = new ConstantUnion[1];
2319 unionArray->setIConst(i);
2320 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, *(*fields)[i].type, (yyvsp[(3) - (3)].lex).line);
2321 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirectStruct, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2322 (yyval.interm.intermTypedNode)->setType(*(*fields)[i].type);
2323 }
2324 } else {
2325 context->error((yyvsp[(2) - (3)].lex).line, " no such field in structure", (yyvsp[(3) - (3)].lex).string->c_str(), "");
2326 context->recover();
2327 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2328 }
2329 }
2330 } else {
2331 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(), "");
2332 context->recover();
2333 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2334 }
2335 // don't delete $3.string, it's from the pool
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002336 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002337 break;
2338
2339 case 12:
2340
2341 {
2342 if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode)))
2343 context->recover();
2344 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostIncrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line, context->symbolTable);
2345 if ((yyval.interm.intermTypedNode) == 0) {
2346 context->unaryOpError((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
2347 context->recover();
2348 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode);
2349 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002350 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002351 break;
2352
2353 case 13:
2354
2355 {
2356 if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode)))
2357 context->recover();
2358 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostDecrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line, context->symbolTable);
2359 if ((yyval.interm.intermTypedNode) == 0) {
2360 context->unaryOpError((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
2361 context->recover();
2362 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode);
2363 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002364 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002365 break;
2366
2367 case 14:
2368
2369 {
2370 if (context->integerErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode), "[]"))
2371 context->recover();
2372 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002373 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002374 break;
2375
2376 case 15:
2377
2378 {
2379 TFunction* fnCall = (yyvsp[(1) - (1)].interm).function;
2380 TOperator op = fnCall->getBuiltInOp();
2381
2382 if (op != EOpNull)
2383 {
2384 //
2385 // Then this should be a constructor.
2386 // Don't go through the symbol table for constructors.
2387 // Their parameters will be verified algorithmically.
2388 //
2389 TType type(EbtVoid, EbpUndefined); // use this to get the type back
2390 if (context->constructorErrorCheck((yyvsp[(1) - (1)].interm).line, (yyvsp[(1) - (1)].interm).intermNode, *fnCall, op, &type)) {
2391 (yyval.interm.intermTypedNode) = 0;
2392 } else {
2393 //
2394 // It's a constructor, of type 'type'.
2395 //
2396 (yyval.interm.intermTypedNode) = context->addConstructor((yyvsp[(1) - (1)].interm).intermNode, &type, op, fnCall, (yyvsp[(1) - (1)].interm).line);
2397 }
2398
2399 if ((yyval.interm.intermTypedNode) == 0) {
2400 context->recover();
2401 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator(0, op, (yyvsp[(1) - (1)].interm).line);
2402 }
2403 (yyval.interm.intermTypedNode)->setType(type);
2404 } else {
2405 //
2406 // Not a constructor. Find it in the symbol table.
2407 //
2408 const TFunction* fnCandidate;
2409 bool builtIn;
2410 fnCandidate = context->findFunction((yyvsp[(1) - (1)].interm).line, fnCall, &builtIn);
2411 if (fnCandidate) {
2412 //
2413 // A declared function.
2414 //
2415 if (builtIn && !fnCandidate->getExtension().empty() &&
2416 context->extensionErrorCheck((yyvsp[(1) - (1)].interm).line, fnCandidate->getExtension())) {
2417 context->recover();
2418 }
2419 op = fnCandidate->getBuiltInOp();
2420 if (builtIn && op != EOpNull) {
2421 //
2422 // A function call mapped to a built-in operation.
2423 //
2424 if (fnCandidate->getParamCount() == 1) {
2425 //
2426 // Treat it like a built-in unary operator.
2427 //
2428 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(op, (yyvsp[(1) - (1)].interm).intermNode, 0, context->symbolTable);
2429 if ((yyval.interm.intermTypedNode) == 0) {
2430 context->error((yyvsp[(1) - (1)].interm).intermNode->getLine(), " wrong operand type", "Internal Error",
2431 "built in unary operator function. Type: %s",
2432 static_cast<TIntermTyped*>((yyvsp[(1) - (1)].interm).intermNode)->getCompleteString().c_str());
2433 YYERROR;
2434 }
2435 } else {
2436 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, op, (yyvsp[(1) - (1)].interm).line);
2437 }
2438 } else {
2439 // This is a real function call
2440
2441 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, EOpFunctionCall, (yyvsp[(1) - (1)].interm).line);
2442 (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType());
2443
2444 // this is how we know whether the given function is a builtIn function or a user defined function
2445 // if builtIn == false, it's a userDefined -> could be an overloaded builtIn function also
2446 // if builtIn == true, it's definitely a builtIn function with EOpNull
2447 if (!builtIn)
2448 (yyval.interm.intermTypedNode)->getAsAggregate()->setUserDefined();
2449 (yyval.interm.intermTypedNode)->getAsAggregate()->setName(fnCandidate->getMangledName());
2450
2451 TQualifier qual;
2452 for (int i = 0; i < fnCandidate->getParamCount(); ++i) {
2453 qual = fnCandidate->getParam(i).type->getQualifier();
2454 if (qual == EvqOut || qual == EvqInOut) {
2455 if (context->lValueErrorCheck((yyval.interm.intermTypedNode)->getLine(), "assign", (yyval.interm.intermTypedNode)->getAsAggregate()->getSequence()[i]->getAsTyped())) {
2456 context->error((yyvsp[(1) - (1)].interm).intermNode->getLine(), "Constant value cannot be passed for 'out' or 'inout' parameters.", "Error", "");
2457 context->recover();
2458 }
2459 }
2460 }
2461 }
2462 (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType());
2463 } else {
2464 // error message was put out by PaFindFunction()
2465 // Put on a dummy node for error recovery
2466 ConstantUnion *unionArray = new ConstantUnion[1];
2467 unionArray->setFConst(0.0f);
2468 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].interm).line);
2469 context->recover();
2470 }
2471 }
2472 delete fnCall;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002473 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002474 break;
2475
2476 case 16:
2477
2478 {
2479 (yyval.interm) = (yyvsp[(1) - (1)].interm);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002480 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002481 break;
2482
2483 case 17:
2484
2485 {
2486 context->error((yyvsp[(3) - (3)].interm).line, "methods are not supported", "", "");
2487 context->recover();
2488 (yyval.interm) = (yyvsp[(3) - (3)].interm);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002489 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002490 break;
2491
2492 case 18:
2493
2494 {
2495 (yyval.interm) = (yyvsp[(1) - (2)].interm);
2496 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002497 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002498 break;
2499
2500 case 19:
2501
2502 {
2503 (yyval.interm) = (yyvsp[(1) - (2)].interm);
2504 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002505 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002506 break;
2507
2508 case 20:
2509
2510 {
2511 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
2512 (yyval.interm).intermNode = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002513 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002514 break;
2515
2516 case 21:
2517
2518 {
2519 (yyval.interm).function = (yyvsp[(1) - (1)].interm.function);
2520 (yyval.interm).intermNode = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002521 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002522 break;
2523
2524 case 22:
2525
2526 {
2527 TParameter param = { 0, new TType((yyvsp[(2) - (2)].interm.intermTypedNode)->getType()) };
2528 (yyvsp[(1) - (2)].interm.function)->addParameter(param);
2529 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
2530 (yyval.interm).intermNode = (yyvsp[(2) - (2)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002531 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002532 break;
2533
2534 case 23:
2535
2536 {
2537 TParameter param = { 0, new TType((yyvsp[(3) - (3)].interm.intermTypedNode)->getType()) };
2538 (yyvsp[(1) - (3)].interm).function->addParameter(param);
2539 (yyval.interm).function = (yyvsp[(1) - (3)].interm).function;
2540 (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 +00002541 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002542 break;
2543
2544 case 24:
2545
2546 {
2547 (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002548 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002549 break;
2550
2551 case 25:
2552
2553 {
2554 //
2555 // Constructor
2556 //
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002557 TOperator op = EOpNull;
2558 if ((yyvsp[(1) - (1)].interm.type).userDef) {
2559 op = EOpConstructStruct;
2560 } else {
2561 switch ((yyvsp[(1) - (1)].interm.type).type) {
2562 case EbtFloat:
2563 if ((yyvsp[(1) - (1)].interm.type).matrix) {
2564 switch((yyvsp[(1) - (1)].interm.type).size) {
2565 case 2: op = EOpConstructMat2; break;
2566 case 3: op = EOpConstructMat3; break;
2567 case 4: op = EOpConstructMat4; break;
2568 }
2569 } else {
2570 switch((yyvsp[(1) - (1)].interm.type).size) {
2571 case 1: op = EOpConstructFloat; break;
2572 case 2: op = EOpConstructVec2; break;
2573 case 3: op = EOpConstructVec3; break;
2574 case 4: op = EOpConstructVec4; break;
2575 }
2576 }
2577 break;
2578 case EbtInt:
2579 switch((yyvsp[(1) - (1)].interm.type).size) {
2580 case 1: op = EOpConstructInt; break;
2581 case 2: FRAG_VERT_ONLY("ivec2", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec2; break;
2582 case 3: FRAG_VERT_ONLY("ivec3", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec3; break;
2583 case 4: FRAG_VERT_ONLY("ivec4", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec4; break;
2584 }
2585 break;
2586 case EbtBool:
2587 switch((yyvsp[(1) - (1)].interm.type).size) {
2588 case 1: op = EOpConstructBool; break;
2589 case 2: FRAG_VERT_ONLY("bvec2", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec2; break;
2590 case 3: FRAG_VERT_ONLY("bvec3", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec3; break;
2591 case 4: FRAG_VERT_ONLY("bvec4", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec4; break;
2592 }
2593 break;
2594 default: break;
2595 }
2596 if (op == EOpNull) {
2597 context->error((yyvsp[(1) - (1)].interm.type).line, "cannot construct this type", getBasicString((yyvsp[(1) - (1)].interm.type).type), "");
2598 context->recover();
2599 (yyvsp[(1) - (1)].interm.type).type = EbtFloat;
2600 op = EOpConstructFloat;
2601 }
2602 }
2603 TString tempString;
2604 TType type((yyvsp[(1) - (1)].interm.type));
2605 TFunction *function = new TFunction(&tempString, type, op);
2606 (yyval.interm.function) = function;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002607 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002608 break;
2609
2610 case 26:
2611
2612 {
2613 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
2614 context->recover();
2615 TType type(EbtVoid, EbpUndefined);
2616 TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type);
2617 (yyval.interm.function) = function;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002618 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002619 break;
2620
2621 case 27:
2622
2623 {
2624 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
2625 context->recover();
2626 TType type(EbtVoid, EbpUndefined);
2627 TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type);
2628 (yyval.interm.function) = function;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002629 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002630 break;
2631
2632 case 28:
2633
2634 {
2635 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002636 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002637 break;
2638
2639 case 29:
2640
2641 {
2642 if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)))
2643 context->recover();
2644 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreIncrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line, context->symbolTable);
2645 if ((yyval.interm.intermTypedNode) == 0) {
2646 context->unaryOpError((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2647 context->recover();
2648 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2649 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002650 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002651 break;
2652
2653 case 30:
2654
2655 {
2656 if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)))
2657 context->recover();
2658 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreDecrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line, context->symbolTable);
2659 if ((yyval.interm.intermTypedNode) == 0) {
2660 context->unaryOpError((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2661 context->recover();
2662 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2663 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002664 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002665 break;
2666
2667 case 31:
2668
2669 {
2670 if ((yyvsp[(1) - (2)].interm).op != EOpNull) {
2671 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath((yyvsp[(1) - (2)].interm).op, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].interm).line, context->symbolTable);
2672 if ((yyval.interm.intermTypedNode) == 0) {
2673 const char* errorOp = "";
2674 switch((yyvsp[(1) - (2)].interm).op) {
2675 case EOpNegative: errorOp = "-"; break;
2676 case EOpLogicalNot: errorOp = "!"; break;
2677 default: break;
2678 }
2679 context->unaryOpError((yyvsp[(1) - (2)].interm).line, errorOp, (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2680 context->recover();
2681 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2682 }
2683 } else
2684 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002685 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002686 break;
2687
2688 case 32:
2689
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002690 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNull; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002691 break;
2692
2693 case 33:
2694
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002695 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNegative; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002696 break;
2697
2698 case 34:
2699
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002700 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpLogicalNot; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002701 break;
2702
2703 case 35:
2704
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002705 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002706 break;
2707
2708 case 36:
2709
2710 {
2711 FRAG_VERT_ONLY("*", (yyvsp[(2) - (3)].lex).line);
2712 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpMul, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2713 if ((yyval.interm.intermTypedNode) == 0) {
2714 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "*", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2715 context->recover();
2716 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2717 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002718 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002719 break;
2720
2721 case 37:
2722
2723 {
2724 FRAG_VERT_ONLY("/", (yyvsp[(2) - (3)].lex).line);
2725 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpDiv, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2726 if ((yyval.interm.intermTypedNode) == 0) {
2727 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "/", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2728 context->recover();
2729 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2730 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002731 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002732 break;
2733
2734 case 38:
2735
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002736 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002737 break;
2738
2739 case 39:
2740
2741 {
2742 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpAdd, (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 40:
2752
2753 {
2754 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpSub, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2755 if ((yyval.interm.intermTypedNode) == 0) {
2756 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "-", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2757 context->recover();
2758 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2759 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002760 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002761 break;
2762
2763 case 41:
2764
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002765 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002766 break;
2767
2768 case 42:
2769
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002770 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002771 break;
2772
2773 case 43:
2774
2775 {
2776 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2777 if ((yyval.interm.intermTypedNode) == 0) {
2778 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2779 context->recover();
2780 ConstantUnion *unionArray = new ConstantUnion[1];
2781 unionArray->setBConst(false);
2782 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2783 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002784 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002785 break;
2786
2787 case 44:
2788
2789 {
2790 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2791 if ((yyval.interm.intermTypedNode) == 0) {
2792 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2793 context->recover();
2794 ConstantUnion *unionArray = new ConstantUnion[1];
2795 unionArray->setBConst(false);
2796 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2797 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002798 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002799 break;
2800
2801 case 45:
2802
2803 {
2804 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2805 if ((yyval.interm.intermTypedNode) == 0) {
2806 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2807 context->recover();
2808 ConstantUnion *unionArray = new ConstantUnion[1];
2809 unionArray->setBConst(false);
2810 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2811 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002812 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002813 break;
2814
2815 case 46:
2816
2817 {
2818 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2819 if ((yyval.interm.intermTypedNode) == 0) {
2820 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2821 context->recover();
2822 ConstantUnion *unionArray = new ConstantUnion[1];
2823 unionArray->setBConst(false);
2824 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2825 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002826 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002827 break;
2828
2829 case 47:
2830
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002831 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002832 break;
2833
2834 case 48:
2835
2836 {
2837 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2838 if ((yyval.interm.intermTypedNode) == 0) {
2839 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "==", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2840 context->recover();
2841 ConstantUnion *unionArray = new ConstantUnion[1];
2842 unionArray->setBConst(false);
2843 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2844 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002845 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002846 break;
2847
2848 case 49:
2849
2850 {
2851 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpNotEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2852 if ((yyval.interm.intermTypedNode) == 0) {
2853 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "!=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2854 context->recover();
2855 ConstantUnion *unionArray = new ConstantUnion[1];
2856 unionArray->setBConst(false);
2857 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2858 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002859 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002860 break;
2861
2862 case 50:
2863
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002864 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002865 break;
2866
2867 case 51:
2868
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002869 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002870 break;
2871
2872 case 52:
2873
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002874 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002875 break;
2876
2877 case 53:
2878
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002879 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002880 break;
2881
2882 case 54:
2883
2884 {
2885 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalAnd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2886 if ((yyval.interm.intermTypedNode) == 0) {
2887 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "&&", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2888 context->recover();
2889 ConstantUnion *unionArray = new ConstantUnion[1];
2890 unionArray->setBConst(false);
2891 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2892 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002893 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002894 break;
2895
2896 case 55:
2897
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002898 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002899 break;
2900
2901 case 56:
2902
2903 {
2904 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalXor, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2905 if ((yyval.interm.intermTypedNode) == 0) {
2906 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "^^", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2907 context->recover();
2908 ConstantUnion *unionArray = new ConstantUnion[1];
2909 unionArray->setBConst(false);
2910 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2911 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002912 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002913 break;
2914
2915 case 57:
2916
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002917 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002918 break;
2919
2920 case 58:
2921
2922 {
2923 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalOr, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2924 if ((yyval.interm.intermTypedNode) == 0) {
2925 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "||", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2926 context->recover();
2927 ConstantUnion *unionArray = new ConstantUnion[1];
2928 unionArray->setBConst(false);
2929 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2930 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002931 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002932 break;
2933
2934 case 59:
2935
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002936 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002937 break;
2938
2939 case 60:
2940
2941 {
2942 if (context->boolErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.intermTypedNode)))
2943 context->recover();
2944
2945 (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);
2946 if ((yyvsp[(3) - (5)].interm.intermTypedNode)->getType() != (yyvsp[(5) - (5)].interm.intermTypedNode)->getType())
2947 (yyval.interm.intermTypedNode) = 0;
2948
2949 if ((yyval.interm.intermTypedNode) == 0) {
2950 context->binaryOpError((yyvsp[(2) - (5)].lex).line, ":", (yyvsp[(3) - (5)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(5) - (5)].interm.intermTypedNode)->getCompleteString());
2951 context->recover();
2952 (yyval.interm.intermTypedNode) = (yyvsp[(5) - (5)].interm.intermTypedNode);
2953 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002954 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002955 break;
2956
2957 case 61:
2958
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002959 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002960 break;
2961
2962 case 62:
2963
2964 {
2965 if (context->lValueErrorCheck((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)))
2966 context->recover();
2967 (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);
2968 if ((yyval.interm.intermTypedNode) == 0) {
2969 context->assignError((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2970 context->recover();
2971 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2972 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002973 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002974 break;
2975
2976 case 63:
2977
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002978 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAssign; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002979 break;
2980
2981 case 64:
2982
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002983 { 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 +00002984 break;
2985
2986 case 65:
2987
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002988 { 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 +00002989 break;
2990
2991 case 66:
2992
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002993 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAddAssign; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002994 break;
2995
2996 case 67:
2997
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002998 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpSubAssign; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002999 break;
3000
3001 case 68:
3002
3003 {
3004 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003005 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003006 break;
3007
3008 case 69:
3009
3010 {
3011 (yyval.interm.intermTypedNode) = context->intermediate.addComma((yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
3012 if ((yyval.interm.intermTypedNode) == 0) {
3013 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ",", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3014 context->recover();
3015 (yyval.interm.intermTypedNode) = (yyvsp[(3) - (3)].interm.intermTypedNode);
3016 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003017 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003018 break;
3019
3020 case 70:
3021
3022 {
3023 if (context->constErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)))
3024 context->recover();
3025 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003026 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003027 break;
3028
3029 case 71:
3030
3031 {
3032 TFunction &function = *((yyvsp[(1) - (2)].interm).function);
3033
3034 TIntermAggregate *prototype = new TIntermAggregate;
3035 prototype->setType(function.getReturnType());
3036 prototype->setName(function.getName());
3037
3038 for (int i = 0; i < function.getParamCount(); i++)
3039 {
3040 const TParameter &param = function.getParam(i);
3041 if (param.name != 0)
3042 {
3043 TVariable *variable = new TVariable(param.name, *param.type);
3044
3045 prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(variable->getUniqueId(), variable->getName(), variable->getType(), (yyvsp[(1) - (2)].interm).line), (yyvsp[(1) - (2)].interm).line);
3046 }
3047 else
3048 {
3049 prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (2)].interm).line), (yyvsp[(1) - (2)].interm).line);
3050 }
3051 }
3052
3053 prototype->setOp(EOpPrototype);
3054 (yyval.interm.intermNode) = prototype;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003055 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003056 break;
3057
3058 case 72:
3059
3060 {
3061 if ((yyvsp[(1) - (2)].interm).intermAggregate)
3062 (yyvsp[(1) - (2)].interm).intermAggregate->setOp(EOpDeclaration);
3063 (yyval.interm.intermNode) = (yyvsp[(1) - (2)].interm).intermAggregate;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003064 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003065 break;
3066
3067 case 73:
3068
3069 {
3070 context->symbolTable.setDefaultPrecision( (yyvsp[(3) - (4)].interm.type).type, (yyvsp[(2) - (4)].interm.precision) );
3071 (yyval.interm.intermNode) = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003072 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003073 break;
3074
3075 case 74:
3076
3077 {
3078 //
3079 // Multiple declarations of the same function are allowed.
3080 //
3081 // If this is a definition, the definition production code will check for redefinitions
3082 // (we don't know at this point if it's a definition or not).
3083 //
3084 // Redeclarations are allowed. But, return types and parameter qualifiers must match.
3085 //
3086 TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find((yyvsp[(1) - (2)].interm.function)->getMangledName()));
3087 if (prevDec) {
3088 if (prevDec->getReturnType() != (yyvsp[(1) - (2)].interm.function)->getReturnType()) {
3089 context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same return type", (yyvsp[(1) - (2)].interm.function)->getReturnType().getBasicString(), "");
3090 context->recover();
3091 }
3092 for (int i = 0; i < prevDec->getParamCount(); ++i) {
3093 if (prevDec->getParam(i).type->getQualifier() != (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifier()) {
3094 context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same parameter qualifiers", (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifierString(), "");
3095 context->recover();
3096 }
3097 }
3098 }
3099
3100 //
3101 // If this is a redeclaration, it could also be a definition,
3102 // in which case, we want to use the variable names from this one, and not the one that's
3103 // being redeclared. So, pass back up this declaration, not the one in the symbol table.
3104 //
3105 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
3106 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
3107
3108 context->symbolTable.insert(*(yyval.interm).function);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003109 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003110 break;
3111
3112 case 75:
3113
3114 {
3115 (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003116 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003117 break;
3118
3119 case 76:
3120
3121 {
3122 (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003123 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003124 break;
3125
3126 case 77:
3127
3128 {
3129 // Add the parameter
3130 (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
3131 if ((yyvsp[(2) - (2)].interm).param.type->getBasicType() != EbtVoid)
3132 (yyvsp[(1) - (2)].interm.function)->addParameter((yyvsp[(2) - (2)].interm).param);
3133 else
3134 delete (yyvsp[(2) - (2)].interm).param.type;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003135 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003136 break;
3137
3138 case 78:
3139
3140 {
3141 //
3142 // Only first parameter of one-parameter functions can be void
3143 // The check for named parameters not being void is done in parameter_declarator
3144 //
3145 if ((yyvsp[(3) - (3)].interm).param.type->getBasicType() == EbtVoid) {
3146 //
3147 // This parameter > first is void
3148 //
3149 context->error((yyvsp[(2) - (3)].lex).line, "cannot be an argument type except for '(void)'", "void", "");
3150 context->recover();
3151 delete (yyvsp[(3) - (3)].interm).param.type;
3152 } else {
3153 // Add the parameter
3154 (yyval.interm.function) = (yyvsp[(1) - (3)].interm.function);
3155 (yyvsp[(1) - (3)].interm.function)->addParameter((yyvsp[(3) - (3)].interm).param);
3156 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003157 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003158 break;
3159
3160 case 79:
3161
3162 {
3163 if ((yyvsp[(1) - (3)].interm.type).qualifier != EvqGlobal && (yyvsp[(1) - (3)].interm.type).qualifier != EvqTemporary) {
3164 context->error((yyvsp[(2) - (3)].lex).line, "no qualifiers allowed for function return", getQualifierString((yyvsp[(1) - (3)].interm.type).qualifier), "");
3165 context->recover();
3166 }
3167 // make sure a sampler is not involved as well...
3168 if (context->structQualifierErrorCheck((yyvsp[(2) - (3)].lex).line, (yyvsp[(1) - (3)].interm.type)))
3169 context->recover();
3170
3171 // Add the function as a prototype after parsing it (we do not support recursion)
3172 TFunction *function;
3173 TType type((yyvsp[(1) - (3)].interm.type));
3174 function = new TFunction((yyvsp[(2) - (3)].lex).string, type);
3175 (yyval.interm.function) = function;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003176 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003177 break;
3178
3179 case 80:
3180
3181 {
3182 if ((yyvsp[(1) - (2)].interm.type).type == EbtVoid) {
3183 context->error((yyvsp[(2) - (2)].lex).line, "illegal use of type 'void'", (yyvsp[(2) - (2)].lex).string->c_str(), "");
3184 context->recover();
3185 }
3186 if (context->reservedErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string))
3187 context->recover();
3188 TParameter param = {(yyvsp[(2) - (2)].lex).string, new TType((yyvsp[(1) - (2)].interm.type))};
3189 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
3190 (yyval.interm).param = param;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003191 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003192 break;
3193
3194 case 81:
3195
3196 {
3197 // Check that we can make an array out of this type
3198 if (context->arrayTypeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
3199 context->recover();
3200
3201 if (context->reservedErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string))
3202 context->recover();
3203
3204 int size;
3205 if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3206 context->recover();
3207 (yyvsp[(1) - (5)].interm.type).setArray(true, size);
3208
3209 TType* type = new TType((yyvsp[(1) - (5)].interm.type));
3210 TParameter param = { (yyvsp[(2) - (5)].lex).string, type };
3211 (yyval.interm).line = (yyvsp[(2) - (5)].lex).line;
3212 (yyval.interm).param = param;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003213 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003214 break;
3215
3216 case 82:
3217
3218 {
3219 (yyval.interm) = (yyvsp[(3) - (3)].interm);
3220 if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
3221 context->recover();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003222 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003223 break;
3224
3225 case 83:
3226
3227 {
3228 (yyval.interm) = (yyvsp[(2) - (2)].interm);
3229 if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
3230 context->recover();
3231 if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
3232 context->recover();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003233 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003234 break;
3235
3236 case 84:
3237
3238 {
3239 (yyval.interm) = (yyvsp[(3) - (3)].interm);
3240 if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
3241 context->recover();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003242 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003243 break;
3244
3245 case 85:
3246
3247 {
3248 (yyval.interm) = (yyvsp[(2) - (2)].interm);
3249 if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
3250 context->recover();
3251 if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
3252 context->recover();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003253 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003254 break;
3255
3256 case 86:
3257
3258 {
3259 (yyval.interm.qualifier) = EvqIn;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003260 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003261 break;
3262
3263 case 87:
3264
3265 {
3266 (yyval.interm.qualifier) = EvqIn;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003267 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003268 break;
3269
3270 case 88:
3271
3272 {
3273 (yyval.interm.qualifier) = EvqOut;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003274 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003275 break;
3276
3277 case 89:
3278
3279 {
3280 (yyval.interm.qualifier) = EvqInOut;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003281 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003282 break;
3283
3284 case 90:
3285
3286 {
3287 TParameter param = { 0, new TType((yyvsp[(1) - (1)].interm.type)) };
3288 (yyval.interm).param = param;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003289 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003290 break;
3291
3292 case 91:
3293
3294 {
3295 (yyval.interm) = (yyvsp[(1) - (1)].interm);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003296 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003297 break;
3298
3299 case 92:
3300
3301 {
zmo@google.comfd747b82011-04-23 01:30:07 +00003302 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(3) - (3)].lex).string, TType((yyvsp[(1) - (3)].interm).type), (yyvsp[(3) - (3)].lex).line);
3303 (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 +00003304
3305 if (context->structQualifierErrorCheck((yyvsp[(3) - (3)].lex).line, (yyval.interm).type))
3306 context->recover();
3307
3308 if (context->nonInitConstErrorCheck((yyvsp[(3) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyval.interm).type))
3309 context->recover();
3310
zmo@google.comfd747b82011-04-23 01:30:07 +00003311 TVariable* variable = 0;
3312 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 +00003313 context->recover();
zmo@google.comfd747b82011-04-23 01:30:07 +00003314 if (symbol && variable)
3315 symbol->setId(variable->getUniqueId());
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003316 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003317 break;
3318
3319 case 93:
3320
3321 {
3322 if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
3323 context->recover();
3324
3325 if (context->nonInitConstErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type))
3326 context->recover();
3327
3328 (yyval.interm) = (yyvsp[(1) - (5)].interm);
3329
3330 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))
3331 context->recover();
3332 else {
3333 (yyvsp[(1) - (5)].interm).type.setArray(true);
3334 TVariable* variable;
3335 if (context->arrayErrorCheck((yyvsp[(4) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, variable))
3336 context->recover();
3337 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003338 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003339 break;
3340
3341 case 94:
3342
3343 {
3344 if (context->structQualifierErrorCheck((yyvsp[(3) - (6)].lex).line, (yyvsp[(1) - (6)].interm).type))
3345 context->recover();
3346
3347 if (context->nonInitConstErrorCheck((yyvsp[(3) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type))
3348 context->recover();
3349
3350 (yyval.interm) = (yyvsp[(1) - (6)].interm);
3351
3352 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))
3353 context->recover();
3354 else {
3355 int size;
3356 if (context->arraySizeErrorCheck((yyvsp[(4) - (6)].lex).line, (yyvsp[(5) - (6)].interm.intermTypedNode), size))
3357 context->recover();
3358 (yyvsp[(1) - (6)].interm).type.setArray(true, size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003359 TVariable* variable = 0;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003360 if (context->arrayErrorCheck((yyvsp[(4) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type, variable))
3361 context->recover();
3362 TType type = TType((yyvsp[(1) - (6)].interm).type);
3363 type.setArraySize(size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003364 (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 +00003365 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003366 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003367 break;
3368
3369 case 95:
3370
3371 {
3372 if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
3373 context->recover();
3374
3375 (yyval.interm) = (yyvsp[(1) - (5)].interm);
3376
3377 TIntermNode* intermNode;
3378 if (!context->executeInitializer((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, (yyvsp[(5) - (5)].interm.intermTypedNode), intermNode)) {
3379 //
3380 // build the intermediate representation
3381 //
3382 if (intermNode)
3383 (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (5)].interm).intermNode, intermNode, (yyvsp[(4) - (5)].lex).line);
3384 else
3385 (yyval.interm).intermAggregate = (yyvsp[(1) - (5)].interm).intermAggregate;
3386 } else {
3387 context->recover();
3388 (yyval.interm).intermAggregate = 0;
3389 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003390 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003391 break;
3392
3393 case 96:
3394
3395 {
3396 (yyval.interm).type = (yyvsp[(1) - (1)].interm.type);
3397 (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 +00003398 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003399 break;
3400
3401 case 97:
3402
3403 {
zmo@google.comfd747b82011-04-23 01:30:07 +00003404 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyvsp[(1) - (2)].interm.type)), (yyvsp[(2) - (2)].lex).line);
3405 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (2)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003406
3407 if (context->structQualifierErrorCheck((yyvsp[(2) - (2)].lex).line, (yyval.interm).type))
3408 context->recover();
3409
3410 if (context->nonInitConstErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string, (yyval.interm).type))
3411 context->recover();
3412
3413 (yyval.interm).type = (yyvsp[(1) - (2)].interm.type);
3414
zmo@google.comfd747b82011-04-23 01:30:07 +00003415 TVariable* variable = 0;
3416 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 +00003417 context->recover();
zmo@google.comfd747b82011-04-23 01:30:07 +00003418 if (variable && symbol)
3419 symbol->setId(variable->getUniqueId());
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003420 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003421 break;
3422
3423 case 98:
3424
3425 {
kbr@chromium.org04277b82011-06-02 18:41:26 +00003426 context->error((yyvsp[(2) - (4)].lex).line, "unsized array declarations not supported", (yyvsp[(2) - (4)].lex).string->c_str(), "");
3427 context->recover();
3428
zmo@google.comfd747b82011-04-23 01:30:07 +00003429 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (4)].lex).string, TType((yyvsp[(1) - (4)].interm.type)), (yyvsp[(2) - (4)].lex).line);
3430 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (4)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003431 (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003432 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003433 break;
3434
3435 case 99:
3436
3437 {
3438 TType type = TType((yyvsp[(1) - (5)].interm.type));
3439 int size;
3440 if (context->arraySizeErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3441 context->recover();
3442 type.setArraySize(size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003443 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (5)].lex).string, type, (yyvsp[(2) - (5)].lex).line);
3444 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (5)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003445
3446 if (context->structQualifierErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
3447 context->recover();
3448
3449 if (context->nonInitConstErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type)))
3450 context->recover();
3451
3452 (yyval.interm).type = (yyvsp[(1) - (5)].interm.type);
3453
3454 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)))
3455 context->recover();
3456 else {
3457 int size;
3458 if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3459 context->recover();
3460
3461 (yyvsp[(1) - (5)].interm.type).setArray(true, size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003462 TVariable* variable = 0;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003463 if (context->arrayErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type), variable))
3464 context->recover();
zmo@google.comfd747b82011-04-23 01:30:07 +00003465 if (variable && symbol)
3466 symbol->setId(variable->getUniqueId());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003467 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003468 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003469 break;
3470
3471 case 100:
3472
3473 {
3474 if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
3475 context->recover();
3476
3477 (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
3478
3479 TIntermNode* intermNode;
3480 if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode)) {
3481 //
3482 // Build intermediate representation
3483 //
3484 if(intermNode)
3485 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(intermNode, (yyvsp[(3) - (4)].lex).line);
3486 else
3487 (yyval.interm).intermAggregate = 0;
3488 } else {
3489 context->recover();
3490 (yyval.interm).intermAggregate = 0;
3491 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003492 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003493 break;
3494
3495 case 101:
3496
3497 {
3498 VERTEX_ONLY("invariant declaration", (yyvsp[(1) - (2)].lex).line);
3499 (yyval.interm).qualifier = EvqInvariantVaryingOut;
3500 (yyval.interm).intermAggregate = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003501 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003502 break;
3503
3504 case 102:
3505
3506 {
3507 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3508
3509 if ((yyvsp[(1) - (1)].interm.type).array) {
3510 context->error((yyvsp[(1) - (1)].interm.type).line, "not supported", "first-class array", "");
3511 context->recover();
3512 (yyvsp[(1) - (1)].interm.type).setArray(false);
3513 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003514 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003515 break;
3516
3517 case 103:
3518
3519 {
3520 if ((yyvsp[(2) - (2)].interm.type).array) {
3521 context->error((yyvsp[(2) - (2)].interm.type).line, "not supported", "first-class array", "");
3522 context->recover();
3523 (yyvsp[(2) - (2)].interm.type).setArray(false);
3524 }
3525
3526 if ((yyvsp[(1) - (2)].interm.type).qualifier == EvqAttribute &&
3527 ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
3528 context->error((yyvsp[(2) - (2)].interm.type).line, "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier), "");
3529 context->recover();
3530 }
3531 if (((yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingIn || (yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingOut) &&
3532 ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
3533 context->error((yyvsp[(2) - (2)].interm.type).line, "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier), "");
3534 context->recover();
3535 }
3536 (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
3537 (yyval.interm.type).qualifier = (yyvsp[(1) - (2)].interm.type).qualifier;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003538 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003539 break;
3540
3541 case 104:
3542
3543 {
3544 (yyval.interm.type).setBasic(EbtVoid, EvqConst, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003545 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003546 break;
3547
3548 case 105:
3549
3550 {
3551 VERTEX_ONLY("attribute", (yyvsp[(1) - (1)].lex).line);
3552 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "attribute"))
3553 context->recover();
3554 (yyval.interm.type).setBasic(EbtVoid, EvqAttribute, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003555 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003556 break;
3557
3558 case 106:
3559
3560 {
3561 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "varying"))
3562 context->recover();
3563 if (context->shaderType == SH_VERTEX_SHADER)
3564 (yyval.interm.type).setBasic(EbtVoid, EvqVaryingOut, (yyvsp[(1) - (1)].lex).line);
3565 else
3566 (yyval.interm.type).setBasic(EbtVoid, EvqVaryingIn, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003567 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003568 break;
3569
3570 case 107:
3571
3572 {
3573 if (context->globalErrorCheck((yyvsp[(1) - (2)].lex).line, context->symbolTable.atGlobalLevel(), "invariant varying"))
3574 context->recover();
3575 if (context->shaderType == SH_VERTEX_SHADER)
3576 (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingOut, (yyvsp[(1) - (2)].lex).line);
3577 else
3578 (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingIn, (yyvsp[(1) - (2)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003579 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003580 break;
3581
3582 case 108:
3583
3584 {
3585 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "uniform"))
3586 context->recover();
3587 (yyval.interm.type).setBasic(EbtVoid, EvqUniform, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003588 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003589 break;
3590
3591 case 109:
3592
3593 {
3594 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
zmo@google.comdc4b4f82011-06-17 00:42:53 +00003595
3596 if ((yyval.interm.type).precision == EbpUndefined) {
3597 (yyval.interm.type).precision = context->symbolTable.getDefaultPrecision((yyvsp[(1) - (1)].interm.type).type);
3598 if (context->precisionErrorCheck((yyvsp[(1) - (1)].interm.type).line, (yyval.interm.type).precision, (yyvsp[(1) - (1)].interm.type).type)) {
3599 context->recover();
3600 }
3601 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003602 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003603 break;
3604
3605 case 110:
3606
3607 {
3608 (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
3609 (yyval.interm.type).precision = (yyvsp[(1) - (2)].interm.precision);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003610 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003611 break;
3612
3613 case 111:
3614
3615 {
3616 (yyval.interm.precision) = EbpHigh;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003617 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003618 break;
3619
3620 case 112:
3621
3622 {
3623 (yyval.interm.precision) = EbpMedium;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003624 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003625 break;
3626
3627 case 113:
3628
3629 {
3630 (yyval.interm.precision) = EbpLow;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003631 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003632 break;
3633
3634 case 114:
3635
3636 {
3637 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003638 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003639 break;
3640
3641 case 115:
3642
3643 {
3644 (yyval.interm.type) = (yyvsp[(1) - (4)].interm.type);
3645
3646 if (context->arrayTypeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
3647 context->recover();
3648 else {
3649 int size;
3650 if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
3651 context->recover();
3652 (yyval.interm.type).setArray(true, size);
3653 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003654 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003655 break;
3656
3657 case 116:
3658
3659 {
3660 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3661 (yyval.interm.type).setBasic(EbtVoid, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003662 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003663 break;
3664
3665 case 117:
3666
3667 {
3668 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3669 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003670 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003671 break;
3672
3673 case 118:
3674
3675 {
3676 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3677 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003678 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003679 break;
3680
3681 case 119:
3682
3683 {
3684 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3685 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003686 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003687 break;
3688
3689 case 120:
3690
3691 {
3692 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3693 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3694 (yyval.interm.type).setAggregate(2);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003695 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003696 break;
3697
3698 case 121:
3699
3700 {
3701 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3702 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3703 (yyval.interm.type).setAggregate(3);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003704 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003705 break;
3706
3707 case 122:
3708
3709 {
3710 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3711 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3712 (yyval.interm.type).setAggregate(4);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003713 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003714 break;
3715
3716 case 123:
3717
3718 {
3719 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3720 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3721 (yyval.interm.type).setAggregate(2);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003722 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003723 break;
3724
3725 case 124:
3726
3727 {
3728 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3729 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3730 (yyval.interm.type).setAggregate(3);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003731 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003732 break;
3733
3734 case 125:
3735
3736 {
3737 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3738 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3739 (yyval.interm.type).setAggregate(4);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003740 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003741 break;
3742
3743 case 126:
3744
3745 {
3746 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3747 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3748 (yyval.interm.type).setAggregate(2);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003749 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003750 break;
3751
3752 case 127:
3753
3754 {
3755 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3756 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3757 (yyval.interm.type).setAggregate(3);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003758 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003759 break;
3760
3761 case 128:
3762
3763 {
3764 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3765 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3766 (yyval.interm.type).setAggregate(4);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003767 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003768 break;
3769
3770 case 129:
3771
3772 {
3773 FRAG_VERT_ONLY("mat2", (yyvsp[(1) - (1)].lex).line);
3774 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3775 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3776 (yyval.interm.type).setAggregate(2, true);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003777 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003778 break;
3779
3780 case 130:
3781
3782 {
3783 FRAG_VERT_ONLY("mat3", (yyvsp[(1) - (1)].lex).line);
3784 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3785 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3786 (yyval.interm.type).setAggregate(3, true);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003787 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003788 break;
3789
3790 case 131:
3791
3792 {
3793 FRAG_VERT_ONLY("mat4", (yyvsp[(1) - (1)].lex).line);
3794 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3795 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3796 (yyval.interm.type).setAggregate(4, true);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003797 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003798 break;
3799
3800 case 132:
3801
3802 {
3803 FRAG_VERT_ONLY("sampler2D", (yyvsp[(1) - (1)].lex).line);
3804 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3805 (yyval.interm.type).setBasic(EbtSampler2D, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003806 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003807 break;
3808
3809 case 133:
3810
3811 {
3812 FRAG_VERT_ONLY("samplerCube", (yyvsp[(1) - (1)].lex).line);
3813 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3814 (yyval.interm.type).setBasic(EbtSamplerCube, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003815 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003816 break;
3817
3818 case 134:
3819
3820 {
zmo@google.com09c323a2011-08-12 18:22:25 +00003821 if (!context->supportsExtension("GL_OES_EGL_image_external")) {
3822 context->error((yyvsp[(1) - (1)].lex).line, "unsupported type", "samplerExternalOES", "");
3823 context->recover();
3824 }
3825 FRAG_VERT_ONLY("samplerExternalOES", (yyvsp[(1) - (1)].lex).line);
3826 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3827 (yyval.interm.type).setBasic(EbtSamplerExternalOES, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003828 }
zmo@google.com09c323a2011-08-12 18:22:25 +00003829 break;
3830
3831 case 135:
3832
3833 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00003834 if (!context->supportsExtension("GL_ARB_texture_rectangle")) {
3835 context->error((yyvsp[(1) - (1)].lex).line, "unsupported type", "sampler2DRect", "");
3836 context->recover();
3837 }
3838 FRAG_VERT_ONLY("sampler2DRect", (yyvsp[(1) - (1)].lex).line);
3839 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3840 (yyval.interm.type).setBasic(EbtSampler2DRect, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003841 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003842 break;
3843
zmo@google.com09c323a2011-08-12 18:22:25 +00003844 case 136:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003845
3846 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00003847 FRAG_VERT_ONLY("struct", (yyvsp[(1) - (1)].interm.type).line);
3848 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3849 (yyval.interm.type).qualifier = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003850 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003851 break;
3852
3853 case 137:
3854
3855 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003856 //
3857 // This is for user defined type names. The lexical phase looked up the
3858 // type.
3859 //
3860 TType& structure = static_cast<TVariable*>((yyvsp[(1) - (1)].lex).symbol)->getType();
3861 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3862 (yyval.interm.type).setBasic(EbtStruct, qual, (yyvsp[(1) - (1)].lex).line);
3863 (yyval.interm.type).userDef = &structure;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003864 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003865 break;
3866
zmo@google.com09c323a2011-08-12 18:22:25 +00003867 case 138:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003868
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003869 { if (context->enterStructDeclaration((yyvsp[(2) - (3)].lex).line, *(yyvsp[(2) - (3)].lex).string)) context->recover(); }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003870 break;
3871
3872 case 139:
3873
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003874 {
kbr@chromium.org476541f2011-10-27 21:14:51 +00003875 if (context->reservedErrorCheck((yyvsp[(2) - (6)].lex).line, *(yyvsp[(2) - (6)].lex).string))
3876 context->recover();
3877
3878 TType* structure = new TType((yyvsp[(5) - (6)].interm.typeList), *(yyvsp[(2) - (6)].lex).string);
3879 TVariable* userTypeDef = new TVariable((yyvsp[(2) - (6)].lex).string, *structure, true);
3880 if (! context->symbolTable.insert(*userTypeDef)) {
3881 context->error((yyvsp[(2) - (6)].lex).line, "redefinition", (yyvsp[(2) - (6)].lex).string->c_str(), "struct");
3882 context->recover();
3883 }
3884 (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (6)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003885 (yyval.interm.type).userDef = structure;
kbr@chromium.org476541f2011-10-27 21:14:51 +00003886 context->exitStructDeclaration();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003887 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00003888 break;
3889
3890 case 140:
3891
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003892 { if (context->enterStructDeclaration((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string)) context->recover(); }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003893 break;
3894
3895 case 141:
3896
kbr@chromium.org476541f2011-10-27 21:14:51 +00003897 {
3898 TType* structure = new TType((yyvsp[(4) - (5)].interm.typeList), TString(""));
3899 (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (5)].lex).line);
3900 (yyval.interm.type).userDef = structure;
3901 context->exitStructDeclaration();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003902 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003903 break;
3904
kbr@chromium.org476541f2011-10-27 21:14:51 +00003905 case 142:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003906
3907 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00003908 (yyval.interm.typeList) = (yyvsp[(1) - (1)].interm.typeList);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003909 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003910 break;
3911
3912 case 143:
3913
3914 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003915 (yyval.interm.typeList) = (yyvsp[(1) - (2)].interm.typeList);
3916 for (unsigned int i = 0; i < (yyvsp[(2) - (2)].interm.typeList)->size(); ++i) {
3917 for (unsigned int j = 0; j < (yyval.interm.typeList)->size(); ++j) {
3918 if ((*(yyval.interm.typeList))[j].type->getFieldName() == (*(yyvsp[(2) - (2)].interm.typeList))[i].type->getFieldName()) {
3919 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());
3920 context->recover();
3921 }
3922 }
3923 (yyval.interm.typeList)->push_back((*(yyvsp[(2) - (2)].interm.typeList))[i]);
3924 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003925 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003926 break;
3927
kbr@chromium.org205fef32011-11-22 20:50:02 +00003928 case 144:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003929
3930 {
3931 (yyval.interm.typeList) = (yyvsp[(2) - (3)].interm.typeList);
3932
3933 if (context->voidErrorCheck((yyvsp[(1) - (3)].interm.type).line, (*(yyvsp[(2) - (3)].interm.typeList))[0].type->getFieldName(), (yyvsp[(1) - (3)].interm.type))) {
3934 context->recover();
3935 }
3936 for (unsigned int i = 0; i < (yyval.interm.typeList)->size(); ++i) {
3937 //
3938 // Careful not to replace already known aspects of type, like array-ness
3939 //
3940 TType* type = (*(yyval.interm.typeList))[i].type;
3941 type->setBasicType((yyvsp[(1) - (3)].interm.type).type);
3942 type->setNominalSize((yyvsp[(1) - (3)].interm.type).size);
3943 type->setMatrix((yyvsp[(1) - (3)].interm.type).matrix);
zmo@google.comdc4b4f82011-06-17 00:42:53 +00003944 type->setPrecision((yyvsp[(1) - (3)].interm.type).precision);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003945
3946 // don't allow arrays of arrays
3947 if (type->isArray()) {
3948 if (context->arrayTypeErrorCheck((yyvsp[(1) - (3)].interm.type).line, (yyvsp[(1) - (3)].interm.type)))
3949 context->recover();
3950 }
3951 if ((yyvsp[(1) - (3)].interm.type).array)
3952 type->setArraySize((yyvsp[(1) - (3)].interm.type).arraySize);
3953 if ((yyvsp[(1) - (3)].interm.type).userDef) {
3954 type->setStruct((yyvsp[(1) - (3)].interm.type).userDef->getStruct());
3955 type->setTypeName((yyvsp[(1) - (3)].interm.type).userDef->getTypeName());
3956 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00003957
3958 if (context->structNestingErrorCheck((yyvsp[(1) - (3)].interm.type).line, *type)) {
3959 context->recover();
3960 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003961 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003962 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003963 break;
3964
kbr@chromium.org476541f2011-10-27 21:14:51 +00003965 case 145:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003966
3967 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00003968 (yyval.interm.typeList) = NewPoolTTypeList();
3969 (yyval.interm.typeList)->push_back((yyvsp[(1) - (1)].interm.typeLine));
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003970 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003971 break;
3972
kbr@chromium.org476541f2011-10-27 21:14:51 +00003973 case 146:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003974
3975 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00003976 (yyval.interm.typeList)->push_back((yyvsp[(3) - (3)].interm.typeLine));
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003977 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003978 break;
3979
3980 case 147:
3981
3982 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003983 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
3984 context->recover();
3985
3986 (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
3987 (yyval.interm.typeLine).line = (yyvsp[(1) - (1)].lex).line;
3988 (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (1)].lex).string);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003989 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003990 break;
3991
kbr@chromium.org205fef32011-11-22 20:50:02 +00003992 case 148:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003993
3994 {
3995 if (context->reservedErrorCheck((yyvsp[(1) - (4)].lex).line, *(yyvsp[(1) - (4)].lex).string))
3996 context->recover();
3997
3998 (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
3999 (yyval.interm.typeLine).line = (yyvsp[(1) - (4)].lex).line;
4000 (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (4)].lex).string);
4001
4002 int size;
4003 if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
4004 context->recover();
4005 (yyval.interm.typeLine).type->setArraySize(size);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004006 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004007 break;
4008
4009 case 149:
4010
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004011 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004012 break;
4013
4014 case 150:
4015
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004016 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004017 break;
4018
4019 case 151:
4020
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004021 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermAggregate); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004022 break;
4023
4024 case 152:
4025
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004026 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004027 break;
4028
4029 case 153:
4030
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004031 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004032 break;
4033
4034 case 154:
4035
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004036 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004037 break;
4038
4039 case 155:
4040
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004041 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004042 break;
4043
4044 case 156:
4045
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004046 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004047 break;
4048
4049 case 157:
4050
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004051 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
zmo@google.com09c323a2011-08-12 18:22:25 +00004052 break;
4053
4054 case 158:
4055
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004056 { (yyval.interm.intermAggregate) = 0; }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004057 break;
4058
4059 case 159:
4060
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004061 { context->symbolTable.push(); }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004062 break;
4063
4064 case 160:
4065
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004066 { context->symbolTable.pop(); }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004067 break;
4068
4069 case 161:
4070
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004071 {
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004072 if ((yyvsp[(3) - (5)].interm.intermAggregate) != 0) {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004073 (yyvsp[(3) - (5)].interm.intermAggregate)->setOp(EOpSequence);
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004074 (yyvsp[(3) - (5)].interm.intermAggregate)->setEndLine((yyvsp[(5) - (5)].lex).line);
4075 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004076 (yyval.interm.intermAggregate) = (yyvsp[(3) - (5)].interm.intermAggregate);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004077 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004078 break;
4079
4080 case 162:
4081
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004082 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004083 break;
4084
4085 case 163:
4086
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004087 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004088 break;
4089
kbr@chromium.org476541f2011-10-27 21:14:51 +00004090 case 164:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004091
4092 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004093 (yyval.interm.intermNode) = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004094 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004095 break;
4096
4097 case 165:
4098
4099 {
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004100 if ((yyvsp[(2) - (3)].interm.intermAggregate)) {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004101 (yyvsp[(2) - (3)].interm.intermAggregate)->setOp(EOpSequence);
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004102 (yyvsp[(2) - (3)].interm.intermAggregate)->setEndLine((yyvsp[(3) - (3)].lex).line);
4103 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004104 (yyval.interm.intermNode) = (yyvsp[(2) - (3)].interm.intermAggregate);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004105 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004106 break;
4107
kbr@chromium.org476541f2011-10-27 21:14:51 +00004108 case 166:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004109
4110 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004111 (yyval.interm.intermAggregate) = context->intermediate.makeAggregate((yyvsp[(1) - (1)].interm.intermNode), 0);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004112 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004113 break;
4114
kbr@chromium.org476541f2011-10-27 21:14:51 +00004115 case 167:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004116
kbr@chromium.org205fef32011-11-22 20:50:02 +00004117 {
4118 (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 +00004119 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004120 break;
4121
kbr@chromium.org476541f2011-10-27 21:14:51 +00004122 case 168:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004123
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004124 { (yyval.interm.intermNode) = 0; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004125 break;
4126
kbr@chromium.org476541f2011-10-27 21:14:51 +00004127 case 169:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004128
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004129 { (yyval.interm.intermNode) = static_cast<TIntermNode*>((yyvsp[(1) - (2)].interm.intermTypedNode)); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004130 break;
4131
kbr@chromium.org476541f2011-10-27 21:14:51 +00004132 case 170:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004133
4134 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004135 if (context->boolErrorCheck((yyvsp[(1) - (5)].lex).line, (yyvsp[(3) - (5)].interm.intermTypedNode)))
4136 context->recover();
4137 (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 +00004138 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004139 break;
4140
kbr@chromium.org476541f2011-10-27 21:14:51 +00004141 case 171:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004142
4143 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004144 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermNode);
4145 (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004146 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004147 break;
4148
kbr@chromium.org476541f2011-10-27 21:14:51 +00004149 case 172:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004150
4151 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004152 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (1)].interm.intermNode);
4153 (yyval.interm.nodePair).node2 = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004154 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004155 break;
4156
kbr@chromium.org476541f2011-10-27 21:14:51 +00004157 case 173:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004158
4159 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004160 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
4161 if (context->boolErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)->getLine(), (yyvsp[(1) - (1)].interm.intermTypedNode)))
4162 context->recover();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004163 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004164 break;
4165
4166 case 174:
4167
4168 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004169 TIntermNode* intermNode;
4170 if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
4171 context->recover();
4172 if (context->boolErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
4173 context->recover();
4174
4175 if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode))
4176 (yyval.interm.intermTypedNode) = (yyvsp[(4) - (4)].interm.intermTypedNode);
4177 else {
4178 context->recover();
4179 (yyval.interm.intermTypedNode) = 0;
4180 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004181 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004182 break;
4183
kbr@chromium.org476541f2011-10-27 21:14:51 +00004184 case 175:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004185
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004186 { context->symbolTable.push(); ++context->loopNestingLevel; }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004187 break;
4188
4189 case 176:
4190
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004191 {
4192 context->symbolTable.pop();
alokp@chromium.org52813552010-11-16 18:36:09 +00004193 (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 +00004194 --context->loopNestingLevel;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004195 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004196 break;
4197
kbr@chromium.org476541f2011-10-27 21:14:51 +00004198 case 177:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004199
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004200 { ++context->loopNestingLevel; }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004201 break;
4202
4203 case 178:
4204
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004205 {
4206 if (context->boolErrorCheck((yyvsp[(8) - (8)].lex).line, (yyvsp[(6) - (8)].interm.intermTypedNode)))
4207 context->recover();
4208
alokp@chromium.org52813552010-11-16 18:36:09 +00004209 (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 +00004210 --context->loopNestingLevel;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004211 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004212 break;
4213
kbr@chromium.org476541f2011-10-27 21:14:51 +00004214 case 179:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004215
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004216 { context->symbolTable.push(); ++context->loopNestingLevel; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004217 break;
4218
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004219 case 180:
4220
4221 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004222 context->symbolTable.pop();
4223 (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);
4224 --context->loopNestingLevel;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004225 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004226 break;
4227
4228 case 181:
4229
4230 {
kbr@chromium.org476541f2011-10-27 21:14:51 +00004231 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004232 }
zmo@google.com09c323a2011-08-12 18:22:25 +00004233 break;
4234
4235 case 182:
4236
4237 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004238 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004239 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004240 break;
4241
4242 case 183:
4243
4244 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004245 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004246 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004247 break;
4248
4249 case 184:
4250
4251 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004252 (yyval.interm.intermTypedNode) = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004253 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004254 break;
4255
kbr@chromium.org476541f2011-10-27 21:14:51 +00004256 case 185:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004257
4258 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004259 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (2)].interm.intermTypedNode);
4260 (yyval.interm.nodePair).node2 = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004261 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004262 break;
4263
kbr@chromium.org476541f2011-10-27 21:14:51 +00004264 case 186:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004265
4266 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004267 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermTypedNode);
4268 (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004269 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004270 break;
4271
4272 case 187:
4273
4274 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004275 if (context->loopNestingLevel <= 0) {
4276 context->error((yyvsp[(1) - (2)].lex).line, "continue statement only allowed in loops", "", "");
4277 context->recover();
4278 }
4279 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpContinue, (yyvsp[(1) - (2)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004280 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004281 break;
4282
kbr@chromium.org205fef32011-11-22 20:50:02 +00004283 case 188:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004284
4285 {
4286 if (context->loopNestingLevel <= 0) {
4287 context->error((yyvsp[(1) - (2)].lex).line, "break statement only allowed in loops", "", "");
4288 context->recover();
4289 }
4290 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpBreak, (yyvsp[(1) - (2)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004291 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004292 break;
4293
kbr@chromium.org205fef32011-11-22 20:50:02 +00004294 case 189:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004295
4296 {
4297 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(1) - (2)].lex).line);
4298 if (context->currentFunctionType->getBasicType() != EbtVoid) {
4299 context->error((yyvsp[(1) - (2)].lex).line, "non-void function must return a value", "return", "");
4300 context->recover();
4301 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004302 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004303 break;
4304
kbr@chromium.org205fef32011-11-22 20:50:02 +00004305 case 190:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004306
4307 {
4308 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(2) - (3)].interm.intermTypedNode), (yyvsp[(1) - (3)].lex).line);
4309 context->functionReturnsValue = true;
4310 if (context->currentFunctionType->getBasicType() == EbtVoid) {
4311 context->error((yyvsp[(1) - (3)].lex).line, "void function cannot return a value", "return", "");
4312 context->recover();
4313 } else if (*(context->currentFunctionType) != (yyvsp[(2) - (3)].interm.intermTypedNode)->getType()) {
4314 context->error((yyvsp[(1) - (3)].lex).line, "function return is not matching type:", "return", "");
4315 context->recover();
4316 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004317 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004318 break;
4319
kbr@chromium.org476541f2011-10-27 21:14:51 +00004320 case 191:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004321
4322 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004323 FRAG_ONLY("discard", (yyvsp[(1) - (2)].lex).line);
4324 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpKill, (yyvsp[(1) - (2)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004325 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004326 break;
4327
kbr@chromium.org476541f2011-10-27 21:14:51 +00004328 case 192:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004329
4330 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004331 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
zmo@google.com09c323a2011-08-12 18:22:25 +00004332 context->treeRoot = (yyval.interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004333 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004334 break;
4335
zmo@google.com09c323a2011-08-12 18:22:25 +00004336 case 193:
4337
4338 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004339 (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermNode), (yyvsp[(2) - (2)].interm.intermNode), 0);
4340 context->treeRoot = (yyval.interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004341 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004342 break;
4343
4344 case 194:
4345
4346 {
4347 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004348 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004349 break;
4350
4351 case 195:
4352
4353 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004354 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004355 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004356 break;
4357
4358 case 196:
4359
4360 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004361 TFunction* function = (yyvsp[(1) - (1)].interm).function;
4362 TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find(function->getMangledName()));
4363 //
4364 // Note: 'prevDec' could be 'function' if this is the first time we've seen function
4365 // as it would have just been put in the symbol table. Otherwise, we're looking up
4366 // an earlier occurance.
4367 //
4368 if (prevDec->isDefined()) {
4369 //
4370 // Then this function already has a body.
4371 //
4372 context->error((yyvsp[(1) - (1)].interm).line, "function already has a body", function->getName().c_str(), "");
4373 context->recover();
4374 }
4375 prevDec->setDefined();
4376
4377 //
4378 // Raise error message if main function takes any parameters or return anything other than void
4379 //
4380 if (function->getName() == "main") {
4381 if (function->getParamCount() > 0) {
4382 context->error((yyvsp[(1) - (1)].interm).line, "function cannot take any parameter(s)", function->getName().c_str(), "");
4383 context->recover();
4384 }
4385 if (function->getReturnType().getBasicType() != EbtVoid) {
4386 context->error((yyvsp[(1) - (1)].interm).line, "", function->getReturnType().getBasicString(), "main function cannot return a value");
4387 context->recover();
4388 }
4389 }
4390
4391 //
4392 // New symbol table scope for body of function plus its arguments
4393 //
4394 context->symbolTable.push();
4395
4396 //
4397 // Remember the return type for later checking for RETURN statements.
4398 //
4399 context->currentFunctionType = &(prevDec->getReturnType());
4400 context->functionReturnsValue = false;
4401
4402 //
4403 // Insert parameters into the symbol table.
4404 // If the parameter has no name, it's not an error, just don't insert it
4405 // (could be used for unused args).
4406 //
4407 // Also, accumulate the list of parameters into the HIL, so lower level code
4408 // knows where to find parameters.
4409 //
4410 TIntermAggregate* paramNodes = new TIntermAggregate;
4411 for (int i = 0; i < function->getParamCount(); i++) {
4412 const TParameter& param = function->getParam(i);
4413 if (param.name != 0) {
4414 TVariable *variable = new TVariable(param.name, *param.type);
4415 //
4416 // Insert the parameters with name in the symbol table.
4417 //
4418 if (! context->symbolTable.insert(*variable)) {
4419 context->error((yyvsp[(1) - (1)].interm).line, "redefinition", variable->getName().c_str(), "");
4420 context->recover();
4421 delete variable;
4422 }
4423
4424 //
4425 // Add the parameter to the HIL
4426 //
4427 paramNodes = context->intermediate.growAggregate(
4428 paramNodes,
4429 context->intermediate.addSymbol(variable->getUniqueId(),
4430 variable->getName(),
4431 variable->getType(), (yyvsp[(1) - (1)].interm).line),
4432 (yyvsp[(1) - (1)].interm).line);
4433 } else {
4434 paramNodes = context->intermediate.growAggregate(paramNodes, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (1)].interm).line), (yyvsp[(1) - (1)].interm).line);
4435 }
4436 }
4437 context->intermediate.setAggregateOperator(paramNodes, EOpParameters, (yyvsp[(1) - (1)].interm).line);
4438 (yyvsp[(1) - (1)].interm).intermAggregate = paramNodes;
4439 context->loopNestingLevel = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004440 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004441 break;
4442
kbr@chromium.org205fef32011-11-22 20:50:02 +00004443 case 197:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004444
4445 {
4446 //?? Check that all paths return a value if return type != void ?
4447 // May be best done as post process phase on intermediate code
4448 if (context->currentFunctionType->getBasicType() != EbtVoid && ! context->functionReturnsValue) {
4449 context->error((yyvsp[(1) - (3)].interm).line, "function does not return a value:", "", (yyvsp[(1) - (3)].interm).function->getName().c_str());
4450 context->recover();
4451 }
4452 context->symbolTable.pop();
4453 (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermAggregate, (yyvsp[(3) - (3)].interm.intermNode), 0);
4454 context->intermediate.setAggregateOperator((yyval.interm.intermNode), EOpFunction, (yyvsp[(1) - (3)].interm).line);
4455 (yyval.interm.intermNode)->getAsAggregate()->setName((yyvsp[(1) - (3)].interm).function->getMangledName().c_str());
4456 (yyval.interm.intermNode)->getAsAggregate()->setType((yyvsp[(1) - (3)].interm).function->getReturnType());
4457
4458 // store the pragma information for debug and optimize and other vendor specific
4459 // information. This information can be queried from the parse tree
4460 (yyval.interm.intermNode)->getAsAggregate()->setOptimize(context->contextPragma.optimize);
4461 (yyval.interm.intermNode)->getAsAggregate()->setDebug(context->contextPragma.debug);
4462 (yyval.interm.intermNode)->getAsAggregate()->addToPragmaTable(context->contextPragma.pragmaTable);
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004463
4464 if ((yyvsp[(3) - (3)].interm.intermNode) && (yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate())
4465 (yyval.interm.intermNode)->getAsAggregate()->setEndLine((yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate()->getEndLine());
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004466 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004467 break;
4468
4469
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004470
4471 default: break;
4472 }
4473 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
4474
4475 YYPOPSTACK (yylen);
4476 yylen = 0;
4477 YY_STACK_PRINT (yyss, yyssp);
4478
4479 *++yyvsp = yyval;
4480
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004481 /* Now `shift' the result of the reduction. Determine what state
4482 that goes to, based on the state we popped back to and the rule
4483 number reduced by. */
4484
4485 yyn = yyr1[yyn];
4486
4487 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
4488 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
4489 yystate = yytable[yystate];
4490 else
4491 yystate = yydefgoto[yyn - YYNTOKENS];
4492
4493 goto yynewstate;
4494
4495
4496/*------------------------------------.
4497| yyerrlab -- here on detecting error |
4498`------------------------------------*/
4499yyerrlab:
4500 /* If not already recovering from an error, report this error. */
4501 if (!yyerrstatus)
4502 {
4503 ++yynerrs;
4504#if ! YYERROR_VERBOSE
4505 yyerror (context, YY_("syntax error"));
4506#else
4507 {
4508 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
4509 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
4510 {
4511 YYSIZE_T yyalloc = 2 * yysize;
4512 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
4513 yyalloc = YYSTACK_ALLOC_MAXIMUM;
4514 if (yymsg != yymsgbuf)
4515 YYSTACK_FREE (yymsg);
4516 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
4517 if (yymsg)
4518 yymsg_alloc = yyalloc;
4519 else
4520 {
4521 yymsg = yymsgbuf;
4522 yymsg_alloc = sizeof yymsgbuf;
4523 }
4524 }
4525
4526 if (0 < yysize && yysize <= yymsg_alloc)
4527 {
4528 (void) yysyntax_error (yymsg, yystate, yychar);
4529 yyerror (context, yymsg);
4530 }
4531 else
4532 {
4533 yyerror (context, YY_("syntax error"));
4534 if (yysize != 0)
4535 goto yyexhaustedlab;
4536 }
4537 }
4538#endif
4539 }
4540
4541
4542
4543 if (yyerrstatus == 3)
4544 {
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004545 /* If just tried and failed to reuse lookahead token after an
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004546 error, discard it. */
4547
4548 if (yychar <= YYEOF)
4549 {
4550 /* Return failure if at end of input. */
4551 if (yychar == YYEOF)
4552 YYABORT;
4553 }
4554 else
4555 {
4556 yydestruct ("Error: discarding",
4557 yytoken, &yylval, context);
4558 yychar = YYEMPTY;
4559 }
4560 }
4561
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004562 /* Else will try to reuse lookahead token after shifting the error
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004563 token. */
4564 goto yyerrlab1;
4565
4566
4567/*---------------------------------------------------.
4568| yyerrorlab -- error raised explicitly by YYERROR. |
4569`---------------------------------------------------*/
4570yyerrorlab:
4571
4572 /* Pacify compilers like GCC when the user code never invokes
4573 YYERROR and the label yyerrorlab therefore never appears in user
4574 code. */
4575 if (/*CONSTCOND*/ 0)
4576 goto yyerrorlab;
4577
4578 /* Do not reclaim the symbols of the rule which action triggered
4579 this YYERROR. */
4580 YYPOPSTACK (yylen);
4581 yylen = 0;
4582 YY_STACK_PRINT (yyss, yyssp);
4583 yystate = *yyssp;
4584 goto yyerrlab1;
4585
4586
4587/*-------------------------------------------------------------.
4588| yyerrlab1 -- common code for both syntax error and YYERROR. |
4589`-------------------------------------------------------------*/
4590yyerrlab1:
4591 yyerrstatus = 3; /* Each real token shifted decrements this. */
4592
4593 for (;;)
4594 {
4595 yyn = yypact[yystate];
4596 if (yyn != YYPACT_NINF)
4597 {
4598 yyn += YYTERROR;
4599 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
4600 {
4601 yyn = yytable[yyn];
4602 if (0 < yyn)
4603 break;
4604 }
4605 }
4606
4607 /* Pop the current state because it cannot handle the error token. */
4608 if (yyssp == yyss)
4609 YYABORT;
4610
4611
4612 yydestruct ("Error: popping",
4613 yystos[yystate], yyvsp, context);
4614 YYPOPSTACK (1);
4615 yystate = *yyssp;
4616 YY_STACK_PRINT (yyss, yyssp);
4617 }
4618
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004619 *++yyvsp = yylval;
4620
4621
4622 /* Shift the error token. */
4623 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
4624
4625 yystate = yyn;
4626 goto yynewstate;
4627
4628
4629/*-------------------------------------.
4630| yyacceptlab -- YYACCEPT comes here. |
4631`-------------------------------------*/
4632yyacceptlab:
4633 yyresult = 0;
4634 goto yyreturn;
4635
4636/*-----------------------------------.
4637| yyabortlab -- YYABORT comes here. |
4638`-----------------------------------*/
4639yyabortlab:
4640 yyresult = 1;
4641 goto yyreturn;
4642
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004643#if !defined(yyoverflow) || YYERROR_VERBOSE
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004644/*-------------------------------------------------.
4645| yyexhaustedlab -- memory exhaustion comes here. |
4646`-------------------------------------------------*/
4647yyexhaustedlab:
4648 yyerror (context, YY_("memory exhausted"));
4649 yyresult = 2;
4650 /* Fall through. */
4651#endif
4652
4653yyreturn:
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004654 if (yychar != YYEMPTY)
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004655 yydestruct ("Cleanup: discarding lookahead",
4656 yytoken, &yylval, context);
4657 /* Do not reclaim the symbols of the rule which action triggered
4658 this YYABORT or YYACCEPT. */
4659 YYPOPSTACK (yylen);
4660 YY_STACK_PRINT (yyss, yyssp);
4661 while (yyssp != yyss)
4662 {
4663 yydestruct ("Cleanup: popping",
4664 yystos[*yyssp], yyvsp, context);
4665 YYPOPSTACK (1);
4666 }
4667#ifndef yyoverflow
4668 if (yyss != yyssa)
4669 YYSTACK_FREE (yyss);
4670#endif
4671#if YYERROR_VERBOSE
4672 if (yymsg != yymsgbuf)
4673 YYSTACK_FREE (yymsg);
4674#endif
4675 /* Make sure YYID is used. */
4676 return YYID (yyresult);
4677}
4678
4679
4680
4681
4682
4683int glslang_parse(TParseContext* context) {
4684 return yyparse(context);
4685}
4686
4687