blob: 535177bdbf4fad55bc50862ae7ab813550674cfc [file] [log] [blame]
kbr@chromium.org205fef32011-11-22 20:50:02 +00001
2/* A Bison parser, made by GNU Bison 2.4.1. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003
4/* Skeleton implementation for Bison's Yacc-like parsers in C
kbr@chromium.org205fef32011-11-22 20:50:02 +00005
6 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00007 Free Software Foundation, Inc.
kbr@chromium.org205fef32011-11-22 20:50:02 +00008
9 This program is free software: you can redistribute it and/or modify
alokp@chromium.org044a5cf2010-11-12 15:42:16 +000010 it under the terms of the GNU General Public License as published by
kbr@chromium.org205fef32011-11-22 20:50:02 +000011 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13
alokp@chromium.org044a5cf2010-11-12 15:42:16 +000014 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
kbr@chromium.org205fef32011-11-22 20:50:02 +000018
alokp@chromium.org044a5cf2010-11-12 15:42:16 +000019 You should have received a copy of the GNU General Public License
kbr@chromium.org205fef32011-11-22 20:50:02 +000020 along with this program. If not, see <http://www.gnu.org/licenses/>. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +000021
22/* As a special exception, you may create a larger work that contains
23 part or all of the Bison parser skeleton and distribute that work
24 under terms of your choice, so long as that work isn't itself a
25 parser generator using the skeleton or a modified version thereof
26 as a parser skeleton. Alternatively, if you modify or redistribute
27 the parser skeleton itself, you may (at your option) remove this
28 special exception, which will cause the skeleton and the resulting
29 Bison output files to be licensed under the GNU General Public
30 License without this special exception.
kbr@chromium.org205fef32011-11-22 20:50:02 +000031
alokp@chromium.org044a5cf2010-11-12 15:42:16 +000032 This special exception was added by the Free Software Foundation in
33 version 2.2 of Bison. */
34
35/* C LALR(1) parser skeleton written by Richard Stallman, by
36 simplifying the original so-called "semantic" parser. */
37
38/* All symbols defined below should begin with yy or YY, to avoid
39 infringing on user name space. This should be done even for local
40 variables, as they might otherwise be expanded by user macros.
41 There are some unavoidable exceptions within include files to
42 define necessary library symbols; they are noted "INFRINGES ON
43 USER NAME SPACE" below. */
44
45/* Identify Bison output. */
46#define YYBISON 1
47
48/* Bison version. */
kbr@chromium.org205fef32011-11-22 20:50:02 +000049#define YYBISON_VERSION "2.4.1"
alokp@chromium.org044a5cf2010-11-12 15:42:16 +000050
51/* Skeleton name. */
52#define YYSKELETON_NAME "yacc.c"
53
54/* Pure parsers. */
55#define YYPURE 1
56
kbr@chromium.org205fef32011-11-22 20:50:02 +000057/* Push parsers. */
58#define YYPUSH 0
59
60/* Pull parsers. */
61#define YYPULL 1
62
alokp@chromium.org044a5cf2010-11-12 15:42:16 +000063/* Using locations. */
64#define YYLSP_NEEDED 0
65
66
67
kbr@chromium.org205fef32011-11-22 20:50:02 +000068/* Copy the first part of user declarations. */
69
70
71//
72// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
73// Use of this source code is governed by a BSD-style license that can be
74// found in the LICENSE file.
75//
76
77// This file is auto-generated by generate_parser.sh. DO NOT EDIT!
78
79#include "compiler/SymbolTable.h"
80#include "compiler/ParseHelper.h"
81#include "GLSLANG/ShaderLang.h"
82
83#define YYLEX_PARAM context->scanner
84
85
86
87/* Enabling traces. */
88#ifndef YYDEBUG
89# define YYDEBUG 0
90#endif
91
92/* Enabling verbose error messages. */
93#ifdef YYERROR_VERBOSE
94# undef YYERROR_VERBOSE
95# define YYERROR_VERBOSE 1
96#else
97# define YYERROR_VERBOSE 0
98#endif
99
100/* Enabling the token table. */
101#ifndef YYTOKEN_TABLE
102# define YYTOKEN_TABLE 0
103#endif
104
105
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000106/* Tokens. */
107#ifndef YYTOKENTYPE
108# define YYTOKENTYPE
109 /* Put the tokens into the symbol table, so that GDB and other debuggers
110 know about them. */
111 enum yytokentype {
112 INVARIANT = 258,
113 HIGH_PRECISION = 259,
114 MEDIUM_PRECISION = 260,
115 LOW_PRECISION = 261,
116 PRECISION = 262,
117 ATTRIBUTE = 263,
118 CONST_QUAL = 264,
119 BOOL_TYPE = 265,
120 FLOAT_TYPE = 266,
121 INT_TYPE = 267,
122 BREAK = 268,
123 CONTINUE = 269,
124 DO = 270,
125 ELSE = 271,
126 FOR = 272,
127 IF = 273,
128 DISCARD = 274,
129 RETURN = 275,
130 BVEC2 = 276,
131 BVEC3 = 277,
132 BVEC4 = 278,
133 IVEC2 = 279,
134 IVEC3 = 280,
135 IVEC4 = 281,
136 VEC2 = 282,
137 VEC3 = 283,
138 VEC4 = 284,
139 MATRIX2 = 285,
140 MATRIX3 = 286,
141 MATRIX4 = 287,
142 IN_QUAL = 288,
143 OUT_QUAL = 289,
144 INOUT_QUAL = 290,
145 UNIFORM = 291,
146 VARYING = 292,
147 STRUCT = 293,
148 VOID_TYPE = 294,
149 WHILE = 295,
150 SAMPLER2D = 296,
151 SAMPLERCUBE = 297,
zmo@google.com09c323a2011-08-12 18:22:25 +0000152 SAMPLER_EXTERNAL_OES = 298,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000153 SAMPLER2DRECT = 299,
154 IDENTIFIER = 300,
155 TYPE_NAME = 301,
156 FLOATCONSTANT = 302,
157 INTCONSTANT = 303,
158 BOOLCONSTANT = 304,
159 FIELD_SELECTION = 305,
160 LEFT_OP = 306,
161 RIGHT_OP = 307,
162 INC_OP = 308,
163 DEC_OP = 309,
164 LE_OP = 310,
165 GE_OP = 311,
166 EQ_OP = 312,
167 NE_OP = 313,
168 AND_OP = 314,
169 OR_OP = 315,
170 XOR_OP = 316,
171 MUL_ASSIGN = 317,
172 DIV_ASSIGN = 318,
173 ADD_ASSIGN = 319,
174 MOD_ASSIGN = 320,
175 LEFT_ASSIGN = 321,
176 RIGHT_ASSIGN = 322,
177 AND_ASSIGN = 323,
178 XOR_ASSIGN = 324,
179 OR_ASSIGN = 325,
180 SUB_ASSIGN = 326,
181 LEFT_PAREN = 327,
182 RIGHT_PAREN = 328,
183 LEFT_BRACKET = 329,
184 RIGHT_BRACKET = 330,
185 LEFT_BRACE = 331,
186 RIGHT_BRACE = 332,
187 DOT = 333,
188 COMMA = 334,
189 COLON = 335,
190 EQUAL = 336,
191 SEMICOLON = 337,
192 BANG = 338,
193 DASH = 339,
194 TILDE = 340,
195 PLUS = 341,
196 STAR = 342,
197 SLASH = 343,
198 PERCENT = 344,
199 LEFT_ANGLE = 345,
200 RIGHT_ANGLE = 346,
201 VERTICAL_BAR = 347,
202 CARET = 348,
203 AMPERSAND = 349,
204 QUESTION = 350
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000205 };
206#endif
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000207
208
209
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000210#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
211typedef union YYSTYPE
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000212{
kbr@chromium.org205fef32011-11-22 20:50:02 +0000213
214
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000215 struct {
216 TSourceLoc line;
217 union {
218 TString *string;
219 float f;
220 int i;
221 bool b;
222 };
223 TSymbol* symbol;
224 } lex;
225 struct {
226 TSourceLoc line;
227 TOperator op;
228 union {
229 TIntermNode* intermNode;
230 TIntermNodePair nodePair;
231 TIntermTyped* intermTypedNode;
232 TIntermAggregate* intermAggregate;
233 };
234 union {
235 TPublicType type;
236 TPrecision precision;
237 TQualifier qualifier;
238 TFunction* function;
239 TParameter param;
240 TTypeLine typeLine;
241 TTypeList* typeList;
242 };
243 } interm;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000244
kbr@chromium.org205fef32011-11-22 20:50:02 +0000245
246
247} YYSTYPE;
248# define YYSTYPE_IS_TRIVIAL 1
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000249# define yystype YYSTYPE /* obsolescent; will be withdrawn */
250# define YYSTYPE_IS_DECLARED 1
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000251#endif
252
253
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000254/* Copy the second part of user declarations. */
255
256
257extern int yylex(YYSTYPE* yylval_param, void* yyscanner);
258extern void yyerror(TParseContext* context, const char* reason);
259
260#define FRAG_VERT_ONLY(S, L) { \
261 if (context->shaderType != SH_FRAGMENT_SHADER && \
262 context->shaderType != SH_VERTEX_SHADER) { \
263 context->error(L, " supported in vertex/fragment shaders only ", S, "", ""); \
264 context->recover(); \
265 } \
266}
267
268#define VERTEX_ONLY(S, L) { \
269 if (context->shaderType != SH_VERTEX_SHADER) { \
270 context->error(L, " supported in vertex shaders only ", S, "", ""); \
271 context->recover(); \
272 } \
273}
274
275#define FRAG_ONLY(S, L) { \
276 if (context->shaderType != SH_FRAGMENT_SHADER) { \
277 context->error(L, " supported in fragment shaders only ", S, "", ""); \
278 context->recover(); \
279 } \
280}
281
282
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000283
284#ifdef short
285# undef short
286#endif
287
288#ifdef YYTYPE_UINT8
289typedef YYTYPE_UINT8 yytype_uint8;
290#else
291typedef unsigned char yytype_uint8;
292#endif
293
294#ifdef YYTYPE_INT8
295typedef YYTYPE_INT8 yytype_int8;
296#elif (defined __STDC__ || defined __C99__FUNC__ \
297 || defined __cplusplus || defined _MSC_VER)
298typedef signed char yytype_int8;
299#else
300typedef short int yytype_int8;
301#endif
302
303#ifdef YYTYPE_UINT16
304typedef YYTYPE_UINT16 yytype_uint16;
305#else
306typedef unsigned short int yytype_uint16;
307#endif
308
309#ifdef YYTYPE_INT16
310typedef YYTYPE_INT16 yytype_int16;
311#else
312typedef short int yytype_int16;
313#endif
314
315#ifndef YYSIZE_T
316# ifdef __SIZE_TYPE__
317# define YYSIZE_T __SIZE_TYPE__
318# elif defined size_t
319# define YYSIZE_T size_t
320# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
321 || defined __cplusplus || defined _MSC_VER)
322# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
323# define YYSIZE_T size_t
324# else
325# define YYSIZE_T unsigned int
326# endif
327#endif
328
329#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
330
331#ifndef YY_
kbr@chromium.org205fef32011-11-22 20:50:02 +0000332# if YYENABLE_NLS
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000333# if ENABLE_NLS
334# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
335# define YY_(msgid) dgettext ("bison-runtime", msgid)
336# endif
337# endif
338# ifndef YY_
339# define YY_(msgid) msgid
340# endif
341#endif
342
343/* Suppress unused-variable warnings by "using" E. */
344#if ! defined lint || defined __GNUC__
345# define YYUSE(e) ((void) (e))
346#else
347# define YYUSE(e) /* empty */
348#endif
349
350/* Identity function, used to suppress warnings about constant conditions. */
351#ifndef lint
352# define YYID(n) (n)
353#else
354#if (defined __STDC__ || defined __C99__FUNC__ \
355 || defined __cplusplus || defined _MSC_VER)
356static int
kbr@chromium.org205fef32011-11-22 20:50:02 +0000357YYID (int yyi)
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000358#else
359static int
kbr@chromium.org205fef32011-11-22 20:50:02 +0000360YYID (yyi)
361 int yyi;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000362#endif
363{
kbr@chromium.org205fef32011-11-22 20:50:02 +0000364 return yyi;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000365}
366#endif
367
368#if ! defined yyoverflow || YYERROR_VERBOSE
369
370/* The parser invokes alloca or malloc; define the necessary symbols. */
371
372# ifdef YYSTACK_USE_ALLOCA
373# if YYSTACK_USE_ALLOCA
374# ifdef __GNUC__
375# define YYSTACK_ALLOC __builtin_alloca
376# elif defined __BUILTIN_VA_ARG_INCR
377# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
378# elif defined _AIX
379# define YYSTACK_ALLOC __alloca
380# elif defined _MSC_VER
381# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
382# define alloca _alloca
383# else
384# define YYSTACK_ALLOC alloca
385# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
386 || defined __cplusplus || defined _MSC_VER)
387# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
388# ifndef _STDLIB_H
389# define _STDLIB_H 1
390# endif
391# endif
392# endif
393# endif
394# endif
395
396# ifdef YYSTACK_ALLOC
397 /* Pacify GCC's `empty if-body' warning. */
398# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
399# ifndef YYSTACK_ALLOC_MAXIMUM
400 /* The OS might guarantee only one guard page at the bottom of the stack,
401 and a page size can be as small as 4096 bytes. So we cannot safely
402 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
403 to allow for a few compiler-allocated temporary stack slots. */
404# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
405# endif
406# else
407# define YYSTACK_ALLOC YYMALLOC
408# define YYSTACK_FREE YYFREE
409# ifndef YYSTACK_ALLOC_MAXIMUM
410# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
411# endif
412# if (defined __cplusplus && ! defined _STDLIB_H \
413 && ! ((defined YYMALLOC || defined malloc) \
414 && (defined YYFREE || defined free)))
415# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
416# ifndef _STDLIB_H
417# define _STDLIB_H 1
418# endif
419# endif
420# ifndef YYMALLOC
421# define YYMALLOC malloc
422# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
423 || defined __cplusplus || defined _MSC_VER)
424void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
425# endif
426# endif
427# ifndef YYFREE
428# define YYFREE free
429# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
430 || defined __cplusplus || defined _MSC_VER)
431void free (void *); /* INFRINGES ON USER NAME SPACE */
432# endif
433# endif
434# endif
435#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
436
437
438#if (! defined yyoverflow \
439 && (! defined __cplusplus \
440 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
441
442/* A type that is properly aligned for any stack member. */
443union yyalloc
444{
kbr@chromium.org205fef32011-11-22 20:50:02 +0000445 yytype_int16 yyss_alloc;
446 YYSTYPE yyvs_alloc;
447};
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000448
449/* The size of the maximum gap between one aligned stack and the next. */
450# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
451
452/* The size of an array large to enough to hold all stacks, each with
453 N elements. */
454# define YYSTACK_BYTES(N) \
455 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
456 + YYSTACK_GAP_MAXIMUM)
457
458/* Copy COUNT objects from FROM to TO. The source and destination do
459 not overlap. */
460# ifndef YYCOPY
461# if defined __GNUC__ && 1 < __GNUC__
462# define YYCOPY(To, From, Count) \
463 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
464# else
465# define YYCOPY(To, From, Count) \
466 do \
467 { \
468 YYSIZE_T yyi; \
469 for (yyi = 0; yyi < (Count); yyi++) \
470 (To)[yyi] = (From)[yyi]; \
471 } \
472 while (YYID (0))
473# endif
474# endif
475
476/* Relocate STACK from its old location to the new one. The
477 local variables YYSIZE and YYSTACKSIZE give the old and new number of
478 elements in the stack, and YYPTR gives the new location of the
479 stack. Advance YYPTR to a properly aligned location for the next
480 stack. */
kbr@chromium.org205fef32011-11-22 20:50:02 +0000481# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000482 do \
483 { \
484 YYSIZE_T yynewbytes; \
kbr@chromium.org205fef32011-11-22 20:50:02 +0000485 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
486 Stack = &yyptr->Stack_alloc; \
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000487 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
488 yyptr += yynewbytes / sizeof (*yyptr); \
489 } \
490 while (YYID (0))
491
492#endif
493
494/* YYFINAL -- State number of the termination state. */
kbr@chromium.org205fef32011-11-22 20:50:02 +0000495#define YYFINAL 71
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000496/* YYLAST -- Last index in YYTABLE. */
kbr@chromium.org205fef32011-11-22 20:50:02 +0000497#define YYLAST 1370
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000498
499/* YYNTOKENS -- Number of terminals. */
kbr@chromium.org205fef32011-11-22 20:50:02 +0000500#define YYNTOKENS 96
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000501/* YYNNTS -- Number of nonterminals. */
kbr@chromium.org476541f2011-10-27 21:14:51 +0000502#define YYNNTS 80
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000503/* YYNRULES -- Number of rules. */
kbr@chromium.org205fef32011-11-22 20:50:02 +0000504#define YYNRULES 197
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000505/* YYNRULES -- Number of states. */
kbr@chromium.org205fef32011-11-22 20:50:02 +0000506#define YYNSTATES 300
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000507
508/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
509#define YYUNDEFTOK 2
kbr@chromium.org205fef32011-11-22 20:50:02 +0000510#define YYMAXUTOK 350
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000511
512#define YYTRANSLATE(YYX) \
513 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
514
515/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
516static const yytype_uint8 yytranslate[] =
517{
518 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
519 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
520 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
521 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
522 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
523 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
524 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
525 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
526 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
527 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
528 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
529 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
530 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
531 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
532 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
533 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
534 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
535 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
536 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
537 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
538 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
539 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
540 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
541 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
542 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
543 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
544 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
545 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
546 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
547 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
548 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
549 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
550 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
551 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000552 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
553 95
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000554};
555
556#if YYDEBUG
557/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
558 YYRHS. */
559static const yytype_uint16 yyprhs[] =
560{
561 0, 0, 3, 5, 7, 9, 11, 13, 17, 19,
562 24, 26, 30, 33, 36, 38, 40, 42, 46, 49,
563 52, 55, 57, 60, 64, 67, 69, 71, 73, 75,
564 78, 81, 84, 86, 88, 90, 92, 96, 100, 102,
565 106, 110, 112, 114, 118, 122, 126, 130, 132, 136,
566 140, 142, 144, 146, 148, 152, 154, 158, 160, 164,
567 166, 172, 174, 178, 180, 182, 184, 186, 188, 190,
568 194, 196, 199, 202, 207, 210, 212, 214, 217, 221,
569 225, 228, 234, 238, 241, 245, 248, 249, 251, 253,
570 255, 257, 259, 263, 269, 276, 282, 284, 287, 292,
571 298, 303, 306, 308, 311, 313, 315, 317, 320, 322,
572 324, 327, 329, 331, 333, 335, 340, 342, 344, 346,
573 348, 350, 352, 354, 356, 358, 360, 362, 364, 366,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000574 368, 370, 372, 374, 376, 378, 380, 382, 384, 385,
575 392, 393, 399, 401, 404, 408, 410, 414, 416, 421,
576 423, 425, 427, 429, 431, 433, 435, 437, 439, 442,
577 443, 444, 450, 452, 454, 457, 461, 463, 466, 468,
578 471, 477, 481, 483, 485, 490, 491, 498, 499, 508,
579 509, 517, 519, 521, 523, 524, 527, 531, 534, 537,
580 540, 544, 547, 549, 552, 554, 556, 557
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000581};
582
583/* YYRHS -- A `-1'-separated list of the rules' RHS. */
584static const yytype_int16 yyrhs[] =
585{
kbr@chromium.org205fef32011-11-22 20:50:02 +0000586 172, 0, -1, 45, -1, 97, -1, 48, -1, 47,
587 -1, 49, -1, 72, 124, 73, -1, 98, -1, 99,
588 74, 100, 75, -1, 101, -1, 99, 78, 50, -1,
589 99, 53, -1, 99, 54, -1, 124, -1, 102, -1,
590 103, -1, 99, 78, 103, -1, 105, 73, -1, 104,
591 73, -1, 106, 39, -1, 106, -1, 106, 122, -1,
592 105, 79, 122, -1, 107, 72, -1, 142, -1, 45,
593 -1, 50, -1, 99, -1, 53, 108, -1, 54, 108,
594 -1, 109, 108, -1, 86, -1, 84, -1, 83, -1,
595 108, -1, 110, 87, 108, -1, 110, 88, 108, -1,
596 110, -1, 111, 86, 110, -1, 111, 84, 110, -1,
597 111, -1, 112, -1, 113, 90, 112, -1, 113, 91,
598 112, -1, 113, 55, 112, -1, 113, 56, 112, -1,
599 113, -1, 114, 57, 113, -1, 114, 58, 113, -1,
600 114, -1, 115, -1, 116, -1, 117, -1, 118, 59,
601 117, -1, 118, -1, 119, 61, 118, -1, 119, -1,
602 120, 60, 119, -1, 120, -1, 120, 95, 124, 80,
603 122, -1, 121, -1, 108, 123, 122, -1, 81, -1,
604 62, -1, 63, -1, 64, -1, 71, -1, 122, -1,
605 124, 79, 122, -1, 121, -1, 127, 82, -1, 135,
606 82, -1, 7, 140, 141, 82, -1, 128, 73, -1,
607 130, -1, 129, -1, 130, 132, -1, 129, 79, 132,
608 -1, 137, 45, 72, -1, 139, 45, -1, 139, 45,
609 74, 125, 75, -1, 138, 133, 131, -1, 133, 131,
610 -1, 138, 133, 134, -1, 133, 134, -1, -1, 33,
611 -1, 34, -1, 35, -1, 139, -1, 136, -1, 135,
612 79, 45, -1, 135, 79, 45, 74, 75, -1, 135,
613 79, 45, 74, 125, 75, -1, 135, 79, 45, 81,
614 150, -1, 137, -1, 137, 45, -1, 137, 45, 74,
615 75, -1, 137, 45, 74, 125, 75, -1, 137, 45,
616 81, 150, -1, 3, 45, -1, 139, -1, 138, 139,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000617 -1, 9, -1, 8, -1, 37, -1, 3, 37, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000618 36, -1, 141, -1, 140, 141, -1, 4, -1, 5,
619 -1, 6, -1, 142, -1, 142, 74, 125, 75, -1,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000620 39, -1, 11, -1, 12, -1, 10, -1, 27, -1,
621 28, -1, 29, -1, 21, -1, 22, -1, 23, -1,
622 24, -1, 25, -1, 26, -1, 30, -1, 31, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000623 32, -1, 41, -1, 42, -1, 43, -1, 44, -1,
624 143, -1, 46, -1, -1, 38, 45, 76, 144, 146,
625 77, -1, -1, 38, 76, 145, 146, 77, -1, 147,
626 -1, 146, 147, -1, 139, 148, 82, -1, 149, -1,
627 148, 79, 149, -1, 45, -1, 45, 74, 125, 75,
628 -1, 122, -1, 126, -1, 154, -1, 153, -1, 151,
629 -1, 160, -1, 161, -1, 164, -1, 171, -1, 76,
630 77, -1, -1, -1, 76, 155, 159, 156, 77, -1,
631 158, -1, 153, -1, 76, 77, -1, 76, 159, 77,
632 -1, 152, -1, 159, 152, -1, 82, -1, 124, 82,
633 -1, 18, 72, 124, 73, 162, -1, 152, 16, 152,
634 -1, 152, -1, 124, -1, 137, 45, 81, 150, -1,
635 -1, 40, 72, 165, 163, 73, 157, -1, -1, 15,
636 166, 152, 40, 72, 124, 73, 82, -1, -1, 17,
637 72, 167, 168, 170, 73, 157, -1, 160, -1, 151,
638 -1, 163, -1, -1, 169, 82, -1, 169, 82, 124,
639 -1, 14, 82, -1, 13, 82, -1, 20, 82, -1,
640 20, 124, 82, -1, 19, 82, -1, 173, -1, 172,
641 173, -1, 174, -1, 126, -1, -1, 127, 175, 158,
642 -1
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000643};
644
645/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
646static const yytype_uint16 yyrline[] =
647{
648 0, 153, 153, 188, 191, 204, 209, 214, 220, 223,
649 296, 299, 408, 418, 431, 439, 538, 541, 549, 553,
zmo@google.comdc4b4f82011-06-17 00:42:53 +0000650 560, 564, 571, 577, 586, 594, 649, 656, 666, 669,
651 679, 689, 710, 711, 712, 717, 718, 727, 739, 740,
652 748, 759, 763, 764, 774, 784, 794, 807, 808, 818,
653 831, 835, 839, 843, 844, 857, 858, 871, 872, 885,
654 886, 903, 904, 917, 918, 919, 920, 921, 925, 928,
655 939, 947, 972, 977, 984, 1020, 1023, 1030, 1038, 1059,
656 1078, 1089, 1118, 1123, 1133, 1138, 1148, 1151, 1154, 1157,
657 1163, 1170, 1173, 1189, 1207, 1231, 1254, 1258, 1276, 1284,
658 1316, 1336, 1412, 1421, 1444, 1447, 1453, 1461, 1469, 1477,
659 1487, 1494, 1497, 1500, 1506, 1509, 1524, 1528, 1532, 1536,
660 1545, 1550, 1555, 1560, 1565, 1570, 1575, 1580, 1585, 1590,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000661 1596, 1602, 1608, 1613, 1618, 1627, 1636, 1641, 1654, 1654,
662 1668, 1668, 1677, 1680, 1695, 1731, 1735, 1741, 1749, 1765,
663 1769, 1773, 1774, 1780, 1781, 1782, 1783, 1784, 1788, 1789,
664 1789, 1789, 1799, 1800, 1805, 1808, 1818, 1821, 1827, 1828,
665 1832, 1840, 1844, 1854, 1859, 1876, 1876, 1881, 1881, 1888,
666 1888, 1896, 1899, 1905, 1908, 1914, 1918, 1925, 1932, 1939,
667 1946, 1957, 1966, 1970, 1977, 1980, 1986, 1986
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000668};
669#endif
670
671#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
672/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
673 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
674static const char *const yytname[] =
675{
676 "$end", "error", "$undefined", "INVARIANT", "HIGH_PRECISION",
677 "MEDIUM_PRECISION", "LOW_PRECISION", "PRECISION", "ATTRIBUTE",
678 "CONST_QUAL", "BOOL_TYPE", "FLOAT_TYPE", "INT_TYPE", "BREAK", "CONTINUE",
679 "DO", "ELSE", "FOR", "IF", "DISCARD", "RETURN", "BVEC2", "BVEC3",
680 "BVEC4", "IVEC2", "IVEC3", "IVEC4", "VEC2", "VEC3", "VEC4", "MATRIX2",
681 "MATRIX3", "MATRIX4", "IN_QUAL", "OUT_QUAL", "INOUT_QUAL", "UNIFORM",
682 "VARYING", "STRUCT", "VOID_TYPE", "WHILE", "SAMPLER2D", "SAMPLERCUBE",
kbr@chromium.org205fef32011-11-22 20:50:02 +0000683 "SAMPLER_EXTERNAL_OES", "SAMPLER2DRECT", "IDENTIFIER", "TYPE_NAME",
684 "FLOATCONSTANT", "INTCONSTANT", "BOOLCONSTANT", "FIELD_SELECTION",
685 "LEFT_OP", "RIGHT_OP", "INC_OP", "DEC_OP", "LE_OP", "GE_OP", "EQ_OP",
686 "NE_OP", "AND_OP", "OR_OP", "XOR_OP", "MUL_ASSIGN", "DIV_ASSIGN",
687 "ADD_ASSIGN", "MOD_ASSIGN", "LEFT_ASSIGN", "RIGHT_ASSIGN", "AND_ASSIGN",
688 "XOR_ASSIGN", "OR_ASSIGN", "SUB_ASSIGN", "LEFT_PAREN", "RIGHT_PAREN",
689 "LEFT_BRACKET", "RIGHT_BRACKET", "LEFT_BRACE", "RIGHT_BRACE", "DOT",
690 "COMMA", "COLON", "EQUAL", "SEMICOLON", "BANG", "DASH", "TILDE", "PLUS",
691 "STAR", "SLASH", "PERCENT", "LEFT_ANGLE", "RIGHT_ANGLE", "VERTICAL_BAR",
692 "CARET", "AMPERSAND", "QUESTION", "$accept", "variable_identifier",
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000693 "primary_expression", "postfix_expression", "integer_expression",
694 "function_call", "function_call_or_method", "function_call_generic",
695 "function_call_header_no_parameters",
696 "function_call_header_with_parameters", "function_call_header",
697 "function_identifier", "unary_expression", "unary_operator",
698 "multiplicative_expression", "additive_expression", "shift_expression",
699 "relational_expression", "equality_expression", "and_expression",
700 "exclusive_or_expression", "inclusive_or_expression",
701 "logical_and_expression", "logical_xor_expression",
702 "logical_or_expression", "conditional_expression",
703 "assignment_expression", "assignment_operator", "expression",
704 "constant_expression", "declaration", "function_prototype",
705 "function_declarator", "function_header_with_parameters",
706 "function_header", "parameter_declarator", "parameter_declaration",
707 "parameter_qualifier", "parameter_type_specifier",
708 "init_declarator_list", "single_declaration", "fully_specified_type",
709 "type_qualifier", "type_specifier", "precision_qualifier",
710 "type_specifier_no_prec", "type_specifier_nonarray", "struct_specifier",
kbr@chromium.org205fef32011-11-22 20:50:02 +0000711 "$@1", "$@2", "struct_declaration_list", "struct_declaration",
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000712 "struct_declarator_list", "struct_declarator", "initializer",
713 "declaration_statement", "statement", "simple_statement",
kbr@chromium.org205fef32011-11-22 20:50:02 +0000714 "compound_statement", "$@3", "$@4", "statement_no_new_scope",
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000715 "compound_statement_no_new_scope", "statement_list",
716 "expression_statement", "selection_statement",
kbr@chromium.org205fef32011-11-22 20:50:02 +0000717 "selection_rest_statement", "condition", "iteration_statement", "$@5",
718 "$@6", "$@7", "for_init_statement", "conditionopt", "for_rest_statement",
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000719 "jump_statement", "translation_unit", "external_declaration",
kbr@chromium.org205fef32011-11-22 20:50:02 +0000720 "function_definition", "$@8", 0
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000721};
722#endif
723
724# ifdef YYPRINT
725/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
726 token YYLEX-NUM. */
727static const yytype_uint16 yytoknum[] =
728{
729 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
730 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
731 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
732 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
733 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
734 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
735 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
736 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
737 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000738 345, 346, 347, 348, 349, 350
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000739};
740# endif
741
742/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
743static const yytype_uint8 yyr1[] =
744{
kbr@chromium.org205fef32011-11-22 20:50:02 +0000745 0, 96, 97, 98, 98, 98, 98, 98, 99, 99,
746 99, 99, 99, 99, 100, 101, 102, 102, 103, 103,
747 104, 104, 105, 105, 106, 107, 107, 107, 108, 108,
748 108, 108, 109, 109, 109, 110, 110, 110, 111, 111,
749 111, 112, 113, 113, 113, 113, 113, 114, 114, 114,
750 115, 116, 117, 118, 118, 119, 119, 120, 120, 121,
751 121, 122, 122, 123, 123, 123, 123, 123, 124, 124,
752 125, 126, 126, 126, 127, 128, 128, 129, 129, 130,
753 131, 131, 132, 132, 132, 132, 133, 133, 133, 133,
754 134, 135, 135, 135, 135, 135, 136, 136, 136, 136,
755 136, 136, 137, 137, 138, 138, 138, 138, 138, 139,
756 139, 140, 140, 140, 141, 141, 142, 142, 142, 142,
757 142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
758 142, 142, 142, 142, 142, 142, 142, 142, 144, 143,
759 145, 143, 146, 146, 147, 148, 148, 149, 149, 150,
760 151, 152, 152, 153, 153, 153, 153, 153, 154, 155,
761 156, 154, 157, 157, 158, 158, 159, 159, 160, 160,
762 161, 162, 162, 163, 163, 165, 164, 166, 164, 167,
763 164, 168, 168, 169, 169, 170, 170, 171, 171, 171,
764 171, 171, 172, 172, 173, 173, 175, 174
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000765};
766
767/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
768static const yytype_uint8 yyr2[] =
769{
770 0, 2, 1, 1, 1, 1, 1, 3, 1, 4,
771 1, 3, 2, 2, 1, 1, 1, 3, 2, 2,
772 2, 1, 2, 3, 2, 1, 1, 1, 1, 2,
773 2, 2, 1, 1, 1, 1, 3, 3, 1, 3,
774 3, 1, 1, 3, 3, 3, 3, 1, 3, 3,
775 1, 1, 1, 1, 3, 1, 3, 1, 3, 1,
776 5, 1, 3, 1, 1, 1, 1, 1, 1, 3,
777 1, 2, 2, 4, 2, 1, 1, 2, 3, 3,
778 2, 5, 3, 2, 3, 2, 0, 1, 1, 1,
779 1, 1, 3, 5, 6, 5, 1, 2, 4, 5,
780 4, 2, 1, 2, 1, 1, 1, 2, 1, 1,
781 2, 1, 1, 1, 1, 4, 1, 1, 1, 1,
782 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000783 1, 1, 1, 1, 1, 1, 1, 1, 0, 6,
784 0, 5, 1, 2, 3, 1, 3, 1, 4, 1,
785 1, 1, 1, 1, 1, 1, 1, 1, 2, 0,
786 0, 5, 1, 1, 2, 3, 1, 2, 1, 2,
787 5, 3, 1, 1, 4, 0, 6, 0, 8, 0,
788 7, 1, 1, 1, 0, 2, 3, 2, 2, 2,
789 3, 2, 1, 2, 1, 1, 0, 3
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000790};
791
792/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
793 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
794 means the default is an error. */
795static const yytype_uint8 yydefact[] =
796{
797 0, 0, 111, 112, 113, 0, 105, 104, 119, 117,
798 118, 123, 124, 125, 126, 127, 128, 120, 121, 122,
zmo@google.com09c323a2011-08-12 18:22:25 +0000799 129, 130, 131, 108, 106, 0, 116, 132, 133, 134,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000800 135, 137, 195, 196, 0, 76, 86, 0, 91, 96,
801 0, 102, 0, 109, 114, 136, 0, 192, 194, 107,
802 101, 0, 0, 140, 71, 0, 74, 86, 0, 87,
803 88, 89, 77, 0, 86, 0, 72, 97, 103, 110,
804 0, 1, 193, 0, 138, 0, 0, 197, 78, 83,
805 85, 90, 0, 92, 79, 0, 0, 2, 5, 4,
806 6, 27, 0, 0, 0, 34, 33, 32, 3, 8,
807 28, 10, 15, 16, 0, 0, 21, 0, 35, 0,
808 38, 41, 42, 47, 50, 51, 52, 53, 55, 57,
809 59, 70, 0, 25, 73, 0, 0, 0, 142, 0,
810 0, 177, 0, 0, 0, 0, 0, 159, 164, 168,
811 35, 61, 68, 0, 150, 0, 114, 153, 166, 152,
812 151, 0, 154, 155, 156, 157, 80, 82, 84, 0,
813 0, 98, 0, 149, 100, 29, 30, 0, 12, 13,
814 0, 0, 19, 18, 0, 20, 22, 24, 31, 0,
kbr@chromium.org476541f2011-10-27 21:14:51 +0000815 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000816 0, 0, 0, 115, 0, 147, 0, 145, 141, 143,
817 188, 187, 0, 179, 0, 191, 189, 0, 175, 158,
818 0, 64, 65, 66, 67, 63, 0, 0, 169, 165,
819 167, 0, 93, 0, 95, 99, 7, 0, 14, 26,
820 11, 17, 23, 36, 37, 40, 39, 45, 46, 43,
821 44, 48, 49, 54, 56, 58, 0, 139, 0, 0,
822 144, 0, 0, 0, 190, 0, 160, 62, 69, 0,
823 94, 9, 0, 0, 146, 0, 182, 181, 184, 0,
824 173, 0, 0, 0, 81, 60, 148, 0, 183, 0,
825 0, 172, 170, 0, 0, 161, 0, 185, 0, 0,
826 0, 163, 176, 162, 0, 186, 180, 171, 174, 178
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000827};
828
829/* YYDEFGOTO[NTERM-NUM]. */
830static const yytype_int16 yydefgoto[] =
831{
kbr@chromium.org205fef32011-11-22 20:50:02 +0000832 -1, 98, 99, 100, 227, 101, 102, 103, 104, 105,
833 106, 107, 140, 109, 110, 111, 112, 113, 114, 115,
834 116, 117, 118, 119, 120, 141, 142, 216, 143, 122,
835 144, 145, 34, 35, 36, 79, 62, 63, 80, 37,
836 38, 39, 40, 41, 42, 43, 123, 45, 125, 75,
837 127, 128, 196, 197, 164, 147, 148, 149, 150, 210,
838 273, 292, 293, 151, 152, 153, 282, 272, 154, 255,
839 202, 252, 268, 279, 280, 155, 46, 47, 48, 55
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000840};
841
842/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
843 STATE-NUM. */
kbr@chromium.org205fef32011-11-22 20:50:02 +0000844#define YYPACT_NINF -251
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000845static const yytype_int16 yypact[] =
846{
kbr@chromium.org205fef32011-11-22 20:50:02 +0000847 1250, -17, -251, -251, -251, 113, -251, -251, -251, -251,
848 -251, -251, -251, -251, -251, -251, -251, -251, -251, -251,
849 -251, -251, -251, -251, -251, -39, -251, -251, -251, -251,
850 -251, -251, -251, -65, -34, -10, 21, -32, -251, 28,
851 207, -251, 1324, -251, 56, -251, 1206, -251, -251, -251,
852 -251, 1324, 74, -251, -251, 86, -251, 71, 95, -251,
853 -251, -251, -251, 207, 119, 120, -251, -56, -251, -251,
854 971, -251, -251, 84, -251, 207, 287, -251, -251, -251,
855 -251, 124, 207, -59, -251, 773, 971, 98, -251, -251,
856 -251, -251, 971, 971, 971, -251, -251, -251, -251, -251,
857 35, -251, -251, -251, 100, -9, 1037, 102, -251, 971,
858 -27, -1, -251, -24, 99, -251, -251, -251, 112, 111,
859 -51, -251, 103, -251, -251, 207, 135, 1106, -251, 101,
860 104, -251, 109, 115, 106, 839, 117, 107, -251, -251,
861 39, -251, -251, -11, -251, -65, 54, -251, -251, -251,
862 -251, 371, -251, -251, -251, -251, 116, -251, -251, 905,
863 971, -251, 118, -251, -251, -251, -251, 8, -251, -251,
864 971, 1287, -251, -251, 971, 125, -251, -251, -251, 971,
865 971, 971, 971, 971, 971, 971, 971, 971, 971, 971,
866 971, 971, 971, -251, 1149, 122, 17, -251, -251, -251,
867 -251, -251, 455, -251, 971, -251, -251, 32, -251, -251,
868 455, -251, -251, -251, -251, -251, 971, 971, -251, -251,
869 -251, 971, -251, 123, -251, -251, -251, 126, 121, -251,
870 127, -251, -251, -251, -251, -27, -27, -251, -251, -251,
871 -251, -24, -24, -251, 112, 111, 79, -251, 971, 135,
872 -251, 151, 623, 11, -251, 707, 455, -251, -251, 128,
873 -251, -251, 971, 130, -251, 134, -251, -251, 707, 455,
874 121, 147, 136, 131, -251, -251, -251, 971, -251, 132,
875 142, 200, -251, 139, 539, -251, 19, 971, 539, 455,
876 971, -251, -251, -251, 140, 121, -251, -251, -251, -251
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000877};
878
879/* YYPGOTO[NTERM-NUM]. */
880static const yytype_int16 yypgoto[] =
881{
kbr@chromium.org205fef32011-11-22 20:50:02 +0000882 -251, -251, -251, -251, -251, -251, -251, 50, -251, -251,
883 -251, -251, -44, -251, -21, -251, -62, -20, -251, -251,
884 -251, 34, 36, 33, -251, -66, -83, -251, -92, -73,
885 7, 13, -251, -251, -251, 143, 170, 176, 159, -251,
886 -251, -247, -22, -30, 237, -15, 0, -251, -251, -251,
887 129, -122, -251, -6, -159, -8, -140, -250, -251, -251,
888 -251, -41, 202, 48, 9, -251, -251, -5, -251, -251,
889 -251, -251, -251, -251, -251, -251, -251, 213, -251, -251
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000890};
891
892/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
893 positive, shift that token. If negative, reduce the rule which
894 number is the opposite. If zero, do what YYDEFACT says.
895 If YYTABLE_NINF, syntax error. */
zmo@google.comdc4b4f82011-06-17 00:42:53 +0000896#define YYTABLE_NINF -117
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000897static const yytype_int16 yytable[] =
898{
kbr@chromium.org205fef32011-11-22 20:50:02 +0000899 44, 224, 167, 163, 121, 199, 52, 32, 271, 191,
900 68, 220, 162, 33, 64, 159, 84, 54, 85, 121,
901 49, 271, 160, 176, 58, 86, 108, 69, 50, 6,
902 7, 183, 184, 81, 291, 64, 73, 53, 291, 56,
903 44, 108, 44, 207, 192, 126, 44, 65, 165, 166,
904 66, 44, 81, 32, 59, 60, 61, 23, 24, 33,
905 179, 180, 251, 44, 173, 178, 185, 186, 217, 57,
906 174, 218, 199, 67, 58, 44, 146, 163, 228, 6,
907 7, 226, 44, 181, 269, 182, 223, 217, 168, 169,
908 217, 232, 294, 121, -75, 126, 249, 126, 217, 250,
909 246, 211, 212, 213, 59, 60, 61, 23, 24, 170,
910 214, 217, 253, 171, 254, 108, 220, 2, 3, 4,
911 215, 237, 238, 239, 240, 44, -25, 44, 70, 281,
912 70, 298, 49, 257, 258, 233, 234, 108, 108, 108,
913 108, 108, 108, 108, 108, 108, 108, 108, 259, 297,
914 74, 146, 59, 60, 61, 121, 187, 188, 217, 262,
915 235, 236, 76, 270, 126, 83, 124, 241, 242, 156,
916 -26, 189, 190, 172, 177, 263, 270, 108, 193, 275,
917 195, 203, 121, 200, 209, 286, 201, 204, 205, 208,
918 221, 265, 283, 225, 44, 295, 248, -116, 260, -27,
919 217, 261, 146, 274, 108, 276, 277, 163, 285, 284,
920 146, 2, 3, 4, 287, 288, 289, 8, 9, 10,
921 290, 231, 299, 243, 245, 157, 244, 78, 11, 12,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000922 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000923 82, 158, 51, 264, 266, 25, 26, 296, 27, 28,
924 29, 30, 146, 31, 194, 146, 146, 77, 256, 72,
925 0, 267, 0, 278, 0, 0, 0, 0, 146, 146,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000926 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000927 0, 0, 0, 0, 146, 0, 0, 0, 146, 146,
928 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
929 129, 130, 131, 0, 132, 133, 134, 135, 11, 12,
930 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
931 0, 0, 0, 23, 24, 25, 26, 136, 27, 28,
932 29, 30, 87, 31, 88, 89, 90, 91, 0, 0,
933 92, 93, 0, 0, 0, 0, 0, 0, 0, 0,
934 0, 0, 0, 0, 0, 0, 0, 0, 0, 94,
935 0, 0, 0, 137, 138, 0, 0, 0, 0, 139,
936 95, 96, 0, 97, 1, 2, 3, 4, 5, 6,
937 7, 8, 9, 10, 129, 130, 131, 0, 132, 133,
938 134, 135, 11, 12, 13, 14, 15, 16, 17, 18,
kbr@chromium.org476541f2011-10-27 21:14:51 +0000939 19, 20, 21, 22, 0, 0, 0, 23, 24, 25,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000940 26, 136, 27, 28, 29, 30, 87, 31, 88, 89,
941 90, 91, 0, 0, 92, 93, 0, 0, 0, 0,
kbr@chromium.org476541f2011-10-27 21:14:51 +0000942 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000943 0, 0, 0, 94, 0, 0, 0, 137, 219, 0,
944 0, 0, 0, 139, 95, 96, 0, 97, 1, 2,
945 3, 4, 5, 6, 7, 8, 9, 10, 129, 130,
946 131, 0, 132, 133, 134, 135, 11, 12, 13, 14,
947 15, 16, 17, 18, 19, 20, 21, 22, 0, 0,
948 0, 23, 24, 25, 26, 136, 27, 28, 29, 30,
949 87, 31, 88, 89, 90, 91, 0, 0, 92, 93,
kbr@chromium.org476541f2011-10-27 21:14:51 +0000950 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000951 0, 0, 0, 0, 0, 0, 0, 94, 0, 0,
952 0, 137, 0, 0, 0, 0, 0, 139, 95, 96,
953 0, 97, 1, 2, 3, 4, 5, 6, 7, 8,
954 9, 10, 129, 130, 131, 0, 132, 133, 134, 135,
955 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
956 21, 22, 0, 0, 0, 23, 24, 25, 26, 136,
957 27, 28, 29, 30, 87, 31, 88, 89, 90, 91,
958 0, 0, 92, 93, 0, 0, 0, 0, 0, 0,
959 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
960 0, 94, 0, 0, 0, 76, 0, 0, 0, 0,
961 0, 139, 95, 96, 0, 97, 1, 2, 3, 4,
962 5, 6, 7, 8, 9, 10, 0, 0, 0, 0,
963 0, 0, 0, 0, 11, 12, 13, 14, 15, 16,
964 17, 18, 19, 20, 21, 22, 0, 0, 0, 23,
965 24, 25, 26, 0, 27, 28, 29, 30, 87, 31,
966 88, 89, 90, 91, 0, 0, 92, 93, 0, 0,
967 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
968 0, 0, 0, 0, 0, 94, 0, 0, 0, 0,
969 0, 0, 0, 0, 0, 139, 95, 96, 0, 97,
970 58, 2, 3, 4, 0, 6, 7, 8, 9, 10,
971 0, 0, 0, 0, 0, 0, 0, 0, 11, 12,
972 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
973 0, 0, 0, 23, 24, 25, 26, 0, 27, 28,
974 29, 30, 87, 31, 88, 89, 90, 91, 0, 0,
975 92, 93, 0, 0, 0, 0, 0, 0, 0, 0,
976 0, 0, 0, 0, 0, 0, 0, 0, 0, 94,
977 0, 0, 0, 8, 9, 10, 0, 0, 0, 0,
978 95, 96, 0, 97, 11, 12, 13, 14, 15, 16,
979 17, 18, 19, 20, 21, 22, 0, 0, 0, 0,
980 0, 25, 26, 0, 27, 28, 29, 30, 87, 31,
981 88, 89, 90, 91, 0, 0, 92, 93, 0, 0,
982 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
983 0, 0, 0, 0, 0, 94, 0, 0, 161, 8,
984 9, 10, 0, 0, 0, 0, 95, 96, 0, 97,
985 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
986 21, 22, 0, 0, 0, 0, 0, 25, 26, 0,
987 27, 28, 29, 30, 87, 31, 88, 89, 90, 91,
988 0, 0, 92, 93, 0, 0, 0, 0, 0, 0,
989 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
990 0, 94, 0, 0, 0, 8, 9, 10, 0, 0,
991 0, 206, 95, 96, 0, 97, 11, 12, 13, 14,
992 15, 16, 17, 18, 19, 20, 21, 22, 0, 0,
993 0, 0, 0, 25, 26, 0, 27, 28, 29, 30,
994 87, 31, 88, 89, 90, 91, 0, 0, 92, 93,
995 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
996 0, 0, 0, 0, 0, 0, 0, 94, 0, 0,
997 222, 8, 9, 10, 0, 0, 0, 0, 95, 96,
998 0, 97, 11, 12, 13, 14, 15, 16, 17, 18,
kbr@chromium.org476541f2011-10-27 21:14:51 +0000999 19, 20, 21, 22, 0, 0, 0, 0, 0, 25,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001000 26, 0, 27, 28, 29, 30, 87, 31, 88, 89,
1001 90, 91, 0, 0, 92, 93, 0, 0, 0, 0,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001002 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001003 0, 0, 0, 94, 0, 0, 0, 8, 9, 10,
1004 0, 0, 0, 0, 95, 96, 0, 97, 11, 12,
1005 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
1006 0, 0, 0, 0, 0, 25, 175, 0, 27, 28,
1007 29, 30, 87, 31, 88, 89, 90, 91, 0, 0,
1008 92, 93, 0, 0, 0, 0, 0, 0, 0, 0,
1009 0, 0, 0, 0, 0, 0, 0, 0, 0, 94,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001010 2, 3, 4, 0, 0, 0, 8, 9, 10, 0,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001011 95, 96, 0, 97, 0, 0, 0, 11, 12, 13,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001012 14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001013 0, 0, 0, 0, 25, 26, 0, 27, 28, 29,
1014 30, 0, 31, 2, 3, 4, 0, 0, 0, 8,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001015 9, 10, 0, 0, 0, 0, 0, 0, 0, 0,
1016 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001017 21, 22, 0, 198, 0, 0, 0, 25, 26, 0,
1018 27, 28, 29, 30, 0, 31, 0, 0, 0, 0,
1019 0, 0, 0, 0, 0, 0, 71, 0, 0, 1,
1020 2, 3, 4, 5, 6, 7, 8, 9, 10, 0,
1021 0, 0, 0, 0, 0, 0, 247, 11, 12, 13,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001022 14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001023 0, 0, 23, 24, 25, 26, 0, 27, 28, 29,
1024 30, 0, 31, 1, 2, 3, 4, 5, 6, 7,
1025 8, 9, 10, 0, 0, 0, 0, 0, 0, 0,
1026 0, 11, 12, 13, 14, 15, 16, 17, 18, 19,
1027 20, 21, 22, 0, 0, 0, 23, 24, 25, 26,
1028 0, 27, 28, 29, 30, 0, 31, 8, 9, 10,
1029 0, 0, 0, 0, 0, 0, 0, 0, 11, 12,
1030 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
1031 0, 0, 0, 0, 0, 25, 26, 0, 27, 28,
1032 29, 30, 229, 31, 8, 9, 10, 230, 0, 0,
1033 0, 0, 0, 0, 0, 11, 12, 13, 14, 15,
1034 16, 17, 18, 19, 20, 21, 22, 0, 0, 0,
1035 0, 0, 25, 26, 0, 27, 28, 29, 30, 0,
1036 31
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001037};
1038
1039static const yytype_int16 yycheck[] =
1040{
kbr@chromium.org205fef32011-11-22 20:50:02 +00001041 0, 160, 94, 86, 70, 127, 45, 0, 255, 60,
1042 40, 151, 85, 0, 36, 74, 72, 82, 74, 85,
1043 37, 268, 81, 106, 3, 81, 70, 42, 45, 8,
1044 9, 55, 56, 63, 284, 57, 51, 76, 288, 73,
1045 40, 85, 42, 135, 95, 75, 46, 79, 92, 93,
1046 82, 51, 82, 46, 33, 34, 35, 36, 37, 46,
1047 87, 88, 202, 63, 73, 109, 90, 91, 79, 79,
1048 79, 82, 194, 45, 3, 75, 76, 160, 170, 8,
1049 9, 73, 82, 84, 73, 86, 159, 79, 53, 54,
1050 79, 174, 73, 159, 73, 125, 79, 127, 79, 82,
1051 192, 62, 63, 64, 33, 34, 35, 36, 37, 74,
1052 71, 79, 204, 78, 82, 159, 256, 4, 5, 6,
1053 81, 183, 184, 185, 186, 125, 72, 127, 74, 269,
1054 74, 290, 37, 216, 217, 179, 180, 181, 182, 183,
1055 184, 185, 186, 187, 188, 189, 190, 191, 221, 289,
1056 76, 151, 33, 34, 35, 221, 57, 58, 79, 80,
1057 181, 182, 76, 255, 194, 45, 82, 187, 188, 45,
1058 72, 59, 61, 73, 72, 248, 268, 221, 75, 262,
1059 45, 72, 248, 82, 77, 277, 82, 72, 82, 72,
1060 74, 40, 45, 75, 194, 287, 74, 72, 75, 72,
1061 79, 75, 202, 75, 248, 75, 72, 290, 77, 73,
1062 210, 4, 5, 6, 82, 73, 16, 10, 11, 12,
1063 81, 171, 82, 189, 191, 82, 190, 57, 21, 22,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001064 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001065 64, 82, 5, 249, 252, 38, 39, 288, 41, 42,
1066 43, 44, 252, 46, 125, 255, 256, 55, 210, 46,
1067 -1, 252, -1, 268, -1, -1, -1, -1, 268, 269,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001068 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001069 -1, -1, -1, -1, 284, -1, -1, -1, 288, 289,
1070 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
1071 13, 14, 15, -1, 17, 18, 19, 20, 21, 22,
1072 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
1073 -1, -1, -1, 36, 37, 38, 39, 40, 41, 42,
1074 43, 44, 45, 46, 47, 48, 49, 50, -1, -1,
1075 53, 54, -1, -1, -1, -1, -1, -1, -1, -1,
1076 -1, -1, -1, -1, -1, -1, -1, -1, -1, 72,
1077 -1, -1, -1, 76, 77, -1, -1, -1, -1, 82,
1078 83, 84, -1, 86, 3, 4, 5, 6, 7, 8,
1079 9, 10, 11, 12, 13, 14, 15, -1, 17, 18,
1080 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
1081 29, 30, 31, 32, -1, -1, -1, 36, 37, 38,
1082 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
1083 49, 50, -1, -1, 53, 54, -1, -1, -1, -1,
zmo@google.com09c323a2011-08-12 18:22:25 +00001084 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001085 -1, -1, -1, 72, -1, -1, -1, 76, 77, -1,
1086 -1, -1, -1, 82, 83, 84, -1, 86, 3, 4,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001087 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1088 15, -1, 17, 18, 19, 20, 21, 22, 23, 24,
zmo@google.com09c323a2011-08-12 18:22:25 +00001089 25, 26, 27, 28, 29, 30, 31, 32, -1, -1,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001090 -1, 36, 37, 38, 39, 40, 41, 42, 43, 44,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001091 45, 46, 47, 48, 49, 50, -1, -1, 53, 54,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001092 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001093 -1, -1, -1, -1, -1, -1, -1, 72, -1, -1,
1094 -1, 76, -1, -1, -1, -1, -1, 82, 83, 84,
1095 -1, 86, 3, 4, 5, 6, 7, 8, 9, 10,
1096 11, 12, 13, 14, 15, -1, 17, 18, 19, 20,
1097 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
1098 31, 32, -1, -1, -1, 36, 37, 38, 39, 40,
1099 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
1100 -1, -1, 53, 54, -1, -1, -1, -1, -1, -1,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001101 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001102 -1, 72, -1, -1, -1, 76, -1, -1, -1, -1,
1103 -1, 82, 83, 84, -1, 86, 3, 4, 5, 6,
1104 7, 8, 9, 10, 11, 12, -1, -1, -1, -1,
1105 -1, -1, -1, -1, 21, 22, 23, 24, 25, 26,
1106 27, 28, 29, 30, 31, 32, -1, -1, -1, 36,
1107 37, 38, 39, -1, 41, 42, 43, 44, 45, 46,
1108 47, 48, 49, 50, -1, -1, 53, 54, -1, -1,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001109 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001110 -1, -1, -1, -1, -1, 72, -1, -1, -1, -1,
1111 -1, -1, -1, -1, -1, 82, 83, 84, -1, 86,
1112 3, 4, 5, 6, -1, 8, 9, 10, 11, 12,
1113 -1, -1, -1, -1, -1, -1, -1, -1, 21, 22,
1114 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
1115 -1, -1, -1, 36, 37, 38, 39, -1, 41, 42,
1116 43, 44, 45, 46, 47, 48, 49, 50, -1, -1,
1117 53, 54, -1, -1, -1, -1, -1, -1, -1, -1,
1118 -1, -1, -1, -1, -1, -1, -1, -1, -1, 72,
1119 -1, -1, -1, 10, 11, 12, -1, -1, -1, -1,
1120 83, 84, -1, 86, 21, 22, 23, 24, 25, 26,
1121 27, 28, 29, 30, 31, 32, -1, -1, -1, -1,
1122 -1, 38, 39, -1, 41, 42, 43, 44, 45, 46,
1123 47, 48, 49, 50, -1, -1, 53, 54, -1, -1,
1124 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1125 -1, -1, -1, -1, -1, 72, -1, -1, 75, 10,
1126 11, 12, -1, -1, -1, -1, 83, 84, -1, 86,
1127 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
1128 31, 32, -1, -1, -1, -1, -1, 38, 39, -1,
1129 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
1130 -1, -1, 53, 54, -1, -1, -1, -1, -1, -1,
1131 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1132 -1, 72, -1, -1, -1, 10, 11, 12, -1, -1,
1133 -1, 82, 83, 84, -1, 86, 21, 22, 23, 24,
1134 25, 26, 27, 28, 29, 30, 31, 32, -1, -1,
1135 -1, -1, -1, 38, 39, -1, 41, 42, 43, 44,
1136 45, 46, 47, 48, 49, 50, -1, -1, 53, 54,
1137 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1138 -1, -1, -1, -1, -1, -1, -1, 72, -1, -1,
1139 75, 10, 11, 12, -1, -1, -1, -1, 83, 84,
1140 -1, 86, 21, 22, 23, 24, 25, 26, 27, 28,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001141 29, 30, 31, 32, -1, -1, -1, -1, -1, 38,
1142 39, -1, 41, 42, 43, 44, 45, 46, 47, 48,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001143 49, 50, -1, -1, 53, 54, -1, -1, -1, -1,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001144 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001145 -1, -1, -1, 72, -1, -1, -1, 10, 11, 12,
1146 -1, -1, -1, -1, 83, 84, -1, 86, 21, 22,
1147 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
1148 -1, -1, -1, -1, -1, 38, 39, -1, 41, 42,
1149 43, 44, 45, 46, 47, 48, 49, 50, -1, -1,
1150 53, 54, -1, -1, -1, -1, -1, -1, -1, -1,
1151 -1, -1, -1, -1, -1, -1, -1, -1, -1, 72,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001152 4, 5, 6, -1, -1, -1, 10, 11, 12, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001153 83, 84, -1, 86, -1, -1, -1, 21, 22, 23,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001154 24, 25, 26, 27, 28, 29, 30, 31, 32, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001155 -1, -1, -1, -1, 38, 39, -1, 41, 42, 43,
1156 44, -1, 46, 4, 5, 6, -1, -1, -1, 10,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001157 11, 12, -1, -1, -1, -1, -1, -1, -1, -1,
1158 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001159 31, 32, -1, 77, -1, -1, -1, 38, 39, -1,
1160 41, 42, 43, 44, -1, 46, -1, -1, -1, -1,
1161 -1, -1, -1, -1, -1, -1, 0, -1, -1, 3,
1162 4, 5, 6, 7, 8, 9, 10, 11, 12, -1,
1163 -1, -1, -1, -1, -1, -1, 77, 21, 22, 23,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001164 24, 25, 26, 27, 28, 29, 30, 31, 32, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001165 -1, -1, 36, 37, 38, 39, -1, 41, 42, 43,
1166 44, -1, 46, 3, 4, 5, 6, 7, 8, 9,
1167 10, 11, 12, -1, -1, -1, -1, -1, -1, -1,
1168 -1, 21, 22, 23, 24, 25, 26, 27, 28, 29,
1169 30, 31, 32, -1, -1, -1, 36, 37, 38, 39,
1170 -1, 41, 42, 43, 44, -1, 46, 10, 11, 12,
1171 -1, -1, -1, -1, -1, -1, -1, -1, 21, 22,
1172 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
1173 -1, -1, -1, -1, -1, 38, 39, -1, 41, 42,
1174 43, 44, 45, 46, 10, 11, 12, 50, -1, -1,
1175 -1, -1, -1, -1, -1, 21, 22, 23, 24, 25,
1176 26, 27, 28, 29, 30, 31, 32, -1, -1, -1,
1177 -1, -1, 38, 39, -1, 41, 42, 43, 44, -1,
1178 46
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001179};
1180
1181/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
1182 symbol of state STATE-NUM. */
1183static const yytype_uint8 yystos[] =
1184{
1185 0, 3, 4, 5, 6, 7, 8, 9, 10, 11,
1186 12, 21, 22, 23, 24, 25, 26, 27, 28, 29,
zmo@google.com09c323a2011-08-12 18:22:25 +00001187 30, 31, 32, 36, 37, 38, 39, 41, 42, 43,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001188 44, 46, 126, 127, 128, 129, 130, 135, 136, 137,
1189 138, 139, 140, 141, 142, 143, 172, 173, 174, 37,
1190 45, 140, 45, 76, 82, 175, 73, 79, 3, 33,
1191 34, 35, 132, 133, 138, 79, 82, 45, 139, 141,
1192 74, 0, 173, 141, 76, 145, 76, 158, 132, 131,
1193 134, 139, 133, 45, 72, 74, 81, 45, 47, 48,
1194 49, 50, 53, 54, 72, 83, 84, 86, 97, 98,
1195 99, 101, 102, 103, 104, 105, 106, 107, 108, 109,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001196 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001197 120, 121, 125, 142, 82, 144, 139, 146, 147, 13,
1198 14, 15, 17, 18, 19, 20, 40, 76, 77, 82,
1199 108, 121, 122, 124, 126, 127, 142, 151, 152, 153,
1200 154, 159, 160, 161, 164, 171, 45, 131, 134, 74,
1201 81, 75, 125, 122, 150, 108, 108, 124, 53, 54,
1202 74, 78, 73, 73, 79, 39, 122, 72, 108, 87,
1203 88, 84, 86, 55, 56, 90, 91, 57, 58, 59,
1204 61, 60, 95, 75, 146, 45, 148, 149, 77, 147,
1205 82, 82, 166, 72, 72, 82, 82, 124, 72, 77,
1206 155, 62, 63, 64, 71, 81, 123, 79, 82, 77,
1207 152, 74, 75, 125, 150, 75, 73, 100, 124, 45,
1208 50, 103, 122, 108, 108, 110, 110, 112, 112, 112,
1209 112, 113, 113, 117, 118, 119, 124, 77, 74, 79,
1210 82, 152, 167, 124, 82, 165, 159, 122, 122, 125,
1211 75, 75, 80, 125, 149, 40, 151, 160, 168, 73,
1212 124, 137, 163, 156, 75, 122, 75, 72, 163, 169,
1213 170, 152, 162, 45, 73, 77, 124, 82, 73, 16,
1214 81, 153, 157, 158, 73, 124, 157, 152, 150, 82
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001215};
1216
1217#define yyerrok (yyerrstatus = 0)
1218#define yyclearin (yychar = YYEMPTY)
1219#define YYEMPTY (-2)
1220#define YYEOF 0
1221
1222#define YYACCEPT goto yyacceptlab
1223#define YYABORT goto yyabortlab
1224#define YYERROR goto yyerrorlab
1225
1226
1227/* Like YYERROR except do call yyerror. This remains here temporarily
1228 to ease the transition to the new meaning of YYERROR, for GCC.
1229 Once GCC version 2 has supplanted version 1, this can go. */
1230
1231#define YYFAIL goto yyerrlab
1232
1233#define YYRECOVERING() (!!yyerrstatus)
1234
1235#define YYBACKUP(Token, Value) \
1236do \
1237 if (yychar == YYEMPTY && yylen == 1) \
1238 { \
1239 yychar = (Token); \
1240 yylval = (Value); \
1241 yytoken = YYTRANSLATE (yychar); \
1242 YYPOPSTACK (1); \
1243 goto yybackup; \
1244 } \
1245 else \
1246 { \
1247 yyerror (context, YY_("syntax error: cannot back up")); \
1248 YYERROR; \
1249 } \
1250while (YYID (0))
1251
1252
1253#define YYTERROR 1
1254#define YYERRCODE 256
1255
1256
1257/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
1258 If N is 0, then set CURRENT to the empty location which ends
1259 the previous symbol: RHS[0] (always defined). */
1260
1261#define YYRHSLOC(Rhs, K) ((Rhs)[K])
1262#ifndef YYLLOC_DEFAULT
1263# define YYLLOC_DEFAULT(Current, Rhs, N) \
1264 do \
1265 if (YYID (N)) \
1266 { \
1267 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
1268 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
1269 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
1270 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
1271 } \
1272 else \
1273 { \
1274 (Current).first_line = (Current).last_line = \
1275 YYRHSLOC (Rhs, 0).last_line; \
1276 (Current).first_column = (Current).last_column = \
1277 YYRHSLOC (Rhs, 0).last_column; \
1278 } \
1279 while (YYID (0))
1280#endif
1281
1282
1283/* YY_LOCATION_PRINT -- Print the location on the stream.
1284 This macro was not mandated originally: define only if we know
1285 we won't break user code: when these are the locations we know. */
1286
1287#ifndef YY_LOCATION_PRINT
kbr@chromium.org205fef32011-11-22 20:50:02 +00001288# if YYLTYPE_IS_TRIVIAL
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001289# define YY_LOCATION_PRINT(File, Loc) \
1290 fprintf (File, "%d.%d-%d.%d", \
1291 (Loc).first_line, (Loc).first_column, \
1292 (Loc).last_line, (Loc).last_column)
1293# else
1294# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1295# endif
1296#endif
1297
1298
1299/* YYLEX -- calling `yylex' with the right arguments. */
1300
1301#ifdef YYLEX_PARAM
1302# define YYLEX yylex (&yylval, YYLEX_PARAM)
1303#else
1304# define YYLEX yylex (&yylval)
1305#endif
1306
1307/* Enable debugging if requested. */
1308#if YYDEBUG
1309
1310# ifndef YYFPRINTF
1311# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1312# define YYFPRINTF fprintf
1313# endif
1314
1315# define YYDPRINTF(Args) \
1316do { \
1317 if (yydebug) \
1318 YYFPRINTF Args; \
1319} while (YYID (0))
1320
1321# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
1322do { \
1323 if (yydebug) \
1324 { \
1325 YYFPRINTF (stderr, "%s ", Title); \
1326 yy_symbol_print (stderr, \
1327 Type, Value, context); \
1328 YYFPRINTF (stderr, "\n"); \
1329 } \
1330} while (YYID (0))
1331
1332
1333/*--------------------------------.
1334| Print this symbol on YYOUTPUT. |
1335`--------------------------------*/
1336
1337/*ARGSUSED*/
1338#if (defined __STDC__ || defined __C99__FUNC__ \
1339 || defined __cplusplus || defined _MSC_VER)
1340static void
1341yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, TParseContext* context)
1342#else
1343static void
1344yy_symbol_value_print (yyoutput, yytype, yyvaluep, context)
1345 FILE *yyoutput;
1346 int yytype;
1347 YYSTYPE const * const yyvaluep;
1348 TParseContext* context;
1349#endif
1350{
1351 if (!yyvaluep)
1352 return;
1353 YYUSE (context);
1354# ifdef YYPRINT
1355 if (yytype < YYNTOKENS)
1356 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1357# else
1358 YYUSE (yyoutput);
1359# endif
1360 switch (yytype)
1361 {
1362 default:
1363 break;
1364 }
1365}
1366
1367
1368/*--------------------------------.
1369| Print this symbol on YYOUTPUT. |
1370`--------------------------------*/
1371
1372#if (defined __STDC__ || defined __C99__FUNC__ \
1373 || defined __cplusplus || defined _MSC_VER)
1374static void
1375yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, TParseContext* context)
1376#else
1377static void
1378yy_symbol_print (yyoutput, yytype, yyvaluep, context)
1379 FILE *yyoutput;
1380 int yytype;
1381 YYSTYPE const * const yyvaluep;
1382 TParseContext* context;
1383#endif
1384{
1385 if (yytype < YYNTOKENS)
1386 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1387 else
1388 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1389
1390 yy_symbol_value_print (yyoutput, yytype, yyvaluep, context);
1391 YYFPRINTF (yyoutput, ")");
1392}
1393
1394/*------------------------------------------------------------------.
1395| yy_stack_print -- Print the state stack from its BOTTOM up to its |
1396| TOP (included). |
1397`------------------------------------------------------------------*/
1398
1399#if (defined __STDC__ || defined __C99__FUNC__ \
1400 || defined __cplusplus || defined _MSC_VER)
1401static void
kbr@chromium.org205fef32011-11-22 20:50:02 +00001402yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001403#else
1404static void
kbr@chromium.org205fef32011-11-22 20:50:02 +00001405yy_stack_print (yybottom, yytop)
1406 yytype_int16 *yybottom;
1407 yytype_int16 *yytop;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001408#endif
1409{
1410 YYFPRINTF (stderr, "Stack now");
kbr@chromium.org205fef32011-11-22 20:50:02 +00001411 for (; yybottom <= yytop; yybottom++)
1412 {
1413 int yybot = *yybottom;
1414 YYFPRINTF (stderr, " %d", yybot);
1415 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001416 YYFPRINTF (stderr, "\n");
1417}
1418
1419# define YY_STACK_PRINT(Bottom, Top) \
1420do { \
1421 if (yydebug) \
1422 yy_stack_print ((Bottom), (Top)); \
1423} while (YYID (0))
1424
1425
1426/*------------------------------------------------.
1427| Report that the YYRULE is going to be reduced. |
1428`------------------------------------------------*/
1429
1430#if (defined __STDC__ || defined __C99__FUNC__ \
1431 || defined __cplusplus || defined _MSC_VER)
1432static void
1433yy_reduce_print (YYSTYPE *yyvsp, int yyrule, TParseContext* context)
1434#else
1435static void
1436yy_reduce_print (yyvsp, yyrule, context)
1437 YYSTYPE *yyvsp;
1438 int yyrule;
1439 TParseContext* context;
1440#endif
1441{
1442 int yynrhs = yyr2[yyrule];
1443 int yyi;
1444 unsigned long int yylno = yyrline[yyrule];
1445 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1446 yyrule - 1, yylno);
1447 /* The symbols being reduced. */
1448 for (yyi = 0; yyi < yynrhs; yyi++)
1449 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00001450 YYFPRINTF (stderr, " $%d = ", yyi + 1);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001451 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1452 &(yyvsp[(yyi + 1) - (yynrhs)])
1453 , context);
kbr@chromium.org205fef32011-11-22 20:50:02 +00001454 YYFPRINTF (stderr, "\n");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001455 }
1456}
1457
1458# define YY_REDUCE_PRINT(Rule) \
1459do { \
1460 if (yydebug) \
1461 yy_reduce_print (yyvsp, Rule, context); \
1462} while (YYID (0))
1463
1464/* Nonzero means print parse trace. It is left uninitialized so that
1465 multiple parsers can coexist. */
1466int yydebug;
1467#else /* !YYDEBUG */
1468# define YYDPRINTF(Args)
1469# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1470# define YY_STACK_PRINT(Bottom, Top)
1471# define YY_REDUCE_PRINT(Rule)
1472#endif /* !YYDEBUG */
1473
1474
1475/* YYINITDEPTH -- initial size of the parser's stacks. */
1476#ifndef YYINITDEPTH
1477# define YYINITDEPTH 200
1478#endif
1479
1480/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1481 if the built-in stack extension method is used).
1482
1483 Do not make this value too large; the results are undefined if
1484 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1485 evaluated with infinite-precision integer arithmetic. */
1486
1487#ifndef YYMAXDEPTH
1488# define YYMAXDEPTH 10000
1489#endif
1490
1491
1492
1493#if YYERROR_VERBOSE
1494
1495# ifndef yystrlen
1496# if defined __GLIBC__ && defined _STRING_H
1497# define yystrlen strlen
1498# else
1499/* Return the length of YYSTR. */
1500#if (defined __STDC__ || defined __C99__FUNC__ \
1501 || defined __cplusplus || defined _MSC_VER)
1502static YYSIZE_T
1503yystrlen (const char *yystr)
1504#else
1505static YYSIZE_T
1506yystrlen (yystr)
1507 const char *yystr;
1508#endif
1509{
1510 YYSIZE_T yylen;
1511 for (yylen = 0; yystr[yylen]; yylen++)
1512 continue;
1513 return yylen;
1514}
1515# endif
1516# endif
1517
1518# ifndef yystpcpy
1519# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1520# define yystpcpy stpcpy
1521# else
1522/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1523 YYDEST. */
1524#if (defined __STDC__ || defined __C99__FUNC__ \
1525 || defined __cplusplus || defined _MSC_VER)
1526static char *
1527yystpcpy (char *yydest, const char *yysrc)
1528#else
1529static char *
1530yystpcpy (yydest, yysrc)
1531 char *yydest;
1532 const char *yysrc;
1533#endif
1534{
1535 char *yyd = yydest;
1536 const char *yys = yysrc;
1537
1538 while ((*yyd++ = *yys++) != '\0')
1539 continue;
1540
1541 return yyd - 1;
1542}
1543# endif
1544# endif
1545
1546# ifndef yytnamerr
1547/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1548 quotes and backslashes, so that it's suitable for yyerror. The
1549 heuristic is that double-quoting is unnecessary unless the string
1550 contains an apostrophe, a comma, or backslash (other than
1551 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1552 null, do not copy; instead, return the length of what the result
1553 would have been. */
1554static YYSIZE_T
1555yytnamerr (char *yyres, const char *yystr)
1556{
1557 if (*yystr == '"')
1558 {
1559 YYSIZE_T yyn = 0;
1560 char const *yyp = yystr;
1561
1562 for (;;)
1563 switch (*++yyp)
1564 {
1565 case '\'':
1566 case ',':
1567 goto do_not_strip_quotes;
1568
1569 case '\\':
1570 if (*++yyp != '\\')
1571 goto do_not_strip_quotes;
1572 /* Fall through. */
1573 default:
1574 if (yyres)
1575 yyres[yyn] = *yyp;
1576 yyn++;
1577 break;
1578
1579 case '"':
1580 if (yyres)
1581 yyres[yyn] = '\0';
1582 return yyn;
1583 }
1584 do_not_strip_quotes: ;
1585 }
1586
1587 if (! yyres)
1588 return yystrlen (yystr);
1589
1590 return yystpcpy (yyres, yystr) - yyres;
1591}
1592# endif
1593
1594/* Copy into YYRESULT an error message about the unexpected token
1595 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1596 including the terminating null byte. If YYRESULT is null, do not
1597 copy anything; just return the number of bytes that would be
1598 copied. As a special case, return 0 if an ordinary "syntax error"
1599 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1600 size calculation. */
1601static YYSIZE_T
1602yysyntax_error (char *yyresult, int yystate, int yychar)
1603{
1604 int yyn = yypact[yystate];
1605
1606 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1607 return 0;
1608 else
1609 {
1610 int yytype = YYTRANSLATE (yychar);
1611 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1612 YYSIZE_T yysize = yysize0;
1613 YYSIZE_T yysize1;
1614 int yysize_overflow = 0;
1615 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1616 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1617 int yyx;
1618
1619# if 0
1620 /* This is so xgettext sees the translatable formats that are
1621 constructed on the fly. */
1622 YY_("syntax error, unexpected %s");
1623 YY_("syntax error, unexpected %s, expecting %s");
1624 YY_("syntax error, unexpected %s, expecting %s or %s");
1625 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1626 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1627# endif
1628 char *yyfmt;
1629 char const *yyf;
1630 static char const yyunexpected[] = "syntax error, unexpected %s";
1631 static char const yyexpecting[] = ", expecting %s";
1632 static char const yyor[] = " or %s";
1633 char yyformat[sizeof yyunexpected
1634 + sizeof yyexpecting - 1
1635 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1636 * (sizeof yyor - 1))];
1637 char const *yyprefix = yyexpecting;
1638
1639 /* Start YYX at -YYN if negative to avoid negative indexes in
1640 YYCHECK. */
1641 int yyxbegin = yyn < 0 ? -yyn : 0;
1642
1643 /* Stay within bounds of both yycheck and yytname. */
1644 int yychecklim = YYLAST - yyn + 1;
1645 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1646 int yycount = 1;
1647
1648 yyarg[0] = yytname[yytype];
1649 yyfmt = yystpcpy (yyformat, yyunexpected);
1650
1651 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1652 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1653 {
1654 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1655 {
1656 yycount = 1;
1657 yysize = yysize0;
1658 yyformat[sizeof yyunexpected - 1] = '\0';
1659 break;
1660 }
1661 yyarg[yycount++] = yytname[yyx];
1662 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1663 yysize_overflow |= (yysize1 < yysize);
1664 yysize = yysize1;
1665 yyfmt = yystpcpy (yyfmt, yyprefix);
1666 yyprefix = yyor;
1667 }
1668
1669 yyf = YY_(yyformat);
1670 yysize1 = yysize + yystrlen (yyf);
1671 yysize_overflow |= (yysize1 < yysize);
1672 yysize = yysize1;
1673
1674 if (yysize_overflow)
1675 return YYSIZE_MAXIMUM;
1676
1677 if (yyresult)
1678 {
1679 /* Avoid sprintf, as that infringes on the user's name space.
1680 Don't have undefined behavior even if the translation
1681 produced a string with the wrong number of "%s"s. */
1682 char *yyp = yyresult;
1683 int yyi = 0;
1684 while ((*yyp = *yyf) != '\0')
1685 {
1686 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1687 {
1688 yyp += yytnamerr (yyp, yyarg[yyi++]);
1689 yyf += 2;
1690 }
1691 else
1692 {
1693 yyp++;
1694 yyf++;
1695 }
1696 }
1697 }
1698 return yysize;
1699 }
1700}
1701#endif /* YYERROR_VERBOSE */
1702
1703
1704/*-----------------------------------------------.
1705| Release the memory associated to this symbol. |
1706`-----------------------------------------------*/
1707
1708/*ARGSUSED*/
1709#if (defined __STDC__ || defined __C99__FUNC__ \
1710 || defined __cplusplus || defined _MSC_VER)
1711static void
1712yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, TParseContext* context)
1713#else
1714static void
1715yydestruct (yymsg, yytype, yyvaluep, context)
1716 const char *yymsg;
1717 int yytype;
1718 YYSTYPE *yyvaluep;
1719 TParseContext* context;
1720#endif
1721{
1722 YYUSE (yyvaluep);
1723 YYUSE (context);
1724
1725 if (!yymsg)
1726 yymsg = "Deleting";
1727 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1728
1729 switch (yytype)
1730 {
1731
1732 default:
1733 break;
1734 }
1735}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001736
1737/* Prevent warnings from -Wmissing-prototypes. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001738#ifdef YYPARSE_PARAM
1739#if defined __STDC__ || defined __cplusplus
1740int yyparse (void *YYPARSE_PARAM);
1741#else
1742int yyparse ();
1743#endif
1744#else /* ! YYPARSE_PARAM */
1745#if defined __STDC__ || defined __cplusplus
1746int yyparse (TParseContext* context);
1747#else
1748int yyparse ();
1749#endif
1750#endif /* ! YYPARSE_PARAM */
1751
1752
1753
1754
1755
kbr@chromium.org205fef32011-11-22 20:50:02 +00001756/*-------------------------.
1757| yyparse or yypush_parse. |
1758`-------------------------*/
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001759
1760#ifdef YYPARSE_PARAM
1761#if (defined __STDC__ || defined __C99__FUNC__ \
1762 || defined __cplusplus || defined _MSC_VER)
1763int
1764yyparse (void *YYPARSE_PARAM)
1765#else
1766int
1767yyparse (YYPARSE_PARAM)
1768 void *YYPARSE_PARAM;
1769#endif
1770#else /* ! YYPARSE_PARAM */
1771#if (defined __STDC__ || defined __C99__FUNC__ \
1772 || defined __cplusplus || defined _MSC_VER)
1773int
1774yyparse (TParseContext* context)
1775#else
1776int
1777yyparse (context)
1778 TParseContext* context;
1779#endif
1780#endif
1781{
kbr@chromium.org205fef32011-11-22 20:50:02 +00001782/* The lookahead symbol. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001783int yychar;
1784
kbr@chromium.org205fef32011-11-22 20:50:02 +00001785/* The semantic value of the lookahead symbol. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001786YYSTYPE yylval;
1787
kbr@chromium.org205fef32011-11-22 20:50:02 +00001788 /* Number of syntax errors so far. */
1789 int yynerrs;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001790
kbr@chromium.org205fef32011-11-22 20:50:02 +00001791 int yystate;
1792 /* Number of tokens to shift before error messages enabled. */
1793 int yyerrstatus;
1794
1795 /* The stacks and their tools:
1796 `yyss': related to states.
1797 `yyvs': related to semantic values.
1798
1799 Refer to the stacks thru separate pointers, to allow yyoverflow
1800 to reallocate them elsewhere. */
1801
1802 /* The state stack. */
1803 yytype_int16 yyssa[YYINITDEPTH];
1804 yytype_int16 *yyss;
1805 yytype_int16 *yyssp;
1806
1807 /* The semantic value stack. */
1808 YYSTYPE yyvsa[YYINITDEPTH];
1809 YYSTYPE *yyvs;
1810 YYSTYPE *yyvsp;
1811
1812 YYSIZE_T yystacksize;
1813
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001814 int yyn;
1815 int yyresult;
kbr@chromium.org205fef32011-11-22 20:50:02 +00001816 /* Lookahead token as an internal (translated) token number. */
1817 int yytoken;
1818 /* The variables used to return semantic value and location from the
1819 action routines. */
1820 YYSTYPE yyval;
1821
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001822#if YYERROR_VERBOSE
1823 /* Buffer for error messages, and its allocated size. */
1824 char yymsgbuf[128];
1825 char *yymsg = yymsgbuf;
1826 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1827#endif
1828
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001829#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1830
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001831 /* The number of symbols on the RHS of the reduced rule.
1832 Keep to zero when no symbol should be popped. */
1833 int yylen = 0;
1834
kbr@chromium.org205fef32011-11-22 20:50:02 +00001835 yytoken = 0;
1836 yyss = yyssa;
1837 yyvs = yyvsa;
1838 yystacksize = YYINITDEPTH;
1839
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001840 YYDPRINTF ((stderr, "Starting parse\n"));
1841
1842 yystate = 0;
1843 yyerrstatus = 0;
1844 yynerrs = 0;
kbr@chromium.org205fef32011-11-22 20:50:02 +00001845 yychar = YYEMPTY; /* Cause a token to be read. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001846
1847 /* Initialize stack pointers.
1848 Waste one element of value and location stack
1849 so that they stay on the same level as the state stack.
1850 The wasted elements are never initialized. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001851 yyssp = yyss;
1852 yyvsp = yyvs;
1853
1854 goto yysetstate;
1855
1856/*------------------------------------------------------------.
1857| yynewstate -- Push a new state, which is found in yystate. |
1858`------------------------------------------------------------*/
1859 yynewstate:
1860 /* In all cases, when you get here, the value and location stacks
1861 have just been pushed. So pushing a state here evens the stacks. */
1862 yyssp++;
1863
1864 yysetstate:
1865 *yyssp = yystate;
1866
1867 if (yyss + yystacksize - 1 <= yyssp)
1868 {
1869 /* Get the current used size of the three stacks, in elements. */
1870 YYSIZE_T yysize = yyssp - yyss + 1;
1871
1872#ifdef yyoverflow
1873 {
1874 /* Give user a chance to reallocate the stack. Use copies of
1875 these so that the &'s don't force the real ones into
1876 memory. */
1877 YYSTYPE *yyvs1 = yyvs;
1878 yytype_int16 *yyss1 = yyss;
1879
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001880 /* Each stack pointer address is followed by the size of the
1881 data in use in that stack, in bytes. This used to be a
1882 conditional around just the two extra args, but that might
1883 be undefined if yyoverflow is a macro. */
1884 yyoverflow (YY_("memory exhausted"),
1885 &yyss1, yysize * sizeof (*yyssp),
1886 &yyvs1, yysize * sizeof (*yyvsp),
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001887 &yystacksize);
1888
1889 yyss = yyss1;
1890 yyvs = yyvs1;
1891 }
1892#else /* no yyoverflow */
1893# ifndef YYSTACK_RELOCATE
1894 goto yyexhaustedlab;
1895# else
1896 /* Extend the stack our own way. */
1897 if (YYMAXDEPTH <= yystacksize)
1898 goto yyexhaustedlab;
1899 yystacksize *= 2;
1900 if (YYMAXDEPTH < yystacksize)
1901 yystacksize = YYMAXDEPTH;
1902
1903 {
1904 yytype_int16 *yyss1 = yyss;
1905 union yyalloc *yyptr =
1906 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1907 if (! yyptr)
1908 goto yyexhaustedlab;
kbr@chromium.org205fef32011-11-22 20:50:02 +00001909 YYSTACK_RELOCATE (yyss_alloc, yyss);
1910 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001911# undef YYSTACK_RELOCATE
1912 if (yyss1 != yyssa)
1913 YYSTACK_FREE (yyss1);
1914 }
1915# endif
1916#endif /* no yyoverflow */
1917
1918 yyssp = yyss + yysize - 1;
1919 yyvsp = yyvs + yysize - 1;
1920
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001921 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1922 (unsigned long int) yystacksize));
1923
1924 if (yyss + yystacksize - 1 <= yyssp)
1925 YYABORT;
1926 }
1927
1928 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1929
kbr@chromium.org205fef32011-11-22 20:50:02 +00001930 if (yystate == YYFINAL)
1931 YYACCEPT;
1932
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001933 goto yybackup;
1934
1935/*-----------.
1936| yybackup. |
1937`-----------*/
1938yybackup:
1939
1940 /* Do appropriate processing given the current state. Read a
kbr@chromium.org205fef32011-11-22 20:50:02 +00001941 lookahead token if we need one and don't already have one. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001942
kbr@chromium.org205fef32011-11-22 20:50:02 +00001943 /* First try to decide what to do without reference to lookahead token. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001944 yyn = yypact[yystate];
1945 if (yyn == YYPACT_NINF)
1946 goto yydefault;
1947
kbr@chromium.org205fef32011-11-22 20:50:02 +00001948 /* Not known => get a lookahead token if don't already have one. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001949
kbr@chromium.org205fef32011-11-22 20:50:02 +00001950 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001951 if (yychar == YYEMPTY)
1952 {
1953 YYDPRINTF ((stderr, "Reading a token: "));
1954 yychar = YYLEX;
1955 }
1956
1957 if (yychar <= YYEOF)
1958 {
1959 yychar = yytoken = YYEOF;
1960 YYDPRINTF ((stderr, "Now at end of input.\n"));
1961 }
1962 else
1963 {
1964 yytoken = YYTRANSLATE (yychar);
1965 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1966 }
1967
1968 /* If the proper action on seeing token YYTOKEN is to reduce or to
1969 detect an error, take that action. */
1970 yyn += yytoken;
1971 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1972 goto yydefault;
1973 yyn = yytable[yyn];
1974 if (yyn <= 0)
1975 {
1976 if (yyn == 0 || yyn == YYTABLE_NINF)
1977 goto yyerrlab;
1978 yyn = -yyn;
1979 goto yyreduce;
1980 }
1981
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001982 /* Count tokens shifted since error; after three, turn off error
1983 status. */
1984 if (yyerrstatus)
1985 yyerrstatus--;
1986
kbr@chromium.org205fef32011-11-22 20:50:02 +00001987 /* Shift the lookahead token. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001988 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1989
kbr@chromium.org205fef32011-11-22 20:50:02 +00001990 /* Discard the shifted token. */
1991 yychar = YYEMPTY;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001992
1993 yystate = yyn;
1994 *++yyvsp = yylval;
1995
1996 goto yynewstate;
1997
1998
1999/*-----------------------------------------------------------.
2000| yydefault -- do the default action for the current state. |
2001`-----------------------------------------------------------*/
2002yydefault:
2003 yyn = yydefact[yystate];
2004 if (yyn == 0)
2005 goto yyerrlab;
2006 goto yyreduce;
2007
2008
2009/*-----------------------------.
2010| yyreduce -- Do a reduction. |
2011`-----------------------------*/
2012yyreduce:
2013 /* yyn is the number of a rule to reduce with. */
2014 yylen = yyr2[yyn];
2015
2016 /* If YYLEN is nonzero, implement the default value of the action:
2017 `$$ = $1'.
2018
2019 Otherwise, the following line sets YYVAL to garbage.
2020 This behavior is undocumented and Bison
2021 users should not rely upon it. Assigning to YYVAL
2022 unconditionally makes the parser a bit smaller, and it avoids a
2023 GCC warning that YYVAL may be used uninitialized. */
2024 yyval = yyvsp[1-yylen];
2025
2026
2027 YY_REDUCE_PRINT (yyn);
2028 switch (yyn)
2029 {
2030 case 2:
2031
2032 {
2033 // The symbol table search was done in the lexical phase
2034 const TSymbol* symbol = (yyvsp[(1) - (1)].lex).symbol;
2035 const TVariable* variable;
2036 if (symbol == 0) {
2037 context->error((yyvsp[(1) - (1)].lex).line, "undeclared identifier", (yyvsp[(1) - (1)].lex).string->c_str(), "");
2038 context->recover();
2039 TType type(EbtFloat, EbpUndefined);
2040 TVariable* fakeVariable = new TVariable((yyvsp[(1) - (1)].lex).string, type);
2041 context->symbolTable.insert(*fakeVariable);
2042 variable = fakeVariable;
2043 } else {
2044 // This identifier can only be a variable type symbol
2045 if (! symbol->isVariable()) {
2046 context->error((yyvsp[(1) - (1)].lex).line, "variable expected", (yyvsp[(1) - (1)].lex).string->c_str(), "");
2047 context->recover();
2048 }
2049 variable = static_cast<const TVariable*>(symbol);
2050 }
2051
2052 // don't delete $1.string, it's used by error recovery, and the pool
2053 // pop will reclaim the memory
2054
2055 if (variable->getType().getQualifier() == EvqConst ) {
2056 ConstantUnion* constArray = variable->getConstPointer();
2057 TType t(variable->getType());
2058 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(constArray, t, (yyvsp[(1) - (1)].lex).line);
2059 } else
2060 (yyval.interm.intermTypedNode) = context->intermediate.addSymbol(variable->getUniqueId(),
2061 variable->getName(),
2062 variable->getType(), (yyvsp[(1) - (1)].lex).line);
kbr@chromium.org205fef32011-11-22 20:50:02 +00002063 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002064 break;
2065
2066 case 3:
2067
2068 {
2069 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
kbr@chromium.org205fef32011-11-22 20:50:02 +00002070 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002071 break;
2072
2073 case 4:
2074
2075 {
2076 //
2077 // INT_TYPE is only 16-bit plus sign bit for vertex/fragment shaders,
2078 // check for overflow for constants
2079 //
2080 if (abs((yyvsp[(1) - (1)].lex).i) >= (1 << 16)) {
2081 context->error((yyvsp[(1) - (1)].lex).line, " integer constant overflow", "", "");
2082 context->recover();
2083 }
2084 ConstantUnion *unionArray = new ConstantUnion[1];
2085 unionArray->setIConst((yyvsp[(1) - (1)].lex).i);
2086 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
kbr@chromium.org205fef32011-11-22 20:50:02 +00002087 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002088 break;
2089
2090 case 5:
2091
2092 {
2093 ConstantUnion *unionArray = new ConstantUnion[1];
2094 unionArray->setFConst((yyvsp[(1) - (1)].lex).f);
2095 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
kbr@chromium.org205fef32011-11-22 20:50:02 +00002096 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002097 break;
2098
2099 case 6:
2100
2101 {
2102 ConstantUnion *unionArray = new ConstantUnion[1];
2103 unionArray->setBConst((yyvsp[(1) - (1)].lex).b);
2104 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
kbr@chromium.org205fef32011-11-22 20:50:02 +00002105 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002106 break;
2107
2108 case 7:
2109
2110 {
2111 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (3)].interm.intermTypedNode);
kbr@chromium.org205fef32011-11-22 20:50:02 +00002112 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002113 break;
2114
2115 case 8:
2116
2117 {
2118 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
kbr@chromium.org205fef32011-11-22 20:50:02 +00002119 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002120 break;
2121
2122 case 9:
2123
2124 {
2125 if (!(yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isVector()) {
2126 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode())
2127 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(), "");
2128 else
2129 context->error((yyvsp[(2) - (4)].lex).line, " left of '[' is not of type array, matrix, or vector ", "expression", "");
2130 context->recover();
2131 }
2132 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst && (yyvsp[(3) - (4)].interm.intermTypedNode)->getQualifier() == EvqConst) {
2133 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) { // constant folding for arrays
2134 (yyval.interm.intermTypedNode) = context->addConstArrayNode((yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2135 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector()) { // constant folding for vectors
2136 TVectorFields fields;
2137 fields.num = 1;
2138 fields.offsets[0] = (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(); // need to do it this way because v.xy sends fields integer array
2139 (yyval.interm.intermTypedNode) = context->addConstVectorNode(fields, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2140 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix()) { // constant folding for matrices
2141 (yyval.interm.intermTypedNode) = context->addConstMatrixNode((yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2142 }
2143 } else {
2144 if ((yyvsp[(3) - (4)].interm.intermTypedNode)->getQualifier() == EvqConst) {
2145 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() ) {
2146 context->error((yyvsp[(2) - (4)].lex).line, "", "[", "field selection out of range '%d'", (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst());
2147 context->recover();
2148 } else {
2149 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) {
2150 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize() == 0) {
2151 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getMaxArraySize() <= (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst()) {
2152 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))
2153 context->recover();
2154 } else {
2155 if (context->arraySetMaxSize((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getTypePointer(), 0, false, (yyvsp[(2) - (4)].lex).line))
2156 context->recover();
2157 }
2158 } else if ( (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst() >= (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize()) {
2159 context->error((yyvsp[(2) - (4)].lex).line, "", "[", "array index out of range '%d'", (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst());
2160 context->recover();
2161 }
2162 }
2163 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(3) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2164 }
2165 } else {
2166 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize() == 0) {
2167 context->error((yyvsp[(2) - (4)].lex).line, "", "[", "array must be redeclared with a size before being indexed with a variable");
2168 context->recover();
2169 }
2170
2171 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexIndirect, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(3) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2172 }
2173 }
2174 if ((yyval.interm.intermTypedNode) == 0) {
2175 ConstantUnion *unionArray = new ConstantUnion[1];
2176 unionArray->setFConst(0.0f);
2177 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpHigh, EvqConst), (yyvsp[(2) - (4)].lex).line);
2178 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) {
2179 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getStruct())
2180 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getStruct(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getTypeName()));
2181 else
2182 (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()));
2183
2184 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst)
2185 (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConst);
2186 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst)
2187 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqConst, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize()));
2188 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix())
2189 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize()));
2190 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst)
2191 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqConst));
2192 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector())
2193 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary));
2194 else
2195 (yyval.interm.intermTypedNode)->setType((yyvsp[(1) - (4)].interm.intermTypedNode)->getType());
kbr@chromium.org205fef32011-11-22 20:50:02 +00002196 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002197 break;
2198
2199 case 10:
2200
2201 {
2202 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
kbr@chromium.org205fef32011-11-22 20:50:02 +00002203 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002204 break;
2205
2206 case 11:
2207
2208 {
2209 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isArray()) {
2210 context->error((yyvsp[(3) - (3)].lex).line, "cannot apply dot operator to an array", ".", "");
2211 context->recover();
2212 }
2213
2214 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isVector()) {
2215 TVectorFields fields;
2216 if (! context->parseVectorFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yyvsp[(3) - (3)].lex).line)) {
2217 fields.num = 1;
2218 fields.offsets[0] = 0;
2219 context->recover();
2220 }
2221
2222 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) { // constant folding for vector fields
2223 (yyval.interm.intermTypedNode) = context->addConstVectorNode(fields, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].lex).line);
2224 if ((yyval.interm.intermTypedNode) == 0) {
2225 context->recover();
2226 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2227 }
2228 else
2229 (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()));
2230 } else {
2231 if (fields.num == 1) {
2232 ConstantUnion *unionArray = new ConstantUnion[1];
2233 unionArray->setIConst(fields.offsets[0]);
2234 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line);
2235 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2236 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision()));
2237 } else {
2238 TString vectorString = *(yyvsp[(3) - (3)].lex).string;
2239 TIntermTyped* index = context->intermediate.addSwizzle(fields, (yyvsp[(3) - (3)].lex).line);
2240 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpVectorSwizzle, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2241 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (int) vectorString.size()));
2242 }
2243 }
2244 } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isMatrix()) {
2245 TMatrixFields fields;
2246 if (! context->parseMatrixFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yyvsp[(3) - (3)].lex).line)) {
2247 fields.wholeRow = false;
2248 fields.wholeCol = false;
2249 fields.row = 0;
2250 fields.col = 0;
2251 context->recover();
2252 }
2253
2254 if (fields.wholeRow || fields.wholeCol) {
2255 context->error((yyvsp[(2) - (3)].lex).line, " non-scalar fields not implemented yet", ".", "");
2256 context->recover();
2257 ConstantUnion *unionArray = new ConstantUnion[1];
2258 unionArray->setIConst(0);
2259 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line);
2260 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2261 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(),EvqTemporary, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize()));
2262 } else {
2263 ConstantUnion *unionArray = new ConstantUnion[1];
2264 unionArray->setIConst(fields.col * (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize() + fields.row);
2265 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line);
2266 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2267 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision()));
2268 }
2269 } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType() == EbtStruct) {
2270 bool fieldFound = false;
2271 const TTypeList* fields = (yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getStruct();
2272 if (fields == 0) {
2273 context->error((yyvsp[(2) - (3)].lex).line, "structure has no fields", "Internal Error", "");
2274 context->recover();
2275 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2276 } else {
2277 unsigned int i;
2278 for (i = 0; i < fields->size(); ++i) {
2279 if ((*fields)[i].type->getFieldName() == *(yyvsp[(3) - (3)].lex).string) {
2280 fieldFound = true;
2281 break;
2282 }
2283 }
2284 if (fieldFound) {
2285 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) {
2286 (yyval.interm.intermTypedNode) = context->addConstStruct(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
2287 if ((yyval.interm.intermTypedNode) == 0) {
2288 context->recover();
2289 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2290 }
2291 else {
2292 (yyval.interm.intermTypedNode)->setType(*(*fields)[i].type);
2293 // change the qualifier of the return type, not of the structure field
2294 // as the structure definition is shared between various structures.
2295 (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConst);
2296 }
2297 } else {
2298 ConstantUnion *unionArray = new ConstantUnion[1];
2299 unionArray->setIConst(i);
2300 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, *(*fields)[i].type, (yyvsp[(3) - (3)].lex).line);
2301 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirectStruct, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2302 (yyval.interm.intermTypedNode)->setType(*(*fields)[i].type);
2303 }
2304 } else {
2305 context->error((yyvsp[(2) - (3)].lex).line, " no such field in structure", (yyvsp[(3) - (3)].lex).string->c_str(), "");
2306 context->recover();
2307 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2308 }
2309 }
2310 } else {
2311 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(), "");
2312 context->recover();
2313 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2314 }
2315 // don't delete $3.string, it's from the pool
kbr@chromium.org205fef32011-11-22 20:50:02 +00002316 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002317 break;
2318
2319 case 12:
2320
2321 {
2322 if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode)))
2323 context->recover();
2324 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostIncrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line, context->symbolTable);
2325 if ((yyval.interm.intermTypedNode) == 0) {
2326 context->unaryOpError((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
2327 context->recover();
2328 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode);
2329 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00002330 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002331 break;
2332
2333 case 13:
2334
2335 {
2336 if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode)))
2337 context->recover();
2338 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostDecrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line, context->symbolTable);
2339 if ((yyval.interm.intermTypedNode) == 0) {
2340 context->unaryOpError((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
2341 context->recover();
2342 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode);
2343 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00002344 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002345 break;
2346
2347 case 14:
2348
2349 {
2350 if (context->integerErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode), "[]"))
2351 context->recover();
2352 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
kbr@chromium.org205fef32011-11-22 20:50:02 +00002353 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002354 break;
2355
2356 case 15:
2357
2358 {
2359 TFunction* fnCall = (yyvsp[(1) - (1)].interm).function;
2360 TOperator op = fnCall->getBuiltInOp();
2361
2362 if (op != EOpNull)
2363 {
2364 //
2365 // Then this should be a constructor.
2366 // Don't go through the symbol table for constructors.
2367 // Their parameters will be verified algorithmically.
2368 //
2369 TType type(EbtVoid, EbpUndefined); // use this to get the type back
2370 if (context->constructorErrorCheck((yyvsp[(1) - (1)].interm).line, (yyvsp[(1) - (1)].interm).intermNode, *fnCall, op, &type)) {
2371 (yyval.interm.intermTypedNode) = 0;
2372 } else {
2373 //
2374 // It's a constructor, of type 'type'.
2375 //
2376 (yyval.interm.intermTypedNode) = context->addConstructor((yyvsp[(1) - (1)].interm).intermNode, &type, op, fnCall, (yyvsp[(1) - (1)].interm).line);
2377 }
2378
2379 if ((yyval.interm.intermTypedNode) == 0) {
2380 context->recover();
2381 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator(0, op, (yyvsp[(1) - (1)].interm).line);
2382 }
2383 (yyval.interm.intermTypedNode)->setType(type);
2384 } else {
2385 //
2386 // Not a constructor. Find it in the symbol table.
2387 //
2388 const TFunction* fnCandidate;
2389 bool builtIn;
2390 fnCandidate = context->findFunction((yyvsp[(1) - (1)].interm).line, fnCall, &builtIn);
2391 if (fnCandidate) {
2392 //
2393 // A declared function.
2394 //
2395 if (builtIn && !fnCandidate->getExtension().empty() &&
2396 context->extensionErrorCheck((yyvsp[(1) - (1)].interm).line, fnCandidate->getExtension())) {
2397 context->recover();
2398 }
2399 op = fnCandidate->getBuiltInOp();
2400 if (builtIn && op != EOpNull) {
2401 //
2402 // A function call mapped to a built-in operation.
2403 //
2404 if (fnCandidate->getParamCount() == 1) {
2405 //
2406 // Treat it like a built-in unary operator.
2407 //
2408 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(op, (yyvsp[(1) - (1)].interm).intermNode, 0, context->symbolTable);
2409 if ((yyval.interm.intermTypedNode) == 0) {
2410 context->error((yyvsp[(1) - (1)].interm).intermNode->getLine(), " wrong operand type", "Internal Error",
2411 "built in unary operator function. Type: %s",
2412 static_cast<TIntermTyped*>((yyvsp[(1) - (1)].interm).intermNode)->getCompleteString().c_str());
2413 YYERROR;
2414 }
2415 } else {
2416 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, op, (yyvsp[(1) - (1)].interm).line);
2417 }
2418 } else {
2419 // This is a real function call
2420
2421 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, EOpFunctionCall, (yyvsp[(1) - (1)].interm).line);
2422 (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType());
2423
2424 // this is how we know whether the given function is a builtIn function or a user defined function
2425 // if builtIn == false, it's a userDefined -> could be an overloaded builtIn function also
2426 // if builtIn == true, it's definitely a builtIn function with EOpNull
2427 if (!builtIn)
2428 (yyval.interm.intermTypedNode)->getAsAggregate()->setUserDefined();
2429 (yyval.interm.intermTypedNode)->getAsAggregate()->setName(fnCandidate->getMangledName());
2430
2431 TQualifier qual;
2432 for (int i = 0; i < fnCandidate->getParamCount(); ++i) {
2433 qual = fnCandidate->getParam(i).type->getQualifier();
2434 if (qual == EvqOut || qual == EvqInOut) {
2435 if (context->lValueErrorCheck((yyval.interm.intermTypedNode)->getLine(), "assign", (yyval.interm.intermTypedNode)->getAsAggregate()->getSequence()[i]->getAsTyped())) {
2436 context->error((yyvsp[(1) - (1)].interm).intermNode->getLine(), "Constant value cannot be passed for 'out' or 'inout' parameters.", "Error", "");
2437 context->recover();
2438 }
2439 }
2440 }
2441 }
2442 (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType());
2443 } else {
2444 // error message was put out by PaFindFunction()
2445 // Put on a dummy node for error recovery
2446 ConstantUnion *unionArray = new ConstantUnion[1];
2447 unionArray->setFConst(0.0f);
2448 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].interm).line);
2449 context->recover();
2450 }
2451 }
2452 delete fnCall;
kbr@chromium.org205fef32011-11-22 20:50:02 +00002453 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002454 break;
2455
2456 case 16:
2457
2458 {
2459 (yyval.interm) = (yyvsp[(1) - (1)].interm);
kbr@chromium.org205fef32011-11-22 20:50:02 +00002460 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002461 break;
2462
2463 case 17:
2464
2465 {
2466 context->error((yyvsp[(3) - (3)].interm).line, "methods are not supported", "", "");
2467 context->recover();
2468 (yyval.interm) = (yyvsp[(3) - (3)].interm);
kbr@chromium.org205fef32011-11-22 20:50:02 +00002469 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002470 break;
2471
2472 case 18:
2473
2474 {
2475 (yyval.interm) = (yyvsp[(1) - (2)].interm);
2476 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
kbr@chromium.org205fef32011-11-22 20:50:02 +00002477 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002478 break;
2479
2480 case 19:
2481
2482 {
2483 (yyval.interm) = (yyvsp[(1) - (2)].interm);
2484 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
kbr@chromium.org205fef32011-11-22 20:50:02 +00002485 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002486 break;
2487
2488 case 20:
2489
2490 {
2491 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
2492 (yyval.interm).intermNode = 0;
kbr@chromium.org205fef32011-11-22 20:50:02 +00002493 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002494 break;
2495
2496 case 21:
2497
2498 {
2499 (yyval.interm).function = (yyvsp[(1) - (1)].interm.function);
2500 (yyval.interm).intermNode = 0;
kbr@chromium.org205fef32011-11-22 20:50:02 +00002501 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002502 break;
2503
2504 case 22:
2505
2506 {
2507 TParameter param = { 0, new TType((yyvsp[(2) - (2)].interm.intermTypedNode)->getType()) };
2508 (yyvsp[(1) - (2)].interm.function)->addParameter(param);
2509 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
2510 (yyval.interm).intermNode = (yyvsp[(2) - (2)].interm.intermTypedNode);
kbr@chromium.org205fef32011-11-22 20:50:02 +00002511 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002512 break;
2513
2514 case 23:
2515
2516 {
2517 TParameter param = { 0, new TType((yyvsp[(3) - (3)].interm.intermTypedNode)->getType()) };
2518 (yyvsp[(1) - (3)].interm).function->addParameter(param);
2519 (yyval.interm).function = (yyvsp[(1) - (3)].interm).function;
2520 (yyval.interm).intermNode = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermNode, (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
kbr@chromium.org205fef32011-11-22 20:50:02 +00002521 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002522 break;
2523
2524 case 24:
2525
2526 {
2527 (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
kbr@chromium.org205fef32011-11-22 20:50:02 +00002528 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002529 break;
2530
2531 case 25:
2532
2533 {
2534 //
2535 // Constructor
2536 //
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002537 TOperator op = EOpNull;
2538 if ((yyvsp[(1) - (1)].interm.type).userDef) {
2539 op = EOpConstructStruct;
2540 } else {
2541 switch ((yyvsp[(1) - (1)].interm.type).type) {
2542 case EbtFloat:
2543 if ((yyvsp[(1) - (1)].interm.type).matrix) {
2544 switch((yyvsp[(1) - (1)].interm.type).size) {
2545 case 2: op = EOpConstructMat2; break;
2546 case 3: op = EOpConstructMat3; break;
2547 case 4: op = EOpConstructMat4; break;
2548 }
2549 } else {
2550 switch((yyvsp[(1) - (1)].interm.type).size) {
2551 case 1: op = EOpConstructFloat; break;
2552 case 2: op = EOpConstructVec2; break;
2553 case 3: op = EOpConstructVec3; break;
2554 case 4: op = EOpConstructVec4; break;
2555 }
2556 }
2557 break;
2558 case EbtInt:
2559 switch((yyvsp[(1) - (1)].interm.type).size) {
2560 case 1: op = EOpConstructInt; break;
2561 case 2: FRAG_VERT_ONLY("ivec2", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec2; break;
2562 case 3: FRAG_VERT_ONLY("ivec3", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec3; break;
2563 case 4: FRAG_VERT_ONLY("ivec4", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec4; break;
2564 }
2565 break;
2566 case EbtBool:
2567 switch((yyvsp[(1) - (1)].interm.type).size) {
2568 case 1: op = EOpConstructBool; break;
2569 case 2: FRAG_VERT_ONLY("bvec2", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec2; break;
2570 case 3: FRAG_VERT_ONLY("bvec3", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec3; break;
2571 case 4: FRAG_VERT_ONLY("bvec4", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec4; break;
2572 }
2573 break;
2574 default: break;
2575 }
2576 if (op == EOpNull) {
2577 context->error((yyvsp[(1) - (1)].interm.type).line, "cannot construct this type", getBasicString((yyvsp[(1) - (1)].interm.type).type), "");
2578 context->recover();
2579 (yyvsp[(1) - (1)].interm.type).type = EbtFloat;
2580 op = EOpConstructFloat;
2581 }
2582 }
2583 TString tempString;
2584 TType type((yyvsp[(1) - (1)].interm.type));
2585 TFunction *function = new TFunction(&tempString, type, op);
2586 (yyval.interm.function) = function;
kbr@chromium.org205fef32011-11-22 20:50:02 +00002587 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002588 break;
2589
2590 case 26:
2591
2592 {
2593 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
2594 context->recover();
2595 TType type(EbtVoid, EbpUndefined);
2596 TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type);
2597 (yyval.interm.function) = function;
kbr@chromium.org205fef32011-11-22 20:50:02 +00002598 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002599 break;
2600
2601 case 27:
2602
2603 {
2604 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
2605 context->recover();
2606 TType type(EbtVoid, EbpUndefined);
2607 TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type);
2608 (yyval.interm.function) = function;
kbr@chromium.org205fef32011-11-22 20:50:02 +00002609 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002610 break;
2611
2612 case 28:
2613
2614 {
2615 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
kbr@chromium.org205fef32011-11-22 20:50:02 +00002616 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002617 break;
2618
2619 case 29:
2620
2621 {
2622 if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)))
2623 context->recover();
2624 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreIncrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line, context->symbolTable);
2625 if ((yyval.interm.intermTypedNode) == 0) {
2626 context->unaryOpError((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2627 context->recover();
2628 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2629 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00002630 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002631 break;
2632
2633 case 30:
2634
2635 {
2636 if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)))
2637 context->recover();
2638 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreDecrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line, context->symbolTable);
2639 if ((yyval.interm.intermTypedNode) == 0) {
2640 context->unaryOpError((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2641 context->recover();
2642 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2643 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00002644 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002645 break;
2646
2647 case 31:
2648
2649 {
2650 if ((yyvsp[(1) - (2)].interm).op != EOpNull) {
2651 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath((yyvsp[(1) - (2)].interm).op, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].interm).line, context->symbolTable);
2652 if ((yyval.interm.intermTypedNode) == 0) {
2653 const char* errorOp = "";
2654 switch((yyvsp[(1) - (2)].interm).op) {
2655 case EOpNegative: errorOp = "-"; break;
2656 case EOpLogicalNot: errorOp = "!"; break;
2657 default: break;
2658 }
2659 context->unaryOpError((yyvsp[(1) - (2)].interm).line, errorOp, (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2660 context->recover();
2661 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2662 }
2663 } else
2664 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
kbr@chromium.org205fef32011-11-22 20:50:02 +00002665 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002666 break;
2667
2668 case 32:
2669
kbr@chromium.org205fef32011-11-22 20:50:02 +00002670 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNull; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002671 break;
2672
2673 case 33:
2674
kbr@chromium.org205fef32011-11-22 20:50:02 +00002675 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNegative; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002676 break;
2677
2678 case 34:
2679
kbr@chromium.org205fef32011-11-22 20:50:02 +00002680 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpLogicalNot; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002681 break;
2682
2683 case 35:
2684
kbr@chromium.org205fef32011-11-22 20:50:02 +00002685 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002686 break;
2687
2688 case 36:
2689
2690 {
2691 FRAG_VERT_ONLY("*", (yyvsp[(2) - (3)].lex).line);
2692 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpMul, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2693 if ((yyval.interm.intermTypedNode) == 0) {
2694 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "*", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2695 context->recover();
2696 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2697 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00002698 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002699 break;
2700
2701 case 37:
2702
2703 {
2704 FRAG_VERT_ONLY("/", (yyvsp[(2) - (3)].lex).line);
2705 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpDiv, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2706 if ((yyval.interm.intermTypedNode) == 0) {
2707 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "/", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2708 context->recover();
2709 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2710 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00002711 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002712 break;
2713
2714 case 38:
2715
kbr@chromium.org205fef32011-11-22 20:50:02 +00002716 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002717 break;
2718
2719 case 39:
2720
2721 {
2722 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpAdd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2723 if ((yyval.interm.intermTypedNode) == 0) {
2724 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "+", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2725 context->recover();
2726 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2727 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00002728 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002729 break;
2730
2731 case 40:
2732
2733 {
2734 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpSub, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2735 if ((yyval.interm.intermTypedNode) == 0) {
2736 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "-", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2737 context->recover();
2738 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2739 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00002740 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002741 break;
2742
2743 case 41:
2744
kbr@chromium.org205fef32011-11-22 20:50:02 +00002745 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002746 break;
2747
2748 case 42:
2749
kbr@chromium.org205fef32011-11-22 20:50:02 +00002750 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002751 break;
2752
2753 case 43:
2754
2755 {
2756 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2757 if ((yyval.interm.intermTypedNode) == 0) {
2758 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2759 context->recover();
2760 ConstantUnion *unionArray = new ConstantUnion[1];
2761 unionArray->setBConst(false);
2762 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2763 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00002764 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002765 break;
2766
2767 case 44:
2768
2769 {
2770 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2771 if ((yyval.interm.intermTypedNode) == 0) {
2772 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2773 context->recover();
2774 ConstantUnion *unionArray = new ConstantUnion[1];
2775 unionArray->setBConst(false);
2776 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2777 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00002778 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002779 break;
2780
2781 case 45:
2782
2783 {
2784 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2785 if ((yyval.interm.intermTypedNode) == 0) {
2786 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2787 context->recover();
2788 ConstantUnion *unionArray = new ConstantUnion[1];
2789 unionArray->setBConst(false);
2790 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2791 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00002792 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002793 break;
2794
2795 case 46:
2796
2797 {
2798 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2799 if ((yyval.interm.intermTypedNode) == 0) {
2800 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2801 context->recover();
2802 ConstantUnion *unionArray = new ConstantUnion[1];
2803 unionArray->setBConst(false);
2804 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2805 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00002806 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002807 break;
2808
2809 case 47:
2810
kbr@chromium.org205fef32011-11-22 20:50:02 +00002811 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002812 break;
2813
2814 case 48:
2815
2816 {
2817 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2818 if ((yyval.interm.intermTypedNode) == 0) {
2819 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "==", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2820 context->recover();
2821 ConstantUnion *unionArray = new ConstantUnion[1];
2822 unionArray->setBConst(false);
2823 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2824 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00002825 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002826 break;
2827
2828 case 49:
2829
2830 {
2831 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpNotEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2832 if ((yyval.interm.intermTypedNode) == 0) {
2833 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "!=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2834 context->recover();
2835 ConstantUnion *unionArray = new ConstantUnion[1];
2836 unionArray->setBConst(false);
2837 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2838 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00002839 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002840 break;
2841
2842 case 50:
2843
kbr@chromium.org205fef32011-11-22 20:50:02 +00002844 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002845 break;
2846
2847 case 51:
2848
kbr@chromium.org205fef32011-11-22 20:50:02 +00002849 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002850 break;
2851
2852 case 52:
2853
kbr@chromium.org205fef32011-11-22 20:50:02 +00002854 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002855 break;
2856
2857 case 53:
2858
kbr@chromium.org205fef32011-11-22 20:50:02 +00002859 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002860 break;
2861
2862 case 54:
2863
2864 {
2865 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalAnd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2866 if ((yyval.interm.intermTypedNode) == 0) {
2867 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "&&", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2868 context->recover();
2869 ConstantUnion *unionArray = new ConstantUnion[1];
2870 unionArray->setBConst(false);
2871 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2872 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00002873 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002874 break;
2875
2876 case 55:
2877
kbr@chromium.org205fef32011-11-22 20:50:02 +00002878 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002879 break;
2880
2881 case 56:
2882
2883 {
2884 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalXor, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2885 if ((yyval.interm.intermTypedNode) == 0) {
2886 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "^^", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2887 context->recover();
2888 ConstantUnion *unionArray = new ConstantUnion[1];
2889 unionArray->setBConst(false);
2890 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2891 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00002892 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002893 break;
2894
2895 case 57:
2896
kbr@chromium.org205fef32011-11-22 20:50:02 +00002897 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002898 break;
2899
2900 case 58:
2901
2902 {
2903 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalOr, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2904 if ((yyval.interm.intermTypedNode) == 0) {
2905 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "||", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2906 context->recover();
2907 ConstantUnion *unionArray = new ConstantUnion[1];
2908 unionArray->setBConst(false);
2909 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2910 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00002911 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002912 break;
2913
2914 case 59:
2915
kbr@chromium.org205fef32011-11-22 20:50:02 +00002916 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002917 break;
2918
2919 case 60:
2920
2921 {
2922 if (context->boolErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.intermTypedNode)))
2923 context->recover();
2924
2925 (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);
2926 if ((yyvsp[(3) - (5)].interm.intermTypedNode)->getType() != (yyvsp[(5) - (5)].interm.intermTypedNode)->getType())
2927 (yyval.interm.intermTypedNode) = 0;
2928
2929 if ((yyval.interm.intermTypedNode) == 0) {
2930 context->binaryOpError((yyvsp[(2) - (5)].lex).line, ":", (yyvsp[(3) - (5)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(5) - (5)].interm.intermTypedNode)->getCompleteString());
2931 context->recover();
2932 (yyval.interm.intermTypedNode) = (yyvsp[(5) - (5)].interm.intermTypedNode);
2933 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00002934 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002935 break;
2936
2937 case 61:
2938
kbr@chromium.org205fef32011-11-22 20:50:02 +00002939 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002940 break;
2941
2942 case 62:
2943
2944 {
2945 if (context->lValueErrorCheck((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)))
2946 context->recover();
2947 (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);
2948 if ((yyval.interm.intermTypedNode) == 0) {
2949 context->assignError((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2950 context->recover();
2951 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2952 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00002953 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002954 break;
2955
2956 case 63:
2957
kbr@chromium.org205fef32011-11-22 20:50:02 +00002958 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAssign; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002959 break;
2960
2961 case 64:
2962
kbr@chromium.org205fef32011-11-22 20:50:02 +00002963 { 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 +00002964 break;
2965
2966 case 65:
2967
kbr@chromium.org205fef32011-11-22 20:50:02 +00002968 { 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 +00002969 break;
2970
2971 case 66:
2972
kbr@chromium.org205fef32011-11-22 20:50:02 +00002973 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAddAssign; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002974 break;
2975
2976 case 67:
2977
kbr@chromium.org205fef32011-11-22 20:50:02 +00002978 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpSubAssign; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002979 break;
2980
2981 case 68:
2982
2983 {
2984 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
kbr@chromium.org205fef32011-11-22 20:50:02 +00002985 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002986 break;
2987
2988 case 69:
2989
2990 {
2991 (yyval.interm.intermTypedNode) = context->intermediate.addComma((yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
2992 if ((yyval.interm.intermTypedNode) == 0) {
2993 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ",", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2994 context->recover();
2995 (yyval.interm.intermTypedNode) = (yyvsp[(3) - (3)].interm.intermTypedNode);
2996 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00002997 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002998 break;
2999
3000 case 70:
3001
3002 {
3003 if (context->constErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)))
3004 context->recover();
3005 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003006 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003007 break;
3008
3009 case 71:
3010
3011 {
3012 TFunction &function = *((yyvsp[(1) - (2)].interm).function);
3013
3014 TIntermAggregate *prototype = new TIntermAggregate;
3015 prototype->setType(function.getReturnType());
3016 prototype->setName(function.getName());
3017
3018 for (int i = 0; i < function.getParamCount(); i++)
3019 {
3020 const TParameter &param = function.getParam(i);
3021 if (param.name != 0)
3022 {
3023 TVariable *variable = new TVariable(param.name, *param.type);
3024
3025 prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(variable->getUniqueId(), variable->getName(), variable->getType(), (yyvsp[(1) - (2)].interm).line), (yyvsp[(1) - (2)].interm).line);
3026 }
3027 else
3028 {
3029 prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (2)].interm).line), (yyvsp[(1) - (2)].interm).line);
3030 }
3031 }
3032
3033 prototype->setOp(EOpPrototype);
3034 (yyval.interm.intermNode) = prototype;
kbr@chromium.org205fef32011-11-22 20:50:02 +00003035 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003036 break;
3037
3038 case 72:
3039
3040 {
3041 if ((yyvsp[(1) - (2)].interm).intermAggregate)
3042 (yyvsp[(1) - (2)].interm).intermAggregate->setOp(EOpDeclaration);
3043 (yyval.interm.intermNode) = (yyvsp[(1) - (2)].interm).intermAggregate;
kbr@chromium.org205fef32011-11-22 20:50:02 +00003044 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003045 break;
3046
3047 case 73:
3048
3049 {
3050 context->symbolTable.setDefaultPrecision( (yyvsp[(3) - (4)].interm.type).type, (yyvsp[(2) - (4)].interm.precision) );
3051 (yyval.interm.intermNode) = 0;
kbr@chromium.org205fef32011-11-22 20:50:02 +00003052 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003053 break;
3054
3055 case 74:
3056
3057 {
3058 //
3059 // Multiple declarations of the same function are allowed.
3060 //
3061 // If this is a definition, the definition production code will check for redefinitions
3062 // (we don't know at this point if it's a definition or not).
3063 //
3064 // Redeclarations are allowed. But, return types and parameter qualifiers must match.
3065 //
3066 TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find((yyvsp[(1) - (2)].interm.function)->getMangledName()));
3067 if (prevDec) {
3068 if (prevDec->getReturnType() != (yyvsp[(1) - (2)].interm.function)->getReturnType()) {
3069 context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same return type", (yyvsp[(1) - (2)].interm.function)->getReturnType().getBasicString(), "");
3070 context->recover();
3071 }
3072 for (int i = 0; i < prevDec->getParamCount(); ++i) {
3073 if (prevDec->getParam(i).type->getQualifier() != (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifier()) {
3074 context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same parameter qualifiers", (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifierString(), "");
3075 context->recover();
3076 }
3077 }
3078 }
3079
3080 //
3081 // If this is a redeclaration, it could also be a definition,
3082 // in which case, we want to use the variable names from this one, and not the one that's
3083 // being redeclared. So, pass back up this declaration, not the one in the symbol table.
3084 //
3085 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
3086 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
3087
3088 context->symbolTable.insert(*(yyval.interm).function);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003089 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003090 break;
3091
3092 case 75:
3093
3094 {
3095 (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003096 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003097 break;
3098
3099 case 76:
3100
3101 {
3102 (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003103 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003104 break;
3105
3106 case 77:
3107
3108 {
3109 // Add the parameter
3110 (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
3111 if ((yyvsp[(2) - (2)].interm).param.type->getBasicType() != EbtVoid)
3112 (yyvsp[(1) - (2)].interm.function)->addParameter((yyvsp[(2) - (2)].interm).param);
3113 else
3114 delete (yyvsp[(2) - (2)].interm).param.type;
kbr@chromium.org205fef32011-11-22 20:50:02 +00003115 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003116 break;
3117
3118 case 78:
3119
3120 {
3121 //
3122 // Only first parameter of one-parameter functions can be void
3123 // The check for named parameters not being void is done in parameter_declarator
3124 //
3125 if ((yyvsp[(3) - (3)].interm).param.type->getBasicType() == EbtVoid) {
3126 //
3127 // This parameter > first is void
3128 //
3129 context->error((yyvsp[(2) - (3)].lex).line, "cannot be an argument type except for '(void)'", "void", "");
3130 context->recover();
3131 delete (yyvsp[(3) - (3)].interm).param.type;
3132 } else {
3133 // Add the parameter
3134 (yyval.interm.function) = (yyvsp[(1) - (3)].interm.function);
3135 (yyvsp[(1) - (3)].interm.function)->addParameter((yyvsp[(3) - (3)].interm).param);
3136 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003137 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003138 break;
3139
3140 case 79:
3141
3142 {
3143 if ((yyvsp[(1) - (3)].interm.type).qualifier != EvqGlobal && (yyvsp[(1) - (3)].interm.type).qualifier != EvqTemporary) {
3144 context->error((yyvsp[(2) - (3)].lex).line, "no qualifiers allowed for function return", getQualifierString((yyvsp[(1) - (3)].interm.type).qualifier), "");
3145 context->recover();
3146 }
3147 // make sure a sampler is not involved as well...
3148 if (context->structQualifierErrorCheck((yyvsp[(2) - (3)].lex).line, (yyvsp[(1) - (3)].interm.type)))
3149 context->recover();
3150
3151 // Add the function as a prototype after parsing it (we do not support recursion)
3152 TFunction *function;
3153 TType type((yyvsp[(1) - (3)].interm.type));
3154 function = new TFunction((yyvsp[(2) - (3)].lex).string, type);
3155 (yyval.interm.function) = function;
kbr@chromium.org205fef32011-11-22 20:50:02 +00003156 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003157 break;
3158
3159 case 80:
3160
3161 {
3162 if ((yyvsp[(1) - (2)].interm.type).type == EbtVoid) {
3163 context->error((yyvsp[(2) - (2)].lex).line, "illegal use of type 'void'", (yyvsp[(2) - (2)].lex).string->c_str(), "");
3164 context->recover();
3165 }
3166 if (context->reservedErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string))
3167 context->recover();
3168 TParameter param = {(yyvsp[(2) - (2)].lex).string, new TType((yyvsp[(1) - (2)].interm.type))};
3169 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
3170 (yyval.interm).param = param;
kbr@chromium.org205fef32011-11-22 20:50:02 +00003171 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003172 break;
3173
3174 case 81:
3175
3176 {
3177 // Check that we can make an array out of this type
3178 if (context->arrayTypeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
3179 context->recover();
3180
3181 if (context->reservedErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string))
3182 context->recover();
3183
3184 int size;
3185 if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3186 context->recover();
3187 (yyvsp[(1) - (5)].interm.type).setArray(true, size);
3188
3189 TType* type = new TType((yyvsp[(1) - (5)].interm.type));
3190 TParameter param = { (yyvsp[(2) - (5)].lex).string, type };
3191 (yyval.interm).line = (yyvsp[(2) - (5)].lex).line;
3192 (yyval.interm).param = param;
kbr@chromium.org205fef32011-11-22 20:50:02 +00003193 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003194 break;
3195
3196 case 82:
3197
3198 {
3199 (yyval.interm) = (yyvsp[(3) - (3)].interm);
3200 if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
3201 context->recover();
kbr@chromium.org205fef32011-11-22 20:50:02 +00003202 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003203 break;
3204
3205 case 83:
3206
3207 {
3208 (yyval.interm) = (yyvsp[(2) - (2)].interm);
3209 if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
3210 context->recover();
3211 if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
3212 context->recover();
kbr@chromium.org205fef32011-11-22 20:50:02 +00003213 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003214 break;
3215
3216 case 84:
3217
3218 {
3219 (yyval.interm) = (yyvsp[(3) - (3)].interm);
3220 if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
3221 context->recover();
kbr@chromium.org205fef32011-11-22 20:50:02 +00003222 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003223 break;
3224
3225 case 85:
3226
3227 {
3228 (yyval.interm) = (yyvsp[(2) - (2)].interm);
3229 if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
3230 context->recover();
3231 if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
3232 context->recover();
kbr@chromium.org205fef32011-11-22 20:50:02 +00003233 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003234 break;
3235
3236 case 86:
3237
3238 {
3239 (yyval.interm.qualifier) = EvqIn;
kbr@chromium.org205fef32011-11-22 20:50:02 +00003240 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003241 break;
3242
3243 case 87:
3244
3245 {
3246 (yyval.interm.qualifier) = EvqIn;
kbr@chromium.org205fef32011-11-22 20:50:02 +00003247 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003248 break;
3249
3250 case 88:
3251
3252 {
3253 (yyval.interm.qualifier) = EvqOut;
kbr@chromium.org205fef32011-11-22 20:50:02 +00003254 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003255 break;
3256
3257 case 89:
3258
3259 {
3260 (yyval.interm.qualifier) = EvqInOut;
kbr@chromium.org205fef32011-11-22 20:50:02 +00003261 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003262 break;
3263
3264 case 90:
3265
3266 {
3267 TParameter param = { 0, new TType((yyvsp[(1) - (1)].interm.type)) };
3268 (yyval.interm).param = param;
kbr@chromium.org205fef32011-11-22 20:50:02 +00003269 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003270 break;
3271
3272 case 91:
3273
3274 {
3275 (yyval.interm) = (yyvsp[(1) - (1)].interm);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003276 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003277 break;
3278
3279 case 92:
3280
3281 {
zmo@google.comfd747b82011-04-23 01:30:07 +00003282 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(3) - (3)].lex).string, TType((yyvsp[(1) - (3)].interm).type), (yyvsp[(3) - (3)].lex).line);
3283 (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 +00003284
3285 if (context->structQualifierErrorCheck((yyvsp[(3) - (3)].lex).line, (yyval.interm).type))
3286 context->recover();
3287
3288 if (context->nonInitConstErrorCheck((yyvsp[(3) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyval.interm).type))
3289 context->recover();
3290
zmo@google.comfd747b82011-04-23 01:30:07 +00003291 TVariable* variable = 0;
3292 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 +00003293 context->recover();
zmo@google.comfd747b82011-04-23 01:30:07 +00003294 if (symbol && variable)
3295 symbol->setId(variable->getUniqueId());
kbr@chromium.org205fef32011-11-22 20:50:02 +00003296 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003297 break;
3298
3299 case 93:
3300
3301 {
3302 if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
3303 context->recover();
3304
3305 if (context->nonInitConstErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type))
3306 context->recover();
3307
3308 (yyval.interm) = (yyvsp[(1) - (5)].interm);
3309
3310 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))
3311 context->recover();
3312 else {
3313 (yyvsp[(1) - (5)].interm).type.setArray(true);
3314 TVariable* variable;
3315 if (context->arrayErrorCheck((yyvsp[(4) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, variable))
3316 context->recover();
3317 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003318 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003319 break;
3320
3321 case 94:
3322
3323 {
3324 if (context->structQualifierErrorCheck((yyvsp[(3) - (6)].lex).line, (yyvsp[(1) - (6)].interm).type))
3325 context->recover();
3326
3327 if (context->nonInitConstErrorCheck((yyvsp[(3) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type))
3328 context->recover();
3329
3330 (yyval.interm) = (yyvsp[(1) - (6)].interm);
3331
3332 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))
3333 context->recover();
3334 else {
3335 int size;
3336 if (context->arraySizeErrorCheck((yyvsp[(4) - (6)].lex).line, (yyvsp[(5) - (6)].interm.intermTypedNode), size))
3337 context->recover();
3338 (yyvsp[(1) - (6)].interm).type.setArray(true, size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003339 TVariable* variable = 0;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003340 if (context->arrayErrorCheck((yyvsp[(4) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type, variable))
3341 context->recover();
3342 TType type = TType((yyvsp[(1) - (6)].interm).type);
3343 type.setArraySize(size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003344 (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 +00003345 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003346 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003347 break;
3348
3349 case 95:
3350
3351 {
3352 if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
3353 context->recover();
3354
3355 (yyval.interm) = (yyvsp[(1) - (5)].interm);
3356
3357 TIntermNode* intermNode;
3358 if (!context->executeInitializer((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, (yyvsp[(5) - (5)].interm.intermTypedNode), intermNode)) {
3359 //
3360 // build the intermediate representation
3361 //
3362 if (intermNode)
3363 (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (5)].interm).intermNode, intermNode, (yyvsp[(4) - (5)].lex).line);
3364 else
3365 (yyval.interm).intermAggregate = (yyvsp[(1) - (5)].interm).intermAggregate;
3366 } else {
3367 context->recover();
3368 (yyval.interm).intermAggregate = 0;
3369 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003370 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003371 break;
3372
3373 case 96:
3374
3375 {
3376 (yyval.interm).type = (yyvsp[(1) - (1)].interm.type);
3377 (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);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003378 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003379 break;
3380
3381 case 97:
3382
3383 {
zmo@google.comfd747b82011-04-23 01:30:07 +00003384 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyvsp[(1) - (2)].interm.type)), (yyvsp[(2) - (2)].lex).line);
3385 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (2)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003386
3387 if (context->structQualifierErrorCheck((yyvsp[(2) - (2)].lex).line, (yyval.interm).type))
3388 context->recover();
3389
3390 if (context->nonInitConstErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string, (yyval.interm).type))
3391 context->recover();
3392
3393 (yyval.interm).type = (yyvsp[(1) - (2)].interm.type);
3394
zmo@google.comfd747b82011-04-23 01:30:07 +00003395 TVariable* variable = 0;
3396 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 +00003397 context->recover();
zmo@google.comfd747b82011-04-23 01:30:07 +00003398 if (variable && symbol)
3399 symbol->setId(variable->getUniqueId());
kbr@chromium.org205fef32011-11-22 20:50:02 +00003400 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003401 break;
3402
3403 case 98:
3404
3405 {
kbr@chromium.org04277b82011-06-02 18:41:26 +00003406 context->error((yyvsp[(2) - (4)].lex).line, "unsized array declarations not supported", (yyvsp[(2) - (4)].lex).string->c_str(), "");
3407 context->recover();
3408
zmo@google.comfd747b82011-04-23 01:30:07 +00003409 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (4)].lex).string, TType((yyvsp[(1) - (4)].interm.type)), (yyvsp[(2) - (4)].lex).line);
3410 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (4)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003411 (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003412 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003413 break;
3414
3415 case 99:
3416
3417 {
3418 TType type = TType((yyvsp[(1) - (5)].interm.type));
3419 int size;
3420 if (context->arraySizeErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3421 context->recover();
3422 type.setArraySize(size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003423 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (5)].lex).string, type, (yyvsp[(2) - (5)].lex).line);
3424 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (5)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003425
3426 if (context->structQualifierErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
3427 context->recover();
3428
3429 if (context->nonInitConstErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type)))
3430 context->recover();
3431
3432 (yyval.interm).type = (yyvsp[(1) - (5)].interm.type);
3433
3434 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)))
3435 context->recover();
3436 else {
3437 int size;
3438 if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3439 context->recover();
3440
3441 (yyvsp[(1) - (5)].interm.type).setArray(true, size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003442 TVariable* variable = 0;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003443 if (context->arrayErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type), variable))
3444 context->recover();
zmo@google.comfd747b82011-04-23 01:30:07 +00003445 if (variable && symbol)
3446 symbol->setId(variable->getUniqueId());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003447 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003448 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003449 break;
3450
3451 case 100:
3452
3453 {
3454 if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
3455 context->recover();
3456
3457 (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
3458
3459 TIntermNode* intermNode;
3460 if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode)) {
3461 //
3462 // Build intermediate representation
3463 //
3464 if(intermNode)
3465 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(intermNode, (yyvsp[(3) - (4)].lex).line);
3466 else
3467 (yyval.interm).intermAggregate = 0;
3468 } else {
3469 context->recover();
3470 (yyval.interm).intermAggregate = 0;
3471 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003472 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003473 break;
3474
3475 case 101:
3476
3477 {
3478 VERTEX_ONLY("invariant declaration", (yyvsp[(1) - (2)].lex).line);
3479 (yyval.interm).qualifier = EvqInvariantVaryingOut;
3480 (yyval.interm).intermAggregate = 0;
kbr@chromium.org205fef32011-11-22 20:50:02 +00003481 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003482 break;
3483
3484 case 102:
3485
3486 {
3487 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3488
3489 if ((yyvsp[(1) - (1)].interm.type).array) {
3490 context->error((yyvsp[(1) - (1)].interm.type).line, "not supported", "first-class array", "");
3491 context->recover();
3492 (yyvsp[(1) - (1)].interm.type).setArray(false);
3493 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003494 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003495 break;
3496
3497 case 103:
3498
3499 {
3500 if ((yyvsp[(2) - (2)].interm.type).array) {
3501 context->error((yyvsp[(2) - (2)].interm.type).line, "not supported", "first-class array", "");
3502 context->recover();
3503 (yyvsp[(2) - (2)].interm.type).setArray(false);
3504 }
3505
3506 if ((yyvsp[(1) - (2)].interm.type).qualifier == EvqAttribute &&
3507 ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
3508 context->error((yyvsp[(2) - (2)].interm.type).line, "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier), "");
3509 context->recover();
3510 }
3511 if (((yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingIn || (yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingOut) &&
3512 ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
3513 context->error((yyvsp[(2) - (2)].interm.type).line, "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier), "");
3514 context->recover();
3515 }
3516 (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
3517 (yyval.interm.type).qualifier = (yyvsp[(1) - (2)].interm.type).qualifier;
kbr@chromium.org205fef32011-11-22 20:50:02 +00003518 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003519 break;
3520
3521 case 104:
3522
3523 {
3524 (yyval.interm.type).setBasic(EbtVoid, EvqConst, (yyvsp[(1) - (1)].lex).line);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003525 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003526 break;
3527
3528 case 105:
3529
3530 {
3531 VERTEX_ONLY("attribute", (yyvsp[(1) - (1)].lex).line);
3532 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "attribute"))
3533 context->recover();
3534 (yyval.interm.type).setBasic(EbtVoid, EvqAttribute, (yyvsp[(1) - (1)].lex).line);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003535 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003536 break;
3537
3538 case 106:
3539
3540 {
3541 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "varying"))
3542 context->recover();
3543 if (context->shaderType == SH_VERTEX_SHADER)
3544 (yyval.interm.type).setBasic(EbtVoid, EvqVaryingOut, (yyvsp[(1) - (1)].lex).line);
3545 else
3546 (yyval.interm.type).setBasic(EbtVoid, EvqVaryingIn, (yyvsp[(1) - (1)].lex).line);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003547 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003548 break;
3549
3550 case 107:
3551
3552 {
3553 if (context->globalErrorCheck((yyvsp[(1) - (2)].lex).line, context->symbolTable.atGlobalLevel(), "invariant varying"))
3554 context->recover();
3555 if (context->shaderType == SH_VERTEX_SHADER)
3556 (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingOut, (yyvsp[(1) - (2)].lex).line);
3557 else
3558 (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingIn, (yyvsp[(1) - (2)].lex).line);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003559 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003560 break;
3561
3562 case 108:
3563
3564 {
3565 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "uniform"))
3566 context->recover();
3567 (yyval.interm.type).setBasic(EbtVoid, EvqUniform, (yyvsp[(1) - (1)].lex).line);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003568 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003569 break;
3570
3571 case 109:
3572
3573 {
3574 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
zmo@google.comdc4b4f82011-06-17 00:42:53 +00003575
3576 if ((yyval.interm.type).precision == EbpUndefined) {
3577 (yyval.interm.type).precision = context->symbolTable.getDefaultPrecision((yyvsp[(1) - (1)].interm.type).type);
3578 if (context->precisionErrorCheck((yyvsp[(1) - (1)].interm.type).line, (yyval.interm.type).precision, (yyvsp[(1) - (1)].interm.type).type)) {
3579 context->recover();
3580 }
3581 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003582 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003583 break;
3584
3585 case 110:
3586
3587 {
3588 (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
3589 (yyval.interm.type).precision = (yyvsp[(1) - (2)].interm.precision);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003590 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003591 break;
3592
3593 case 111:
3594
3595 {
3596 (yyval.interm.precision) = EbpHigh;
kbr@chromium.org205fef32011-11-22 20:50:02 +00003597 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003598 break;
3599
3600 case 112:
3601
3602 {
3603 (yyval.interm.precision) = EbpMedium;
kbr@chromium.org205fef32011-11-22 20:50:02 +00003604 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003605 break;
3606
3607 case 113:
3608
3609 {
3610 (yyval.interm.precision) = EbpLow;
kbr@chromium.org205fef32011-11-22 20:50:02 +00003611 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003612 break;
3613
3614 case 114:
3615
3616 {
3617 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003618 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003619 break;
3620
3621 case 115:
3622
3623 {
3624 (yyval.interm.type) = (yyvsp[(1) - (4)].interm.type);
3625
3626 if (context->arrayTypeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
3627 context->recover();
3628 else {
3629 int size;
3630 if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
3631 context->recover();
3632 (yyval.interm.type).setArray(true, size);
3633 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003634 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003635 break;
3636
3637 case 116:
3638
3639 {
3640 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3641 (yyval.interm.type).setBasic(EbtVoid, qual, (yyvsp[(1) - (1)].lex).line);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003642 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003643 break;
3644
3645 case 117:
3646
3647 {
3648 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3649 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003650 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003651 break;
3652
3653 case 118:
3654
3655 {
3656 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3657 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003658 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003659 break;
3660
3661 case 119:
3662
3663 {
3664 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3665 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003666 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003667 break;
3668
3669 case 120:
3670
3671 {
3672 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3673 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3674 (yyval.interm.type).setAggregate(2);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003675 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003676 break;
3677
3678 case 121:
3679
3680 {
3681 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3682 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3683 (yyval.interm.type).setAggregate(3);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003684 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003685 break;
3686
3687 case 122:
3688
3689 {
3690 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3691 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3692 (yyval.interm.type).setAggregate(4);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003693 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003694 break;
3695
3696 case 123:
3697
3698 {
3699 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3700 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3701 (yyval.interm.type).setAggregate(2);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003702 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003703 break;
3704
3705 case 124:
3706
3707 {
3708 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3709 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3710 (yyval.interm.type).setAggregate(3);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003711 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003712 break;
3713
3714 case 125:
3715
3716 {
3717 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3718 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3719 (yyval.interm.type).setAggregate(4);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003720 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003721 break;
3722
3723 case 126:
3724
3725 {
3726 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3727 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3728 (yyval.interm.type).setAggregate(2);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003729 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003730 break;
3731
3732 case 127:
3733
3734 {
3735 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3736 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3737 (yyval.interm.type).setAggregate(3);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003738 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003739 break;
3740
3741 case 128:
3742
3743 {
3744 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3745 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3746 (yyval.interm.type).setAggregate(4);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003747 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003748 break;
3749
3750 case 129:
3751
3752 {
3753 FRAG_VERT_ONLY("mat2", (yyvsp[(1) - (1)].lex).line);
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(2, true);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003757 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003758 break;
3759
3760 case 130:
3761
3762 {
3763 FRAG_VERT_ONLY("mat3", (yyvsp[(1) - (1)].lex).line);
3764 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3765 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3766 (yyval.interm.type).setAggregate(3, true);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003767 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003768 break;
3769
3770 case 131:
3771
3772 {
3773 FRAG_VERT_ONLY("mat4", (yyvsp[(1) - (1)].lex).line);
3774 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3775 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3776 (yyval.interm.type).setAggregate(4, true);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003777 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003778 break;
3779
3780 case 132:
3781
3782 {
3783 FRAG_VERT_ONLY("sampler2D", (yyvsp[(1) - (1)].lex).line);
3784 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3785 (yyval.interm.type).setBasic(EbtSampler2D, qual, (yyvsp[(1) - (1)].lex).line);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003786 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003787 break;
3788
3789 case 133:
3790
3791 {
3792 FRAG_VERT_ONLY("samplerCube", (yyvsp[(1) - (1)].lex).line);
3793 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3794 (yyval.interm.type).setBasic(EbtSamplerCube, qual, (yyvsp[(1) - (1)].lex).line);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003795 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003796 break;
3797
3798 case 134:
3799
3800 {
zmo@google.com09c323a2011-08-12 18:22:25 +00003801 if (!context->supportsExtension("GL_OES_EGL_image_external")) {
3802 context->error((yyvsp[(1) - (1)].lex).line, "unsupported type", "samplerExternalOES", "");
3803 context->recover();
3804 }
3805 FRAG_VERT_ONLY("samplerExternalOES", (yyvsp[(1) - (1)].lex).line);
3806 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3807 (yyval.interm.type).setBasic(EbtSamplerExternalOES, qual, (yyvsp[(1) - (1)].lex).line);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003808 }
zmo@google.com09c323a2011-08-12 18:22:25 +00003809 break;
3810
3811 case 135:
3812
3813 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00003814 if (!context->supportsExtension("GL_ARB_texture_rectangle")) {
3815 context->error((yyvsp[(1) - (1)].lex).line, "unsupported type", "sampler2DRect", "");
3816 context->recover();
3817 }
3818 FRAG_VERT_ONLY("sampler2DRect", (yyvsp[(1) - (1)].lex).line);
3819 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3820 (yyval.interm.type).setBasic(EbtSampler2DRect, qual, (yyvsp[(1) - (1)].lex).line);
3821 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003822 break;
3823
zmo@google.com09c323a2011-08-12 18:22:25 +00003824 case 136:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003825
3826 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00003827 FRAG_VERT_ONLY("struct", (yyvsp[(1) - (1)].interm.type).line);
3828 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3829 (yyval.interm.type).qualifier = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3830 }
3831 break;
3832
3833 case 137:
3834
3835 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003836 //
3837 // This is for user defined type names. The lexical phase looked up the
3838 // type.
3839 //
3840 TType& structure = static_cast<TVariable*>((yyvsp[(1) - (1)].lex).symbol)->getType();
3841 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3842 (yyval.interm.type).setBasic(EbtStruct, qual, (yyvsp[(1) - (1)].lex).line);
3843 (yyval.interm.type).userDef = &structure;
kbr@chromium.org205fef32011-11-22 20:50:02 +00003844 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003845 break;
3846
zmo@google.com09c323a2011-08-12 18:22:25 +00003847 case 138:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003848
kbr@chromium.org205fef32011-11-22 20:50:02 +00003849 { if (context->enterStructDeclaration((yyvsp[(2) - (3)].lex).line, *(yyvsp[(2) - (3)].lex).string)) context->recover(); }
3850 break;
3851
3852 case 139:
3853
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003854 {
kbr@chromium.org476541f2011-10-27 21:14:51 +00003855 if (context->reservedErrorCheck((yyvsp[(2) - (6)].lex).line, *(yyvsp[(2) - (6)].lex).string))
3856 context->recover();
3857
3858 TType* structure = new TType((yyvsp[(5) - (6)].interm.typeList), *(yyvsp[(2) - (6)].lex).string);
3859 TVariable* userTypeDef = new TVariable((yyvsp[(2) - (6)].lex).string, *structure, true);
3860 if (! context->symbolTable.insert(*userTypeDef)) {
3861 context->error((yyvsp[(2) - (6)].lex).line, "redefinition", (yyvsp[(2) - (6)].lex).string->c_str(), "struct");
3862 context->recover();
3863 }
3864 (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (6)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003865 (yyval.interm.type).userDef = structure;
kbr@chromium.org476541f2011-10-27 21:14:51 +00003866 context->exitStructDeclaration();
kbr@chromium.org205fef32011-11-22 20:50:02 +00003867 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00003868 break;
3869
3870 case 140:
3871
kbr@chromium.org205fef32011-11-22 20:50:02 +00003872 { if (context->enterStructDeclaration((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string)) context->recover(); }
3873 break;
3874
3875 case 141:
3876
kbr@chromium.org476541f2011-10-27 21:14:51 +00003877 {
3878 TType* structure = new TType((yyvsp[(4) - (5)].interm.typeList), TString(""));
3879 (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (5)].lex).line);
3880 (yyval.interm.type).userDef = structure;
3881 context->exitStructDeclaration();
kbr@chromium.org205fef32011-11-22 20:50:02 +00003882 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003883 break;
3884
kbr@chromium.org476541f2011-10-27 21:14:51 +00003885 case 142:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003886
3887 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00003888 (yyval.interm.typeList) = (yyvsp[(1) - (1)].interm.typeList);
3889 }
3890 break;
3891
3892 case 143:
3893
3894 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003895 (yyval.interm.typeList) = (yyvsp[(1) - (2)].interm.typeList);
3896 for (unsigned int i = 0; i < (yyvsp[(2) - (2)].interm.typeList)->size(); ++i) {
3897 for (unsigned int j = 0; j < (yyval.interm.typeList)->size(); ++j) {
3898 if ((*(yyval.interm.typeList))[j].type->getFieldName() == (*(yyvsp[(2) - (2)].interm.typeList))[i].type->getFieldName()) {
3899 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());
3900 context->recover();
3901 }
3902 }
3903 (yyval.interm.typeList)->push_back((*(yyvsp[(2) - (2)].interm.typeList))[i]);
3904 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003905 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003906 break;
3907
kbr@chromium.org205fef32011-11-22 20:50:02 +00003908 case 144:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003909
3910 {
3911 (yyval.interm.typeList) = (yyvsp[(2) - (3)].interm.typeList);
3912
3913 if (context->voidErrorCheck((yyvsp[(1) - (3)].interm.type).line, (*(yyvsp[(2) - (3)].interm.typeList))[0].type->getFieldName(), (yyvsp[(1) - (3)].interm.type))) {
3914 context->recover();
3915 }
3916 for (unsigned int i = 0; i < (yyval.interm.typeList)->size(); ++i) {
3917 //
3918 // Careful not to replace already known aspects of type, like array-ness
3919 //
3920 TType* type = (*(yyval.interm.typeList))[i].type;
3921 type->setBasicType((yyvsp[(1) - (3)].interm.type).type);
3922 type->setNominalSize((yyvsp[(1) - (3)].interm.type).size);
3923 type->setMatrix((yyvsp[(1) - (3)].interm.type).matrix);
zmo@google.comdc4b4f82011-06-17 00:42:53 +00003924 type->setPrecision((yyvsp[(1) - (3)].interm.type).precision);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003925
3926 // don't allow arrays of arrays
3927 if (type->isArray()) {
3928 if (context->arrayTypeErrorCheck((yyvsp[(1) - (3)].interm.type).line, (yyvsp[(1) - (3)].interm.type)))
3929 context->recover();
3930 }
3931 if ((yyvsp[(1) - (3)].interm.type).array)
3932 type->setArraySize((yyvsp[(1) - (3)].interm.type).arraySize);
3933 if ((yyvsp[(1) - (3)].interm.type).userDef) {
3934 type->setStruct((yyvsp[(1) - (3)].interm.type).userDef->getStruct());
3935 type->setTypeName((yyvsp[(1) - (3)].interm.type).userDef->getTypeName());
3936 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00003937
3938 if (context->structNestingErrorCheck((yyvsp[(1) - (3)].interm.type).line, *type)) {
3939 context->recover();
3940 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003941 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003942 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003943 break;
3944
kbr@chromium.org476541f2011-10-27 21:14:51 +00003945 case 145:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003946
3947 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00003948 (yyval.interm.typeList) = NewPoolTTypeList();
3949 (yyval.interm.typeList)->push_back((yyvsp[(1) - (1)].interm.typeLine));
3950 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003951 break;
3952
kbr@chromium.org476541f2011-10-27 21:14:51 +00003953 case 146:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003954
3955 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00003956 (yyval.interm.typeList)->push_back((yyvsp[(3) - (3)].interm.typeLine));
3957 }
3958 break;
3959
3960 case 147:
3961
3962 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003963 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
3964 context->recover();
3965
3966 (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
3967 (yyval.interm.typeLine).line = (yyvsp[(1) - (1)].lex).line;
3968 (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (1)].lex).string);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003969 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003970 break;
3971
kbr@chromium.org205fef32011-11-22 20:50:02 +00003972 case 148:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003973
3974 {
3975 if (context->reservedErrorCheck((yyvsp[(1) - (4)].lex).line, *(yyvsp[(1) - (4)].lex).string))
3976 context->recover();
3977
3978 (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
3979 (yyval.interm.typeLine).line = (yyvsp[(1) - (4)].lex).line;
3980 (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (4)].lex).string);
3981
3982 int size;
3983 if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
3984 context->recover();
3985 (yyval.interm.typeLine).type->setArraySize(size);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003986 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003987 break;
3988
3989 case 149:
3990
kbr@chromium.org205fef32011-11-22 20:50:02 +00003991 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003992 break;
3993
3994 case 150:
3995
kbr@chromium.org205fef32011-11-22 20:50:02 +00003996 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003997 break;
3998
3999 case 151:
4000
kbr@chromium.org205fef32011-11-22 20:50:02 +00004001 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermAggregate); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004002 break;
4003
4004 case 152:
4005
kbr@chromium.org205fef32011-11-22 20:50:02 +00004006 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004007 break;
4008
4009 case 153:
4010
kbr@chromium.org205fef32011-11-22 20:50:02 +00004011 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004012 break;
4013
4014 case 154:
4015
kbr@chromium.org205fef32011-11-22 20:50:02 +00004016 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004017 break;
4018
4019 case 155:
4020
kbr@chromium.org205fef32011-11-22 20:50:02 +00004021 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004022 break;
4023
4024 case 156:
4025
kbr@chromium.org205fef32011-11-22 20:50:02 +00004026 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004027 break;
4028
4029 case 157:
4030
kbr@chromium.org205fef32011-11-22 20:50:02 +00004031 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
zmo@google.com09c323a2011-08-12 18:22:25 +00004032 break;
4033
4034 case 158:
4035
kbr@chromium.org205fef32011-11-22 20:50:02 +00004036 { (yyval.interm.intermAggregate) = 0; }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004037 break;
4038
4039 case 159:
4040
kbr@chromium.org205fef32011-11-22 20:50:02 +00004041 { context->symbolTable.push(); }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004042 break;
4043
4044 case 160:
4045
kbr@chromium.org205fef32011-11-22 20:50:02 +00004046 { context->symbolTable.pop(); }
4047 break;
4048
4049 case 161:
4050
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004051 {
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004052 if ((yyvsp[(3) - (5)].interm.intermAggregate) != 0) {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004053 (yyvsp[(3) - (5)].interm.intermAggregate)->setOp(EOpSequence);
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004054 (yyvsp[(3) - (5)].interm.intermAggregate)->setEndLine((yyvsp[(5) - (5)].lex).line);
4055 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004056 (yyval.interm.intermAggregate) = (yyvsp[(3) - (5)].interm.intermAggregate);
kbr@chromium.org205fef32011-11-22 20:50:02 +00004057 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004058 break;
4059
4060 case 162:
4061
kbr@chromium.org205fef32011-11-22 20:50:02 +00004062 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004063 break;
4064
4065 case 163:
4066
kbr@chromium.org205fef32011-11-22 20:50:02 +00004067 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004068 break;
4069
kbr@chromium.org476541f2011-10-27 21:14:51 +00004070 case 164:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004071
4072 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004073 (yyval.interm.intermNode) = 0;
4074 }
4075 break;
4076
4077 case 165:
4078
4079 {
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004080 if ((yyvsp[(2) - (3)].interm.intermAggregate)) {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004081 (yyvsp[(2) - (3)].interm.intermAggregate)->setOp(EOpSequence);
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004082 (yyvsp[(2) - (3)].interm.intermAggregate)->setEndLine((yyvsp[(3) - (3)].lex).line);
4083 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004084 (yyval.interm.intermNode) = (yyvsp[(2) - (3)].interm.intermAggregate);
kbr@chromium.org205fef32011-11-22 20:50:02 +00004085 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004086 break;
4087
kbr@chromium.org476541f2011-10-27 21:14:51 +00004088 case 166:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004089
4090 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004091 (yyval.interm.intermAggregate) = context->intermediate.makeAggregate((yyvsp[(1) - (1)].interm.intermNode), 0);
4092 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004093 break;
4094
kbr@chromium.org476541f2011-10-27 21:14:51 +00004095 case 167:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004096
kbr@chromium.org205fef32011-11-22 20:50:02 +00004097 {
4098 (yyval.interm.intermAggregate) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermAggregate), (yyvsp[(2) - (2)].interm.intermNode), 0);
4099 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004100 break;
4101
kbr@chromium.org476541f2011-10-27 21:14:51 +00004102 case 168:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004103
kbr@chromium.org205fef32011-11-22 20:50:02 +00004104 { (yyval.interm.intermNode) = 0; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004105 break;
4106
kbr@chromium.org476541f2011-10-27 21:14:51 +00004107 case 169:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004108
kbr@chromium.org205fef32011-11-22 20:50:02 +00004109 { (yyval.interm.intermNode) = static_cast<TIntermNode*>((yyvsp[(1) - (2)].interm.intermTypedNode)); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004110 break;
4111
kbr@chromium.org476541f2011-10-27 21:14:51 +00004112 case 170:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004113
4114 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004115 if (context->boolErrorCheck((yyvsp[(1) - (5)].lex).line, (yyvsp[(3) - (5)].interm.intermTypedNode)))
4116 context->recover();
4117 (yyval.interm.intermNode) = context->intermediate.addSelection((yyvsp[(3) - (5)].interm.intermTypedNode), (yyvsp[(5) - (5)].interm.nodePair), (yyvsp[(1) - (5)].lex).line);
4118 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004119 break;
4120
kbr@chromium.org476541f2011-10-27 21:14:51 +00004121 case 171:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004122
4123 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004124 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermNode);
4125 (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermNode);
4126 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004127 break;
4128
kbr@chromium.org476541f2011-10-27 21:14:51 +00004129 case 172:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004130
4131 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004132 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (1)].interm.intermNode);
4133 (yyval.interm.nodePair).node2 = 0;
4134 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004135 break;
4136
kbr@chromium.org476541f2011-10-27 21:14:51 +00004137 case 173:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004138
4139 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004140 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
4141 if (context->boolErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)->getLine(), (yyvsp[(1) - (1)].interm.intermTypedNode)))
4142 context->recover();
4143 }
4144 break;
4145
4146 case 174:
4147
4148 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004149 TIntermNode* intermNode;
4150 if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
4151 context->recover();
4152 if (context->boolErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
4153 context->recover();
4154
4155 if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode))
4156 (yyval.interm.intermTypedNode) = (yyvsp[(4) - (4)].interm.intermTypedNode);
4157 else {
4158 context->recover();
4159 (yyval.interm.intermTypedNode) = 0;
4160 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004161 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004162 break;
4163
kbr@chromium.org476541f2011-10-27 21:14:51 +00004164 case 175:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004165
kbr@chromium.org205fef32011-11-22 20:50:02 +00004166 { context->symbolTable.push(); ++context->loopNestingLevel; }
4167 break;
4168
4169 case 176:
4170
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004171 {
4172 context->symbolTable.pop();
alokp@chromium.org52813552010-11-16 18:36:09 +00004173 (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 +00004174 --context->loopNestingLevel;
kbr@chromium.org205fef32011-11-22 20:50:02 +00004175 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004176 break;
4177
kbr@chromium.org476541f2011-10-27 21:14:51 +00004178 case 177:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004179
kbr@chromium.org205fef32011-11-22 20:50:02 +00004180 { ++context->loopNestingLevel; }
4181 break;
4182
4183 case 178:
4184
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004185 {
4186 if (context->boolErrorCheck((yyvsp[(8) - (8)].lex).line, (yyvsp[(6) - (8)].interm.intermTypedNode)))
4187 context->recover();
4188
alokp@chromium.org52813552010-11-16 18:36:09 +00004189 (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 +00004190 --context->loopNestingLevel;
kbr@chromium.org205fef32011-11-22 20:50:02 +00004191 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004192 break;
4193
kbr@chromium.org476541f2011-10-27 21:14:51 +00004194 case 179:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004195
kbr@chromium.org205fef32011-11-22 20:50:02 +00004196 { context->symbolTable.push(); ++context->loopNestingLevel; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004197 break;
4198
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004199 case 180:
4200
4201 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004202 context->symbolTable.pop();
4203 (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);
4204 --context->loopNestingLevel;
4205 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004206 break;
4207
4208 case 181:
4209
4210 {
kbr@chromium.org476541f2011-10-27 21:14:51 +00004211 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
kbr@chromium.org205fef32011-11-22 20:50:02 +00004212 }
zmo@google.com09c323a2011-08-12 18:22:25 +00004213 break;
4214
4215 case 182:
4216
4217 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004218 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
4219 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004220 break;
4221
4222 case 183:
4223
4224 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004225 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
4226 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004227 break;
4228
4229 case 184:
4230
4231 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004232 (yyval.interm.intermTypedNode) = 0;
4233 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004234 break;
4235
kbr@chromium.org476541f2011-10-27 21:14:51 +00004236 case 185:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004237
4238 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004239 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (2)].interm.intermTypedNode);
4240 (yyval.interm.nodePair).node2 = 0;
4241 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004242 break;
4243
kbr@chromium.org476541f2011-10-27 21:14:51 +00004244 case 186:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004245
4246 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004247 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermTypedNode);
4248 (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermTypedNode);
4249 }
4250 break;
4251
4252 case 187:
4253
4254 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004255 if (context->loopNestingLevel <= 0) {
4256 context->error((yyvsp[(1) - (2)].lex).line, "continue statement only allowed in loops", "", "");
4257 context->recover();
4258 }
4259 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpContinue, (yyvsp[(1) - (2)].lex).line);
kbr@chromium.org205fef32011-11-22 20:50:02 +00004260 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004261 break;
4262
kbr@chromium.org205fef32011-11-22 20:50:02 +00004263 case 188:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004264
4265 {
4266 if (context->loopNestingLevel <= 0) {
4267 context->error((yyvsp[(1) - (2)].lex).line, "break statement only allowed in loops", "", "");
4268 context->recover();
4269 }
4270 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpBreak, (yyvsp[(1) - (2)].lex).line);
kbr@chromium.org205fef32011-11-22 20:50:02 +00004271 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004272 break;
4273
kbr@chromium.org205fef32011-11-22 20:50:02 +00004274 case 189:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004275
4276 {
4277 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(1) - (2)].lex).line);
4278 if (context->currentFunctionType->getBasicType() != EbtVoid) {
4279 context->error((yyvsp[(1) - (2)].lex).line, "non-void function must return a value", "return", "");
4280 context->recover();
4281 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004282 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004283 break;
4284
kbr@chromium.org205fef32011-11-22 20:50:02 +00004285 case 190:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004286
4287 {
4288 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(2) - (3)].interm.intermTypedNode), (yyvsp[(1) - (3)].lex).line);
4289 context->functionReturnsValue = true;
4290 if (context->currentFunctionType->getBasicType() == EbtVoid) {
4291 context->error((yyvsp[(1) - (3)].lex).line, "void function cannot return a value", "return", "");
4292 context->recover();
4293 } else if (*(context->currentFunctionType) != (yyvsp[(2) - (3)].interm.intermTypedNode)->getType()) {
4294 context->error((yyvsp[(1) - (3)].lex).line, "function return is not matching type:", "return", "");
4295 context->recover();
4296 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004297 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004298 break;
4299
kbr@chromium.org476541f2011-10-27 21:14:51 +00004300 case 191:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004301
4302 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004303 FRAG_ONLY("discard", (yyvsp[(1) - (2)].lex).line);
4304 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpKill, (yyvsp[(1) - (2)].lex).line);
4305 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004306 break;
4307
kbr@chromium.org476541f2011-10-27 21:14:51 +00004308 case 192:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004309
4310 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004311 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
zmo@google.com09c323a2011-08-12 18:22:25 +00004312 context->treeRoot = (yyval.interm.intermNode);
kbr@chromium.org205fef32011-11-22 20:50:02 +00004313 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004314 break;
4315
zmo@google.com09c323a2011-08-12 18:22:25 +00004316 case 193:
4317
4318 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004319 (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermNode), (yyvsp[(2) - (2)].interm.intermNode), 0);
4320 context->treeRoot = (yyval.interm.intermNode);
4321 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004322 break;
4323
4324 case 194:
4325
4326 {
4327 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
kbr@chromium.org205fef32011-11-22 20:50:02 +00004328 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004329 break;
4330
4331 case 195:
4332
4333 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004334 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
4335 }
4336 break;
4337
4338 case 196:
4339
4340 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004341 TFunction* function = (yyvsp[(1) - (1)].interm).function;
4342 TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find(function->getMangledName()));
4343 //
4344 // Note: 'prevDec' could be 'function' if this is the first time we've seen function
4345 // as it would have just been put in the symbol table. Otherwise, we're looking up
4346 // an earlier occurance.
4347 //
4348 if (prevDec->isDefined()) {
4349 //
4350 // Then this function already has a body.
4351 //
4352 context->error((yyvsp[(1) - (1)].interm).line, "function already has a body", function->getName().c_str(), "");
4353 context->recover();
4354 }
4355 prevDec->setDefined();
4356
4357 //
4358 // Raise error message if main function takes any parameters or return anything other than void
4359 //
4360 if (function->getName() == "main") {
4361 if (function->getParamCount() > 0) {
4362 context->error((yyvsp[(1) - (1)].interm).line, "function cannot take any parameter(s)", function->getName().c_str(), "");
4363 context->recover();
4364 }
4365 if (function->getReturnType().getBasicType() != EbtVoid) {
4366 context->error((yyvsp[(1) - (1)].interm).line, "", function->getReturnType().getBasicString(), "main function cannot return a value");
4367 context->recover();
4368 }
4369 }
4370
4371 //
4372 // New symbol table scope for body of function plus its arguments
4373 //
4374 context->symbolTable.push();
4375
4376 //
4377 // Remember the return type for later checking for RETURN statements.
4378 //
4379 context->currentFunctionType = &(prevDec->getReturnType());
4380 context->functionReturnsValue = false;
4381
4382 //
4383 // Insert parameters into the symbol table.
4384 // If the parameter has no name, it's not an error, just don't insert it
4385 // (could be used for unused args).
4386 //
4387 // Also, accumulate the list of parameters into the HIL, so lower level code
4388 // knows where to find parameters.
4389 //
4390 TIntermAggregate* paramNodes = new TIntermAggregate;
4391 for (int i = 0; i < function->getParamCount(); i++) {
4392 const TParameter& param = function->getParam(i);
4393 if (param.name != 0) {
4394 TVariable *variable = new TVariable(param.name, *param.type);
4395 //
4396 // Insert the parameters with name in the symbol table.
4397 //
4398 if (! context->symbolTable.insert(*variable)) {
4399 context->error((yyvsp[(1) - (1)].interm).line, "redefinition", variable->getName().c_str(), "");
4400 context->recover();
4401 delete variable;
4402 }
4403
4404 //
4405 // Add the parameter to the HIL
4406 //
4407 paramNodes = context->intermediate.growAggregate(
4408 paramNodes,
4409 context->intermediate.addSymbol(variable->getUniqueId(),
4410 variable->getName(),
4411 variable->getType(), (yyvsp[(1) - (1)].interm).line),
4412 (yyvsp[(1) - (1)].interm).line);
4413 } else {
4414 paramNodes = context->intermediate.growAggregate(paramNodes, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (1)].interm).line), (yyvsp[(1) - (1)].interm).line);
4415 }
4416 }
4417 context->intermediate.setAggregateOperator(paramNodes, EOpParameters, (yyvsp[(1) - (1)].interm).line);
4418 (yyvsp[(1) - (1)].interm).intermAggregate = paramNodes;
4419 context->loopNestingLevel = 0;
kbr@chromium.org205fef32011-11-22 20:50:02 +00004420 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004421 break;
4422
kbr@chromium.org205fef32011-11-22 20:50:02 +00004423 case 197:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004424
4425 {
4426 //?? Check that all paths return a value if return type != void ?
4427 // May be best done as post process phase on intermediate code
4428 if (context->currentFunctionType->getBasicType() != EbtVoid && ! context->functionReturnsValue) {
4429 context->error((yyvsp[(1) - (3)].interm).line, "function does not return a value:", "", (yyvsp[(1) - (3)].interm).function->getName().c_str());
4430 context->recover();
4431 }
4432 context->symbolTable.pop();
4433 (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermAggregate, (yyvsp[(3) - (3)].interm.intermNode), 0);
4434 context->intermediate.setAggregateOperator((yyval.interm.intermNode), EOpFunction, (yyvsp[(1) - (3)].interm).line);
4435 (yyval.interm.intermNode)->getAsAggregate()->setName((yyvsp[(1) - (3)].interm).function->getMangledName().c_str());
4436 (yyval.interm.intermNode)->getAsAggregate()->setType((yyvsp[(1) - (3)].interm).function->getReturnType());
4437
4438 // store the pragma information for debug and optimize and other vendor specific
4439 // information. This information can be queried from the parse tree
4440 (yyval.interm.intermNode)->getAsAggregate()->setOptimize(context->contextPragma.optimize);
4441 (yyval.interm.intermNode)->getAsAggregate()->setDebug(context->contextPragma.debug);
4442 (yyval.interm.intermNode)->getAsAggregate()->addToPragmaTable(context->contextPragma.pragmaTable);
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004443
4444 if ((yyvsp[(3) - (3)].interm.intermNode) && (yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate())
4445 (yyval.interm.intermNode)->getAsAggregate()->setEndLine((yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate()->getEndLine());
kbr@chromium.org205fef32011-11-22 20:50:02 +00004446 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004447 break;
4448
4449
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004450
4451 default: break;
4452 }
4453 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
4454
4455 YYPOPSTACK (yylen);
4456 yylen = 0;
4457 YY_STACK_PRINT (yyss, yyssp);
4458
4459 *++yyvsp = yyval;
4460
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004461 /* Now `shift' the result of the reduction. Determine what state
4462 that goes to, based on the state we popped back to and the rule
4463 number reduced by. */
4464
4465 yyn = yyr1[yyn];
4466
4467 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
4468 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
4469 yystate = yytable[yystate];
4470 else
4471 yystate = yydefgoto[yyn - YYNTOKENS];
4472
4473 goto yynewstate;
4474
4475
4476/*------------------------------------.
4477| yyerrlab -- here on detecting error |
4478`------------------------------------*/
4479yyerrlab:
4480 /* If not already recovering from an error, report this error. */
4481 if (!yyerrstatus)
4482 {
4483 ++yynerrs;
4484#if ! YYERROR_VERBOSE
4485 yyerror (context, YY_("syntax error"));
4486#else
4487 {
4488 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
4489 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
4490 {
4491 YYSIZE_T yyalloc = 2 * yysize;
4492 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
4493 yyalloc = YYSTACK_ALLOC_MAXIMUM;
4494 if (yymsg != yymsgbuf)
4495 YYSTACK_FREE (yymsg);
4496 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
4497 if (yymsg)
4498 yymsg_alloc = yyalloc;
4499 else
4500 {
4501 yymsg = yymsgbuf;
4502 yymsg_alloc = sizeof yymsgbuf;
4503 }
4504 }
4505
4506 if (0 < yysize && yysize <= yymsg_alloc)
4507 {
4508 (void) yysyntax_error (yymsg, yystate, yychar);
4509 yyerror (context, yymsg);
4510 }
4511 else
4512 {
4513 yyerror (context, YY_("syntax error"));
4514 if (yysize != 0)
4515 goto yyexhaustedlab;
4516 }
4517 }
4518#endif
4519 }
4520
4521
4522
4523 if (yyerrstatus == 3)
4524 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004525 /* If just tried and failed to reuse lookahead token after an
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004526 error, discard it. */
4527
4528 if (yychar <= YYEOF)
4529 {
4530 /* Return failure if at end of input. */
4531 if (yychar == YYEOF)
4532 YYABORT;
4533 }
4534 else
4535 {
4536 yydestruct ("Error: discarding",
4537 yytoken, &yylval, context);
4538 yychar = YYEMPTY;
4539 }
4540 }
4541
kbr@chromium.org205fef32011-11-22 20:50:02 +00004542 /* Else will try to reuse lookahead token after shifting the error
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004543 token. */
4544 goto yyerrlab1;
4545
4546
4547/*---------------------------------------------------.
4548| yyerrorlab -- error raised explicitly by YYERROR. |
4549`---------------------------------------------------*/
4550yyerrorlab:
4551
4552 /* Pacify compilers like GCC when the user code never invokes
4553 YYERROR and the label yyerrorlab therefore never appears in user
4554 code. */
4555 if (/*CONSTCOND*/ 0)
4556 goto yyerrorlab;
4557
4558 /* Do not reclaim the symbols of the rule which action triggered
4559 this YYERROR. */
4560 YYPOPSTACK (yylen);
4561 yylen = 0;
4562 YY_STACK_PRINT (yyss, yyssp);
4563 yystate = *yyssp;
4564 goto yyerrlab1;
4565
4566
4567/*-------------------------------------------------------------.
4568| yyerrlab1 -- common code for both syntax error and YYERROR. |
4569`-------------------------------------------------------------*/
4570yyerrlab1:
4571 yyerrstatus = 3; /* Each real token shifted decrements this. */
4572
4573 for (;;)
4574 {
4575 yyn = yypact[yystate];
4576 if (yyn != YYPACT_NINF)
4577 {
4578 yyn += YYTERROR;
4579 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
4580 {
4581 yyn = yytable[yyn];
4582 if (0 < yyn)
4583 break;
4584 }
4585 }
4586
4587 /* Pop the current state because it cannot handle the error token. */
4588 if (yyssp == yyss)
4589 YYABORT;
4590
4591
4592 yydestruct ("Error: popping",
4593 yystos[yystate], yyvsp, context);
4594 YYPOPSTACK (1);
4595 yystate = *yyssp;
4596 YY_STACK_PRINT (yyss, yyssp);
4597 }
4598
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004599 *++yyvsp = yylval;
4600
4601
4602 /* Shift the error token. */
4603 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
4604
4605 yystate = yyn;
4606 goto yynewstate;
4607
4608
4609/*-------------------------------------.
4610| yyacceptlab -- YYACCEPT comes here. |
4611`-------------------------------------*/
4612yyacceptlab:
4613 yyresult = 0;
4614 goto yyreturn;
4615
4616/*-----------------------------------.
4617| yyabortlab -- YYABORT comes here. |
4618`-----------------------------------*/
4619yyabortlab:
4620 yyresult = 1;
4621 goto yyreturn;
4622
kbr@chromium.org205fef32011-11-22 20:50:02 +00004623#if !defined(yyoverflow) || YYERROR_VERBOSE
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004624/*-------------------------------------------------.
4625| yyexhaustedlab -- memory exhaustion comes here. |
4626`-------------------------------------------------*/
4627yyexhaustedlab:
4628 yyerror (context, YY_("memory exhausted"));
4629 yyresult = 2;
4630 /* Fall through. */
4631#endif
4632
4633yyreturn:
kbr@chromium.org205fef32011-11-22 20:50:02 +00004634 if (yychar != YYEMPTY)
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004635 yydestruct ("Cleanup: discarding lookahead",
4636 yytoken, &yylval, context);
4637 /* Do not reclaim the symbols of the rule which action triggered
4638 this YYABORT or YYACCEPT. */
4639 YYPOPSTACK (yylen);
4640 YY_STACK_PRINT (yyss, yyssp);
4641 while (yyssp != yyss)
4642 {
4643 yydestruct ("Cleanup: popping",
4644 yystos[*yyssp], yyvsp, context);
4645 YYPOPSTACK (1);
4646 }
4647#ifndef yyoverflow
4648 if (yyss != yyssa)
4649 YYSTACK_FREE (yyss);
4650#endif
4651#if YYERROR_VERBOSE
4652 if (yymsg != yymsgbuf)
4653 YYSTACK_FREE (yymsg);
4654#endif
4655 /* Make sure YYID is used. */
4656 return YYID (yyresult);
4657}
4658
4659
4660
4661
4662
4663int glslang_parse(TParseContext* context) {
4664 return yyparse(context);
4665}
4666
4667