blob: 30d16275ec0d041754b11464a2bf1b93f60cb925 [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.comd25a6b32013-02-28 23:19:13 +0000670 953, 961, 988, 993, 1003, 1041, 1044, 1051, 1059, 1080,
671 1101, 1112, 1141, 1146, 1156, 1161, 1171, 1174, 1177, 1180,
672 1186, 1193, 1196, 1218, 1236, 1260, 1283, 1287, 1305, 1313,
673 1345, 1365, 1454, 1463, 1486, 1489, 1495, 1503, 1511, 1519,
674 1529, 1536, 1539, 1542, 1548, 1551, 1566, 1570, 1574, 1578,
675 1587, 1592, 1597, 1602, 1607, 1612, 1617, 1622, 1627, 1632,
676 1638, 1644, 1650, 1655, 1660, 1669, 1678, 1683, 1696, 1696,
677 1710, 1710, 1719, 1722, 1737, 1773, 1777, 1783, 1791, 1807,
678 1811, 1815, 1816, 1822, 1823, 1824, 1825, 1826, 1830, 1831,
679 1831, 1831, 1841, 1842, 1846, 1846, 1847, 1847, 1852, 1855,
680 1865, 1868, 1874, 1875, 1879, 1887, 1891, 1901, 1906, 1923,
681 1923, 1928, 1928, 1935, 1935, 1943, 1946, 1952, 1955, 1961,
682 1965, 1972, 1979, 1986, 1993, 2004, 2013, 2017, 2024, 2027,
683 2033, 2033
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
2174 (yyval.interm.intermTypedNode) = context->addConstArrayNode((yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2175 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector()) { // constant folding for vectors
2176 TVectorFields fields;
2177 fields.num = 1;
2178 fields.offsets[0] = (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(); // need to do it this way because v.xy sends fields integer array
2179 (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
2181 (yyval.interm.intermTypedNode) = context->addConstMatrixNode((yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2182 }
2183 } else {
2184 if ((yyvsp[(3) - (4)].interm.intermTypedNode)->getQualifier() == EvqConst) {
2185 if (((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector() || (yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix()) && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getNominalSize() <= (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() ) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00002186 std::stringstream extraInfoStream;
2187 extraInfoStream << "field selection out of range '" << (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst() << "'";
2188 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) {
2194 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getMaxArraySize() <= (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst()) {
2195 if (context->arraySetMaxSize((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getTypePointer(), (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), true, (yyvsp[(2) - (4)].lex).line))
2196 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 }
2201 } else if ( (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst() >= (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize()) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00002202 std::stringstream extraInfoStream;
2203 extraInfoStream << "array index out of range '" << (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst() << "'";
2204 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.comd25a6b32013-02-28 23:19:13 +00003091 if (!context->symbolTable.setDefaultPrecision( (yyvsp[(3) - (4)].interm.type), (yyvsp[(2) - (4)].interm.precision) )) {
3092 context->error((yyvsp[(1) - (4)].lex).line, "illegal type argument for default precision qualifier", getBasicString((yyvsp[(3) - (4)].interm.type).type));
3093 context->recover();
3094 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003095 (yyval.interm.intermNode) = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003096 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003097 break;
3098
3099 case 74:
3100
3101 {
3102 //
3103 // Multiple declarations of the same function are allowed.
3104 //
3105 // If this is a definition, the definition production code will check for redefinitions
3106 // (we don't know at this point if it's a definition or not).
3107 //
3108 // Redeclarations are allowed. But, return types and parameter qualifiers must match.
3109 //
3110 TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find((yyvsp[(1) - (2)].interm.function)->getMangledName()));
3111 if (prevDec) {
3112 if (prevDec->getReturnType() != (yyvsp[(1) - (2)].interm.function)->getReturnType()) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003113 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 +00003114 context->recover();
3115 }
shannon.woods@transgaming.comd64b3da2013-02-28 23:19:26 +00003116 for (size_t i = 0; i < prevDec->getParamCount(); ++i) {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003117 if (prevDec->getParam(i).type->getQualifier() != (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifier()) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003118 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 +00003119 context->recover();
3120 }
3121 }
3122 }
3123
3124 //
3125 // If this is a redeclaration, it could also be a definition,
3126 // in which case, we want to use the variable names from this one, and not the one that's
3127 // being redeclared. So, pass back up this declaration, not the one in the symbol table.
3128 //
3129 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
3130 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
3131
daniel@transgaming.com5dd6d092012-03-20 20:10:28 +00003132 // We're at the inner scope level of the function's arguments and body statement.
3133 // Add the function prototype to the surrounding scope instead.
3134 context->symbolTable.getOuterLevel()->insert(*(yyval.interm).function);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003135 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003136 break;
3137
3138 case 75:
3139
3140 {
3141 (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003142 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003143 break;
3144
3145 case 76:
3146
3147 {
3148 (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003149 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003150 break;
3151
3152 case 77:
3153
3154 {
3155 // Add the parameter
3156 (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
3157 if ((yyvsp[(2) - (2)].interm).param.type->getBasicType() != EbtVoid)
3158 (yyvsp[(1) - (2)].interm.function)->addParameter((yyvsp[(2) - (2)].interm).param);
3159 else
3160 delete (yyvsp[(2) - (2)].interm).param.type;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003161 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003162 break;
3163
3164 case 78:
3165
3166 {
3167 //
3168 // Only first parameter of one-parameter functions can be void
3169 // The check for named parameters not being void is done in parameter_declarator
3170 //
3171 if ((yyvsp[(3) - (3)].interm).param.type->getBasicType() == EbtVoid) {
3172 //
3173 // This parameter > first is void
3174 //
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003175 context->error((yyvsp[(2) - (3)].lex).line, "cannot be an argument type except for '(void)'", "void");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003176 context->recover();
3177 delete (yyvsp[(3) - (3)].interm).param.type;
3178 } else {
3179 // Add the parameter
3180 (yyval.interm.function) = (yyvsp[(1) - (3)].interm.function);
3181 (yyvsp[(1) - (3)].interm.function)->addParameter((yyvsp[(3) - (3)].interm).param);
3182 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003183 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003184 break;
3185
3186 case 79:
3187
3188 {
3189 if ((yyvsp[(1) - (3)].interm.type).qualifier != EvqGlobal && (yyvsp[(1) - (3)].interm.type).qualifier != EvqTemporary) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003190 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 +00003191 context->recover();
3192 }
3193 // make sure a sampler is not involved as well...
3194 if (context->structQualifierErrorCheck((yyvsp[(2) - (3)].lex).line, (yyvsp[(1) - (3)].interm.type)))
3195 context->recover();
3196
3197 // Add the function as a prototype after parsing it (we do not support recursion)
3198 TFunction *function;
3199 TType type((yyvsp[(1) - (3)].interm.type));
3200 function = new TFunction((yyvsp[(2) - (3)].lex).string, type);
3201 (yyval.interm.function) = function;
daniel@transgaming.com5dd6d092012-03-20 20:10:28 +00003202
3203 context->symbolTable.push();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003204 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003205 break;
3206
3207 case 80:
3208
3209 {
3210 if ((yyvsp[(1) - (2)].interm.type).type == EbtVoid) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003211 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 +00003212 context->recover();
3213 }
3214 if (context->reservedErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string))
3215 context->recover();
3216 TParameter param = {(yyvsp[(2) - (2)].lex).string, new TType((yyvsp[(1) - (2)].interm.type))};
3217 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
3218 (yyval.interm).param = param;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003219 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003220 break;
3221
3222 case 81:
3223
3224 {
3225 // Check that we can make an array out of this type
3226 if (context->arrayTypeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
3227 context->recover();
3228
3229 if (context->reservedErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string))
3230 context->recover();
3231
3232 int size;
3233 if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3234 context->recover();
3235 (yyvsp[(1) - (5)].interm.type).setArray(true, size);
3236
3237 TType* type = new TType((yyvsp[(1) - (5)].interm.type));
3238 TParameter param = { (yyvsp[(2) - (5)].lex).string, type };
3239 (yyval.interm).line = (yyvsp[(2) - (5)].lex).line;
3240 (yyval.interm).param = param;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003241 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003242 break;
3243
3244 case 82:
3245
3246 {
3247 (yyval.interm) = (yyvsp[(3) - (3)].interm);
3248 if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
3249 context->recover();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003250 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003251 break;
3252
3253 case 83:
3254
3255 {
3256 (yyval.interm) = (yyvsp[(2) - (2)].interm);
3257 if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
3258 context->recover();
3259 if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
3260 context->recover();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003261 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003262 break;
3263
3264 case 84:
3265
3266 {
3267 (yyval.interm) = (yyvsp[(3) - (3)].interm);
3268 if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
3269 context->recover();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003270 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003271 break;
3272
3273 case 85:
3274
3275 {
3276 (yyval.interm) = (yyvsp[(2) - (2)].interm);
3277 if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
3278 context->recover();
3279 if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
3280 context->recover();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003281 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003282 break;
3283
3284 case 86:
3285
3286 {
3287 (yyval.interm.qualifier) = EvqIn;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003288 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003289 break;
3290
3291 case 87:
3292
3293 {
3294 (yyval.interm.qualifier) = EvqIn;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003295 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003296 break;
3297
3298 case 88:
3299
3300 {
3301 (yyval.interm.qualifier) = EvqOut;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003302 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003303 break;
3304
3305 case 89:
3306
3307 {
3308 (yyval.interm.qualifier) = EvqInOut;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003309 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003310 break;
3311
3312 case 90:
3313
3314 {
3315 TParameter param = { 0, new TType((yyvsp[(1) - (1)].interm.type)) };
3316 (yyval.interm).param = param;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003317 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003318 break;
3319
3320 case 91:
3321
3322 {
3323 (yyval.interm) = (yyvsp[(1) - (1)].interm);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003324 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003325 break;
3326
3327 case 92:
3328
3329 {
daniel@transgaming.comeec8efc2012-03-09 21:57:49 +00003330 if ((yyvsp[(1) - (3)].interm).type.type == EbtInvariant && !(yyvsp[(3) - (3)].lex).symbol)
3331 {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003332 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 +00003333 context->recover();
3334 }
3335
zmo@google.comfd747b82011-04-23 01:30:07 +00003336 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(3) - (3)].lex).string, TType((yyvsp[(1) - (3)].interm).type), (yyvsp[(3) - (3)].lex).line);
3337 (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 +00003338
3339 if (context->structQualifierErrorCheck((yyvsp[(3) - (3)].lex).line, (yyval.interm).type))
3340 context->recover();
3341
daniel@transgaming.com8abd0b72012-09-27 17:46:07 +00003342 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 +00003343 context->recover();
3344
zmo@google.comfd747b82011-04-23 01:30:07 +00003345 TVariable* variable = 0;
3346 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 +00003347 context->recover();
zmo@google.comfd747b82011-04-23 01:30:07 +00003348 if (symbol && variable)
3349 symbol->setId(variable->getUniqueId());
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003350 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003351 break;
3352
3353 case 93:
3354
3355 {
3356 if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
3357 context->recover();
3358
daniel@transgaming.com8abd0b72012-09-27 17:46:07 +00003359 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 +00003360 context->recover();
3361
3362 (yyval.interm) = (yyvsp[(1) - (5)].interm);
3363
3364 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))
3365 context->recover();
3366 else {
3367 (yyvsp[(1) - (5)].interm).type.setArray(true);
3368 TVariable* variable;
3369 if (context->arrayErrorCheck((yyvsp[(4) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, variable))
3370 context->recover();
3371 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003372 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003373 break;
3374
3375 case 94:
3376
3377 {
3378 if (context->structQualifierErrorCheck((yyvsp[(3) - (6)].lex).line, (yyvsp[(1) - (6)].interm).type))
3379 context->recover();
3380
daniel@transgaming.com8abd0b72012-09-27 17:46:07 +00003381 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 +00003382 context->recover();
3383
3384 (yyval.interm) = (yyvsp[(1) - (6)].interm);
3385
3386 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))
3387 context->recover();
3388 else {
3389 int size;
3390 if (context->arraySizeErrorCheck((yyvsp[(4) - (6)].lex).line, (yyvsp[(5) - (6)].interm.intermTypedNode), size))
3391 context->recover();
3392 (yyvsp[(1) - (6)].interm).type.setArray(true, size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003393 TVariable* variable = 0;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003394 if (context->arrayErrorCheck((yyvsp[(4) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type, variable))
3395 context->recover();
3396 TType type = TType((yyvsp[(1) - (6)].interm).type);
3397 type.setArraySize(size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003398 (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 +00003399 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003400 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003401 break;
3402
3403 case 95:
3404
3405 {
3406 if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
3407 context->recover();
3408
3409 (yyval.interm) = (yyvsp[(1) - (5)].interm);
3410
3411 TIntermNode* intermNode;
3412 if (!context->executeInitializer((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, (yyvsp[(5) - (5)].interm.intermTypedNode), intermNode)) {
3413 //
3414 // build the intermediate representation
3415 //
3416 if (intermNode)
3417 (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (5)].interm).intermNode, intermNode, (yyvsp[(4) - (5)].lex).line);
3418 else
3419 (yyval.interm).intermAggregate = (yyvsp[(1) - (5)].interm).intermAggregate;
3420 } else {
3421 context->recover();
3422 (yyval.interm).intermAggregate = 0;
3423 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003424 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003425 break;
3426
3427 case 96:
3428
3429 {
3430 (yyval.interm).type = (yyvsp[(1) - (1)].interm.type);
3431 (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 +00003432 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003433 break;
3434
3435 case 97:
3436
3437 {
zmo@google.comfd747b82011-04-23 01:30:07 +00003438 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyvsp[(1) - (2)].interm.type)), (yyvsp[(2) - (2)].lex).line);
3439 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (2)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003440
3441 if (context->structQualifierErrorCheck((yyvsp[(2) - (2)].lex).line, (yyval.interm).type))
3442 context->recover();
3443
daniel@transgaming.com8abd0b72012-09-27 17:46:07 +00003444 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 +00003445 context->recover();
3446
3447 (yyval.interm).type = (yyvsp[(1) - (2)].interm.type);
3448
zmo@google.comfd747b82011-04-23 01:30:07 +00003449 TVariable* variable = 0;
3450 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 +00003451 context->recover();
zmo@google.comfd747b82011-04-23 01:30:07 +00003452 if (variable && symbol)
3453 symbol->setId(variable->getUniqueId());
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003454 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003455 break;
3456
3457 case 98:
3458
3459 {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003460 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 +00003461 context->recover();
3462
zmo@google.comfd747b82011-04-23 01:30:07 +00003463 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (4)].lex).string, TType((yyvsp[(1) - (4)].interm.type)), (yyvsp[(2) - (4)].lex).line);
3464 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (4)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003465 (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003466 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003467 break;
3468
3469 case 99:
3470
3471 {
3472 TType type = TType((yyvsp[(1) - (5)].interm.type));
3473 int size;
3474 if (context->arraySizeErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3475 context->recover();
3476 type.setArraySize(size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003477 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (5)].lex).string, type, (yyvsp[(2) - (5)].lex).line);
3478 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (5)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003479
3480 if (context->structQualifierErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
3481 context->recover();
3482
daniel@transgaming.com8abd0b72012-09-27 17:46:07 +00003483 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 +00003484 context->recover();
3485
3486 (yyval.interm).type = (yyvsp[(1) - (5)].interm.type);
3487
3488 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)))
3489 context->recover();
3490 else {
3491 int size;
3492 if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3493 context->recover();
3494
3495 (yyvsp[(1) - (5)].interm.type).setArray(true, size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003496 TVariable* variable = 0;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003497 if (context->arrayErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type), variable))
3498 context->recover();
zmo@google.comfd747b82011-04-23 01:30:07 +00003499 if (variable && symbol)
3500 symbol->setId(variable->getUniqueId());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003501 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003502 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003503 break;
3504
3505 case 100:
3506
3507 {
3508 if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
3509 context->recover();
3510
3511 (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
3512
3513 TIntermNode* intermNode;
3514 if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode)) {
3515 //
3516 // Build intermediate representation
3517 //
3518 if(intermNode)
3519 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(intermNode, (yyvsp[(3) - (4)].lex).line);
3520 else
3521 (yyval.interm).intermAggregate = 0;
3522 } else {
3523 context->recover();
3524 (yyval.interm).intermAggregate = 0;
3525 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003526 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003527 break;
3528
3529 case 101:
3530
3531 {
3532 VERTEX_ONLY("invariant declaration", (yyvsp[(1) - (2)].lex).line);
daniel@transgaming.comeec8efc2012-03-09 21:57:49 +00003533 if (context->globalErrorCheck((yyvsp[(1) - (2)].lex).line, context->symbolTable.atGlobalLevel(), "invariant varying"))
3534 context->recover();
3535 (yyval.interm).type.setBasic(EbtInvariant, EvqInvariantVaryingOut, (yyvsp[(2) - (2)].lex).line);
3536 if (!(yyvsp[(2) - (2)].lex).symbol)
3537 {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003538 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 +00003539 context->recover();
3540
3541 (yyval.interm).intermAggregate = 0;
3542 }
3543 else
3544 {
3545 TIntermSymbol *symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyval.interm).type), (yyvsp[(2) - (2)].lex).line);
3546 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (2)].lex).line);
3547 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003548 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003549 break;
3550
3551 case 102:
3552
3553 {
3554 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3555
3556 if ((yyvsp[(1) - (1)].interm.type).array) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003557 context->error((yyvsp[(1) - (1)].interm.type).line, "not supported", "first-class array");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003558 context->recover();
3559 (yyvsp[(1) - (1)].interm.type).setArray(false);
3560 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003561 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003562 break;
3563
3564 case 103:
3565
3566 {
3567 if ((yyvsp[(2) - (2)].interm.type).array) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003568 context->error((yyvsp[(2) - (2)].interm.type).line, "not supported", "first-class array");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003569 context->recover();
3570 (yyvsp[(2) - (2)].interm.type).setArray(false);
3571 }
3572
3573 if ((yyvsp[(1) - (2)].interm.type).qualifier == EvqAttribute &&
3574 ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003575 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 +00003576 context->recover();
3577 }
3578 if (((yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingIn || (yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingOut) &&
3579 ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003580 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 +00003581 context->recover();
3582 }
3583 (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
3584 (yyval.interm.type).qualifier = (yyvsp[(1) - (2)].interm.type).qualifier;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003585 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003586 break;
3587
3588 case 104:
3589
3590 {
3591 (yyval.interm.type).setBasic(EbtVoid, EvqConst, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003592 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003593 break;
3594
3595 case 105:
3596
3597 {
3598 VERTEX_ONLY("attribute", (yyvsp[(1) - (1)].lex).line);
3599 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "attribute"))
3600 context->recover();
3601 (yyval.interm.type).setBasic(EbtVoid, EvqAttribute, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003602 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003603 break;
3604
3605 case 106:
3606
3607 {
3608 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "varying"))
3609 context->recover();
3610 if (context->shaderType == SH_VERTEX_SHADER)
3611 (yyval.interm.type).setBasic(EbtVoid, EvqVaryingOut, (yyvsp[(1) - (1)].lex).line);
3612 else
3613 (yyval.interm.type).setBasic(EbtVoid, EvqVaryingIn, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003614 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003615 break;
3616
3617 case 107:
3618
3619 {
3620 if (context->globalErrorCheck((yyvsp[(1) - (2)].lex).line, context->symbolTable.atGlobalLevel(), "invariant varying"))
3621 context->recover();
3622 if (context->shaderType == SH_VERTEX_SHADER)
3623 (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingOut, (yyvsp[(1) - (2)].lex).line);
3624 else
3625 (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingIn, (yyvsp[(1) - (2)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003626 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003627 break;
3628
3629 case 108:
3630
3631 {
3632 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "uniform"))
3633 context->recover();
3634 (yyval.interm.type).setBasic(EbtVoid, EvqUniform, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003635 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003636 break;
3637
3638 case 109:
3639
3640 {
3641 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
zmo@google.comdc4b4f82011-06-17 00:42:53 +00003642
3643 if ((yyval.interm.type).precision == EbpUndefined) {
3644 (yyval.interm.type).precision = context->symbolTable.getDefaultPrecision((yyvsp[(1) - (1)].interm.type).type);
3645 if (context->precisionErrorCheck((yyvsp[(1) - (1)].interm.type).line, (yyval.interm.type).precision, (yyvsp[(1) - (1)].interm.type).type)) {
3646 context->recover();
3647 }
3648 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003649 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003650 break;
3651
3652 case 110:
3653
3654 {
3655 (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
3656 (yyval.interm.type).precision = (yyvsp[(1) - (2)].interm.precision);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003657 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003658 break;
3659
3660 case 111:
3661
3662 {
3663 (yyval.interm.precision) = EbpHigh;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003664 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003665 break;
3666
3667 case 112:
3668
3669 {
3670 (yyval.interm.precision) = EbpMedium;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003671 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003672 break;
3673
3674 case 113:
3675
3676 {
3677 (yyval.interm.precision) = EbpLow;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003678 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003679 break;
3680
3681 case 114:
3682
3683 {
3684 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003685 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003686 break;
3687
3688 case 115:
3689
3690 {
3691 (yyval.interm.type) = (yyvsp[(1) - (4)].interm.type);
3692
3693 if (context->arrayTypeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
3694 context->recover();
3695 else {
3696 int size;
3697 if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
3698 context->recover();
3699 (yyval.interm.type).setArray(true, size);
3700 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003701 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003702 break;
3703
3704 case 116:
3705
3706 {
3707 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3708 (yyval.interm.type).setBasic(EbtVoid, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003709 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003710 break;
3711
3712 case 117:
3713
3714 {
3715 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3716 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003717 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003718 break;
3719
3720 case 118:
3721
3722 {
3723 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3724 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003725 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003726 break;
3727
3728 case 119:
3729
3730 {
3731 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3732 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003733 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003734 break;
3735
3736 case 120:
3737
3738 {
3739 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3740 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3741 (yyval.interm.type).setAggregate(2);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003742 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003743 break;
3744
3745 case 121:
3746
3747 {
3748 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3749 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3750 (yyval.interm.type).setAggregate(3);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003751 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003752 break;
3753
3754 case 122:
3755
3756 {
3757 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3758 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3759 (yyval.interm.type).setAggregate(4);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003760 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003761 break;
3762
3763 case 123:
3764
3765 {
3766 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3767 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3768 (yyval.interm.type).setAggregate(2);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003769 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003770 break;
3771
3772 case 124:
3773
3774 {
3775 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3776 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3777 (yyval.interm.type).setAggregate(3);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003778 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003779 break;
3780
3781 case 125:
3782
3783 {
3784 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3785 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3786 (yyval.interm.type).setAggregate(4);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003787 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003788 break;
3789
3790 case 126:
3791
3792 {
3793 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3794 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3795 (yyval.interm.type).setAggregate(2);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003796 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003797 break;
3798
3799 case 127:
3800
3801 {
3802 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3803 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3804 (yyval.interm.type).setAggregate(3);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003805 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003806 break;
3807
3808 case 128:
3809
3810 {
3811 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3812 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3813 (yyval.interm.type).setAggregate(4);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003814 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003815 break;
3816
3817 case 129:
3818
3819 {
3820 FRAG_VERT_ONLY("mat2", (yyvsp[(1) - (1)].lex).line);
3821 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3822 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3823 (yyval.interm.type).setAggregate(2, true);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003824 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003825 break;
3826
3827 case 130:
3828
3829 {
3830 FRAG_VERT_ONLY("mat3", (yyvsp[(1) - (1)].lex).line);
3831 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3832 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3833 (yyval.interm.type).setAggregate(3, true);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003834 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003835 break;
3836
3837 case 131:
3838
3839 {
3840 FRAG_VERT_ONLY("mat4", (yyvsp[(1) - (1)].lex).line);
3841 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3842 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3843 (yyval.interm.type).setAggregate(4, true);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003844 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003845 break;
3846
3847 case 132:
3848
3849 {
3850 FRAG_VERT_ONLY("sampler2D", (yyvsp[(1) - (1)].lex).line);
3851 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3852 (yyval.interm.type).setBasic(EbtSampler2D, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003853 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003854 break;
3855
3856 case 133:
3857
3858 {
3859 FRAG_VERT_ONLY("samplerCube", (yyvsp[(1) - (1)].lex).line);
3860 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3861 (yyval.interm.type).setBasic(EbtSamplerCube, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003862 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003863 break;
3864
3865 case 134:
3866
3867 {
zmo@google.com09c323a2011-08-12 18:22:25 +00003868 if (!context->supportsExtension("GL_OES_EGL_image_external")) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003869 context->error((yyvsp[(1) - (1)].lex).line, "unsupported type", "samplerExternalOES");
zmo@google.com09c323a2011-08-12 18:22:25 +00003870 context->recover();
3871 }
3872 FRAG_VERT_ONLY("samplerExternalOES", (yyvsp[(1) - (1)].lex).line);
3873 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3874 (yyval.interm.type).setBasic(EbtSamplerExternalOES, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003875 }
zmo@google.com09c323a2011-08-12 18:22:25 +00003876 break;
3877
3878 case 135:
3879
3880 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00003881 if (!context->supportsExtension("GL_ARB_texture_rectangle")) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003882 context->error((yyvsp[(1) - (1)].lex).line, "unsupported type", "sampler2DRect");
kbr@chromium.org205fef32011-11-22 20:50:02 +00003883 context->recover();
3884 }
3885 FRAG_VERT_ONLY("sampler2DRect", (yyvsp[(1) - (1)].lex).line);
3886 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3887 (yyval.interm.type).setBasic(EbtSampler2DRect, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003888 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003889 break;
3890
zmo@google.com09c323a2011-08-12 18:22:25 +00003891 case 136:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003892
3893 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00003894 FRAG_VERT_ONLY("struct", (yyvsp[(1) - (1)].interm.type).line);
3895 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3896 (yyval.interm.type).qualifier = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003897 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003898 break;
3899
3900 case 137:
3901
3902 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003903 //
3904 // This is for user defined type names. The lexical phase looked up the
3905 // type.
3906 //
3907 TType& structure = static_cast<TVariable*>((yyvsp[(1) - (1)].lex).symbol)->getType();
3908 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3909 (yyval.interm.type).setBasic(EbtStruct, qual, (yyvsp[(1) - (1)].lex).line);
3910 (yyval.interm.type).userDef = &structure;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003911 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003912 break;
3913
zmo@google.com09c323a2011-08-12 18:22:25 +00003914 case 138:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003915
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003916 { if (context->enterStructDeclaration((yyvsp[(2) - (3)].lex).line, *(yyvsp[(2) - (3)].lex).string)) context->recover(); }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003917 break;
3918
3919 case 139:
3920
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003921 {
kbr@chromium.org476541f2011-10-27 21:14:51 +00003922 if (context->reservedErrorCheck((yyvsp[(2) - (6)].lex).line, *(yyvsp[(2) - (6)].lex).string))
3923 context->recover();
3924
3925 TType* structure = new TType((yyvsp[(5) - (6)].interm.typeList), *(yyvsp[(2) - (6)].lex).string);
3926 TVariable* userTypeDef = new TVariable((yyvsp[(2) - (6)].lex).string, *structure, true);
3927 if (! context->symbolTable.insert(*userTypeDef)) {
3928 context->error((yyvsp[(2) - (6)].lex).line, "redefinition", (yyvsp[(2) - (6)].lex).string->c_str(), "struct");
3929 context->recover();
3930 }
3931 (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (6)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003932 (yyval.interm.type).userDef = structure;
kbr@chromium.org476541f2011-10-27 21:14:51 +00003933 context->exitStructDeclaration();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003934 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00003935 break;
3936
3937 case 140:
3938
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003939 { if (context->enterStructDeclaration((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string)) context->recover(); }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003940 break;
3941
3942 case 141:
3943
kbr@chromium.org476541f2011-10-27 21:14:51 +00003944 {
3945 TType* structure = new TType((yyvsp[(4) - (5)].interm.typeList), TString(""));
3946 (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (5)].lex).line);
3947 (yyval.interm.type).userDef = structure;
3948 context->exitStructDeclaration();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003949 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003950 break;
3951
kbr@chromium.org476541f2011-10-27 21:14:51 +00003952 case 142:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003953
3954 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00003955 (yyval.interm.typeList) = (yyvsp[(1) - (1)].interm.typeList);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003956 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003957 break;
3958
3959 case 143:
3960
3961 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003962 (yyval.interm.typeList) = (yyvsp[(1) - (2)].interm.typeList);
3963 for (unsigned int i = 0; i < (yyvsp[(2) - (2)].interm.typeList)->size(); ++i) {
3964 for (unsigned int j = 0; j < (yyval.interm.typeList)->size(); ++j) {
3965 if ((*(yyval.interm.typeList))[j].type->getFieldName() == (*(yyvsp[(2) - (2)].interm.typeList))[i].type->getFieldName()) {
3966 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());
3967 context->recover();
3968 }
3969 }
3970 (yyval.interm.typeList)->push_back((*(yyvsp[(2) - (2)].interm.typeList))[i]);
3971 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003972 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003973 break;
3974
kbr@chromium.org205fef32011-11-22 20:50:02 +00003975 case 144:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003976
3977 {
3978 (yyval.interm.typeList) = (yyvsp[(2) - (3)].interm.typeList);
3979
3980 if (context->voidErrorCheck((yyvsp[(1) - (3)].interm.type).line, (*(yyvsp[(2) - (3)].interm.typeList))[0].type->getFieldName(), (yyvsp[(1) - (3)].interm.type))) {
3981 context->recover();
3982 }
3983 for (unsigned int i = 0; i < (yyval.interm.typeList)->size(); ++i) {
3984 //
3985 // Careful not to replace already known aspects of type, like array-ness
3986 //
3987 TType* type = (*(yyval.interm.typeList))[i].type;
3988 type->setBasicType((yyvsp[(1) - (3)].interm.type).type);
3989 type->setNominalSize((yyvsp[(1) - (3)].interm.type).size);
3990 type->setMatrix((yyvsp[(1) - (3)].interm.type).matrix);
zmo@google.comdc4b4f82011-06-17 00:42:53 +00003991 type->setPrecision((yyvsp[(1) - (3)].interm.type).precision);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003992
3993 // don't allow arrays of arrays
3994 if (type->isArray()) {
3995 if (context->arrayTypeErrorCheck((yyvsp[(1) - (3)].interm.type).line, (yyvsp[(1) - (3)].interm.type)))
3996 context->recover();
3997 }
3998 if ((yyvsp[(1) - (3)].interm.type).array)
3999 type->setArraySize((yyvsp[(1) - (3)].interm.type).arraySize);
4000 if ((yyvsp[(1) - (3)].interm.type).userDef) {
4001 type->setStruct((yyvsp[(1) - (3)].interm.type).userDef->getStruct());
4002 type->setTypeName((yyvsp[(1) - (3)].interm.type).userDef->getTypeName());
4003 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004004
4005 if (context->structNestingErrorCheck((yyvsp[(1) - (3)].interm.type).line, *type)) {
4006 context->recover();
4007 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004008 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004009 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004010 break;
4011
kbr@chromium.org476541f2011-10-27 21:14:51 +00004012 case 145:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004013
4014 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004015 (yyval.interm.typeList) = NewPoolTTypeList();
4016 (yyval.interm.typeList)->push_back((yyvsp[(1) - (1)].interm.typeLine));
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004017 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004018 break;
4019
kbr@chromium.org476541f2011-10-27 21:14:51 +00004020 case 146:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004021
4022 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004023 (yyval.interm.typeList)->push_back((yyvsp[(3) - (3)].interm.typeLine));
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004024 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004025 break;
4026
4027 case 147:
4028
4029 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004030 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
4031 context->recover();
4032
4033 (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
4034 (yyval.interm.typeLine).line = (yyvsp[(1) - (1)].lex).line;
4035 (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (1)].lex).string);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004036 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004037 break;
4038
kbr@chromium.org205fef32011-11-22 20:50:02 +00004039 case 148:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004040
4041 {
4042 if (context->reservedErrorCheck((yyvsp[(1) - (4)].lex).line, *(yyvsp[(1) - (4)].lex).string))
4043 context->recover();
4044
4045 (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
4046 (yyval.interm.typeLine).line = (yyvsp[(1) - (4)].lex).line;
4047 (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (4)].lex).string);
4048
4049 int size;
4050 if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
4051 context->recover();
4052 (yyval.interm.typeLine).type->setArraySize(size);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004053 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004054 break;
4055
4056 case 149:
4057
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004058 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004059 break;
4060
4061 case 150:
4062
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004063 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004064 break;
4065
4066 case 151:
4067
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004068 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermAggregate); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004069 break;
4070
4071 case 152:
4072
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004073 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004074 break;
4075
4076 case 153:
4077
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004078 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004079 break;
4080
4081 case 154:
4082
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004083 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004084 break;
4085
4086 case 155:
4087
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004088 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004089 break;
4090
4091 case 156:
4092
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004093 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004094 break;
4095
4096 case 157:
4097
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004098 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
zmo@google.com09c323a2011-08-12 18:22:25 +00004099 break;
4100
4101 case 158:
4102
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004103 { (yyval.interm.intermAggregate) = 0; }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004104 break;
4105
4106 case 159:
4107
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004108 { context->symbolTable.push(); }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004109 break;
4110
4111 case 160:
4112
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004113 { context->symbolTable.pop(); }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004114 break;
4115
4116 case 161:
4117
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004118 {
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004119 if ((yyvsp[(3) - (5)].interm.intermAggregate) != 0) {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004120 (yyvsp[(3) - (5)].interm.intermAggregate)->setOp(EOpSequence);
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004121 (yyvsp[(3) - (5)].interm.intermAggregate)->setEndLine((yyvsp[(5) - (5)].lex).line);
4122 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004123 (yyval.interm.intermAggregate) = (yyvsp[(3) - (5)].interm.intermAggregate);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004124 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004125 break;
4126
4127 case 162:
4128
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004129 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004130 break;
4131
4132 case 163:
4133
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004134 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004135 break;
4136
kbr@chromium.org476541f2011-10-27 21:14:51 +00004137 case 164:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004138
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004139 { context->symbolTable.push(); }
4140 break;
4141
4142 case 165:
4143
4144 { context->symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[(2) - (2)].interm.intermNode); }
4145 break;
4146
4147 case 166:
4148
4149 { context->symbolTable.push(); }
4150 break;
4151
4152 case 167:
4153
4154 { context->symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[(2) - (2)].interm.intermNode); }
4155 break;
4156
4157 case 168:
4158
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004159 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004160 (yyval.interm.intermNode) = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004161 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004162 break;
4163
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004164 case 169:
kbr@chromium.org205fef32011-11-22 20:50:02 +00004165
4166 {
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004167 if ((yyvsp[(2) - (3)].interm.intermAggregate)) {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004168 (yyvsp[(2) - (3)].interm.intermAggregate)->setOp(EOpSequence);
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004169 (yyvsp[(2) - (3)].interm.intermAggregate)->setEndLine((yyvsp[(3) - (3)].lex).line);
4170 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004171 (yyval.interm.intermNode) = (yyvsp[(2) - (3)].interm.intermAggregate);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004172 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004173 break;
4174
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004175 case 170:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004176
4177 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004178 (yyval.interm.intermAggregate) = context->intermediate.makeAggregate((yyvsp[(1) - (1)].interm.intermNode), 0);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004179 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004180 break;
4181
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004182 case 171:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004183
kbr@chromium.org205fef32011-11-22 20:50:02 +00004184 {
4185 (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 +00004186 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004187 break;
4188
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004189 case 172:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004190
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004191 { (yyval.interm.intermNode) = 0; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004192 break;
4193
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004194 case 173:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004195
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004196 { (yyval.interm.intermNode) = static_cast<TIntermNode*>((yyvsp[(1) - (2)].interm.intermTypedNode)); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004197 break;
4198
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004199 case 174:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004200
4201 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004202 if (context->boolErrorCheck((yyvsp[(1) - (5)].lex).line, (yyvsp[(3) - (5)].interm.intermTypedNode)))
4203 context->recover();
4204 (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 +00004205 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004206 break;
4207
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004208 case 175:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004209
4210 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004211 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermNode);
4212 (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004213 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004214 break;
4215
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004216 case 176:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004217
4218 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004219 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (1)].interm.intermNode);
4220 (yyval.interm.nodePair).node2 = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004221 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004222 break;
4223
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004224 case 177:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004225
4226 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004227 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
4228 if (context->boolErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)->getLine(), (yyvsp[(1) - (1)].interm.intermTypedNode)))
4229 context->recover();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004230 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004231 break;
4232
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004233 case 178:
kbr@chromium.org205fef32011-11-22 20:50:02 +00004234
4235 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004236 TIntermNode* intermNode;
4237 if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
4238 context->recover();
4239 if (context->boolErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
4240 context->recover();
4241
4242 if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode))
4243 (yyval.interm.intermTypedNode) = (yyvsp[(4) - (4)].interm.intermTypedNode);
4244 else {
4245 context->recover();
4246 (yyval.interm.intermTypedNode) = 0;
4247 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004248 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004249 break;
4250
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004251 case 179:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004252
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004253 { context->symbolTable.push(); ++context->loopNestingLevel; }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004254 break;
4255
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004256 case 180:
kbr@chromium.org205fef32011-11-22 20:50:02 +00004257
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004258 {
4259 context->symbolTable.pop();
alokp@chromium.org52813552010-11-16 18:36:09 +00004260 (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 +00004261 --context->loopNestingLevel;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004262 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004263 break;
4264
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004265 case 181:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004266
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004267 { ++context->loopNestingLevel; }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004268 break;
4269
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004270 case 182:
kbr@chromium.org205fef32011-11-22 20:50:02 +00004271
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004272 {
4273 if (context->boolErrorCheck((yyvsp[(8) - (8)].lex).line, (yyvsp[(6) - (8)].interm.intermTypedNode)))
4274 context->recover();
4275
alokp@chromium.org52813552010-11-16 18:36:09 +00004276 (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 +00004277 --context->loopNestingLevel;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004278 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004279 break;
4280
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004281 case 183:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004282
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004283 { context->symbolTable.push(); ++context->loopNestingLevel; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004284 break;
4285
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004286 case 184:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004287
4288 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004289 context->symbolTable.pop();
4290 (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);
4291 --context->loopNestingLevel;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004292 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004293 break;
4294
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004295 case 185:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004296
4297 {
kbr@chromium.org476541f2011-10-27 21:14:51 +00004298 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004299 }
zmo@google.com09c323a2011-08-12 18:22:25 +00004300 break;
4301
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004302 case 186:
zmo@google.com09c323a2011-08-12 18:22:25 +00004303
4304 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004305 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004306 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004307 break;
4308
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004309 case 187:
kbr@chromium.org476541f2011-10-27 21:14:51 +00004310
4311 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004312 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004313 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004314 break;
4315
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004316 case 188:
kbr@chromium.org476541f2011-10-27 21:14:51 +00004317
4318 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004319 (yyval.interm.intermTypedNode) = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004320 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004321 break;
4322
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004323 case 189:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004324
4325 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004326 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (2)].interm.intermTypedNode);
4327 (yyval.interm.nodePair).node2 = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004328 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004329 break;
4330
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004331 case 190:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004332
4333 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004334 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermTypedNode);
4335 (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004336 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004337 break;
4338
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004339 case 191:
kbr@chromium.org205fef32011-11-22 20:50:02 +00004340
4341 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004342 if (context->loopNestingLevel <= 0) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00004343 context->error((yyvsp[(1) - (2)].lex).line, "continue statement only allowed in loops", "");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004344 context->recover();
4345 }
4346 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpContinue, (yyvsp[(1) - (2)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004347 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004348 break;
4349
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004350 case 192:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004351
4352 {
4353 if (context->loopNestingLevel <= 0) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00004354 context->error((yyvsp[(1) - (2)].lex).line, "break statement only allowed in loops", "");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004355 context->recover();
4356 }
4357 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpBreak, (yyvsp[(1) - (2)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004358 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004359 break;
4360
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004361 case 193:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004362
4363 {
4364 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(1) - (2)].lex).line);
4365 if (context->currentFunctionType->getBasicType() != EbtVoid) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00004366 context->error((yyvsp[(1) - (2)].lex).line, "non-void function must return a value", "return");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004367 context->recover();
4368 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004369 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004370 break;
4371
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004372 case 194:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004373
4374 {
4375 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(2) - (3)].interm.intermTypedNode), (yyvsp[(1) - (3)].lex).line);
4376 context->functionReturnsValue = true;
4377 if (context->currentFunctionType->getBasicType() == EbtVoid) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00004378 context->error((yyvsp[(1) - (3)].lex).line, "void function cannot return a value", "return");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004379 context->recover();
4380 } else if (*(context->currentFunctionType) != (yyvsp[(2) - (3)].interm.intermTypedNode)->getType()) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00004381 context->error((yyvsp[(1) - (3)].lex).line, "function return is not matching type:", "return");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004382 context->recover();
4383 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004384 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004385 break;
4386
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004387 case 195:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004388
4389 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004390 FRAG_ONLY("discard", (yyvsp[(1) - (2)].lex).line);
4391 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpKill, (yyvsp[(1) - (2)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004392 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004393 break;
4394
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004395 case 196:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004396
4397 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004398 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
zmo@google.com09c323a2011-08-12 18:22:25 +00004399 context->treeRoot = (yyval.interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004400 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004401 break;
4402
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004403 case 197:
zmo@google.com09c323a2011-08-12 18:22:25 +00004404
4405 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004406 (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermNode), (yyvsp[(2) - (2)].interm.intermNode), 0);
4407 context->treeRoot = (yyval.interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004408 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004409 break;
4410
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004411 case 198:
kbr@chromium.org476541f2011-10-27 21:14:51 +00004412
4413 {
4414 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004415 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004416 break;
4417
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004418 case 199:
kbr@chromium.org476541f2011-10-27 21:14:51 +00004419
4420 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004421 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004422 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004423 break;
4424
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004425 case 200:
kbr@chromium.org205fef32011-11-22 20:50:02 +00004426
4427 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004428 TFunction* function = (yyvsp[(1) - (1)].interm).function;
daniel@transgaming.coma8833e92012-07-11 20:37:16 +00004429
4430 const TSymbol *builtIn = context->symbolTable.findBuiltIn(function->getMangledName());
4431
4432 if (builtIn)
4433 {
4434 context->error((yyvsp[(1) - (1)].interm).line, "built-in functions cannot be redefined", function->getName().c_str());
4435 context->recover();
4436 }
4437
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004438 TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find(function->getMangledName()));
4439 //
4440 // Note: 'prevDec' could be 'function' if this is the first time we've seen function
4441 // as it would have just been put in the symbol table. Otherwise, we're looking up
4442 // an earlier occurance.
4443 //
4444 if (prevDec->isDefined()) {
4445 //
4446 // Then this function already has a body.
4447 //
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00004448 context->error((yyvsp[(1) - (1)].interm).line, "function already has a body", function->getName().c_str());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004449 context->recover();
4450 }
4451 prevDec->setDefined();
4452
4453 //
4454 // Raise error message if main function takes any parameters or return anything other than void
4455 //
4456 if (function->getName() == "main") {
4457 if (function->getParamCount() > 0) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00004458 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 +00004459 context->recover();
4460 }
4461 if (function->getReturnType().getBasicType() != EbtVoid) {
4462 context->error((yyvsp[(1) - (1)].interm).line, "", function->getReturnType().getBasicString(), "main function cannot return a value");
4463 context->recover();
4464 }
4465 }
4466
4467 //
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004468 // Remember the return type for later checking for RETURN statements.
4469 //
4470 context->currentFunctionType = &(prevDec->getReturnType());
4471 context->functionReturnsValue = false;
4472
4473 //
4474 // Insert parameters into the symbol table.
4475 // If the parameter has no name, it's not an error, just don't insert it
4476 // (could be used for unused args).
4477 //
4478 // Also, accumulate the list of parameters into the HIL, so lower level code
4479 // knows where to find parameters.
4480 //
4481 TIntermAggregate* paramNodes = new TIntermAggregate;
4482 for (int i = 0; i < function->getParamCount(); i++) {
4483 const TParameter& param = function->getParam(i);
4484 if (param.name != 0) {
4485 TVariable *variable = new TVariable(param.name, *param.type);
4486 //
4487 // Insert the parameters with name in the symbol table.
4488 //
4489 if (! context->symbolTable.insert(*variable)) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00004490 context->error((yyvsp[(1) - (1)].interm).line, "redefinition", variable->getName().c_str());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004491 context->recover();
4492 delete variable;
4493 }
4494
4495 //
4496 // Add the parameter to the HIL
4497 //
4498 paramNodes = context->intermediate.growAggregate(
4499 paramNodes,
4500 context->intermediate.addSymbol(variable->getUniqueId(),
4501 variable->getName(),
4502 variable->getType(), (yyvsp[(1) - (1)].interm).line),
4503 (yyvsp[(1) - (1)].interm).line);
4504 } else {
4505 paramNodes = context->intermediate.growAggregate(paramNodes, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (1)].interm).line), (yyvsp[(1) - (1)].interm).line);
4506 }
4507 }
4508 context->intermediate.setAggregateOperator(paramNodes, EOpParameters, (yyvsp[(1) - (1)].interm).line);
4509 (yyvsp[(1) - (1)].interm).intermAggregate = paramNodes;
4510 context->loopNestingLevel = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004511 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004512 break;
4513
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004514 case 201:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004515
4516 {
4517 //?? Check that all paths return a value if return type != void ?
4518 // May be best done as post process phase on intermediate code
4519 if (context->currentFunctionType->getBasicType() != EbtVoid && ! context->functionReturnsValue) {
4520 context->error((yyvsp[(1) - (3)].interm).line, "function does not return a value:", "", (yyvsp[(1) - (3)].interm).function->getName().c_str());
4521 context->recover();
4522 }
daniel@transgaming.com5dd6d092012-03-20 20:10:28 +00004523
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004524 (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermAggregate, (yyvsp[(3) - (3)].interm.intermNode), 0);
4525 context->intermediate.setAggregateOperator((yyval.interm.intermNode), EOpFunction, (yyvsp[(1) - (3)].interm).line);
4526 (yyval.interm.intermNode)->getAsAggregate()->setName((yyvsp[(1) - (3)].interm).function->getMangledName().c_str());
4527 (yyval.interm.intermNode)->getAsAggregate()->setType((yyvsp[(1) - (3)].interm).function->getReturnType());
4528
4529 // store the pragma information for debug and optimize and other vendor specific
4530 // information. This information can be queried from the parse tree
alokp@chromium.org8b851c62012-06-15 16:25:11 +00004531 (yyval.interm.intermNode)->getAsAggregate()->setOptimize(context->pragma().optimize);
4532 (yyval.interm.intermNode)->getAsAggregate()->setDebug(context->pragma().debug);
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004533
4534 if ((yyvsp[(3) - (3)].interm.intermNode) && (yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate())
4535 (yyval.interm.intermNode)->getAsAggregate()->setEndLine((yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate()->getEndLine());
daniel@transgaming.com5dd6d092012-03-20 20:10:28 +00004536
4537 context->symbolTable.pop();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004538 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004539 break;
4540
4541
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004542
4543 default: break;
4544 }
4545 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
4546
4547 YYPOPSTACK (yylen);
4548 yylen = 0;
4549 YY_STACK_PRINT (yyss, yyssp);
4550
4551 *++yyvsp = yyval;
4552
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004553 /* Now `shift' the result of the reduction. Determine what state
4554 that goes to, based on the state we popped back to and the rule
4555 number reduced by. */
4556
4557 yyn = yyr1[yyn];
4558
4559 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
4560 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
4561 yystate = yytable[yystate];
4562 else
4563 yystate = yydefgoto[yyn - YYNTOKENS];
4564
4565 goto yynewstate;
4566
4567
4568/*------------------------------------.
4569| yyerrlab -- here on detecting error |
4570`------------------------------------*/
4571yyerrlab:
4572 /* If not already recovering from an error, report this error. */
4573 if (!yyerrstatus)
4574 {
4575 ++yynerrs;
4576#if ! YYERROR_VERBOSE
4577 yyerror (context, YY_("syntax error"));
4578#else
4579 {
4580 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
4581 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
4582 {
4583 YYSIZE_T yyalloc = 2 * yysize;
4584 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
4585 yyalloc = YYSTACK_ALLOC_MAXIMUM;
4586 if (yymsg != yymsgbuf)
4587 YYSTACK_FREE (yymsg);
4588 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
4589 if (yymsg)
4590 yymsg_alloc = yyalloc;
4591 else
4592 {
4593 yymsg = yymsgbuf;
4594 yymsg_alloc = sizeof yymsgbuf;
4595 }
4596 }
4597
4598 if (0 < yysize && yysize <= yymsg_alloc)
4599 {
4600 (void) yysyntax_error (yymsg, yystate, yychar);
4601 yyerror (context, yymsg);
4602 }
4603 else
4604 {
4605 yyerror (context, YY_("syntax error"));
4606 if (yysize != 0)
4607 goto yyexhaustedlab;
4608 }
4609 }
4610#endif
4611 }
4612
4613
4614
4615 if (yyerrstatus == 3)
4616 {
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004617 /* If just tried and failed to reuse lookahead token after an
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004618 error, discard it. */
4619
4620 if (yychar <= YYEOF)
4621 {
4622 /* Return failure if at end of input. */
4623 if (yychar == YYEOF)
4624 YYABORT;
4625 }
4626 else
4627 {
4628 yydestruct ("Error: discarding",
4629 yytoken, &yylval, context);
4630 yychar = YYEMPTY;
4631 }
4632 }
4633
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004634 /* Else will try to reuse lookahead token after shifting the error
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004635 token. */
4636 goto yyerrlab1;
4637
4638
4639/*---------------------------------------------------.
4640| yyerrorlab -- error raised explicitly by YYERROR. |
4641`---------------------------------------------------*/
4642yyerrorlab:
4643
4644 /* Pacify compilers like GCC when the user code never invokes
4645 YYERROR and the label yyerrorlab therefore never appears in user
4646 code. */
4647 if (/*CONSTCOND*/ 0)
4648 goto yyerrorlab;
4649
4650 /* Do not reclaim the symbols of the rule which action triggered
4651 this YYERROR. */
4652 YYPOPSTACK (yylen);
4653 yylen = 0;
4654 YY_STACK_PRINT (yyss, yyssp);
4655 yystate = *yyssp;
4656 goto yyerrlab1;
4657
4658
4659/*-------------------------------------------------------------.
4660| yyerrlab1 -- common code for both syntax error and YYERROR. |
4661`-------------------------------------------------------------*/
4662yyerrlab1:
4663 yyerrstatus = 3; /* Each real token shifted decrements this. */
4664
4665 for (;;)
4666 {
4667 yyn = yypact[yystate];
4668 if (yyn != YYPACT_NINF)
4669 {
4670 yyn += YYTERROR;
4671 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
4672 {
4673 yyn = yytable[yyn];
4674 if (0 < yyn)
4675 break;
4676 }
4677 }
4678
4679 /* Pop the current state because it cannot handle the error token. */
4680 if (yyssp == yyss)
4681 YYABORT;
4682
4683
4684 yydestruct ("Error: popping",
4685 yystos[yystate], yyvsp, context);
4686 YYPOPSTACK (1);
4687 yystate = *yyssp;
4688 YY_STACK_PRINT (yyss, yyssp);
4689 }
4690
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004691 *++yyvsp = yylval;
4692
4693
4694 /* Shift the error token. */
4695 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
4696
4697 yystate = yyn;
4698 goto yynewstate;
4699
4700
4701/*-------------------------------------.
4702| yyacceptlab -- YYACCEPT comes here. |
4703`-------------------------------------*/
4704yyacceptlab:
4705 yyresult = 0;
4706 goto yyreturn;
4707
4708/*-----------------------------------.
4709| yyabortlab -- YYABORT comes here. |
4710`-----------------------------------*/
4711yyabortlab:
4712 yyresult = 1;
4713 goto yyreturn;
4714
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004715#if !defined(yyoverflow) || YYERROR_VERBOSE
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004716/*-------------------------------------------------.
4717| yyexhaustedlab -- memory exhaustion comes here. |
4718`-------------------------------------------------*/
4719yyexhaustedlab:
4720 yyerror (context, YY_("memory exhausted"));
4721 yyresult = 2;
4722 /* Fall through. */
4723#endif
4724
4725yyreturn:
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004726 if (yychar != YYEMPTY)
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004727 yydestruct ("Cleanup: discarding lookahead",
4728 yytoken, &yylval, context);
4729 /* Do not reclaim the symbols of the rule which action triggered
4730 this YYABORT or YYACCEPT. */
4731 YYPOPSTACK (yylen);
4732 YY_STACK_PRINT (yyss, yyssp);
4733 while (yyssp != yyss)
4734 {
4735 yydestruct ("Cleanup: popping",
4736 yystos[*yyssp], yyvsp, context);
4737 YYPOPSTACK (1);
4738 }
4739#ifndef yyoverflow
4740 if (yyss != yyssa)
4741 YYSTACK_FREE (yyss);
4742#endif
4743#if YYERROR_VERBOSE
4744 if (yymsg != yymsgbuf)
4745 YYSTACK_FREE (yymsg);
4746#endif
4747 /* Make sure YYID is used. */
4748 return YYID (yyresult);
4749}
4750
4751
4752
4753
4754
4755int glslang_parse(TParseContext* context) {
4756 return yyparse(context);
4757}
4758
4759