blob: 2231728cbff3fd04e4786e5c4ce11384024cd95b [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
daniel@transgaming.comb3077d02013-01-11 04:12:09 +000094#define YYENABLE_NLS 0
95#define YYLTYPE_IS_TRIVIAL 1
96
daniel@transgaming.com05bc2042012-03-09 21:56:58 +000097#define YYLEX_PARAM context->scanner
98
99
100
101/* Enabling traces. */
102#ifndef YYDEBUG
103# define YYDEBUG 0
104#endif
105
106/* Enabling verbose error messages. */
107#ifdef YYERROR_VERBOSE
108# undef YYERROR_VERBOSE
109# define YYERROR_VERBOSE 1
110#else
111# define YYERROR_VERBOSE 0
112#endif
113
114/* Enabling the token table. */
115#ifndef YYTOKEN_TABLE
116# define YYTOKEN_TABLE 0
117#endif
118
119
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000120/* Tokens. */
121#ifndef YYTOKENTYPE
122# define YYTOKENTYPE
123 /* Put the tokens into the symbol table, so that GDB and other debuggers
124 know about them. */
125 enum yytokentype {
126 INVARIANT = 258,
127 HIGH_PRECISION = 259,
128 MEDIUM_PRECISION = 260,
129 LOW_PRECISION = 261,
130 PRECISION = 262,
131 ATTRIBUTE = 263,
132 CONST_QUAL = 264,
133 BOOL_TYPE = 265,
134 FLOAT_TYPE = 266,
135 INT_TYPE = 267,
136 BREAK = 268,
137 CONTINUE = 269,
138 DO = 270,
139 ELSE = 271,
140 FOR = 272,
141 IF = 273,
142 DISCARD = 274,
143 RETURN = 275,
144 BVEC2 = 276,
145 BVEC3 = 277,
146 BVEC4 = 278,
147 IVEC2 = 279,
148 IVEC3 = 280,
149 IVEC4 = 281,
150 VEC2 = 282,
151 VEC3 = 283,
152 VEC4 = 284,
153 MATRIX2 = 285,
154 MATRIX3 = 286,
155 MATRIX4 = 287,
156 IN_QUAL = 288,
157 OUT_QUAL = 289,
158 INOUT_QUAL = 290,
159 UNIFORM = 291,
160 VARYING = 292,
161 STRUCT = 293,
162 VOID_TYPE = 294,
163 WHILE = 295,
164 SAMPLER2D = 296,
165 SAMPLERCUBE = 297,
zmo@google.com09c323a2011-08-12 18:22:25 +0000166 SAMPLER_EXTERNAL_OES = 298,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000167 SAMPLER2DRECT = 299,
168 IDENTIFIER = 300,
169 TYPE_NAME = 301,
170 FLOATCONSTANT = 302,
171 INTCONSTANT = 303,
172 BOOLCONSTANT = 304,
173 FIELD_SELECTION = 305,
174 LEFT_OP = 306,
175 RIGHT_OP = 307,
176 INC_OP = 308,
177 DEC_OP = 309,
178 LE_OP = 310,
179 GE_OP = 311,
180 EQ_OP = 312,
181 NE_OP = 313,
182 AND_OP = 314,
183 OR_OP = 315,
184 XOR_OP = 316,
185 MUL_ASSIGN = 317,
186 DIV_ASSIGN = 318,
187 ADD_ASSIGN = 319,
188 MOD_ASSIGN = 320,
189 LEFT_ASSIGN = 321,
190 RIGHT_ASSIGN = 322,
191 AND_ASSIGN = 323,
192 XOR_ASSIGN = 324,
193 OR_ASSIGN = 325,
194 SUB_ASSIGN = 326,
195 LEFT_PAREN = 327,
196 RIGHT_PAREN = 328,
197 LEFT_BRACKET = 329,
198 RIGHT_BRACKET = 330,
199 LEFT_BRACE = 331,
200 RIGHT_BRACE = 332,
201 DOT = 333,
202 COMMA = 334,
203 COLON = 335,
204 EQUAL = 336,
205 SEMICOLON = 337,
206 BANG = 338,
207 DASH = 339,
208 TILDE = 340,
209 PLUS = 341,
210 STAR = 342,
211 SLASH = 343,
212 PERCENT = 344,
213 LEFT_ANGLE = 345,
214 RIGHT_ANGLE = 346,
215 VERTICAL_BAR = 347,
216 CARET = 348,
217 AMPERSAND = 349,
218 QUESTION = 350
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000219 };
220#endif
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000221
222
223
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000224#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
225typedef union YYSTYPE
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000226{
daniel@transgaming.com05bc2042012-03-09 21:56:58 +0000227
228
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000229 struct {
230 TSourceLoc line;
231 union {
232 TString *string;
233 float f;
234 int i;
235 bool b;
236 };
237 TSymbol* symbol;
238 } lex;
239 struct {
240 TSourceLoc line;
241 TOperator op;
242 union {
243 TIntermNode* intermNode;
244 TIntermNodePair nodePair;
245 TIntermTyped* intermTypedNode;
246 TIntermAggregate* intermAggregate;
247 };
248 union {
249 TPublicType type;
250 TPrecision precision;
251 TQualifier qualifier;
252 TFunction* function;
253 TParameter param;
254 TTypeLine typeLine;
255 TTypeList* typeList;
256 };
257 } interm;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000258
daniel@transgaming.com05bc2042012-03-09 21:56:58 +0000259
260
261} YYSTYPE;
262# define YYSTYPE_IS_TRIVIAL 1
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000263# define yystype YYSTYPE /* obsolescent; will be withdrawn */
264# define YYSTYPE_IS_DECLARED 1
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000265#endif
266
267
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000268/* Copy the second part of user declarations. */
269
270
271extern int yylex(YYSTYPE* yylval_param, void* yyscanner);
272extern void yyerror(TParseContext* context, const char* reason);
273
274#define FRAG_VERT_ONLY(S, L) { \
275 if (context->shaderType != SH_FRAGMENT_SHADER && \
276 context->shaderType != SH_VERTEX_SHADER) { \
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +0000277 context->error(L, " supported in vertex/fragment shaders only ", S); \
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000278 context->recover(); \
279 } \
280}
281
282#define VERTEX_ONLY(S, L) { \
283 if (context->shaderType != SH_VERTEX_SHADER) { \
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +0000284 context->error(L, " supported in vertex shaders only ", S); \
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000285 context->recover(); \
286 } \
287}
288
289#define FRAG_ONLY(S, L) { \
290 if (context->shaderType != SH_FRAGMENT_SHADER) { \
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +0000291 context->error(L, " supported in fragment shaders only ", S); \
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000292 context->recover(); \
293 } \
294}
295
296
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000297
298#ifdef short
299# undef short
300#endif
301
302#ifdef YYTYPE_UINT8
303typedef YYTYPE_UINT8 yytype_uint8;
304#else
305typedef unsigned char yytype_uint8;
306#endif
307
308#ifdef YYTYPE_INT8
309typedef YYTYPE_INT8 yytype_int8;
310#elif (defined __STDC__ || defined __C99__FUNC__ \
311 || defined __cplusplus || defined _MSC_VER)
312typedef signed char yytype_int8;
313#else
314typedef short int yytype_int8;
315#endif
316
317#ifdef YYTYPE_UINT16
318typedef YYTYPE_UINT16 yytype_uint16;
319#else
320typedef unsigned short int yytype_uint16;
321#endif
322
323#ifdef YYTYPE_INT16
324typedef YYTYPE_INT16 yytype_int16;
325#else
326typedef short int yytype_int16;
327#endif
328
329#ifndef YYSIZE_T
330# ifdef __SIZE_TYPE__
331# define YYSIZE_T __SIZE_TYPE__
332# elif defined size_t
333# define YYSIZE_T size_t
334# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
335 || defined __cplusplus || defined _MSC_VER)
336# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
337# define YYSIZE_T size_t
338# else
339# define YYSIZE_T unsigned int
340# endif
341#endif
342
343#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
344
345#ifndef YY_
daniel@transgaming.com05bc2042012-03-09 21:56:58 +0000346# if defined YYENABLE_NLS && YYENABLE_NLS
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000347# if ENABLE_NLS
348# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
349# define YY_(msgid) dgettext ("bison-runtime", msgid)
350# endif
351# endif
352# ifndef YY_
353# define YY_(msgid) msgid
354# endif
355#endif
356
357/* Suppress unused-variable warnings by "using" E. */
358#if ! defined lint || defined __GNUC__
359# define YYUSE(e) ((void) (e))
360#else
361# define YYUSE(e) /* empty */
362#endif
363
364/* Identity function, used to suppress warnings about constant conditions. */
365#ifndef lint
366# define YYID(n) (n)
367#else
368#if (defined __STDC__ || defined __C99__FUNC__ \
369 || defined __cplusplus || defined _MSC_VER)
370static int
daniel@transgaming.com05bc2042012-03-09 21:56:58 +0000371YYID (int yyi)
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000372#else
373static int
daniel@transgaming.com05bc2042012-03-09 21:56:58 +0000374YYID (yyi)
375 int yyi;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000376#endif
377{
daniel@transgaming.com05bc2042012-03-09 21:56:58 +0000378 return yyi;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000379}
380#endif
381
382#if ! defined yyoverflow || YYERROR_VERBOSE
383
384/* The parser invokes alloca or malloc; define the necessary symbols. */
385
386# ifdef YYSTACK_USE_ALLOCA
387# if YYSTACK_USE_ALLOCA
388# ifdef __GNUC__
389# define YYSTACK_ALLOC __builtin_alloca
390# elif defined __BUILTIN_VA_ARG_INCR
391# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
392# elif defined _AIX
393# define YYSTACK_ALLOC __alloca
394# elif defined _MSC_VER
395# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
396# define alloca _alloca
397# else
398# define YYSTACK_ALLOC alloca
399# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
400 || defined __cplusplus || defined _MSC_VER)
401# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
402# ifndef _STDLIB_H
403# define _STDLIB_H 1
404# endif
405# endif
406# endif
407# endif
408# endif
409
410# ifdef YYSTACK_ALLOC
411 /* Pacify GCC's `empty if-body' warning. */
412# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
413# ifndef YYSTACK_ALLOC_MAXIMUM
414 /* The OS might guarantee only one guard page at the bottom of the stack,
415 and a page size can be as small as 4096 bytes. So we cannot safely
416 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
417 to allow for a few compiler-allocated temporary stack slots. */
418# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
419# endif
420# else
421# define YYSTACK_ALLOC YYMALLOC
422# define YYSTACK_FREE YYFREE
423# ifndef YYSTACK_ALLOC_MAXIMUM
424# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
425# endif
426# if (defined __cplusplus && ! defined _STDLIB_H \
427 && ! ((defined YYMALLOC || defined malloc) \
428 && (defined YYFREE || defined free)))
429# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
430# ifndef _STDLIB_H
431# define _STDLIB_H 1
432# endif
433# endif
434# ifndef YYMALLOC
435# define YYMALLOC malloc
436# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
437 || defined __cplusplus || defined _MSC_VER)
438void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
439# endif
440# endif
441# ifndef YYFREE
442# define YYFREE free
443# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
444 || defined __cplusplus || defined _MSC_VER)
445void free (void *); /* INFRINGES ON USER NAME SPACE */
446# endif
447# endif
448# endif
449#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
450
451
452#if (! defined yyoverflow \
453 && (! defined __cplusplus \
454 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
455
456/* A type that is properly aligned for any stack member. */
457union yyalloc
458{
daniel@transgaming.com05bc2042012-03-09 21:56:58 +0000459 yytype_int16 yyss_alloc;
460 YYSTYPE yyvs_alloc;
461};
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000462
463/* The size of the maximum gap between one aligned stack and the next. */
464# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
465
466/* The size of an array large to enough to hold all stacks, each with
467 N elements. */
468# define YYSTACK_BYTES(N) \
469 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
470 + YYSTACK_GAP_MAXIMUM)
471
472/* Copy COUNT objects from FROM to TO. The source and destination do
473 not overlap. */
474# ifndef YYCOPY
475# if defined __GNUC__ && 1 < __GNUC__
476# define YYCOPY(To, From, Count) \
477 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
478# else
479# define YYCOPY(To, From, Count) \
480 do \
481 { \
482 YYSIZE_T yyi; \
483 for (yyi = 0; yyi < (Count); yyi++) \
484 (To)[yyi] = (From)[yyi]; \
485 } \
486 while (YYID (0))
487# endif
488# endif
489
490/* Relocate STACK from its old location to the new one. The
491 local variables YYSIZE and YYSTACKSIZE give the old and new number of
492 elements in the stack, and YYPTR gives the new location of the
493 stack. Advance YYPTR to a properly aligned location for the next
494 stack. */
daniel@transgaming.com05bc2042012-03-09 21:56:58 +0000495# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000496 do \
497 { \
498 YYSIZE_T yynewbytes; \
daniel@transgaming.com05bc2042012-03-09 21:56:58 +0000499 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
500 Stack = &yyptr->Stack_alloc; \
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000501 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
502 yyptr += yynewbytes / sizeof (*yyptr); \
503 } \
504 while (YYID (0))
505
506#endif
507
508/* YYFINAL -- State number of the termination state. */
kbr@chromium.org205fef32011-11-22 20:50:02 +0000509#define YYFINAL 71
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000510/* YYLAST -- Last index in YYTABLE. */
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000511#define YYLAST 1416
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000512
513/* YYNTOKENS -- Number of terminals. */
kbr@chromium.org205fef32011-11-22 20:50:02 +0000514#define YYNTOKENS 96
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000515/* YYNNTS -- Number of nonterminals. */
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000516#define YYNNTS 83
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000517/* YYNRULES -- Number of rules. */
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000518#define YYNRULES 201
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000519/* YYNRULES -- Number of states. */
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000520#define YYNSTATES 304
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000521
522/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
523#define YYUNDEFTOK 2
kbr@chromium.org205fef32011-11-22 20:50:02 +0000524#define YYMAXUTOK 350
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000525
526#define YYTRANSLATE(YYX) \
527 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
528
529/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
530static const yytype_uint8 yytranslate[] =
531{
532 0, 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, 2, 2, 2, 2,
555 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
556 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
557 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
558 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
559 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
560 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
561 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
562 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
563 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
564 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
565 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000566 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
567 95
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000568};
569
570#if YYDEBUG
571/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
572 YYRHS. */
573static const yytype_uint16 yyprhs[] =
574{
575 0, 0, 3, 5, 7, 9, 11, 13, 17, 19,
576 24, 26, 30, 33, 36, 38, 40, 42, 46, 49,
577 52, 55, 57, 60, 64, 67, 69, 71, 73, 75,
578 78, 81, 84, 86, 88, 90, 92, 96, 100, 102,
579 106, 110, 112, 114, 118, 122, 126, 130, 132, 136,
580 140, 142, 144, 146, 148, 152, 154, 158, 160, 164,
581 166, 172, 174, 178, 180, 182, 184, 186, 188, 190,
582 194, 196, 199, 202, 207, 210, 212, 214, 217, 221,
583 225, 228, 234, 238, 241, 245, 248, 249, 251, 253,
584 255, 257, 259, 263, 269, 276, 282, 284, 287, 292,
585 298, 303, 306, 308, 311, 313, 315, 317, 320, 322,
586 324, 327, 329, 331, 333, 335, 340, 342, 344, 346,
587 348, 350, 352, 354, 356, 358, 360, 362, 364, 366,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000588 368, 370, 372, 374, 376, 378, 380, 382, 384, 385,
589 392, 393, 399, 401, 404, 408, 410, 414, 416, 421,
590 423, 425, 427, 429, 431, 433, 435, 437, 439, 442,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000591 443, 444, 450, 452, 454, 455, 458, 459, 462, 465,
592 469, 471, 474, 476, 479, 485, 489, 491, 493, 498,
593 499, 506, 507, 516, 517, 525, 527, 529, 531, 532,
594 535, 539, 542, 545, 548, 552, 555, 557, 560, 562,
595 564, 565
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000596};
597
598/* YYRHS -- A `-1'-separated list of the rules' RHS. */
599static const yytype_int16 yyrhs[] =
600{
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000601 175, 0, -1, 45, -1, 97, -1, 48, -1, 47,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000602 -1, 49, -1, 72, 124, 73, -1, 98, -1, 99,
603 74, 100, 75, -1, 101, -1, 99, 78, 50, -1,
604 99, 53, -1, 99, 54, -1, 124, -1, 102, -1,
605 103, -1, 99, 78, 103, -1, 105, 73, -1, 104,
606 73, -1, 106, 39, -1, 106, -1, 106, 122, -1,
607 105, 79, 122, -1, 107, 72, -1, 142, -1, 45,
608 -1, 50, -1, 99, -1, 53, 108, -1, 54, 108,
609 -1, 109, 108, -1, 86, -1, 84, -1, 83, -1,
610 108, -1, 110, 87, 108, -1, 110, 88, 108, -1,
611 110, -1, 111, 86, 110, -1, 111, 84, 110, -1,
612 111, -1, 112, -1, 113, 90, 112, -1, 113, 91,
613 112, -1, 113, 55, 112, -1, 113, 56, 112, -1,
614 113, -1, 114, 57, 113, -1, 114, 58, 113, -1,
615 114, -1, 115, -1, 116, -1, 117, -1, 118, 59,
616 117, -1, 118, -1, 119, 61, 118, -1, 119, -1,
617 120, 60, 119, -1, 120, -1, 120, 95, 124, 80,
618 122, -1, 121, -1, 108, 123, 122, -1, 81, -1,
619 62, -1, 63, -1, 64, -1, 71, -1, 122, -1,
620 124, 79, 122, -1, 121, -1, 127, 82, -1, 135,
621 82, -1, 7, 140, 141, 82, -1, 128, 73, -1,
622 130, -1, 129, -1, 130, 132, -1, 129, 79, 132,
623 -1, 137, 45, 72, -1, 139, 45, -1, 139, 45,
624 74, 125, 75, -1, 138, 133, 131, -1, 133, 131,
625 -1, 138, 133, 134, -1, 133, 134, -1, -1, 33,
626 -1, 34, -1, 35, -1, 139, -1, 136, -1, 135,
627 79, 45, -1, 135, 79, 45, 74, 75, -1, 135,
628 79, 45, 74, 125, 75, -1, 135, 79, 45, 81,
629 150, -1, 137, -1, 137, 45, -1, 137, 45, 74,
630 75, -1, 137, 45, 74, 125, 75, -1, 137, 45,
631 81, 150, -1, 3, 45, -1, 139, -1, 138, 139,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000632 -1, 9, -1, 8, -1, 37, -1, 3, 37, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000633 36, -1, 141, -1, 140, 141, -1, 4, -1, 5,
634 -1, 6, -1, 142, -1, 142, 74, 125, 75, -1,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000635 39, -1, 11, -1, 12, -1, 10, -1, 27, -1,
636 28, -1, 29, -1, 21, -1, 22, -1, 23, -1,
637 24, -1, 25, -1, 26, -1, 30, -1, 31, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000638 32, -1, 41, -1, 42, -1, 43, -1, 44, -1,
639 143, -1, 46, -1, -1, 38, 45, 76, 144, 146,
640 77, -1, -1, 38, 76, 145, 146, 77, -1, 147,
641 -1, 146, 147, -1, 139, 148, 82, -1, 149, -1,
642 148, 79, 149, -1, 45, -1, 45, 74, 125, 75,
643 -1, 122, -1, 126, -1, 154, -1, 153, -1, 151,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000644 -1, 163, -1, 164, -1, 167, -1, 174, -1, 76,
645 77, -1, -1, -1, 76, 155, 162, 156, 77, -1,
646 161, -1, 153, -1, -1, 159, 161, -1, -1, 160,
647 153, -1, 76, 77, -1, 76, 162, 77, -1, 152,
648 -1, 162, 152, -1, 82, -1, 124, 82, -1, 18,
649 72, 124, 73, 165, -1, 158, 16, 158, -1, 158,
650 -1, 124, -1, 137, 45, 81, 150, -1, -1, 40,
651 72, 168, 166, 73, 157, -1, -1, 15, 169, 158,
652 40, 72, 124, 73, 82, -1, -1, 17, 72, 170,
653 171, 173, 73, 157, -1, 163, -1, 151, -1, 166,
654 -1, -1, 172, 82, -1, 172, 82, 124, -1, 14,
655 82, -1, 13, 82, -1, 20, 82, -1, 20, 124,
656 82, -1, 19, 82, -1, 176, -1, 175, 176, -1,
657 177, -1, 126, -1, -1, 127, 178, 161, -1
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000658};
659
660/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
661static const yytype_uint16 yyrline[] =
662{
daniel@transgaming.comb3077d02013-01-11 04:12:09 +0000663 0, 168, 168, 203, 206, 219, 224, 229, 235, 238,
664 317, 320, 421, 431, 444, 452, 552, 555, 563, 567,
665 574, 578, 585, 591, 600, 608, 663, 670, 680, 683,
666 693, 703, 724, 725, 726, 731, 732, 741, 753, 754,
667 762, 773, 777, 778, 788, 798, 808, 821, 822, 832,
668 845, 849, 853, 857, 858, 871, 872, 885, 886, 899,
669 900, 917, 918, 931, 932, 933, 934, 935, 939, 942,
shannon.woods%transgaming.com@gtempaccount.comcbb6b6a2013-04-13 03:27:47 +0000670 953, 961, 988, 993, 1007, 1045, 1048, 1055, 1063, 1084,
671 1105, 1116, 1145, 1150, 1160, 1165, 1175, 1178, 1181, 1184,
672 1190, 1197, 1200, 1222, 1240, 1264, 1287, 1291, 1309, 1317,
673 1349, 1369, 1458, 1467, 1490, 1493, 1499, 1507, 1515, 1523,
674 1533, 1540, 1543, 1546, 1552, 1555, 1570, 1574, 1578, 1582,
675 1591, 1596, 1601, 1606, 1611, 1616, 1621, 1626, 1631, 1636,
676 1642, 1648, 1654, 1659, 1664, 1673, 1682, 1687, 1700, 1700,
677 1714, 1714, 1723, 1726, 1741, 1777, 1781, 1787, 1795, 1811,
678 1815, 1819, 1820, 1826, 1827, 1828, 1829, 1830, 1834, 1835,
679 1835, 1835, 1845, 1846, 1850, 1850, 1851, 1851, 1856, 1859,
680 1869, 1872, 1878, 1879, 1883, 1891, 1895, 1905, 1910, 1927,
681 1927, 1932, 1932, 1939, 1939, 1947, 1950, 1956, 1959, 1965,
682 1969, 1976, 1983, 1990, 1997, 2008, 2017, 2021, 2028, 2031,
683 2037, 2037
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000684};
685#endif
686
687#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
688/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
689 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
690static const char *const yytname[] =
691{
692 "$end", "error", "$undefined", "INVARIANT", "HIGH_PRECISION",
693 "MEDIUM_PRECISION", "LOW_PRECISION", "PRECISION", "ATTRIBUTE",
694 "CONST_QUAL", "BOOL_TYPE", "FLOAT_TYPE", "INT_TYPE", "BREAK", "CONTINUE",
695 "DO", "ELSE", "FOR", "IF", "DISCARD", "RETURN", "BVEC2", "BVEC3",
696 "BVEC4", "IVEC2", "IVEC3", "IVEC4", "VEC2", "VEC3", "VEC4", "MATRIX2",
697 "MATRIX3", "MATRIX4", "IN_QUAL", "OUT_QUAL", "INOUT_QUAL", "UNIFORM",
698 "VARYING", "STRUCT", "VOID_TYPE", "WHILE", "SAMPLER2D", "SAMPLERCUBE",
kbr@chromium.org205fef32011-11-22 20:50:02 +0000699 "SAMPLER_EXTERNAL_OES", "SAMPLER2DRECT", "IDENTIFIER", "TYPE_NAME",
700 "FLOATCONSTANT", "INTCONSTANT", "BOOLCONSTANT", "FIELD_SELECTION",
701 "LEFT_OP", "RIGHT_OP", "INC_OP", "DEC_OP", "LE_OP", "GE_OP", "EQ_OP",
702 "NE_OP", "AND_OP", "OR_OP", "XOR_OP", "MUL_ASSIGN", "DIV_ASSIGN",
703 "ADD_ASSIGN", "MOD_ASSIGN", "LEFT_ASSIGN", "RIGHT_ASSIGN", "AND_ASSIGN",
704 "XOR_ASSIGN", "OR_ASSIGN", "SUB_ASSIGN", "LEFT_PAREN", "RIGHT_PAREN",
705 "LEFT_BRACKET", "RIGHT_BRACKET", "LEFT_BRACE", "RIGHT_BRACE", "DOT",
706 "COMMA", "COLON", "EQUAL", "SEMICOLON", "BANG", "DASH", "TILDE", "PLUS",
707 "STAR", "SLASH", "PERCENT", "LEFT_ANGLE", "RIGHT_ANGLE", "VERTICAL_BAR",
708 "CARET", "AMPERSAND", "QUESTION", "$accept", "variable_identifier",
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000709 "primary_expression", "postfix_expression", "integer_expression",
710 "function_call", "function_call_or_method", "function_call_generic",
711 "function_call_header_no_parameters",
712 "function_call_header_with_parameters", "function_call_header",
713 "function_identifier", "unary_expression", "unary_operator",
714 "multiplicative_expression", "additive_expression", "shift_expression",
715 "relational_expression", "equality_expression", "and_expression",
716 "exclusive_or_expression", "inclusive_or_expression",
717 "logical_and_expression", "logical_xor_expression",
718 "logical_or_expression", "conditional_expression",
719 "assignment_expression", "assignment_operator", "expression",
720 "constant_expression", "declaration", "function_prototype",
721 "function_declarator", "function_header_with_parameters",
722 "function_header", "parameter_declarator", "parameter_declaration",
723 "parameter_qualifier", "parameter_type_specifier",
724 "init_declarator_list", "single_declaration", "fully_specified_type",
725 "type_qualifier", "type_specifier", "precision_qualifier",
726 "type_specifier_no_prec", "type_specifier_nonarray", "struct_specifier",
daniel@transgaming.com05bc2042012-03-09 21:56:58 +0000727 "$@1", "$@2", "struct_declaration_list", "struct_declaration",
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000728 "struct_declarator_list", "struct_declarator", "initializer",
729 "declaration_statement", "statement", "simple_statement",
daniel@transgaming.com05bc2042012-03-09 21:56:58 +0000730 "compound_statement", "$@3", "$@4", "statement_no_new_scope",
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000731 "statement_with_scope", "$@5", "$@6", "compound_statement_no_new_scope",
732 "statement_list", "expression_statement", "selection_statement",
733 "selection_rest_statement", "condition", "iteration_statement", "$@7",
734 "$@8", "$@9", "for_init_statement", "conditionopt", "for_rest_statement",
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000735 "jump_statement", "translation_unit", "external_declaration",
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000736 "function_definition", "$@10", 0
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000737};
738#endif
739
740# ifdef YYPRINT
741/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
742 token YYLEX-NUM. */
743static const yytype_uint16 yytoknum[] =
744{
745 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
746 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
747 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
748 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
749 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
750 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
751 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
752 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
753 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000754 345, 346, 347, 348, 349, 350
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000755};
756# endif
757
758/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
759static const yytype_uint8 yyr1[] =
760{
kbr@chromium.org205fef32011-11-22 20:50:02 +0000761 0, 96, 97, 98, 98, 98, 98, 98, 99, 99,
762 99, 99, 99, 99, 100, 101, 102, 102, 103, 103,
763 104, 104, 105, 105, 106, 107, 107, 107, 108, 108,
764 108, 108, 109, 109, 109, 110, 110, 110, 111, 111,
765 111, 112, 113, 113, 113, 113, 113, 114, 114, 114,
766 115, 116, 117, 118, 118, 119, 119, 120, 120, 121,
767 121, 122, 122, 123, 123, 123, 123, 123, 124, 124,
768 125, 126, 126, 126, 127, 128, 128, 129, 129, 130,
769 131, 131, 132, 132, 132, 132, 133, 133, 133, 133,
770 134, 135, 135, 135, 135, 135, 136, 136, 136, 136,
771 136, 136, 137, 137, 138, 138, 138, 138, 138, 139,
772 139, 140, 140, 140, 141, 141, 142, 142, 142, 142,
773 142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
774 142, 142, 142, 142, 142, 142, 142, 142, 144, 143,
775 145, 143, 146, 146, 147, 148, 148, 149, 149, 150,
776 151, 152, 152, 153, 153, 153, 153, 153, 154, 155,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000777 156, 154, 157, 157, 159, 158, 160, 158, 161, 161,
778 162, 162, 163, 163, 164, 165, 165, 166, 166, 168,
779 167, 169, 167, 170, 167, 171, 171, 172, 172, 173,
780 173, 174, 174, 174, 174, 174, 175, 175, 176, 176,
781 178, 177
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000782};
783
784/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
785static const yytype_uint8 yyr2[] =
786{
787 0, 2, 1, 1, 1, 1, 1, 3, 1, 4,
788 1, 3, 2, 2, 1, 1, 1, 3, 2, 2,
789 2, 1, 2, 3, 2, 1, 1, 1, 1, 2,
790 2, 2, 1, 1, 1, 1, 3, 3, 1, 3,
791 3, 1, 1, 3, 3, 3, 3, 1, 3, 3,
792 1, 1, 1, 1, 3, 1, 3, 1, 3, 1,
793 5, 1, 3, 1, 1, 1, 1, 1, 1, 3,
794 1, 2, 2, 4, 2, 1, 1, 2, 3, 3,
795 2, 5, 3, 2, 3, 2, 0, 1, 1, 1,
796 1, 1, 3, 5, 6, 5, 1, 2, 4, 5,
797 4, 2, 1, 2, 1, 1, 1, 2, 1, 1,
798 2, 1, 1, 1, 1, 4, 1, 1, 1, 1,
799 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000800 1, 1, 1, 1, 1, 1, 1, 1, 0, 6,
801 0, 5, 1, 2, 3, 1, 3, 1, 4, 1,
802 1, 1, 1, 1, 1, 1, 1, 1, 2, 0,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000803 0, 5, 1, 1, 0, 2, 0, 2, 2, 3,
804 1, 2, 1, 2, 5, 3, 1, 1, 4, 0,
805 6, 0, 8, 0, 7, 1, 1, 1, 0, 2,
806 3, 2, 2, 2, 3, 2, 1, 2, 1, 1,
807 0, 3
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000808};
809
810/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
811 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
812 means the default is an error. */
813static const yytype_uint8 yydefact[] =
814{
815 0, 0, 111, 112, 113, 0, 105, 104, 119, 117,
816 118, 123, 124, 125, 126, 127, 128, 120, 121, 122,
zmo@google.com09c323a2011-08-12 18:22:25 +0000817 129, 130, 131, 108, 106, 0, 116, 132, 133, 134,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000818 135, 137, 199, 200, 0, 76, 86, 0, 91, 96,
819 0, 102, 0, 109, 114, 136, 0, 196, 198, 107,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000820 101, 0, 0, 140, 71, 0, 74, 86, 0, 87,
821 88, 89, 77, 0, 86, 0, 72, 97, 103, 110,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000822 0, 1, 197, 0, 138, 0, 0, 201, 78, 83,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000823 85, 90, 0, 92, 79, 0, 0, 2, 5, 4,
824 6, 27, 0, 0, 0, 34, 33, 32, 3, 8,
825 28, 10, 15, 16, 0, 0, 21, 0, 35, 0,
826 38, 41, 42, 47, 50, 51, 52, 53, 55, 57,
827 59, 70, 0, 25, 73, 0, 0, 0, 142, 0,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000828 0, 181, 0, 0, 0, 0, 0, 159, 168, 172,
829 35, 61, 68, 0, 150, 0, 114, 153, 170, 152,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000830 151, 0, 154, 155, 156, 157, 80, 82, 84, 0,
831 0, 98, 0, 149, 100, 29, 30, 0, 12, 13,
832 0, 0, 19, 18, 0, 20, 22, 24, 31, 0,
kbr@chromium.org476541f2011-10-27 21:14:51 +0000833 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000834 0, 0, 0, 115, 0, 147, 0, 145, 141, 143,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000835 192, 191, 166, 183, 0, 195, 193, 0, 179, 158,
836 0, 64, 65, 66, 67, 63, 0, 0, 173, 169,
837 171, 0, 93, 0, 95, 99, 7, 0, 14, 26,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000838 11, 17, 23, 36, 37, 40, 39, 45, 46, 43,
839 44, 48, 49, 54, 56, 58, 0, 139, 0, 0,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000840 144, 0, 0, 0, 0, 0, 194, 0, 160, 62,
841 69, 0, 94, 9, 0, 0, 146, 0, 165, 167,
842 186, 185, 188, 166, 177, 0, 0, 0, 81, 60,
843 148, 0, 187, 0, 0, 176, 174, 0, 0, 161,
844 0, 189, 0, 166, 0, 163, 180, 162, 0, 190,
845 184, 175, 178, 182
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000846};
847
848/* YYDEFGOTO[NTERM-NUM]. */
849static const yytype_int16 yydefgoto[] =
850{
kbr@chromium.org205fef32011-11-22 20:50:02 +0000851 -1, 98, 99, 100, 227, 101, 102, 103, 104, 105,
852 106, 107, 140, 109, 110, 111, 112, 113, 114, 115,
853 116, 117, 118, 119, 120, 141, 142, 216, 143, 122,
854 144, 145, 34, 35, 36, 79, 62, 63, 80, 37,
855 38, 39, 40, 41, 42, 43, 123, 45, 125, 75,
856 127, 128, 196, 197, 164, 147, 148, 149, 150, 210,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000857 277, 296, 251, 252, 253, 297, 151, 152, 153, 286,
858 276, 154, 257, 202, 254, 272, 283, 284, 155, 46,
859 47, 48, 55
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000860};
861
862/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
863 STATE-NUM. */
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000864#define YYPACT_NINF -266
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000865static const yytype_int16 yypact[] =
866{
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000867 1253, -20, -266, -266, -266, 148, -266, -266, -266, -266,
868 -266, -266, -266, -266, -266, -266, -266, -266, -266, -266,
869 -266, -266, -266, -266, -266, -39, -266, -266, -266, -266,
870 -266, -266, -266, -18, -2, 6, 21, -61, -266, 51,
871 1296, -266, 1370, -266, 25, -266, 1209, -266, -266, -266,
872 -266, 1370, 42, -266, -266, 50, -266, 71, 95, -266,
873 -266, -266, -266, 1296, 123, 105, -266, 9, -266, -266,
874 974, -266, -266, 81, -266, 1296, 290, -266, -266, -266,
875 -266, 125, 1296, -13, -266, 776, 974, 99, -266, -266,
876 -266, -266, 974, 974, 974, -266, -266, -266, -266, -266,
877 35, -266, -266, -266, 100, -6, 1040, 104, -266, 974,
878 36, -64, -266, -21, 102, -266, -266, -266, 113, 117,
879 -51, -266, 108, -266, -266, 1296, 129, 1109, -266, 97,
880 103, -266, 112, 114, 106, 842, 115, 116, -266, -266,
881 39, -266, -266, -43, -266, -18, 47, -266, -266, -266,
882 -266, 374, -266, -266, -266, -266, 118, -266, -266, 908,
883 974, -266, 120, -266, -266, -266, -266, 19, -266, -266,
884 974, 1333, -266, -266, 974, 119, -266, -266, -266, 974,
885 974, 974, 974, 974, 974, 974, 974, 974, 974, 974,
886 974, 974, 974, -266, 1152, 122, -29, -266, -266, -266,
887 -266, -266, 121, -266, 974, -266, -266, 5, -266, -266,
888 458, -266, -266, -266, -266, -266, 974, 974, -266, -266,
889 -266, 974, -266, 137, -266, -266, -266, 138, 111, -266,
890 142, -266, -266, -266, -266, 36, 36, -266, -266, -266,
891 -266, -21, -21, -266, 113, 117, 82, -266, 974, 129,
892 -266, 175, 50, 626, 710, 38, -266, 197, 458, -266,
893 -266, 141, -266, -266, 974, 155, -266, 145, -266, -266,
894 -266, -266, 197, 121, 111, 186, 159, 160, -266, -266,
895 -266, 974, -266, 166, 176, 236, -266, 174, 542, -266,
896 43, 974, 542, 121, 974, -266, -266, -266, 177, 111,
897 -266, -266, -266, -266
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000898};
899
900/* YYPGOTO[NTERM-NUM]. */
901static const yytype_int16 yypgoto[] =
902{
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000903 -266, -266, -266, -266, -266, -266, -266, 85, -266, -266,
904 -266, -266, -44, -266, -15, -266, -55, -19, -266, -266,
905 -266, 72, 70, 73, -266, -66, -83, -266, -92, -73,
906 13, 14, -266, -266, -266, 180, 206, 201, 184, -266,
907 -266, -241, -25, -30, 262, -4, 0, -266, -266, -266,
908 143, -122, -266, 22, -145, 16, -144, -226, -266, -266,
909 -266, -17, -265, -266, -266, -54, 63, 20, -266, -266,
910 4, -266, -266, -266, -266, -266, -266, -266, -266, -266,
911 231, -266, -266
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000912};
913
914/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
915 positive, shift that token. If negative, reduce the rule which
916 number is the opposite. If zero, do what YYDEFACT says.
917 If YYTABLE_NINF, syntax error. */
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000918#define YYTABLE_NINF -165
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000919static const yytype_int16 yytable[] =
920{
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000921 44, 77, 167, 163, 121, 199, 52, 220, 285, 191,
922 68, 64, 162, 32, 33, 224, 275, 49, 65, 121,
923 181, 66, 182, 176, 58, 50, 108, 269, 301, 6,
924 7, 275, 64, 81, 183, 184, 217, 53, 69, 218,
925 44, 108, 44, 207, 192, 126, 44, 73, 165, 166,
926 249, 44, 81, 250, 59, 60, 61, 23, 24, 32,
927 33, 159, 295, 44, 54, 178, 295, 173, 160, 185,
928 186, 56, 199, 174, 58, 44, 146, 163, 228, 6,
929 7, 84, 44, 85, 217, 57, 223, 256, 168, 169,
930 86, 232, 226, 121, -75, 126, 67, 126, 217, 70,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000931 246, 211, 212, 213, 59, 60, 61, 23, 24, 170,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000932 214, 273, 255, 171, 220, 108, 298, 217, 74, -25,
933 215, 70, 217, 179, 180, 44, 76, 44, 237, 238,
934 239, 240, 49, 259, 260, 233, 234, 108, 108, 108,
935 108, 108, 108, 108, 108, 108, 108, 108, 261, 302,
936 83, 146, 2, 3, 4, 121, 59, 60, 61, 187,
937 188, 217, 264, 124, 126, 274, 235, 236, 241, 242,
938 156, -26, 189, 172, 195, 265, 177, 108, 190, 200,
939 274, 279, 121, 193, 203, 201, 204, 208, 205, 290,
940 217, -116, 221, 209, 44, 225, 248, -164, 268, 299,
941 58, 2, 3, 4, 108, 6, 7, 8, 9, 10,
942 146, 163, 262, 263, -27, 267, 278, 281, 11, 12,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000943 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000944 280, 287, 288, 23, 24, 25, 26, 289, 27, 28,
945 29, 30, 87, 31, 88, 89, 90, 91, 291, 292,
946 92, 93, 293, 146, 146, 294, 231, 146, 146, 303,
947 244, 243, 157, 78, 245, 82, 158, 51, 194, 94,
948 270, 266, 146, 258, 271, 300, 282, 72, 0, 0,
949 95, 96, 0, 97, 0, 0, 0, 0, 146, 0,
950 0, 0, 146, 1, 2, 3, 4, 5, 6, 7,
951 8, 9, 10, 129, 130, 131, 0, 132, 133, 134,
952 135, 11, 12, 13, 14, 15, 16, 17, 18, 19,
953 20, 21, 22, 0, 0, 0, 23, 24, 25, 26,
954 136, 27, 28, 29, 30, 87, 31, 88, 89, 90,
955 91, 0, 0, 92, 93, 0, 0, 0, 0, 0,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000956 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000957 0, 0, 94, 0, 0, 0, 137, 138, 0, 0,
958 0, 0, 139, 95, 96, 0, 97, 1, 2, 3,
959 4, 5, 6, 7, 8, 9, 10, 129, 130, 131,
960 0, 132, 133, 134, 135, 11, 12, 13, 14, 15,
961 16, 17, 18, 19, 20, 21, 22, 0, 0, 0,
962 23, 24, 25, 26, 136, 27, 28, 29, 30, 87,
963 31, 88, 89, 90, 91, 0, 0, 92, 93, 0,
kbr@chromium.org476541f2011-10-27 21:14:51 +0000964 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000965 0, 0, 0, 0, 0, 0, 94, 0, 0, 0,
966 137, 219, 0, 0, 0, 0, 139, 95, 96, 0,
967 97, 1, 2, 3, 4, 5, 6, 7, 8, 9,
968 10, 129, 130, 131, 0, 132, 133, 134, 135, 11,
969 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
970 22, 0, 0, 0, 23, 24, 25, 26, 136, 27,
971 28, 29, 30, 87, 31, 88, 89, 90, 91, 0,
972 0, 92, 93, 0, 0, 0, 0, 0, 0, 0,
kbr@chromium.org476541f2011-10-27 21:14:51 +0000973 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000974 94, 0, 0, 0, 137, 0, 0, 0, 0, 0,
975 139, 95, 96, 0, 97, 1, 2, 3, 4, 5,
976 6, 7, 8, 9, 10, 129, 130, 131, 0, 132,
977 133, 134, 135, 11, 12, 13, 14, 15, 16, 17,
978 18, 19, 20, 21, 22, 0, 0, 0, 23, 24,
979 25, 26, 136, 27, 28, 29, 30, 87, 31, 88,
980 89, 90, 91, 0, 0, 92, 93, 0, 0, 0,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000981 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000982 0, 0, 0, 0, 94, 0, 0, 0, 76, 0,
983 0, 0, 0, 0, 139, 95, 96, 0, 97, 1,
984 2, 3, 4, 5, 6, 7, 8, 9, 10, 129,
985 130, 131, 0, 132, 133, 134, 135, 11, 12, 13,
kbr@chromium.org476541f2011-10-27 21:14:51 +0000986 14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000987 0, 0, 23, 24, 25, 26, 136, 27, 28, 29,
988 30, 87, 31, 88, 89, 90, 91, 0, 0, 92,
989 93, 0, 0, 0, 0, 0, 0, 0, 0, 0,
990 0, 0, 0, 0, 0, 0, 0, 0, 94, 0,
991 0, 0, 0, 0, 0, 0, 0, 0, 139, 95,
992 96, 0, 97, 1, 2, 3, 4, 5, 6, 7,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000993 8, 9, 10, 0, 0, 0, 0, 0, 0, 0,
994 0, 11, 12, 13, 14, 15, 16, 17, 18, 19,
995 20, 21, 22, 0, 0, 0, 23, 24, 25, 26,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +0000996 0, 27, 28, 29, 30, 87, 31, 88, 89, 90,
997 91, 0, 0, 92, 93, 0, 0, 0, 0, 0,
998 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
999 0, 0, 94, 0, 0, 0, 8, 9, 10, 0,
1000 0, 0, 139, 95, 96, 0, 97, 11, 12, 13,
1001 14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
1002 0, 0, 0, 0, 25, 26, 0, 27, 28, 29,
1003 30, 87, 31, 88, 89, 90, 91, 0, 0, 92,
1004 93, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1005 0, 0, 0, 0, 0, 0, 0, 0, 94, 0,
1006 0, 161, 8, 9, 10, 0, 0, 0, 0, 95,
1007 96, 0, 97, 11, 12, 13, 14, 15, 16, 17,
1008 18, 19, 20, 21, 22, 0, 0, 0, 0, 0,
1009 25, 26, 0, 27, 28, 29, 30, 87, 31, 88,
1010 89, 90, 91, 0, 0, 92, 93, 0, 0, 0,
1011 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1012 0, 0, 0, 0, 94, 0, 0, 0, 8, 9,
1013 10, 0, 0, 0, 206, 95, 96, 0, 97, 11,
1014 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
1015 22, 0, 0, 0, 0, 0, 25, 26, 0, 27,
1016 28, 29, 30, 87, 31, 88, 89, 90, 91, 0,
1017 0, 92, 93, 0, 0, 0, 0, 0, 0, 0,
1018 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1019 94, 0, 0, 222, 8, 9, 10, 0, 0, 0,
1020 0, 95, 96, 0, 97, 11, 12, 13, 14, 15,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001021 16, 17, 18, 19, 20, 21, 22, 0, 0, 0,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00001022 0, 0, 25, 26, 0, 27, 28, 29, 30, 87,
1023 31, 88, 89, 90, 91, 0, 0, 92, 93, 0,
1024 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1025 0, 0, 0, 0, 0, 0, 94, 0, 0, 0,
1026 8, 9, 10, 0, 0, 0, 0, 95, 96, 0,
1027 97, 11, 12, 13, 14, 15, 16, 17, 18, 19,
1028 20, 21, 22, 0, 0, 0, 0, 0, 25, 175,
1029 0, 27, 28, 29, 30, 87, 31, 88, 89, 90,
1030 91, 0, 0, 92, 93, 0, 0, 0, 0, 0,
1031 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1032 0, 0, 94, 2, 3, 4, 0, 0, 0, 8,
1033 9, 10, 0, 95, 96, 0, 97, 0, 0, 0,
1034 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
1035 21, 22, 0, 0, 0, 0, 0, 25, 26, 0,
1036 27, 28, 29, 30, 0, 31, 2, 3, 4, 0,
1037 0, 0, 8, 9, 10, 0, 0, 0, 0, 0,
1038 0, 0, 0, 11, 12, 13, 14, 15, 16, 17,
1039 18, 19, 20, 21, 22, 0, 198, 0, 0, 0,
1040 25, 26, 0, 27, 28, 29, 30, 0, 31, 0,
1041 0, 0, 0, 0, 0, 0, 0, 0, 0, 71,
1042 0, 0, 1, 2, 3, 4, 5, 6, 7, 8,
1043 9, 10, 0, 0, 0, 0, 0, 0, 0, 247,
1044 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
1045 21, 22, 0, 0, 0, 23, 24, 25, 26, 0,
1046 27, 28, 29, 30, 0, 31, 1, 2, 3, 4,
1047 5, 6, 7, 8, 9, 10, 0, 0, 0, 0,
1048 0, 0, 0, 0, 11, 12, 13, 14, 15, 16,
1049 17, 18, 19, 20, 21, 22, 0, 0, 0, 23,
1050 24, 25, 26, 0, 27, 28, 29, 30, 0, 31,
1051 2, 3, 4, 0, 0, 0, 8, 9, 10, 0,
1052 0, 0, 0, 0, 0, 0, 0, 11, 12, 13,
1053 14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
1054 0, 0, 0, 0, 25, 26, 0, 27, 28, 29,
1055 30, 0, 31, 8, 9, 10, 0, 0, 0, 0,
1056 0, 0, 0, 0, 11, 12, 13, 14, 15, 16,
1057 17, 18, 19, 20, 21, 22, 0, 0, 0, 0,
1058 0, 25, 26, 0, 27, 28, 29, 30, 229, 31,
1059 8, 9, 10, 230, 0, 0, 0, 0, 0, 0,
1060 0, 11, 12, 13, 14, 15, 16, 17, 18, 19,
1061 20, 21, 22, 0, 0, 0, 0, 0, 25, 26,
1062 0, 27, 28, 29, 30, 0, 31
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001063};
1064
1065static const yytype_int16 yycheck[] =
1066{
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00001067 0, 55, 94, 86, 70, 127, 45, 151, 273, 60,
1068 40, 36, 85, 0, 0, 160, 257, 37, 79, 85,
1069 84, 82, 86, 106, 3, 45, 70, 253, 293, 8,
1070 9, 272, 57, 63, 55, 56, 79, 76, 42, 82,
1071 40, 85, 42, 135, 95, 75, 46, 51, 92, 93,
1072 79, 51, 82, 82, 33, 34, 35, 36, 37, 46,
1073 46, 74, 288, 63, 82, 109, 292, 73, 81, 90,
1074 91, 73, 194, 79, 3, 75, 76, 160, 170, 8,
1075 9, 72, 82, 74, 79, 79, 159, 82, 53, 54,
1076 81, 174, 73, 159, 73, 125, 45, 127, 79, 74,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001077 192, 62, 63, 64, 33, 34, 35, 36, 37, 74,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00001078 71, 73, 204, 78, 258, 159, 73, 79, 76, 72,
1079 81, 74, 79, 87, 88, 125, 76, 127, 183, 184,
1080 185, 186, 37, 216, 217, 179, 180, 181, 182, 183,
1081 184, 185, 186, 187, 188, 189, 190, 191, 221, 294,
1082 45, 151, 4, 5, 6, 221, 33, 34, 35, 57,
1083 58, 79, 80, 82, 194, 257, 181, 182, 187, 188,
1084 45, 72, 59, 73, 45, 248, 72, 221, 61, 82,
1085 272, 264, 248, 75, 72, 82, 72, 72, 82, 281,
1086 79, 72, 74, 77, 194, 75, 74, 76, 252, 291,
1087 3, 4, 5, 6, 248, 8, 9, 10, 11, 12,
1088 210, 294, 75, 75, 72, 40, 75, 72, 21, 22,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001089 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00001090 75, 45, 73, 36, 37, 38, 39, 77, 41, 42,
1091 43, 44, 45, 46, 47, 48, 49, 50, 82, 73,
1092 53, 54, 16, 253, 254, 81, 171, 257, 258, 82,
1093 190, 189, 82, 57, 191, 64, 82, 5, 125, 72,
1094 254, 249, 272, 210, 254, 292, 272, 46, -1, -1,
1095 83, 84, -1, 86, -1, -1, -1, -1, 288, -1,
1096 -1, -1, 292, 3, 4, 5, 6, 7, 8, 9,
1097 10, 11, 12, 13, 14, 15, -1, 17, 18, 19,
1098 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
1099 30, 31, 32, -1, -1, -1, 36, 37, 38, 39,
1100 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
1101 50, -1, -1, 53, 54, -1, -1, -1, -1, -1,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001102 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00001103 -1, -1, 72, -1, -1, -1, 76, 77, -1, -1,
1104 -1, -1, 82, 83, 84, -1, 86, 3, 4, 5,
1105 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
1106 -1, 17, 18, 19, 20, 21, 22, 23, 24, 25,
1107 26, 27, 28, 29, 30, 31, 32, -1, -1, -1,
1108 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
1109 46, 47, 48, 49, 50, -1, -1, 53, 54, -1,
zmo@google.com09c323a2011-08-12 18:22:25 +00001110 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00001111 -1, -1, -1, -1, -1, -1, 72, -1, -1, -1,
1112 76, 77, -1, -1, -1, -1, 82, 83, 84, -1,
1113 86, 3, 4, 5, 6, 7, 8, 9, 10, 11,
1114 12, 13, 14, 15, -1, 17, 18, 19, 20, 21,
1115 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
1116 32, -1, -1, -1, 36, 37, 38, 39, 40, 41,
1117 42, 43, 44, 45, 46, 47, 48, 49, 50, -1,
1118 -1, 53, 54, -1, -1, -1, -1, -1, -1, -1,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001119 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00001120 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
1121 82, 83, 84, -1, 86, 3, 4, 5, 6, 7,
1122 8, 9, 10, 11, 12, 13, 14, 15, -1, 17,
1123 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
1124 28, 29, 30, 31, 32, -1, -1, -1, 36, 37,
1125 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
1126 48, 49, 50, -1, -1, 53, 54, -1, -1, -1,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001127 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00001128 -1, -1, -1, -1, 72, -1, -1, -1, 76, -1,
1129 -1, -1, -1, -1, 82, 83, 84, -1, 86, 3,
1130 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
1131 14, 15, -1, 17, 18, 19, 20, 21, 22, 23,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001132 24, 25, 26, 27, 28, 29, 30, 31, 32, -1,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00001133 -1, -1, 36, 37, 38, 39, 40, 41, 42, 43,
1134 44, 45, 46, 47, 48, 49, 50, -1, -1, 53,
1135 54, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1136 -1, -1, -1, -1, -1, -1, -1, -1, 72, -1,
1137 -1, -1, -1, -1, -1, -1, -1, -1, 82, 83,
1138 84, -1, 86, 3, 4, 5, 6, 7, 8, 9,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001139 10, 11, 12, -1, -1, -1, -1, -1, -1, -1,
1140 -1, 21, 22, 23, 24, 25, 26, 27, 28, 29,
1141 30, 31, 32, -1, -1, -1, 36, 37, 38, 39,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00001142 -1, 41, 42, 43, 44, 45, 46, 47, 48, 49,
1143 50, -1, -1, 53, 54, -1, -1, -1, -1, -1,
1144 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1145 -1, -1, 72, -1, -1, -1, 10, 11, 12, -1,
1146 -1, -1, 82, 83, 84, -1, 86, 21, 22, 23,
1147 24, 25, 26, 27, 28, 29, 30, 31, 32, -1,
1148 -1, -1, -1, -1, 38, 39, -1, 41, 42, 43,
1149 44, 45, 46, 47, 48, 49, 50, -1, -1, 53,
1150 54, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1151 -1, -1, -1, -1, -1, -1, -1, -1, 72, -1,
1152 -1, 75, 10, 11, 12, -1, -1, -1, -1, 83,
1153 84, -1, 86, 21, 22, 23, 24, 25, 26, 27,
1154 28, 29, 30, 31, 32, -1, -1, -1, -1, -1,
1155 38, 39, -1, 41, 42, 43, 44, 45, 46, 47,
1156 48, 49, 50, -1, -1, 53, 54, -1, -1, -1,
1157 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1158 -1, -1, -1, -1, 72, -1, -1, -1, 10, 11,
1159 12, -1, -1, -1, 82, 83, 84, -1, 86, 21,
1160 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
1161 32, -1, -1, -1, -1, -1, 38, 39, -1, 41,
1162 42, 43, 44, 45, 46, 47, 48, 49, 50, -1,
1163 -1, 53, 54, -1, -1, -1, -1, -1, -1, -1,
1164 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1165 72, -1, -1, 75, 10, 11, 12, -1, -1, -1,
1166 -1, 83, 84, -1, 86, 21, 22, 23, 24, 25,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001167 26, 27, 28, 29, 30, 31, 32, -1, -1, -1,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00001168 -1, -1, 38, 39, -1, 41, 42, 43, 44, 45,
1169 46, 47, 48, 49, 50, -1, -1, 53, 54, -1,
1170 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1171 -1, -1, -1, -1, -1, -1, 72, -1, -1, -1,
1172 10, 11, 12, -1, -1, -1, -1, 83, 84, -1,
1173 86, 21, 22, 23, 24, 25, 26, 27, 28, 29,
1174 30, 31, 32, -1, -1, -1, -1, -1, 38, 39,
1175 -1, 41, 42, 43, 44, 45, 46, 47, 48, 49,
1176 50, -1, -1, 53, 54, -1, -1, -1, -1, -1,
1177 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1178 -1, -1, 72, 4, 5, 6, -1, -1, -1, 10,
1179 11, 12, -1, 83, 84, -1, 86, -1, -1, -1,
1180 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
1181 31, 32, -1, -1, -1, -1, -1, 38, 39, -1,
1182 41, 42, 43, 44, -1, 46, 4, 5, 6, -1,
1183 -1, -1, 10, 11, 12, -1, -1, -1, -1, -1,
1184 -1, -1, -1, 21, 22, 23, 24, 25, 26, 27,
1185 28, 29, 30, 31, 32, -1, 77, -1, -1, -1,
1186 38, 39, -1, 41, 42, 43, 44, -1, 46, -1,
1187 -1, -1, -1, -1, -1, -1, -1, -1, -1, 0,
1188 -1, -1, 3, 4, 5, 6, 7, 8, 9, 10,
1189 11, 12, -1, -1, -1, -1, -1, -1, -1, 77,
1190 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
1191 31, 32, -1, -1, -1, 36, 37, 38, 39, -1,
1192 41, 42, 43, 44, -1, 46, 3, 4, 5, 6,
1193 7, 8, 9, 10, 11, 12, -1, -1, -1, -1,
1194 -1, -1, -1, -1, 21, 22, 23, 24, 25, 26,
1195 27, 28, 29, 30, 31, 32, -1, -1, -1, 36,
1196 37, 38, 39, -1, 41, 42, 43, 44, -1, 46,
1197 4, 5, 6, -1, -1, -1, 10, 11, 12, -1,
1198 -1, -1, -1, -1, -1, -1, -1, 21, 22, 23,
1199 24, 25, 26, 27, 28, 29, 30, 31, 32, -1,
1200 -1, -1, -1, -1, 38, 39, -1, 41, 42, 43,
1201 44, -1, 46, 10, 11, 12, -1, -1, -1, -1,
1202 -1, -1, -1, -1, 21, 22, 23, 24, 25, 26,
1203 27, 28, 29, 30, 31, 32, -1, -1, -1, -1,
1204 -1, 38, 39, -1, 41, 42, 43, 44, 45, 46,
1205 10, 11, 12, 50, -1, -1, -1, -1, -1, -1,
1206 -1, 21, 22, 23, 24, 25, 26, 27, 28, 29,
1207 30, 31, 32, -1, -1, -1, -1, -1, 38, 39,
1208 -1, 41, 42, 43, 44, -1, 46
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001209};
1210
1211/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
1212 symbol of state STATE-NUM. */
1213static const yytype_uint8 yystos[] =
1214{
1215 0, 3, 4, 5, 6, 7, 8, 9, 10, 11,
1216 12, 21, 22, 23, 24, 25, 26, 27, 28, 29,
zmo@google.com09c323a2011-08-12 18:22:25 +00001217 30, 31, 32, 36, 37, 38, 39, 41, 42, 43,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001218 44, 46, 126, 127, 128, 129, 130, 135, 136, 137,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00001219 138, 139, 140, 141, 142, 143, 175, 176, 177, 37,
1220 45, 140, 45, 76, 82, 178, 73, 79, 3, 33,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001221 34, 35, 132, 133, 138, 79, 82, 45, 139, 141,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00001222 74, 0, 176, 141, 76, 145, 76, 161, 132, 131,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001223 134, 139, 133, 45, 72, 74, 81, 45, 47, 48,
1224 49, 50, 53, 54, 72, 83, 84, 86, 97, 98,
1225 99, 101, 102, 103, 104, 105, 106, 107, 108, 109,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001226 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001227 120, 121, 125, 142, 82, 144, 139, 146, 147, 13,
1228 14, 15, 17, 18, 19, 20, 40, 76, 77, 82,
1229 108, 121, 122, 124, 126, 127, 142, 151, 152, 153,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00001230 154, 162, 163, 164, 167, 174, 45, 131, 134, 74,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001231 81, 75, 125, 122, 150, 108, 108, 124, 53, 54,
1232 74, 78, 73, 73, 79, 39, 122, 72, 108, 87,
1233 88, 84, 86, 55, 56, 90, 91, 57, 58, 59,
1234 61, 60, 95, 75, 146, 45, 148, 149, 77, 147,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00001235 82, 82, 169, 72, 72, 82, 82, 124, 72, 77,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001236 155, 62, 63, 64, 71, 81, 123, 79, 82, 77,
1237 152, 74, 75, 125, 150, 75, 73, 100, 124, 45,
1238 50, 103, 122, 108, 108, 110, 110, 112, 112, 112,
1239 112, 113, 113, 117, 118, 119, 124, 77, 74, 79,
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00001240 82, 158, 159, 160, 170, 124, 82, 168, 162, 122,
1241 122, 125, 75, 75, 80, 125, 149, 40, 161, 153,
1242 151, 163, 171, 73, 124, 137, 166, 156, 75, 122,
1243 75, 72, 166, 172, 173, 158, 165, 45, 73, 77,
1244 124, 82, 73, 16, 81, 153, 157, 161, 73, 124,
1245 157, 158, 150, 82
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001246};
1247
1248#define yyerrok (yyerrstatus = 0)
1249#define yyclearin (yychar = YYEMPTY)
1250#define YYEMPTY (-2)
1251#define YYEOF 0
1252
1253#define YYACCEPT goto yyacceptlab
1254#define YYABORT goto yyabortlab
1255#define YYERROR goto yyerrorlab
1256
1257
1258/* Like YYERROR except do call yyerror. This remains here temporarily
1259 to ease the transition to the new meaning of YYERROR, for GCC.
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001260 Once GCC version 2 has supplanted version 1, this can go. However,
1261 YYFAIL appears to be in use. Nevertheless, it is formally deprecated
1262 in Bison 2.4.2's NEWS entry, where a plan to phase it out is
1263 discussed. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001264
1265#define YYFAIL goto yyerrlab
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001266#if defined YYFAIL
1267 /* This is here to suppress warnings from the GCC cpp's
1268 -Wunused-macros. Normally we don't worry about that warning, but
1269 some users do, and we want to make it easy for users to remove
1270 YYFAIL uses, which will produce warnings from Bison 2.5. */
1271#endif
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001272
1273#define YYRECOVERING() (!!yyerrstatus)
1274
1275#define YYBACKUP(Token, Value) \
1276do \
1277 if (yychar == YYEMPTY && yylen == 1) \
1278 { \
1279 yychar = (Token); \
1280 yylval = (Value); \
1281 yytoken = YYTRANSLATE (yychar); \
1282 YYPOPSTACK (1); \
1283 goto yybackup; \
1284 } \
1285 else \
1286 { \
1287 yyerror (context, YY_("syntax error: cannot back up")); \
1288 YYERROR; \
1289 } \
1290while (YYID (0))
1291
1292
1293#define YYTERROR 1
1294#define YYERRCODE 256
1295
1296
1297/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
1298 If N is 0, then set CURRENT to the empty location which ends
1299 the previous symbol: RHS[0] (always defined). */
1300
1301#define YYRHSLOC(Rhs, K) ((Rhs)[K])
1302#ifndef YYLLOC_DEFAULT
1303# define YYLLOC_DEFAULT(Current, Rhs, N) \
1304 do \
1305 if (YYID (N)) \
1306 { \
1307 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
1308 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
1309 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
1310 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
1311 } \
1312 else \
1313 { \
1314 (Current).first_line = (Current).last_line = \
1315 YYRHSLOC (Rhs, 0).last_line; \
1316 (Current).first_column = (Current).last_column = \
1317 YYRHSLOC (Rhs, 0).last_column; \
1318 } \
1319 while (YYID (0))
1320#endif
1321
1322
1323/* YY_LOCATION_PRINT -- Print the location on the stream.
1324 This macro was not mandated originally: define only if we know
1325 we won't break user code: when these are the locations we know. */
1326
1327#ifndef YY_LOCATION_PRINT
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001328# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001329# define YY_LOCATION_PRINT(File, Loc) \
1330 fprintf (File, "%d.%d-%d.%d", \
1331 (Loc).first_line, (Loc).first_column, \
1332 (Loc).last_line, (Loc).last_column)
1333# else
1334# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1335# endif
1336#endif
1337
1338
1339/* YYLEX -- calling `yylex' with the right arguments. */
1340
1341#ifdef YYLEX_PARAM
1342# define YYLEX yylex (&yylval, YYLEX_PARAM)
1343#else
1344# define YYLEX yylex (&yylval)
1345#endif
1346
1347/* Enable debugging if requested. */
1348#if YYDEBUG
1349
1350# ifndef YYFPRINTF
1351# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1352# define YYFPRINTF fprintf
1353# endif
1354
1355# define YYDPRINTF(Args) \
1356do { \
1357 if (yydebug) \
1358 YYFPRINTF Args; \
1359} while (YYID (0))
1360
1361# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
1362do { \
1363 if (yydebug) \
1364 { \
1365 YYFPRINTF (stderr, "%s ", Title); \
1366 yy_symbol_print (stderr, \
1367 Type, Value, context); \
1368 YYFPRINTF (stderr, "\n"); \
1369 } \
1370} while (YYID (0))
1371
1372
1373/*--------------------------------.
1374| Print this symbol on YYOUTPUT. |
1375`--------------------------------*/
1376
1377/*ARGSUSED*/
1378#if (defined __STDC__ || defined __C99__FUNC__ \
1379 || defined __cplusplus || defined _MSC_VER)
1380static void
1381yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, TParseContext* context)
1382#else
1383static void
1384yy_symbol_value_print (yyoutput, yytype, yyvaluep, context)
1385 FILE *yyoutput;
1386 int yytype;
1387 YYSTYPE const * const yyvaluep;
1388 TParseContext* context;
1389#endif
1390{
1391 if (!yyvaluep)
1392 return;
1393 YYUSE (context);
1394# ifdef YYPRINT
1395 if (yytype < YYNTOKENS)
1396 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1397# else
1398 YYUSE (yyoutput);
1399# endif
1400 switch (yytype)
1401 {
1402 default:
1403 break;
1404 }
1405}
1406
1407
1408/*--------------------------------.
1409| Print this symbol on YYOUTPUT. |
1410`--------------------------------*/
1411
1412#if (defined __STDC__ || defined __C99__FUNC__ \
1413 || defined __cplusplus || defined _MSC_VER)
1414static void
1415yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, TParseContext* context)
1416#else
1417static void
1418yy_symbol_print (yyoutput, yytype, yyvaluep, context)
1419 FILE *yyoutput;
1420 int yytype;
1421 YYSTYPE const * const yyvaluep;
1422 TParseContext* context;
1423#endif
1424{
1425 if (yytype < YYNTOKENS)
1426 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1427 else
1428 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1429
1430 yy_symbol_value_print (yyoutput, yytype, yyvaluep, context);
1431 YYFPRINTF (yyoutput, ")");
1432}
1433
1434/*------------------------------------------------------------------.
1435| yy_stack_print -- Print the state stack from its BOTTOM up to its |
1436| TOP (included). |
1437`------------------------------------------------------------------*/
1438
1439#if (defined __STDC__ || defined __C99__FUNC__ \
1440 || defined __cplusplus || defined _MSC_VER)
1441static void
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001442yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001443#else
1444static void
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001445yy_stack_print (yybottom, yytop)
1446 yytype_int16 *yybottom;
1447 yytype_int16 *yytop;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001448#endif
1449{
1450 YYFPRINTF (stderr, "Stack now");
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001451 for (; yybottom <= yytop; yybottom++)
1452 {
1453 int yybot = *yybottom;
1454 YYFPRINTF (stderr, " %d", yybot);
1455 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001456 YYFPRINTF (stderr, "\n");
1457}
1458
1459# define YY_STACK_PRINT(Bottom, Top) \
1460do { \
1461 if (yydebug) \
1462 yy_stack_print ((Bottom), (Top)); \
1463} while (YYID (0))
1464
1465
1466/*------------------------------------------------.
1467| Report that the YYRULE is going to be reduced. |
1468`------------------------------------------------*/
1469
1470#if (defined __STDC__ || defined __C99__FUNC__ \
1471 || defined __cplusplus || defined _MSC_VER)
1472static void
1473yy_reduce_print (YYSTYPE *yyvsp, int yyrule, TParseContext* context)
1474#else
1475static void
1476yy_reduce_print (yyvsp, yyrule, context)
1477 YYSTYPE *yyvsp;
1478 int yyrule;
1479 TParseContext* context;
1480#endif
1481{
1482 int yynrhs = yyr2[yyrule];
1483 int yyi;
1484 unsigned long int yylno = yyrline[yyrule];
1485 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1486 yyrule - 1, yylno);
1487 /* The symbols being reduced. */
1488 for (yyi = 0; yyi < yynrhs; yyi++)
1489 {
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001490 YYFPRINTF (stderr, " $%d = ", yyi + 1);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001491 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1492 &(yyvsp[(yyi + 1) - (yynrhs)])
1493 , context);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001494 YYFPRINTF (stderr, "\n");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001495 }
1496}
1497
1498# define YY_REDUCE_PRINT(Rule) \
1499do { \
1500 if (yydebug) \
1501 yy_reduce_print (yyvsp, Rule, context); \
1502} while (YYID (0))
1503
1504/* Nonzero means print parse trace. It is left uninitialized so that
1505 multiple parsers can coexist. */
1506int yydebug;
1507#else /* !YYDEBUG */
1508# define YYDPRINTF(Args)
1509# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1510# define YY_STACK_PRINT(Bottom, Top)
1511# define YY_REDUCE_PRINT(Rule)
1512#endif /* !YYDEBUG */
1513
1514
1515/* YYINITDEPTH -- initial size of the parser's stacks. */
1516#ifndef YYINITDEPTH
1517# define YYINITDEPTH 200
1518#endif
1519
1520/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1521 if the built-in stack extension method is used).
1522
1523 Do not make this value too large; the results are undefined if
1524 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1525 evaluated with infinite-precision integer arithmetic. */
1526
1527#ifndef YYMAXDEPTH
1528# define YYMAXDEPTH 10000
1529#endif
1530
1531
1532
1533#if YYERROR_VERBOSE
1534
1535# ifndef yystrlen
1536# if defined __GLIBC__ && defined _STRING_H
1537# define yystrlen strlen
1538# else
1539/* Return the length of YYSTR. */
1540#if (defined __STDC__ || defined __C99__FUNC__ \
1541 || defined __cplusplus || defined _MSC_VER)
1542static YYSIZE_T
1543yystrlen (const char *yystr)
1544#else
1545static YYSIZE_T
1546yystrlen (yystr)
1547 const char *yystr;
1548#endif
1549{
1550 YYSIZE_T yylen;
1551 for (yylen = 0; yystr[yylen]; yylen++)
1552 continue;
1553 return yylen;
1554}
1555# endif
1556# endif
1557
1558# ifndef yystpcpy
1559# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1560# define yystpcpy stpcpy
1561# else
1562/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1563 YYDEST. */
1564#if (defined __STDC__ || defined __C99__FUNC__ \
1565 || defined __cplusplus || defined _MSC_VER)
1566static char *
1567yystpcpy (char *yydest, const char *yysrc)
1568#else
1569static char *
1570yystpcpy (yydest, yysrc)
1571 char *yydest;
1572 const char *yysrc;
1573#endif
1574{
1575 char *yyd = yydest;
1576 const char *yys = yysrc;
1577
1578 while ((*yyd++ = *yys++) != '\0')
1579 continue;
1580
1581 return yyd - 1;
1582}
1583# endif
1584# endif
1585
1586# ifndef yytnamerr
1587/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1588 quotes and backslashes, so that it's suitable for yyerror. The
1589 heuristic is that double-quoting is unnecessary unless the string
1590 contains an apostrophe, a comma, or backslash (other than
1591 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1592 null, do not copy; instead, return the length of what the result
1593 would have been. */
1594static YYSIZE_T
1595yytnamerr (char *yyres, const char *yystr)
1596{
1597 if (*yystr == '"')
1598 {
1599 YYSIZE_T yyn = 0;
1600 char const *yyp = yystr;
1601
1602 for (;;)
1603 switch (*++yyp)
1604 {
1605 case '\'':
1606 case ',':
1607 goto do_not_strip_quotes;
1608
1609 case '\\':
1610 if (*++yyp != '\\')
1611 goto do_not_strip_quotes;
1612 /* Fall through. */
1613 default:
1614 if (yyres)
1615 yyres[yyn] = *yyp;
1616 yyn++;
1617 break;
1618
1619 case '"':
1620 if (yyres)
1621 yyres[yyn] = '\0';
1622 return yyn;
1623 }
1624 do_not_strip_quotes: ;
1625 }
1626
1627 if (! yyres)
1628 return yystrlen (yystr);
1629
1630 return yystpcpy (yyres, yystr) - yyres;
1631}
1632# endif
1633
1634/* Copy into YYRESULT an error message about the unexpected token
1635 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1636 including the terminating null byte. If YYRESULT is null, do not
1637 copy anything; just return the number of bytes that would be
1638 copied. As a special case, return 0 if an ordinary "syntax error"
1639 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1640 size calculation. */
1641static YYSIZE_T
1642yysyntax_error (char *yyresult, int yystate, int yychar)
1643{
1644 int yyn = yypact[yystate];
1645
1646 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1647 return 0;
1648 else
1649 {
1650 int yytype = YYTRANSLATE (yychar);
1651 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1652 YYSIZE_T yysize = yysize0;
1653 YYSIZE_T yysize1;
1654 int yysize_overflow = 0;
1655 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1656 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1657 int yyx;
1658
1659# if 0
1660 /* This is so xgettext sees the translatable formats that are
1661 constructed on the fly. */
1662 YY_("syntax error, unexpected %s");
1663 YY_("syntax error, unexpected %s, expecting %s");
1664 YY_("syntax error, unexpected %s, expecting %s or %s");
1665 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1666 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1667# endif
1668 char *yyfmt;
1669 char const *yyf;
1670 static char const yyunexpected[] = "syntax error, unexpected %s";
1671 static char const yyexpecting[] = ", expecting %s";
1672 static char const yyor[] = " or %s";
1673 char yyformat[sizeof yyunexpected
1674 + sizeof yyexpecting - 1
1675 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1676 * (sizeof yyor - 1))];
1677 char const *yyprefix = yyexpecting;
1678
1679 /* Start YYX at -YYN if negative to avoid negative indexes in
1680 YYCHECK. */
1681 int yyxbegin = yyn < 0 ? -yyn : 0;
1682
1683 /* Stay within bounds of both yycheck and yytname. */
1684 int yychecklim = YYLAST - yyn + 1;
1685 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1686 int yycount = 1;
1687
1688 yyarg[0] = yytname[yytype];
1689 yyfmt = yystpcpy (yyformat, yyunexpected);
1690
1691 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1692 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1693 {
1694 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1695 {
1696 yycount = 1;
1697 yysize = yysize0;
1698 yyformat[sizeof yyunexpected - 1] = '\0';
1699 break;
1700 }
1701 yyarg[yycount++] = yytname[yyx];
1702 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1703 yysize_overflow |= (yysize1 < yysize);
1704 yysize = yysize1;
1705 yyfmt = yystpcpy (yyfmt, yyprefix);
1706 yyprefix = yyor;
1707 }
1708
1709 yyf = YY_(yyformat);
1710 yysize1 = yysize + yystrlen (yyf);
1711 yysize_overflow |= (yysize1 < yysize);
1712 yysize = yysize1;
1713
1714 if (yysize_overflow)
1715 return YYSIZE_MAXIMUM;
1716
1717 if (yyresult)
1718 {
1719 /* Avoid sprintf, as that infringes on the user's name space.
1720 Don't have undefined behavior even if the translation
1721 produced a string with the wrong number of "%s"s. */
1722 char *yyp = yyresult;
1723 int yyi = 0;
1724 while ((*yyp = *yyf) != '\0')
1725 {
1726 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1727 {
1728 yyp += yytnamerr (yyp, yyarg[yyi++]);
1729 yyf += 2;
1730 }
1731 else
1732 {
1733 yyp++;
1734 yyf++;
1735 }
1736 }
1737 }
1738 return yysize;
1739 }
1740}
1741#endif /* YYERROR_VERBOSE */
1742
1743
1744/*-----------------------------------------------.
1745| Release the memory associated to this symbol. |
1746`-----------------------------------------------*/
1747
1748/*ARGSUSED*/
1749#if (defined __STDC__ || defined __C99__FUNC__ \
1750 || defined __cplusplus || defined _MSC_VER)
1751static void
1752yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, TParseContext* context)
1753#else
1754static void
1755yydestruct (yymsg, yytype, yyvaluep, context)
1756 const char *yymsg;
1757 int yytype;
1758 YYSTYPE *yyvaluep;
1759 TParseContext* context;
1760#endif
1761{
1762 YYUSE (yyvaluep);
1763 YYUSE (context);
1764
1765 if (!yymsg)
1766 yymsg = "Deleting";
1767 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1768
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001769 switch (yytype)
1770 {
1771
1772 default:
1773 break;
1774 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001775}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001776
1777/* Prevent warnings from -Wmissing-prototypes. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001778#ifdef YYPARSE_PARAM
1779#if defined __STDC__ || defined __cplusplus
1780int yyparse (void *YYPARSE_PARAM);
1781#else
1782int yyparse ();
1783#endif
1784#else /* ! YYPARSE_PARAM */
1785#if defined __STDC__ || defined __cplusplus
1786int yyparse (TParseContext* context);
1787#else
1788int yyparse ();
1789#endif
1790#endif /* ! YYPARSE_PARAM */
1791
1792
1793
1794
1795
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001796/*-------------------------.
1797| yyparse or yypush_parse. |
1798`-------------------------*/
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001799
1800#ifdef YYPARSE_PARAM
1801#if (defined __STDC__ || defined __C99__FUNC__ \
1802 || defined __cplusplus || defined _MSC_VER)
1803int
1804yyparse (void *YYPARSE_PARAM)
1805#else
1806int
1807yyparse (YYPARSE_PARAM)
1808 void *YYPARSE_PARAM;
1809#endif
1810#else /* ! YYPARSE_PARAM */
1811#if (defined __STDC__ || defined __C99__FUNC__ \
1812 || defined __cplusplus || defined _MSC_VER)
1813int
1814yyparse (TParseContext* context)
1815#else
1816int
1817yyparse (context)
1818 TParseContext* context;
1819#endif
1820#endif
1821{
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001822/* The lookahead symbol. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001823int yychar;
1824
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001825/* The semantic value of the lookahead symbol. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001826YYSTYPE yylval;
1827
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001828 /* Number of syntax errors so far. */
1829 int yynerrs;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001830
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001831 int yystate;
1832 /* Number of tokens to shift before error messages enabled. */
1833 int yyerrstatus;
1834
1835 /* The stacks and their tools:
1836 `yyss': related to states.
1837 `yyvs': related to semantic values.
1838
1839 Refer to the stacks thru separate pointers, to allow yyoverflow
1840 to reallocate them elsewhere. */
1841
1842 /* The state stack. */
1843 yytype_int16 yyssa[YYINITDEPTH];
1844 yytype_int16 *yyss;
1845 yytype_int16 *yyssp;
1846
1847 /* The semantic value stack. */
1848 YYSTYPE yyvsa[YYINITDEPTH];
1849 YYSTYPE *yyvs;
1850 YYSTYPE *yyvsp;
1851
1852 YYSIZE_T yystacksize;
1853
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001854 int yyn;
1855 int yyresult;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001856 /* Lookahead token as an internal (translated) token number. */
1857 int yytoken;
1858 /* The variables used to return semantic value and location from the
1859 action routines. */
1860 YYSTYPE yyval;
1861
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001862#if YYERROR_VERBOSE
1863 /* Buffer for error messages, and its allocated size. */
1864 char yymsgbuf[128];
1865 char *yymsg = yymsgbuf;
1866 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1867#endif
1868
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001869#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1870
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001871 /* The number of symbols on the RHS of the reduced rule.
1872 Keep to zero when no symbol should be popped. */
1873 int yylen = 0;
1874
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001875 yytoken = 0;
1876 yyss = yyssa;
1877 yyvs = yyvsa;
1878 yystacksize = YYINITDEPTH;
1879
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001880 YYDPRINTF ((stderr, "Starting parse\n"));
1881
1882 yystate = 0;
1883 yyerrstatus = 0;
1884 yynerrs = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001885 yychar = YYEMPTY; /* Cause a token to be read. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001886
1887 /* Initialize stack pointers.
1888 Waste one element of value and location stack
1889 so that they stay on the same level as the state stack.
1890 The wasted elements are never initialized. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001891 yyssp = yyss;
1892 yyvsp = yyvs;
1893
1894 goto yysetstate;
1895
1896/*------------------------------------------------------------.
1897| yynewstate -- Push a new state, which is found in yystate. |
1898`------------------------------------------------------------*/
1899 yynewstate:
1900 /* In all cases, when you get here, the value and location stacks
1901 have just been pushed. So pushing a state here evens the stacks. */
1902 yyssp++;
1903
1904 yysetstate:
1905 *yyssp = yystate;
1906
1907 if (yyss + yystacksize - 1 <= yyssp)
1908 {
1909 /* Get the current used size of the three stacks, in elements. */
1910 YYSIZE_T yysize = yyssp - yyss + 1;
1911
1912#ifdef yyoverflow
1913 {
1914 /* Give user a chance to reallocate the stack. Use copies of
1915 these so that the &'s don't force the real ones into
1916 memory. */
1917 YYSTYPE *yyvs1 = yyvs;
1918 yytype_int16 *yyss1 = yyss;
1919
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001920 /* Each stack pointer address is followed by the size of the
1921 data in use in that stack, in bytes. This used to be a
1922 conditional around just the two extra args, but that might
1923 be undefined if yyoverflow is a macro. */
1924 yyoverflow (YY_("memory exhausted"),
1925 &yyss1, yysize * sizeof (*yyssp),
1926 &yyvs1, yysize * sizeof (*yyvsp),
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001927 &yystacksize);
1928
1929 yyss = yyss1;
1930 yyvs = yyvs1;
1931 }
1932#else /* no yyoverflow */
1933# ifndef YYSTACK_RELOCATE
1934 goto yyexhaustedlab;
1935# else
1936 /* Extend the stack our own way. */
1937 if (YYMAXDEPTH <= yystacksize)
1938 goto yyexhaustedlab;
1939 yystacksize *= 2;
1940 if (YYMAXDEPTH < yystacksize)
1941 yystacksize = YYMAXDEPTH;
1942
1943 {
1944 yytype_int16 *yyss1 = yyss;
1945 union yyalloc *yyptr =
1946 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1947 if (! yyptr)
1948 goto yyexhaustedlab;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001949 YYSTACK_RELOCATE (yyss_alloc, yyss);
1950 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001951# undef YYSTACK_RELOCATE
1952 if (yyss1 != yyssa)
1953 YYSTACK_FREE (yyss1);
1954 }
1955# endif
1956#endif /* no yyoverflow */
1957
1958 yyssp = yyss + yysize - 1;
1959 yyvsp = yyvs + yysize - 1;
1960
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001961 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1962 (unsigned long int) yystacksize));
1963
1964 if (yyss + yystacksize - 1 <= yyssp)
1965 YYABORT;
1966 }
1967
1968 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1969
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001970 if (yystate == YYFINAL)
1971 YYACCEPT;
1972
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001973 goto yybackup;
1974
1975/*-----------.
1976| yybackup. |
1977`-----------*/
1978yybackup:
1979
1980 /* Do appropriate processing given the current state. Read a
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001981 lookahead token if we need one and don't already have one. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001982
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001983 /* First try to decide what to do without reference to lookahead token. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001984 yyn = yypact[yystate];
1985 if (yyn == YYPACT_NINF)
1986 goto yydefault;
1987
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001988 /* Not known => get a lookahead token if don't already have one. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001989
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00001990 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001991 if (yychar == YYEMPTY)
1992 {
1993 YYDPRINTF ((stderr, "Reading a token: "));
1994 yychar = YYLEX;
1995 }
1996
1997 if (yychar <= YYEOF)
1998 {
1999 yychar = yytoken = YYEOF;
2000 YYDPRINTF ((stderr, "Now at end of input.\n"));
2001 }
2002 else
2003 {
2004 yytoken = YYTRANSLATE (yychar);
2005 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
2006 }
2007
2008 /* If the proper action on seeing token YYTOKEN is to reduce or to
2009 detect an error, take that action. */
2010 yyn += yytoken;
2011 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
2012 goto yydefault;
2013 yyn = yytable[yyn];
2014 if (yyn <= 0)
2015 {
2016 if (yyn == 0 || yyn == YYTABLE_NINF)
2017 goto yyerrlab;
2018 yyn = -yyn;
2019 goto yyreduce;
2020 }
2021
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002022 /* Count tokens shifted since error; after three, turn off error
2023 status. */
2024 if (yyerrstatus)
2025 yyerrstatus--;
2026
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002027 /* Shift the lookahead token. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002028 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
2029
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002030 /* Discard the shifted token. */
2031 yychar = YYEMPTY;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002032
2033 yystate = yyn;
2034 *++yyvsp = yylval;
2035
2036 goto yynewstate;
2037
2038
2039/*-----------------------------------------------------------.
2040| yydefault -- do the default action for the current state. |
2041`-----------------------------------------------------------*/
2042yydefault:
2043 yyn = yydefact[yystate];
2044 if (yyn == 0)
2045 goto yyerrlab;
2046 goto yyreduce;
2047
2048
2049/*-----------------------------.
2050| yyreduce -- Do a reduction. |
2051`-----------------------------*/
2052yyreduce:
2053 /* yyn is the number of a rule to reduce with. */
2054 yylen = yyr2[yyn];
2055
2056 /* If YYLEN is nonzero, implement the default value of the action:
2057 `$$ = $1'.
2058
2059 Otherwise, the following line sets YYVAL to garbage.
2060 This behavior is undocumented and Bison
2061 users should not rely upon it. Assigning to YYVAL
2062 unconditionally makes the parser a bit smaller, and it avoids a
2063 GCC warning that YYVAL may be used uninitialized. */
2064 yyval = yyvsp[1-yylen];
2065
2066
2067 YY_REDUCE_PRINT (yyn);
2068 switch (yyn)
2069 {
2070 case 2:
2071
2072 {
2073 // The symbol table search was done in the lexical phase
2074 const TSymbol* symbol = (yyvsp[(1) - (1)].lex).symbol;
2075 const TVariable* variable;
2076 if (symbol == 0) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00002077 context->error((yyvsp[(1) - (1)].lex).line, "undeclared identifier", (yyvsp[(1) - (1)].lex).string->c_str());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002078 context->recover();
2079 TType type(EbtFloat, EbpUndefined);
2080 TVariable* fakeVariable = new TVariable((yyvsp[(1) - (1)].lex).string, type);
2081 context->symbolTable.insert(*fakeVariable);
2082 variable = fakeVariable;
2083 } else {
2084 // This identifier can only be a variable type symbol
2085 if (! symbol->isVariable()) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00002086 context->error((yyvsp[(1) - (1)].lex).line, "variable expected", (yyvsp[(1) - (1)].lex).string->c_str());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002087 context->recover();
2088 }
2089 variable = static_cast<const TVariable*>(symbol);
2090 }
2091
2092 // don't delete $1.string, it's used by error recovery, and the pool
2093 // pop will reclaim the memory
2094
2095 if (variable->getType().getQualifier() == EvqConst ) {
2096 ConstantUnion* constArray = variable->getConstPointer();
2097 TType t(variable->getType());
2098 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(constArray, t, (yyvsp[(1) - (1)].lex).line);
2099 } else
2100 (yyval.interm.intermTypedNode) = context->intermediate.addSymbol(variable->getUniqueId(),
2101 variable->getName(),
2102 variable->getType(), (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002103 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002104 break;
2105
2106 case 3:
2107
2108 {
2109 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002110 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002111 break;
2112
2113 case 4:
2114
2115 {
2116 //
2117 // INT_TYPE is only 16-bit plus sign bit for vertex/fragment shaders,
2118 // check for overflow for constants
2119 //
2120 if (abs((yyvsp[(1) - (1)].lex).i) >= (1 << 16)) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00002121 context->error((yyvsp[(1) - (1)].lex).line, " integer constant overflow", "");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002122 context->recover();
2123 }
2124 ConstantUnion *unionArray = new ConstantUnion[1];
2125 unionArray->setIConst((yyvsp[(1) - (1)].lex).i);
2126 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002127 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002128 break;
2129
2130 case 5:
2131
2132 {
2133 ConstantUnion *unionArray = new ConstantUnion[1];
2134 unionArray->setFConst((yyvsp[(1) - (1)].lex).f);
2135 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002136 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002137 break;
2138
2139 case 6:
2140
2141 {
2142 ConstantUnion *unionArray = new ConstantUnion[1];
2143 unionArray->setBConst((yyvsp[(1) - (1)].lex).b);
2144 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002145 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002146 break;
2147
2148 case 7:
2149
2150 {
2151 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (3)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002152 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002153 break;
2154
2155 case 8:
2156
2157 {
2158 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002159 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002160 break;
2161
2162 case 9:
2163
2164 {
2165 if (!(yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isVector()) {
2166 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode())
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00002167 context->error((yyvsp[(2) - (4)].lex).line, " left of '[' is not of type array, matrix, or vector ", (yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode()->getSymbol().c_str());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002168 else
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00002169 context->error((yyvsp[(2) - (4)].lex).line, " left of '[' is not of type array, matrix, or vector ", "expression");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002170 context->recover();
2171 }
2172 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst && (yyvsp[(3) - (4)].interm.intermTypedNode)->getQualifier() == EvqConst) {
2173 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) { // constant folding for arrays
shannon.woods%transgaming.com@gtempaccount.comc0d0c222013-04-13 03:29:36 +00002174 (yyval.interm.intermTypedNode) = context->addConstArrayNode((yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0), (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002175 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector()) { // constant folding for vectors
2176 TVectorFields fields;
2177 fields.num = 1;
shannon.woods%transgaming.com@gtempaccount.comc0d0c222013-04-13 03:29:36 +00002178 fields.offsets[0] = (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0); // need to do it this way because v.xy sends fields integer array
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002179 (yyval.interm.intermTypedNode) = context->addConstVectorNode(fields, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2180 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix()) { // constant folding for matrices
shannon.woods%transgaming.com@gtempaccount.comc0d0c222013-04-13 03:29:36 +00002181 (yyval.interm.intermTypedNode) = context->addConstMatrixNode((yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0), (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002182 }
2183 } else {
2184 if ((yyvsp[(3) - (4)].interm.intermTypedNode)->getQualifier() == EvqConst) {
shannon.woods%transgaming.com@gtempaccount.comc0d0c222013-04-13 03:29:36 +00002185 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()->getIConst(0) && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() ) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00002186 std::stringstream extraInfoStream;
shannon.woods%transgaming.com@gtempaccount.comc0d0c222013-04-13 03:29:36 +00002187 extraInfoStream << "field selection out of range '" << (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0) << "'";
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00002188 std::string extraInfo = extraInfoStream.str();
2189 context->error((yyvsp[(2) - (4)].lex).line, "", "[", extraInfo.c_str());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002190 context->recover();
2191 } else {
2192 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) {
2193 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize() == 0) {
shannon.woods%transgaming.com@gtempaccount.comc0d0c222013-04-13 03:29:36 +00002194 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getMaxArraySize() <= (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0)) {
2195 if (context->arraySetMaxSize((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getTypePointer(), (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0), true, (yyvsp[(2) - (4)].lex).line))
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002196 context->recover();
2197 } else {
2198 if (context->arraySetMaxSize((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getTypePointer(), 0, false, (yyvsp[(2) - (4)].lex).line))
2199 context->recover();
2200 }
shannon.woods%transgaming.com@gtempaccount.comc0d0c222013-04-13 03:29:36 +00002201 } else if ( (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0) >= (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize()) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00002202 std::stringstream extraInfoStream;
shannon.woods%transgaming.com@gtempaccount.comc0d0c222013-04-13 03:29:36 +00002203 extraInfoStream << "array index out of range '" << (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getIConst(0) << "'";
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00002204 std::string extraInfo = extraInfoStream.str();
2205 context->error((yyvsp[(2) - (4)].lex).line, "", "[", extraInfo.c_str());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002206 context->recover();
2207 }
2208 }
2209 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(3) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2210 }
2211 } else {
2212 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize() == 0) {
2213 context->error((yyvsp[(2) - (4)].lex).line, "", "[", "array must be redeclared with a size before being indexed with a variable");
2214 context->recover();
2215 }
2216
2217 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexIndirect, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(3) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2218 }
2219 }
2220 if ((yyval.interm.intermTypedNode) == 0) {
2221 ConstantUnion *unionArray = new ConstantUnion[1];
2222 unionArray->setFConst(0.0f);
2223 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpHigh, EvqConst), (yyvsp[(2) - (4)].lex).line);
2224 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) {
2225 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getStruct())
2226 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getStruct(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getTypeName()));
2227 else
2228 (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()));
2229
2230 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst)
2231 (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConst);
2232 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst)
2233 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqConst, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize()));
2234 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix())
2235 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize()));
2236 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst)
2237 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqConst));
2238 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector())
2239 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary));
2240 else
2241 (yyval.interm.intermTypedNode)->setType((yyvsp[(1) - (4)].interm.intermTypedNode)->getType());
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002242 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002243 break;
2244
2245 case 10:
2246
2247 {
2248 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002249 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002250 break;
2251
2252 case 11:
2253
2254 {
2255 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isArray()) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00002256 context->error((yyvsp[(3) - (3)].lex).line, "cannot apply dot operator to an array", ".");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002257 context->recover();
2258 }
2259
2260 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isVector()) {
2261 TVectorFields fields;
2262 if (! context->parseVectorFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yyvsp[(3) - (3)].lex).line)) {
2263 fields.num = 1;
2264 fields.offsets[0] = 0;
2265 context->recover();
2266 }
2267
2268 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) { // constant folding for vector fields
2269 (yyval.interm.intermTypedNode) = context->addConstVectorNode(fields, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].lex).line);
2270 if ((yyval.interm.intermTypedNode) == 0) {
2271 context->recover();
2272 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2273 }
2274 else
2275 (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()));
2276 } else {
alokp@chromium.orgab8c0262012-08-13 17:36:25 +00002277 TString vectorString = *(yyvsp[(3) - (3)].lex).string;
2278 TIntermTyped* index = context->intermediate.addSwizzle(fields, (yyvsp[(3) - (3)].lex).line);
2279 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpVectorSwizzle, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2280 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (int) vectorString.size()));
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002281 }
2282 } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isMatrix()) {
2283 TMatrixFields fields;
2284 if (! context->parseMatrixFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yyvsp[(3) - (3)].lex).line)) {
2285 fields.wholeRow = false;
2286 fields.wholeCol = false;
2287 fields.row = 0;
2288 fields.col = 0;
2289 context->recover();
2290 }
2291
2292 if (fields.wholeRow || fields.wholeCol) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00002293 context->error((yyvsp[(2) - (3)].lex).line, " non-scalar fields not implemented yet", ".");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002294 context->recover();
2295 ConstantUnion *unionArray = new ConstantUnion[1];
2296 unionArray->setIConst(0);
2297 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line);
2298 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2299 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(),EvqTemporary, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize()));
2300 } else {
2301 ConstantUnion *unionArray = new ConstantUnion[1];
2302 unionArray->setIConst(fields.col * (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize() + fields.row);
2303 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line);
2304 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2305 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision()));
2306 }
2307 } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType() == EbtStruct) {
2308 bool fieldFound = false;
2309 const TTypeList* fields = (yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getStruct();
2310 if (fields == 0) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00002311 context->error((yyvsp[(2) - (3)].lex).line, "structure has no fields", "Internal Error");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002312 context->recover();
2313 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2314 } else {
2315 unsigned int i;
2316 for (i = 0; i < fields->size(); ++i) {
2317 if ((*fields)[i].type->getFieldName() == *(yyvsp[(3) - (3)].lex).string) {
2318 fieldFound = true;
2319 break;
2320 }
2321 }
2322 if (fieldFound) {
2323 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) {
2324 (yyval.interm.intermTypedNode) = context->addConstStruct(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
2325 if ((yyval.interm.intermTypedNode) == 0) {
2326 context->recover();
2327 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2328 }
2329 else {
2330 (yyval.interm.intermTypedNode)->setType(*(*fields)[i].type);
2331 // change the qualifier of the return type, not of the structure field
2332 // as the structure definition is shared between various structures.
2333 (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConst);
2334 }
2335 } else {
2336 ConstantUnion *unionArray = new ConstantUnion[1];
2337 unionArray->setIConst(i);
2338 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, *(*fields)[i].type, (yyvsp[(3) - (3)].lex).line);
2339 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirectStruct, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2340 (yyval.interm.intermTypedNode)->setType(*(*fields)[i].type);
2341 }
2342 } else {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00002343 context->error((yyvsp[(2) - (3)].lex).line, " no such field in structure", (yyvsp[(3) - (3)].lex).string->c_str());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002344 context->recover();
2345 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2346 }
2347 }
2348 } else {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00002349 context->error((yyvsp[(2) - (3)].lex).line, " field selection requires structure, vector, or matrix on left hand side", (yyvsp[(3) - (3)].lex).string->c_str());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002350 context->recover();
2351 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2352 }
2353 // don't delete $3.string, it's from the pool
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002354 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002355 break;
2356
2357 case 12:
2358
2359 {
2360 if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode)))
2361 context->recover();
2362 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostIncrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line, context->symbolTable);
2363 if ((yyval.interm.intermTypedNode) == 0) {
2364 context->unaryOpError((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
2365 context->recover();
2366 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode);
2367 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002368 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002369 break;
2370
2371 case 13:
2372
2373 {
2374 if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode)))
2375 context->recover();
2376 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostDecrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line, context->symbolTable);
2377 if ((yyval.interm.intermTypedNode) == 0) {
2378 context->unaryOpError((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
2379 context->recover();
2380 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode);
2381 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002382 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002383 break;
2384
2385 case 14:
2386
2387 {
2388 if (context->integerErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode), "[]"))
2389 context->recover();
2390 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002391 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002392 break;
2393
2394 case 15:
2395
2396 {
2397 TFunction* fnCall = (yyvsp[(1) - (1)].interm).function;
2398 TOperator op = fnCall->getBuiltInOp();
2399
2400 if (op != EOpNull)
2401 {
2402 //
2403 // Then this should be a constructor.
2404 // Don't go through the symbol table for constructors.
2405 // Their parameters will be verified algorithmically.
2406 //
2407 TType type(EbtVoid, EbpUndefined); // use this to get the type back
2408 if (context->constructorErrorCheck((yyvsp[(1) - (1)].interm).line, (yyvsp[(1) - (1)].interm).intermNode, *fnCall, op, &type)) {
2409 (yyval.interm.intermTypedNode) = 0;
2410 } else {
2411 //
2412 // It's a constructor, of type 'type'.
2413 //
2414 (yyval.interm.intermTypedNode) = context->addConstructor((yyvsp[(1) - (1)].interm).intermNode, &type, op, fnCall, (yyvsp[(1) - (1)].interm).line);
2415 }
2416
2417 if ((yyval.interm.intermTypedNode) == 0) {
2418 context->recover();
2419 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator(0, op, (yyvsp[(1) - (1)].interm).line);
2420 }
2421 (yyval.interm.intermTypedNode)->setType(type);
2422 } else {
2423 //
2424 // Not a constructor. Find it in the symbol table.
2425 //
2426 const TFunction* fnCandidate;
2427 bool builtIn;
2428 fnCandidate = context->findFunction((yyvsp[(1) - (1)].interm).line, fnCall, &builtIn);
2429 if (fnCandidate) {
2430 //
2431 // A declared function.
2432 //
2433 if (builtIn && !fnCandidate->getExtension().empty() &&
2434 context->extensionErrorCheck((yyvsp[(1) - (1)].interm).line, fnCandidate->getExtension())) {
2435 context->recover();
2436 }
2437 op = fnCandidate->getBuiltInOp();
2438 if (builtIn && op != EOpNull) {
2439 //
2440 // A function call mapped to a built-in operation.
2441 //
2442 if (fnCandidate->getParamCount() == 1) {
2443 //
2444 // Treat it like a built-in unary operator.
2445 //
2446 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(op, (yyvsp[(1) - (1)].interm).intermNode, 0, context->symbolTable);
2447 if ((yyval.interm.intermTypedNode) == 0) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00002448 std::stringstream extraInfoStream;
2449 extraInfoStream << "built in unary operator function. Type: " << static_cast<TIntermTyped*>((yyvsp[(1) - (1)].interm).intermNode)->getCompleteString();
2450 std::string extraInfo = extraInfoStream.str();
2451 context->error((yyvsp[(1) - (1)].interm).intermNode->getLine(), " wrong operand type", "Internal Error", extraInfo.c_str());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002452 YYERROR;
2453 }
2454 } else {
2455 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, op, (yyvsp[(1) - (1)].interm).line);
2456 }
2457 } else {
2458 // This is a real function call
2459
2460 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, EOpFunctionCall, (yyvsp[(1) - (1)].interm).line);
2461 (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType());
2462
2463 // this is how we know whether the given function is a builtIn function or a user defined function
2464 // if builtIn == false, it's a userDefined -> could be an overloaded builtIn function also
2465 // if builtIn == true, it's definitely a builtIn function with EOpNull
2466 if (!builtIn)
2467 (yyval.interm.intermTypedNode)->getAsAggregate()->setUserDefined();
2468 (yyval.interm.intermTypedNode)->getAsAggregate()->setName(fnCandidate->getMangledName());
2469
2470 TQualifier qual;
shannon.woods@transgaming.comd64b3da2013-02-28 23:19:26 +00002471 for (size_t i = 0; i < fnCandidate->getParamCount(); ++i) {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002472 qual = fnCandidate->getParam(i).type->getQualifier();
2473 if (qual == EvqOut || qual == EvqInOut) {
2474 if (context->lValueErrorCheck((yyval.interm.intermTypedNode)->getLine(), "assign", (yyval.interm.intermTypedNode)->getAsAggregate()->getSequence()[i]->getAsTyped())) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00002475 context->error((yyvsp[(1) - (1)].interm).intermNode->getLine(), "Constant value cannot be passed for 'out' or 'inout' parameters.", "Error");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002476 context->recover();
2477 }
2478 }
2479 }
2480 }
2481 (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType());
2482 } else {
2483 // error message was put out by PaFindFunction()
2484 // Put on a dummy node for error recovery
2485 ConstantUnion *unionArray = new ConstantUnion[1];
2486 unionArray->setFConst(0.0f);
2487 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].interm).line);
2488 context->recover();
2489 }
2490 }
2491 delete fnCall;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002492 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002493 break;
2494
2495 case 16:
2496
2497 {
2498 (yyval.interm) = (yyvsp[(1) - (1)].interm);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002499 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002500 break;
2501
2502 case 17:
2503
2504 {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00002505 context->error((yyvsp[(3) - (3)].interm).line, "methods are not supported", "");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002506 context->recover();
2507 (yyval.interm) = (yyvsp[(3) - (3)].interm);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002508 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002509 break;
2510
2511 case 18:
2512
2513 {
2514 (yyval.interm) = (yyvsp[(1) - (2)].interm);
2515 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002516 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002517 break;
2518
2519 case 19:
2520
2521 {
2522 (yyval.interm) = (yyvsp[(1) - (2)].interm);
2523 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002524 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002525 break;
2526
2527 case 20:
2528
2529 {
2530 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
2531 (yyval.interm).intermNode = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002532 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002533 break;
2534
2535 case 21:
2536
2537 {
2538 (yyval.interm).function = (yyvsp[(1) - (1)].interm.function);
2539 (yyval.interm).intermNode = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002540 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002541 break;
2542
2543 case 22:
2544
2545 {
2546 TParameter param = { 0, new TType((yyvsp[(2) - (2)].interm.intermTypedNode)->getType()) };
2547 (yyvsp[(1) - (2)].interm.function)->addParameter(param);
2548 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
2549 (yyval.interm).intermNode = (yyvsp[(2) - (2)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002550 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002551 break;
2552
2553 case 23:
2554
2555 {
2556 TParameter param = { 0, new TType((yyvsp[(3) - (3)].interm.intermTypedNode)->getType()) };
2557 (yyvsp[(1) - (3)].interm).function->addParameter(param);
2558 (yyval.interm).function = (yyvsp[(1) - (3)].interm).function;
2559 (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 +00002560 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002561 break;
2562
2563 case 24:
2564
2565 {
2566 (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002567 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002568 break;
2569
2570 case 25:
2571
2572 {
2573 //
2574 // Constructor
2575 //
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002576 TOperator op = EOpNull;
2577 if ((yyvsp[(1) - (1)].interm.type).userDef) {
2578 op = EOpConstructStruct;
2579 } else {
2580 switch ((yyvsp[(1) - (1)].interm.type).type) {
2581 case EbtFloat:
2582 if ((yyvsp[(1) - (1)].interm.type).matrix) {
2583 switch((yyvsp[(1) - (1)].interm.type).size) {
2584 case 2: op = EOpConstructMat2; break;
2585 case 3: op = EOpConstructMat3; break;
2586 case 4: op = EOpConstructMat4; break;
2587 }
2588 } else {
2589 switch((yyvsp[(1) - (1)].interm.type).size) {
2590 case 1: op = EOpConstructFloat; break;
2591 case 2: op = EOpConstructVec2; break;
2592 case 3: op = EOpConstructVec3; break;
2593 case 4: op = EOpConstructVec4; break;
2594 }
2595 }
2596 break;
2597 case EbtInt:
2598 switch((yyvsp[(1) - (1)].interm.type).size) {
2599 case 1: op = EOpConstructInt; break;
2600 case 2: FRAG_VERT_ONLY("ivec2", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec2; break;
2601 case 3: FRAG_VERT_ONLY("ivec3", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec3; break;
2602 case 4: FRAG_VERT_ONLY("ivec4", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec4; break;
2603 }
2604 break;
2605 case EbtBool:
2606 switch((yyvsp[(1) - (1)].interm.type).size) {
2607 case 1: op = EOpConstructBool; break;
2608 case 2: FRAG_VERT_ONLY("bvec2", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec2; break;
2609 case 3: FRAG_VERT_ONLY("bvec3", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec3; break;
2610 case 4: FRAG_VERT_ONLY("bvec4", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec4; break;
2611 }
2612 break;
2613 default: break;
2614 }
2615 if (op == EOpNull) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00002616 context->error((yyvsp[(1) - (1)].interm.type).line, "cannot construct this type", getBasicString((yyvsp[(1) - (1)].interm.type).type));
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002617 context->recover();
2618 (yyvsp[(1) - (1)].interm.type).type = EbtFloat;
2619 op = EOpConstructFloat;
2620 }
2621 }
2622 TString tempString;
2623 TType type((yyvsp[(1) - (1)].interm.type));
2624 TFunction *function = new TFunction(&tempString, type, op);
2625 (yyval.interm.function) = function;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002626 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002627 break;
2628
2629 case 26:
2630
2631 {
2632 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
2633 context->recover();
2634 TType type(EbtVoid, EbpUndefined);
2635 TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type);
2636 (yyval.interm.function) = function;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002637 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002638 break;
2639
2640 case 27:
2641
2642 {
2643 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
2644 context->recover();
2645 TType type(EbtVoid, EbpUndefined);
2646 TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type);
2647 (yyval.interm.function) = function;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002648 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002649 break;
2650
2651 case 28:
2652
2653 {
2654 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002655 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002656 break;
2657
2658 case 29:
2659
2660 {
2661 if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)))
2662 context->recover();
2663 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreIncrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line, context->symbolTable);
2664 if ((yyval.interm.intermTypedNode) == 0) {
2665 context->unaryOpError((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2666 context->recover();
2667 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2668 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002669 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002670 break;
2671
2672 case 30:
2673
2674 {
2675 if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)))
2676 context->recover();
2677 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreDecrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line, context->symbolTable);
2678 if ((yyval.interm.intermTypedNode) == 0) {
2679 context->unaryOpError((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2680 context->recover();
2681 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2682 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002683 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002684 break;
2685
2686 case 31:
2687
2688 {
2689 if ((yyvsp[(1) - (2)].interm).op != EOpNull) {
2690 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath((yyvsp[(1) - (2)].interm).op, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].interm).line, context->symbolTable);
2691 if ((yyval.interm.intermTypedNode) == 0) {
2692 const char* errorOp = "";
2693 switch((yyvsp[(1) - (2)].interm).op) {
2694 case EOpNegative: errorOp = "-"; break;
2695 case EOpLogicalNot: errorOp = "!"; break;
2696 default: break;
2697 }
2698 context->unaryOpError((yyvsp[(1) - (2)].interm).line, errorOp, (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2699 context->recover();
2700 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2701 }
2702 } else
2703 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002704 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002705 break;
2706
2707 case 32:
2708
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002709 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNull; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002710 break;
2711
2712 case 33:
2713
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002714 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNegative; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002715 break;
2716
2717 case 34:
2718
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002719 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpLogicalNot; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002720 break;
2721
2722 case 35:
2723
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002724 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002725 break;
2726
2727 case 36:
2728
2729 {
2730 FRAG_VERT_ONLY("*", (yyvsp[(2) - (3)].lex).line);
2731 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpMul, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2732 if ((yyval.interm.intermTypedNode) == 0) {
2733 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "*", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2734 context->recover();
2735 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2736 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002737 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002738 break;
2739
2740 case 37:
2741
2742 {
2743 FRAG_VERT_ONLY("/", (yyvsp[(2) - (3)].lex).line);
2744 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpDiv, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2745 if ((yyval.interm.intermTypedNode) == 0) {
2746 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "/", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2747 context->recover();
2748 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2749 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002750 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002751 break;
2752
2753 case 38:
2754
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002755 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002756 break;
2757
2758 case 39:
2759
2760 {
2761 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpAdd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2762 if ((yyval.interm.intermTypedNode) == 0) {
2763 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "+", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2764 context->recover();
2765 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2766 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002767 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002768 break;
2769
2770 case 40:
2771
2772 {
2773 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpSub, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2774 if ((yyval.interm.intermTypedNode) == 0) {
2775 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "-", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2776 context->recover();
2777 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2778 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002779 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002780 break;
2781
2782 case 41:
2783
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002784 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002785 break;
2786
2787 case 42:
2788
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002789 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002790 break;
2791
2792 case 43:
2793
2794 {
2795 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2796 if ((yyval.interm.intermTypedNode) == 0) {
2797 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2798 context->recover();
2799 ConstantUnion *unionArray = new ConstantUnion[1];
2800 unionArray->setBConst(false);
2801 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2802 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002803 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002804 break;
2805
2806 case 44:
2807
2808 {
2809 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2810 if ((yyval.interm.intermTypedNode) == 0) {
2811 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2812 context->recover();
2813 ConstantUnion *unionArray = new ConstantUnion[1];
2814 unionArray->setBConst(false);
2815 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2816 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002817 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002818 break;
2819
2820 case 45:
2821
2822 {
2823 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2824 if ((yyval.interm.intermTypedNode) == 0) {
2825 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2826 context->recover();
2827 ConstantUnion *unionArray = new ConstantUnion[1];
2828 unionArray->setBConst(false);
2829 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2830 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002831 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002832 break;
2833
2834 case 46:
2835
2836 {
2837 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThanEqual, (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 47:
2849
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002850 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002851 break;
2852
2853 case 48:
2854
2855 {
2856 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2857 if ((yyval.interm.intermTypedNode) == 0) {
2858 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "==", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2859 context->recover();
2860 ConstantUnion *unionArray = new ConstantUnion[1];
2861 unionArray->setBConst(false);
2862 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2863 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002864 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002865 break;
2866
2867 case 49:
2868
2869 {
2870 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpNotEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2871 if ((yyval.interm.intermTypedNode) == 0) {
2872 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "!=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2873 context->recover();
2874 ConstantUnion *unionArray = new ConstantUnion[1];
2875 unionArray->setBConst(false);
2876 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2877 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002878 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002879 break;
2880
2881 case 50:
2882
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002883 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002884 break;
2885
2886 case 51:
2887
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002888 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002889 break;
2890
2891 case 52:
2892
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002893 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002894 break;
2895
2896 case 53:
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 54:
2902
2903 {
2904 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalAnd, (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 55:
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 56:
2921
2922 {
2923 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalXor, (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 57:
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 58:
2940
2941 {
2942 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalOr, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2943 if ((yyval.interm.intermTypedNode) == 0) {
2944 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "||", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2945 context->recover();
2946 ConstantUnion *unionArray = new ConstantUnion[1];
2947 unionArray->setBConst(false);
2948 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2949 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002950 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002951 break;
2952
2953 case 59:
2954
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002955 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002956 break;
2957
2958 case 60:
2959
2960 {
2961 if (context->boolErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.intermTypedNode)))
2962 context->recover();
2963
2964 (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);
2965 if ((yyvsp[(3) - (5)].interm.intermTypedNode)->getType() != (yyvsp[(5) - (5)].interm.intermTypedNode)->getType())
2966 (yyval.interm.intermTypedNode) = 0;
2967
2968 if ((yyval.interm.intermTypedNode) == 0) {
2969 context->binaryOpError((yyvsp[(2) - (5)].lex).line, ":", (yyvsp[(3) - (5)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(5) - (5)].interm.intermTypedNode)->getCompleteString());
2970 context->recover();
2971 (yyval.interm.intermTypedNode) = (yyvsp[(5) - (5)].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 61:
2977
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002978 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002979 break;
2980
2981 case 62:
2982
2983 {
2984 if (context->lValueErrorCheck((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)))
2985 context->recover();
2986 (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);
2987 if ((yyval.interm.intermTypedNode) == 0) {
2988 context->assignError((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2989 context->recover();
2990 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2991 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002992 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002993 break;
2994
2995 case 63:
2996
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00002997 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAssign; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002998 break;
2999
3000 case 64:
3001
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003002 { 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 +00003003 break;
3004
3005 case 65:
3006
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003007 { FRAG_VERT_ONLY("/=", (yyvsp[(1) - (1)].lex).line); (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpDivAssign; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003008 break;
3009
3010 case 66:
3011
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003012 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAddAssign; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003013 break;
3014
3015 case 67:
3016
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003017 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpSubAssign; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003018 break;
3019
3020 case 68:
3021
3022 {
3023 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003024 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003025 break;
3026
3027 case 69:
3028
3029 {
3030 (yyval.interm.intermTypedNode) = context->intermediate.addComma((yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
3031 if ((yyval.interm.intermTypedNode) == 0) {
3032 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ",", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3033 context->recover();
3034 (yyval.interm.intermTypedNode) = (yyvsp[(3) - (3)].interm.intermTypedNode);
3035 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003036 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003037 break;
3038
3039 case 70:
3040
3041 {
3042 if (context->constErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)))
3043 context->recover();
3044 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003045 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003046 break;
3047
3048 case 71:
3049
3050 {
3051 TFunction &function = *((yyvsp[(1) - (2)].interm).function);
3052
3053 TIntermAggregate *prototype = new TIntermAggregate;
3054 prototype->setType(function.getReturnType());
3055 prototype->setName(function.getName());
3056
shannon.woods@transgaming.comd64b3da2013-02-28 23:19:26 +00003057 for (size_t i = 0; i < function.getParamCount(); i++)
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003058 {
3059 const TParameter &param = function.getParam(i);
3060 if (param.name != 0)
3061 {
3062 TVariable *variable = new TVariable(param.name, *param.type);
3063
3064 prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(variable->getUniqueId(), variable->getName(), variable->getType(), (yyvsp[(1) - (2)].interm).line), (yyvsp[(1) - (2)].interm).line);
3065 }
3066 else
3067 {
3068 prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (2)].interm).line), (yyvsp[(1) - (2)].interm).line);
3069 }
3070 }
3071
3072 prototype->setOp(EOpPrototype);
3073 (yyval.interm.intermNode) = prototype;
daniel@transgaming.com5dd6d092012-03-20 20:10:28 +00003074
3075 context->symbolTable.pop();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003076 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003077 break;
3078
3079 case 72:
3080
3081 {
3082 if ((yyvsp[(1) - (2)].interm).intermAggregate)
3083 (yyvsp[(1) - (2)].interm).intermAggregate->setOp(EOpDeclaration);
3084 (yyval.interm.intermNode) = (yyvsp[(1) - (2)].interm).intermAggregate;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003085 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003086 break;
3087
3088 case 73:
3089
3090 {
shannon.woods%transgaming.com@gtempaccount.comcbb6b6a2013-04-13 03:27:47 +00003091 if (((yyvsp[(2) - (4)].interm.precision) == EbpHigh) && (context->shaderType == SH_FRAGMENT_SHADER) && !context->fragmentPrecisionHigh) {
3092 context->error((yyvsp[(1) - (4)].lex).line, "precision is not supported in fragment shader", "highp");
3093 context->recover();
3094 }
shannon.woods@transgaming.comd25a6b32013-02-28 23:19:13 +00003095 if (!context->symbolTable.setDefaultPrecision( (yyvsp[(3) - (4)].interm.type), (yyvsp[(2) - (4)].interm.precision) )) {
3096 context->error((yyvsp[(1) - (4)].lex).line, "illegal type argument for default precision qualifier", getBasicString((yyvsp[(3) - (4)].interm.type).type));
3097 context->recover();
3098 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003099 (yyval.interm.intermNode) = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003100 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003101 break;
3102
3103 case 74:
3104
3105 {
3106 //
3107 // Multiple declarations of the same function are allowed.
3108 //
3109 // If this is a definition, the definition production code will check for redefinitions
3110 // (we don't know at this point if it's a definition or not).
3111 //
3112 // Redeclarations are allowed. But, return types and parameter qualifiers must match.
3113 //
3114 TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find((yyvsp[(1) - (2)].interm.function)->getMangledName()));
3115 if (prevDec) {
3116 if (prevDec->getReturnType() != (yyvsp[(1) - (2)].interm.function)->getReturnType()) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003117 context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same return type", (yyvsp[(1) - (2)].interm.function)->getReturnType().getBasicString());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003118 context->recover();
3119 }
shannon.woods@transgaming.comd64b3da2013-02-28 23:19:26 +00003120 for (size_t i = 0; i < prevDec->getParamCount(); ++i) {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003121 if (prevDec->getParam(i).type->getQualifier() != (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifier()) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003122 context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same parameter qualifiers", (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifierString());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003123 context->recover();
3124 }
3125 }
3126 }
3127
3128 //
3129 // If this is a redeclaration, it could also be a definition,
3130 // in which case, we want to use the variable names from this one, and not the one that's
3131 // being redeclared. So, pass back up this declaration, not the one in the symbol table.
3132 //
3133 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
3134 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
3135
daniel@transgaming.com5dd6d092012-03-20 20:10:28 +00003136 // We're at the inner scope level of the function's arguments and body statement.
3137 // Add the function prototype to the surrounding scope instead.
3138 context->symbolTable.getOuterLevel()->insert(*(yyval.interm).function);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003139 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003140 break;
3141
3142 case 75:
3143
3144 {
3145 (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003146 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003147 break;
3148
3149 case 76:
3150
3151 {
3152 (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003153 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003154 break;
3155
3156 case 77:
3157
3158 {
3159 // Add the parameter
3160 (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
3161 if ((yyvsp[(2) - (2)].interm).param.type->getBasicType() != EbtVoid)
3162 (yyvsp[(1) - (2)].interm.function)->addParameter((yyvsp[(2) - (2)].interm).param);
3163 else
3164 delete (yyvsp[(2) - (2)].interm).param.type;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003165 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003166 break;
3167
3168 case 78:
3169
3170 {
3171 //
3172 // Only first parameter of one-parameter functions can be void
3173 // The check for named parameters not being void is done in parameter_declarator
3174 //
3175 if ((yyvsp[(3) - (3)].interm).param.type->getBasicType() == EbtVoid) {
3176 //
3177 // This parameter > first is void
3178 //
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003179 context->error((yyvsp[(2) - (3)].lex).line, "cannot be an argument type except for '(void)'", "void");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003180 context->recover();
3181 delete (yyvsp[(3) - (3)].interm).param.type;
3182 } else {
3183 // Add the parameter
3184 (yyval.interm.function) = (yyvsp[(1) - (3)].interm.function);
3185 (yyvsp[(1) - (3)].interm.function)->addParameter((yyvsp[(3) - (3)].interm).param);
3186 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003187 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003188 break;
3189
3190 case 79:
3191
3192 {
3193 if ((yyvsp[(1) - (3)].interm.type).qualifier != EvqGlobal && (yyvsp[(1) - (3)].interm.type).qualifier != EvqTemporary) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003194 context->error((yyvsp[(2) - (3)].lex).line, "no qualifiers allowed for function return", getQualifierString((yyvsp[(1) - (3)].interm.type).qualifier));
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003195 context->recover();
3196 }
3197 // make sure a sampler is not involved as well...
3198 if (context->structQualifierErrorCheck((yyvsp[(2) - (3)].lex).line, (yyvsp[(1) - (3)].interm.type)))
3199 context->recover();
3200
3201 // Add the function as a prototype after parsing it (we do not support recursion)
3202 TFunction *function;
3203 TType type((yyvsp[(1) - (3)].interm.type));
3204 function = new TFunction((yyvsp[(2) - (3)].lex).string, type);
3205 (yyval.interm.function) = function;
daniel@transgaming.com5dd6d092012-03-20 20:10:28 +00003206
3207 context->symbolTable.push();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003208 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003209 break;
3210
3211 case 80:
3212
3213 {
3214 if ((yyvsp[(1) - (2)].interm.type).type == EbtVoid) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003215 context->error((yyvsp[(2) - (2)].lex).line, "illegal use of type 'void'", (yyvsp[(2) - (2)].lex).string->c_str());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003216 context->recover();
3217 }
3218 if (context->reservedErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string))
3219 context->recover();
3220 TParameter param = {(yyvsp[(2) - (2)].lex).string, new TType((yyvsp[(1) - (2)].interm.type))};
3221 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
3222 (yyval.interm).param = param;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003223 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003224 break;
3225
3226 case 81:
3227
3228 {
3229 // Check that we can make an array out of this type
3230 if (context->arrayTypeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
3231 context->recover();
3232
3233 if (context->reservedErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string))
3234 context->recover();
3235
3236 int size;
3237 if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3238 context->recover();
3239 (yyvsp[(1) - (5)].interm.type).setArray(true, size);
3240
3241 TType* type = new TType((yyvsp[(1) - (5)].interm.type));
3242 TParameter param = { (yyvsp[(2) - (5)].lex).string, type };
3243 (yyval.interm).line = (yyvsp[(2) - (5)].lex).line;
3244 (yyval.interm).param = param;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003245 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003246 break;
3247
3248 case 82:
3249
3250 {
3251 (yyval.interm) = (yyvsp[(3) - (3)].interm);
3252 if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
3253 context->recover();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003254 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003255 break;
3256
3257 case 83:
3258
3259 {
3260 (yyval.interm) = (yyvsp[(2) - (2)].interm);
3261 if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
3262 context->recover();
3263 if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
3264 context->recover();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003265 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003266 break;
3267
3268 case 84:
3269
3270 {
3271 (yyval.interm) = (yyvsp[(3) - (3)].interm);
3272 if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
3273 context->recover();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003274 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003275 break;
3276
3277 case 85:
3278
3279 {
3280 (yyval.interm) = (yyvsp[(2) - (2)].interm);
3281 if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
3282 context->recover();
3283 if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
3284 context->recover();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003285 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003286 break;
3287
3288 case 86:
3289
3290 {
3291 (yyval.interm.qualifier) = EvqIn;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003292 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003293 break;
3294
3295 case 87:
3296
3297 {
3298 (yyval.interm.qualifier) = EvqIn;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003299 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003300 break;
3301
3302 case 88:
3303
3304 {
3305 (yyval.interm.qualifier) = EvqOut;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003306 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003307 break;
3308
3309 case 89:
3310
3311 {
3312 (yyval.interm.qualifier) = EvqInOut;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003313 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003314 break;
3315
3316 case 90:
3317
3318 {
3319 TParameter param = { 0, new TType((yyvsp[(1) - (1)].interm.type)) };
3320 (yyval.interm).param = param;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003321 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003322 break;
3323
3324 case 91:
3325
3326 {
3327 (yyval.interm) = (yyvsp[(1) - (1)].interm);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003328 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003329 break;
3330
3331 case 92:
3332
3333 {
daniel@transgaming.comeec8efc2012-03-09 21:57:49 +00003334 if ((yyvsp[(1) - (3)].interm).type.type == EbtInvariant && !(yyvsp[(3) - (3)].lex).symbol)
3335 {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003336 context->error((yyvsp[(3) - (3)].lex).line, "undeclared identifier declared as invariant", (yyvsp[(3) - (3)].lex).string->c_str());
daniel@transgaming.comeec8efc2012-03-09 21:57:49 +00003337 context->recover();
3338 }
3339
zmo@google.comfd747b82011-04-23 01:30:07 +00003340 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(3) - (3)].lex).string, TType((yyvsp[(1) - (3)].interm).type), (yyvsp[(3) - (3)].lex).line);
3341 (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 +00003342
3343 if (context->structQualifierErrorCheck((yyvsp[(3) - (3)].lex).line, (yyval.interm).type))
3344 context->recover();
3345
daniel@transgaming.com8abd0b72012-09-27 17:46:07 +00003346 if (context->nonInitConstErrorCheck((yyvsp[(3) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyval.interm).type, false))
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003347 context->recover();
3348
zmo@google.comfd747b82011-04-23 01:30:07 +00003349 TVariable* variable = 0;
3350 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 +00003351 context->recover();
zmo@google.comfd747b82011-04-23 01:30:07 +00003352 if (symbol && variable)
3353 symbol->setId(variable->getUniqueId());
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003354 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003355 break;
3356
3357 case 93:
3358
3359 {
3360 if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
3361 context->recover();
3362
daniel@transgaming.com8abd0b72012-09-27 17:46:07 +00003363 if (context->nonInitConstErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, true))
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003364 context->recover();
3365
3366 (yyval.interm) = (yyvsp[(1) - (5)].interm);
3367
3368 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))
3369 context->recover();
3370 else {
3371 (yyvsp[(1) - (5)].interm).type.setArray(true);
3372 TVariable* variable;
3373 if (context->arrayErrorCheck((yyvsp[(4) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, variable))
3374 context->recover();
3375 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003376 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003377 break;
3378
3379 case 94:
3380
3381 {
3382 if (context->structQualifierErrorCheck((yyvsp[(3) - (6)].lex).line, (yyvsp[(1) - (6)].interm).type))
3383 context->recover();
3384
daniel@transgaming.com8abd0b72012-09-27 17:46:07 +00003385 if (context->nonInitConstErrorCheck((yyvsp[(3) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type, true))
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003386 context->recover();
3387
3388 (yyval.interm) = (yyvsp[(1) - (6)].interm);
3389
3390 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))
3391 context->recover();
3392 else {
3393 int size;
3394 if (context->arraySizeErrorCheck((yyvsp[(4) - (6)].lex).line, (yyvsp[(5) - (6)].interm.intermTypedNode), size))
3395 context->recover();
3396 (yyvsp[(1) - (6)].interm).type.setArray(true, size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003397 TVariable* variable = 0;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003398 if (context->arrayErrorCheck((yyvsp[(4) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type, variable))
3399 context->recover();
3400 TType type = TType((yyvsp[(1) - (6)].interm).type);
3401 type.setArraySize(size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003402 (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 +00003403 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003404 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003405 break;
3406
3407 case 95:
3408
3409 {
3410 if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
3411 context->recover();
3412
3413 (yyval.interm) = (yyvsp[(1) - (5)].interm);
3414
3415 TIntermNode* intermNode;
3416 if (!context->executeInitializer((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, (yyvsp[(5) - (5)].interm.intermTypedNode), intermNode)) {
3417 //
3418 // build the intermediate representation
3419 //
3420 if (intermNode)
3421 (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (5)].interm).intermNode, intermNode, (yyvsp[(4) - (5)].lex).line);
3422 else
3423 (yyval.interm).intermAggregate = (yyvsp[(1) - (5)].interm).intermAggregate;
3424 } else {
3425 context->recover();
3426 (yyval.interm).intermAggregate = 0;
3427 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003428 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003429 break;
3430
3431 case 96:
3432
3433 {
3434 (yyval.interm).type = (yyvsp[(1) - (1)].interm.type);
3435 (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 +00003436 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003437 break;
3438
3439 case 97:
3440
3441 {
zmo@google.comfd747b82011-04-23 01:30:07 +00003442 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyvsp[(1) - (2)].interm.type)), (yyvsp[(2) - (2)].lex).line);
3443 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (2)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003444
3445 if (context->structQualifierErrorCheck((yyvsp[(2) - (2)].lex).line, (yyval.interm).type))
3446 context->recover();
3447
daniel@transgaming.com8abd0b72012-09-27 17:46:07 +00003448 if (context->nonInitConstErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string, (yyval.interm).type, false))
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003449 context->recover();
3450
3451 (yyval.interm).type = (yyvsp[(1) - (2)].interm.type);
3452
zmo@google.comfd747b82011-04-23 01:30:07 +00003453 TVariable* variable = 0;
3454 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 +00003455 context->recover();
zmo@google.comfd747b82011-04-23 01:30:07 +00003456 if (variable && symbol)
3457 symbol->setId(variable->getUniqueId());
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003458 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003459 break;
3460
3461 case 98:
3462
3463 {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003464 context->error((yyvsp[(2) - (4)].lex).line, "unsized array declarations not supported", (yyvsp[(2) - (4)].lex).string->c_str());
kbr@chromium.org04277b82011-06-02 18:41:26 +00003465 context->recover();
3466
zmo@google.comfd747b82011-04-23 01:30:07 +00003467 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (4)].lex).string, TType((yyvsp[(1) - (4)].interm.type)), (yyvsp[(2) - (4)].lex).line);
3468 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (4)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003469 (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003470 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003471 break;
3472
3473 case 99:
3474
3475 {
3476 TType type = TType((yyvsp[(1) - (5)].interm.type));
3477 int size;
3478 if (context->arraySizeErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3479 context->recover();
3480 type.setArraySize(size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003481 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (5)].lex).string, type, (yyvsp[(2) - (5)].lex).line);
3482 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (5)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003483
3484 if (context->structQualifierErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
3485 context->recover();
3486
daniel@transgaming.com8abd0b72012-09-27 17:46:07 +00003487 if (context->nonInitConstErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type), true))
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003488 context->recover();
3489
3490 (yyval.interm).type = (yyvsp[(1) - (5)].interm.type);
3491
3492 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)))
3493 context->recover();
3494 else {
3495 int size;
3496 if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3497 context->recover();
3498
3499 (yyvsp[(1) - (5)].interm.type).setArray(true, size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003500 TVariable* variable = 0;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003501 if (context->arrayErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type), variable))
3502 context->recover();
zmo@google.comfd747b82011-04-23 01:30:07 +00003503 if (variable && symbol)
3504 symbol->setId(variable->getUniqueId());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003505 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003506 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003507 break;
3508
3509 case 100:
3510
3511 {
3512 if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
3513 context->recover();
3514
3515 (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
3516
3517 TIntermNode* intermNode;
3518 if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode)) {
3519 //
3520 // Build intermediate representation
3521 //
3522 if(intermNode)
3523 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(intermNode, (yyvsp[(3) - (4)].lex).line);
3524 else
3525 (yyval.interm).intermAggregate = 0;
3526 } else {
3527 context->recover();
3528 (yyval.interm).intermAggregate = 0;
3529 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003530 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003531 break;
3532
3533 case 101:
3534
3535 {
3536 VERTEX_ONLY("invariant declaration", (yyvsp[(1) - (2)].lex).line);
daniel@transgaming.comeec8efc2012-03-09 21:57:49 +00003537 if (context->globalErrorCheck((yyvsp[(1) - (2)].lex).line, context->symbolTable.atGlobalLevel(), "invariant varying"))
3538 context->recover();
3539 (yyval.interm).type.setBasic(EbtInvariant, EvqInvariantVaryingOut, (yyvsp[(2) - (2)].lex).line);
3540 if (!(yyvsp[(2) - (2)].lex).symbol)
3541 {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003542 context->error((yyvsp[(2) - (2)].lex).line, "undeclared identifier declared as invariant", (yyvsp[(2) - (2)].lex).string->c_str());
daniel@transgaming.comeec8efc2012-03-09 21:57:49 +00003543 context->recover();
3544
3545 (yyval.interm).intermAggregate = 0;
3546 }
3547 else
3548 {
3549 TIntermSymbol *symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyval.interm).type), (yyvsp[(2) - (2)].lex).line);
3550 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (2)].lex).line);
3551 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003552 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003553 break;
3554
3555 case 102:
3556
3557 {
3558 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3559
3560 if ((yyvsp[(1) - (1)].interm.type).array) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003561 context->error((yyvsp[(1) - (1)].interm.type).line, "not supported", "first-class array");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003562 context->recover();
3563 (yyvsp[(1) - (1)].interm.type).setArray(false);
3564 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003565 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003566 break;
3567
3568 case 103:
3569
3570 {
3571 if ((yyvsp[(2) - (2)].interm.type).array) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003572 context->error((yyvsp[(2) - (2)].interm.type).line, "not supported", "first-class array");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003573 context->recover();
3574 (yyvsp[(2) - (2)].interm.type).setArray(false);
3575 }
3576
3577 if ((yyvsp[(1) - (2)].interm.type).qualifier == EvqAttribute &&
3578 ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003579 context->error((yyvsp[(2) - (2)].interm.type).line, "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier));
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003580 context->recover();
3581 }
3582 if (((yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingIn || (yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingOut) &&
3583 ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003584 context->error((yyvsp[(2) - (2)].interm.type).line, "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier));
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003585 context->recover();
3586 }
3587 (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
3588 (yyval.interm.type).qualifier = (yyvsp[(1) - (2)].interm.type).qualifier;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003589 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003590 break;
3591
3592 case 104:
3593
3594 {
3595 (yyval.interm.type).setBasic(EbtVoid, EvqConst, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003596 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003597 break;
3598
3599 case 105:
3600
3601 {
3602 VERTEX_ONLY("attribute", (yyvsp[(1) - (1)].lex).line);
3603 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "attribute"))
3604 context->recover();
3605 (yyval.interm.type).setBasic(EbtVoid, EvqAttribute, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003606 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003607 break;
3608
3609 case 106:
3610
3611 {
3612 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "varying"))
3613 context->recover();
3614 if (context->shaderType == SH_VERTEX_SHADER)
3615 (yyval.interm.type).setBasic(EbtVoid, EvqVaryingOut, (yyvsp[(1) - (1)].lex).line);
3616 else
3617 (yyval.interm.type).setBasic(EbtVoid, EvqVaryingIn, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003618 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003619 break;
3620
3621 case 107:
3622
3623 {
3624 if (context->globalErrorCheck((yyvsp[(1) - (2)].lex).line, context->symbolTable.atGlobalLevel(), "invariant varying"))
3625 context->recover();
3626 if (context->shaderType == SH_VERTEX_SHADER)
3627 (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingOut, (yyvsp[(1) - (2)].lex).line);
3628 else
3629 (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingIn, (yyvsp[(1) - (2)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003630 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003631 break;
3632
3633 case 108:
3634
3635 {
3636 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "uniform"))
3637 context->recover();
3638 (yyval.interm.type).setBasic(EbtVoid, EvqUniform, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003639 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003640 break;
3641
3642 case 109:
3643
3644 {
3645 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
zmo@google.comdc4b4f82011-06-17 00:42:53 +00003646
3647 if ((yyval.interm.type).precision == EbpUndefined) {
3648 (yyval.interm.type).precision = context->symbolTable.getDefaultPrecision((yyvsp[(1) - (1)].interm.type).type);
3649 if (context->precisionErrorCheck((yyvsp[(1) - (1)].interm.type).line, (yyval.interm.type).precision, (yyvsp[(1) - (1)].interm.type).type)) {
3650 context->recover();
3651 }
3652 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003653 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003654 break;
3655
3656 case 110:
3657
3658 {
3659 (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
3660 (yyval.interm.type).precision = (yyvsp[(1) - (2)].interm.precision);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003661 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003662 break;
3663
3664 case 111:
3665
3666 {
3667 (yyval.interm.precision) = EbpHigh;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003668 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003669 break;
3670
3671 case 112:
3672
3673 {
3674 (yyval.interm.precision) = EbpMedium;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003675 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003676 break;
3677
3678 case 113:
3679
3680 {
3681 (yyval.interm.precision) = EbpLow;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003682 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003683 break;
3684
3685 case 114:
3686
3687 {
3688 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003689 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003690 break;
3691
3692 case 115:
3693
3694 {
3695 (yyval.interm.type) = (yyvsp[(1) - (4)].interm.type);
3696
3697 if (context->arrayTypeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
3698 context->recover();
3699 else {
3700 int size;
3701 if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
3702 context->recover();
3703 (yyval.interm.type).setArray(true, size);
3704 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003705 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003706 break;
3707
3708 case 116:
3709
3710 {
3711 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3712 (yyval.interm.type).setBasic(EbtVoid, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003713 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003714 break;
3715
3716 case 117:
3717
3718 {
3719 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3720 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003721 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003722 break;
3723
3724 case 118:
3725
3726 {
3727 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3728 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003729 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003730 break;
3731
3732 case 119:
3733
3734 {
3735 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3736 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003737 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003738 break;
3739
3740 case 120:
3741
3742 {
3743 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3744 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3745 (yyval.interm.type).setAggregate(2);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003746 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003747 break;
3748
3749 case 121:
3750
3751 {
3752 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3753 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3754 (yyval.interm.type).setAggregate(3);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003755 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003756 break;
3757
3758 case 122:
3759
3760 {
3761 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3762 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3763 (yyval.interm.type).setAggregate(4);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003764 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003765 break;
3766
3767 case 123:
3768
3769 {
3770 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3771 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3772 (yyval.interm.type).setAggregate(2);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003773 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003774 break;
3775
3776 case 124:
3777
3778 {
3779 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3780 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3781 (yyval.interm.type).setAggregate(3);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003782 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003783 break;
3784
3785 case 125:
3786
3787 {
3788 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3789 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3790 (yyval.interm.type).setAggregate(4);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003791 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003792 break;
3793
3794 case 126:
3795
3796 {
3797 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3798 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3799 (yyval.interm.type).setAggregate(2);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003800 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003801 break;
3802
3803 case 127:
3804
3805 {
3806 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3807 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3808 (yyval.interm.type).setAggregate(3);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003809 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003810 break;
3811
3812 case 128:
3813
3814 {
3815 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3816 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3817 (yyval.interm.type).setAggregate(4);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003818 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003819 break;
3820
3821 case 129:
3822
3823 {
3824 FRAG_VERT_ONLY("mat2", (yyvsp[(1) - (1)].lex).line);
3825 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3826 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3827 (yyval.interm.type).setAggregate(2, true);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003828 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003829 break;
3830
3831 case 130:
3832
3833 {
3834 FRAG_VERT_ONLY("mat3", (yyvsp[(1) - (1)].lex).line);
3835 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3836 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3837 (yyval.interm.type).setAggregate(3, true);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003838 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003839 break;
3840
3841 case 131:
3842
3843 {
3844 FRAG_VERT_ONLY("mat4", (yyvsp[(1) - (1)].lex).line);
3845 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3846 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3847 (yyval.interm.type).setAggregate(4, true);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003848 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003849 break;
3850
3851 case 132:
3852
3853 {
3854 FRAG_VERT_ONLY("sampler2D", (yyvsp[(1) - (1)].lex).line);
3855 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3856 (yyval.interm.type).setBasic(EbtSampler2D, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003857 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003858 break;
3859
3860 case 133:
3861
3862 {
3863 FRAG_VERT_ONLY("samplerCube", (yyvsp[(1) - (1)].lex).line);
3864 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3865 (yyval.interm.type).setBasic(EbtSamplerCube, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003866 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003867 break;
3868
3869 case 134:
3870
3871 {
zmo@google.com09c323a2011-08-12 18:22:25 +00003872 if (!context->supportsExtension("GL_OES_EGL_image_external")) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003873 context->error((yyvsp[(1) - (1)].lex).line, "unsupported type", "samplerExternalOES");
zmo@google.com09c323a2011-08-12 18:22:25 +00003874 context->recover();
3875 }
3876 FRAG_VERT_ONLY("samplerExternalOES", (yyvsp[(1) - (1)].lex).line);
3877 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3878 (yyval.interm.type).setBasic(EbtSamplerExternalOES, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003879 }
zmo@google.com09c323a2011-08-12 18:22:25 +00003880 break;
3881
3882 case 135:
3883
3884 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00003885 if (!context->supportsExtension("GL_ARB_texture_rectangle")) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003886 context->error((yyvsp[(1) - (1)].lex).line, "unsupported type", "sampler2DRect");
kbr@chromium.org205fef32011-11-22 20:50:02 +00003887 context->recover();
3888 }
3889 FRAG_VERT_ONLY("sampler2DRect", (yyvsp[(1) - (1)].lex).line);
3890 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3891 (yyval.interm.type).setBasic(EbtSampler2DRect, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003892 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003893 break;
3894
zmo@google.com09c323a2011-08-12 18:22:25 +00003895 case 136:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003896
3897 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00003898 FRAG_VERT_ONLY("struct", (yyvsp[(1) - (1)].interm.type).line);
3899 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3900 (yyval.interm.type).qualifier = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003901 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003902 break;
3903
3904 case 137:
3905
3906 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003907 //
3908 // This is for user defined type names. The lexical phase looked up the
3909 // type.
3910 //
3911 TType& structure = static_cast<TVariable*>((yyvsp[(1) - (1)].lex).symbol)->getType();
3912 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3913 (yyval.interm.type).setBasic(EbtStruct, qual, (yyvsp[(1) - (1)].lex).line);
3914 (yyval.interm.type).userDef = &structure;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003915 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003916 break;
3917
zmo@google.com09c323a2011-08-12 18:22:25 +00003918 case 138:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003919
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003920 { if (context->enterStructDeclaration((yyvsp[(2) - (3)].lex).line, *(yyvsp[(2) - (3)].lex).string)) context->recover(); }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003921 break;
3922
3923 case 139:
3924
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003925 {
kbr@chromium.org476541f2011-10-27 21:14:51 +00003926 if (context->reservedErrorCheck((yyvsp[(2) - (6)].lex).line, *(yyvsp[(2) - (6)].lex).string))
3927 context->recover();
3928
3929 TType* structure = new TType((yyvsp[(5) - (6)].interm.typeList), *(yyvsp[(2) - (6)].lex).string);
3930 TVariable* userTypeDef = new TVariable((yyvsp[(2) - (6)].lex).string, *structure, true);
3931 if (! context->symbolTable.insert(*userTypeDef)) {
3932 context->error((yyvsp[(2) - (6)].lex).line, "redefinition", (yyvsp[(2) - (6)].lex).string->c_str(), "struct");
3933 context->recover();
3934 }
3935 (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (6)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003936 (yyval.interm.type).userDef = structure;
kbr@chromium.org476541f2011-10-27 21:14:51 +00003937 context->exitStructDeclaration();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003938 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00003939 break;
3940
3941 case 140:
3942
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003943 { if (context->enterStructDeclaration((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string)) context->recover(); }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003944 break;
3945
3946 case 141:
3947
kbr@chromium.org476541f2011-10-27 21:14:51 +00003948 {
3949 TType* structure = new TType((yyvsp[(4) - (5)].interm.typeList), TString(""));
3950 (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (5)].lex).line);
3951 (yyval.interm.type).userDef = structure;
3952 context->exitStructDeclaration();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003953 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003954 break;
3955
kbr@chromium.org476541f2011-10-27 21:14:51 +00003956 case 142:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003957
3958 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00003959 (yyval.interm.typeList) = (yyvsp[(1) - (1)].interm.typeList);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003960 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003961 break;
3962
3963 case 143:
3964
3965 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003966 (yyval.interm.typeList) = (yyvsp[(1) - (2)].interm.typeList);
3967 for (unsigned int i = 0; i < (yyvsp[(2) - (2)].interm.typeList)->size(); ++i) {
3968 for (unsigned int j = 0; j < (yyval.interm.typeList)->size(); ++j) {
3969 if ((*(yyval.interm.typeList))[j].type->getFieldName() == (*(yyvsp[(2) - (2)].interm.typeList))[i].type->getFieldName()) {
3970 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());
3971 context->recover();
3972 }
3973 }
3974 (yyval.interm.typeList)->push_back((*(yyvsp[(2) - (2)].interm.typeList))[i]);
3975 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003976 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003977 break;
3978
kbr@chromium.org205fef32011-11-22 20:50:02 +00003979 case 144:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003980
3981 {
3982 (yyval.interm.typeList) = (yyvsp[(2) - (3)].interm.typeList);
3983
3984 if (context->voidErrorCheck((yyvsp[(1) - (3)].interm.type).line, (*(yyvsp[(2) - (3)].interm.typeList))[0].type->getFieldName(), (yyvsp[(1) - (3)].interm.type))) {
3985 context->recover();
3986 }
3987 for (unsigned int i = 0; i < (yyval.interm.typeList)->size(); ++i) {
3988 //
3989 // Careful not to replace already known aspects of type, like array-ness
3990 //
3991 TType* type = (*(yyval.interm.typeList))[i].type;
3992 type->setBasicType((yyvsp[(1) - (3)].interm.type).type);
3993 type->setNominalSize((yyvsp[(1) - (3)].interm.type).size);
3994 type->setMatrix((yyvsp[(1) - (3)].interm.type).matrix);
zmo@google.comdc4b4f82011-06-17 00:42:53 +00003995 type->setPrecision((yyvsp[(1) - (3)].interm.type).precision);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003996
3997 // don't allow arrays of arrays
3998 if (type->isArray()) {
3999 if (context->arrayTypeErrorCheck((yyvsp[(1) - (3)].interm.type).line, (yyvsp[(1) - (3)].interm.type)))
4000 context->recover();
4001 }
4002 if ((yyvsp[(1) - (3)].interm.type).array)
4003 type->setArraySize((yyvsp[(1) - (3)].interm.type).arraySize);
4004 if ((yyvsp[(1) - (3)].interm.type).userDef) {
4005 type->setStruct((yyvsp[(1) - (3)].interm.type).userDef->getStruct());
4006 type->setTypeName((yyvsp[(1) - (3)].interm.type).userDef->getTypeName());
4007 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004008
4009 if (context->structNestingErrorCheck((yyvsp[(1) - (3)].interm.type).line, *type)) {
4010 context->recover();
4011 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004012 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004013 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004014 break;
4015
kbr@chromium.org476541f2011-10-27 21:14:51 +00004016 case 145:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004017
4018 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004019 (yyval.interm.typeList) = NewPoolTTypeList();
4020 (yyval.interm.typeList)->push_back((yyvsp[(1) - (1)].interm.typeLine));
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004021 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004022 break;
4023
kbr@chromium.org476541f2011-10-27 21:14:51 +00004024 case 146:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004025
4026 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004027 (yyval.interm.typeList)->push_back((yyvsp[(3) - (3)].interm.typeLine));
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004028 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004029 break;
4030
4031 case 147:
4032
4033 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004034 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
4035 context->recover();
4036
4037 (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
4038 (yyval.interm.typeLine).line = (yyvsp[(1) - (1)].lex).line;
4039 (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (1)].lex).string);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004040 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004041 break;
4042
kbr@chromium.org205fef32011-11-22 20:50:02 +00004043 case 148:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004044
4045 {
4046 if (context->reservedErrorCheck((yyvsp[(1) - (4)].lex).line, *(yyvsp[(1) - (4)].lex).string))
4047 context->recover();
4048
4049 (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
4050 (yyval.interm.typeLine).line = (yyvsp[(1) - (4)].lex).line;
4051 (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (4)].lex).string);
4052
4053 int size;
4054 if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
4055 context->recover();
4056 (yyval.interm.typeLine).type->setArraySize(size);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004057 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004058 break;
4059
4060 case 149:
4061
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004062 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004063 break;
4064
4065 case 150:
4066
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004067 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004068 break;
4069
4070 case 151:
4071
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004072 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermAggregate); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004073 break;
4074
4075 case 152:
4076
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004077 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004078 break;
4079
4080 case 153:
4081
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004082 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004083 break;
4084
4085 case 154:
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
4090 case 155:
4091
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004092 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004093 break;
4094
4095 case 156:
4096
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004097 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004098 break;
4099
4100 case 157:
4101
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004102 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
zmo@google.com09c323a2011-08-12 18:22:25 +00004103 break;
4104
4105 case 158:
4106
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004107 { (yyval.interm.intermAggregate) = 0; }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004108 break;
4109
4110 case 159:
4111
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004112 { context->symbolTable.push(); }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004113 break;
4114
4115 case 160:
4116
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004117 { context->symbolTable.pop(); }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004118 break;
4119
4120 case 161:
4121
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004122 {
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004123 if ((yyvsp[(3) - (5)].interm.intermAggregate) != 0) {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004124 (yyvsp[(3) - (5)].interm.intermAggregate)->setOp(EOpSequence);
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004125 (yyvsp[(3) - (5)].interm.intermAggregate)->setEndLine((yyvsp[(5) - (5)].lex).line);
4126 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004127 (yyval.interm.intermAggregate) = (yyvsp[(3) - (5)].interm.intermAggregate);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004128 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004129 break;
4130
4131 case 162:
4132
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004133 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004134 break;
4135
4136 case 163:
4137
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004138 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004139 break;
4140
kbr@chromium.org476541f2011-10-27 21:14:51 +00004141 case 164:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004142
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004143 { context->symbolTable.push(); }
4144 break;
4145
4146 case 165:
4147
4148 { context->symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[(2) - (2)].interm.intermNode); }
4149 break;
4150
4151 case 166:
4152
4153 { context->symbolTable.push(); }
4154 break;
4155
4156 case 167:
4157
4158 { context->symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[(2) - (2)].interm.intermNode); }
4159 break;
4160
4161 case 168:
4162
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004163 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004164 (yyval.interm.intermNode) = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004165 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004166 break;
4167
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004168 case 169:
kbr@chromium.org205fef32011-11-22 20:50:02 +00004169
4170 {
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004171 if ((yyvsp[(2) - (3)].interm.intermAggregate)) {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004172 (yyvsp[(2) - (3)].interm.intermAggregate)->setOp(EOpSequence);
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004173 (yyvsp[(2) - (3)].interm.intermAggregate)->setEndLine((yyvsp[(3) - (3)].lex).line);
4174 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004175 (yyval.interm.intermNode) = (yyvsp[(2) - (3)].interm.intermAggregate);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004176 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004177 break;
4178
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004179 case 170:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004180
4181 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004182 (yyval.interm.intermAggregate) = context->intermediate.makeAggregate((yyvsp[(1) - (1)].interm.intermNode), 0);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004183 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004184 break;
4185
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004186 case 171:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004187
kbr@chromium.org205fef32011-11-22 20:50:02 +00004188 {
4189 (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 +00004190 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004191 break;
4192
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004193 case 172:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004194
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004195 { (yyval.interm.intermNode) = 0; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004196 break;
4197
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004198 case 173:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004199
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004200 { (yyval.interm.intermNode) = static_cast<TIntermNode*>((yyvsp[(1) - (2)].interm.intermTypedNode)); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004201 break;
4202
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004203 case 174:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004204
4205 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004206 if (context->boolErrorCheck((yyvsp[(1) - (5)].lex).line, (yyvsp[(3) - (5)].interm.intermTypedNode)))
4207 context->recover();
4208 (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 +00004209 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004210 break;
4211
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004212 case 175:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004213
4214 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004215 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermNode);
4216 (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004217 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004218 break;
4219
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004220 case 176:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004221
4222 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004223 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (1)].interm.intermNode);
4224 (yyval.interm.nodePair).node2 = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004225 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004226 break;
4227
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004228 case 177:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004229
4230 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004231 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
4232 if (context->boolErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)->getLine(), (yyvsp[(1) - (1)].interm.intermTypedNode)))
4233 context->recover();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004234 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004235 break;
4236
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004237 case 178:
kbr@chromium.org205fef32011-11-22 20:50:02 +00004238
4239 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004240 TIntermNode* intermNode;
4241 if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
4242 context->recover();
4243 if (context->boolErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
4244 context->recover();
4245
4246 if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode))
4247 (yyval.interm.intermTypedNode) = (yyvsp[(4) - (4)].interm.intermTypedNode);
4248 else {
4249 context->recover();
4250 (yyval.interm.intermTypedNode) = 0;
4251 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004252 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004253 break;
4254
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004255 case 179:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004256
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004257 { context->symbolTable.push(); ++context->loopNestingLevel; }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004258 break;
4259
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004260 case 180:
kbr@chromium.org205fef32011-11-22 20:50:02 +00004261
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004262 {
4263 context->symbolTable.pop();
alokp@chromium.org52813552010-11-16 18:36:09 +00004264 (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 +00004265 --context->loopNestingLevel;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004266 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004267 break;
4268
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004269 case 181:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004270
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004271 { ++context->loopNestingLevel; }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004272 break;
4273
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004274 case 182:
kbr@chromium.org205fef32011-11-22 20:50:02 +00004275
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004276 {
4277 if (context->boolErrorCheck((yyvsp[(8) - (8)].lex).line, (yyvsp[(6) - (8)].interm.intermTypedNode)))
4278 context->recover();
4279
alokp@chromium.org52813552010-11-16 18:36:09 +00004280 (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 +00004281 --context->loopNestingLevel;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004282 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004283 break;
4284
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004285 case 183:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004286
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004287 { context->symbolTable.push(); ++context->loopNestingLevel; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004288 break;
4289
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004290 case 184:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004291
4292 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004293 context->symbolTable.pop();
4294 (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);
4295 --context->loopNestingLevel;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004296 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004297 break;
4298
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004299 case 185:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004300
4301 {
kbr@chromium.org476541f2011-10-27 21:14:51 +00004302 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004303 }
zmo@google.com09c323a2011-08-12 18:22:25 +00004304 break;
4305
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004306 case 186:
zmo@google.com09c323a2011-08-12 18:22:25 +00004307
4308 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004309 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004310 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004311 break;
4312
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004313 case 187:
kbr@chromium.org476541f2011-10-27 21:14:51 +00004314
4315 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004316 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004317 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004318 break;
4319
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004320 case 188:
kbr@chromium.org476541f2011-10-27 21:14:51 +00004321
4322 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004323 (yyval.interm.intermTypedNode) = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004324 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004325 break;
4326
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004327 case 189:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004328
4329 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004330 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (2)].interm.intermTypedNode);
4331 (yyval.interm.nodePair).node2 = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004332 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004333 break;
4334
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004335 case 190:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004336
4337 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004338 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermTypedNode);
4339 (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004340 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004341 break;
4342
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004343 case 191:
kbr@chromium.org205fef32011-11-22 20:50:02 +00004344
4345 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004346 if (context->loopNestingLevel <= 0) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00004347 context->error((yyvsp[(1) - (2)].lex).line, "continue statement only allowed in loops", "");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004348 context->recover();
4349 }
4350 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpContinue, (yyvsp[(1) - (2)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004351 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004352 break;
4353
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004354 case 192:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004355
4356 {
4357 if (context->loopNestingLevel <= 0) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00004358 context->error((yyvsp[(1) - (2)].lex).line, "break statement only allowed in loops", "");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004359 context->recover();
4360 }
4361 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpBreak, (yyvsp[(1) - (2)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004362 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004363 break;
4364
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004365 case 193:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004366
4367 {
4368 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(1) - (2)].lex).line);
4369 if (context->currentFunctionType->getBasicType() != EbtVoid) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00004370 context->error((yyvsp[(1) - (2)].lex).line, "non-void function must return a value", "return");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004371 context->recover();
4372 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004373 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004374 break;
4375
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004376 case 194:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004377
4378 {
4379 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(2) - (3)].interm.intermTypedNode), (yyvsp[(1) - (3)].lex).line);
4380 context->functionReturnsValue = true;
4381 if (context->currentFunctionType->getBasicType() == EbtVoid) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00004382 context->error((yyvsp[(1) - (3)].lex).line, "void function cannot return a value", "return");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004383 context->recover();
4384 } else if (*(context->currentFunctionType) != (yyvsp[(2) - (3)].interm.intermTypedNode)->getType()) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00004385 context->error((yyvsp[(1) - (3)].lex).line, "function return is not matching type:", "return");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004386 context->recover();
4387 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004388 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004389 break;
4390
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004391 case 195:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004392
4393 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004394 FRAG_ONLY("discard", (yyvsp[(1) - (2)].lex).line);
4395 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpKill, (yyvsp[(1) - (2)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004396 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004397 break;
4398
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004399 case 196:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004400
4401 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004402 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
zmo@google.com09c323a2011-08-12 18:22:25 +00004403 context->treeRoot = (yyval.interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004404 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004405 break;
4406
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004407 case 197:
zmo@google.com09c323a2011-08-12 18:22:25 +00004408
4409 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004410 (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermNode), (yyvsp[(2) - (2)].interm.intermNode), 0);
4411 context->treeRoot = (yyval.interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004412 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004413 break;
4414
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004415 case 198:
kbr@chromium.org476541f2011-10-27 21:14:51 +00004416
4417 {
4418 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004419 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004420 break;
4421
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004422 case 199:
kbr@chromium.org476541f2011-10-27 21:14:51 +00004423
4424 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004425 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004426 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004427 break;
4428
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004429 case 200:
kbr@chromium.org205fef32011-11-22 20:50:02 +00004430
4431 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004432 TFunction* function = (yyvsp[(1) - (1)].interm).function;
daniel@transgaming.coma8833e92012-07-11 20:37:16 +00004433
4434 const TSymbol *builtIn = context->symbolTable.findBuiltIn(function->getMangledName());
4435
4436 if (builtIn)
4437 {
4438 context->error((yyvsp[(1) - (1)].interm).line, "built-in functions cannot be redefined", function->getName().c_str());
4439 context->recover();
4440 }
4441
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004442 TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find(function->getMangledName()));
4443 //
4444 // Note: 'prevDec' could be 'function' if this is the first time we've seen function
4445 // as it would have just been put in the symbol table. Otherwise, we're looking up
4446 // an earlier occurance.
4447 //
4448 if (prevDec->isDefined()) {
4449 //
4450 // Then this function already has a body.
4451 //
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00004452 context->error((yyvsp[(1) - (1)].interm).line, "function already has a body", function->getName().c_str());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004453 context->recover();
4454 }
4455 prevDec->setDefined();
4456
4457 //
4458 // Raise error message if main function takes any parameters or return anything other than void
4459 //
4460 if (function->getName() == "main") {
4461 if (function->getParamCount() > 0) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00004462 context->error((yyvsp[(1) - (1)].interm).line, "function cannot take any parameter(s)", function->getName().c_str());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004463 context->recover();
4464 }
4465 if (function->getReturnType().getBasicType() != EbtVoid) {
4466 context->error((yyvsp[(1) - (1)].interm).line, "", function->getReturnType().getBasicString(), "main function cannot return a value");
4467 context->recover();
4468 }
4469 }
4470
4471 //
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004472 // Remember the return type for later checking for RETURN statements.
4473 //
4474 context->currentFunctionType = &(prevDec->getReturnType());
4475 context->functionReturnsValue = false;
4476
4477 //
4478 // Insert parameters into the symbol table.
4479 // If the parameter has no name, it's not an error, just don't insert it
4480 // (could be used for unused args).
4481 //
4482 // Also, accumulate the list of parameters into the HIL, so lower level code
4483 // knows where to find parameters.
4484 //
4485 TIntermAggregate* paramNodes = new TIntermAggregate;
shannon.woods@transgaming.com6b04e1b2013-02-28 23:19:41 +00004486 for (size_t i = 0; i < function->getParamCount(); i++) {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004487 const TParameter& param = function->getParam(i);
4488 if (param.name != 0) {
4489 TVariable *variable = new TVariable(param.name, *param.type);
4490 //
4491 // Insert the parameters with name in the symbol table.
4492 //
4493 if (! context->symbolTable.insert(*variable)) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00004494 context->error((yyvsp[(1) - (1)].interm).line, "redefinition", variable->getName().c_str());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004495 context->recover();
4496 delete variable;
4497 }
4498
4499 //
4500 // Add the parameter to the HIL
4501 //
4502 paramNodes = context->intermediate.growAggregate(
4503 paramNodes,
4504 context->intermediate.addSymbol(variable->getUniqueId(),
4505 variable->getName(),
4506 variable->getType(), (yyvsp[(1) - (1)].interm).line),
4507 (yyvsp[(1) - (1)].interm).line);
4508 } else {
4509 paramNodes = context->intermediate.growAggregate(paramNodes, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (1)].interm).line), (yyvsp[(1) - (1)].interm).line);
4510 }
4511 }
4512 context->intermediate.setAggregateOperator(paramNodes, EOpParameters, (yyvsp[(1) - (1)].interm).line);
4513 (yyvsp[(1) - (1)].interm).intermAggregate = paramNodes;
4514 context->loopNestingLevel = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004515 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004516 break;
4517
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004518 case 201:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004519
4520 {
4521 //?? Check that all paths return a value if return type != void ?
4522 // May be best done as post process phase on intermediate code
4523 if (context->currentFunctionType->getBasicType() != EbtVoid && ! context->functionReturnsValue) {
4524 context->error((yyvsp[(1) - (3)].interm).line, "function does not return a value:", "", (yyvsp[(1) - (3)].interm).function->getName().c_str());
4525 context->recover();
4526 }
daniel@transgaming.com5dd6d092012-03-20 20:10:28 +00004527
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004528 (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermAggregate, (yyvsp[(3) - (3)].interm.intermNode), 0);
4529 context->intermediate.setAggregateOperator((yyval.interm.intermNode), EOpFunction, (yyvsp[(1) - (3)].interm).line);
4530 (yyval.interm.intermNode)->getAsAggregate()->setName((yyvsp[(1) - (3)].interm).function->getMangledName().c_str());
4531 (yyval.interm.intermNode)->getAsAggregate()->setType((yyvsp[(1) - (3)].interm).function->getReturnType());
4532
4533 // store the pragma information for debug and optimize and other vendor specific
4534 // information. This information can be queried from the parse tree
alokp@chromium.org8b851c62012-06-15 16:25:11 +00004535 (yyval.interm.intermNode)->getAsAggregate()->setOptimize(context->pragma().optimize);
4536 (yyval.interm.intermNode)->getAsAggregate()->setDebug(context->pragma().debug);
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004537
4538 if ((yyvsp[(3) - (3)].interm.intermNode) && (yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate())
4539 (yyval.interm.intermNode)->getAsAggregate()->setEndLine((yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate()->getEndLine());
daniel@transgaming.com5dd6d092012-03-20 20:10:28 +00004540
4541 context->symbolTable.pop();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004542 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004543 break;
4544
4545
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004546
4547 default: break;
4548 }
4549 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
4550
4551 YYPOPSTACK (yylen);
4552 yylen = 0;
4553 YY_STACK_PRINT (yyss, yyssp);
4554
4555 *++yyvsp = yyval;
4556
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004557 /* Now `shift' the result of the reduction. Determine what state
4558 that goes to, based on the state we popped back to and the rule
4559 number reduced by. */
4560
4561 yyn = yyr1[yyn];
4562
4563 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
4564 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
4565 yystate = yytable[yystate];
4566 else
4567 yystate = yydefgoto[yyn - YYNTOKENS];
4568
4569 goto yynewstate;
4570
4571
4572/*------------------------------------.
4573| yyerrlab -- here on detecting error |
4574`------------------------------------*/
4575yyerrlab:
4576 /* If not already recovering from an error, report this error. */
4577 if (!yyerrstatus)
4578 {
4579 ++yynerrs;
4580#if ! YYERROR_VERBOSE
4581 yyerror (context, YY_("syntax error"));
4582#else
4583 {
4584 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
4585 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
4586 {
4587 YYSIZE_T yyalloc = 2 * yysize;
4588 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
4589 yyalloc = YYSTACK_ALLOC_MAXIMUM;
4590 if (yymsg != yymsgbuf)
4591 YYSTACK_FREE (yymsg);
4592 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
4593 if (yymsg)
4594 yymsg_alloc = yyalloc;
4595 else
4596 {
4597 yymsg = yymsgbuf;
4598 yymsg_alloc = sizeof yymsgbuf;
4599 }
4600 }
4601
4602 if (0 < yysize && yysize <= yymsg_alloc)
4603 {
4604 (void) yysyntax_error (yymsg, yystate, yychar);
4605 yyerror (context, yymsg);
4606 }
4607 else
4608 {
4609 yyerror (context, YY_("syntax error"));
4610 if (yysize != 0)
4611 goto yyexhaustedlab;
4612 }
4613 }
4614#endif
4615 }
4616
4617
4618
4619 if (yyerrstatus == 3)
4620 {
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004621 /* If just tried and failed to reuse lookahead token after an
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004622 error, discard it. */
4623
4624 if (yychar <= YYEOF)
4625 {
4626 /* Return failure if at end of input. */
4627 if (yychar == YYEOF)
4628 YYABORT;
4629 }
4630 else
4631 {
4632 yydestruct ("Error: discarding",
4633 yytoken, &yylval, context);
4634 yychar = YYEMPTY;
4635 }
4636 }
4637
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004638 /* Else will try to reuse lookahead token after shifting the error
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004639 token. */
4640 goto yyerrlab1;
4641
4642
4643/*---------------------------------------------------.
4644| yyerrorlab -- error raised explicitly by YYERROR. |
4645`---------------------------------------------------*/
4646yyerrorlab:
4647
4648 /* Pacify compilers like GCC when the user code never invokes
4649 YYERROR and the label yyerrorlab therefore never appears in user
4650 code. */
4651 if (/*CONSTCOND*/ 0)
4652 goto yyerrorlab;
4653
4654 /* Do not reclaim the symbols of the rule which action triggered
4655 this YYERROR. */
4656 YYPOPSTACK (yylen);
4657 yylen = 0;
4658 YY_STACK_PRINT (yyss, yyssp);
4659 yystate = *yyssp;
4660 goto yyerrlab1;
4661
4662
4663/*-------------------------------------------------------------.
4664| yyerrlab1 -- common code for both syntax error and YYERROR. |
4665`-------------------------------------------------------------*/
4666yyerrlab1:
4667 yyerrstatus = 3; /* Each real token shifted decrements this. */
4668
4669 for (;;)
4670 {
4671 yyn = yypact[yystate];
4672 if (yyn != YYPACT_NINF)
4673 {
4674 yyn += YYTERROR;
4675 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
4676 {
4677 yyn = yytable[yyn];
4678 if (0 < yyn)
4679 break;
4680 }
4681 }
4682
4683 /* Pop the current state because it cannot handle the error token. */
4684 if (yyssp == yyss)
4685 YYABORT;
4686
4687
4688 yydestruct ("Error: popping",
4689 yystos[yystate], yyvsp, context);
4690 YYPOPSTACK (1);
4691 yystate = *yyssp;
4692 YY_STACK_PRINT (yyss, yyssp);
4693 }
4694
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004695 *++yyvsp = yylval;
4696
4697
4698 /* Shift the error token. */
4699 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
4700
4701 yystate = yyn;
4702 goto yynewstate;
4703
4704
4705/*-------------------------------------.
4706| yyacceptlab -- YYACCEPT comes here. |
4707`-------------------------------------*/
4708yyacceptlab:
4709 yyresult = 0;
4710 goto yyreturn;
4711
4712/*-----------------------------------.
4713| yyabortlab -- YYABORT comes here. |
4714`-----------------------------------*/
4715yyabortlab:
4716 yyresult = 1;
4717 goto yyreturn;
4718
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004719#if !defined(yyoverflow) || YYERROR_VERBOSE
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004720/*-------------------------------------------------.
4721| yyexhaustedlab -- memory exhaustion comes here. |
4722`-------------------------------------------------*/
4723yyexhaustedlab:
4724 yyerror (context, YY_("memory exhausted"));
4725 yyresult = 2;
4726 /* Fall through. */
4727#endif
4728
4729yyreturn:
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004730 if (yychar != YYEMPTY)
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004731 yydestruct ("Cleanup: discarding lookahead",
4732 yytoken, &yylval, context);
4733 /* Do not reclaim the symbols of the rule which action triggered
4734 this YYABORT or YYACCEPT. */
4735 YYPOPSTACK (yylen);
4736 YY_STACK_PRINT (yyss, yyssp);
4737 while (yyssp != yyss)
4738 {
4739 yydestruct ("Cleanup: popping",
4740 yystos[*yyssp], yyvsp, context);
4741 YYPOPSTACK (1);
4742 }
4743#ifndef yyoverflow
4744 if (yyss != yyssa)
4745 YYSTACK_FREE (yyss);
4746#endif
4747#if YYERROR_VERBOSE
4748 if (yymsg != yymsgbuf)
4749 YYSTACK_FREE (yymsg);
4750#endif
4751 /* Make sure YYID is used. */
4752 return YYID (yyresult);
4753}
4754
4755
4756
4757
4758
4759int glslang_parse(TParseContext* context) {
4760 return yyparse(context);
4761}
shannon.woods%transgaming.com@gtempaccount.comcbb6b6a2013-04-13 03:27:47 +00004762