blob: 7c47ec37480bfbeef0539ea35a70121131f3d942 [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,
670 953, 961, 988, 993, 1000, 1038, 1041, 1048, 1056, 1077,
671 1098, 1109, 1138, 1143, 1153, 1158, 1168, 1171, 1174, 1177,
672 1183, 1190, 1193, 1215, 1233, 1257, 1280, 1284, 1302, 1310,
673 1342, 1362, 1451, 1460, 1483, 1486, 1492, 1500, 1508, 1516,
674 1526, 1533, 1536, 1539, 1545, 1548, 1563, 1567, 1571, 1575,
675 1584, 1589, 1594, 1599, 1604, 1609, 1614, 1619, 1624, 1629,
676 1635, 1641, 1647, 1652, 1657, 1666, 1675, 1680, 1693, 1693,
677 1707, 1707, 1716, 1719, 1734, 1770, 1774, 1780, 1788, 1804,
678 1808, 1812, 1813, 1819, 1820, 1821, 1822, 1823, 1827, 1828,
679 1828, 1828, 1838, 1839, 1843, 1843, 1844, 1844, 1849, 1852,
680 1862, 1865, 1871, 1872, 1876, 1884, 1888, 1898, 1903, 1920,
681 1920, 1925, 1925, 1932, 1932, 1940, 1943, 1949, 1952, 1958,
682 1962, 1969, 1976, 1983, 1990, 2001, 2010, 2014, 2021, 2024,
683 2030, 2030
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;
2471 for (int i = 0; i < fnCandidate->getParamCount(); ++i) {
2472 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
3057 for (int i = 0; i < function.getParamCount(); i++)
3058 {
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 {
3091 context->symbolTable.setDefaultPrecision( (yyvsp[(3) - (4)].interm.type).type, (yyvsp[(2) - (4)].interm.precision) );
3092 (yyval.interm.intermNode) = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003093 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003094 break;
3095
3096 case 74:
3097
3098 {
3099 //
3100 // Multiple declarations of the same function are allowed.
3101 //
3102 // If this is a definition, the definition production code will check for redefinitions
3103 // (we don't know at this point if it's a definition or not).
3104 //
3105 // Redeclarations are allowed. But, return types and parameter qualifiers must match.
3106 //
3107 TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find((yyvsp[(1) - (2)].interm.function)->getMangledName()));
3108 if (prevDec) {
3109 if (prevDec->getReturnType() != (yyvsp[(1) - (2)].interm.function)->getReturnType()) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003110 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 +00003111 context->recover();
3112 }
3113 for (int i = 0; i < prevDec->getParamCount(); ++i) {
3114 if (prevDec->getParam(i).type->getQualifier() != (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifier()) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003115 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 +00003116 context->recover();
3117 }
3118 }
3119 }
3120
3121 //
3122 // If this is a redeclaration, it could also be a definition,
3123 // in which case, we want to use the variable names from this one, and not the one that's
3124 // being redeclared. So, pass back up this declaration, not the one in the symbol table.
3125 //
3126 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
3127 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
3128
daniel@transgaming.com5dd6d092012-03-20 20:10:28 +00003129 // We're at the inner scope level of the function's arguments and body statement.
3130 // Add the function prototype to the surrounding scope instead.
3131 context->symbolTable.getOuterLevel()->insert(*(yyval.interm).function);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003132 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003133 break;
3134
3135 case 75:
3136
3137 {
3138 (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003139 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003140 break;
3141
3142 case 76:
3143
3144 {
3145 (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003146 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003147 break;
3148
3149 case 77:
3150
3151 {
3152 // Add the parameter
3153 (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
3154 if ((yyvsp[(2) - (2)].interm).param.type->getBasicType() != EbtVoid)
3155 (yyvsp[(1) - (2)].interm.function)->addParameter((yyvsp[(2) - (2)].interm).param);
3156 else
3157 delete (yyvsp[(2) - (2)].interm).param.type;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003158 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003159 break;
3160
3161 case 78:
3162
3163 {
3164 //
3165 // Only first parameter of one-parameter functions can be void
3166 // The check for named parameters not being void is done in parameter_declarator
3167 //
3168 if ((yyvsp[(3) - (3)].interm).param.type->getBasicType() == EbtVoid) {
3169 //
3170 // This parameter > first is void
3171 //
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003172 context->error((yyvsp[(2) - (3)].lex).line, "cannot be an argument type except for '(void)'", "void");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003173 context->recover();
3174 delete (yyvsp[(3) - (3)].interm).param.type;
3175 } else {
3176 // Add the parameter
3177 (yyval.interm.function) = (yyvsp[(1) - (3)].interm.function);
3178 (yyvsp[(1) - (3)].interm.function)->addParameter((yyvsp[(3) - (3)].interm).param);
3179 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003180 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003181 break;
3182
3183 case 79:
3184
3185 {
3186 if ((yyvsp[(1) - (3)].interm.type).qualifier != EvqGlobal && (yyvsp[(1) - (3)].interm.type).qualifier != EvqTemporary) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003187 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 +00003188 context->recover();
3189 }
3190 // make sure a sampler is not involved as well...
3191 if (context->structQualifierErrorCheck((yyvsp[(2) - (3)].lex).line, (yyvsp[(1) - (3)].interm.type)))
3192 context->recover();
3193
3194 // Add the function as a prototype after parsing it (we do not support recursion)
3195 TFunction *function;
3196 TType type((yyvsp[(1) - (3)].interm.type));
3197 function = new TFunction((yyvsp[(2) - (3)].lex).string, type);
3198 (yyval.interm.function) = function;
daniel@transgaming.com5dd6d092012-03-20 20:10:28 +00003199
3200 context->symbolTable.push();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003201 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003202 break;
3203
3204 case 80:
3205
3206 {
3207 if ((yyvsp[(1) - (2)].interm.type).type == EbtVoid) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003208 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 +00003209 context->recover();
3210 }
3211 if (context->reservedErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string))
3212 context->recover();
3213 TParameter param = {(yyvsp[(2) - (2)].lex).string, new TType((yyvsp[(1) - (2)].interm.type))};
3214 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
3215 (yyval.interm).param = param;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003216 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003217 break;
3218
3219 case 81:
3220
3221 {
3222 // Check that we can make an array out of this type
3223 if (context->arrayTypeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
3224 context->recover();
3225
3226 if (context->reservedErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string))
3227 context->recover();
3228
3229 int size;
3230 if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3231 context->recover();
3232 (yyvsp[(1) - (5)].interm.type).setArray(true, size);
3233
3234 TType* type = new TType((yyvsp[(1) - (5)].interm.type));
3235 TParameter param = { (yyvsp[(2) - (5)].lex).string, type };
3236 (yyval.interm).line = (yyvsp[(2) - (5)].lex).line;
3237 (yyval.interm).param = param;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003238 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003239 break;
3240
3241 case 82:
3242
3243 {
3244 (yyval.interm) = (yyvsp[(3) - (3)].interm);
3245 if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
3246 context->recover();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003247 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003248 break;
3249
3250 case 83:
3251
3252 {
3253 (yyval.interm) = (yyvsp[(2) - (2)].interm);
3254 if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
3255 context->recover();
3256 if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
3257 context->recover();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003258 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003259 break;
3260
3261 case 84:
3262
3263 {
3264 (yyval.interm) = (yyvsp[(3) - (3)].interm);
3265 if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
3266 context->recover();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003267 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003268 break;
3269
3270 case 85:
3271
3272 {
3273 (yyval.interm) = (yyvsp[(2) - (2)].interm);
3274 if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
3275 context->recover();
3276 if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
3277 context->recover();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003278 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003279 break;
3280
3281 case 86:
3282
3283 {
3284 (yyval.interm.qualifier) = EvqIn;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003285 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003286 break;
3287
3288 case 87:
3289
3290 {
3291 (yyval.interm.qualifier) = EvqIn;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003292 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003293 break;
3294
3295 case 88:
3296
3297 {
3298 (yyval.interm.qualifier) = EvqOut;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003299 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003300 break;
3301
3302 case 89:
3303
3304 {
3305 (yyval.interm.qualifier) = EvqInOut;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003306 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003307 break;
3308
3309 case 90:
3310
3311 {
3312 TParameter param = { 0, new TType((yyvsp[(1) - (1)].interm.type)) };
3313 (yyval.interm).param = param;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003314 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003315 break;
3316
3317 case 91:
3318
3319 {
3320 (yyval.interm) = (yyvsp[(1) - (1)].interm);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003321 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003322 break;
3323
3324 case 92:
3325
3326 {
daniel@transgaming.comeec8efc2012-03-09 21:57:49 +00003327 if ((yyvsp[(1) - (3)].interm).type.type == EbtInvariant && !(yyvsp[(3) - (3)].lex).symbol)
3328 {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003329 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 +00003330 context->recover();
3331 }
3332
zmo@google.comfd747b82011-04-23 01:30:07 +00003333 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(3) - (3)].lex).string, TType((yyvsp[(1) - (3)].interm).type), (yyvsp[(3) - (3)].lex).line);
3334 (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 +00003335
3336 if (context->structQualifierErrorCheck((yyvsp[(3) - (3)].lex).line, (yyval.interm).type))
3337 context->recover();
3338
daniel@transgaming.com8abd0b72012-09-27 17:46:07 +00003339 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 +00003340 context->recover();
3341
zmo@google.comfd747b82011-04-23 01:30:07 +00003342 TVariable* variable = 0;
3343 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 +00003344 context->recover();
zmo@google.comfd747b82011-04-23 01:30:07 +00003345 if (symbol && variable)
3346 symbol->setId(variable->getUniqueId());
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003347 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003348 break;
3349
3350 case 93:
3351
3352 {
3353 if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
3354 context->recover();
3355
daniel@transgaming.com8abd0b72012-09-27 17:46:07 +00003356 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 +00003357 context->recover();
3358
3359 (yyval.interm) = (yyvsp[(1) - (5)].interm);
3360
3361 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))
3362 context->recover();
3363 else {
3364 (yyvsp[(1) - (5)].interm).type.setArray(true);
3365 TVariable* variable;
3366 if (context->arrayErrorCheck((yyvsp[(4) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, variable))
3367 context->recover();
3368 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003369 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003370 break;
3371
3372 case 94:
3373
3374 {
3375 if (context->structQualifierErrorCheck((yyvsp[(3) - (6)].lex).line, (yyvsp[(1) - (6)].interm).type))
3376 context->recover();
3377
daniel@transgaming.com8abd0b72012-09-27 17:46:07 +00003378 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 +00003379 context->recover();
3380
3381 (yyval.interm) = (yyvsp[(1) - (6)].interm);
3382
3383 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))
3384 context->recover();
3385 else {
3386 int size;
3387 if (context->arraySizeErrorCheck((yyvsp[(4) - (6)].lex).line, (yyvsp[(5) - (6)].interm.intermTypedNode), size))
3388 context->recover();
3389 (yyvsp[(1) - (6)].interm).type.setArray(true, size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003390 TVariable* variable = 0;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003391 if (context->arrayErrorCheck((yyvsp[(4) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type, variable))
3392 context->recover();
3393 TType type = TType((yyvsp[(1) - (6)].interm).type);
3394 type.setArraySize(size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003395 (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 +00003396 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003397 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003398 break;
3399
3400 case 95:
3401
3402 {
3403 if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
3404 context->recover();
3405
3406 (yyval.interm) = (yyvsp[(1) - (5)].interm);
3407
3408 TIntermNode* intermNode;
3409 if (!context->executeInitializer((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, (yyvsp[(5) - (5)].interm.intermTypedNode), intermNode)) {
3410 //
3411 // build the intermediate representation
3412 //
3413 if (intermNode)
3414 (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (5)].interm).intermNode, intermNode, (yyvsp[(4) - (5)].lex).line);
3415 else
3416 (yyval.interm).intermAggregate = (yyvsp[(1) - (5)].interm).intermAggregate;
3417 } else {
3418 context->recover();
3419 (yyval.interm).intermAggregate = 0;
3420 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003421 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003422 break;
3423
3424 case 96:
3425
3426 {
3427 (yyval.interm).type = (yyvsp[(1) - (1)].interm.type);
3428 (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 +00003429 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003430 break;
3431
3432 case 97:
3433
3434 {
zmo@google.comfd747b82011-04-23 01:30:07 +00003435 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyvsp[(1) - (2)].interm.type)), (yyvsp[(2) - (2)].lex).line);
3436 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (2)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003437
3438 if (context->structQualifierErrorCheck((yyvsp[(2) - (2)].lex).line, (yyval.interm).type))
3439 context->recover();
3440
daniel@transgaming.com8abd0b72012-09-27 17:46:07 +00003441 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 +00003442 context->recover();
3443
3444 (yyval.interm).type = (yyvsp[(1) - (2)].interm.type);
3445
zmo@google.comfd747b82011-04-23 01:30:07 +00003446 TVariable* variable = 0;
3447 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 +00003448 context->recover();
zmo@google.comfd747b82011-04-23 01:30:07 +00003449 if (variable && symbol)
3450 symbol->setId(variable->getUniqueId());
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003451 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003452 break;
3453
3454 case 98:
3455
3456 {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003457 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 +00003458 context->recover();
3459
zmo@google.comfd747b82011-04-23 01:30:07 +00003460 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (4)].lex).string, TType((yyvsp[(1) - (4)].interm.type)), (yyvsp[(2) - (4)].lex).line);
3461 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (4)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003462 (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003463 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003464 break;
3465
3466 case 99:
3467
3468 {
3469 TType type = TType((yyvsp[(1) - (5)].interm.type));
3470 int size;
3471 if (context->arraySizeErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3472 context->recover();
3473 type.setArraySize(size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003474 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (5)].lex).string, type, (yyvsp[(2) - (5)].lex).line);
3475 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (5)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003476
3477 if (context->structQualifierErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
3478 context->recover();
3479
daniel@transgaming.com8abd0b72012-09-27 17:46:07 +00003480 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 +00003481 context->recover();
3482
3483 (yyval.interm).type = (yyvsp[(1) - (5)].interm.type);
3484
3485 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)))
3486 context->recover();
3487 else {
3488 int size;
3489 if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3490 context->recover();
3491
3492 (yyvsp[(1) - (5)].interm.type).setArray(true, size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003493 TVariable* variable = 0;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003494 if (context->arrayErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type), variable))
3495 context->recover();
zmo@google.comfd747b82011-04-23 01:30:07 +00003496 if (variable && symbol)
3497 symbol->setId(variable->getUniqueId());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003498 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003499 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003500 break;
3501
3502 case 100:
3503
3504 {
3505 if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
3506 context->recover();
3507
3508 (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
3509
3510 TIntermNode* intermNode;
3511 if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode)) {
3512 //
3513 // Build intermediate representation
3514 //
3515 if(intermNode)
3516 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(intermNode, (yyvsp[(3) - (4)].lex).line);
3517 else
3518 (yyval.interm).intermAggregate = 0;
3519 } else {
3520 context->recover();
3521 (yyval.interm).intermAggregate = 0;
3522 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003523 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003524 break;
3525
3526 case 101:
3527
3528 {
3529 VERTEX_ONLY("invariant declaration", (yyvsp[(1) - (2)].lex).line);
daniel@transgaming.comeec8efc2012-03-09 21:57:49 +00003530 if (context->globalErrorCheck((yyvsp[(1) - (2)].lex).line, context->symbolTable.atGlobalLevel(), "invariant varying"))
3531 context->recover();
3532 (yyval.interm).type.setBasic(EbtInvariant, EvqInvariantVaryingOut, (yyvsp[(2) - (2)].lex).line);
3533 if (!(yyvsp[(2) - (2)].lex).symbol)
3534 {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003535 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 +00003536 context->recover();
3537
3538 (yyval.interm).intermAggregate = 0;
3539 }
3540 else
3541 {
3542 TIntermSymbol *symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyval.interm).type), (yyvsp[(2) - (2)].lex).line);
3543 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (2)].lex).line);
3544 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003545 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003546 break;
3547
3548 case 102:
3549
3550 {
3551 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3552
3553 if ((yyvsp[(1) - (1)].interm.type).array) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003554 context->error((yyvsp[(1) - (1)].interm.type).line, "not supported", "first-class array");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003555 context->recover();
3556 (yyvsp[(1) - (1)].interm.type).setArray(false);
3557 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003558 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003559 break;
3560
3561 case 103:
3562
3563 {
3564 if ((yyvsp[(2) - (2)].interm.type).array) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003565 context->error((yyvsp[(2) - (2)].interm.type).line, "not supported", "first-class array");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003566 context->recover();
3567 (yyvsp[(2) - (2)].interm.type).setArray(false);
3568 }
3569
3570 if ((yyvsp[(1) - (2)].interm.type).qualifier == EvqAttribute &&
3571 ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003572 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 +00003573 context->recover();
3574 }
3575 if (((yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingIn || (yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingOut) &&
3576 ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003577 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 +00003578 context->recover();
3579 }
3580 (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
3581 (yyval.interm.type).qualifier = (yyvsp[(1) - (2)].interm.type).qualifier;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003582 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003583 break;
3584
3585 case 104:
3586
3587 {
3588 (yyval.interm.type).setBasic(EbtVoid, EvqConst, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003589 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003590 break;
3591
3592 case 105:
3593
3594 {
3595 VERTEX_ONLY("attribute", (yyvsp[(1) - (1)].lex).line);
3596 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "attribute"))
3597 context->recover();
3598 (yyval.interm.type).setBasic(EbtVoid, EvqAttribute, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003599 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003600 break;
3601
3602 case 106:
3603
3604 {
3605 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "varying"))
3606 context->recover();
3607 if (context->shaderType == SH_VERTEX_SHADER)
3608 (yyval.interm.type).setBasic(EbtVoid, EvqVaryingOut, (yyvsp[(1) - (1)].lex).line);
3609 else
3610 (yyval.interm.type).setBasic(EbtVoid, EvqVaryingIn, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003611 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003612 break;
3613
3614 case 107:
3615
3616 {
3617 if (context->globalErrorCheck((yyvsp[(1) - (2)].lex).line, context->symbolTable.atGlobalLevel(), "invariant varying"))
3618 context->recover();
3619 if (context->shaderType == SH_VERTEX_SHADER)
3620 (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingOut, (yyvsp[(1) - (2)].lex).line);
3621 else
3622 (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingIn, (yyvsp[(1) - (2)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003623 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003624 break;
3625
3626 case 108:
3627
3628 {
3629 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "uniform"))
3630 context->recover();
3631 (yyval.interm.type).setBasic(EbtVoid, EvqUniform, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003632 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003633 break;
3634
3635 case 109:
3636
3637 {
3638 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
zmo@google.comdc4b4f82011-06-17 00:42:53 +00003639
3640 if ((yyval.interm.type).precision == EbpUndefined) {
3641 (yyval.interm.type).precision = context->symbolTable.getDefaultPrecision((yyvsp[(1) - (1)].interm.type).type);
3642 if (context->precisionErrorCheck((yyvsp[(1) - (1)].interm.type).line, (yyval.interm.type).precision, (yyvsp[(1) - (1)].interm.type).type)) {
3643 context->recover();
3644 }
3645 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003646 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003647 break;
3648
3649 case 110:
3650
3651 {
3652 (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
3653 (yyval.interm.type).precision = (yyvsp[(1) - (2)].interm.precision);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003654 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003655 break;
3656
3657 case 111:
3658
3659 {
3660 (yyval.interm.precision) = EbpHigh;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003661 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003662 break;
3663
3664 case 112:
3665
3666 {
3667 (yyval.interm.precision) = EbpMedium;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003668 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003669 break;
3670
3671 case 113:
3672
3673 {
3674 (yyval.interm.precision) = EbpLow;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003675 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003676 break;
3677
3678 case 114:
3679
3680 {
3681 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003682 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003683 break;
3684
3685 case 115:
3686
3687 {
3688 (yyval.interm.type) = (yyvsp[(1) - (4)].interm.type);
3689
3690 if (context->arrayTypeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
3691 context->recover();
3692 else {
3693 int size;
3694 if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
3695 context->recover();
3696 (yyval.interm.type).setArray(true, size);
3697 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003698 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003699 break;
3700
3701 case 116:
3702
3703 {
3704 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3705 (yyval.interm.type).setBasic(EbtVoid, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003706 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003707 break;
3708
3709 case 117:
3710
3711 {
3712 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3713 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003714 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003715 break;
3716
3717 case 118:
3718
3719 {
3720 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3721 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003722 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003723 break;
3724
3725 case 119:
3726
3727 {
3728 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3729 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003730 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003731 break;
3732
3733 case 120:
3734
3735 {
3736 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3737 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3738 (yyval.interm.type).setAggregate(2);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003739 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003740 break;
3741
3742 case 121:
3743
3744 {
3745 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3746 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3747 (yyval.interm.type).setAggregate(3);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003748 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003749 break;
3750
3751 case 122:
3752
3753 {
3754 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3755 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3756 (yyval.interm.type).setAggregate(4);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003757 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003758 break;
3759
3760 case 123:
3761
3762 {
3763 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3764 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3765 (yyval.interm.type).setAggregate(2);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003766 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003767 break;
3768
3769 case 124:
3770
3771 {
3772 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3773 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3774 (yyval.interm.type).setAggregate(3);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003775 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003776 break;
3777
3778 case 125:
3779
3780 {
3781 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3782 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3783 (yyval.interm.type).setAggregate(4);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003784 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003785 break;
3786
3787 case 126:
3788
3789 {
3790 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3791 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3792 (yyval.interm.type).setAggregate(2);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003793 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003794 break;
3795
3796 case 127:
3797
3798 {
3799 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3800 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3801 (yyval.interm.type).setAggregate(3);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003802 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003803 break;
3804
3805 case 128:
3806
3807 {
3808 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3809 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3810 (yyval.interm.type).setAggregate(4);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003811 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003812 break;
3813
3814 case 129:
3815
3816 {
3817 FRAG_VERT_ONLY("mat2", (yyvsp[(1) - (1)].lex).line);
3818 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3819 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3820 (yyval.interm.type).setAggregate(2, true);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003821 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003822 break;
3823
3824 case 130:
3825
3826 {
3827 FRAG_VERT_ONLY("mat3", (yyvsp[(1) - (1)].lex).line);
3828 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3829 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3830 (yyval.interm.type).setAggregate(3, true);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003831 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003832 break;
3833
3834 case 131:
3835
3836 {
3837 FRAG_VERT_ONLY("mat4", (yyvsp[(1) - (1)].lex).line);
3838 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3839 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3840 (yyval.interm.type).setAggregate(4, true);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003841 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003842 break;
3843
3844 case 132:
3845
3846 {
3847 FRAG_VERT_ONLY("sampler2D", (yyvsp[(1) - (1)].lex).line);
3848 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3849 (yyval.interm.type).setBasic(EbtSampler2D, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003850 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003851 break;
3852
3853 case 133:
3854
3855 {
3856 FRAG_VERT_ONLY("samplerCube", (yyvsp[(1) - (1)].lex).line);
3857 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3858 (yyval.interm.type).setBasic(EbtSamplerCube, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003859 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003860 break;
3861
3862 case 134:
3863
3864 {
zmo@google.com09c323a2011-08-12 18:22:25 +00003865 if (!context->supportsExtension("GL_OES_EGL_image_external")) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003866 context->error((yyvsp[(1) - (1)].lex).line, "unsupported type", "samplerExternalOES");
zmo@google.com09c323a2011-08-12 18:22:25 +00003867 context->recover();
3868 }
3869 FRAG_VERT_ONLY("samplerExternalOES", (yyvsp[(1) - (1)].lex).line);
3870 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3871 (yyval.interm.type).setBasic(EbtSamplerExternalOES, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003872 }
zmo@google.com09c323a2011-08-12 18:22:25 +00003873 break;
3874
3875 case 135:
3876
3877 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00003878 if (!context->supportsExtension("GL_ARB_texture_rectangle")) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00003879 context->error((yyvsp[(1) - (1)].lex).line, "unsupported type", "sampler2DRect");
kbr@chromium.org205fef32011-11-22 20:50:02 +00003880 context->recover();
3881 }
3882 FRAG_VERT_ONLY("sampler2DRect", (yyvsp[(1) - (1)].lex).line);
3883 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3884 (yyval.interm.type).setBasic(EbtSampler2DRect, qual, (yyvsp[(1) - (1)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003885 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003886 break;
3887
zmo@google.com09c323a2011-08-12 18:22:25 +00003888 case 136:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003889
3890 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00003891 FRAG_VERT_ONLY("struct", (yyvsp[(1) - (1)].interm.type).line);
3892 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3893 (yyval.interm.type).qualifier = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003894 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003895 break;
3896
3897 case 137:
3898
3899 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003900 //
3901 // This is for user defined type names. The lexical phase looked up the
3902 // type.
3903 //
3904 TType& structure = static_cast<TVariable*>((yyvsp[(1) - (1)].lex).symbol)->getType();
3905 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3906 (yyval.interm.type).setBasic(EbtStruct, qual, (yyvsp[(1) - (1)].lex).line);
3907 (yyval.interm.type).userDef = &structure;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003908 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003909 break;
3910
zmo@google.com09c323a2011-08-12 18:22:25 +00003911 case 138:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003912
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003913 { if (context->enterStructDeclaration((yyvsp[(2) - (3)].lex).line, *(yyvsp[(2) - (3)].lex).string)) context->recover(); }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003914 break;
3915
3916 case 139:
3917
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003918 {
kbr@chromium.org476541f2011-10-27 21:14:51 +00003919 if (context->reservedErrorCheck((yyvsp[(2) - (6)].lex).line, *(yyvsp[(2) - (6)].lex).string))
3920 context->recover();
3921
3922 TType* structure = new TType((yyvsp[(5) - (6)].interm.typeList), *(yyvsp[(2) - (6)].lex).string);
3923 TVariable* userTypeDef = new TVariable((yyvsp[(2) - (6)].lex).string, *structure, true);
3924 if (! context->symbolTable.insert(*userTypeDef)) {
3925 context->error((yyvsp[(2) - (6)].lex).line, "redefinition", (yyvsp[(2) - (6)].lex).string->c_str(), "struct");
3926 context->recover();
3927 }
3928 (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (6)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003929 (yyval.interm.type).userDef = structure;
kbr@chromium.org476541f2011-10-27 21:14:51 +00003930 context->exitStructDeclaration();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003931 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00003932 break;
3933
3934 case 140:
3935
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003936 { if (context->enterStructDeclaration((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string)) context->recover(); }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003937 break;
3938
3939 case 141:
3940
kbr@chromium.org476541f2011-10-27 21:14:51 +00003941 {
3942 TType* structure = new TType((yyvsp[(4) - (5)].interm.typeList), TString(""));
3943 (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (5)].lex).line);
3944 (yyval.interm.type).userDef = structure;
3945 context->exitStructDeclaration();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003946 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003947 break;
3948
kbr@chromium.org476541f2011-10-27 21:14:51 +00003949 case 142:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003950
3951 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00003952 (yyval.interm.typeList) = (yyvsp[(1) - (1)].interm.typeList);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003953 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003954 break;
3955
3956 case 143:
3957
3958 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003959 (yyval.interm.typeList) = (yyvsp[(1) - (2)].interm.typeList);
3960 for (unsigned int i = 0; i < (yyvsp[(2) - (2)].interm.typeList)->size(); ++i) {
3961 for (unsigned int j = 0; j < (yyval.interm.typeList)->size(); ++j) {
3962 if ((*(yyval.interm.typeList))[j].type->getFieldName() == (*(yyvsp[(2) - (2)].interm.typeList))[i].type->getFieldName()) {
3963 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());
3964 context->recover();
3965 }
3966 }
3967 (yyval.interm.typeList)->push_back((*(yyvsp[(2) - (2)].interm.typeList))[i]);
3968 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00003969 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003970 break;
3971
kbr@chromium.org205fef32011-11-22 20:50:02 +00003972 case 144:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003973
3974 {
3975 (yyval.interm.typeList) = (yyvsp[(2) - (3)].interm.typeList);
3976
3977 if (context->voidErrorCheck((yyvsp[(1) - (3)].interm.type).line, (*(yyvsp[(2) - (3)].interm.typeList))[0].type->getFieldName(), (yyvsp[(1) - (3)].interm.type))) {
3978 context->recover();
3979 }
3980 for (unsigned int i = 0; i < (yyval.interm.typeList)->size(); ++i) {
3981 //
3982 // Careful not to replace already known aspects of type, like array-ness
3983 //
3984 TType* type = (*(yyval.interm.typeList))[i].type;
3985 type->setBasicType((yyvsp[(1) - (3)].interm.type).type);
3986 type->setNominalSize((yyvsp[(1) - (3)].interm.type).size);
3987 type->setMatrix((yyvsp[(1) - (3)].interm.type).matrix);
zmo@google.comdc4b4f82011-06-17 00:42:53 +00003988 type->setPrecision((yyvsp[(1) - (3)].interm.type).precision);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003989
3990 // don't allow arrays of arrays
3991 if (type->isArray()) {
3992 if (context->arrayTypeErrorCheck((yyvsp[(1) - (3)].interm.type).line, (yyvsp[(1) - (3)].interm.type)))
3993 context->recover();
3994 }
3995 if ((yyvsp[(1) - (3)].interm.type).array)
3996 type->setArraySize((yyvsp[(1) - (3)].interm.type).arraySize);
3997 if ((yyvsp[(1) - (3)].interm.type).userDef) {
3998 type->setStruct((yyvsp[(1) - (3)].interm.type).userDef->getStruct());
3999 type->setTypeName((yyvsp[(1) - (3)].interm.type).userDef->getTypeName());
4000 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004001
4002 if (context->structNestingErrorCheck((yyvsp[(1) - (3)].interm.type).line, *type)) {
4003 context->recover();
4004 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004005 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004006 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004007 break;
4008
kbr@chromium.org476541f2011-10-27 21:14:51 +00004009 case 145:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004010
4011 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004012 (yyval.interm.typeList) = NewPoolTTypeList();
4013 (yyval.interm.typeList)->push_back((yyvsp[(1) - (1)].interm.typeLine));
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004014 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004015 break;
4016
kbr@chromium.org476541f2011-10-27 21:14:51 +00004017 case 146:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004018
4019 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004020 (yyval.interm.typeList)->push_back((yyvsp[(3) - (3)].interm.typeLine));
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004021 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004022 break;
4023
4024 case 147:
4025
4026 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004027 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
4028 context->recover();
4029
4030 (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
4031 (yyval.interm.typeLine).line = (yyvsp[(1) - (1)].lex).line;
4032 (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (1)].lex).string);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004033 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004034 break;
4035
kbr@chromium.org205fef32011-11-22 20:50:02 +00004036 case 148:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004037
4038 {
4039 if (context->reservedErrorCheck((yyvsp[(1) - (4)].lex).line, *(yyvsp[(1) - (4)].lex).string))
4040 context->recover();
4041
4042 (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
4043 (yyval.interm.typeLine).line = (yyvsp[(1) - (4)].lex).line;
4044 (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (4)].lex).string);
4045
4046 int size;
4047 if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
4048 context->recover();
4049 (yyval.interm.typeLine).type->setArraySize(size);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004050 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004051 break;
4052
4053 case 149:
4054
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004055 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004056 break;
4057
4058 case 150:
4059
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004060 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004061 break;
4062
4063 case 151:
4064
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004065 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermAggregate); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004066 break;
4067
4068 case 152:
4069
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004070 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004071 break;
4072
4073 case 153:
4074
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004075 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004076 break;
4077
4078 case 154:
4079
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004080 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004081 break;
4082
4083 case 155:
4084
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004085 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004086 break;
4087
4088 case 156:
4089
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004090 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004091 break;
4092
4093 case 157:
4094
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004095 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
zmo@google.com09c323a2011-08-12 18:22:25 +00004096 break;
4097
4098 case 158:
4099
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004100 { (yyval.interm.intermAggregate) = 0; }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004101 break;
4102
4103 case 159:
4104
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004105 { context->symbolTable.push(); }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004106 break;
4107
4108 case 160:
4109
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004110 { context->symbolTable.pop(); }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004111 break;
4112
4113 case 161:
4114
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004115 {
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004116 if ((yyvsp[(3) - (5)].interm.intermAggregate) != 0) {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004117 (yyvsp[(3) - (5)].interm.intermAggregate)->setOp(EOpSequence);
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004118 (yyvsp[(3) - (5)].interm.intermAggregate)->setEndLine((yyvsp[(5) - (5)].lex).line);
4119 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004120 (yyval.interm.intermAggregate) = (yyvsp[(3) - (5)].interm.intermAggregate);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004121 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004122 break;
4123
4124 case 162:
4125
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004126 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004127 break;
4128
4129 case 163:
4130
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004131 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004132 break;
4133
kbr@chromium.org476541f2011-10-27 21:14:51 +00004134 case 164:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004135
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004136 { context->symbolTable.push(); }
4137 break;
4138
4139 case 165:
4140
4141 { context->symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[(2) - (2)].interm.intermNode); }
4142 break;
4143
4144 case 166:
4145
4146 { context->symbolTable.push(); }
4147 break;
4148
4149 case 167:
4150
4151 { context->symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[(2) - (2)].interm.intermNode); }
4152 break;
4153
4154 case 168:
4155
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004156 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004157 (yyval.interm.intermNode) = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004158 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004159 break;
4160
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004161 case 169:
kbr@chromium.org205fef32011-11-22 20:50:02 +00004162
4163 {
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004164 if ((yyvsp[(2) - (3)].interm.intermAggregate)) {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004165 (yyvsp[(2) - (3)].interm.intermAggregate)->setOp(EOpSequence);
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004166 (yyvsp[(2) - (3)].interm.intermAggregate)->setEndLine((yyvsp[(3) - (3)].lex).line);
4167 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004168 (yyval.interm.intermNode) = (yyvsp[(2) - (3)].interm.intermAggregate);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004169 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004170 break;
4171
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004172 case 170:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004173
4174 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004175 (yyval.interm.intermAggregate) = context->intermediate.makeAggregate((yyvsp[(1) - (1)].interm.intermNode), 0);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004176 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004177 break;
4178
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004179 case 171:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004180
kbr@chromium.org205fef32011-11-22 20:50:02 +00004181 {
4182 (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 +00004183 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004184 break;
4185
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004186 case 172:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004187
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004188 { (yyval.interm.intermNode) = 0; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004189 break;
4190
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004191 case 173:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004192
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004193 { (yyval.interm.intermNode) = static_cast<TIntermNode*>((yyvsp[(1) - (2)].interm.intermTypedNode)); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004194 break;
4195
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004196 case 174:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004197
4198 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004199 if (context->boolErrorCheck((yyvsp[(1) - (5)].lex).line, (yyvsp[(3) - (5)].interm.intermTypedNode)))
4200 context->recover();
4201 (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 +00004202 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004203 break;
4204
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004205 case 175:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004206
4207 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004208 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermNode);
4209 (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004210 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004211 break;
4212
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004213 case 176:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004214
4215 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004216 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (1)].interm.intermNode);
4217 (yyval.interm.nodePair).node2 = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004218 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004219 break;
4220
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004221 case 177:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004222
4223 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004224 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
4225 if (context->boolErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)->getLine(), (yyvsp[(1) - (1)].interm.intermTypedNode)))
4226 context->recover();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004227 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004228 break;
4229
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004230 case 178:
kbr@chromium.org205fef32011-11-22 20:50:02 +00004231
4232 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004233 TIntermNode* intermNode;
4234 if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
4235 context->recover();
4236 if (context->boolErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
4237 context->recover();
4238
4239 if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode))
4240 (yyval.interm.intermTypedNode) = (yyvsp[(4) - (4)].interm.intermTypedNode);
4241 else {
4242 context->recover();
4243 (yyval.interm.intermTypedNode) = 0;
4244 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004245 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004246 break;
4247
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004248 case 179:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004249
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004250 { context->symbolTable.push(); ++context->loopNestingLevel; }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004251 break;
4252
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004253 case 180:
kbr@chromium.org205fef32011-11-22 20:50:02 +00004254
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004255 {
4256 context->symbolTable.pop();
alokp@chromium.org52813552010-11-16 18:36:09 +00004257 (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 +00004258 --context->loopNestingLevel;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004259 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004260 break;
4261
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004262 case 181:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004263
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004264 { ++context->loopNestingLevel; }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004265 break;
4266
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004267 case 182:
kbr@chromium.org205fef32011-11-22 20:50:02 +00004268
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004269 {
4270 if (context->boolErrorCheck((yyvsp[(8) - (8)].lex).line, (yyvsp[(6) - (8)].interm.intermTypedNode)))
4271 context->recover();
4272
alokp@chromium.org52813552010-11-16 18:36:09 +00004273 (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 +00004274 --context->loopNestingLevel;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004275 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004276 break;
4277
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004278 case 183:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004279
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004280 { context->symbolTable.push(); ++context->loopNestingLevel; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004281 break;
4282
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004283 case 184:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004284
4285 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004286 context->symbolTable.pop();
4287 (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);
4288 --context->loopNestingLevel;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004289 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004290 break;
4291
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004292 case 185:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004293
4294 {
kbr@chromium.org476541f2011-10-27 21:14:51 +00004295 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004296 }
zmo@google.com09c323a2011-08-12 18:22:25 +00004297 break;
4298
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004299 case 186:
zmo@google.com09c323a2011-08-12 18:22:25 +00004300
4301 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004302 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004303 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004304 break;
4305
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004306 case 187:
kbr@chromium.org476541f2011-10-27 21:14:51 +00004307
4308 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004309 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004310 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004311 break;
4312
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004313 case 188:
kbr@chromium.org476541f2011-10-27 21:14:51 +00004314
4315 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004316 (yyval.interm.intermTypedNode) = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004317 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004318 break;
4319
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004320 case 189:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004321
4322 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004323 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (2)].interm.intermTypedNode);
4324 (yyval.interm.nodePair).node2 = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004325 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004326 break;
4327
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004328 case 190:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004329
4330 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004331 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermTypedNode);
4332 (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermTypedNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004333 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004334 break;
4335
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004336 case 191:
kbr@chromium.org205fef32011-11-22 20:50:02 +00004337
4338 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004339 if (context->loopNestingLevel <= 0) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00004340 context->error((yyvsp[(1) - (2)].lex).line, "continue statement only allowed in loops", "");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004341 context->recover();
4342 }
4343 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpContinue, (yyvsp[(1) - (2)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004344 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004345 break;
4346
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004347 case 192:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004348
4349 {
4350 if (context->loopNestingLevel <= 0) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00004351 context->error((yyvsp[(1) - (2)].lex).line, "break statement only allowed in loops", "");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004352 context->recover();
4353 }
4354 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpBreak, (yyvsp[(1) - (2)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004355 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004356 break;
4357
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004358 case 193:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004359
4360 {
4361 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(1) - (2)].lex).line);
4362 if (context->currentFunctionType->getBasicType() != EbtVoid) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00004363 context->error((yyvsp[(1) - (2)].lex).line, "non-void function must return a value", "return");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004364 context->recover();
4365 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004366 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004367 break;
4368
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004369 case 194:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004370
4371 {
4372 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(2) - (3)].interm.intermTypedNode), (yyvsp[(1) - (3)].lex).line);
4373 context->functionReturnsValue = true;
4374 if (context->currentFunctionType->getBasicType() == EbtVoid) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00004375 context->error((yyvsp[(1) - (3)].lex).line, "void function cannot return a value", "return");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004376 context->recover();
4377 } else if (*(context->currentFunctionType) != (yyvsp[(2) - (3)].interm.intermTypedNode)->getType()) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00004378 context->error((yyvsp[(1) - (3)].lex).line, "function return is not matching type:", "return");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004379 context->recover();
4380 }
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004381 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004382 break;
4383
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004384 case 195:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004385
4386 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004387 FRAG_ONLY("discard", (yyvsp[(1) - (2)].lex).line);
4388 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpKill, (yyvsp[(1) - (2)].lex).line);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004389 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004390 break;
4391
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004392 case 196:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004393
4394 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004395 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
zmo@google.com09c323a2011-08-12 18:22:25 +00004396 context->treeRoot = (yyval.interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004397 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004398 break;
4399
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004400 case 197:
zmo@google.com09c323a2011-08-12 18:22:25 +00004401
4402 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004403 (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermNode), (yyvsp[(2) - (2)].interm.intermNode), 0);
4404 context->treeRoot = (yyval.interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004405 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004406 break;
4407
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004408 case 198:
kbr@chromium.org476541f2011-10-27 21:14:51 +00004409
4410 {
4411 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004412 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004413 break;
4414
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004415 case 199:
kbr@chromium.org476541f2011-10-27 21:14:51 +00004416
4417 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004418 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004419 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004420 break;
4421
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004422 case 200:
kbr@chromium.org205fef32011-11-22 20:50:02 +00004423
4424 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004425 TFunction* function = (yyvsp[(1) - (1)].interm).function;
daniel@transgaming.coma8833e92012-07-11 20:37:16 +00004426
4427 const TSymbol *builtIn = context->symbolTable.findBuiltIn(function->getMangledName());
4428
4429 if (builtIn)
4430 {
4431 context->error((yyvsp[(1) - (1)].interm).line, "built-in functions cannot be redefined", function->getName().c_str());
4432 context->recover();
4433 }
4434
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004435 TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find(function->getMangledName()));
4436 //
4437 // Note: 'prevDec' could be 'function' if this is the first time we've seen function
4438 // as it would have just been put in the symbol table. Otherwise, we're looking up
4439 // an earlier occurance.
4440 //
4441 if (prevDec->isDefined()) {
4442 //
4443 // Then this function already has a body.
4444 //
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00004445 context->error((yyvsp[(1) - (1)].interm).line, "function already has a body", function->getName().c_str());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004446 context->recover();
4447 }
4448 prevDec->setDefined();
4449
4450 //
4451 // Raise error message if main function takes any parameters or return anything other than void
4452 //
4453 if (function->getName() == "main") {
4454 if (function->getParamCount() > 0) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00004455 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 +00004456 context->recover();
4457 }
4458 if (function->getReturnType().getBasicType() != EbtVoid) {
4459 context->error((yyvsp[(1) - (1)].interm).line, "", function->getReturnType().getBasicString(), "main function cannot return a value");
4460 context->recover();
4461 }
4462 }
4463
4464 //
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004465 // Remember the return type for later checking for RETURN statements.
4466 //
4467 context->currentFunctionType = &(prevDec->getReturnType());
4468 context->functionReturnsValue = false;
4469
4470 //
4471 // Insert parameters into the symbol table.
4472 // If the parameter has no name, it's not an error, just don't insert it
4473 // (could be used for unused args).
4474 //
4475 // Also, accumulate the list of parameters into the HIL, so lower level code
4476 // knows where to find parameters.
4477 //
4478 TIntermAggregate* paramNodes = new TIntermAggregate;
4479 for (int i = 0; i < function->getParamCount(); i++) {
4480 const TParameter& param = function->getParam(i);
4481 if (param.name != 0) {
4482 TVariable *variable = new TVariable(param.name, *param.type);
4483 //
4484 // Insert the parameters with name in the symbol table.
4485 //
4486 if (! context->symbolTable.insert(*variable)) {
maxvujovic@gmail.comc6b3b3c2012-06-27 22:49:39 +00004487 context->error((yyvsp[(1) - (1)].interm).line, "redefinition", variable->getName().c_str());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004488 context->recover();
4489 delete variable;
4490 }
4491
4492 //
4493 // Add the parameter to the HIL
4494 //
4495 paramNodes = context->intermediate.growAggregate(
4496 paramNodes,
4497 context->intermediate.addSymbol(variable->getUniqueId(),
4498 variable->getName(),
4499 variable->getType(), (yyvsp[(1) - (1)].interm).line),
4500 (yyvsp[(1) - (1)].interm).line);
4501 } else {
4502 paramNodes = context->intermediate.growAggregate(paramNodes, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (1)].interm).line), (yyvsp[(1) - (1)].interm).line);
4503 }
4504 }
4505 context->intermediate.setAggregateOperator(paramNodes, EOpParameters, (yyvsp[(1) - (1)].interm).line);
4506 (yyvsp[(1) - (1)].interm).intermAggregate = paramNodes;
4507 context->loopNestingLevel = 0;
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004508 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004509 break;
4510
daniel@transgaming.com83dc5a72012-03-09 21:57:07 +00004511 case 201:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004512
4513 {
4514 //?? Check that all paths return a value if return type != void ?
4515 // May be best done as post process phase on intermediate code
4516 if (context->currentFunctionType->getBasicType() != EbtVoid && ! context->functionReturnsValue) {
4517 context->error((yyvsp[(1) - (3)].interm).line, "function does not return a value:", "", (yyvsp[(1) - (3)].interm).function->getName().c_str());
4518 context->recover();
4519 }
daniel@transgaming.com5dd6d092012-03-20 20:10:28 +00004520
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004521 (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermAggregate, (yyvsp[(3) - (3)].interm.intermNode), 0);
4522 context->intermediate.setAggregateOperator((yyval.interm.intermNode), EOpFunction, (yyvsp[(1) - (3)].interm).line);
4523 (yyval.interm.intermNode)->getAsAggregate()->setName((yyvsp[(1) - (3)].interm).function->getMangledName().c_str());
4524 (yyval.interm.intermNode)->getAsAggregate()->setType((yyvsp[(1) - (3)].interm).function->getReturnType());
4525
4526 // store the pragma information for debug and optimize and other vendor specific
4527 // information. This information can be queried from the parse tree
alokp@chromium.org8b851c62012-06-15 16:25:11 +00004528 (yyval.interm.intermNode)->getAsAggregate()->setOptimize(context->pragma().optimize);
4529 (yyval.interm.intermNode)->getAsAggregate()->setDebug(context->pragma().debug);
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004530
4531 if ((yyvsp[(3) - (3)].interm.intermNode) && (yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate())
4532 (yyval.interm.intermNode)->getAsAggregate()->setEndLine((yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate()->getEndLine());
daniel@transgaming.com5dd6d092012-03-20 20:10:28 +00004533
4534 context->symbolTable.pop();
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004535 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004536 break;
4537
4538
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004539
4540 default: break;
4541 }
4542 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
4543
4544 YYPOPSTACK (yylen);
4545 yylen = 0;
4546 YY_STACK_PRINT (yyss, yyssp);
4547
4548 *++yyvsp = yyval;
4549
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004550 /* Now `shift' the result of the reduction. Determine what state
4551 that goes to, based on the state we popped back to and the rule
4552 number reduced by. */
4553
4554 yyn = yyr1[yyn];
4555
4556 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
4557 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
4558 yystate = yytable[yystate];
4559 else
4560 yystate = yydefgoto[yyn - YYNTOKENS];
4561
4562 goto yynewstate;
4563
4564
4565/*------------------------------------.
4566| yyerrlab -- here on detecting error |
4567`------------------------------------*/
4568yyerrlab:
4569 /* If not already recovering from an error, report this error. */
4570 if (!yyerrstatus)
4571 {
4572 ++yynerrs;
4573#if ! YYERROR_VERBOSE
4574 yyerror (context, YY_("syntax error"));
4575#else
4576 {
4577 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
4578 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
4579 {
4580 YYSIZE_T yyalloc = 2 * yysize;
4581 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
4582 yyalloc = YYSTACK_ALLOC_MAXIMUM;
4583 if (yymsg != yymsgbuf)
4584 YYSTACK_FREE (yymsg);
4585 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
4586 if (yymsg)
4587 yymsg_alloc = yyalloc;
4588 else
4589 {
4590 yymsg = yymsgbuf;
4591 yymsg_alloc = sizeof yymsgbuf;
4592 }
4593 }
4594
4595 if (0 < yysize && yysize <= yymsg_alloc)
4596 {
4597 (void) yysyntax_error (yymsg, yystate, yychar);
4598 yyerror (context, yymsg);
4599 }
4600 else
4601 {
4602 yyerror (context, YY_("syntax error"));
4603 if (yysize != 0)
4604 goto yyexhaustedlab;
4605 }
4606 }
4607#endif
4608 }
4609
4610
4611
4612 if (yyerrstatus == 3)
4613 {
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004614 /* If just tried and failed to reuse lookahead token after an
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004615 error, discard it. */
4616
4617 if (yychar <= YYEOF)
4618 {
4619 /* Return failure if at end of input. */
4620 if (yychar == YYEOF)
4621 YYABORT;
4622 }
4623 else
4624 {
4625 yydestruct ("Error: discarding",
4626 yytoken, &yylval, context);
4627 yychar = YYEMPTY;
4628 }
4629 }
4630
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004631 /* Else will try to reuse lookahead token after shifting the error
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004632 token. */
4633 goto yyerrlab1;
4634
4635
4636/*---------------------------------------------------.
4637| yyerrorlab -- error raised explicitly by YYERROR. |
4638`---------------------------------------------------*/
4639yyerrorlab:
4640
4641 /* Pacify compilers like GCC when the user code never invokes
4642 YYERROR and the label yyerrorlab therefore never appears in user
4643 code. */
4644 if (/*CONSTCOND*/ 0)
4645 goto yyerrorlab;
4646
4647 /* Do not reclaim the symbols of the rule which action triggered
4648 this YYERROR. */
4649 YYPOPSTACK (yylen);
4650 yylen = 0;
4651 YY_STACK_PRINT (yyss, yyssp);
4652 yystate = *yyssp;
4653 goto yyerrlab1;
4654
4655
4656/*-------------------------------------------------------------.
4657| yyerrlab1 -- common code for both syntax error and YYERROR. |
4658`-------------------------------------------------------------*/
4659yyerrlab1:
4660 yyerrstatus = 3; /* Each real token shifted decrements this. */
4661
4662 for (;;)
4663 {
4664 yyn = yypact[yystate];
4665 if (yyn != YYPACT_NINF)
4666 {
4667 yyn += YYTERROR;
4668 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
4669 {
4670 yyn = yytable[yyn];
4671 if (0 < yyn)
4672 break;
4673 }
4674 }
4675
4676 /* Pop the current state because it cannot handle the error token. */
4677 if (yyssp == yyss)
4678 YYABORT;
4679
4680
4681 yydestruct ("Error: popping",
4682 yystos[yystate], yyvsp, context);
4683 YYPOPSTACK (1);
4684 yystate = *yyssp;
4685 YY_STACK_PRINT (yyss, yyssp);
4686 }
4687
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004688 *++yyvsp = yylval;
4689
4690
4691 /* Shift the error token. */
4692 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
4693
4694 yystate = yyn;
4695 goto yynewstate;
4696
4697
4698/*-------------------------------------.
4699| yyacceptlab -- YYACCEPT comes here. |
4700`-------------------------------------*/
4701yyacceptlab:
4702 yyresult = 0;
4703 goto yyreturn;
4704
4705/*-----------------------------------.
4706| yyabortlab -- YYABORT comes here. |
4707`-----------------------------------*/
4708yyabortlab:
4709 yyresult = 1;
4710 goto yyreturn;
4711
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004712#if !defined(yyoverflow) || YYERROR_VERBOSE
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004713/*-------------------------------------------------.
4714| yyexhaustedlab -- memory exhaustion comes here. |
4715`-------------------------------------------------*/
4716yyexhaustedlab:
4717 yyerror (context, YY_("memory exhausted"));
4718 yyresult = 2;
4719 /* Fall through. */
4720#endif
4721
4722yyreturn:
daniel@transgaming.com05bc2042012-03-09 21:56:58 +00004723 if (yychar != YYEMPTY)
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004724 yydestruct ("Cleanup: discarding lookahead",
4725 yytoken, &yylval, context);
4726 /* Do not reclaim the symbols of the rule which action triggered
4727 this YYABORT or YYACCEPT. */
4728 YYPOPSTACK (yylen);
4729 YY_STACK_PRINT (yyss, yyssp);
4730 while (yyssp != yyss)
4731 {
4732 yydestruct ("Cleanup: popping",
4733 yystos[*yyssp], yyvsp, context);
4734 YYPOPSTACK (1);
4735 }
4736#ifndef yyoverflow
4737 if (yyss != yyssa)
4738 YYSTACK_FREE (yyss);
4739#endif
4740#if YYERROR_VERBOSE
4741 if (yymsg != yymsgbuf)
4742 YYSTACK_FREE (yymsg);
4743#endif
4744 /* Make sure YYID is used. */
4745 return YYID (yyresult);
4746}
4747
4748
4749
4750
4751
4752int glslang_parse(TParseContext* context) {
4753 return yyparse(context);
4754}
4755
4756