blob: d2fdc17b053bd1d62192c7dbf548cb5b37878ba3 [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
apatrick@chromium.orgf3c92312012-01-25 00:51:19 +00001729 // Delete any automatically generated switch with no cases code that appears
1730 // here. It will produce a warning (and therefore an error) in MSVC.
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001731}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001732
1733/* Prevent warnings from -Wmissing-prototypes. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001734#ifdef YYPARSE_PARAM
1735#if defined __STDC__ || defined __cplusplus
1736int yyparse (void *YYPARSE_PARAM);
1737#else
1738int yyparse ();
1739#endif
1740#else /* ! YYPARSE_PARAM */
1741#if defined __STDC__ || defined __cplusplus
1742int yyparse (TParseContext* context);
1743#else
1744int yyparse ();
1745#endif
1746#endif /* ! YYPARSE_PARAM */
1747
1748
1749
1750
1751
kbr@chromium.org205fef32011-11-22 20:50:02 +00001752/*-------------------------.
1753| yyparse or yypush_parse. |
1754`-------------------------*/
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001755
1756#ifdef YYPARSE_PARAM
1757#if (defined __STDC__ || defined __C99__FUNC__ \
1758 || defined __cplusplus || defined _MSC_VER)
1759int
1760yyparse (void *YYPARSE_PARAM)
1761#else
1762int
1763yyparse (YYPARSE_PARAM)
1764 void *YYPARSE_PARAM;
1765#endif
1766#else /* ! YYPARSE_PARAM */
1767#if (defined __STDC__ || defined __C99__FUNC__ \
1768 || defined __cplusplus || defined _MSC_VER)
1769int
1770yyparse (TParseContext* context)
1771#else
1772int
1773yyparse (context)
1774 TParseContext* context;
1775#endif
1776#endif
1777{
kbr@chromium.org205fef32011-11-22 20:50:02 +00001778/* The lookahead symbol. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001779int yychar;
1780
kbr@chromium.org205fef32011-11-22 20:50:02 +00001781/* The semantic value of the lookahead symbol. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001782YYSTYPE yylval;
1783
kbr@chromium.org205fef32011-11-22 20:50:02 +00001784 /* Number of syntax errors so far. */
1785 int yynerrs;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001786
kbr@chromium.org205fef32011-11-22 20:50:02 +00001787 int yystate;
1788 /* Number of tokens to shift before error messages enabled. */
1789 int yyerrstatus;
1790
1791 /* The stacks and their tools:
1792 `yyss': related to states.
1793 `yyvs': related to semantic values.
1794
1795 Refer to the stacks thru separate pointers, to allow yyoverflow
1796 to reallocate them elsewhere. */
1797
1798 /* The state stack. */
1799 yytype_int16 yyssa[YYINITDEPTH];
1800 yytype_int16 *yyss;
1801 yytype_int16 *yyssp;
1802
1803 /* The semantic value stack. */
1804 YYSTYPE yyvsa[YYINITDEPTH];
1805 YYSTYPE *yyvs;
1806 YYSTYPE *yyvsp;
1807
1808 YYSIZE_T yystacksize;
1809
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001810 int yyn;
1811 int yyresult;
kbr@chromium.org205fef32011-11-22 20:50:02 +00001812 /* Lookahead token as an internal (translated) token number. */
1813 int yytoken;
1814 /* The variables used to return semantic value and location from the
1815 action routines. */
1816 YYSTYPE yyval;
1817
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001818#if YYERROR_VERBOSE
1819 /* Buffer for error messages, and its allocated size. */
1820 char yymsgbuf[128];
1821 char *yymsg = yymsgbuf;
1822 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1823#endif
1824
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001825#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1826
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001827 /* The number of symbols on the RHS of the reduced rule.
1828 Keep to zero when no symbol should be popped. */
1829 int yylen = 0;
1830
kbr@chromium.org205fef32011-11-22 20:50:02 +00001831 yytoken = 0;
1832 yyss = yyssa;
1833 yyvs = yyvsa;
1834 yystacksize = YYINITDEPTH;
1835
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001836 YYDPRINTF ((stderr, "Starting parse\n"));
1837
1838 yystate = 0;
1839 yyerrstatus = 0;
1840 yynerrs = 0;
kbr@chromium.org205fef32011-11-22 20:50:02 +00001841 yychar = YYEMPTY; /* Cause a token to be read. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001842
1843 /* Initialize stack pointers.
1844 Waste one element of value and location stack
1845 so that they stay on the same level as the state stack.
1846 The wasted elements are never initialized. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001847 yyssp = yyss;
1848 yyvsp = yyvs;
1849
1850 goto yysetstate;
1851
1852/*------------------------------------------------------------.
1853| yynewstate -- Push a new state, which is found in yystate. |
1854`------------------------------------------------------------*/
1855 yynewstate:
1856 /* In all cases, when you get here, the value and location stacks
1857 have just been pushed. So pushing a state here evens the stacks. */
1858 yyssp++;
1859
1860 yysetstate:
1861 *yyssp = yystate;
1862
1863 if (yyss + yystacksize - 1 <= yyssp)
1864 {
1865 /* Get the current used size of the three stacks, in elements. */
1866 YYSIZE_T yysize = yyssp - yyss + 1;
1867
1868#ifdef yyoverflow
1869 {
1870 /* Give user a chance to reallocate the stack. Use copies of
1871 these so that the &'s don't force the real ones into
1872 memory. */
1873 YYSTYPE *yyvs1 = yyvs;
1874 yytype_int16 *yyss1 = yyss;
1875
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001876 /* Each stack pointer address is followed by the size of the
1877 data in use in that stack, in bytes. This used to be a
1878 conditional around just the two extra args, but that might
1879 be undefined if yyoverflow is a macro. */
1880 yyoverflow (YY_("memory exhausted"),
1881 &yyss1, yysize * sizeof (*yyssp),
1882 &yyvs1, yysize * sizeof (*yyvsp),
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001883 &yystacksize);
1884
1885 yyss = yyss1;
1886 yyvs = yyvs1;
1887 }
1888#else /* no yyoverflow */
1889# ifndef YYSTACK_RELOCATE
1890 goto yyexhaustedlab;
1891# else
1892 /* Extend the stack our own way. */
1893 if (YYMAXDEPTH <= yystacksize)
1894 goto yyexhaustedlab;
1895 yystacksize *= 2;
1896 if (YYMAXDEPTH < yystacksize)
1897 yystacksize = YYMAXDEPTH;
1898
1899 {
1900 yytype_int16 *yyss1 = yyss;
1901 union yyalloc *yyptr =
1902 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1903 if (! yyptr)
1904 goto yyexhaustedlab;
kbr@chromium.org205fef32011-11-22 20:50:02 +00001905 YYSTACK_RELOCATE (yyss_alloc, yyss);
1906 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001907# undef YYSTACK_RELOCATE
1908 if (yyss1 != yyssa)
1909 YYSTACK_FREE (yyss1);
1910 }
1911# endif
1912#endif /* no yyoverflow */
1913
1914 yyssp = yyss + yysize - 1;
1915 yyvsp = yyvs + yysize - 1;
1916
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001917 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1918 (unsigned long int) yystacksize));
1919
1920 if (yyss + yystacksize - 1 <= yyssp)
1921 YYABORT;
1922 }
1923
1924 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1925
kbr@chromium.org205fef32011-11-22 20:50:02 +00001926 if (yystate == YYFINAL)
1927 YYACCEPT;
1928
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001929 goto yybackup;
1930
1931/*-----------.
1932| yybackup. |
1933`-----------*/
1934yybackup:
1935
1936 /* Do appropriate processing given the current state. Read a
kbr@chromium.org205fef32011-11-22 20:50:02 +00001937 lookahead token if we need one and don't already have one. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001938
kbr@chromium.org205fef32011-11-22 20:50:02 +00001939 /* First try to decide what to do without reference to lookahead token. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001940 yyn = yypact[yystate];
1941 if (yyn == YYPACT_NINF)
1942 goto yydefault;
1943
kbr@chromium.org205fef32011-11-22 20:50:02 +00001944 /* Not known => get a lookahead token if don't already have one. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001945
kbr@chromium.org205fef32011-11-22 20:50:02 +00001946 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001947 if (yychar == YYEMPTY)
1948 {
1949 YYDPRINTF ((stderr, "Reading a token: "));
1950 yychar = YYLEX;
1951 }
1952
1953 if (yychar <= YYEOF)
1954 {
1955 yychar = yytoken = YYEOF;
1956 YYDPRINTF ((stderr, "Now at end of input.\n"));
1957 }
1958 else
1959 {
1960 yytoken = YYTRANSLATE (yychar);
1961 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1962 }
1963
1964 /* If the proper action on seeing token YYTOKEN is to reduce or to
1965 detect an error, take that action. */
1966 yyn += yytoken;
1967 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1968 goto yydefault;
1969 yyn = yytable[yyn];
1970 if (yyn <= 0)
1971 {
1972 if (yyn == 0 || yyn == YYTABLE_NINF)
1973 goto yyerrlab;
1974 yyn = -yyn;
1975 goto yyreduce;
1976 }
1977
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001978 /* Count tokens shifted since error; after three, turn off error
1979 status. */
1980 if (yyerrstatus)
1981 yyerrstatus--;
1982
kbr@chromium.org205fef32011-11-22 20:50:02 +00001983 /* Shift the lookahead token. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001984 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1985
kbr@chromium.org205fef32011-11-22 20:50:02 +00001986 /* Discard the shifted token. */
1987 yychar = YYEMPTY;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001988
1989 yystate = yyn;
1990 *++yyvsp = yylval;
1991
1992 goto yynewstate;
1993
1994
1995/*-----------------------------------------------------------.
1996| yydefault -- do the default action for the current state. |
1997`-----------------------------------------------------------*/
1998yydefault:
1999 yyn = yydefact[yystate];
2000 if (yyn == 0)
2001 goto yyerrlab;
2002 goto yyreduce;
2003
2004
2005/*-----------------------------.
2006| yyreduce -- Do a reduction. |
2007`-----------------------------*/
2008yyreduce:
2009 /* yyn is the number of a rule to reduce with. */
2010 yylen = yyr2[yyn];
2011
2012 /* If YYLEN is nonzero, implement the default value of the action:
2013 `$$ = $1'.
2014
2015 Otherwise, the following line sets YYVAL to garbage.
2016 This behavior is undocumented and Bison
2017 users should not rely upon it. Assigning to YYVAL
2018 unconditionally makes the parser a bit smaller, and it avoids a
2019 GCC warning that YYVAL may be used uninitialized. */
2020 yyval = yyvsp[1-yylen];
2021
2022
2023 YY_REDUCE_PRINT (yyn);
2024 switch (yyn)
2025 {
2026 case 2:
2027
2028 {
2029 // The symbol table search was done in the lexical phase
2030 const TSymbol* symbol = (yyvsp[(1) - (1)].lex).symbol;
2031 const TVariable* variable;
2032 if (symbol == 0) {
2033 context->error((yyvsp[(1) - (1)].lex).line, "undeclared identifier", (yyvsp[(1) - (1)].lex).string->c_str(), "");
2034 context->recover();
2035 TType type(EbtFloat, EbpUndefined);
2036 TVariable* fakeVariable = new TVariable((yyvsp[(1) - (1)].lex).string, type);
2037 context->symbolTable.insert(*fakeVariable);
2038 variable = fakeVariable;
2039 } else {
2040 // This identifier can only be a variable type symbol
2041 if (! symbol->isVariable()) {
2042 context->error((yyvsp[(1) - (1)].lex).line, "variable expected", (yyvsp[(1) - (1)].lex).string->c_str(), "");
2043 context->recover();
2044 }
2045 variable = static_cast<const TVariable*>(symbol);
2046 }
2047
2048 // don't delete $1.string, it's used by error recovery, and the pool
2049 // pop will reclaim the memory
2050
2051 if (variable->getType().getQualifier() == EvqConst ) {
2052 ConstantUnion* constArray = variable->getConstPointer();
2053 TType t(variable->getType());
2054 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(constArray, t, (yyvsp[(1) - (1)].lex).line);
2055 } else
2056 (yyval.interm.intermTypedNode) = context->intermediate.addSymbol(variable->getUniqueId(),
2057 variable->getName(),
2058 variable->getType(), (yyvsp[(1) - (1)].lex).line);
kbr@chromium.org205fef32011-11-22 20:50:02 +00002059 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002060 break;
2061
2062 case 3:
2063
2064 {
2065 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
kbr@chromium.org205fef32011-11-22 20:50:02 +00002066 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002067 break;
2068
2069 case 4:
2070
2071 {
2072 //
2073 // INT_TYPE is only 16-bit plus sign bit for vertex/fragment shaders,
2074 // check for overflow for constants
2075 //
2076 if (abs((yyvsp[(1) - (1)].lex).i) >= (1 << 16)) {
2077 context->error((yyvsp[(1) - (1)].lex).line, " integer constant overflow", "", "");
2078 context->recover();
2079 }
2080 ConstantUnion *unionArray = new ConstantUnion[1];
2081 unionArray->setIConst((yyvsp[(1) - (1)].lex).i);
2082 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
kbr@chromium.org205fef32011-11-22 20:50:02 +00002083 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002084 break;
2085
2086 case 5:
2087
2088 {
2089 ConstantUnion *unionArray = new ConstantUnion[1];
2090 unionArray->setFConst((yyvsp[(1) - (1)].lex).f);
2091 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
kbr@chromium.org205fef32011-11-22 20:50:02 +00002092 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002093 break;
2094
2095 case 6:
2096
2097 {
2098 ConstantUnion *unionArray = new ConstantUnion[1];
2099 unionArray->setBConst((yyvsp[(1) - (1)].lex).b);
2100 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
kbr@chromium.org205fef32011-11-22 20:50:02 +00002101 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002102 break;
2103
2104 case 7:
2105
2106 {
2107 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (3)].interm.intermTypedNode);
kbr@chromium.org205fef32011-11-22 20:50:02 +00002108 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002109 break;
2110
2111 case 8:
2112
2113 {
2114 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
kbr@chromium.org205fef32011-11-22 20:50:02 +00002115 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002116 break;
2117
2118 case 9:
2119
2120 {
2121 if (!(yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isVector()) {
2122 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode())
2123 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(), "");
2124 else
2125 context->error((yyvsp[(2) - (4)].lex).line, " left of '[' is not of type array, matrix, or vector ", "expression", "");
2126 context->recover();
2127 }
2128 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst && (yyvsp[(3) - (4)].interm.intermTypedNode)->getQualifier() == EvqConst) {
2129 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) { // constant folding for arrays
2130 (yyval.interm.intermTypedNode) = context->addConstArrayNode((yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2131 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector()) { // constant folding for vectors
2132 TVectorFields fields;
2133 fields.num = 1;
2134 fields.offsets[0] = (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(); // need to do it this way because v.xy sends fields integer array
2135 (yyval.interm.intermTypedNode) = context->addConstVectorNode(fields, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2136 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix()) { // constant folding for matrices
2137 (yyval.interm.intermTypedNode) = context->addConstMatrixNode((yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2138 }
2139 } else {
2140 if ((yyvsp[(3) - (4)].interm.intermTypedNode)->getQualifier() == EvqConst) {
2141 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() ) {
2142 context->error((yyvsp[(2) - (4)].lex).line, "", "[", "field selection out of range '%d'", (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst());
2143 context->recover();
2144 } else {
2145 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) {
2146 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize() == 0) {
2147 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getMaxArraySize() <= (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst()) {
2148 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))
2149 context->recover();
2150 } else {
2151 if (context->arraySetMaxSize((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getTypePointer(), 0, false, (yyvsp[(2) - (4)].lex).line))
2152 context->recover();
2153 }
2154 } else if ( (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst() >= (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize()) {
2155 context->error((yyvsp[(2) - (4)].lex).line, "", "[", "array index out of range '%d'", (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst());
2156 context->recover();
2157 }
2158 }
2159 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(3) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2160 }
2161 } else {
2162 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize() == 0) {
2163 context->error((yyvsp[(2) - (4)].lex).line, "", "[", "array must be redeclared with a size before being indexed with a variable");
2164 context->recover();
2165 }
2166
2167 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexIndirect, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(3) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2168 }
2169 }
2170 if ((yyval.interm.intermTypedNode) == 0) {
2171 ConstantUnion *unionArray = new ConstantUnion[1];
2172 unionArray->setFConst(0.0f);
2173 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpHigh, EvqConst), (yyvsp[(2) - (4)].lex).line);
2174 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) {
2175 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getStruct())
2176 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getStruct(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getTypeName()));
2177 else
2178 (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()));
2179
2180 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst)
2181 (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConst);
2182 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst)
2183 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqConst, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize()));
2184 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix())
2185 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize()));
2186 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector() && (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));
2188 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector())
2189 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary));
2190 else
2191 (yyval.interm.intermTypedNode)->setType((yyvsp[(1) - (4)].interm.intermTypedNode)->getType());
kbr@chromium.org205fef32011-11-22 20:50:02 +00002192 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002193 break;
2194
2195 case 10:
2196
2197 {
2198 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
kbr@chromium.org205fef32011-11-22 20:50:02 +00002199 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002200 break;
2201
2202 case 11:
2203
2204 {
2205 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isArray()) {
2206 context->error((yyvsp[(3) - (3)].lex).line, "cannot apply dot operator to an array", ".", "");
2207 context->recover();
2208 }
2209
2210 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isVector()) {
2211 TVectorFields fields;
2212 if (! context->parseVectorFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yyvsp[(3) - (3)].lex).line)) {
2213 fields.num = 1;
2214 fields.offsets[0] = 0;
2215 context->recover();
2216 }
2217
2218 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) { // constant folding for vector fields
2219 (yyval.interm.intermTypedNode) = context->addConstVectorNode(fields, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].lex).line);
2220 if ((yyval.interm.intermTypedNode) == 0) {
2221 context->recover();
2222 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2223 }
2224 else
2225 (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()));
2226 } else {
2227 if (fields.num == 1) {
2228 ConstantUnion *unionArray = new ConstantUnion[1];
2229 unionArray->setIConst(fields.offsets[0]);
2230 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line);
2231 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2232 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision()));
2233 } else {
2234 TString vectorString = *(yyvsp[(3) - (3)].lex).string;
2235 TIntermTyped* index = context->intermediate.addSwizzle(fields, (yyvsp[(3) - (3)].lex).line);
2236 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpVectorSwizzle, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2237 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (int) vectorString.size()));
2238 }
2239 }
2240 } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isMatrix()) {
2241 TMatrixFields fields;
2242 if (! context->parseMatrixFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yyvsp[(3) - (3)].lex).line)) {
2243 fields.wholeRow = false;
2244 fields.wholeCol = false;
2245 fields.row = 0;
2246 fields.col = 0;
2247 context->recover();
2248 }
2249
2250 if (fields.wholeRow || fields.wholeCol) {
2251 context->error((yyvsp[(2) - (3)].lex).line, " non-scalar fields not implemented yet", ".", "");
2252 context->recover();
2253 ConstantUnion *unionArray = new ConstantUnion[1];
2254 unionArray->setIConst(0);
2255 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line);
2256 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2257 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(),EvqTemporary, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize()));
2258 } else {
2259 ConstantUnion *unionArray = new ConstantUnion[1];
2260 unionArray->setIConst(fields.col * (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize() + fields.row);
2261 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line);
2262 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2263 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision()));
2264 }
2265 } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType() == EbtStruct) {
2266 bool fieldFound = false;
2267 const TTypeList* fields = (yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getStruct();
2268 if (fields == 0) {
2269 context->error((yyvsp[(2) - (3)].lex).line, "structure has no fields", "Internal Error", "");
2270 context->recover();
2271 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2272 } else {
2273 unsigned int i;
2274 for (i = 0; i < fields->size(); ++i) {
2275 if ((*fields)[i].type->getFieldName() == *(yyvsp[(3) - (3)].lex).string) {
2276 fieldFound = true;
2277 break;
2278 }
2279 }
2280 if (fieldFound) {
2281 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) {
2282 (yyval.interm.intermTypedNode) = context->addConstStruct(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
2283 if ((yyval.interm.intermTypedNode) == 0) {
2284 context->recover();
2285 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2286 }
2287 else {
2288 (yyval.interm.intermTypedNode)->setType(*(*fields)[i].type);
2289 // change the qualifier of the return type, not of the structure field
2290 // as the structure definition is shared between various structures.
2291 (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConst);
2292 }
2293 } else {
2294 ConstantUnion *unionArray = new ConstantUnion[1];
2295 unionArray->setIConst(i);
2296 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, *(*fields)[i].type, (yyvsp[(3) - (3)].lex).line);
2297 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirectStruct, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2298 (yyval.interm.intermTypedNode)->setType(*(*fields)[i].type);
2299 }
2300 } else {
2301 context->error((yyvsp[(2) - (3)].lex).line, " no such field in structure", (yyvsp[(3) - (3)].lex).string->c_str(), "");
2302 context->recover();
2303 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2304 }
2305 }
2306 } else {
2307 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(), "");
2308 context->recover();
2309 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2310 }
2311 // don't delete $3.string, it's from the pool
kbr@chromium.org205fef32011-11-22 20:50:02 +00002312 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002313 break;
2314
2315 case 12:
2316
2317 {
2318 if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode)))
2319 context->recover();
2320 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostIncrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line, context->symbolTable);
2321 if ((yyval.interm.intermTypedNode) == 0) {
2322 context->unaryOpError((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
2323 context->recover();
2324 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode);
2325 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00002326 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002327 break;
2328
2329 case 13:
2330
2331 {
2332 if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode)))
2333 context->recover();
2334 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostDecrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line, context->symbolTable);
2335 if ((yyval.interm.intermTypedNode) == 0) {
2336 context->unaryOpError((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
2337 context->recover();
2338 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode);
2339 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00002340 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002341 break;
2342
2343 case 14:
2344
2345 {
2346 if (context->integerErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode), "[]"))
2347 context->recover();
2348 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
kbr@chromium.org205fef32011-11-22 20:50:02 +00002349 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002350 break;
2351
2352 case 15:
2353
2354 {
2355 TFunction* fnCall = (yyvsp[(1) - (1)].interm).function;
2356 TOperator op = fnCall->getBuiltInOp();
2357
2358 if (op != EOpNull)
2359 {
2360 //
2361 // Then this should be a constructor.
2362 // Don't go through the symbol table for constructors.
2363 // Their parameters will be verified algorithmically.
2364 //
2365 TType type(EbtVoid, EbpUndefined); // use this to get the type back
2366 if (context->constructorErrorCheck((yyvsp[(1) - (1)].interm).line, (yyvsp[(1) - (1)].interm).intermNode, *fnCall, op, &type)) {
2367 (yyval.interm.intermTypedNode) = 0;
2368 } else {
2369 //
2370 // It's a constructor, of type 'type'.
2371 //
2372 (yyval.interm.intermTypedNode) = context->addConstructor((yyvsp[(1) - (1)].interm).intermNode, &type, op, fnCall, (yyvsp[(1) - (1)].interm).line);
2373 }
2374
2375 if ((yyval.interm.intermTypedNode) == 0) {
2376 context->recover();
2377 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator(0, op, (yyvsp[(1) - (1)].interm).line);
2378 }
2379 (yyval.interm.intermTypedNode)->setType(type);
2380 } else {
2381 //
2382 // Not a constructor. Find it in the symbol table.
2383 //
2384 const TFunction* fnCandidate;
2385 bool builtIn;
2386 fnCandidate = context->findFunction((yyvsp[(1) - (1)].interm).line, fnCall, &builtIn);
2387 if (fnCandidate) {
2388 //
2389 // A declared function.
2390 //
2391 if (builtIn && !fnCandidate->getExtension().empty() &&
2392 context->extensionErrorCheck((yyvsp[(1) - (1)].interm).line, fnCandidate->getExtension())) {
2393 context->recover();
2394 }
2395 op = fnCandidate->getBuiltInOp();
2396 if (builtIn && op != EOpNull) {
2397 //
2398 // A function call mapped to a built-in operation.
2399 //
2400 if (fnCandidate->getParamCount() == 1) {
2401 //
2402 // Treat it like a built-in unary operator.
2403 //
2404 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(op, (yyvsp[(1) - (1)].interm).intermNode, 0, context->symbolTable);
2405 if ((yyval.interm.intermTypedNode) == 0) {
2406 context->error((yyvsp[(1) - (1)].interm).intermNode->getLine(), " wrong operand type", "Internal Error",
2407 "built in unary operator function. Type: %s",
2408 static_cast<TIntermTyped*>((yyvsp[(1) - (1)].interm).intermNode)->getCompleteString().c_str());
2409 YYERROR;
2410 }
2411 } else {
2412 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, op, (yyvsp[(1) - (1)].interm).line);
2413 }
2414 } else {
2415 // This is a real function call
2416
2417 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, EOpFunctionCall, (yyvsp[(1) - (1)].interm).line);
2418 (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType());
2419
2420 // this is how we know whether the given function is a builtIn function or a user defined function
2421 // if builtIn == false, it's a userDefined -> could be an overloaded builtIn function also
2422 // if builtIn == true, it's definitely a builtIn function with EOpNull
2423 if (!builtIn)
2424 (yyval.interm.intermTypedNode)->getAsAggregate()->setUserDefined();
2425 (yyval.interm.intermTypedNode)->getAsAggregate()->setName(fnCandidate->getMangledName());
2426
2427 TQualifier qual;
2428 for (int i = 0; i < fnCandidate->getParamCount(); ++i) {
2429 qual = fnCandidate->getParam(i).type->getQualifier();
2430 if (qual == EvqOut || qual == EvqInOut) {
2431 if (context->lValueErrorCheck((yyval.interm.intermTypedNode)->getLine(), "assign", (yyval.interm.intermTypedNode)->getAsAggregate()->getSequence()[i]->getAsTyped())) {
2432 context->error((yyvsp[(1) - (1)].interm).intermNode->getLine(), "Constant value cannot be passed for 'out' or 'inout' parameters.", "Error", "");
2433 context->recover();
2434 }
2435 }
2436 }
2437 }
2438 (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType());
2439 } else {
2440 // error message was put out by PaFindFunction()
2441 // Put on a dummy node for error recovery
2442 ConstantUnion *unionArray = new ConstantUnion[1];
2443 unionArray->setFConst(0.0f);
2444 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].interm).line);
2445 context->recover();
2446 }
2447 }
2448 delete fnCall;
kbr@chromium.org205fef32011-11-22 20:50:02 +00002449 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002450 break;
2451
2452 case 16:
2453
2454 {
2455 (yyval.interm) = (yyvsp[(1) - (1)].interm);
kbr@chromium.org205fef32011-11-22 20:50:02 +00002456 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002457 break;
2458
2459 case 17:
2460
2461 {
2462 context->error((yyvsp[(3) - (3)].interm).line, "methods are not supported", "", "");
2463 context->recover();
2464 (yyval.interm) = (yyvsp[(3) - (3)].interm);
kbr@chromium.org205fef32011-11-22 20:50:02 +00002465 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002466 break;
2467
2468 case 18:
2469
2470 {
2471 (yyval.interm) = (yyvsp[(1) - (2)].interm);
2472 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
kbr@chromium.org205fef32011-11-22 20:50:02 +00002473 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002474 break;
2475
2476 case 19:
2477
2478 {
2479 (yyval.interm) = (yyvsp[(1) - (2)].interm);
2480 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
kbr@chromium.org205fef32011-11-22 20:50:02 +00002481 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002482 break;
2483
2484 case 20:
2485
2486 {
2487 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
2488 (yyval.interm).intermNode = 0;
kbr@chromium.org205fef32011-11-22 20:50:02 +00002489 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002490 break;
2491
2492 case 21:
2493
2494 {
2495 (yyval.interm).function = (yyvsp[(1) - (1)].interm.function);
2496 (yyval.interm).intermNode = 0;
kbr@chromium.org205fef32011-11-22 20:50:02 +00002497 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002498 break;
2499
2500 case 22:
2501
2502 {
2503 TParameter param = { 0, new TType((yyvsp[(2) - (2)].interm.intermTypedNode)->getType()) };
2504 (yyvsp[(1) - (2)].interm.function)->addParameter(param);
2505 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
2506 (yyval.interm).intermNode = (yyvsp[(2) - (2)].interm.intermTypedNode);
kbr@chromium.org205fef32011-11-22 20:50:02 +00002507 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002508 break;
2509
2510 case 23:
2511
2512 {
2513 TParameter param = { 0, new TType((yyvsp[(3) - (3)].interm.intermTypedNode)->getType()) };
2514 (yyvsp[(1) - (3)].interm).function->addParameter(param);
2515 (yyval.interm).function = (yyvsp[(1) - (3)].interm).function;
2516 (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 +00002517 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002518 break;
2519
2520 case 24:
2521
2522 {
2523 (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
kbr@chromium.org205fef32011-11-22 20:50:02 +00002524 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002525 break;
2526
2527 case 25:
2528
2529 {
2530 //
2531 // Constructor
2532 //
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002533 TOperator op = EOpNull;
2534 if ((yyvsp[(1) - (1)].interm.type).userDef) {
2535 op = EOpConstructStruct;
2536 } else {
2537 switch ((yyvsp[(1) - (1)].interm.type).type) {
2538 case EbtFloat:
2539 if ((yyvsp[(1) - (1)].interm.type).matrix) {
2540 switch((yyvsp[(1) - (1)].interm.type).size) {
2541 case 2: op = EOpConstructMat2; break;
2542 case 3: op = EOpConstructMat3; break;
2543 case 4: op = EOpConstructMat4; break;
2544 }
2545 } else {
2546 switch((yyvsp[(1) - (1)].interm.type).size) {
2547 case 1: op = EOpConstructFloat; break;
2548 case 2: op = EOpConstructVec2; break;
2549 case 3: op = EOpConstructVec3; break;
2550 case 4: op = EOpConstructVec4; break;
2551 }
2552 }
2553 break;
2554 case EbtInt:
2555 switch((yyvsp[(1) - (1)].interm.type).size) {
2556 case 1: op = EOpConstructInt; break;
2557 case 2: FRAG_VERT_ONLY("ivec2", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec2; break;
2558 case 3: FRAG_VERT_ONLY("ivec3", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec3; break;
2559 case 4: FRAG_VERT_ONLY("ivec4", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec4; break;
2560 }
2561 break;
2562 case EbtBool:
2563 switch((yyvsp[(1) - (1)].interm.type).size) {
2564 case 1: op = EOpConstructBool; break;
2565 case 2: FRAG_VERT_ONLY("bvec2", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec2; break;
2566 case 3: FRAG_VERT_ONLY("bvec3", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec3; break;
2567 case 4: FRAG_VERT_ONLY("bvec4", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec4; break;
2568 }
2569 break;
2570 default: break;
2571 }
2572 if (op == EOpNull) {
2573 context->error((yyvsp[(1) - (1)].interm.type).line, "cannot construct this type", getBasicString((yyvsp[(1) - (1)].interm.type).type), "");
2574 context->recover();
2575 (yyvsp[(1) - (1)].interm.type).type = EbtFloat;
2576 op = EOpConstructFloat;
2577 }
2578 }
2579 TString tempString;
2580 TType type((yyvsp[(1) - (1)].interm.type));
2581 TFunction *function = new TFunction(&tempString, type, op);
2582 (yyval.interm.function) = function;
kbr@chromium.org205fef32011-11-22 20:50:02 +00002583 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002584 break;
2585
2586 case 26:
2587
2588 {
2589 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
2590 context->recover();
2591 TType type(EbtVoid, EbpUndefined);
2592 TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type);
2593 (yyval.interm.function) = function;
kbr@chromium.org205fef32011-11-22 20:50:02 +00002594 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002595 break;
2596
2597 case 27:
2598
2599 {
2600 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
2601 context->recover();
2602 TType type(EbtVoid, EbpUndefined);
2603 TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type);
2604 (yyval.interm.function) = function;
kbr@chromium.org205fef32011-11-22 20:50:02 +00002605 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002606 break;
2607
2608 case 28:
2609
2610 {
2611 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
kbr@chromium.org205fef32011-11-22 20:50:02 +00002612 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002613 break;
2614
2615 case 29:
2616
2617 {
2618 if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)))
2619 context->recover();
2620 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreIncrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line, context->symbolTable);
2621 if ((yyval.interm.intermTypedNode) == 0) {
2622 context->unaryOpError((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2623 context->recover();
2624 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2625 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00002626 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002627 break;
2628
2629 case 30:
2630
2631 {
2632 if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)))
2633 context->recover();
2634 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreDecrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line, context->symbolTable);
2635 if ((yyval.interm.intermTypedNode) == 0) {
2636 context->unaryOpError((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2637 context->recover();
2638 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2639 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00002640 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002641 break;
2642
2643 case 31:
2644
2645 {
2646 if ((yyvsp[(1) - (2)].interm).op != EOpNull) {
2647 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath((yyvsp[(1) - (2)].interm).op, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].interm).line, context->symbolTable);
2648 if ((yyval.interm.intermTypedNode) == 0) {
2649 const char* errorOp = "";
2650 switch((yyvsp[(1) - (2)].interm).op) {
2651 case EOpNegative: errorOp = "-"; break;
2652 case EOpLogicalNot: errorOp = "!"; break;
2653 default: break;
2654 }
2655 context->unaryOpError((yyvsp[(1) - (2)].interm).line, errorOp, (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2656 context->recover();
2657 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2658 }
2659 } else
2660 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
kbr@chromium.org205fef32011-11-22 20:50:02 +00002661 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002662 break;
2663
2664 case 32:
2665
kbr@chromium.org205fef32011-11-22 20:50:02 +00002666 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNull; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002667 break;
2668
2669 case 33:
2670
kbr@chromium.org205fef32011-11-22 20:50:02 +00002671 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNegative; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002672 break;
2673
2674 case 34:
2675
kbr@chromium.org205fef32011-11-22 20:50:02 +00002676 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpLogicalNot; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002677 break;
2678
2679 case 35:
2680
kbr@chromium.org205fef32011-11-22 20:50:02 +00002681 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002682 break;
2683
2684 case 36:
2685
2686 {
2687 FRAG_VERT_ONLY("*", (yyvsp[(2) - (3)].lex).line);
2688 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpMul, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2689 if ((yyval.interm.intermTypedNode) == 0) {
2690 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "*", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2691 context->recover();
2692 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2693 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00002694 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002695 break;
2696
2697 case 37:
2698
2699 {
2700 FRAG_VERT_ONLY("/", (yyvsp[(2) - (3)].lex).line);
2701 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpDiv, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2702 if ((yyval.interm.intermTypedNode) == 0) {
2703 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "/", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2704 context->recover();
2705 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2706 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00002707 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002708 break;
2709
2710 case 38:
2711
kbr@chromium.org205fef32011-11-22 20:50:02 +00002712 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002713 break;
2714
2715 case 39:
2716
2717 {
2718 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpAdd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2719 if ((yyval.interm.intermTypedNode) == 0) {
2720 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "+", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2721 context->recover();
2722 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2723 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00002724 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002725 break;
2726
2727 case 40:
2728
2729 {
2730 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpSub, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2731 if ((yyval.interm.intermTypedNode) == 0) {
2732 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "-", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2733 context->recover();
2734 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2735 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00002736 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002737 break;
2738
2739 case 41:
2740
kbr@chromium.org205fef32011-11-22 20:50:02 +00002741 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002742 break;
2743
2744 case 42:
2745
kbr@chromium.org205fef32011-11-22 20:50:02 +00002746 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002747 break;
2748
2749 case 43:
2750
2751 {
2752 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2753 if ((yyval.interm.intermTypedNode) == 0) {
2754 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2755 context->recover();
2756 ConstantUnion *unionArray = new ConstantUnion[1];
2757 unionArray->setBConst(false);
2758 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2759 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00002760 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002761 break;
2762
2763 case 44:
2764
2765 {
2766 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2767 if ((yyval.interm.intermTypedNode) == 0) {
2768 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2769 context->recover();
2770 ConstantUnion *unionArray = new ConstantUnion[1];
2771 unionArray->setBConst(false);
2772 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2773 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00002774 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002775 break;
2776
2777 case 45:
2778
2779 {
2780 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2781 if ((yyval.interm.intermTypedNode) == 0) {
2782 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2783 context->recover();
2784 ConstantUnion *unionArray = new ConstantUnion[1];
2785 unionArray->setBConst(false);
2786 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2787 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00002788 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002789 break;
2790
2791 case 46:
2792
2793 {
2794 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2795 if ((yyval.interm.intermTypedNode) == 0) {
2796 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2797 context->recover();
2798 ConstantUnion *unionArray = new ConstantUnion[1];
2799 unionArray->setBConst(false);
2800 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2801 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00002802 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002803 break;
2804
2805 case 47:
2806
kbr@chromium.org205fef32011-11-22 20:50:02 +00002807 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002808 break;
2809
2810 case 48:
2811
2812 {
2813 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2814 if ((yyval.interm.intermTypedNode) == 0) {
2815 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "==", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2816 context->recover();
2817 ConstantUnion *unionArray = new ConstantUnion[1];
2818 unionArray->setBConst(false);
2819 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2820 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00002821 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002822 break;
2823
2824 case 49:
2825
2826 {
2827 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpNotEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2828 if ((yyval.interm.intermTypedNode) == 0) {
2829 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "!=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2830 context->recover();
2831 ConstantUnion *unionArray = new ConstantUnion[1];
2832 unionArray->setBConst(false);
2833 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2834 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00002835 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002836 break;
2837
2838 case 50:
2839
kbr@chromium.org205fef32011-11-22 20:50:02 +00002840 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002841 break;
2842
2843 case 51:
2844
kbr@chromium.org205fef32011-11-22 20:50:02 +00002845 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002846 break;
2847
2848 case 52:
2849
kbr@chromium.org205fef32011-11-22 20:50:02 +00002850 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002851 break;
2852
2853 case 53:
2854
kbr@chromium.org205fef32011-11-22 20:50:02 +00002855 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002856 break;
2857
2858 case 54:
2859
2860 {
2861 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalAnd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2862 if ((yyval.interm.intermTypedNode) == 0) {
2863 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "&&", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2864 context->recover();
2865 ConstantUnion *unionArray = new ConstantUnion[1];
2866 unionArray->setBConst(false);
2867 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2868 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00002869 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002870 break;
2871
2872 case 55:
2873
kbr@chromium.org205fef32011-11-22 20:50:02 +00002874 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002875 break;
2876
2877 case 56:
2878
2879 {
2880 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalXor, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2881 if ((yyval.interm.intermTypedNode) == 0) {
2882 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "^^", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2883 context->recover();
2884 ConstantUnion *unionArray = new ConstantUnion[1];
2885 unionArray->setBConst(false);
2886 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2887 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00002888 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002889 break;
2890
2891 case 57:
2892
kbr@chromium.org205fef32011-11-22 20:50:02 +00002893 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002894 break;
2895
2896 case 58:
2897
2898 {
2899 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalOr, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2900 if ((yyval.interm.intermTypedNode) == 0) {
2901 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "||", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2902 context->recover();
2903 ConstantUnion *unionArray = new ConstantUnion[1];
2904 unionArray->setBConst(false);
2905 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2906 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00002907 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002908 break;
2909
2910 case 59:
2911
kbr@chromium.org205fef32011-11-22 20:50:02 +00002912 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002913 break;
2914
2915 case 60:
2916
2917 {
2918 if (context->boolErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.intermTypedNode)))
2919 context->recover();
2920
2921 (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);
2922 if ((yyvsp[(3) - (5)].interm.intermTypedNode)->getType() != (yyvsp[(5) - (5)].interm.intermTypedNode)->getType())
2923 (yyval.interm.intermTypedNode) = 0;
2924
2925 if ((yyval.interm.intermTypedNode) == 0) {
2926 context->binaryOpError((yyvsp[(2) - (5)].lex).line, ":", (yyvsp[(3) - (5)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(5) - (5)].interm.intermTypedNode)->getCompleteString());
2927 context->recover();
2928 (yyval.interm.intermTypedNode) = (yyvsp[(5) - (5)].interm.intermTypedNode);
2929 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00002930 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002931 break;
2932
2933 case 61:
2934
kbr@chromium.org205fef32011-11-22 20:50:02 +00002935 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002936 break;
2937
2938 case 62:
2939
2940 {
2941 if (context->lValueErrorCheck((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)))
2942 context->recover();
2943 (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);
2944 if ((yyval.interm.intermTypedNode) == 0) {
2945 context->assignError((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2946 context->recover();
2947 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2948 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00002949 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002950 break;
2951
2952 case 63:
2953
kbr@chromium.org205fef32011-11-22 20:50:02 +00002954 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAssign; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002955 break;
2956
2957 case 64:
2958
kbr@chromium.org205fef32011-11-22 20:50:02 +00002959 { 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 +00002960 break;
2961
2962 case 65:
2963
kbr@chromium.org205fef32011-11-22 20:50:02 +00002964 { 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 +00002965 break;
2966
2967 case 66:
2968
kbr@chromium.org205fef32011-11-22 20:50:02 +00002969 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAddAssign; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002970 break;
2971
2972 case 67:
2973
kbr@chromium.org205fef32011-11-22 20:50:02 +00002974 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpSubAssign; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002975 break;
2976
2977 case 68:
2978
2979 {
2980 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
kbr@chromium.org205fef32011-11-22 20:50:02 +00002981 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002982 break;
2983
2984 case 69:
2985
2986 {
2987 (yyval.interm.intermTypedNode) = context->intermediate.addComma((yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
2988 if ((yyval.interm.intermTypedNode) == 0) {
2989 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ",", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2990 context->recover();
2991 (yyval.interm.intermTypedNode) = (yyvsp[(3) - (3)].interm.intermTypedNode);
2992 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00002993 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002994 break;
2995
2996 case 70:
2997
2998 {
2999 if (context->constErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)))
3000 context->recover();
3001 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003002 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003003 break;
3004
3005 case 71:
3006
3007 {
3008 TFunction &function = *((yyvsp[(1) - (2)].interm).function);
3009
3010 TIntermAggregate *prototype = new TIntermAggregate;
3011 prototype->setType(function.getReturnType());
3012 prototype->setName(function.getName());
3013
3014 for (int i = 0; i < function.getParamCount(); i++)
3015 {
3016 const TParameter &param = function.getParam(i);
3017 if (param.name != 0)
3018 {
3019 TVariable *variable = new TVariable(param.name, *param.type);
3020
3021 prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(variable->getUniqueId(), variable->getName(), variable->getType(), (yyvsp[(1) - (2)].interm).line), (yyvsp[(1) - (2)].interm).line);
3022 }
3023 else
3024 {
3025 prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (2)].interm).line), (yyvsp[(1) - (2)].interm).line);
3026 }
3027 }
3028
3029 prototype->setOp(EOpPrototype);
3030 (yyval.interm.intermNode) = prototype;
kbr@chromium.org205fef32011-11-22 20:50:02 +00003031 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003032 break;
3033
3034 case 72:
3035
3036 {
3037 if ((yyvsp[(1) - (2)].interm).intermAggregate)
3038 (yyvsp[(1) - (2)].interm).intermAggregate->setOp(EOpDeclaration);
3039 (yyval.interm.intermNode) = (yyvsp[(1) - (2)].interm).intermAggregate;
kbr@chromium.org205fef32011-11-22 20:50:02 +00003040 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003041 break;
3042
3043 case 73:
3044
3045 {
3046 context->symbolTable.setDefaultPrecision( (yyvsp[(3) - (4)].interm.type).type, (yyvsp[(2) - (4)].interm.precision) );
3047 (yyval.interm.intermNode) = 0;
kbr@chromium.org205fef32011-11-22 20:50:02 +00003048 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003049 break;
3050
3051 case 74:
3052
3053 {
3054 //
3055 // Multiple declarations of the same function are allowed.
3056 //
3057 // If this is a definition, the definition production code will check for redefinitions
3058 // (we don't know at this point if it's a definition or not).
3059 //
3060 // Redeclarations are allowed. But, return types and parameter qualifiers must match.
3061 //
3062 TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find((yyvsp[(1) - (2)].interm.function)->getMangledName()));
3063 if (prevDec) {
3064 if (prevDec->getReturnType() != (yyvsp[(1) - (2)].interm.function)->getReturnType()) {
3065 context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same return type", (yyvsp[(1) - (2)].interm.function)->getReturnType().getBasicString(), "");
3066 context->recover();
3067 }
3068 for (int i = 0; i < prevDec->getParamCount(); ++i) {
3069 if (prevDec->getParam(i).type->getQualifier() != (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifier()) {
3070 context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same parameter qualifiers", (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifierString(), "");
3071 context->recover();
3072 }
3073 }
3074 }
3075
3076 //
3077 // If this is a redeclaration, it could also be a definition,
3078 // in which case, we want to use the variable names from this one, and not the one that's
3079 // being redeclared. So, pass back up this declaration, not the one in the symbol table.
3080 //
3081 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
3082 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
3083
3084 context->symbolTable.insert(*(yyval.interm).function);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003085 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003086 break;
3087
3088 case 75:
3089
3090 {
3091 (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003092 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003093 break;
3094
3095 case 76:
3096
3097 {
3098 (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003099 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003100 break;
3101
3102 case 77:
3103
3104 {
3105 // Add the parameter
3106 (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
3107 if ((yyvsp[(2) - (2)].interm).param.type->getBasicType() != EbtVoid)
3108 (yyvsp[(1) - (2)].interm.function)->addParameter((yyvsp[(2) - (2)].interm).param);
3109 else
3110 delete (yyvsp[(2) - (2)].interm).param.type;
kbr@chromium.org205fef32011-11-22 20:50:02 +00003111 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003112 break;
3113
3114 case 78:
3115
3116 {
3117 //
3118 // Only first parameter of one-parameter functions can be void
3119 // The check for named parameters not being void is done in parameter_declarator
3120 //
3121 if ((yyvsp[(3) - (3)].interm).param.type->getBasicType() == EbtVoid) {
3122 //
3123 // This parameter > first is void
3124 //
3125 context->error((yyvsp[(2) - (3)].lex).line, "cannot be an argument type except for '(void)'", "void", "");
3126 context->recover();
3127 delete (yyvsp[(3) - (3)].interm).param.type;
3128 } else {
3129 // Add the parameter
3130 (yyval.interm.function) = (yyvsp[(1) - (3)].interm.function);
3131 (yyvsp[(1) - (3)].interm.function)->addParameter((yyvsp[(3) - (3)].interm).param);
3132 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003133 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003134 break;
3135
3136 case 79:
3137
3138 {
3139 if ((yyvsp[(1) - (3)].interm.type).qualifier != EvqGlobal && (yyvsp[(1) - (3)].interm.type).qualifier != EvqTemporary) {
3140 context->error((yyvsp[(2) - (3)].lex).line, "no qualifiers allowed for function return", getQualifierString((yyvsp[(1) - (3)].interm.type).qualifier), "");
3141 context->recover();
3142 }
3143 // make sure a sampler is not involved as well...
3144 if (context->structQualifierErrorCheck((yyvsp[(2) - (3)].lex).line, (yyvsp[(1) - (3)].interm.type)))
3145 context->recover();
3146
3147 // Add the function as a prototype after parsing it (we do not support recursion)
3148 TFunction *function;
3149 TType type((yyvsp[(1) - (3)].interm.type));
3150 function = new TFunction((yyvsp[(2) - (3)].lex).string, type);
3151 (yyval.interm.function) = function;
kbr@chromium.org205fef32011-11-22 20:50:02 +00003152 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003153 break;
3154
3155 case 80:
3156
3157 {
3158 if ((yyvsp[(1) - (2)].interm.type).type == EbtVoid) {
3159 context->error((yyvsp[(2) - (2)].lex).line, "illegal use of type 'void'", (yyvsp[(2) - (2)].lex).string->c_str(), "");
3160 context->recover();
3161 }
3162 if (context->reservedErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string))
3163 context->recover();
3164 TParameter param = {(yyvsp[(2) - (2)].lex).string, new TType((yyvsp[(1) - (2)].interm.type))};
3165 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
3166 (yyval.interm).param = param;
kbr@chromium.org205fef32011-11-22 20:50:02 +00003167 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003168 break;
3169
3170 case 81:
3171
3172 {
3173 // Check that we can make an array out of this type
3174 if (context->arrayTypeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
3175 context->recover();
3176
3177 if (context->reservedErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string))
3178 context->recover();
3179
3180 int size;
3181 if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3182 context->recover();
3183 (yyvsp[(1) - (5)].interm.type).setArray(true, size);
3184
3185 TType* type = new TType((yyvsp[(1) - (5)].interm.type));
3186 TParameter param = { (yyvsp[(2) - (5)].lex).string, type };
3187 (yyval.interm).line = (yyvsp[(2) - (5)].lex).line;
3188 (yyval.interm).param = param;
kbr@chromium.org205fef32011-11-22 20:50:02 +00003189 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003190 break;
3191
3192 case 82:
3193
3194 {
3195 (yyval.interm) = (yyvsp[(3) - (3)].interm);
3196 if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
3197 context->recover();
kbr@chromium.org205fef32011-11-22 20:50:02 +00003198 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003199 break;
3200
3201 case 83:
3202
3203 {
3204 (yyval.interm) = (yyvsp[(2) - (2)].interm);
3205 if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
3206 context->recover();
3207 if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
3208 context->recover();
kbr@chromium.org205fef32011-11-22 20:50:02 +00003209 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003210 break;
3211
3212 case 84:
3213
3214 {
3215 (yyval.interm) = (yyvsp[(3) - (3)].interm);
3216 if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
3217 context->recover();
kbr@chromium.org205fef32011-11-22 20:50:02 +00003218 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003219 break;
3220
3221 case 85:
3222
3223 {
3224 (yyval.interm) = (yyvsp[(2) - (2)].interm);
3225 if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
3226 context->recover();
3227 if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
3228 context->recover();
kbr@chromium.org205fef32011-11-22 20:50:02 +00003229 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003230 break;
3231
3232 case 86:
3233
3234 {
3235 (yyval.interm.qualifier) = EvqIn;
kbr@chromium.org205fef32011-11-22 20:50:02 +00003236 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003237 break;
3238
3239 case 87:
3240
3241 {
3242 (yyval.interm.qualifier) = EvqIn;
kbr@chromium.org205fef32011-11-22 20:50:02 +00003243 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003244 break;
3245
3246 case 88:
3247
3248 {
3249 (yyval.interm.qualifier) = EvqOut;
kbr@chromium.org205fef32011-11-22 20:50:02 +00003250 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003251 break;
3252
3253 case 89:
3254
3255 {
3256 (yyval.interm.qualifier) = EvqInOut;
kbr@chromium.org205fef32011-11-22 20:50:02 +00003257 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003258 break;
3259
3260 case 90:
3261
3262 {
3263 TParameter param = { 0, new TType((yyvsp[(1) - (1)].interm.type)) };
3264 (yyval.interm).param = param;
kbr@chromium.org205fef32011-11-22 20:50:02 +00003265 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003266 break;
3267
3268 case 91:
3269
3270 {
3271 (yyval.interm) = (yyvsp[(1) - (1)].interm);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003272 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003273 break;
3274
3275 case 92:
3276
3277 {
zmo@google.comfd747b82011-04-23 01:30:07 +00003278 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(3) - (3)].lex).string, TType((yyvsp[(1) - (3)].interm).type), (yyvsp[(3) - (3)].lex).line);
3279 (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 +00003280
3281 if (context->structQualifierErrorCheck((yyvsp[(3) - (3)].lex).line, (yyval.interm).type))
3282 context->recover();
3283
3284 if (context->nonInitConstErrorCheck((yyvsp[(3) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyval.interm).type))
3285 context->recover();
3286
zmo@google.comfd747b82011-04-23 01:30:07 +00003287 TVariable* variable = 0;
3288 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 +00003289 context->recover();
zmo@google.comfd747b82011-04-23 01:30:07 +00003290 if (symbol && variable)
3291 symbol->setId(variable->getUniqueId());
kbr@chromium.org205fef32011-11-22 20:50:02 +00003292 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003293 break;
3294
3295 case 93:
3296
3297 {
3298 if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
3299 context->recover();
3300
3301 if (context->nonInitConstErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type))
3302 context->recover();
3303
3304 (yyval.interm) = (yyvsp[(1) - (5)].interm);
3305
3306 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))
3307 context->recover();
3308 else {
3309 (yyvsp[(1) - (5)].interm).type.setArray(true);
3310 TVariable* variable;
3311 if (context->arrayErrorCheck((yyvsp[(4) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, variable))
3312 context->recover();
3313 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003314 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003315 break;
3316
3317 case 94:
3318
3319 {
3320 if (context->structQualifierErrorCheck((yyvsp[(3) - (6)].lex).line, (yyvsp[(1) - (6)].interm).type))
3321 context->recover();
3322
3323 if (context->nonInitConstErrorCheck((yyvsp[(3) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type))
3324 context->recover();
3325
3326 (yyval.interm) = (yyvsp[(1) - (6)].interm);
3327
3328 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))
3329 context->recover();
3330 else {
3331 int size;
3332 if (context->arraySizeErrorCheck((yyvsp[(4) - (6)].lex).line, (yyvsp[(5) - (6)].interm.intermTypedNode), size))
3333 context->recover();
3334 (yyvsp[(1) - (6)].interm).type.setArray(true, size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003335 TVariable* variable = 0;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003336 if (context->arrayErrorCheck((yyvsp[(4) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type, variable))
3337 context->recover();
3338 TType type = TType((yyvsp[(1) - (6)].interm).type);
3339 type.setArraySize(size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003340 (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 +00003341 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003342 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003343 break;
3344
3345 case 95:
3346
3347 {
3348 if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
3349 context->recover();
3350
3351 (yyval.interm) = (yyvsp[(1) - (5)].interm);
3352
3353 TIntermNode* intermNode;
3354 if (!context->executeInitializer((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, (yyvsp[(5) - (5)].interm.intermTypedNode), intermNode)) {
3355 //
3356 // build the intermediate representation
3357 //
3358 if (intermNode)
3359 (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (5)].interm).intermNode, intermNode, (yyvsp[(4) - (5)].lex).line);
3360 else
3361 (yyval.interm).intermAggregate = (yyvsp[(1) - (5)].interm).intermAggregate;
3362 } else {
3363 context->recover();
3364 (yyval.interm).intermAggregate = 0;
3365 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003366 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003367 break;
3368
3369 case 96:
3370
3371 {
3372 (yyval.interm).type = (yyvsp[(1) - (1)].interm.type);
3373 (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 +00003374 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003375 break;
3376
3377 case 97:
3378
3379 {
zmo@google.comfd747b82011-04-23 01:30:07 +00003380 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyvsp[(1) - (2)].interm.type)), (yyvsp[(2) - (2)].lex).line);
3381 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (2)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003382
3383 if (context->structQualifierErrorCheck((yyvsp[(2) - (2)].lex).line, (yyval.interm).type))
3384 context->recover();
3385
3386 if (context->nonInitConstErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string, (yyval.interm).type))
3387 context->recover();
3388
3389 (yyval.interm).type = (yyvsp[(1) - (2)].interm.type);
3390
zmo@google.comfd747b82011-04-23 01:30:07 +00003391 TVariable* variable = 0;
3392 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 +00003393 context->recover();
zmo@google.comfd747b82011-04-23 01:30:07 +00003394 if (variable && symbol)
3395 symbol->setId(variable->getUniqueId());
kbr@chromium.org205fef32011-11-22 20:50:02 +00003396 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003397 break;
3398
3399 case 98:
3400
3401 {
kbr@chromium.org04277b82011-06-02 18:41:26 +00003402 context->error((yyvsp[(2) - (4)].lex).line, "unsized array declarations not supported", (yyvsp[(2) - (4)].lex).string->c_str(), "");
3403 context->recover();
3404
zmo@google.comfd747b82011-04-23 01:30:07 +00003405 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (4)].lex).string, TType((yyvsp[(1) - (4)].interm.type)), (yyvsp[(2) - (4)].lex).line);
3406 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (4)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003407 (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003408 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003409 break;
3410
3411 case 99:
3412
3413 {
3414 TType type = TType((yyvsp[(1) - (5)].interm.type));
3415 int size;
3416 if (context->arraySizeErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3417 context->recover();
3418 type.setArraySize(size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003419 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (5)].lex).string, type, (yyvsp[(2) - (5)].lex).line);
3420 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (5)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003421
3422 if (context->structQualifierErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
3423 context->recover();
3424
3425 if (context->nonInitConstErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type)))
3426 context->recover();
3427
3428 (yyval.interm).type = (yyvsp[(1) - (5)].interm.type);
3429
3430 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)))
3431 context->recover();
3432 else {
3433 int size;
3434 if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3435 context->recover();
3436
3437 (yyvsp[(1) - (5)].interm.type).setArray(true, size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003438 TVariable* variable = 0;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003439 if (context->arrayErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type), variable))
3440 context->recover();
zmo@google.comfd747b82011-04-23 01:30:07 +00003441 if (variable && symbol)
3442 symbol->setId(variable->getUniqueId());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003443 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003444 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003445 break;
3446
3447 case 100:
3448
3449 {
3450 if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
3451 context->recover();
3452
3453 (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
3454
3455 TIntermNode* intermNode;
3456 if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode)) {
3457 //
3458 // Build intermediate representation
3459 //
3460 if(intermNode)
3461 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(intermNode, (yyvsp[(3) - (4)].lex).line);
3462 else
3463 (yyval.interm).intermAggregate = 0;
3464 } else {
3465 context->recover();
3466 (yyval.interm).intermAggregate = 0;
3467 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003468 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003469 break;
3470
3471 case 101:
3472
3473 {
3474 VERTEX_ONLY("invariant declaration", (yyvsp[(1) - (2)].lex).line);
3475 (yyval.interm).qualifier = EvqInvariantVaryingOut;
3476 (yyval.interm).intermAggregate = 0;
kbr@chromium.org205fef32011-11-22 20:50:02 +00003477 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003478 break;
3479
3480 case 102:
3481
3482 {
3483 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3484
3485 if ((yyvsp[(1) - (1)].interm.type).array) {
3486 context->error((yyvsp[(1) - (1)].interm.type).line, "not supported", "first-class array", "");
3487 context->recover();
3488 (yyvsp[(1) - (1)].interm.type).setArray(false);
3489 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003490 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003491 break;
3492
3493 case 103:
3494
3495 {
3496 if ((yyvsp[(2) - (2)].interm.type).array) {
3497 context->error((yyvsp[(2) - (2)].interm.type).line, "not supported", "first-class array", "");
3498 context->recover();
3499 (yyvsp[(2) - (2)].interm.type).setArray(false);
3500 }
3501
3502 if ((yyvsp[(1) - (2)].interm.type).qualifier == EvqAttribute &&
3503 ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
3504 context->error((yyvsp[(2) - (2)].interm.type).line, "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier), "");
3505 context->recover();
3506 }
3507 if (((yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingIn || (yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingOut) &&
3508 ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
3509 context->error((yyvsp[(2) - (2)].interm.type).line, "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier), "");
3510 context->recover();
3511 }
3512 (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
3513 (yyval.interm.type).qualifier = (yyvsp[(1) - (2)].interm.type).qualifier;
kbr@chromium.org205fef32011-11-22 20:50:02 +00003514 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003515 break;
3516
3517 case 104:
3518
3519 {
3520 (yyval.interm.type).setBasic(EbtVoid, EvqConst, (yyvsp[(1) - (1)].lex).line);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003521 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003522 break;
3523
3524 case 105:
3525
3526 {
3527 VERTEX_ONLY("attribute", (yyvsp[(1) - (1)].lex).line);
3528 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "attribute"))
3529 context->recover();
3530 (yyval.interm.type).setBasic(EbtVoid, EvqAttribute, (yyvsp[(1) - (1)].lex).line);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003531 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003532 break;
3533
3534 case 106:
3535
3536 {
3537 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "varying"))
3538 context->recover();
3539 if (context->shaderType == SH_VERTEX_SHADER)
3540 (yyval.interm.type).setBasic(EbtVoid, EvqVaryingOut, (yyvsp[(1) - (1)].lex).line);
3541 else
3542 (yyval.interm.type).setBasic(EbtVoid, EvqVaryingIn, (yyvsp[(1) - (1)].lex).line);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003543 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003544 break;
3545
3546 case 107:
3547
3548 {
3549 if (context->globalErrorCheck((yyvsp[(1) - (2)].lex).line, context->symbolTable.atGlobalLevel(), "invariant varying"))
3550 context->recover();
3551 if (context->shaderType == SH_VERTEX_SHADER)
3552 (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingOut, (yyvsp[(1) - (2)].lex).line);
3553 else
3554 (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingIn, (yyvsp[(1) - (2)].lex).line);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003555 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003556 break;
3557
3558 case 108:
3559
3560 {
3561 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "uniform"))
3562 context->recover();
3563 (yyval.interm.type).setBasic(EbtVoid, EvqUniform, (yyvsp[(1) - (1)].lex).line);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003564 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003565 break;
3566
3567 case 109:
3568
3569 {
3570 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
zmo@google.comdc4b4f82011-06-17 00:42:53 +00003571
3572 if ((yyval.interm.type).precision == EbpUndefined) {
3573 (yyval.interm.type).precision = context->symbolTable.getDefaultPrecision((yyvsp[(1) - (1)].interm.type).type);
3574 if (context->precisionErrorCheck((yyvsp[(1) - (1)].interm.type).line, (yyval.interm.type).precision, (yyvsp[(1) - (1)].interm.type).type)) {
3575 context->recover();
3576 }
3577 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003578 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003579 break;
3580
3581 case 110:
3582
3583 {
3584 (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
3585 (yyval.interm.type).precision = (yyvsp[(1) - (2)].interm.precision);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003586 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003587 break;
3588
3589 case 111:
3590
3591 {
3592 (yyval.interm.precision) = EbpHigh;
kbr@chromium.org205fef32011-11-22 20:50:02 +00003593 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003594 break;
3595
3596 case 112:
3597
3598 {
3599 (yyval.interm.precision) = EbpMedium;
kbr@chromium.org205fef32011-11-22 20:50:02 +00003600 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003601 break;
3602
3603 case 113:
3604
3605 {
3606 (yyval.interm.precision) = EbpLow;
kbr@chromium.org205fef32011-11-22 20:50:02 +00003607 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003608 break;
3609
3610 case 114:
3611
3612 {
3613 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003614 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003615 break;
3616
3617 case 115:
3618
3619 {
3620 (yyval.interm.type) = (yyvsp[(1) - (4)].interm.type);
3621
3622 if (context->arrayTypeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
3623 context->recover();
3624 else {
3625 int size;
3626 if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
3627 context->recover();
3628 (yyval.interm.type).setArray(true, size);
3629 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003630 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003631 break;
3632
3633 case 116:
3634
3635 {
3636 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3637 (yyval.interm.type).setBasic(EbtVoid, qual, (yyvsp[(1) - (1)].lex).line);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003638 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003639 break;
3640
3641 case 117:
3642
3643 {
3644 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3645 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003646 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003647 break;
3648
3649 case 118:
3650
3651 {
3652 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3653 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003654 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003655 break;
3656
3657 case 119:
3658
3659 {
3660 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3661 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003662 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003663 break;
3664
3665 case 120:
3666
3667 {
3668 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3669 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3670 (yyval.interm.type).setAggregate(2);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003671 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003672 break;
3673
3674 case 121:
3675
3676 {
3677 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3678 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3679 (yyval.interm.type).setAggregate(3);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003680 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003681 break;
3682
3683 case 122:
3684
3685 {
3686 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3687 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3688 (yyval.interm.type).setAggregate(4);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003689 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003690 break;
3691
3692 case 123:
3693
3694 {
3695 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3696 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3697 (yyval.interm.type).setAggregate(2);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003698 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003699 break;
3700
3701 case 124:
3702
3703 {
3704 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3705 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3706 (yyval.interm.type).setAggregate(3);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003707 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003708 break;
3709
3710 case 125:
3711
3712 {
3713 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3714 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3715 (yyval.interm.type).setAggregate(4);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003716 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003717 break;
3718
3719 case 126:
3720
3721 {
3722 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3723 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3724 (yyval.interm.type).setAggregate(2);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003725 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003726 break;
3727
3728 case 127:
3729
3730 {
3731 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3732 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3733 (yyval.interm.type).setAggregate(3);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003734 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003735 break;
3736
3737 case 128:
3738
3739 {
3740 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3741 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3742 (yyval.interm.type).setAggregate(4);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003743 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003744 break;
3745
3746 case 129:
3747
3748 {
3749 FRAG_VERT_ONLY("mat2", (yyvsp[(1) - (1)].lex).line);
3750 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3751 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3752 (yyval.interm.type).setAggregate(2, true);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003753 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003754 break;
3755
3756 case 130:
3757
3758 {
3759 FRAG_VERT_ONLY("mat3", (yyvsp[(1) - (1)].lex).line);
3760 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3761 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3762 (yyval.interm.type).setAggregate(3, true);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003763 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003764 break;
3765
3766 case 131:
3767
3768 {
3769 FRAG_VERT_ONLY("mat4", (yyvsp[(1) - (1)].lex).line);
3770 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3771 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3772 (yyval.interm.type).setAggregate(4, true);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003773 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003774 break;
3775
3776 case 132:
3777
3778 {
3779 FRAG_VERT_ONLY("sampler2D", (yyvsp[(1) - (1)].lex).line);
3780 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3781 (yyval.interm.type).setBasic(EbtSampler2D, qual, (yyvsp[(1) - (1)].lex).line);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003782 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003783 break;
3784
3785 case 133:
3786
3787 {
3788 FRAG_VERT_ONLY("samplerCube", (yyvsp[(1) - (1)].lex).line);
3789 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3790 (yyval.interm.type).setBasic(EbtSamplerCube, qual, (yyvsp[(1) - (1)].lex).line);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003791 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003792 break;
3793
3794 case 134:
3795
3796 {
zmo@google.com09c323a2011-08-12 18:22:25 +00003797 if (!context->supportsExtension("GL_OES_EGL_image_external")) {
3798 context->error((yyvsp[(1) - (1)].lex).line, "unsupported type", "samplerExternalOES", "");
3799 context->recover();
3800 }
3801 FRAG_VERT_ONLY("samplerExternalOES", (yyvsp[(1) - (1)].lex).line);
3802 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3803 (yyval.interm.type).setBasic(EbtSamplerExternalOES, qual, (yyvsp[(1) - (1)].lex).line);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003804 }
zmo@google.com09c323a2011-08-12 18:22:25 +00003805 break;
3806
3807 case 135:
3808
3809 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00003810 if (!context->supportsExtension("GL_ARB_texture_rectangle")) {
3811 context->error((yyvsp[(1) - (1)].lex).line, "unsupported type", "sampler2DRect", "");
3812 context->recover();
3813 }
3814 FRAG_VERT_ONLY("sampler2DRect", (yyvsp[(1) - (1)].lex).line);
3815 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3816 (yyval.interm.type).setBasic(EbtSampler2DRect, qual, (yyvsp[(1) - (1)].lex).line);
3817 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003818 break;
3819
zmo@google.com09c323a2011-08-12 18:22:25 +00003820 case 136:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003821
3822 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00003823 FRAG_VERT_ONLY("struct", (yyvsp[(1) - (1)].interm.type).line);
3824 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3825 (yyval.interm.type).qualifier = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3826 }
3827 break;
3828
3829 case 137:
3830
3831 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003832 //
3833 // This is for user defined type names. The lexical phase looked up the
3834 // type.
3835 //
3836 TType& structure = static_cast<TVariable*>((yyvsp[(1) - (1)].lex).symbol)->getType();
3837 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3838 (yyval.interm.type).setBasic(EbtStruct, qual, (yyvsp[(1) - (1)].lex).line);
3839 (yyval.interm.type).userDef = &structure;
kbr@chromium.org205fef32011-11-22 20:50:02 +00003840 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003841 break;
3842
zmo@google.com09c323a2011-08-12 18:22:25 +00003843 case 138:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003844
kbr@chromium.org205fef32011-11-22 20:50:02 +00003845 { if (context->enterStructDeclaration((yyvsp[(2) - (3)].lex).line, *(yyvsp[(2) - (3)].lex).string)) context->recover(); }
3846 break;
3847
3848 case 139:
3849
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003850 {
kbr@chromium.org476541f2011-10-27 21:14:51 +00003851 if (context->reservedErrorCheck((yyvsp[(2) - (6)].lex).line, *(yyvsp[(2) - (6)].lex).string))
3852 context->recover();
3853
3854 TType* structure = new TType((yyvsp[(5) - (6)].interm.typeList), *(yyvsp[(2) - (6)].lex).string);
3855 TVariable* userTypeDef = new TVariable((yyvsp[(2) - (6)].lex).string, *structure, true);
3856 if (! context->symbolTable.insert(*userTypeDef)) {
3857 context->error((yyvsp[(2) - (6)].lex).line, "redefinition", (yyvsp[(2) - (6)].lex).string->c_str(), "struct");
3858 context->recover();
3859 }
3860 (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (6)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003861 (yyval.interm.type).userDef = structure;
kbr@chromium.org476541f2011-10-27 21:14:51 +00003862 context->exitStructDeclaration();
kbr@chromium.org205fef32011-11-22 20:50:02 +00003863 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00003864 break;
3865
3866 case 140:
3867
kbr@chromium.org205fef32011-11-22 20:50:02 +00003868 { if (context->enterStructDeclaration((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string)) context->recover(); }
3869 break;
3870
3871 case 141:
3872
kbr@chromium.org476541f2011-10-27 21:14:51 +00003873 {
3874 TType* structure = new TType((yyvsp[(4) - (5)].interm.typeList), TString(""));
3875 (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (5)].lex).line);
3876 (yyval.interm.type).userDef = structure;
3877 context->exitStructDeclaration();
kbr@chromium.org205fef32011-11-22 20:50:02 +00003878 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003879 break;
3880
kbr@chromium.org476541f2011-10-27 21:14:51 +00003881 case 142:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003882
3883 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00003884 (yyval.interm.typeList) = (yyvsp[(1) - (1)].interm.typeList);
3885 }
3886 break;
3887
3888 case 143:
3889
3890 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003891 (yyval.interm.typeList) = (yyvsp[(1) - (2)].interm.typeList);
3892 for (unsigned int i = 0; i < (yyvsp[(2) - (2)].interm.typeList)->size(); ++i) {
3893 for (unsigned int j = 0; j < (yyval.interm.typeList)->size(); ++j) {
3894 if ((*(yyval.interm.typeList))[j].type->getFieldName() == (*(yyvsp[(2) - (2)].interm.typeList))[i].type->getFieldName()) {
3895 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());
3896 context->recover();
3897 }
3898 }
3899 (yyval.interm.typeList)->push_back((*(yyvsp[(2) - (2)].interm.typeList))[i]);
3900 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003901 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003902 break;
3903
kbr@chromium.org205fef32011-11-22 20:50:02 +00003904 case 144:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003905
3906 {
3907 (yyval.interm.typeList) = (yyvsp[(2) - (3)].interm.typeList);
3908
3909 if (context->voidErrorCheck((yyvsp[(1) - (3)].interm.type).line, (*(yyvsp[(2) - (3)].interm.typeList))[0].type->getFieldName(), (yyvsp[(1) - (3)].interm.type))) {
3910 context->recover();
3911 }
3912 for (unsigned int i = 0; i < (yyval.interm.typeList)->size(); ++i) {
3913 //
3914 // Careful not to replace already known aspects of type, like array-ness
3915 //
3916 TType* type = (*(yyval.interm.typeList))[i].type;
3917 type->setBasicType((yyvsp[(1) - (3)].interm.type).type);
3918 type->setNominalSize((yyvsp[(1) - (3)].interm.type).size);
3919 type->setMatrix((yyvsp[(1) - (3)].interm.type).matrix);
zmo@google.comdc4b4f82011-06-17 00:42:53 +00003920 type->setPrecision((yyvsp[(1) - (3)].interm.type).precision);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003921
3922 // don't allow arrays of arrays
3923 if (type->isArray()) {
3924 if (context->arrayTypeErrorCheck((yyvsp[(1) - (3)].interm.type).line, (yyvsp[(1) - (3)].interm.type)))
3925 context->recover();
3926 }
3927 if ((yyvsp[(1) - (3)].interm.type).array)
3928 type->setArraySize((yyvsp[(1) - (3)].interm.type).arraySize);
3929 if ((yyvsp[(1) - (3)].interm.type).userDef) {
3930 type->setStruct((yyvsp[(1) - (3)].interm.type).userDef->getStruct());
3931 type->setTypeName((yyvsp[(1) - (3)].interm.type).userDef->getTypeName());
3932 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00003933
3934 if (context->structNestingErrorCheck((yyvsp[(1) - (3)].interm.type).line, *type)) {
3935 context->recover();
3936 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003937 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00003938 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003939 break;
3940
kbr@chromium.org476541f2011-10-27 21:14:51 +00003941 case 145:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003942
3943 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00003944 (yyval.interm.typeList) = NewPoolTTypeList();
3945 (yyval.interm.typeList)->push_back((yyvsp[(1) - (1)].interm.typeLine));
3946 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003947 break;
3948
kbr@chromium.org476541f2011-10-27 21:14:51 +00003949 case 146:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003950
3951 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00003952 (yyval.interm.typeList)->push_back((yyvsp[(3) - (3)].interm.typeLine));
3953 }
3954 break;
3955
3956 case 147:
3957
3958 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003959 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
3960 context->recover();
3961
3962 (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
3963 (yyval.interm.typeLine).line = (yyvsp[(1) - (1)].lex).line;
3964 (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (1)].lex).string);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003965 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003966 break;
3967
kbr@chromium.org205fef32011-11-22 20:50:02 +00003968 case 148:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003969
3970 {
3971 if (context->reservedErrorCheck((yyvsp[(1) - (4)].lex).line, *(yyvsp[(1) - (4)].lex).string))
3972 context->recover();
3973
3974 (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
3975 (yyval.interm.typeLine).line = (yyvsp[(1) - (4)].lex).line;
3976 (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (4)].lex).string);
3977
3978 int size;
3979 if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
3980 context->recover();
3981 (yyval.interm.typeLine).type->setArraySize(size);
kbr@chromium.org205fef32011-11-22 20:50:02 +00003982 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003983 break;
3984
3985 case 149:
3986
kbr@chromium.org205fef32011-11-22 20:50:02 +00003987 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003988 break;
3989
3990 case 150:
3991
kbr@chromium.org205fef32011-11-22 20:50:02 +00003992 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003993 break;
3994
3995 case 151:
3996
kbr@chromium.org205fef32011-11-22 20:50:02 +00003997 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermAggregate); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003998 break;
3999
4000 case 152:
4001
kbr@chromium.org205fef32011-11-22 20:50:02 +00004002 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004003 break;
4004
4005 case 153:
4006
kbr@chromium.org205fef32011-11-22 20:50:02 +00004007 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004008 break;
4009
4010 case 154:
4011
kbr@chromium.org205fef32011-11-22 20:50:02 +00004012 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004013 break;
4014
4015 case 155:
4016
kbr@chromium.org205fef32011-11-22 20:50:02 +00004017 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004018 break;
4019
4020 case 156:
4021
kbr@chromium.org205fef32011-11-22 20:50:02 +00004022 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004023 break;
4024
4025 case 157:
4026
kbr@chromium.org205fef32011-11-22 20:50:02 +00004027 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
zmo@google.com09c323a2011-08-12 18:22:25 +00004028 break;
4029
4030 case 158:
4031
kbr@chromium.org205fef32011-11-22 20:50:02 +00004032 { (yyval.interm.intermAggregate) = 0; }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004033 break;
4034
4035 case 159:
4036
kbr@chromium.org205fef32011-11-22 20:50:02 +00004037 { context->symbolTable.push(); }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004038 break;
4039
4040 case 160:
4041
kbr@chromium.org205fef32011-11-22 20:50:02 +00004042 { context->symbolTable.pop(); }
4043 break;
4044
4045 case 161:
4046
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004047 {
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004048 if ((yyvsp[(3) - (5)].interm.intermAggregate) != 0) {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004049 (yyvsp[(3) - (5)].interm.intermAggregate)->setOp(EOpSequence);
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004050 (yyvsp[(3) - (5)].interm.intermAggregate)->setEndLine((yyvsp[(5) - (5)].lex).line);
4051 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004052 (yyval.interm.intermAggregate) = (yyvsp[(3) - (5)].interm.intermAggregate);
kbr@chromium.org205fef32011-11-22 20:50:02 +00004053 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004054 break;
4055
4056 case 162:
4057
kbr@chromium.org205fef32011-11-22 20:50:02 +00004058 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004059 break;
4060
4061 case 163:
4062
kbr@chromium.org205fef32011-11-22 20:50:02 +00004063 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004064 break;
4065
kbr@chromium.org476541f2011-10-27 21:14:51 +00004066 case 164:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004067
4068 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004069 (yyval.interm.intermNode) = 0;
4070 }
4071 break;
4072
4073 case 165:
4074
4075 {
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004076 if ((yyvsp[(2) - (3)].interm.intermAggregate)) {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004077 (yyvsp[(2) - (3)].interm.intermAggregate)->setOp(EOpSequence);
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004078 (yyvsp[(2) - (3)].interm.intermAggregate)->setEndLine((yyvsp[(3) - (3)].lex).line);
4079 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004080 (yyval.interm.intermNode) = (yyvsp[(2) - (3)].interm.intermAggregate);
kbr@chromium.org205fef32011-11-22 20:50:02 +00004081 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004082 break;
4083
kbr@chromium.org476541f2011-10-27 21:14:51 +00004084 case 166:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004085
4086 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004087 (yyval.interm.intermAggregate) = context->intermediate.makeAggregate((yyvsp[(1) - (1)].interm.intermNode), 0);
4088 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004089 break;
4090
kbr@chromium.org476541f2011-10-27 21:14:51 +00004091 case 167:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004092
kbr@chromium.org205fef32011-11-22 20:50:02 +00004093 {
4094 (yyval.interm.intermAggregate) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermAggregate), (yyvsp[(2) - (2)].interm.intermNode), 0);
4095 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004096 break;
4097
kbr@chromium.org476541f2011-10-27 21:14:51 +00004098 case 168:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004099
kbr@chromium.org205fef32011-11-22 20:50:02 +00004100 { (yyval.interm.intermNode) = 0; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004101 break;
4102
kbr@chromium.org476541f2011-10-27 21:14:51 +00004103 case 169:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004104
kbr@chromium.org205fef32011-11-22 20:50:02 +00004105 { (yyval.interm.intermNode) = static_cast<TIntermNode*>((yyvsp[(1) - (2)].interm.intermTypedNode)); }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004106 break;
4107
kbr@chromium.org476541f2011-10-27 21:14:51 +00004108 case 170:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004109
4110 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004111 if (context->boolErrorCheck((yyvsp[(1) - (5)].lex).line, (yyvsp[(3) - (5)].interm.intermTypedNode)))
4112 context->recover();
4113 (yyval.interm.intermNode) = context->intermediate.addSelection((yyvsp[(3) - (5)].interm.intermTypedNode), (yyvsp[(5) - (5)].interm.nodePair), (yyvsp[(1) - (5)].lex).line);
4114 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004115 break;
4116
kbr@chromium.org476541f2011-10-27 21:14:51 +00004117 case 171:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004118
4119 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004120 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermNode);
4121 (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermNode);
4122 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004123 break;
4124
kbr@chromium.org476541f2011-10-27 21:14:51 +00004125 case 172:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004126
4127 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004128 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (1)].interm.intermNode);
4129 (yyval.interm.nodePair).node2 = 0;
4130 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004131 break;
4132
kbr@chromium.org476541f2011-10-27 21:14:51 +00004133 case 173:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004134
4135 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004136 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
4137 if (context->boolErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)->getLine(), (yyvsp[(1) - (1)].interm.intermTypedNode)))
4138 context->recover();
4139 }
4140 break;
4141
4142 case 174:
4143
4144 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004145 TIntermNode* intermNode;
4146 if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
4147 context->recover();
4148 if (context->boolErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
4149 context->recover();
4150
4151 if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode))
4152 (yyval.interm.intermTypedNode) = (yyvsp[(4) - (4)].interm.intermTypedNode);
4153 else {
4154 context->recover();
4155 (yyval.interm.intermTypedNode) = 0;
4156 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004157 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004158 break;
4159
kbr@chromium.org476541f2011-10-27 21:14:51 +00004160 case 175:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004161
kbr@chromium.org205fef32011-11-22 20:50:02 +00004162 { context->symbolTable.push(); ++context->loopNestingLevel; }
4163 break;
4164
4165 case 176:
4166
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004167 {
4168 context->symbolTable.pop();
alokp@chromium.org52813552010-11-16 18:36:09 +00004169 (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 +00004170 --context->loopNestingLevel;
kbr@chromium.org205fef32011-11-22 20:50:02 +00004171 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004172 break;
4173
kbr@chromium.org476541f2011-10-27 21:14:51 +00004174 case 177:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004175
kbr@chromium.org205fef32011-11-22 20:50:02 +00004176 { ++context->loopNestingLevel; }
4177 break;
4178
4179 case 178:
4180
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004181 {
4182 if (context->boolErrorCheck((yyvsp[(8) - (8)].lex).line, (yyvsp[(6) - (8)].interm.intermTypedNode)))
4183 context->recover();
4184
alokp@chromium.org52813552010-11-16 18:36:09 +00004185 (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 +00004186 --context->loopNestingLevel;
kbr@chromium.org205fef32011-11-22 20:50:02 +00004187 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004188 break;
4189
kbr@chromium.org476541f2011-10-27 21:14:51 +00004190 case 179:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004191
kbr@chromium.org205fef32011-11-22 20:50:02 +00004192 { context->symbolTable.push(); ++context->loopNestingLevel; }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004193 break;
4194
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004195 case 180:
4196
4197 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004198 context->symbolTable.pop();
4199 (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);
4200 --context->loopNestingLevel;
4201 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004202 break;
4203
4204 case 181:
4205
4206 {
kbr@chromium.org476541f2011-10-27 21:14:51 +00004207 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
kbr@chromium.org205fef32011-11-22 20:50:02 +00004208 }
zmo@google.com09c323a2011-08-12 18:22:25 +00004209 break;
4210
4211 case 182:
4212
4213 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004214 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
4215 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004216 break;
4217
4218 case 183:
4219
4220 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004221 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
4222 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004223 break;
4224
4225 case 184:
4226
4227 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004228 (yyval.interm.intermTypedNode) = 0;
4229 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004230 break;
4231
kbr@chromium.org476541f2011-10-27 21:14:51 +00004232 case 185:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004233
4234 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004235 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (2)].interm.intermTypedNode);
4236 (yyval.interm.nodePair).node2 = 0;
4237 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004238 break;
4239
kbr@chromium.org476541f2011-10-27 21:14:51 +00004240 case 186:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004241
4242 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004243 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermTypedNode);
4244 (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermTypedNode);
4245 }
4246 break;
4247
4248 case 187:
4249
4250 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004251 if (context->loopNestingLevel <= 0) {
4252 context->error((yyvsp[(1) - (2)].lex).line, "continue statement only allowed in loops", "", "");
4253 context->recover();
4254 }
4255 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpContinue, (yyvsp[(1) - (2)].lex).line);
kbr@chromium.org205fef32011-11-22 20:50:02 +00004256 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004257 break;
4258
kbr@chromium.org205fef32011-11-22 20:50:02 +00004259 case 188:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004260
4261 {
4262 if (context->loopNestingLevel <= 0) {
4263 context->error((yyvsp[(1) - (2)].lex).line, "break statement only allowed in loops", "", "");
4264 context->recover();
4265 }
4266 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpBreak, (yyvsp[(1) - (2)].lex).line);
kbr@chromium.org205fef32011-11-22 20:50:02 +00004267 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004268 break;
4269
kbr@chromium.org205fef32011-11-22 20:50:02 +00004270 case 189:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004271
4272 {
4273 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(1) - (2)].lex).line);
4274 if (context->currentFunctionType->getBasicType() != EbtVoid) {
4275 context->error((yyvsp[(1) - (2)].lex).line, "non-void function must return a value", "return", "");
4276 context->recover();
4277 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004278 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004279 break;
4280
kbr@chromium.org205fef32011-11-22 20:50:02 +00004281 case 190:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004282
4283 {
4284 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(2) - (3)].interm.intermTypedNode), (yyvsp[(1) - (3)].lex).line);
4285 context->functionReturnsValue = true;
4286 if (context->currentFunctionType->getBasicType() == EbtVoid) {
4287 context->error((yyvsp[(1) - (3)].lex).line, "void function cannot return a value", "return", "");
4288 context->recover();
4289 } else if (*(context->currentFunctionType) != (yyvsp[(2) - (3)].interm.intermTypedNode)->getType()) {
4290 context->error((yyvsp[(1) - (3)].lex).line, "function return is not matching type:", "return", "");
4291 context->recover();
4292 }
kbr@chromium.org205fef32011-11-22 20:50:02 +00004293 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004294 break;
4295
kbr@chromium.org476541f2011-10-27 21:14:51 +00004296 case 191:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004297
4298 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004299 FRAG_ONLY("discard", (yyvsp[(1) - (2)].lex).line);
4300 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpKill, (yyvsp[(1) - (2)].lex).line);
4301 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004302 break;
4303
kbr@chromium.org476541f2011-10-27 21:14:51 +00004304 case 192:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004305
4306 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004307 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
zmo@google.com09c323a2011-08-12 18:22:25 +00004308 context->treeRoot = (yyval.interm.intermNode);
kbr@chromium.org205fef32011-11-22 20:50:02 +00004309 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004310 break;
4311
zmo@google.com09c323a2011-08-12 18:22:25 +00004312 case 193:
4313
4314 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004315 (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermNode), (yyvsp[(2) - (2)].interm.intermNode), 0);
4316 context->treeRoot = (yyval.interm.intermNode);
4317 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004318 break;
4319
4320 case 194:
4321
4322 {
4323 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
kbr@chromium.org205fef32011-11-22 20:50:02 +00004324 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004325 break;
4326
4327 case 195:
4328
4329 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004330 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
4331 }
4332 break;
4333
4334 case 196:
4335
4336 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004337 TFunction* function = (yyvsp[(1) - (1)].interm).function;
4338 TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find(function->getMangledName()));
4339 //
4340 // Note: 'prevDec' could be 'function' if this is the first time we've seen function
4341 // as it would have just been put in the symbol table. Otherwise, we're looking up
4342 // an earlier occurance.
4343 //
4344 if (prevDec->isDefined()) {
4345 //
4346 // Then this function already has a body.
4347 //
4348 context->error((yyvsp[(1) - (1)].interm).line, "function already has a body", function->getName().c_str(), "");
4349 context->recover();
4350 }
4351 prevDec->setDefined();
4352
4353 //
4354 // Raise error message if main function takes any parameters or return anything other than void
4355 //
4356 if (function->getName() == "main") {
4357 if (function->getParamCount() > 0) {
4358 context->error((yyvsp[(1) - (1)].interm).line, "function cannot take any parameter(s)", function->getName().c_str(), "");
4359 context->recover();
4360 }
4361 if (function->getReturnType().getBasicType() != EbtVoid) {
4362 context->error((yyvsp[(1) - (1)].interm).line, "", function->getReturnType().getBasicString(), "main function cannot return a value");
4363 context->recover();
4364 }
4365 }
4366
4367 //
4368 // New symbol table scope for body of function plus its arguments
4369 //
4370 context->symbolTable.push();
4371
4372 //
4373 // Remember the return type for later checking for RETURN statements.
4374 //
4375 context->currentFunctionType = &(prevDec->getReturnType());
4376 context->functionReturnsValue = false;
4377
4378 //
4379 // Insert parameters into the symbol table.
4380 // If the parameter has no name, it's not an error, just don't insert it
4381 // (could be used for unused args).
4382 //
4383 // Also, accumulate the list of parameters into the HIL, so lower level code
4384 // knows where to find parameters.
4385 //
4386 TIntermAggregate* paramNodes = new TIntermAggregate;
4387 for (int i = 0; i < function->getParamCount(); i++) {
4388 const TParameter& param = function->getParam(i);
4389 if (param.name != 0) {
4390 TVariable *variable = new TVariable(param.name, *param.type);
4391 //
4392 // Insert the parameters with name in the symbol table.
4393 //
4394 if (! context->symbolTable.insert(*variable)) {
4395 context->error((yyvsp[(1) - (1)].interm).line, "redefinition", variable->getName().c_str(), "");
4396 context->recover();
4397 delete variable;
4398 }
4399
4400 //
4401 // Add the parameter to the HIL
4402 //
4403 paramNodes = context->intermediate.growAggregate(
4404 paramNodes,
4405 context->intermediate.addSymbol(variable->getUniqueId(),
4406 variable->getName(),
4407 variable->getType(), (yyvsp[(1) - (1)].interm).line),
4408 (yyvsp[(1) - (1)].interm).line);
4409 } else {
4410 paramNodes = context->intermediate.growAggregate(paramNodes, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (1)].interm).line), (yyvsp[(1) - (1)].interm).line);
4411 }
4412 }
4413 context->intermediate.setAggregateOperator(paramNodes, EOpParameters, (yyvsp[(1) - (1)].interm).line);
4414 (yyvsp[(1) - (1)].interm).intermAggregate = paramNodes;
4415 context->loopNestingLevel = 0;
kbr@chromium.org205fef32011-11-22 20:50:02 +00004416 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004417 break;
4418
kbr@chromium.org205fef32011-11-22 20:50:02 +00004419 case 197:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004420
4421 {
4422 //?? Check that all paths return a value if return type != void ?
4423 // May be best done as post process phase on intermediate code
4424 if (context->currentFunctionType->getBasicType() != EbtVoid && ! context->functionReturnsValue) {
4425 context->error((yyvsp[(1) - (3)].interm).line, "function does not return a value:", "", (yyvsp[(1) - (3)].interm).function->getName().c_str());
4426 context->recover();
4427 }
4428 context->symbolTable.pop();
4429 (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermAggregate, (yyvsp[(3) - (3)].interm.intermNode), 0);
4430 context->intermediate.setAggregateOperator((yyval.interm.intermNode), EOpFunction, (yyvsp[(1) - (3)].interm).line);
4431 (yyval.interm.intermNode)->getAsAggregate()->setName((yyvsp[(1) - (3)].interm).function->getMangledName().c_str());
4432 (yyval.interm.intermNode)->getAsAggregate()->setType((yyvsp[(1) - (3)].interm).function->getReturnType());
4433
4434 // store the pragma information for debug and optimize and other vendor specific
4435 // information. This information can be queried from the parse tree
4436 (yyval.interm.intermNode)->getAsAggregate()->setOptimize(context->contextPragma.optimize);
4437 (yyval.interm.intermNode)->getAsAggregate()->setDebug(context->contextPragma.debug);
4438 (yyval.interm.intermNode)->getAsAggregate()->addToPragmaTable(context->contextPragma.pragmaTable);
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004439
4440 if ((yyvsp[(3) - (3)].interm.intermNode) && (yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate())
4441 (yyval.interm.intermNode)->getAsAggregate()->setEndLine((yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate()->getEndLine());
kbr@chromium.org205fef32011-11-22 20:50:02 +00004442 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004443 break;
4444
4445
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004446
4447 default: break;
4448 }
4449 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
4450
4451 YYPOPSTACK (yylen);
4452 yylen = 0;
4453 YY_STACK_PRINT (yyss, yyssp);
4454
4455 *++yyvsp = yyval;
4456
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004457 /* Now `shift' the result of the reduction. Determine what state
4458 that goes to, based on the state we popped back to and the rule
4459 number reduced by. */
4460
4461 yyn = yyr1[yyn];
4462
4463 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
4464 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
4465 yystate = yytable[yystate];
4466 else
4467 yystate = yydefgoto[yyn - YYNTOKENS];
4468
4469 goto yynewstate;
4470
4471
4472/*------------------------------------.
4473| yyerrlab -- here on detecting error |
4474`------------------------------------*/
4475yyerrlab:
4476 /* If not already recovering from an error, report this error. */
4477 if (!yyerrstatus)
4478 {
4479 ++yynerrs;
4480#if ! YYERROR_VERBOSE
4481 yyerror (context, YY_("syntax error"));
4482#else
4483 {
4484 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
4485 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
4486 {
4487 YYSIZE_T yyalloc = 2 * yysize;
4488 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
4489 yyalloc = YYSTACK_ALLOC_MAXIMUM;
4490 if (yymsg != yymsgbuf)
4491 YYSTACK_FREE (yymsg);
4492 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
4493 if (yymsg)
4494 yymsg_alloc = yyalloc;
4495 else
4496 {
4497 yymsg = yymsgbuf;
4498 yymsg_alloc = sizeof yymsgbuf;
4499 }
4500 }
4501
4502 if (0 < yysize && yysize <= yymsg_alloc)
4503 {
4504 (void) yysyntax_error (yymsg, yystate, yychar);
4505 yyerror (context, yymsg);
4506 }
4507 else
4508 {
4509 yyerror (context, YY_("syntax error"));
4510 if (yysize != 0)
4511 goto yyexhaustedlab;
4512 }
4513 }
4514#endif
4515 }
4516
4517
4518
4519 if (yyerrstatus == 3)
4520 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004521 /* If just tried and failed to reuse lookahead token after an
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004522 error, discard it. */
4523
4524 if (yychar <= YYEOF)
4525 {
4526 /* Return failure if at end of input. */
4527 if (yychar == YYEOF)
4528 YYABORT;
4529 }
4530 else
4531 {
4532 yydestruct ("Error: discarding",
4533 yytoken, &yylval, context);
4534 yychar = YYEMPTY;
4535 }
4536 }
4537
kbr@chromium.org205fef32011-11-22 20:50:02 +00004538 /* Else will try to reuse lookahead token after shifting the error
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004539 token. */
4540 goto yyerrlab1;
4541
4542
4543/*---------------------------------------------------.
4544| yyerrorlab -- error raised explicitly by YYERROR. |
4545`---------------------------------------------------*/
4546yyerrorlab:
4547
4548 /* Pacify compilers like GCC when the user code never invokes
4549 YYERROR and the label yyerrorlab therefore never appears in user
4550 code. */
4551 if (/*CONSTCOND*/ 0)
4552 goto yyerrorlab;
4553
4554 /* Do not reclaim the symbols of the rule which action triggered
4555 this YYERROR. */
4556 YYPOPSTACK (yylen);
4557 yylen = 0;
4558 YY_STACK_PRINT (yyss, yyssp);
4559 yystate = *yyssp;
4560 goto yyerrlab1;
4561
4562
4563/*-------------------------------------------------------------.
4564| yyerrlab1 -- common code for both syntax error and YYERROR. |
4565`-------------------------------------------------------------*/
4566yyerrlab1:
4567 yyerrstatus = 3; /* Each real token shifted decrements this. */
4568
4569 for (;;)
4570 {
4571 yyn = yypact[yystate];
4572 if (yyn != YYPACT_NINF)
4573 {
4574 yyn += YYTERROR;
4575 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
4576 {
4577 yyn = yytable[yyn];
4578 if (0 < yyn)
4579 break;
4580 }
4581 }
4582
4583 /* Pop the current state because it cannot handle the error token. */
4584 if (yyssp == yyss)
4585 YYABORT;
4586
4587
4588 yydestruct ("Error: popping",
4589 yystos[yystate], yyvsp, context);
4590 YYPOPSTACK (1);
4591 yystate = *yyssp;
4592 YY_STACK_PRINT (yyss, yyssp);
4593 }
4594
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004595 *++yyvsp = yylval;
4596
4597
4598 /* Shift the error token. */
4599 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
4600
4601 yystate = yyn;
4602 goto yynewstate;
4603
4604
4605/*-------------------------------------.
4606| yyacceptlab -- YYACCEPT comes here. |
4607`-------------------------------------*/
4608yyacceptlab:
4609 yyresult = 0;
4610 goto yyreturn;
4611
4612/*-----------------------------------.
4613| yyabortlab -- YYABORT comes here. |
4614`-----------------------------------*/
4615yyabortlab:
4616 yyresult = 1;
4617 goto yyreturn;
4618
kbr@chromium.org205fef32011-11-22 20:50:02 +00004619#if !defined(yyoverflow) || YYERROR_VERBOSE
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004620/*-------------------------------------------------.
4621| yyexhaustedlab -- memory exhaustion comes here. |
4622`-------------------------------------------------*/
4623yyexhaustedlab:
4624 yyerror (context, YY_("memory exhausted"));
4625 yyresult = 2;
4626 /* Fall through. */
4627#endif
4628
4629yyreturn:
kbr@chromium.org205fef32011-11-22 20:50:02 +00004630 if (yychar != YYEMPTY)
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004631 yydestruct ("Cleanup: discarding lookahead",
4632 yytoken, &yylval, context);
4633 /* Do not reclaim the symbols of the rule which action triggered
4634 this YYABORT or YYACCEPT. */
4635 YYPOPSTACK (yylen);
4636 YY_STACK_PRINT (yyss, yyssp);
4637 while (yyssp != yyss)
4638 {
4639 yydestruct ("Cleanup: popping",
4640 yystos[*yyssp], yyvsp, context);
4641 YYPOPSTACK (1);
4642 }
4643#ifndef yyoverflow
4644 if (yyss != yyssa)
4645 YYSTACK_FREE (yyss);
4646#endif
4647#if YYERROR_VERBOSE
4648 if (yymsg != yymsgbuf)
4649 YYSTACK_FREE (yymsg);
4650#endif
4651 /* Make sure YYID is used. */
4652 return YYID (yyresult);
4653}
4654
4655
4656
4657
4658
4659int glslang_parse(TParseContext* context) {
4660 return yyparse(context);
4661}
4662
4663