blob: cfce783cda3546b761d73dd6343f0db171e03ee9 [file] [log] [blame]
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001/* A Bison parser, made by GNU Bison 2.3. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002
3/* Skeleton implementation for Bison's Yacc-like parsers in C
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004
5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00006 Free Software Foundation, Inc.
apatrick@chromium.org536888b2012-01-25 02:10:25 +00007
8 This program is free software; you can redistribute it and/or modify
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00009 it under the terms of the GNU General Public License as published by
apatrick@chromium.org536888b2012-01-25 02:10:25 +000010 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
12
alokp@chromium.org044a5cf2010-11-12 15:42:16 +000013 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
apatrick@chromium.org536888b2012-01-25 02:10:25 +000017
alokp@chromium.org044a5cf2010-11-12 15:42:16 +000018 You should have received a copy of the GNU General Public License
apatrick@chromium.org536888b2012-01-25 02:10:25 +000019 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +000022
23/* As a special exception, you may create a larger work that contains
24 part or all of the Bison parser skeleton and distribute that work
25 under terms of your choice, so long as that work isn't itself a
26 parser generator using the skeleton or a modified version thereof
27 as a parser skeleton. Alternatively, if you modify or redistribute
28 the parser skeleton itself, you may (at your option) remove this
29 special exception, which will cause the skeleton and the resulting
30 Bison output files to be licensed under the GNU General Public
31 License without this special exception.
apatrick@chromium.org536888b2012-01-25 02:10:25 +000032
alokp@chromium.org044a5cf2010-11-12 15:42:16 +000033 This special exception was added by the Free Software Foundation in
34 version 2.2 of Bison. */
35
36/* C LALR(1) parser skeleton written by Richard Stallman, by
37 simplifying the original so-called "semantic" parser. */
38
39/* All symbols defined below should begin with yy or YY, to avoid
40 infringing on user name space. This should be done even for local
41 variables, as they might otherwise be expanded by user macros.
42 There are some unavoidable exceptions within include files to
43 define necessary library symbols; they are noted "INFRINGES ON
44 USER NAME SPACE" below. */
45
46/* Identify Bison output. */
47#define YYBISON 1
48
49/* Bison version. */
apatrick@chromium.org536888b2012-01-25 02:10:25 +000050#define YYBISON_VERSION "2.3"
alokp@chromium.org044a5cf2010-11-12 15:42:16 +000051
52/* Skeleton name. */
53#define YYSKELETON_NAME "yacc.c"
54
55/* Pure parsers. */
56#define YYPURE 1
57
58/* Using locations. */
59#define YYLSP_NEEDED 0
60
61
62
63/* Tokens. */
64#ifndef YYTOKENTYPE
65# define YYTOKENTYPE
66 /* Put the tokens into the symbol table, so that GDB and other debuggers
67 know about them. */
68 enum yytokentype {
69 INVARIANT = 258,
70 HIGH_PRECISION = 259,
71 MEDIUM_PRECISION = 260,
72 LOW_PRECISION = 261,
73 PRECISION = 262,
74 ATTRIBUTE = 263,
75 CONST_QUAL = 264,
76 BOOL_TYPE = 265,
77 FLOAT_TYPE = 266,
78 INT_TYPE = 267,
79 BREAK = 268,
80 CONTINUE = 269,
81 DO = 270,
82 ELSE = 271,
83 FOR = 272,
84 IF = 273,
85 DISCARD = 274,
86 RETURN = 275,
87 BVEC2 = 276,
88 BVEC3 = 277,
89 BVEC4 = 278,
90 IVEC2 = 279,
91 IVEC3 = 280,
92 IVEC4 = 281,
93 VEC2 = 282,
94 VEC3 = 283,
95 VEC4 = 284,
96 MATRIX2 = 285,
97 MATRIX3 = 286,
98 MATRIX4 = 287,
99 IN_QUAL = 288,
100 OUT_QUAL = 289,
101 INOUT_QUAL = 290,
102 UNIFORM = 291,
103 VARYING = 292,
104 STRUCT = 293,
105 VOID_TYPE = 294,
106 WHILE = 295,
107 SAMPLER2D = 296,
108 SAMPLERCUBE = 297,
zmo@google.com09c323a2011-08-12 18:22:25 +0000109 SAMPLER_EXTERNAL_OES = 298,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000110 SAMPLER2DRECT = 299,
111 IDENTIFIER = 300,
112 TYPE_NAME = 301,
113 FLOATCONSTANT = 302,
114 INTCONSTANT = 303,
115 BOOLCONSTANT = 304,
116 FIELD_SELECTION = 305,
117 LEFT_OP = 306,
118 RIGHT_OP = 307,
119 INC_OP = 308,
120 DEC_OP = 309,
121 LE_OP = 310,
122 GE_OP = 311,
123 EQ_OP = 312,
124 NE_OP = 313,
125 AND_OP = 314,
126 OR_OP = 315,
127 XOR_OP = 316,
128 MUL_ASSIGN = 317,
129 DIV_ASSIGN = 318,
130 ADD_ASSIGN = 319,
131 MOD_ASSIGN = 320,
132 LEFT_ASSIGN = 321,
133 RIGHT_ASSIGN = 322,
134 AND_ASSIGN = 323,
135 XOR_ASSIGN = 324,
136 OR_ASSIGN = 325,
137 SUB_ASSIGN = 326,
138 LEFT_PAREN = 327,
139 RIGHT_PAREN = 328,
140 LEFT_BRACKET = 329,
141 RIGHT_BRACKET = 330,
142 LEFT_BRACE = 331,
143 RIGHT_BRACE = 332,
144 DOT = 333,
145 COMMA = 334,
146 COLON = 335,
147 EQUAL = 336,
148 SEMICOLON = 337,
149 BANG = 338,
150 DASH = 339,
151 TILDE = 340,
152 PLUS = 341,
153 STAR = 342,
154 SLASH = 343,
155 PERCENT = 344,
156 LEFT_ANGLE = 345,
157 RIGHT_ANGLE = 346,
158 VERTICAL_BAR = 347,
159 CARET = 348,
160 AMPERSAND = 349,
161 QUESTION = 350
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000162 };
163#endif
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000164/* Tokens. */
165#define INVARIANT 258
166#define HIGH_PRECISION 259
167#define MEDIUM_PRECISION 260
168#define LOW_PRECISION 261
169#define PRECISION 262
170#define ATTRIBUTE 263
171#define CONST_QUAL 264
172#define BOOL_TYPE 265
173#define FLOAT_TYPE 266
174#define INT_TYPE 267
175#define BREAK 268
176#define CONTINUE 269
177#define DO 270
178#define ELSE 271
179#define FOR 272
180#define IF 273
181#define DISCARD 274
182#define RETURN 275
183#define BVEC2 276
184#define BVEC3 277
185#define BVEC4 278
186#define IVEC2 279
187#define IVEC3 280
188#define IVEC4 281
189#define VEC2 282
190#define VEC3 283
191#define VEC4 284
192#define MATRIX2 285
193#define MATRIX3 286
194#define MATRIX4 287
195#define IN_QUAL 288
196#define OUT_QUAL 289
197#define INOUT_QUAL 290
198#define UNIFORM 291
199#define VARYING 292
200#define STRUCT 293
201#define VOID_TYPE 294
202#define WHILE 295
203#define SAMPLER2D 296
204#define SAMPLERCUBE 297
205#define SAMPLER_EXTERNAL_OES 298
206#define SAMPLER2DRECT 299
207#define IDENTIFIER 300
208#define TYPE_NAME 301
209#define FLOATCONSTANT 302
210#define INTCONSTANT 303
211#define BOOLCONSTANT 304
212#define FIELD_SELECTION 305
213#define LEFT_OP 306
214#define RIGHT_OP 307
215#define INC_OP 308
216#define DEC_OP 309
217#define LE_OP 310
218#define GE_OP 311
219#define EQ_OP 312
220#define NE_OP 313
221#define AND_OP 314
222#define OR_OP 315
223#define XOR_OP 316
224#define MUL_ASSIGN 317
225#define DIV_ASSIGN 318
226#define ADD_ASSIGN 319
227#define MOD_ASSIGN 320
228#define LEFT_ASSIGN 321
229#define RIGHT_ASSIGN 322
230#define AND_ASSIGN 323
231#define XOR_ASSIGN 324
232#define OR_ASSIGN 325
233#define SUB_ASSIGN 326
234#define LEFT_PAREN 327
235#define RIGHT_PAREN 328
236#define LEFT_BRACKET 329
237#define RIGHT_BRACKET 330
238#define LEFT_BRACE 331
239#define RIGHT_BRACE 332
240#define DOT 333
241#define COMMA 334
242#define COLON 335
243#define EQUAL 336
244#define SEMICOLON 337
245#define BANG 338
246#define DASH 339
247#define TILDE 340
248#define PLUS 341
249#define STAR 342
250#define SLASH 343
251#define PERCENT 344
252#define LEFT_ANGLE 345
253#define RIGHT_ANGLE 346
254#define VERTICAL_BAR 347
255#define CARET 348
256#define AMPERSAND 349
257#define QUESTION 350
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000258
259
260
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000261
262/* Copy the first part of user declarations. */
263
264
265//
266// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
267// Use of this source code is governed by a BSD-style license that can be
268// found in the LICENSE file.
269//
270
271// This file is auto-generated by generate_parser.sh. DO NOT EDIT!
272
273// Ignore errors in auto-generated code.
274#if defined(__GNUC__)
275#pragma GCC diagnostic ignored "-Wunused-variable"
276#elif defined(_MSC_VER)
277#pragma warning(disable: 4065)
278#endif
279
280#include "compiler/SymbolTable.h"
281#include "compiler/ParseHelper.h"
282#include "GLSLANG/ShaderLang.h"
283
284#define YYLEX_PARAM context->scanner
285
286
287/* Enabling traces. */
288#ifndef YYDEBUG
289# define YYDEBUG 0
290#endif
291
292/* Enabling verbose error messages. */
293#ifdef YYERROR_VERBOSE
294# undef YYERROR_VERBOSE
295# define YYERROR_VERBOSE 1
296#else
297# define YYERROR_VERBOSE 0
298#endif
299
300/* Enabling the token table. */
301#ifndef YYTOKEN_TABLE
302# define YYTOKEN_TABLE 0
303#endif
304
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000305#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
306typedef union YYSTYPE
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000307
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000308{
309 struct {
310 TSourceLoc line;
311 union {
312 TString *string;
313 float f;
314 int i;
315 bool b;
316 };
317 TSymbol* symbol;
318 } lex;
319 struct {
320 TSourceLoc line;
321 TOperator op;
322 union {
323 TIntermNode* intermNode;
324 TIntermNodePair nodePair;
325 TIntermTyped* intermTypedNode;
326 TIntermAggregate* intermAggregate;
327 };
328 union {
329 TPublicType type;
330 TPrecision precision;
331 TQualifier qualifier;
332 TFunction* function;
333 TParameter param;
334 TTypeLine typeLine;
335 TTypeList* typeList;
336 };
337 } interm;
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000338}
339/* Line 187 of yacc.c. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000340
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000341 YYSTYPE;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000342# define yystype YYSTYPE /* obsolescent; will be withdrawn */
343# define YYSTYPE_IS_DECLARED 1
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000344# define YYSTYPE_IS_TRIVIAL 1
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000345#endif
346
347
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000348
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000349/* Copy the second part of user declarations. */
350
351
352extern int yylex(YYSTYPE* yylval_param, void* yyscanner);
353extern void yyerror(TParseContext* context, const char* reason);
354
355#define FRAG_VERT_ONLY(S, L) { \
356 if (context->shaderType != SH_FRAGMENT_SHADER && \
357 context->shaderType != SH_VERTEX_SHADER) { \
358 context->error(L, " supported in vertex/fragment shaders only ", S, "", ""); \
359 context->recover(); \
360 } \
361}
362
363#define VERTEX_ONLY(S, L) { \
364 if (context->shaderType != SH_VERTEX_SHADER) { \
365 context->error(L, " supported in vertex shaders only ", S, "", ""); \
366 context->recover(); \
367 } \
368}
369
370#define FRAG_ONLY(S, L) { \
371 if (context->shaderType != SH_FRAGMENT_SHADER) { \
372 context->error(L, " supported in fragment shaders only ", S, "", ""); \
373 context->recover(); \
374 } \
375}
376
377
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000378/* Line 216 of yacc.c. */
379
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000380
381#ifdef short
382# undef short
383#endif
384
385#ifdef YYTYPE_UINT8
386typedef YYTYPE_UINT8 yytype_uint8;
387#else
388typedef unsigned char yytype_uint8;
389#endif
390
391#ifdef YYTYPE_INT8
392typedef YYTYPE_INT8 yytype_int8;
393#elif (defined __STDC__ || defined __C99__FUNC__ \
394 || defined __cplusplus || defined _MSC_VER)
395typedef signed char yytype_int8;
396#else
397typedef short int yytype_int8;
398#endif
399
400#ifdef YYTYPE_UINT16
401typedef YYTYPE_UINT16 yytype_uint16;
402#else
403typedef unsigned short int yytype_uint16;
404#endif
405
406#ifdef YYTYPE_INT16
407typedef YYTYPE_INT16 yytype_int16;
408#else
409typedef short int yytype_int16;
410#endif
411
412#ifndef YYSIZE_T
413# ifdef __SIZE_TYPE__
414# define YYSIZE_T __SIZE_TYPE__
415# elif defined size_t
416# define YYSIZE_T size_t
417# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
418 || defined __cplusplus || defined _MSC_VER)
419# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
420# define YYSIZE_T size_t
421# else
422# define YYSIZE_T unsigned int
423# endif
424#endif
425
426#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
427
428#ifndef YY_
kbr@chromium.org205fef32011-11-22 20:50:02 +0000429# if YYENABLE_NLS
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000430# if ENABLE_NLS
431# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
432# define YY_(msgid) dgettext ("bison-runtime", msgid)
433# endif
434# endif
435# ifndef YY_
436# define YY_(msgid) msgid
437# endif
438#endif
439
440/* Suppress unused-variable warnings by "using" E. */
441#if ! defined lint || defined __GNUC__
442# define YYUSE(e) ((void) (e))
443#else
444# define YYUSE(e) /* empty */
445#endif
446
447/* Identity function, used to suppress warnings about constant conditions. */
448#ifndef lint
449# define YYID(n) (n)
450#else
451#if (defined __STDC__ || defined __C99__FUNC__ \
452 || defined __cplusplus || defined _MSC_VER)
453static int
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000454YYID (int i)
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000455#else
456static int
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000457YYID (i)
458 int i;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000459#endif
460{
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000461 return i;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000462}
463#endif
464
465#if ! defined yyoverflow || YYERROR_VERBOSE
466
467/* The parser invokes alloca or malloc; define the necessary symbols. */
468
469# ifdef YYSTACK_USE_ALLOCA
470# if YYSTACK_USE_ALLOCA
471# ifdef __GNUC__
472# define YYSTACK_ALLOC __builtin_alloca
473# elif defined __BUILTIN_VA_ARG_INCR
474# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
475# elif defined _AIX
476# define YYSTACK_ALLOC __alloca
477# elif defined _MSC_VER
478# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
479# define alloca _alloca
480# else
481# define YYSTACK_ALLOC alloca
482# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
483 || defined __cplusplus || defined _MSC_VER)
484# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
485# ifndef _STDLIB_H
486# define _STDLIB_H 1
487# endif
488# endif
489# endif
490# endif
491# endif
492
493# ifdef YYSTACK_ALLOC
494 /* Pacify GCC's `empty if-body' warning. */
495# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
496# ifndef YYSTACK_ALLOC_MAXIMUM
497 /* The OS might guarantee only one guard page at the bottom of the stack,
498 and a page size can be as small as 4096 bytes. So we cannot safely
499 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
500 to allow for a few compiler-allocated temporary stack slots. */
501# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
502# endif
503# else
504# define YYSTACK_ALLOC YYMALLOC
505# define YYSTACK_FREE YYFREE
506# ifndef YYSTACK_ALLOC_MAXIMUM
507# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
508# endif
509# if (defined __cplusplus && ! defined _STDLIB_H \
510 && ! ((defined YYMALLOC || defined malloc) \
511 && (defined YYFREE || defined free)))
512# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
513# ifndef _STDLIB_H
514# define _STDLIB_H 1
515# endif
516# endif
517# ifndef YYMALLOC
518# define YYMALLOC malloc
519# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
520 || defined __cplusplus || defined _MSC_VER)
521void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
522# endif
523# endif
524# ifndef YYFREE
525# define YYFREE free
526# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
527 || defined __cplusplus || defined _MSC_VER)
528void free (void *); /* INFRINGES ON USER NAME SPACE */
529# endif
530# endif
531# endif
532#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
533
534
535#if (! defined yyoverflow \
536 && (! defined __cplusplus \
537 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
538
539/* A type that is properly aligned for any stack member. */
540union yyalloc
541{
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000542 yytype_int16 yyss;
543 YYSTYPE yyvs;
544 };
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000545
546/* The size of the maximum gap between one aligned stack and the next. */
547# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
548
549/* The size of an array large to enough to hold all stacks, each with
550 N elements. */
551# define YYSTACK_BYTES(N) \
552 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
553 + YYSTACK_GAP_MAXIMUM)
554
555/* Copy COUNT objects from FROM to TO. The source and destination do
556 not overlap. */
557# ifndef YYCOPY
558# if defined __GNUC__ && 1 < __GNUC__
559# define YYCOPY(To, From, Count) \
560 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
561# else
562# define YYCOPY(To, From, Count) \
563 do \
564 { \
565 YYSIZE_T yyi; \
566 for (yyi = 0; yyi < (Count); yyi++) \
567 (To)[yyi] = (From)[yyi]; \
568 } \
569 while (YYID (0))
570# endif
571# endif
572
573/* Relocate STACK from its old location to the new one. The
574 local variables YYSIZE and YYSTACKSIZE give the old and new number of
575 elements in the stack, and YYPTR gives the new location of the
576 stack. Advance YYPTR to a properly aligned location for the next
577 stack. */
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000578# define YYSTACK_RELOCATE(Stack) \
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000579 do \
580 { \
581 YYSIZE_T yynewbytes; \
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000582 YYCOPY (&yyptr->Stack, Stack, yysize); \
583 Stack = &yyptr->Stack; \
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000584 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
585 yyptr += yynewbytes / sizeof (*yyptr); \
586 } \
587 while (YYID (0))
588
589#endif
590
591/* YYFINAL -- State number of the termination state. */
kbr@chromium.org205fef32011-11-22 20:50:02 +0000592#define YYFINAL 71
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000593/* YYLAST -- Last index in YYTABLE. */
kbr@chromium.org205fef32011-11-22 20:50:02 +0000594#define YYLAST 1370
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000595
596/* YYNTOKENS -- Number of terminals. */
kbr@chromium.org205fef32011-11-22 20:50:02 +0000597#define YYNTOKENS 96
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000598/* YYNNTS -- Number of nonterminals. */
kbr@chromium.org476541f2011-10-27 21:14:51 +0000599#define YYNNTS 80
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000600/* YYNRULES -- Number of rules. */
kbr@chromium.org205fef32011-11-22 20:50:02 +0000601#define YYNRULES 197
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000602/* YYNRULES -- Number of states. */
kbr@chromium.org205fef32011-11-22 20:50:02 +0000603#define YYNSTATES 300
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000604
605/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
606#define YYUNDEFTOK 2
kbr@chromium.org205fef32011-11-22 20:50:02 +0000607#define YYMAXUTOK 350
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000608
609#define YYTRANSLATE(YYX) \
610 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
611
612/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
613static const yytype_uint8 yytranslate[] =
614{
615 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
616 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
617 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
618 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
619 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
620 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
621 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
622 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
623 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
624 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
625 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
626 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
627 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
628 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
629 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
630 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
631 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
632 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
633 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
634 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
635 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
636 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
637 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
638 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
639 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
640 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
641 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
642 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
643 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
644 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
645 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
646 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
647 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
648 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000649 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
650 95
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000651};
652
653#if YYDEBUG
654/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
655 YYRHS. */
656static const yytype_uint16 yyprhs[] =
657{
658 0, 0, 3, 5, 7, 9, 11, 13, 17, 19,
659 24, 26, 30, 33, 36, 38, 40, 42, 46, 49,
660 52, 55, 57, 60, 64, 67, 69, 71, 73, 75,
661 78, 81, 84, 86, 88, 90, 92, 96, 100, 102,
662 106, 110, 112, 114, 118, 122, 126, 130, 132, 136,
663 140, 142, 144, 146, 148, 152, 154, 158, 160, 164,
664 166, 172, 174, 178, 180, 182, 184, 186, 188, 190,
665 194, 196, 199, 202, 207, 210, 212, 214, 217, 221,
666 225, 228, 234, 238, 241, 245, 248, 249, 251, 253,
667 255, 257, 259, 263, 269, 276, 282, 284, 287, 292,
668 298, 303, 306, 308, 311, 313, 315, 317, 320, 322,
669 324, 327, 329, 331, 333, 335, 340, 342, 344, 346,
670 348, 350, 352, 354, 356, 358, 360, 362, 364, 366,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000671 368, 370, 372, 374, 376, 378, 380, 382, 384, 385,
672 392, 393, 399, 401, 404, 408, 410, 414, 416, 421,
673 423, 425, 427, 429, 431, 433, 435, 437, 439, 442,
674 443, 444, 450, 452, 454, 457, 461, 463, 466, 468,
675 471, 477, 481, 483, 485, 490, 491, 498, 499, 508,
676 509, 517, 519, 521, 523, 524, 527, 531, 534, 537,
677 540, 544, 547, 549, 552, 554, 556, 557
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000678};
679
680/* YYRHS -- A `-1'-separated list of the rules' RHS. */
681static const yytype_int16 yyrhs[] =
682{
kbr@chromium.org205fef32011-11-22 20:50:02 +0000683 172, 0, -1, 45, -1, 97, -1, 48, -1, 47,
684 -1, 49, -1, 72, 124, 73, -1, 98, -1, 99,
685 74, 100, 75, -1, 101, -1, 99, 78, 50, -1,
686 99, 53, -1, 99, 54, -1, 124, -1, 102, -1,
687 103, -1, 99, 78, 103, -1, 105, 73, -1, 104,
688 73, -1, 106, 39, -1, 106, -1, 106, 122, -1,
689 105, 79, 122, -1, 107, 72, -1, 142, -1, 45,
690 -1, 50, -1, 99, -1, 53, 108, -1, 54, 108,
691 -1, 109, 108, -1, 86, -1, 84, -1, 83, -1,
692 108, -1, 110, 87, 108, -1, 110, 88, 108, -1,
693 110, -1, 111, 86, 110, -1, 111, 84, 110, -1,
694 111, -1, 112, -1, 113, 90, 112, -1, 113, 91,
695 112, -1, 113, 55, 112, -1, 113, 56, 112, -1,
696 113, -1, 114, 57, 113, -1, 114, 58, 113, -1,
697 114, -1, 115, -1, 116, -1, 117, -1, 118, 59,
698 117, -1, 118, -1, 119, 61, 118, -1, 119, -1,
699 120, 60, 119, -1, 120, -1, 120, 95, 124, 80,
700 122, -1, 121, -1, 108, 123, 122, -1, 81, -1,
701 62, -1, 63, -1, 64, -1, 71, -1, 122, -1,
702 124, 79, 122, -1, 121, -1, 127, 82, -1, 135,
703 82, -1, 7, 140, 141, 82, -1, 128, 73, -1,
704 130, -1, 129, -1, 130, 132, -1, 129, 79, 132,
705 -1, 137, 45, 72, -1, 139, 45, -1, 139, 45,
706 74, 125, 75, -1, 138, 133, 131, -1, 133, 131,
707 -1, 138, 133, 134, -1, 133, 134, -1, -1, 33,
708 -1, 34, -1, 35, -1, 139, -1, 136, -1, 135,
709 79, 45, -1, 135, 79, 45, 74, 75, -1, 135,
710 79, 45, 74, 125, 75, -1, 135, 79, 45, 81,
711 150, -1, 137, -1, 137, 45, -1, 137, 45, 74,
712 75, -1, 137, 45, 74, 125, 75, -1, 137, 45,
713 81, 150, -1, 3, 45, -1, 139, -1, 138, 139,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000714 -1, 9, -1, 8, -1, 37, -1, 3, 37, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000715 36, -1, 141, -1, 140, 141, -1, 4, -1, 5,
716 -1, 6, -1, 142, -1, 142, 74, 125, 75, -1,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000717 39, -1, 11, -1, 12, -1, 10, -1, 27, -1,
718 28, -1, 29, -1, 21, -1, 22, -1, 23, -1,
719 24, -1, 25, -1, 26, -1, 30, -1, 31, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000720 32, -1, 41, -1, 42, -1, 43, -1, 44, -1,
721 143, -1, 46, -1, -1, 38, 45, 76, 144, 146,
722 77, -1, -1, 38, 76, 145, 146, 77, -1, 147,
723 -1, 146, 147, -1, 139, 148, 82, -1, 149, -1,
724 148, 79, 149, -1, 45, -1, 45, 74, 125, 75,
725 -1, 122, -1, 126, -1, 154, -1, 153, -1, 151,
726 -1, 160, -1, 161, -1, 164, -1, 171, -1, 76,
727 77, -1, -1, -1, 76, 155, 159, 156, 77, -1,
728 158, -1, 153, -1, 76, 77, -1, 76, 159, 77,
729 -1, 152, -1, 159, 152, -1, 82, -1, 124, 82,
730 -1, 18, 72, 124, 73, 162, -1, 152, 16, 152,
731 -1, 152, -1, 124, -1, 137, 45, 81, 150, -1,
732 -1, 40, 72, 165, 163, 73, 157, -1, -1, 15,
733 166, 152, 40, 72, 124, 73, 82, -1, -1, 17,
734 72, 167, 168, 170, 73, 157, -1, 160, -1, 151,
735 -1, 163, -1, -1, 169, 82, -1, 169, 82, 124,
736 -1, 14, 82, -1, 13, 82, -1, 20, 82, -1,
737 20, 124, 82, -1, 19, 82, -1, 173, -1, 172,
738 173, -1, 174, -1, 126, -1, -1, 127, 175, 158,
739 -1
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000740};
741
742/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
743static const yytype_uint16 yyrline[] =
744{
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000745 0, 160, 160, 195, 198, 211, 216, 221, 227, 230,
746 303, 306, 415, 425, 438, 446, 545, 548, 556, 560,
747 567, 571, 578, 584, 593, 601, 656, 663, 673, 676,
748 686, 696, 717, 718, 719, 724, 725, 734, 746, 747,
749 755, 766, 770, 771, 781, 791, 801, 814, 815, 825,
750 838, 842, 846, 850, 851, 864, 865, 878, 879, 892,
751 893, 910, 911, 924, 925, 926, 927, 928, 932, 935,
752 946, 954, 979, 984, 991, 1027, 1030, 1037, 1045, 1066,
753 1085, 1096, 1125, 1130, 1140, 1145, 1155, 1158, 1161, 1164,
754 1170, 1177, 1180, 1196, 1214, 1238, 1261, 1265, 1283, 1291,
755 1323, 1343, 1419, 1428, 1451, 1454, 1460, 1468, 1476, 1484,
756 1494, 1501, 1504, 1507, 1513, 1516, 1531, 1535, 1539, 1543,
757 1552, 1557, 1562, 1567, 1572, 1577, 1582, 1587, 1592, 1597,
758 1603, 1609, 1615, 1620, 1625, 1634, 1643, 1648, 1661, 1661,
759 1675, 1675, 1684, 1687, 1702, 1738, 1742, 1748, 1756, 1772,
760 1776, 1780, 1781, 1787, 1788, 1789, 1790, 1791, 1795, 1796,
761 1796, 1796, 1806, 1807, 1812, 1815, 1825, 1828, 1834, 1835,
762 1839, 1847, 1851, 1861, 1866, 1883, 1883, 1888, 1888, 1895,
763 1895, 1903, 1906, 1912, 1915, 1921, 1925, 1932, 1939, 1946,
764 1953, 1964, 1973, 1977, 1984, 1987, 1993, 1993
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000765};
766#endif
767
768#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
769/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
770 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
771static const char *const yytname[] =
772{
773 "$end", "error", "$undefined", "INVARIANT", "HIGH_PRECISION",
774 "MEDIUM_PRECISION", "LOW_PRECISION", "PRECISION", "ATTRIBUTE",
775 "CONST_QUAL", "BOOL_TYPE", "FLOAT_TYPE", "INT_TYPE", "BREAK", "CONTINUE",
776 "DO", "ELSE", "FOR", "IF", "DISCARD", "RETURN", "BVEC2", "BVEC3",
777 "BVEC4", "IVEC2", "IVEC3", "IVEC4", "VEC2", "VEC3", "VEC4", "MATRIX2",
778 "MATRIX3", "MATRIX4", "IN_QUAL", "OUT_QUAL", "INOUT_QUAL", "UNIFORM",
779 "VARYING", "STRUCT", "VOID_TYPE", "WHILE", "SAMPLER2D", "SAMPLERCUBE",
kbr@chromium.org205fef32011-11-22 20:50:02 +0000780 "SAMPLER_EXTERNAL_OES", "SAMPLER2DRECT", "IDENTIFIER", "TYPE_NAME",
781 "FLOATCONSTANT", "INTCONSTANT", "BOOLCONSTANT", "FIELD_SELECTION",
782 "LEFT_OP", "RIGHT_OP", "INC_OP", "DEC_OP", "LE_OP", "GE_OP", "EQ_OP",
783 "NE_OP", "AND_OP", "OR_OP", "XOR_OP", "MUL_ASSIGN", "DIV_ASSIGN",
784 "ADD_ASSIGN", "MOD_ASSIGN", "LEFT_ASSIGN", "RIGHT_ASSIGN", "AND_ASSIGN",
785 "XOR_ASSIGN", "OR_ASSIGN", "SUB_ASSIGN", "LEFT_PAREN", "RIGHT_PAREN",
786 "LEFT_BRACKET", "RIGHT_BRACKET", "LEFT_BRACE", "RIGHT_BRACE", "DOT",
787 "COMMA", "COLON", "EQUAL", "SEMICOLON", "BANG", "DASH", "TILDE", "PLUS",
788 "STAR", "SLASH", "PERCENT", "LEFT_ANGLE", "RIGHT_ANGLE", "VERTICAL_BAR",
789 "CARET", "AMPERSAND", "QUESTION", "$accept", "variable_identifier",
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000790 "primary_expression", "postfix_expression", "integer_expression",
791 "function_call", "function_call_or_method", "function_call_generic",
792 "function_call_header_no_parameters",
793 "function_call_header_with_parameters", "function_call_header",
794 "function_identifier", "unary_expression", "unary_operator",
795 "multiplicative_expression", "additive_expression", "shift_expression",
796 "relational_expression", "equality_expression", "and_expression",
797 "exclusive_or_expression", "inclusive_or_expression",
798 "logical_and_expression", "logical_xor_expression",
799 "logical_or_expression", "conditional_expression",
800 "assignment_expression", "assignment_operator", "expression",
801 "constant_expression", "declaration", "function_prototype",
802 "function_declarator", "function_header_with_parameters",
803 "function_header", "parameter_declarator", "parameter_declaration",
804 "parameter_qualifier", "parameter_type_specifier",
805 "init_declarator_list", "single_declaration", "fully_specified_type",
806 "type_qualifier", "type_specifier", "precision_qualifier",
807 "type_specifier_no_prec", "type_specifier_nonarray", "struct_specifier",
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000808 "@1", "@2", "struct_declaration_list", "struct_declaration",
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000809 "struct_declarator_list", "struct_declarator", "initializer",
810 "declaration_statement", "statement", "simple_statement",
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000811 "compound_statement", "@3", "@4", "statement_no_new_scope",
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000812 "compound_statement_no_new_scope", "statement_list",
813 "expression_statement", "selection_statement",
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000814 "selection_rest_statement", "condition", "iteration_statement", "@5",
815 "@6", "@7", "for_init_statement", "conditionopt", "for_rest_statement",
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000816 "jump_statement", "translation_unit", "external_declaration",
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000817 "function_definition", "@8", 0
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000818};
819#endif
820
821# ifdef YYPRINT
822/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
823 token YYLEX-NUM. */
824static const yytype_uint16 yytoknum[] =
825{
826 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
827 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
828 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
829 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
830 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
831 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
832 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
833 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
834 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000835 345, 346, 347, 348, 349, 350
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000836};
837# endif
838
839/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
840static const yytype_uint8 yyr1[] =
841{
kbr@chromium.org205fef32011-11-22 20:50:02 +0000842 0, 96, 97, 98, 98, 98, 98, 98, 99, 99,
843 99, 99, 99, 99, 100, 101, 102, 102, 103, 103,
844 104, 104, 105, 105, 106, 107, 107, 107, 108, 108,
845 108, 108, 109, 109, 109, 110, 110, 110, 111, 111,
846 111, 112, 113, 113, 113, 113, 113, 114, 114, 114,
847 115, 116, 117, 118, 118, 119, 119, 120, 120, 121,
848 121, 122, 122, 123, 123, 123, 123, 123, 124, 124,
849 125, 126, 126, 126, 127, 128, 128, 129, 129, 130,
850 131, 131, 132, 132, 132, 132, 133, 133, 133, 133,
851 134, 135, 135, 135, 135, 135, 136, 136, 136, 136,
852 136, 136, 137, 137, 138, 138, 138, 138, 138, 139,
853 139, 140, 140, 140, 141, 141, 142, 142, 142, 142,
854 142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
855 142, 142, 142, 142, 142, 142, 142, 142, 144, 143,
856 145, 143, 146, 146, 147, 148, 148, 149, 149, 150,
857 151, 152, 152, 153, 153, 153, 153, 153, 154, 155,
858 156, 154, 157, 157, 158, 158, 159, 159, 160, 160,
859 161, 162, 162, 163, 163, 165, 164, 166, 164, 167,
860 164, 168, 168, 169, 169, 170, 170, 171, 171, 171,
861 171, 171, 172, 172, 173, 173, 175, 174
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000862};
863
864/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
865static const yytype_uint8 yyr2[] =
866{
867 0, 2, 1, 1, 1, 1, 1, 3, 1, 4,
868 1, 3, 2, 2, 1, 1, 1, 3, 2, 2,
869 2, 1, 2, 3, 2, 1, 1, 1, 1, 2,
870 2, 2, 1, 1, 1, 1, 3, 3, 1, 3,
871 3, 1, 1, 3, 3, 3, 3, 1, 3, 3,
872 1, 1, 1, 1, 3, 1, 3, 1, 3, 1,
873 5, 1, 3, 1, 1, 1, 1, 1, 1, 3,
874 1, 2, 2, 4, 2, 1, 1, 2, 3, 3,
875 2, 5, 3, 2, 3, 2, 0, 1, 1, 1,
876 1, 1, 3, 5, 6, 5, 1, 2, 4, 5,
877 4, 2, 1, 2, 1, 1, 1, 2, 1, 1,
878 2, 1, 1, 1, 1, 4, 1, 1, 1, 1,
879 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000880 1, 1, 1, 1, 1, 1, 1, 1, 0, 6,
881 0, 5, 1, 2, 3, 1, 3, 1, 4, 1,
882 1, 1, 1, 1, 1, 1, 1, 1, 2, 0,
883 0, 5, 1, 1, 2, 3, 1, 2, 1, 2,
884 5, 3, 1, 1, 4, 0, 6, 0, 8, 0,
885 7, 1, 1, 1, 0, 2, 3, 2, 2, 2,
886 3, 2, 1, 2, 1, 1, 0, 3
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000887};
888
889/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
890 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
891 means the default is an error. */
892static const yytype_uint8 yydefact[] =
893{
894 0, 0, 111, 112, 113, 0, 105, 104, 119, 117,
895 118, 123, 124, 125, 126, 127, 128, 120, 121, 122,
zmo@google.com09c323a2011-08-12 18:22:25 +0000896 129, 130, 131, 108, 106, 0, 116, 132, 133, 134,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000897 135, 137, 195, 196, 0, 76, 86, 0, 91, 96,
898 0, 102, 0, 109, 114, 136, 0, 192, 194, 107,
899 101, 0, 0, 140, 71, 0, 74, 86, 0, 87,
900 88, 89, 77, 0, 86, 0, 72, 97, 103, 110,
901 0, 1, 193, 0, 138, 0, 0, 197, 78, 83,
902 85, 90, 0, 92, 79, 0, 0, 2, 5, 4,
903 6, 27, 0, 0, 0, 34, 33, 32, 3, 8,
904 28, 10, 15, 16, 0, 0, 21, 0, 35, 0,
905 38, 41, 42, 47, 50, 51, 52, 53, 55, 57,
906 59, 70, 0, 25, 73, 0, 0, 0, 142, 0,
907 0, 177, 0, 0, 0, 0, 0, 159, 164, 168,
908 35, 61, 68, 0, 150, 0, 114, 153, 166, 152,
909 151, 0, 154, 155, 156, 157, 80, 82, 84, 0,
910 0, 98, 0, 149, 100, 29, 30, 0, 12, 13,
911 0, 0, 19, 18, 0, 20, 22, 24, 31, 0,
kbr@chromium.org476541f2011-10-27 21:14:51 +0000912 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000913 0, 0, 0, 115, 0, 147, 0, 145, 141, 143,
914 188, 187, 0, 179, 0, 191, 189, 0, 175, 158,
915 0, 64, 65, 66, 67, 63, 0, 0, 169, 165,
916 167, 0, 93, 0, 95, 99, 7, 0, 14, 26,
917 11, 17, 23, 36, 37, 40, 39, 45, 46, 43,
918 44, 48, 49, 54, 56, 58, 0, 139, 0, 0,
919 144, 0, 0, 0, 190, 0, 160, 62, 69, 0,
920 94, 9, 0, 0, 146, 0, 182, 181, 184, 0,
921 173, 0, 0, 0, 81, 60, 148, 0, 183, 0,
922 0, 172, 170, 0, 0, 161, 0, 185, 0, 0,
923 0, 163, 176, 162, 0, 186, 180, 171, 174, 178
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000924};
925
926/* YYDEFGOTO[NTERM-NUM]. */
927static const yytype_int16 yydefgoto[] =
928{
kbr@chromium.org205fef32011-11-22 20:50:02 +0000929 -1, 98, 99, 100, 227, 101, 102, 103, 104, 105,
930 106, 107, 140, 109, 110, 111, 112, 113, 114, 115,
931 116, 117, 118, 119, 120, 141, 142, 216, 143, 122,
932 144, 145, 34, 35, 36, 79, 62, 63, 80, 37,
933 38, 39, 40, 41, 42, 43, 123, 45, 125, 75,
934 127, 128, 196, 197, 164, 147, 148, 149, 150, 210,
935 273, 292, 293, 151, 152, 153, 282, 272, 154, 255,
936 202, 252, 268, 279, 280, 155, 46, 47, 48, 55
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000937};
938
939/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
940 STATE-NUM. */
kbr@chromium.org205fef32011-11-22 20:50:02 +0000941#define YYPACT_NINF -251
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000942static const yytype_int16 yypact[] =
943{
kbr@chromium.org205fef32011-11-22 20:50:02 +0000944 1250, -17, -251, -251, -251, 113, -251, -251, -251, -251,
945 -251, -251, -251, -251, -251, -251, -251, -251, -251, -251,
946 -251, -251, -251, -251, -251, -39, -251, -251, -251, -251,
947 -251, -251, -251, -65, -34, -10, 21, -32, -251, 28,
948 207, -251, 1324, -251, 56, -251, 1206, -251, -251, -251,
949 -251, 1324, 74, -251, -251, 86, -251, 71, 95, -251,
950 -251, -251, -251, 207, 119, 120, -251, -56, -251, -251,
951 971, -251, -251, 84, -251, 207, 287, -251, -251, -251,
952 -251, 124, 207, -59, -251, 773, 971, 98, -251, -251,
953 -251, -251, 971, 971, 971, -251, -251, -251, -251, -251,
954 35, -251, -251, -251, 100, -9, 1037, 102, -251, 971,
955 -27, -1, -251, -24, 99, -251, -251, -251, 112, 111,
956 -51, -251, 103, -251, -251, 207, 135, 1106, -251, 101,
957 104, -251, 109, 115, 106, 839, 117, 107, -251, -251,
958 39, -251, -251, -11, -251, -65, 54, -251, -251, -251,
959 -251, 371, -251, -251, -251, -251, 116, -251, -251, 905,
960 971, -251, 118, -251, -251, -251, -251, 8, -251, -251,
961 971, 1287, -251, -251, 971, 125, -251, -251, -251, 971,
962 971, 971, 971, 971, 971, 971, 971, 971, 971, 971,
963 971, 971, 971, -251, 1149, 122, 17, -251, -251, -251,
964 -251, -251, 455, -251, 971, -251, -251, 32, -251, -251,
965 455, -251, -251, -251, -251, -251, 971, 971, -251, -251,
966 -251, 971, -251, 123, -251, -251, -251, 126, 121, -251,
967 127, -251, -251, -251, -251, -27, -27, -251, -251, -251,
968 -251, -24, -24, -251, 112, 111, 79, -251, 971, 135,
969 -251, 151, 623, 11, -251, 707, 455, -251, -251, 128,
970 -251, -251, 971, 130, -251, 134, -251, -251, 707, 455,
971 121, 147, 136, 131, -251, -251, -251, 971, -251, 132,
972 142, 200, -251, 139, 539, -251, 19, 971, 539, 455,
973 971, -251, -251, -251, 140, 121, -251, -251, -251, -251
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000974};
975
976/* YYPGOTO[NTERM-NUM]. */
977static const yytype_int16 yypgoto[] =
978{
kbr@chromium.org205fef32011-11-22 20:50:02 +0000979 -251, -251, -251, -251, -251, -251, -251, 50, -251, -251,
980 -251, -251, -44, -251, -21, -251, -62, -20, -251, -251,
981 -251, 34, 36, 33, -251, -66, -83, -251, -92, -73,
982 7, 13, -251, -251, -251, 143, 170, 176, 159, -251,
983 -251, -247, -22, -30, 237, -15, 0, -251, -251, -251,
984 129, -122, -251, -6, -159, -8, -140, -250, -251, -251,
985 -251, -41, 202, 48, 9, -251, -251, -5, -251, -251,
986 -251, -251, -251, -251, -251, -251, -251, 213, -251, -251
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000987};
988
989/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
990 positive, shift that token. If negative, reduce the rule which
991 number is the opposite. If zero, do what YYDEFACT says.
992 If YYTABLE_NINF, syntax error. */
zmo@google.comdc4b4f82011-06-17 00:42:53 +0000993#define YYTABLE_NINF -117
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000994static const yytype_int16 yytable[] =
995{
kbr@chromium.org205fef32011-11-22 20:50:02 +0000996 44, 224, 167, 163, 121, 199, 52, 32, 271, 191,
997 68, 220, 162, 33, 64, 159, 84, 54, 85, 121,
998 49, 271, 160, 176, 58, 86, 108, 69, 50, 6,
999 7, 183, 184, 81, 291, 64, 73, 53, 291, 56,
1000 44, 108, 44, 207, 192, 126, 44, 65, 165, 166,
1001 66, 44, 81, 32, 59, 60, 61, 23, 24, 33,
1002 179, 180, 251, 44, 173, 178, 185, 186, 217, 57,
1003 174, 218, 199, 67, 58, 44, 146, 163, 228, 6,
1004 7, 226, 44, 181, 269, 182, 223, 217, 168, 169,
1005 217, 232, 294, 121, -75, 126, 249, 126, 217, 250,
1006 246, 211, 212, 213, 59, 60, 61, 23, 24, 170,
1007 214, 217, 253, 171, 254, 108, 220, 2, 3, 4,
1008 215, 237, 238, 239, 240, 44, -25, 44, 70, 281,
1009 70, 298, 49, 257, 258, 233, 234, 108, 108, 108,
1010 108, 108, 108, 108, 108, 108, 108, 108, 259, 297,
1011 74, 146, 59, 60, 61, 121, 187, 188, 217, 262,
1012 235, 236, 76, 270, 126, 83, 124, 241, 242, 156,
1013 -26, 189, 190, 172, 177, 263, 270, 108, 193, 275,
1014 195, 203, 121, 200, 209, 286, 201, 204, 205, 208,
1015 221, 265, 283, 225, 44, 295, 248, -116, 260, -27,
1016 217, 261, 146, 274, 108, 276, 277, 163, 285, 284,
1017 146, 2, 3, 4, 287, 288, 289, 8, 9, 10,
1018 290, 231, 299, 243, 245, 157, 244, 78, 11, 12,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001019 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001020 82, 158, 51, 264, 266, 25, 26, 296, 27, 28,
1021 29, 30, 146, 31, 194, 146, 146, 77, 256, 72,
1022 0, 267, 0, 278, 0, 0, 0, 0, 146, 146,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001023 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001024 0, 0, 0, 0, 146, 0, 0, 0, 146, 146,
1025 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
1026 129, 130, 131, 0, 132, 133, 134, 135, 11, 12,
1027 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
1028 0, 0, 0, 23, 24, 25, 26, 136, 27, 28,
1029 29, 30, 87, 31, 88, 89, 90, 91, 0, 0,
1030 92, 93, 0, 0, 0, 0, 0, 0, 0, 0,
1031 0, 0, 0, 0, 0, 0, 0, 0, 0, 94,
1032 0, 0, 0, 137, 138, 0, 0, 0, 0, 139,
1033 95, 96, 0, 97, 1, 2, 3, 4, 5, 6,
1034 7, 8, 9, 10, 129, 130, 131, 0, 132, 133,
1035 134, 135, 11, 12, 13, 14, 15, 16, 17, 18,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001036 19, 20, 21, 22, 0, 0, 0, 23, 24, 25,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001037 26, 136, 27, 28, 29, 30, 87, 31, 88, 89,
1038 90, 91, 0, 0, 92, 93, 0, 0, 0, 0,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001039 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001040 0, 0, 0, 94, 0, 0, 0, 137, 219, 0,
1041 0, 0, 0, 139, 95, 96, 0, 97, 1, 2,
1042 3, 4, 5, 6, 7, 8, 9, 10, 129, 130,
1043 131, 0, 132, 133, 134, 135, 11, 12, 13, 14,
1044 15, 16, 17, 18, 19, 20, 21, 22, 0, 0,
1045 0, 23, 24, 25, 26, 136, 27, 28, 29, 30,
1046 87, 31, 88, 89, 90, 91, 0, 0, 92, 93,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001047 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001048 0, 0, 0, 0, 0, 0, 0, 94, 0, 0,
1049 0, 137, 0, 0, 0, 0, 0, 139, 95, 96,
1050 0, 97, 1, 2, 3, 4, 5, 6, 7, 8,
1051 9, 10, 129, 130, 131, 0, 132, 133, 134, 135,
1052 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
1053 21, 22, 0, 0, 0, 23, 24, 25, 26, 136,
1054 27, 28, 29, 30, 87, 31, 88, 89, 90, 91,
1055 0, 0, 92, 93, 0, 0, 0, 0, 0, 0,
1056 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1057 0, 94, 0, 0, 0, 76, 0, 0, 0, 0,
1058 0, 139, 95, 96, 0, 97, 1, 2, 3, 4,
1059 5, 6, 7, 8, 9, 10, 0, 0, 0, 0,
1060 0, 0, 0, 0, 11, 12, 13, 14, 15, 16,
1061 17, 18, 19, 20, 21, 22, 0, 0, 0, 23,
1062 24, 25, 26, 0, 27, 28, 29, 30, 87, 31,
1063 88, 89, 90, 91, 0, 0, 92, 93, 0, 0,
1064 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1065 0, 0, 0, 0, 0, 94, 0, 0, 0, 0,
1066 0, 0, 0, 0, 0, 139, 95, 96, 0, 97,
1067 58, 2, 3, 4, 0, 6, 7, 8, 9, 10,
1068 0, 0, 0, 0, 0, 0, 0, 0, 11, 12,
1069 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
1070 0, 0, 0, 23, 24, 25, 26, 0, 27, 28,
1071 29, 30, 87, 31, 88, 89, 90, 91, 0, 0,
1072 92, 93, 0, 0, 0, 0, 0, 0, 0, 0,
1073 0, 0, 0, 0, 0, 0, 0, 0, 0, 94,
1074 0, 0, 0, 8, 9, 10, 0, 0, 0, 0,
1075 95, 96, 0, 97, 11, 12, 13, 14, 15, 16,
1076 17, 18, 19, 20, 21, 22, 0, 0, 0, 0,
1077 0, 25, 26, 0, 27, 28, 29, 30, 87, 31,
1078 88, 89, 90, 91, 0, 0, 92, 93, 0, 0,
1079 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1080 0, 0, 0, 0, 0, 94, 0, 0, 161, 8,
1081 9, 10, 0, 0, 0, 0, 95, 96, 0, 97,
1082 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
1083 21, 22, 0, 0, 0, 0, 0, 25, 26, 0,
1084 27, 28, 29, 30, 87, 31, 88, 89, 90, 91,
1085 0, 0, 92, 93, 0, 0, 0, 0, 0, 0,
1086 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1087 0, 94, 0, 0, 0, 8, 9, 10, 0, 0,
1088 0, 206, 95, 96, 0, 97, 11, 12, 13, 14,
1089 15, 16, 17, 18, 19, 20, 21, 22, 0, 0,
1090 0, 0, 0, 25, 26, 0, 27, 28, 29, 30,
1091 87, 31, 88, 89, 90, 91, 0, 0, 92, 93,
1092 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1093 0, 0, 0, 0, 0, 0, 0, 94, 0, 0,
1094 222, 8, 9, 10, 0, 0, 0, 0, 95, 96,
1095 0, 97, 11, 12, 13, 14, 15, 16, 17, 18,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001096 19, 20, 21, 22, 0, 0, 0, 0, 0, 25,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001097 26, 0, 27, 28, 29, 30, 87, 31, 88, 89,
1098 90, 91, 0, 0, 92, 93, 0, 0, 0, 0,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001099 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001100 0, 0, 0, 94, 0, 0, 0, 8, 9, 10,
1101 0, 0, 0, 0, 95, 96, 0, 97, 11, 12,
1102 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
1103 0, 0, 0, 0, 0, 25, 175, 0, 27, 28,
1104 29, 30, 87, 31, 88, 89, 90, 91, 0, 0,
1105 92, 93, 0, 0, 0, 0, 0, 0, 0, 0,
1106 0, 0, 0, 0, 0, 0, 0, 0, 0, 94,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001107 2, 3, 4, 0, 0, 0, 8, 9, 10, 0,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001108 95, 96, 0, 97, 0, 0, 0, 11, 12, 13,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001109 14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001110 0, 0, 0, 0, 25, 26, 0, 27, 28, 29,
1111 30, 0, 31, 2, 3, 4, 0, 0, 0, 8,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001112 9, 10, 0, 0, 0, 0, 0, 0, 0, 0,
1113 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001114 21, 22, 0, 198, 0, 0, 0, 25, 26, 0,
1115 27, 28, 29, 30, 0, 31, 0, 0, 0, 0,
1116 0, 0, 0, 0, 0, 0, 71, 0, 0, 1,
1117 2, 3, 4, 5, 6, 7, 8, 9, 10, 0,
1118 0, 0, 0, 0, 0, 0, 247, 11, 12, 13,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001119 14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001120 0, 0, 23, 24, 25, 26, 0, 27, 28, 29,
1121 30, 0, 31, 1, 2, 3, 4, 5, 6, 7,
1122 8, 9, 10, 0, 0, 0, 0, 0, 0, 0,
1123 0, 11, 12, 13, 14, 15, 16, 17, 18, 19,
1124 20, 21, 22, 0, 0, 0, 23, 24, 25, 26,
1125 0, 27, 28, 29, 30, 0, 31, 8, 9, 10,
1126 0, 0, 0, 0, 0, 0, 0, 0, 11, 12,
1127 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
1128 0, 0, 0, 0, 0, 25, 26, 0, 27, 28,
1129 29, 30, 229, 31, 8, 9, 10, 230, 0, 0,
1130 0, 0, 0, 0, 0, 11, 12, 13, 14, 15,
1131 16, 17, 18, 19, 20, 21, 22, 0, 0, 0,
1132 0, 0, 25, 26, 0, 27, 28, 29, 30, 0,
1133 31
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001134};
1135
1136static const yytype_int16 yycheck[] =
1137{
kbr@chromium.org205fef32011-11-22 20:50:02 +00001138 0, 160, 94, 86, 70, 127, 45, 0, 255, 60,
1139 40, 151, 85, 0, 36, 74, 72, 82, 74, 85,
1140 37, 268, 81, 106, 3, 81, 70, 42, 45, 8,
1141 9, 55, 56, 63, 284, 57, 51, 76, 288, 73,
1142 40, 85, 42, 135, 95, 75, 46, 79, 92, 93,
1143 82, 51, 82, 46, 33, 34, 35, 36, 37, 46,
1144 87, 88, 202, 63, 73, 109, 90, 91, 79, 79,
1145 79, 82, 194, 45, 3, 75, 76, 160, 170, 8,
1146 9, 73, 82, 84, 73, 86, 159, 79, 53, 54,
1147 79, 174, 73, 159, 73, 125, 79, 127, 79, 82,
1148 192, 62, 63, 64, 33, 34, 35, 36, 37, 74,
1149 71, 79, 204, 78, 82, 159, 256, 4, 5, 6,
1150 81, 183, 184, 185, 186, 125, 72, 127, 74, 269,
1151 74, 290, 37, 216, 217, 179, 180, 181, 182, 183,
1152 184, 185, 186, 187, 188, 189, 190, 191, 221, 289,
1153 76, 151, 33, 34, 35, 221, 57, 58, 79, 80,
1154 181, 182, 76, 255, 194, 45, 82, 187, 188, 45,
1155 72, 59, 61, 73, 72, 248, 268, 221, 75, 262,
1156 45, 72, 248, 82, 77, 277, 82, 72, 82, 72,
1157 74, 40, 45, 75, 194, 287, 74, 72, 75, 72,
1158 79, 75, 202, 75, 248, 75, 72, 290, 77, 73,
1159 210, 4, 5, 6, 82, 73, 16, 10, 11, 12,
1160 81, 171, 82, 189, 191, 82, 190, 57, 21, 22,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001161 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001162 64, 82, 5, 249, 252, 38, 39, 288, 41, 42,
1163 43, 44, 252, 46, 125, 255, 256, 55, 210, 46,
1164 -1, 252, -1, 268, -1, -1, -1, -1, 268, 269,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001165 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001166 -1, -1, -1, -1, 284, -1, -1, -1, 288, 289,
1167 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
1168 13, 14, 15, -1, 17, 18, 19, 20, 21, 22,
1169 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
1170 -1, -1, -1, 36, 37, 38, 39, 40, 41, 42,
1171 43, 44, 45, 46, 47, 48, 49, 50, -1, -1,
1172 53, 54, -1, -1, -1, -1, -1, -1, -1, -1,
1173 -1, -1, -1, -1, -1, -1, -1, -1, -1, 72,
1174 -1, -1, -1, 76, 77, -1, -1, -1, -1, 82,
1175 83, 84, -1, 86, 3, 4, 5, 6, 7, 8,
1176 9, 10, 11, 12, 13, 14, 15, -1, 17, 18,
1177 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
1178 29, 30, 31, 32, -1, -1, -1, 36, 37, 38,
1179 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
1180 49, 50, -1, -1, 53, 54, -1, -1, -1, -1,
zmo@google.com09c323a2011-08-12 18:22:25 +00001181 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001182 -1, -1, -1, 72, -1, -1, -1, 76, 77, -1,
1183 -1, -1, -1, 82, 83, 84, -1, 86, 3, 4,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001184 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1185 15, -1, 17, 18, 19, 20, 21, 22, 23, 24,
zmo@google.com09c323a2011-08-12 18:22:25 +00001186 25, 26, 27, 28, 29, 30, 31, 32, -1, -1,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001187 -1, 36, 37, 38, 39, 40, 41, 42, 43, 44,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001188 45, 46, 47, 48, 49, 50, -1, -1, 53, 54,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001189 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001190 -1, -1, -1, -1, -1, -1, -1, 72, -1, -1,
1191 -1, 76, -1, -1, -1, -1, -1, 82, 83, 84,
1192 -1, 86, 3, 4, 5, 6, 7, 8, 9, 10,
1193 11, 12, 13, 14, 15, -1, 17, 18, 19, 20,
1194 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
1195 31, 32, -1, -1, -1, 36, 37, 38, 39, 40,
1196 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
1197 -1, -1, 53, 54, -1, -1, -1, -1, -1, -1,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001198 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001199 -1, 72, -1, -1, -1, 76, -1, -1, -1, -1,
1200 -1, 82, 83, 84, -1, 86, 3, 4, 5, 6,
1201 7, 8, 9, 10, 11, 12, -1, -1, -1, -1,
1202 -1, -1, -1, -1, 21, 22, 23, 24, 25, 26,
1203 27, 28, 29, 30, 31, 32, -1, -1, -1, 36,
1204 37, 38, 39, -1, 41, 42, 43, 44, 45, 46,
1205 47, 48, 49, 50, -1, -1, 53, 54, -1, -1,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001206 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001207 -1, -1, -1, -1, -1, 72, -1, -1, -1, -1,
1208 -1, -1, -1, -1, -1, 82, 83, 84, -1, 86,
1209 3, 4, 5, 6, -1, 8, 9, 10, 11, 12,
1210 -1, -1, -1, -1, -1, -1, -1, -1, 21, 22,
1211 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
1212 -1, -1, -1, 36, 37, 38, 39, -1, 41, 42,
1213 43, 44, 45, 46, 47, 48, 49, 50, -1, -1,
1214 53, 54, -1, -1, -1, -1, -1, -1, -1, -1,
1215 -1, -1, -1, -1, -1, -1, -1, -1, -1, 72,
1216 -1, -1, -1, 10, 11, 12, -1, -1, -1, -1,
1217 83, 84, -1, 86, 21, 22, 23, 24, 25, 26,
1218 27, 28, 29, 30, 31, 32, -1, -1, -1, -1,
1219 -1, 38, 39, -1, 41, 42, 43, 44, 45, 46,
1220 47, 48, 49, 50, -1, -1, 53, 54, -1, -1,
1221 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1222 -1, -1, -1, -1, -1, 72, -1, -1, 75, 10,
1223 11, 12, -1, -1, -1, -1, 83, 84, -1, 86,
1224 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
1225 31, 32, -1, -1, -1, -1, -1, 38, 39, -1,
1226 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
1227 -1, -1, 53, 54, -1, -1, -1, -1, -1, -1,
1228 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1229 -1, 72, -1, -1, -1, 10, 11, 12, -1, -1,
1230 -1, 82, 83, 84, -1, 86, 21, 22, 23, 24,
1231 25, 26, 27, 28, 29, 30, 31, 32, -1, -1,
1232 -1, -1, -1, 38, 39, -1, 41, 42, 43, 44,
1233 45, 46, 47, 48, 49, 50, -1, -1, 53, 54,
1234 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1235 -1, -1, -1, -1, -1, -1, -1, 72, -1, -1,
1236 75, 10, 11, 12, -1, -1, -1, -1, 83, 84,
1237 -1, 86, 21, 22, 23, 24, 25, 26, 27, 28,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001238 29, 30, 31, 32, -1, -1, -1, -1, -1, 38,
1239 39, -1, 41, 42, 43, 44, 45, 46, 47, 48,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001240 49, 50, -1, -1, 53, 54, -1, -1, -1, -1,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001241 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001242 -1, -1, -1, 72, -1, -1, -1, 10, 11, 12,
1243 -1, -1, -1, -1, 83, 84, -1, 86, 21, 22,
1244 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
1245 -1, -1, -1, -1, -1, 38, 39, -1, 41, 42,
1246 43, 44, 45, 46, 47, 48, 49, 50, -1, -1,
1247 53, 54, -1, -1, -1, -1, -1, -1, -1, -1,
1248 -1, -1, -1, -1, -1, -1, -1, -1, -1, 72,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001249 4, 5, 6, -1, -1, -1, 10, 11, 12, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001250 83, 84, -1, 86, -1, -1, -1, 21, 22, 23,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001251 24, 25, 26, 27, 28, 29, 30, 31, 32, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001252 -1, -1, -1, -1, 38, 39, -1, 41, 42, 43,
1253 44, -1, 46, 4, 5, 6, -1, -1, -1, 10,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001254 11, 12, -1, -1, -1, -1, -1, -1, -1, -1,
1255 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001256 31, 32, -1, 77, -1, -1, -1, 38, 39, -1,
1257 41, 42, 43, 44, -1, 46, -1, -1, -1, -1,
1258 -1, -1, -1, -1, -1, -1, 0, -1, -1, 3,
1259 4, 5, 6, 7, 8, 9, 10, 11, 12, -1,
1260 -1, -1, -1, -1, -1, -1, 77, 21, 22, 23,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001261 24, 25, 26, 27, 28, 29, 30, 31, 32, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001262 -1, -1, 36, 37, 38, 39, -1, 41, 42, 43,
1263 44, -1, 46, 3, 4, 5, 6, 7, 8, 9,
1264 10, 11, 12, -1, -1, -1, -1, -1, -1, -1,
1265 -1, 21, 22, 23, 24, 25, 26, 27, 28, 29,
1266 30, 31, 32, -1, -1, -1, 36, 37, 38, 39,
1267 -1, 41, 42, 43, 44, -1, 46, 10, 11, 12,
1268 -1, -1, -1, -1, -1, -1, -1, -1, 21, 22,
1269 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
1270 -1, -1, -1, -1, -1, 38, 39, -1, 41, 42,
1271 43, 44, 45, 46, 10, 11, 12, 50, -1, -1,
1272 -1, -1, -1, -1, -1, 21, 22, 23, 24, 25,
1273 26, 27, 28, 29, 30, 31, 32, -1, -1, -1,
1274 -1, -1, 38, 39, -1, 41, 42, 43, 44, -1,
1275 46
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001276};
1277
1278/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
1279 symbol of state STATE-NUM. */
1280static const yytype_uint8 yystos[] =
1281{
1282 0, 3, 4, 5, 6, 7, 8, 9, 10, 11,
1283 12, 21, 22, 23, 24, 25, 26, 27, 28, 29,
zmo@google.com09c323a2011-08-12 18:22:25 +00001284 30, 31, 32, 36, 37, 38, 39, 41, 42, 43,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001285 44, 46, 126, 127, 128, 129, 130, 135, 136, 137,
1286 138, 139, 140, 141, 142, 143, 172, 173, 174, 37,
1287 45, 140, 45, 76, 82, 175, 73, 79, 3, 33,
1288 34, 35, 132, 133, 138, 79, 82, 45, 139, 141,
1289 74, 0, 173, 141, 76, 145, 76, 158, 132, 131,
1290 134, 139, 133, 45, 72, 74, 81, 45, 47, 48,
1291 49, 50, 53, 54, 72, 83, 84, 86, 97, 98,
1292 99, 101, 102, 103, 104, 105, 106, 107, 108, 109,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001293 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001294 120, 121, 125, 142, 82, 144, 139, 146, 147, 13,
1295 14, 15, 17, 18, 19, 20, 40, 76, 77, 82,
1296 108, 121, 122, 124, 126, 127, 142, 151, 152, 153,
1297 154, 159, 160, 161, 164, 171, 45, 131, 134, 74,
1298 81, 75, 125, 122, 150, 108, 108, 124, 53, 54,
1299 74, 78, 73, 73, 79, 39, 122, 72, 108, 87,
1300 88, 84, 86, 55, 56, 90, 91, 57, 58, 59,
1301 61, 60, 95, 75, 146, 45, 148, 149, 77, 147,
1302 82, 82, 166, 72, 72, 82, 82, 124, 72, 77,
1303 155, 62, 63, 64, 71, 81, 123, 79, 82, 77,
1304 152, 74, 75, 125, 150, 75, 73, 100, 124, 45,
1305 50, 103, 122, 108, 108, 110, 110, 112, 112, 112,
1306 112, 113, 113, 117, 118, 119, 124, 77, 74, 79,
1307 82, 152, 167, 124, 82, 165, 159, 122, 122, 125,
1308 75, 75, 80, 125, 149, 40, 151, 160, 168, 73,
1309 124, 137, 163, 156, 75, 122, 75, 72, 163, 169,
1310 170, 152, 162, 45, 73, 77, 124, 82, 73, 16,
1311 81, 153, 157, 158, 73, 124, 157, 152, 150, 82
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001312};
1313
1314#define yyerrok (yyerrstatus = 0)
1315#define yyclearin (yychar = YYEMPTY)
1316#define YYEMPTY (-2)
1317#define YYEOF 0
1318
1319#define YYACCEPT goto yyacceptlab
1320#define YYABORT goto yyabortlab
1321#define YYERROR goto yyerrorlab
1322
1323
1324/* Like YYERROR except do call yyerror. This remains here temporarily
1325 to ease the transition to the new meaning of YYERROR, for GCC.
1326 Once GCC version 2 has supplanted version 1, this can go. */
1327
1328#define YYFAIL goto yyerrlab
1329
1330#define YYRECOVERING() (!!yyerrstatus)
1331
1332#define YYBACKUP(Token, Value) \
1333do \
1334 if (yychar == YYEMPTY && yylen == 1) \
1335 { \
1336 yychar = (Token); \
1337 yylval = (Value); \
1338 yytoken = YYTRANSLATE (yychar); \
1339 YYPOPSTACK (1); \
1340 goto yybackup; \
1341 } \
1342 else \
1343 { \
1344 yyerror (context, YY_("syntax error: cannot back up")); \
1345 YYERROR; \
1346 } \
1347while (YYID (0))
1348
1349
1350#define YYTERROR 1
1351#define YYERRCODE 256
1352
1353
1354/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
1355 If N is 0, then set CURRENT to the empty location which ends
1356 the previous symbol: RHS[0] (always defined). */
1357
1358#define YYRHSLOC(Rhs, K) ((Rhs)[K])
1359#ifndef YYLLOC_DEFAULT
1360# define YYLLOC_DEFAULT(Current, Rhs, N) \
1361 do \
1362 if (YYID (N)) \
1363 { \
1364 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
1365 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
1366 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
1367 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
1368 } \
1369 else \
1370 { \
1371 (Current).first_line = (Current).last_line = \
1372 YYRHSLOC (Rhs, 0).last_line; \
1373 (Current).first_column = (Current).last_column = \
1374 YYRHSLOC (Rhs, 0).last_column; \
1375 } \
1376 while (YYID (0))
1377#endif
1378
1379
1380/* YY_LOCATION_PRINT -- Print the location on the stream.
1381 This macro was not mandated originally: define only if we know
1382 we won't break user code: when these are the locations we know. */
1383
1384#ifndef YY_LOCATION_PRINT
kbr@chromium.org205fef32011-11-22 20:50:02 +00001385# if YYLTYPE_IS_TRIVIAL
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001386# define YY_LOCATION_PRINT(File, Loc) \
1387 fprintf (File, "%d.%d-%d.%d", \
1388 (Loc).first_line, (Loc).first_column, \
1389 (Loc).last_line, (Loc).last_column)
1390# else
1391# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1392# endif
1393#endif
1394
1395
1396/* YYLEX -- calling `yylex' with the right arguments. */
1397
1398#ifdef YYLEX_PARAM
1399# define YYLEX yylex (&yylval, YYLEX_PARAM)
1400#else
1401# define YYLEX yylex (&yylval)
1402#endif
1403
1404/* Enable debugging if requested. */
1405#if YYDEBUG
1406
1407# ifndef YYFPRINTF
1408# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1409# define YYFPRINTF fprintf
1410# endif
1411
1412# define YYDPRINTF(Args) \
1413do { \
1414 if (yydebug) \
1415 YYFPRINTF Args; \
1416} while (YYID (0))
1417
1418# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
1419do { \
1420 if (yydebug) \
1421 { \
1422 YYFPRINTF (stderr, "%s ", Title); \
1423 yy_symbol_print (stderr, \
1424 Type, Value, context); \
1425 YYFPRINTF (stderr, "\n"); \
1426 } \
1427} while (YYID (0))
1428
1429
1430/*--------------------------------.
1431| Print this symbol on YYOUTPUT. |
1432`--------------------------------*/
1433
1434/*ARGSUSED*/
1435#if (defined __STDC__ || defined __C99__FUNC__ \
1436 || defined __cplusplus || defined _MSC_VER)
1437static void
1438yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, TParseContext* context)
1439#else
1440static void
1441yy_symbol_value_print (yyoutput, yytype, yyvaluep, context)
1442 FILE *yyoutput;
1443 int yytype;
1444 YYSTYPE const * const yyvaluep;
1445 TParseContext* context;
1446#endif
1447{
1448 if (!yyvaluep)
1449 return;
1450 YYUSE (context);
1451# ifdef YYPRINT
1452 if (yytype < YYNTOKENS)
1453 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1454# else
1455 YYUSE (yyoutput);
1456# endif
1457 switch (yytype)
1458 {
1459 default:
1460 break;
1461 }
1462}
1463
1464
1465/*--------------------------------.
1466| Print this symbol on YYOUTPUT. |
1467`--------------------------------*/
1468
1469#if (defined __STDC__ || defined __C99__FUNC__ \
1470 || defined __cplusplus || defined _MSC_VER)
1471static void
1472yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, TParseContext* context)
1473#else
1474static void
1475yy_symbol_print (yyoutput, yytype, yyvaluep, context)
1476 FILE *yyoutput;
1477 int yytype;
1478 YYSTYPE const * const yyvaluep;
1479 TParseContext* context;
1480#endif
1481{
1482 if (yytype < YYNTOKENS)
1483 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1484 else
1485 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1486
1487 yy_symbol_value_print (yyoutput, yytype, yyvaluep, context);
1488 YYFPRINTF (yyoutput, ")");
1489}
1490
1491/*------------------------------------------------------------------.
1492| yy_stack_print -- Print the state stack from its BOTTOM up to its |
1493| TOP (included). |
1494`------------------------------------------------------------------*/
1495
1496#if (defined __STDC__ || defined __C99__FUNC__ \
1497 || defined __cplusplus || defined _MSC_VER)
1498static void
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001499yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001500#else
1501static void
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001502yy_stack_print (bottom, top)
1503 yytype_int16 *bottom;
1504 yytype_int16 *top;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001505#endif
1506{
1507 YYFPRINTF (stderr, "Stack now");
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001508 for (; bottom <= top; ++bottom)
1509 YYFPRINTF (stderr, " %d", *bottom);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001510 YYFPRINTF (stderr, "\n");
1511}
1512
1513# define YY_STACK_PRINT(Bottom, Top) \
1514do { \
1515 if (yydebug) \
1516 yy_stack_print ((Bottom), (Top)); \
1517} while (YYID (0))
1518
1519
1520/*------------------------------------------------.
1521| Report that the YYRULE is going to be reduced. |
1522`------------------------------------------------*/
1523
1524#if (defined __STDC__ || defined __C99__FUNC__ \
1525 || defined __cplusplus || defined _MSC_VER)
1526static void
1527yy_reduce_print (YYSTYPE *yyvsp, int yyrule, TParseContext* context)
1528#else
1529static void
1530yy_reduce_print (yyvsp, yyrule, context)
1531 YYSTYPE *yyvsp;
1532 int yyrule;
1533 TParseContext* context;
1534#endif
1535{
1536 int yynrhs = yyr2[yyrule];
1537 int yyi;
1538 unsigned long int yylno = yyrline[yyrule];
1539 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1540 yyrule - 1, yylno);
1541 /* The symbols being reduced. */
1542 for (yyi = 0; yyi < yynrhs; yyi++)
1543 {
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001544 fprintf (stderr, " $%d = ", yyi + 1);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001545 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1546 &(yyvsp[(yyi + 1) - (yynrhs)])
1547 , context);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001548 fprintf (stderr, "\n");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001549 }
1550}
1551
1552# define YY_REDUCE_PRINT(Rule) \
1553do { \
1554 if (yydebug) \
1555 yy_reduce_print (yyvsp, Rule, context); \
1556} while (YYID (0))
1557
1558/* Nonzero means print parse trace. It is left uninitialized so that
1559 multiple parsers can coexist. */
1560int yydebug;
1561#else /* !YYDEBUG */
1562# define YYDPRINTF(Args)
1563# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1564# define YY_STACK_PRINT(Bottom, Top)
1565# define YY_REDUCE_PRINT(Rule)
1566#endif /* !YYDEBUG */
1567
1568
1569/* YYINITDEPTH -- initial size of the parser's stacks. */
1570#ifndef YYINITDEPTH
1571# define YYINITDEPTH 200
1572#endif
1573
1574/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1575 if the built-in stack extension method is used).
1576
1577 Do not make this value too large; the results are undefined if
1578 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1579 evaluated with infinite-precision integer arithmetic. */
1580
1581#ifndef YYMAXDEPTH
1582# define YYMAXDEPTH 10000
1583#endif
1584
1585
1586
1587#if YYERROR_VERBOSE
1588
1589# ifndef yystrlen
1590# if defined __GLIBC__ && defined _STRING_H
1591# define yystrlen strlen
1592# else
1593/* Return the length of YYSTR. */
1594#if (defined __STDC__ || defined __C99__FUNC__ \
1595 || defined __cplusplus || defined _MSC_VER)
1596static YYSIZE_T
1597yystrlen (const char *yystr)
1598#else
1599static YYSIZE_T
1600yystrlen (yystr)
1601 const char *yystr;
1602#endif
1603{
1604 YYSIZE_T yylen;
1605 for (yylen = 0; yystr[yylen]; yylen++)
1606 continue;
1607 return yylen;
1608}
1609# endif
1610# endif
1611
1612# ifndef yystpcpy
1613# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1614# define yystpcpy stpcpy
1615# else
1616/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1617 YYDEST. */
1618#if (defined __STDC__ || defined __C99__FUNC__ \
1619 || defined __cplusplus || defined _MSC_VER)
1620static char *
1621yystpcpy (char *yydest, const char *yysrc)
1622#else
1623static char *
1624yystpcpy (yydest, yysrc)
1625 char *yydest;
1626 const char *yysrc;
1627#endif
1628{
1629 char *yyd = yydest;
1630 const char *yys = yysrc;
1631
1632 while ((*yyd++ = *yys++) != '\0')
1633 continue;
1634
1635 return yyd - 1;
1636}
1637# endif
1638# endif
1639
1640# ifndef yytnamerr
1641/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1642 quotes and backslashes, so that it's suitable for yyerror. The
1643 heuristic is that double-quoting is unnecessary unless the string
1644 contains an apostrophe, a comma, or backslash (other than
1645 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1646 null, do not copy; instead, return the length of what the result
1647 would have been. */
1648static YYSIZE_T
1649yytnamerr (char *yyres, const char *yystr)
1650{
1651 if (*yystr == '"')
1652 {
1653 YYSIZE_T yyn = 0;
1654 char const *yyp = yystr;
1655
1656 for (;;)
1657 switch (*++yyp)
1658 {
1659 case '\'':
1660 case ',':
1661 goto do_not_strip_quotes;
1662
1663 case '\\':
1664 if (*++yyp != '\\')
1665 goto do_not_strip_quotes;
1666 /* Fall through. */
1667 default:
1668 if (yyres)
1669 yyres[yyn] = *yyp;
1670 yyn++;
1671 break;
1672
1673 case '"':
1674 if (yyres)
1675 yyres[yyn] = '\0';
1676 return yyn;
1677 }
1678 do_not_strip_quotes: ;
1679 }
1680
1681 if (! yyres)
1682 return yystrlen (yystr);
1683
1684 return yystpcpy (yyres, yystr) - yyres;
1685}
1686# endif
1687
1688/* Copy into YYRESULT an error message about the unexpected token
1689 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1690 including the terminating null byte. If YYRESULT is null, do not
1691 copy anything; just return the number of bytes that would be
1692 copied. As a special case, return 0 if an ordinary "syntax error"
1693 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1694 size calculation. */
1695static YYSIZE_T
1696yysyntax_error (char *yyresult, int yystate, int yychar)
1697{
1698 int yyn = yypact[yystate];
1699
1700 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1701 return 0;
1702 else
1703 {
1704 int yytype = YYTRANSLATE (yychar);
1705 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1706 YYSIZE_T yysize = yysize0;
1707 YYSIZE_T yysize1;
1708 int yysize_overflow = 0;
1709 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1710 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1711 int yyx;
1712
1713# if 0
1714 /* This is so xgettext sees the translatable formats that are
1715 constructed on the fly. */
1716 YY_("syntax error, unexpected %s");
1717 YY_("syntax error, unexpected %s, expecting %s");
1718 YY_("syntax error, unexpected %s, expecting %s or %s");
1719 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1720 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1721# endif
1722 char *yyfmt;
1723 char const *yyf;
1724 static char const yyunexpected[] = "syntax error, unexpected %s";
1725 static char const yyexpecting[] = ", expecting %s";
1726 static char const yyor[] = " or %s";
1727 char yyformat[sizeof yyunexpected
1728 + sizeof yyexpecting - 1
1729 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1730 * (sizeof yyor - 1))];
1731 char const *yyprefix = yyexpecting;
1732
1733 /* Start YYX at -YYN if negative to avoid negative indexes in
1734 YYCHECK. */
1735 int yyxbegin = yyn < 0 ? -yyn : 0;
1736
1737 /* Stay within bounds of both yycheck and yytname. */
1738 int yychecklim = YYLAST - yyn + 1;
1739 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1740 int yycount = 1;
1741
1742 yyarg[0] = yytname[yytype];
1743 yyfmt = yystpcpy (yyformat, yyunexpected);
1744
1745 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1746 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1747 {
1748 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1749 {
1750 yycount = 1;
1751 yysize = yysize0;
1752 yyformat[sizeof yyunexpected - 1] = '\0';
1753 break;
1754 }
1755 yyarg[yycount++] = yytname[yyx];
1756 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1757 yysize_overflow |= (yysize1 < yysize);
1758 yysize = yysize1;
1759 yyfmt = yystpcpy (yyfmt, yyprefix);
1760 yyprefix = yyor;
1761 }
1762
1763 yyf = YY_(yyformat);
1764 yysize1 = yysize + yystrlen (yyf);
1765 yysize_overflow |= (yysize1 < yysize);
1766 yysize = yysize1;
1767
1768 if (yysize_overflow)
1769 return YYSIZE_MAXIMUM;
1770
1771 if (yyresult)
1772 {
1773 /* Avoid sprintf, as that infringes on the user's name space.
1774 Don't have undefined behavior even if the translation
1775 produced a string with the wrong number of "%s"s. */
1776 char *yyp = yyresult;
1777 int yyi = 0;
1778 while ((*yyp = *yyf) != '\0')
1779 {
1780 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1781 {
1782 yyp += yytnamerr (yyp, yyarg[yyi++]);
1783 yyf += 2;
1784 }
1785 else
1786 {
1787 yyp++;
1788 yyf++;
1789 }
1790 }
1791 }
1792 return yysize;
1793 }
1794}
1795#endif /* YYERROR_VERBOSE */
1796
1797
1798/*-----------------------------------------------.
1799| Release the memory associated to this symbol. |
1800`-----------------------------------------------*/
1801
1802/*ARGSUSED*/
1803#if (defined __STDC__ || defined __C99__FUNC__ \
1804 || defined __cplusplus || defined _MSC_VER)
1805static void
1806yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, TParseContext* context)
1807#else
1808static void
1809yydestruct (yymsg, yytype, yyvaluep, context)
1810 const char *yymsg;
1811 int yytype;
1812 YYSTYPE *yyvaluep;
1813 TParseContext* context;
1814#endif
1815{
1816 YYUSE (yyvaluep);
1817 YYUSE (context);
1818
1819 if (!yymsg)
1820 yymsg = "Deleting";
1821 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1822
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001823 switch (yytype)
1824 {
1825
1826 default:
1827 break;
1828 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001829}
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001830
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001831
1832/* Prevent warnings from -Wmissing-prototypes. */
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001833
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001834#ifdef YYPARSE_PARAM
1835#if defined __STDC__ || defined __cplusplus
1836int yyparse (void *YYPARSE_PARAM);
1837#else
1838int yyparse ();
1839#endif
1840#else /* ! YYPARSE_PARAM */
1841#if defined __STDC__ || defined __cplusplus
1842int yyparse (TParseContext* context);
1843#else
1844int yyparse ();
1845#endif
1846#endif /* ! YYPARSE_PARAM */
1847
1848
1849
1850
1851
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001852
1853/*----------.
1854| yyparse. |
1855`----------*/
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001856
1857#ifdef YYPARSE_PARAM
1858#if (defined __STDC__ || defined __C99__FUNC__ \
1859 || defined __cplusplus || defined _MSC_VER)
1860int
1861yyparse (void *YYPARSE_PARAM)
1862#else
1863int
1864yyparse (YYPARSE_PARAM)
1865 void *YYPARSE_PARAM;
1866#endif
1867#else /* ! YYPARSE_PARAM */
1868#if (defined __STDC__ || defined __C99__FUNC__ \
1869 || defined __cplusplus || defined _MSC_VER)
1870int
1871yyparse (TParseContext* context)
1872#else
1873int
1874yyparse (context)
1875 TParseContext* context;
1876#endif
1877#endif
1878{
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001879 /* The look-ahead symbol. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001880int yychar;
1881
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001882/* The semantic value of the look-ahead symbol. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001883YYSTYPE yylval;
1884
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001885/* Number of syntax errors so far. */
1886int yynerrs;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001887
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001888 int yystate;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001889 int yyn;
1890 int yyresult;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001891 /* Number of tokens to shift before error messages enabled. */
1892 int yyerrstatus;
1893 /* Look-ahead token as an internal (translated) token number. */
1894 int yytoken = 0;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001895#if YYERROR_VERBOSE
1896 /* Buffer for error messages, and its allocated size. */
1897 char yymsgbuf[128];
1898 char *yymsg = yymsgbuf;
1899 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1900#endif
1901
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001902 /* Three stacks and their tools:
1903 `yyss': related to states,
1904 `yyvs': related to semantic values,
1905 `yyls': related to locations.
1906
1907 Refer to the stacks thru separate pointers, to allow yyoverflow
1908 to reallocate them elsewhere. */
1909
1910 /* The state stack. */
1911 yytype_int16 yyssa[YYINITDEPTH];
1912 yytype_int16 *yyss = yyssa;
1913 yytype_int16 *yyssp;
1914
1915 /* The semantic value stack. */
1916 YYSTYPE yyvsa[YYINITDEPTH];
1917 YYSTYPE *yyvs = yyvsa;
1918 YYSTYPE *yyvsp;
1919
1920
1921
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001922#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1923
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001924 YYSIZE_T yystacksize = YYINITDEPTH;
1925
1926 /* The variables used to return semantic value and location from the
1927 action routines. */
1928 YYSTYPE yyval;
1929
1930
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001931 /* The number of symbols on the RHS of the reduced rule.
1932 Keep to zero when no symbol should be popped. */
1933 int yylen = 0;
1934
1935 YYDPRINTF ((stderr, "Starting parse\n"));
1936
1937 yystate = 0;
1938 yyerrstatus = 0;
1939 yynerrs = 0;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001940 yychar = YYEMPTY; /* Cause a token to be read. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001941
1942 /* Initialize stack pointers.
1943 Waste one element of value and location stack
1944 so that they stay on the same level as the state stack.
1945 The wasted elements are never initialized. */
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001946
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001947 yyssp = yyss;
1948 yyvsp = yyvs;
1949
1950 goto yysetstate;
1951
1952/*------------------------------------------------------------.
1953| yynewstate -- Push a new state, which is found in yystate. |
1954`------------------------------------------------------------*/
1955 yynewstate:
1956 /* In all cases, when you get here, the value and location stacks
1957 have just been pushed. So pushing a state here evens the stacks. */
1958 yyssp++;
1959
1960 yysetstate:
1961 *yyssp = yystate;
1962
1963 if (yyss + yystacksize - 1 <= yyssp)
1964 {
1965 /* Get the current used size of the three stacks, in elements. */
1966 YYSIZE_T yysize = yyssp - yyss + 1;
1967
1968#ifdef yyoverflow
1969 {
1970 /* Give user a chance to reallocate the stack. Use copies of
1971 these so that the &'s don't force the real ones into
1972 memory. */
1973 YYSTYPE *yyvs1 = yyvs;
1974 yytype_int16 *yyss1 = yyss;
1975
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001976
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001977 /* Each stack pointer address is followed by the size of the
1978 data in use in that stack, in bytes. This used to be a
1979 conditional around just the two extra args, but that might
1980 be undefined if yyoverflow is a macro. */
1981 yyoverflow (YY_("memory exhausted"),
1982 &yyss1, yysize * sizeof (*yyssp),
1983 &yyvs1, yysize * sizeof (*yyvsp),
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001984
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001985 &yystacksize);
1986
1987 yyss = yyss1;
1988 yyvs = yyvs1;
1989 }
1990#else /* no yyoverflow */
1991# ifndef YYSTACK_RELOCATE
1992 goto yyexhaustedlab;
1993# else
1994 /* Extend the stack our own way. */
1995 if (YYMAXDEPTH <= yystacksize)
1996 goto yyexhaustedlab;
1997 yystacksize *= 2;
1998 if (YYMAXDEPTH < yystacksize)
1999 yystacksize = YYMAXDEPTH;
2000
2001 {
2002 yytype_int16 *yyss1 = yyss;
2003 union yyalloc *yyptr =
2004 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
2005 if (! yyptr)
2006 goto yyexhaustedlab;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002007 YYSTACK_RELOCATE (yyss);
2008 YYSTACK_RELOCATE (yyvs);
2009
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002010# undef YYSTACK_RELOCATE
2011 if (yyss1 != yyssa)
2012 YYSTACK_FREE (yyss1);
2013 }
2014# endif
2015#endif /* no yyoverflow */
2016
2017 yyssp = yyss + yysize - 1;
2018 yyvsp = yyvs + yysize - 1;
2019
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002020
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002021 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
2022 (unsigned long int) yystacksize));
2023
2024 if (yyss + yystacksize - 1 <= yyssp)
2025 YYABORT;
2026 }
2027
2028 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
2029
2030 goto yybackup;
2031
2032/*-----------.
2033| yybackup. |
2034`-----------*/
2035yybackup:
2036
2037 /* Do appropriate processing given the current state. Read a
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002038 look-ahead token if we need one and don't already have one. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002039
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002040 /* First try to decide what to do without reference to look-ahead token. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002041 yyn = yypact[yystate];
2042 if (yyn == YYPACT_NINF)
2043 goto yydefault;
2044
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002045 /* Not known => get a look-ahead token if don't already have one. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002046
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002047 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002048 if (yychar == YYEMPTY)
2049 {
2050 YYDPRINTF ((stderr, "Reading a token: "));
2051 yychar = YYLEX;
2052 }
2053
2054 if (yychar <= YYEOF)
2055 {
2056 yychar = yytoken = YYEOF;
2057 YYDPRINTF ((stderr, "Now at end of input.\n"));
2058 }
2059 else
2060 {
2061 yytoken = YYTRANSLATE (yychar);
2062 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
2063 }
2064
2065 /* If the proper action on seeing token YYTOKEN is to reduce or to
2066 detect an error, take that action. */
2067 yyn += yytoken;
2068 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
2069 goto yydefault;
2070 yyn = yytable[yyn];
2071 if (yyn <= 0)
2072 {
2073 if (yyn == 0 || yyn == YYTABLE_NINF)
2074 goto yyerrlab;
2075 yyn = -yyn;
2076 goto yyreduce;
2077 }
2078
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002079 if (yyn == YYFINAL)
2080 YYACCEPT;
2081
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002082 /* Count tokens shifted since error; after three, turn off error
2083 status. */
2084 if (yyerrstatus)
2085 yyerrstatus--;
2086
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002087 /* Shift the look-ahead token. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002088 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
2089
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002090 /* Discard the shifted token unless it is eof. */
2091 if (yychar != YYEOF)
2092 yychar = YYEMPTY;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002093
2094 yystate = yyn;
2095 *++yyvsp = yylval;
2096
2097 goto yynewstate;
2098
2099
2100/*-----------------------------------------------------------.
2101| yydefault -- do the default action for the current state. |
2102`-----------------------------------------------------------*/
2103yydefault:
2104 yyn = yydefact[yystate];
2105 if (yyn == 0)
2106 goto yyerrlab;
2107 goto yyreduce;
2108
2109
2110/*-----------------------------.
2111| yyreduce -- Do a reduction. |
2112`-----------------------------*/
2113yyreduce:
2114 /* yyn is the number of a rule to reduce with. */
2115 yylen = yyr2[yyn];
2116
2117 /* If YYLEN is nonzero, implement the default value of the action:
2118 `$$ = $1'.
2119
2120 Otherwise, the following line sets YYVAL to garbage.
2121 This behavior is undocumented and Bison
2122 users should not rely upon it. Assigning to YYVAL
2123 unconditionally makes the parser a bit smaller, and it avoids a
2124 GCC warning that YYVAL may be used uninitialized. */
2125 yyval = yyvsp[1-yylen];
2126
2127
2128 YY_REDUCE_PRINT (yyn);
2129 switch (yyn)
2130 {
2131 case 2:
2132
2133 {
2134 // The symbol table search was done in the lexical phase
2135 const TSymbol* symbol = (yyvsp[(1) - (1)].lex).symbol;
2136 const TVariable* variable;
2137 if (symbol == 0) {
2138 context->error((yyvsp[(1) - (1)].lex).line, "undeclared identifier", (yyvsp[(1) - (1)].lex).string->c_str(), "");
2139 context->recover();
2140 TType type(EbtFloat, EbpUndefined);
2141 TVariable* fakeVariable = new TVariable((yyvsp[(1) - (1)].lex).string, type);
2142 context->symbolTable.insert(*fakeVariable);
2143 variable = fakeVariable;
2144 } else {
2145 // This identifier can only be a variable type symbol
2146 if (! symbol->isVariable()) {
2147 context->error((yyvsp[(1) - (1)].lex).line, "variable expected", (yyvsp[(1) - (1)].lex).string->c_str(), "");
2148 context->recover();
2149 }
2150 variable = static_cast<const TVariable*>(symbol);
2151 }
2152
2153 // don't delete $1.string, it's used by error recovery, and the pool
2154 // pop will reclaim the memory
2155
2156 if (variable->getType().getQualifier() == EvqConst ) {
2157 ConstantUnion* constArray = variable->getConstPointer();
2158 TType t(variable->getType());
2159 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(constArray, t, (yyvsp[(1) - (1)].lex).line);
2160 } else
2161 (yyval.interm.intermTypedNode) = context->intermediate.addSymbol(variable->getUniqueId(),
2162 variable->getName(),
2163 variable->getType(), (yyvsp[(1) - (1)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002164 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002165 break;
2166
2167 case 3:
2168
2169 {
2170 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002171 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002172 break;
2173
2174 case 4:
2175
2176 {
2177 //
2178 // INT_TYPE is only 16-bit plus sign bit for vertex/fragment shaders,
2179 // check for overflow for constants
2180 //
2181 if (abs((yyvsp[(1) - (1)].lex).i) >= (1 << 16)) {
2182 context->error((yyvsp[(1) - (1)].lex).line, " integer constant overflow", "", "");
2183 context->recover();
2184 }
2185 ConstantUnion *unionArray = new ConstantUnion[1];
2186 unionArray->setIConst((yyvsp[(1) - (1)].lex).i);
2187 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002188 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002189 break;
2190
2191 case 5:
2192
2193 {
2194 ConstantUnion *unionArray = new ConstantUnion[1];
2195 unionArray->setFConst((yyvsp[(1) - (1)].lex).f);
2196 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002197 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002198 break;
2199
2200 case 6:
2201
2202 {
2203 ConstantUnion *unionArray = new ConstantUnion[1];
2204 unionArray->setBConst((yyvsp[(1) - (1)].lex).b);
2205 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002206 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002207 break;
2208
2209 case 7:
2210
2211 {
2212 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (3)].interm.intermTypedNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002213 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002214 break;
2215
2216 case 8:
2217
2218 {
2219 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002220 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002221 break;
2222
2223 case 9:
2224
2225 {
2226 if (!(yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isVector()) {
2227 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode())
2228 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(), "");
2229 else
2230 context->error((yyvsp[(2) - (4)].lex).line, " left of '[' is not of type array, matrix, or vector ", "expression", "");
2231 context->recover();
2232 }
2233 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst && (yyvsp[(3) - (4)].interm.intermTypedNode)->getQualifier() == EvqConst) {
2234 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) { // constant folding for arrays
2235 (yyval.interm.intermTypedNode) = context->addConstArrayNode((yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2236 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector()) { // constant folding for vectors
2237 TVectorFields fields;
2238 fields.num = 1;
2239 fields.offsets[0] = (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(); // need to do it this way because v.xy sends fields integer array
2240 (yyval.interm.intermTypedNode) = context->addConstVectorNode(fields, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2241 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix()) { // constant folding for matrices
2242 (yyval.interm.intermTypedNode) = context->addConstMatrixNode((yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2243 }
2244 } else {
2245 if ((yyvsp[(3) - (4)].interm.intermTypedNode)->getQualifier() == EvqConst) {
2246 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() ) {
2247 context->error((yyvsp[(2) - (4)].lex).line, "", "[", "field selection out of range '%d'", (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst());
2248 context->recover();
2249 } else {
2250 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) {
2251 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize() == 0) {
2252 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getMaxArraySize() <= (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst()) {
2253 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))
2254 context->recover();
2255 } else {
2256 if (context->arraySetMaxSize((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getTypePointer(), 0, false, (yyvsp[(2) - (4)].lex).line))
2257 context->recover();
2258 }
2259 } else if ( (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst() >= (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize()) {
2260 context->error((yyvsp[(2) - (4)].lex).line, "", "[", "array index out of range '%d'", (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst());
2261 context->recover();
2262 }
2263 }
2264 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(3) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2265 }
2266 } else {
2267 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize() == 0) {
2268 context->error((yyvsp[(2) - (4)].lex).line, "", "[", "array must be redeclared with a size before being indexed with a variable");
2269 context->recover();
2270 }
2271
2272 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexIndirect, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(3) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2273 }
2274 }
2275 if ((yyval.interm.intermTypedNode) == 0) {
2276 ConstantUnion *unionArray = new ConstantUnion[1];
2277 unionArray->setFConst(0.0f);
2278 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpHigh, EvqConst), (yyvsp[(2) - (4)].lex).line);
2279 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) {
2280 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getStruct())
2281 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getStruct(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getTypeName()));
2282 else
2283 (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()));
2284
2285 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst)
2286 (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConst);
2287 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst)
2288 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqConst, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize()));
2289 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix())
2290 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize()));
2291 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst)
2292 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqConst));
2293 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector())
2294 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary));
2295 else
2296 (yyval.interm.intermTypedNode)->setType((yyvsp[(1) - (4)].interm.intermTypedNode)->getType());
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002297 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002298 break;
2299
2300 case 10:
2301
2302 {
2303 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002304 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002305 break;
2306
2307 case 11:
2308
2309 {
2310 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isArray()) {
2311 context->error((yyvsp[(3) - (3)].lex).line, "cannot apply dot operator to an array", ".", "");
2312 context->recover();
2313 }
2314
2315 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isVector()) {
2316 TVectorFields fields;
2317 if (! context->parseVectorFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yyvsp[(3) - (3)].lex).line)) {
2318 fields.num = 1;
2319 fields.offsets[0] = 0;
2320 context->recover();
2321 }
2322
2323 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) { // constant folding for vector fields
2324 (yyval.interm.intermTypedNode) = context->addConstVectorNode(fields, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].lex).line);
2325 if ((yyval.interm.intermTypedNode) == 0) {
2326 context->recover();
2327 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2328 }
2329 else
2330 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(), EvqConst, (int) (*(yyvsp[(3) - (3)].lex).string).size()));
2331 } else {
2332 if (fields.num == 1) {
2333 ConstantUnion *unionArray = new ConstantUnion[1];
2334 unionArray->setIConst(fields.offsets[0]);
2335 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line);
2336 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2337 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision()));
2338 } else {
2339 TString vectorString = *(yyvsp[(3) - (3)].lex).string;
2340 TIntermTyped* index = context->intermediate.addSwizzle(fields, (yyvsp[(3) - (3)].lex).line);
2341 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpVectorSwizzle, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2342 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (int) vectorString.size()));
2343 }
2344 }
2345 } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isMatrix()) {
2346 TMatrixFields fields;
2347 if (! context->parseMatrixFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yyvsp[(3) - (3)].lex).line)) {
2348 fields.wholeRow = false;
2349 fields.wholeCol = false;
2350 fields.row = 0;
2351 fields.col = 0;
2352 context->recover();
2353 }
2354
2355 if (fields.wholeRow || fields.wholeCol) {
2356 context->error((yyvsp[(2) - (3)].lex).line, " non-scalar fields not implemented yet", ".", "");
2357 context->recover();
2358 ConstantUnion *unionArray = new ConstantUnion[1];
2359 unionArray->setIConst(0);
2360 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line);
2361 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2362 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(),EvqTemporary, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize()));
2363 } else {
2364 ConstantUnion *unionArray = new ConstantUnion[1];
2365 unionArray->setIConst(fields.col * (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize() + fields.row);
2366 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line);
2367 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2368 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision()));
2369 }
2370 } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType() == EbtStruct) {
2371 bool fieldFound = false;
2372 const TTypeList* fields = (yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getStruct();
2373 if (fields == 0) {
2374 context->error((yyvsp[(2) - (3)].lex).line, "structure has no fields", "Internal Error", "");
2375 context->recover();
2376 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2377 } else {
2378 unsigned int i;
2379 for (i = 0; i < fields->size(); ++i) {
2380 if ((*fields)[i].type->getFieldName() == *(yyvsp[(3) - (3)].lex).string) {
2381 fieldFound = true;
2382 break;
2383 }
2384 }
2385 if (fieldFound) {
2386 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) {
2387 (yyval.interm.intermTypedNode) = context->addConstStruct(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
2388 if ((yyval.interm.intermTypedNode) == 0) {
2389 context->recover();
2390 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2391 }
2392 else {
2393 (yyval.interm.intermTypedNode)->setType(*(*fields)[i].type);
2394 // change the qualifier of the return type, not of the structure field
2395 // as the structure definition is shared between various structures.
2396 (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConst);
2397 }
2398 } else {
2399 ConstantUnion *unionArray = new ConstantUnion[1];
2400 unionArray->setIConst(i);
2401 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, *(*fields)[i].type, (yyvsp[(3) - (3)].lex).line);
2402 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirectStruct, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2403 (yyval.interm.intermTypedNode)->setType(*(*fields)[i].type);
2404 }
2405 } else {
2406 context->error((yyvsp[(2) - (3)].lex).line, " no such field in structure", (yyvsp[(3) - (3)].lex).string->c_str(), "");
2407 context->recover();
2408 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2409 }
2410 }
2411 } else {
2412 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(), "");
2413 context->recover();
2414 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2415 }
2416 // don't delete $3.string, it's from the pool
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002417 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002418 break;
2419
2420 case 12:
2421
2422 {
2423 if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode)))
2424 context->recover();
2425 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostIncrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line, context->symbolTable);
2426 if ((yyval.interm.intermTypedNode) == 0) {
2427 context->unaryOpError((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
2428 context->recover();
2429 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode);
2430 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002431 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002432 break;
2433
2434 case 13:
2435
2436 {
2437 if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode)))
2438 context->recover();
2439 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostDecrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line, context->symbolTable);
2440 if ((yyval.interm.intermTypedNode) == 0) {
2441 context->unaryOpError((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
2442 context->recover();
2443 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode);
2444 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002445 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002446 break;
2447
2448 case 14:
2449
2450 {
2451 if (context->integerErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode), "[]"))
2452 context->recover();
2453 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002454 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002455 break;
2456
2457 case 15:
2458
2459 {
2460 TFunction* fnCall = (yyvsp[(1) - (1)].interm).function;
2461 TOperator op = fnCall->getBuiltInOp();
2462
2463 if (op != EOpNull)
2464 {
2465 //
2466 // Then this should be a constructor.
2467 // Don't go through the symbol table for constructors.
2468 // Their parameters will be verified algorithmically.
2469 //
2470 TType type(EbtVoid, EbpUndefined); // use this to get the type back
2471 if (context->constructorErrorCheck((yyvsp[(1) - (1)].interm).line, (yyvsp[(1) - (1)].interm).intermNode, *fnCall, op, &type)) {
2472 (yyval.interm.intermTypedNode) = 0;
2473 } else {
2474 //
2475 // It's a constructor, of type 'type'.
2476 //
2477 (yyval.interm.intermTypedNode) = context->addConstructor((yyvsp[(1) - (1)].interm).intermNode, &type, op, fnCall, (yyvsp[(1) - (1)].interm).line);
2478 }
2479
2480 if ((yyval.interm.intermTypedNode) == 0) {
2481 context->recover();
2482 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator(0, op, (yyvsp[(1) - (1)].interm).line);
2483 }
2484 (yyval.interm.intermTypedNode)->setType(type);
2485 } else {
2486 //
2487 // Not a constructor. Find it in the symbol table.
2488 //
2489 const TFunction* fnCandidate;
2490 bool builtIn;
2491 fnCandidate = context->findFunction((yyvsp[(1) - (1)].interm).line, fnCall, &builtIn);
2492 if (fnCandidate) {
2493 //
2494 // A declared function.
2495 //
2496 if (builtIn && !fnCandidate->getExtension().empty() &&
2497 context->extensionErrorCheck((yyvsp[(1) - (1)].interm).line, fnCandidate->getExtension())) {
2498 context->recover();
2499 }
2500 op = fnCandidate->getBuiltInOp();
2501 if (builtIn && op != EOpNull) {
2502 //
2503 // A function call mapped to a built-in operation.
2504 //
2505 if (fnCandidate->getParamCount() == 1) {
2506 //
2507 // Treat it like a built-in unary operator.
2508 //
2509 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(op, (yyvsp[(1) - (1)].interm).intermNode, 0, context->symbolTable);
2510 if ((yyval.interm.intermTypedNode) == 0) {
2511 context->error((yyvsp[(1) - (1)].interm).intermNode->getLine(), " wrong operand type", "Internal Error",
2512 "built in unary operator function. Type: %s",
2513 static_cast<TIntermTyped*>((yyvsp[(1) - (1)].interm).intermNode)->getCompleteString().c_str());
2514 YYERROR;
2515 }
2516 } else {
2517 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, op, (yyvsp[(1) - (1)].interm).line);
2518 }
2519 } else {
2520 // This is a real function call
2521
2522 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, EOpFunctionCall, (yyvsp[(1) - (1)].interm).line);
2523 (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType());
2524
2525 // this is how we know whether the given function is a builtIn function or a user defined function
2526 // if builtIn == false, it's a userDefined -> could be an overloaded builtIn function also
2527 // if builtIn == true, it's definitely a builtIn function with EOpNull
2528 if (!builtIn)
2529 (yyval.interm.intermTypedNode)->getAsAggregate()->setUserDefined();
2530 (yyval.interm.intermTypedNode)->getAsAggregate()->setName(fnCandidate->getMangledName());
2531
2532 TQualifier qual;
2533 for (int i = 0; i < fnCandidate->getParamCount(); ++i) {
2534 qual = fnCandidate->getParam(i).type->getQualifier();
2535 if (qual == EvqOut || qual == EvqInOut) {
2536 if (context->lValueErrorCheck((yyval.interm.intermTypedNode)->getLine(), "assign", (yyval.interm.intermTypedNode)->getAsAggregate()->getSequence()[i]->getAsTyped())) {
2537 context->error((yyvsp[(1) - (1)].interm).intermNode->getLine(), "Constant value cannot be passed for 'out' or 'inout' parameters.", "Error", "");
2538 context->recover();
2539 }
2540 }
2541 }
2542 }
2543 (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType());
2544 } else {
2545 // error message was put out by PaFindFunction()
2546 // Put on a dummy node for error recovery
2547 ConstantUnion *unionArray = new ConstantUnion[1];
2548 unionArray->setFConst(0.0f);
2549 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].interm).line);
2550 context->recover();
2551 }
2552 }
2553 delete fnCall;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002554 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002555 break;
2556
2557 case 16:
2558
2559 {
2560 (yyval.interm) = (yyvsp[(1) - (1)].interm);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002561 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002562 break;
2563
2564 case 17:
2565
2566 {
2567 context->error((yyvsp[(3) - (3)].interm).line, "methods are not supported", "", "");
2568 context->recover();
2569 (yyval.interm) = (yyvsp[(3) - (3)].interm);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002570 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002571 break;
2572
2573 case 18:
2574
2575 {
2576 (yyval.interm) = (yyvsp[(1) - (2)].interm);
2577 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002578 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002579 break;
2580
2581 case 19:
2582
2583 {
2584 (yyval.interm) = (yyvsp[(1) - (2)].interm);
2585 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002586 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002587 break;
2588
2589 case 20:
2590
2591 {
2592 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
2593 (yyval.interm).intermNode = 0;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002594 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002595 break;
2596
2597 case 21:
2598
2599 {
2600 (yyval.interm).function = (yyvsp[(1) - (1)].interm.function);
2601 (yyval.interm).intermNode = 0;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002602 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002603 break;
2604
2605 case 22:
2606
2607 {
2608 TParameter param = { 0, new TType((yyvsp[(2) - (2)].interm.intermTypedNode)->getType()) };
2609 (yyvsp[(1) - (2)].interm.function)->addParameter(param);
2610 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
2611 (yyval.interm).intermNode = (yyvsp[(2) - (2)].interm.intermTypedNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002612 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002613 break;
2614
2615 case 23:
2616
2617 {
2618 TParameter param = { 0, new TType((yyvsp[(3) - (3)].interm.intermTypedNode)->getType()) };
2619 (yyvsp[(1) - (3)].interm).function->addParameter(param);
2620 (yyval.interm).function = (yyvsp[(1) - (3)].interm).function;
2621 (yyval.interm).intermNode = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermNode, (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002622 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002623 break;
2624
2625 case 24:
2626
2627 {
2628 (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002629 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002630 break;
2631
2632 case 25:
2633
2634 {
2635 //
2636 // Constructor
2637 //
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002638 TOperator op = EOpNull;
2639 if ((yyvsp[(1) - (1)].interm.type).userDef) {
2640 op = EOpConstructStruct;
2641 } else {
2642 switch ((yyvsp[(1) - (1)].interm.type).type) {
2643 case EbtFloat:
2644 if ((yyvsp[(1) - (1)].interm.type).matrix) {
2645 switch((yyvsp[(1) - (1)].interm.type).size) {
2646 case 2: op = EOpConstructMat2; break;
2647 case 3: op = EOpConstructMat3; break;
2648 case 4: op = EOpConstructMat4; break;
2649 }
2650 } else {
2651 switch((yyvsp[(1) - (1)].interm.type).size) {
2652 case 1: op = EOpConstructFloat; break;
2653 case 2: op = EOpConstructVec2; break;
2654 case 3: op = EOpConstructVec3; break;
2655 case 4: op = EOpConstructVec4; break;
2656 }
2657 }
2658 break;
2659 case EbtInt:
2660 switch((yyvsp[(1) - (1)].interm.type).size) {
2661 case 1: op = EOpConstructInt; break;
2662 case 2: FRAG_VERT_ONLY("ivec2", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec2; break;
2663 case 3: FRAG_VERT_ONLY("ivec3", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec3; break;
2664 case 4: FRAG_VERT_ONLY("ivec4", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec4; break;
2665 }
2666 break;
2667 case EbtBool:
2668 switch((yyvsp[(1) - (1)].interm.type).size) {
2669 case 1: op = EOpConstructBool; break;
2670 case 2: FRAG_VERT_ONLY("bvec2", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec2; break;
2671 case 3: FRAG_VERT_ONLY("bvec3", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec3; break;
2672 case 4: FRAG_VERT_ONLY("bvec4", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec4; break;
2673 }
2674 break;
2675 default: break;
2676 }
2677 if (op == EOpNull) {
2678 context->error((yyvsp[(1) - (1)].interm.type).line, "cannot construct this type", getBasicString((yyvsp[(1) - (1)].interm.type).type), "");
2679 context->recover();
2680 (yyvsp[(1) - (1)].interm.type).type = EbtFloat;
2681 op = EOpConstructFloat;
2682 }
2683 }
2684 TString tempString;
2685 TType type((yyvsp[(1) - (1)].interm.type));
2686 TFunction *function = new TFunction(&tempString, type, op);
2687 (yyval.interm.function) = function;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002688 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002689 break;
2690
2691 case 26:
2692
2693 {
2694 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
2695 context->recover();
2696 TType type(EbtVoid, EbpUndefined);
2697 TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type);
2698 (yyval.interm.function) = function;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002699 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002700 break;
2701
2702 case 27:
2703
2704 {
2705 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
2706 context->recover();
2707 TType type(EbtVoid, EbpUndefined);
2708 TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type);
2709 (yyval.interm.function) = function;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002710 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002711 break;
2712
2713 case 28:
2714
2715 {
2716 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002717 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002718 break;
2719
2720 case 29:
2721
2722 {
2723 if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)))
2724 context->recover();
2725 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreIncrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line, context->symbolTable);
2726 if ((yyval.interm.intermTypedNode) == 0) {
2727 context->unaryOpError((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2728 context->recover();
2729 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2730 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002731 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002732 break;
2733
2734 case 30:
2735
2736 {
2737 if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)))
2738 context->recover();
2739 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreDecrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line, context->symbolTable);
2740 if ((yyval.interm.intermTypedNode) == 0) {
2741 context->unaryOpError((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2742 context->recover();
2743 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2744 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002745 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002746 break;
2747
2748 case 31:
2749
2750 {
2751 if ((yyvsp[(1) - (2)].interm).op != EOpNull) {
2752 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath((yyvsp[(1) - (2)].interm).op, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].interm).line, context->symbolTable);
2753 if ((yyval.interm.intermTypedNode) == 0) {
2754 const char* errorOp = "";
2755 switch((yyvsp[(1) - (2)].interm).op) {
2756 case EOpNegative: errorOp = "-"; break;
2757 case EOpLogicalNot: errorOp = "!"; break;
2758 default: break;
2759 }
2760 context->unaryOpError((yyvsp[(1) - (2)].interm).line, errorOp, (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2761 context->recover();
2762 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2763 }
2764 } else
2765 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002766 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002767 break;
2768
2769 case 32:
2770
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002771 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNull; ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002772 break;
2773
2774 case 33:
2775
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002776 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNegative; ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002777 break;
2778
2779 case 34:
2780
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002781 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpLogicalNot; ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002782 break;
2783
2784 case 35:
2785
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002786 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002787 break;
2788
2789 case 36:
2790
2791 {
2792 FRAG_VERT_ONLY("*", (yyvsp[(2) - (3)].lex).line);
2793 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpMul, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2794 if ((yyval.interm.intermTypedNode) == 0) {
2795 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "*", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2796 context->recover();
2797 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2798 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002799 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002800 break;
2801
2802 case 37:
2803
2804 {
2805 FRAG_VERT_ONLY("/", (yyvsp[(2) - (3)].lex).line);
2806 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpDiv, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2807 if ((yyval.interm.intermTypedNode) == 0) {
2808 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "/", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2809 context->recover();
2810 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2811 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002812 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002813 break;
2814
2815 case 38:
2816
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002817 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002818 break;
2819
2820 case 39:
2821
2822 {
2823 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpAdd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2824 if ((yyval.interm.intermTypedNode) == 0) {
2825 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "+", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2826 context->recover();
2827 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2828 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002829 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002830 break;
2831
2832 case 40:
2833
2834 {
2835 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpSub, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2836 if ((yyval.interm.intermTypedNode) == 0) {
2837 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "-", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2838 context->recover();
2839 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2840 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002841 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002842 break;
2843
2844 case 41:
2845
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002846 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002847 break;
2848
2849 case 42:
2850
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002851 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002852 break;
2853
2854 case 43:
2855
2856 {
2857 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2858 if ((yyval.interm.intermTypedNode) == 0) {
2859 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2860 context->recover();
2861 ConstantUnion *unionArray = new ConstantUnion[1];
2862 unionArray->setBConst(false);
2863 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2864 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002865 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002866 break;
2867
2868 case 44:
2869
2870 {
2871 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2872 if ((yyval.interm.intermTypedNode) == 0) {
2873 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2874 context->recover();
2875 ConstantUnion *unionArray = new ConstantUnion[1];
2876 unionArray->setBConst(false);
2877 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2878 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002879 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002880 break;
2881
2882 case 45:
2883
2884 {
2885 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2886 if ((yyval.interm.intermTypedNode) == 0) {
2887 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2888 context->recover();
2889 ConstantUnion *unionArray = new ConstantUnion[1];
2890 unionArray->setBConst(false);
2891 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2892 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002893 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002894 break;
2895
2896 case 46:
2897
2898 {
2899 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThanEqual, (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 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002907 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002908 break;
2909
2910 case 47:
2911
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002912 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002913 break;
2914
2915 case 48:
2916
2917 {
2918 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2919 if ((yyval.interm.intermTypedNode) == 0) {
2920 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "==", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2921 context->recover();
2922 ConstantUnion *unionArray = new ConstantUnion[1];
2923 unionArray->setBConst(false);
2924 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2925 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002926 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002927 break;
2928
2929 case 49:
2930
2931 {
2932 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpNotEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2933 if ((yyval.interm.intermTypedNode) == 0) {
2934 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "!=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2935 context->recover();
2936 ConstantUnion *unionArray = new ConstantUnion[1];
2937 unionArray->setBConst(false);
2938 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2939 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002940 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002941 break;
2942
2943 case 50:
2944
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002945 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002946 break;
2947
2948 case 51:
2949
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002950 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002951 break;
2952
2953 case 52:
2954
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002955 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002956 break;
2957
2958 case 53:
2959
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002960 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002961 break;
2962
2963 case 54:
2964
2965 {
2966 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalAnd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2967 if ((yyval.interm.intermTypedNode) == 0) {
2968 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "&&", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2969 context->recover();
2970 ConstantUnion *unionArray = new ConstantUnion[1];
2971 unionArray->setBConst(false);
2972 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2973 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002974 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002975 break;
2976
2977 case 55:
2978
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002979 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002980 break;
2981
2982 case 56:
2983
2984 {
2985 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalXor, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2986 if ((yyval.interm.intermTypedNode) == 0) {
2987 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "^^", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2988 context->recover();
2989 ConstantUnion *unionArray = new ConstantUnion[1];
2990 unionArray->setBConst(false);
2991 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2992 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002993 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002994 break;
2995
2996 case 57:
2997
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002998 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002999 break;
3000
3001 case 58:
3002
3003 {
3004 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalOr, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
3005 if ((yyval.interm.intermTypedNode) == 0) {
3006 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "||", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3007 context->recover();
3008 ConstantUnion *unionArray = new ConstantUnion[1];
3009 unionArray->setBConst(false);
3010 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
3011 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003012 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003013 break;
3014
3015 case 59:
3016
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003017 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003018 break;
3019
3020 case 60:
3021
3022 {
3023 if (context->boolErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.intermTypedNode)))
3024 context->recover();
3025
3026 (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);
3027 if ((yyvsp[(3) - (5)].interm.intermTypedNode)->getType() != (yyvsp[(5) - (5)].interm.intermTypedNode)->getType())
3028 (yyval.interm.intermTypedNode) = 0;
3029
3030 if ((yyval.interm.intermTypedNode) == 0) {
3031 context->binaryOpError((yyvsp[(2) - (5)].lex).line, ":", (yyvsp[(3) - (5)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(5) - (5)].interm.intermTypedNode)->getCompleteString());
3032 context->recover();
3033 (yyval.interm.intermTypedNode) = (yyvsp[(5) - (5)].interm.intermTypedNode);
3034 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003035 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003036 break;
3037
3038 case 61:
3039
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003040 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003041 break;
3042
3043 case 62:
3044
3045 {
3046 if (context->lValueErrorCheck((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)))
3047 context->recover();
3048 (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);
3049 if ((yyval.interm.intermTypedNode) == 0) {
3050 context->assignError((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3051 context->recover();
3052 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
3053 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003054 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003055 break;
3056
3057 case 63:
3058
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003059 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAssign; ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003060 break;
3061
3062 case 64:
3063
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003064 { 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 +00003065 break;
3066
3067 case 65:
3068
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003069 { 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 +00003070 break;
3071
3072 case 66:
3073
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003074 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAddAssign; ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003075 break;
3076
3077 case 67:
3078
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003079 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpSubAssign; ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003080 break;
3081
3082 case 68:
3083
3084 {
3085 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003086 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003087 break;
3088
3089 case 69:
3090
3091 {
3092 (yyval.interm.intermTypedNode) = context->intermediate.addComma((yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
3093 if ((yyval.interm.intermTypedNode) == 0) {
3094 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ",", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3095 context->recover();
3096 (yyval.interm.intermTypedNode) = (yyvsp[(3) - (3)].interm.intermTypedNode);
3097 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003098 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003099 break;
3100
3101 case 70:
3102
3103 {
3104 if (context->constErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)))
3105 context->recover();
3106 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003107 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003108 break;
3109
3110 case 71:
3111
3112 {
3113 TFunction &function = *((yyvsp[(1) - (2)].interm).function);
3114
3115 TIntermAggregate *prototype = new TIntermAggregate;
3116 prototype->setType(function.getReturnType());
3117 prototype->setName(function.getName());
3118
3119 for (int i = 0; i < function.getParamCount(); i++)
3120 {
3121 const TParameter &param = function.getParam(i);
3122 if (param.name != 0)
3123 {
3124 TVariable *variable = new TVariable(param.name, *param.type);
3125
3126 prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(variable->getUniqueId(), variable->getName(), variable->getType(), (yyvsp[(1) - (2)].interm).line), (yyvsp[(1) - (2)].interm).line);
3127 }
3128 else
3129 {
3130 prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (2)].interm).line), (yyvsp[(1) - (2)].interm).line);
3131 }
3132 }
3133
3134 prototype->setOp(EOpPrototype);
3135 (yyval.interm.intermNode) = prototype;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003136 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003137 break;
3138
3139 case 72:
3140
3141 {
3142 if ((yyvsp[(1) - (2)].interm).intermAggregate)
3143 (yyvsp[(1) - (2)].interm).intermAggregate->setOp(EOpDeclaration);
3144 (yyval.interm.intermNode) = (yyvsp[(1) - (2)].interm).intermAggregate;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003145 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003146 break;
3147
3148 case 73:
3149
3150 {
3151 context->symbolTable.setDefaultPrecision( (yyvsp[(3) - (4)].interm.type).type, (yyvsp[(2) - (4)].interm.precision) );
3152 (yyval.interm.intermNode) = 0;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003153 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003154 break;
3155
3156 case 74:
3157
3158 {
3159 //
3160 // Multiple declarations of the same function are allowed.
3161 //
3162 // If this is a definition, the definition production code will check for redefinitions
3163 // (we don't know at this point if it's a definition or not).
3164 //
3165 // Redeclarations are allowed. But, return types and parameter qualifiers must match.
3166 //
3167 TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find((yyvsp[(1) - (2)].interm.function)->getMangledName()));
3168 if (prevDec) {
3169 if (prevDec->getReturnType() != (yyvsp[(1) - (2)].interm.function)->getReturnType()) {
3170 context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same return type", (yyvsp[(1) - (2)].interm.function)->getReturnType().getBasicString(), "");
3171 context->recover();
3172 }
3173 for (int i = 0; i < prevDec->getParamCount(); ++i) {
3174 if (prevDec->getParam(i).type->getQualifier() != (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifier()) {
3175 context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same parameter qualifiers", (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifierString(), "");
3176 context->recover();
3177 }
3178 }
3179 }
3180
3181 //
3182 // If this is a redeclaration, it could also be a definition,
3183 // in which case, we want to use the variable names from this one, and not the one that's
3184 // being redeclared. So, pass back up this declaration, not the one in the symbol table.
3185 //
3186 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
3187 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
3188
3189 context->symbolTable.insert(*(yyval.interm).function);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003190 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003191 break;
3192
3193 case 75:
3194
3195 {
3196 (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003197 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003198 break;
3199
3200 case 76:
3201
3202 {
3203 (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003204 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003205 break;
3206
3207 case 77:
3208
3209 {
3210 // Add the parameter
3211 (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
3212 if ((yyvsp[(2) - (2)].interm).param.type->getBasicType() != EbtVoid)
3213 (yyvsp[(1) - (2)].interm.function)->addParameter((yyvsp[(2) - (2)].interm).param);
3214 else
3215 delete (yyvsp[(2) - (2)].interm).param.type;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003216 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003217 break;
3218
3219 case 78:
3220
3221 {
3222 //
3223 // Only first parameter of one-parameter functions can be void
3224 // The check for named parameters not being void is done in parameter_declarator
3225 //
3226 if ((yyvsp[(3) - (3)].interm).param.type->getBasicType() == EbtVoid) {
3227 //
3228 // This parameter > first is void
3229 //
3230 context->error((yyvsp[(2) - (3)].lex).line, "cannot be an argument type except for '(void)'", "void", "");
3231 context->recover();
3232 delete (yyvsp[(3) - (3)].interm).param.type;
3233 } else {
3234 // Add the parameter
3235 (yyval.interm.function) = (yyvsp[(1) - (3)].interm.function);
3236 (yyvsp[(1) - (3)].interm.function)->addParameter((yyvsp[(3) - (3)].interm).param);
3237 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003238 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003239 break;
3240
3241 case 79:
3242
3243 {
3244 if ((yyvsp[(1) - (3)].interm.type).qualifier != EvqGlobal && (yyvsp[(1) - (3)].interm.type).qualifier != EvqTemporary) {
3245 context->error((yyvsp[(2) - (3)].lex).line, "no qualifiers allowed for function return", getQualifierString((yyvsp[(1) - (3)].interm.type).qualifier), "");
3246 context->recover();
3247 }
3248 // make sure a sampler is not involved as well...
3249 if (context->structQualifierErrorCheck((yyvsp[(2) - (3)].lex).line, (yyvsp[(1) - (3)].interm.type)))
3250 context->recover();
3251
3252 // Add the function as a prototype after parsing it (we do not support recursion)
3253 TFunction *function;
3254 TType type((yyvsp[(1) - (3)].interm.type));
3255 function = new TFunction((yyvsp[(2) - (3)].lex).string, type);
3256 (yyval.interm.function) = function;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003257 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003258 break;
3259
3260 case 80:
3261
3262 {
3263 if ((yyvsp[(1) - (2)].interm.type).type == EbtVoid) {
3264 context->error((yyvsp[(2) - (2)].lex).line, "illegal use of type 'void'", (yyvsp[(2) - (2)].lex).string->c_str(), "");
3265 context->recover();
3266 }
3267 if (context->reservedErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string))
3268 context->recover();
3269 TParameter param = {(yyvsp[(2) - (2)].lex).string, new TType((yyvsp[(1) - (2)].interm.type))};
3270 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
3271 (yyval.interm).param = param;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003272 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003273 break;
3274
3275 case 81:
3276
3277 {
3278 // Check that we can make an array out of this type
3279 if (context->arrayTypeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
3280 context->recover();
3281
3282 if (context->reservedErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string))
3283 context->recover();
3284
3285 int size;
3286 if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3287 context->recover();
3288 (yyvsp[(1) - (5)].interm.type).setArray(true, size);
3289
3290 TType* type = new TType((yyvsp[(1) - (5)].interm.type));
3291 TParameter param = { (yyvsp[(2) - (5)].lex).string, type };
3292 (yyval.interm).line = (yyvsp[(2) - (5)].lex).line;
3293 (yyval.interm).param = param;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003294 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003295 break;
3296
3297 case 82:
3298
3299 {
3300 (yyval.interm) = (yyvsp[(3) - (3)].interm);
3301 if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
3302 context->recover();
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003303 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003304 break;
3305
3306 case 83:
3307
3308 {
3309 (yyval.interm) = (yyvsp[(2) - (2)].interm);
3310 if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
3311 context->recover();
3312 if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
3313 context->recover();
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003314 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003315 break;
3316
3317 case 84:
3318
3319 {
3320 (yyval.interm) = (yyvsp[(3) - (3)].interm);
3321 if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
3322 context->recover();
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003323 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003324 break;
3325
3326 case 85:
3327
3328 {
3329 (yyval.interm) = (yyvsp[(2) - (2)].interm);
3330 if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
3331 context->recover();
3332 if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
3333 context->recover();
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003334 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003335 break;
3336
3337 case 86:
3338
3339 {
3340 (yyval.interm.qualifier) = EvqIn;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003341 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003342 break;
3343
3344 case 87:
3345
3346 {
3347 (yyval.interm.qualifier) = EvqIn;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003348 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003349 break;
3350
3351 case 88:
3352
3353 {
3354 (yyval.interm.qualifier) = EvqOut;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003355 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003356 break;
3357
3358 case 89:
3359
3360 {
3361 (yyval.interm.qualifier) = EvqInOut;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003362 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003363 break;
3364
3365 case 90:
3366
3367 {
3368 TParameter param = { 0, new TType((yyvsp[(1) - (1)].interm.type)) };
3369 (yyval.interm).param = param;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003370 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003371 break;
3372
3373 case 91:
3374
3375 {
3376 (yyval.interm) = (yyvsp[(1) - (1)].interm);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003377 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003378 break;
3379
3380 case 92:
3381
3382 {
zmo@google.comfd747b82011-04-23 01:30:07 +00003383 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(3) - (3)].lex).string, TType((yyvsp[(1) - (3)].interm).type), (yyvsp[(3) - (3)].lex).line);
3384 (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 +00003385
3386 if (context->structQualifierErrorCheck((yyvsp[(3) - (3)].lex).line, (yyval.interm).type))
3387 context->recover();
3388
3389 if (context->nonInitConstErrorCheck((yyvsp[(3) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyval.interm).type))
3390 context->recover();
3391
zmo@google.comfd747b82011-04-23 01:30:07 +00003392 TVariable* variable = 0;
3393 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 +00003394 context->recover();
zmo@google.comfd747b82011-04-23 01:30:07 +00003395 if (symbol && variable)
3396 symbol->setId(variable->getUniqueId());
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003397 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003398 break;
3399
3400 case 93:
3401
3402 {
3403 if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
3404 context->recover();
3405
3406 if (context->nonInitConstErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type))
3407 context->recover();
3408
3409 (yyval.interm) = (yyvsp[(1) - (5)].interm);
3410
3411 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))
3412 context->recover();
3413 else {
3414 (yyvsp[(1) - (5)].interm).type.setArray(true);
3415 TVariable* variable;
3416 if (context->arrayErrorCheck((yyvsp[(4) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, variable))
3417 context->recover();
3418 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003419 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003420 break;
3421
3422 case 94:
3423
3424 {
3425 if (context->structQualifierErrorCheck((yyvsp[(3) - (6)].lex).line, (yyvsp[(1) - (6)].interm).type))
3426 context->recover();
3427
3428 if (context->nonInitConstErrorCheck((yyvsp[(3) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type))
3429 context->recover();
3430
3431 (yyval.interm) = (yyvsp[(1) - (6)].interm);
3432
3433 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))
3434 context->recover();
3435 else {
3436 int size;
3437 if (context->arraySizeErrorCheck((yyvsp[(4) - (6)].lex).line, (yyvsp[(5) - (6)].interm.intermTypedNode), size))
3438 context->recover();
3439 (yyvsp[(1) - (6)].interm).type.setArray(true, size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003440 TVariable* variable = 0;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003441 if (context->arrayErrorCheck((yyvsp[(4) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type, variable))
3442 context->recover();
3443 TType type = TType((yyvsp[(1) - (6)].interm).type);
3444 type.setArraySize(size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003445 (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 +00003446 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003447 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003448 break;
3449
3450 case 95:
3451
3452 {
3453 if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
3454 context->recover();
3455
3456 (yyval.interm) = (yyvsp[(1) - (5)].interm);
3457
3458 TIntermNode* intermNode;
3459 if (!context->executeInitializer((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, (yyvsp[(5) - (5)].interm.intermTypedNode), intermNode)) {
3460 //
3461 // build the intermediate representation
3462 //
3463 if (intermNode)
3464 (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (5)].interm).intermNode, intermNode, (yyvsp[(4) - (5)].lex).line);
3465 else
3466 (yyval.interm).intermAggregate = (yyvsp[(1) - (5)].interm).intermAggregate;
3467 } else {
3468 context->recover();
3469 (yyval.interm).intermAggregate = 0;
3470 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003471 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003472 break;
3473
3474 case 96:
3475
3476 {
3477 (yyval.interm).type = (yyvsp[(1) - (1)].interm.type);
3478 (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);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003479 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003480 break;
3481
3482 case 97:
3483
3484 {
zmo@google.comfd747b82011-04-23 01:30:07 +00003485 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyvsp[(1) - (2)].interm.type)), (yyvsp[(2) - (2)].lex).line);
3486 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (2)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003487
3488 if (context->structQualifierErrorCheck((yyvsp[(2) - (2)].lex).line, (yyval.interm).type))
3489 context->recover();
3490
3491 if (context->nonInitConstErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string, (yyval.interm).type))
3492 context->recover();
3493
3494 (yyval.interm).type = (yyvsp[(1) - (2)].interm.type);
3495
zmo@google.comfd747b82011-04-23 01:30:07 +00003496 TVariable* variable = 0;
3497 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 +00003498 context->recover();
zmo@google.comfd747b82011-04-23 01:30:07 +00003499 if (variable && symbol)
3500 symbol->setId(variable->getUniqueId());
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003501 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003502 break;
3503
3504 case 98:
3505
3506 {
kbr@chromium.org04277b82011-06-02 18:41:26 +00003507 context->error((yyvsp[(2) - (4)].lex).line, "unsized array declarations not supported", (yyvsp[(2) - (4)].lex).string->c_str(), "");
3508 context->recover();
3509
zmo@google.comfd747b82011-04-23 01:30:07 +00003510 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (4)].lex).string, TType((yyvsp[(1) - (4)].interm.type)), (yyvsp[(2) - (4)].lex).line);
3511 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (4)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003512 (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003513 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003514 break;
3515
3516 case 99:
3517
3518 {
3519 TType type = TType((yyvsp[(1) - (5)].interm.type));
3520 int size;
3521 if (context->arraySizeErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3522 context->recover();
3523 type.setArraySize(size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003524 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (5)].lex).string, type, (yyvsp[(2) - (5)].lex).line);
3525 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (5)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003526
3527 if (context->structQualifierErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
3528 context->recover();
3529
3530 if (context->nonInitConstErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type)))
3531 context->recover();
3532
3533 (yyval.interm).type = (yyvsp[(1) - (5)].interm.type);
3534
3535 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)))
3536 context->recover();
3537 else {
3538 int size;
3539 if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3540 context->recover();
3541
3542 (yyvsp[(1) - (5)].interm.type).setArray(true, size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003543 TVariable* variable = 0;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003544 if (context->arrayErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type), variable))
3545 context->recover();
zmo@google.comfd747b82011-04-23 01:30:07 +00003546 if (variable && symbol)
3547 symbol->setId(variable->getUniqueId());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003548 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003549 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003550 break;
3551
3552 case 100:
3553
3554 {
3555 if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
3556 context->recover();
3557
3558 (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
3559
3560 TIntermNode* intermNode;
3561 if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode)) {
3562 //
3563 // Build intermediate representation
3564 //
3565 if(intermNode)
3566 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(intermNode, (yyvsp[(3) - (4)].lex).line);
3567 else
3568 (yyval.interm).intermAggregate = 0;
3569 } else {
3570 context->recover();
3571 (yyval.interm).intermAggregate = 0;
3572 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003573 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003574 break;
3575
3576 case 101:
3577
3578 {
3579 VERTEX_ONLY("invariant declaration", (yyvsp[(1) - (2)].lex).line);
3580 (yyval.interm).qualifier = EvqInvariantVaryingOut;
3581 (yyval.interm).intermAggregate = 0;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003582 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003583 break;
3584
3585 case 102:
3586
3587 {
3588 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3589
3590 if ((yyvsp[(1) - (1)].interm.type).array) {
3591 context->error((yyvsp[(1) - (1)].interm.type).line, "not supported", "first-class array", "");
3592 context->recover();
3593 (yyvsp[(1) - (1)].interm.type).setArray(false);
3594 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003595 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003596 break;
3597
3598 case 103:
3599
3600 {
3601 if ((yyvsp[(2) - (2)].interm.type).array) {
3602 context->error((yyvsp[(2) - (2)].interm.type).line, "not supported", "first-class array", "");
3603 context->recover();
3604 (yyvsp[(2) - (2)].interm.type).setArray(false);
3605 }
3606
3607 if ((yyvsp[(1) - (2)].interm.type).qualifier == EvqAttribute &&
3608 ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
3609 context->error((yyvsp[(2) - (2)].interm.type).line, "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier), "");
3610 context->recover();
3611 }
3612 if (((yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingIn || (yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingOut) &&
3613 ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
3614 context->error((yyvsp[(2) - (2)].interm.type).line, "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier), "");
3615 context->recover();
3616 }
3617 (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
3618 (yyval.interm.type).qualifier = (yyvsp[(1) - (2)].interm.type).qualifier;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003619 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003620 break;
3621
3622 case 104:
3623
3624 {
3625 (yyval.interm.type).setBasic(EbtVoid, EvqConst, (yyvsp[(1) - (1)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003626 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003627 break;
3628
3629 case 105:
3630
3631 {
3632 VERTEX_ONLY("attribute", (yyvsp[(1) - (1)].lex).line);
3633 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "attribute"))
3634 context->recover();
3635 (yyval.interm.type).setBasic(EbtVoid, EvqAttribute, (yyvsp[(1) - (1)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003636 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003637 break;
3638
3639 case 106:
3640
3641 {
3642 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "varying"))
3643 context->recover();
3644 if (context->shaderType == SH_VERTEX_SHADER)
3645 (yyval.interm.type).setBasic(EbtVoid, EvqVaryingOut, (yyvsp[(1) - (1)].lex).line);
3646 else
3647 (yyval.interm.type).setBasic(EbtVoid, EvqVaryingIn, (yyvsp[(1) - (1)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003648 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003649 break;
3650
3651 case 107:
3652
3653 {
3654 if (context->globalErrorCheck((yyvsp[(1) - (2)].lex).line, context->symbolTable.atGlobalLevel(), "invariant varying"))
3655 context->recover();
3656 if (context->shaderType == SH_VERTEX_SHADER)
3657 (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingOut, (yyvsp[(1) - (2)].lex).line);
3658 else
3659 (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingIn, (yyvsp[(1) - (2)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003660 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003661 break;
3662
3663 case 108:
3664
3665 {
3666 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "uniform"))
3667 context->recover();
3668 (yyval.interm.type).setBasic(EbtVoid, EvqUniform, (yyvsp[(1) - (1)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003669 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003670 break;
3671
3672 case 109:
3673
3674 {
3675 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
zmo@google.comdc4b4f82011-06-17 00:42:53 +00003676
3677 if ((yyval.interm.type).precision == EbpUndefined) {
3678 (yyval.interm.type).precision = context->symbolTable.getDefaultPrecision((yyvsp[(1) - (1)].interm.type).type);
3679 if (context->precisionErrorCheck((yyvsp[(1) - (1)].interm.type).line, (yyval.interm.type).precision, (yyvsp[(1) - (1)].interm.type).type)) {
3680 context->recover();
3681 }
3682 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003683 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003684 break;
3685
3686 case 110:
3687
3688 {
3689 (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
3690 (yyval.interm.type).precision = (yyvsp[(1) - (2)].interm.precision);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003691 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003692 break;
3693
3694 case 111:
3695
3696 {
3697 (yyval.interm.precision) = EbpHigh;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003698 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003699 break;
3700
3701 case 112:
3702
3703 {
3704 (yyval.interm.precision) = EbpMedium;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003705 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003706 break;
3707
3708 case 113:
3709
3710 {
3711 (yyval.interm.precision) = EbpLow;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003712 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003713 break;
3714
3715 case 114:
3716
3717 {
3718 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003719 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003720 break;
3721
3722 case 115:
3723
3724 {
3725 (yyval.interm.type) = (yyvsp[(1) - (4)].interm.type);
3726
3727 if (context->arrayTypeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
3728 context->recover();
3729 else {
3730 int size;
3731 if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
3732 context->recover();
3733 (yyval.interm.type).setArray(true, size);
3734 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003735 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003736 break;
3737
3738 case 116:
3739
3740 {
3741 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3742 (yyval.interm.type).setBasic(EbtVoid, qual, (yyvsp[(1) - (1)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003743 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003744 break;
3745
3746 case 117:
3747
3748 {
3749 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3750 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003751 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003752 break;
3753
3754 case 118:
3755
3756 {
3757 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3758 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003759 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003760 break;
3761
3762 case 119:
3763
3764 {
3765 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3766 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003767 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003768 break;
3769
3770 case 120:
3771
3772 {
3773 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3774 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3775 (yyval.interm.type).setAggregate(2);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003776 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003777 break;
3778
3779 case 121:
3780
3781 {
3782 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3783 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3784 (yyval.interm.type).setAggregate(3);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003785 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003786 break;
3787
3788 case 122:
3789
3790 {
3791 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3792 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3793 (yyval.interm.type).setAggregate(4);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003794 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003795 break;
3796
3797 case 123:
3798
3799 {
3800 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3801 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3802 (yyval.interm.type).setAggregate(2);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003803 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003804 break;
3805
3806 case 124:
3807
3808 {
3809 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3810 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3811 (yyval.interm.type).setAggregate(3);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003812 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003813 break;
3814
3815 case 125:
3816
3817 {
3818 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3819 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3820 (yyval.interm.type).setAggregate(4);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003821 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003822 break;
3823
3824 case 126:
3825
3826 {
3827 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3828 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3829 (yyval.interm.type).setAggregate(2);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003830 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003831 break;
3832
3833 case 127:
3834
3835 {
3836 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3837 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3838 (yyval.interm.type).setAggregate(3);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003839 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003840 break;
3841
3842 case 128:
3843
3844 {
3845 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3846 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3847 (yyval.interm.type).setAggregate(4);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003848 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003849 break;
3850
3851 case 129:
3852
3853 {
3854 FRAG_VERT_ONLY("mat2", (yyvsp[(1) - (1)].lex).line);
3855 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3856 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3857 (yyval.interm.type).setAggregate(2, true);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003858 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003859 break;
3860
3861 case 130:
3862
3863 {
3864 FRAG_VERT_ONLY("mat3", (yyvsp[(1) - (1)].lex).line);
3865 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3866 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3867 (yyval.interm.type).setAggregate(3, true);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003868 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003869 break;
3870
3871 case 131:
3872
3873 {
3874 FRAG_VERT_ONLY("mat4", (yyvsp[(1) - (1)].lex).line);
3875 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3876 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3877 (yyval.interm.type).setAggregate(4, true);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003878 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003879 break;
3880
3881 case 132:
3882
3883 {
3884 FRAG_VERT_ONLY("sampler2D", (yyvsp[(1) - (1)].lex).line);
3885 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3886 (yyval.interm.type).setBasic(EbtSampler2D, qual, (yyvsp[(1) - (1)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003887 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003888 break;
3889
3890 case 133:
3891
3892 {
3893 FRAG_VERT_ONLY("samplerCube", (yyvsp[(1) - (1)].lex).line);
3894 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3895 (yyval.interm.type).setBasic(EbtSamplerCube, qual, (yyvsp[(1) - (1)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003896 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003897 break;
3898
3899 case 134:
3900
3901 {
zmo@google.com09c323a2011-08-12 18:22:25 +00003902 if (!context->supportsExtension("GL_OES_EGL_image_external")) {
3903 context->error((yyvsp[(1) - (1)].lex).line, "unsupported type", "samplerExternalOES", "");
3904 context->recover();
3905 }
3906 FRAG_VERT_ONLY("samplerExternalOES", (yyvsp[(1) - (1)].lex).line);
3907 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3908 (yyval.interm.type).setBasic(EbtSamplerExternalOES, qual, (yyvsp[(1) - (1)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003909 ;}
zmo@google.com09c323a2011-08-12 18:22:25 +00003910 break;
3911
3912 case 135:
3913
3914 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00003915 if (!context->supportsExtension("GL_ARB_texture_rectangle")) {
3916 context->error((yyvsp[(1) - (1)].lex).line, "unsupported type", "sampler2DRect", "");
3917 context->recover();
3918 }
3919 FRAG_VERT_ONLY("sampler2DRect", (yyvsp[(1) - (1)].lex).line);
3920 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3921 (yyval.interm.type).setBasic(EbtSampler2DRect, qual, (yyvsp[(1) - (1)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003922 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003923 break;
3924
zmo@google.com09c323a2011-08-12 18:22:25 +00003925 case 136:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003926
3927 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00003928 FRAG_VERT_ONLY("struct", (yyvsp[(1) - (1)].interm.type).line);
3929 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3930 (yyval.interm.type).qualifier = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003931 ;}
kbr@chromium.org205fef32011-11-22 20:50:02 +00003932 break;
3933
3934 case 137:
3935
3936 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003937 //
3938 // This is for user defined type names. The lexical phase looked up the
3939 // type.
3940 //
3941 TType& structure = static_cast<TVariable*>((yyvsp[(1) - (1)].lex).symbol)->getType();
3942 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3943 (yyval.interm.type).setBasic(EbtStruct, qual, (yyvsp[(1) - (1)].lex).line);
3944 (yyval.interm.type).userDef = &structure;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003945 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003946 break;
3947
zmo@google.com09c323a2011-08-12 18:22:25 +00003948 case 138:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003949
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003950 { if (context->enterStructDeclaration((yyvsp[(2) - (3)].lex).line, *(yyvsp[(2) - (3)].lex).string)) context->recover(); ;}
kbr@chromium.org205fef32011-11-22 20:50:02 +00003951 break;
3952
3953 case 139:
3954
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003955 {
kbr@chromium.org476541f2011-10-27 21:14:51 +00003956 if (context->reservedErrorCheck((yyvsp[(2) - (6)].lex).line, *(yyvsp[(2) - (6)].lex).string))
3957 context->recover();
3958
3959 TType* structure = new TType((yyvsp[(5) - (6)].interm.typeList), *(yyvsp[(2) - (6)].lex).string);
3960 TVariable* userTypeDef = new TVariable((yyvsp[(2) - (6)].lex).string, *structure, true);
3961 if (! context->symbolTable.insert(*userTypeDef)) {
3962 context->error((yyvsp[(2) - (6)].lex).line, "redefinition", (yyvsp[(2) - (6)].lex).string->c_str(), "struct");
3963 context->recover();
3964 }
3965 (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (6)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003966 (yyval.interm.type).userDef = structure;
kbr@chromium.org476541f2011-10-27 21:14:51 +00003967 context->exitStructDeclaration();
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003968 ;}
kbr@chromium.org476541f2011-10-27 21:14:51 +00003969 break;
3970
3971 case 140:
3972
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003973 { if (context->enterStructDeclaration((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string)) context->recover(); ;}
kbr@chromium.org205fef32011-11-22 20:50:02 +00003974 break;
3975
3976 case 141:
3977
kbr@chromium.org476541f2011-10-27 21:14:51 +00003978 {
3979 TType* structure = new TType((yyvsp[(4) - (5)].interm.typeList), TString(""));
3980 (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (5)].lex).line);
3981 (yyval.interm.type).userDef = structure;
3982 context->exitStructDeclaration();
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003983 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003984 break;
3985
kbr@chromium.org476541f2011-10-27 21:14:51 +00003986 case 142:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003987
3988 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00003989 (yyval.interm.typeList) = (yyvsp[(1) - (1)].interm.typeList);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003990 ;}
kbr@chromium.org205fef32011-11-22 20:50:02 +00003991 break;
3992
3993 case 143:
3994
3995 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003996 (yyval.interm.typeList) = (yyvsp[(1) - (2)].interm.typeList);
3997 for (unsigned int i = 0; i < (yyvsp[(2) - (2)].interm.typeList)->size(); ++i) {
3998 for (unsigned int j = 0; j < (yyval.interm.typeList)->size(); ++j) {
3999 if ((*(yyval.interm.typeList))[j].type->getFieldName() == (*(yyvsp[(2) - (2)].interm.typeList))[i].type->getFieldName()) {
4000 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());
4001 context->recover();
4002 }
4003 }
4004 (yyval.interm.typeList)->push_back((*(yyvsp[(2) - (2)].interm.typeList))[i]);
4005 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004006 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004007 break;
4008
kbr@chromium.org205fef32011-11-22 20:50:02 +00004009 case 144:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004010
4011 {
4012 (yyval.interm.typeList) = (yyvsp[(2) - (3)].interm.typeList);
4013
4014 if (context->voidErrorCheck((yyvsp[(1) - (3)].interm.type).line, (*(yyvsp[(2) - (3)].interm.typeList))[0].type->getFieldName(), (yyvsp[(1) - (3)].interm.type))) {
4015 context->recover();
4016 }
4017 for (unsigned int i = 0; i < (yyval.interm.typeList)->size(); ++i) {
4018 //
4019 // Careful not to replace already known aspects of type, like array-ness
4020 //
4021 TType* type = (*(yyval.interm.typeList))[i].type;
4022 type->setBasicType((yyvsp[(1) - (3)].interm.type).type);
4023 type->setNominalSize((yyvsp[(1) - (3)].interm.type).size);
4024 type->setMatrix((yyvsp[(1) - (3)].interm.type).matrix);
zmo@google.comdc4b4f82011-06-17 00:42:53 +00004025 type->setPrecision((yyvsp[(1) - (3)].interm.type).precision);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004026
4027 // don't allow arrays of arrays
4028 if (type->isArray()) {
4029 if (context->arrayTypeErrorCheck((yyvsp[(1) - (3)].interm.type).line, (yyvsp[(1) - (3)].interm.type)))
4030 context->recover();
4031 }
4032 if ((yyvsp[(1) - (3)].interm.type).array)
4033 type->setArraySize((yyvsp[(1) - (3)].interm.type).arraySize);
4034 if ((yyvsp[(1) - (3)].interm.type).userDef) {
4035 type->setStruct((yyvsp[(1) - (3)].interm.type).userDef->getStruct());
4036 type->setTypeName((yyvsp[(1) - (3)].interm.type).userDef->getTypeName());
4037 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004038
4039 if (context->structNestingErrorCheck((yyvsp[(1) - (3)].interm.type).line, *type)) {
4040 context->recover();
4041 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004042 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004043 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004044 break;
4045
kbr@chromium.org476541f2011-10-27 21:14:51 +00004046 case 145:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004047
4048 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004049 (yyval.interm.typeList) = NewPoolTTypeList();
4050 (yyval.interm.typeList)->push_back((yyvsp[(1) - (1)].interm.typeLine));
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004051 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004052 break;
4053
kbr@chromium.org476541f2011-10-27 21:14:51 +00004054 case 146:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004055
4056 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004057 (yyval.interm.typeList)->push_back((yyvsp[(3) - (3)].interm.typeLine));
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004058 ;}
kbr@chromium.org205fef32011-11-22 20:50:02 +00004059 break;
4060
4061 case 147:
4062
4063 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004064 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
4065 context->recover();
4066
4067 (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
4068 (yyval.interm.typeLine).line = (yyvsp[(1) - (1)].lex).line;
4069 (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (1)].lex).string);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004070 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004071 break;
4072
kbr@chromium.org205fef32011-11-22 20:50:02 +00004073 case 148:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004074
4075 {
4076 if (context->reservedErrorCheck((yyvsp[(1) - (4)].lex).line, *(yyvsp[(1) - (4)].lex).string))
4077 context->recover();
4078
4079 (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
4080 (yyval.interm.typeLine).line = (yyvsp[(1) - (4)].lex).line;
4081 (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (4)].lex).string);
4082
4083 int size;
4084 if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
4085 context->recover();
4086 (yyval.interm.typeLine).type->setArraySize(size);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004087 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004088 break;
4089
4090 case 149:
4091
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004092 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004093 break;
4094
4095 case 150:
4096
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004097 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004098 break;
4099
4100 case 151:
4101
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004102 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermAggregate); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004103 break;
4104
4105 case 152:
4106
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004107 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004108 break;
4109
4110 case 153:
4111
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004112 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004113 break;
4114
4115 case 154:
4116
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004117 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004118 break;
4119
4120 case 155:
4121
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004122 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004123 break;
4124
4125 case 156:
4126
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004127 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004128 break;
4129
4130 case 157:
4131
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004132 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
zmo@google.com09c323a2011-08-12 18:22:25 +00004133 break;
4134
4135 case 158:
4136
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004137 { (yyval.interm.intermAggregate) = 0; ;}
kbr@chromium.org476541f2011-10-27 21:14:51 +00004138 break;
4139
4140 case 159:
4141
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004142 { context->symbolTable.push(); ;}
kbr@chromium.org476541f2011-10-27 21:14:51 +00004143 break;
4144
4145 case 160:
4146
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004147 { context->symbolTable.pop(); ;}
kbr@chromium.org205fef32011-11-22 20:50:02 +00004148 break;
4149
4150 case 161:
4151
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004152 {
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004153 if ((yyvsp[(3) - (5)].interm.intermAggregate) != 0) {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004154 (yyvsp[(3) - (5)].interm.intermAggregate)->setOp(EOpSequence);
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004155 (yyvsp[(3) - (5)].interm.intermAggregate)->setEndLine((yyvsp[(5) - (5)].lex).line);
4156 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004157 (yyval.interm.intermAggregate) = (yyvsp[(3) - (5)].interm.intermAggregate);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004158 ;}
kbr@chromium.org476541f2011-10-27 21:14:51 +00004159 break;
4160
4161 case 162:
4162
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004163 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
kbr@chromium.org476541f2011-10-27 21:14:51 +00004164 break;
4165
4166 case 163:
4167
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004168 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004169 break;
4170
kbr@chromium.org476541f2011-10-27 21:14:51 +00004171 case 164:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004172
4173 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004174 (yyval.interm.intermNode) = 0;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004175 ;}
kbr@chromium.org205fef32011-11-22 20:50:02 +00004176 break;
4177
4178 case 165:
4179
4180 {
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004181 if ((yyvsp[(2) - (3)].interm.intermAggregate)) {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004182 (yyvsp[(2) - (3)].interm.intermAggregate)->setOp(EOpSequence);
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004183 (yyvsp[(2) - (3)].interm.intermAggregate)->setEndLine((yyvsp[(3) - (3)].lex).line);
4184 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004185 (yyval.interm.intermNode) = (yyvsp[(2) - (3)].interm.intermAggregate);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004186 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004187 break;
4188
kbr@chromium.org476541f2011-10-27 21:14:51 +00004189 case 166:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004190
4191 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004192 (yyval.interm.intermAggregate) = context->intermediate.makeAggregate((yyvsp[(1) - (1)].interm.intermNode), 0);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004193 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004194 break;
4195
kbr@chromium.org476541f2011-10-27 21:14:51 +00004196 case 167:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004197
kbr@chromium.org205fef32011-11-22 20:50:02 +00004198 {
4199 (yyval.interm.intermAggregate) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermAggregate), (yyvsp[(2) - (2)].interm.intermNode), 0);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004200 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004201 break;
4202
kbr@chromium.org476541f2011-10-27 21:14:51 +00004203 case 168:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004204
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004205 { (yyval.interm.intermNode) = 0; ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004206 break;
4207
kbr@chromium.org476541f2011-10-27 21:14:51 +00004208 case 169:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004209
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004210 { (yyval.interm.intermNode) = static_cast<TIntermNode*>((yyvsp[(1) - (2)].interm.intermTypedNode)); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004211 break;
4212
kbr@chromium.org476541f2011-10-27 21:14:51 +00004213 case 170:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004214
4215 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004216 if (context->boolErrorCheck((yyvsp[(1) - (5)].lex).line, (yyvsp[(3) - (5)].interm.intermTypedNode)))
4217 context->recover();
4218 (yyval.interm.intermNode) = context->intermediate.addSelection((yyvsp[(3) - (5)].interm.intermTypedNode), (yyvsp[(5) - (5)].interm.nodePair), (yyvsp[(1) - (5)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004219 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004220 break;
4221
kbr@chromium.org476541f2011-10-27 21:14:51 +00004222 case 171:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004223
4224 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004225 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermNode);
4226 (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004227 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004228 break;
4229
kbr@chromium.org476541f2011-10-27 21:14:51 +00004230 case 172:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004231
4232 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004233 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (1)].interm.intermNode);
4234 (yyval.interm.nodePair).node2 = 0;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004235 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004236 break;
4237
kbr@chromium.org476541f2011-10-27 21:14:51 +00004238 case 173:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004239
4240 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004241 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
4242 if (context->boolErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)->getLine(), (yyvsp[(1) - (1)].interm.intermTypedNode)))
4243 context->recover();
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004244 ;}
kbr@chromium.org205fef32011-11-22 20:50:02 +00004245 break;
4246
4247 case 174:
4248
4249 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004250 TIntermNode* intermNode;
4251 if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
4252 context->recover();
4253 if (context->boolErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
4254 context->recover();
4255
4256 if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode))
4257 (yyval.interm.intermTypedNode) = (yyvsp[(4) - (4)].interm.intermTypedNode);
4258 else {
4259 context->recover();
4260 (yyval.interm.intermTypedNode) = 0;
4261 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004262 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004263 break;
4264
kbr@chromium.org476541f2011-10-27 21:14:51 +00004265 case 175:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004266
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004267 { context->symbolTable.push(); ++context->loopNestingLevel; ;}
kbr@chromium.org205fef32011-11-22 20:50:02 +00004268 break;
4269
4270 case 176:
4271
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004272 {
4273 context->symbolTable.pop();
alokp@chromium.org52813552010-11-16 18:36:09 +00004274 (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 +00004275 --context->loopNestingLevel;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004276 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004277 break;
4278
kbr@chromium.org476541f2011-10-27 21:14:51 +00004279 case 177:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004280
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004281 { ++context->loopNestingLevel; ;}
kbr@chromium.org205fef32011-11-22 20:50:02 +00004282 break;
4283
4284 case 178:
4285
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004286 {
4287 if (context->boolErrorCheck((yyvsp[(8) - (8)].lex).line, (yyvsp[(6) - (8)].interm.intermTypedNode)))
4288 context->recover();
4289
alokp@chromium.org52813552010-11-16 18:36:09 +00004290 (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 +00004291 --context->loopNestingLevel;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004292 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004293 break;
4294
kbr@chromium.org476541f2011-10-27 21:14:51 +00004295 case 179:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004296
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004297 { context->symbolTable.push(); ++context->loopNestingLevel; ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004298 break;
4299
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004300 case 180:
4301
4302 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004303 context->symbolTable.pop();
4304 (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);
4305 --context->loopNestingLevel;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004306 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004307 break;
4308
4309 case 181:
4310
4311 {
kbr@chromium.org476541f2011-10-27 21:14:51 +00004312 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004313 ;}
zmo@google.com09c323a2011-08-12 18:22:25 +00004314 break;
4315
4316 case 182:
4317
4318 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004319 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004320 ;}
kbr@chromium.org476541f2011-10-27 21:14:51 +00004321 break;
4322
4323 case 183:
4324
4325 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004326 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004327 ;}
kbr@chromium.org476541f2011-10-27 21:14:51 +00004328 break;
4329
4330 case 184:
4331
4332 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004333 (yyval.interm.intermTypedNode) = 0;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004334 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004335 break;
4336
kbr@chromium.org476541f2011-10-27 21:14:51 +00004337 case 185:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004338
4339 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004340 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (2)].interm.intermTypedNode);
4341 (yyval.interm.nodePair).node2 = 0;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004342 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004343 break;
4344
kbr@chromium.org476541f2011-10-27 21:14:51 +00004345 case 186:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004346
4347 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004348 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermTypedNode);
4349 (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermTypedNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004350 ;}
kbr@chromium.org205fef32011-11-22 20:50:02 +00004351 break;
4352
4353 case 187:
4354
4355 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004356 if (context->loopNestingLevel <= 0) {
4357 context->error((yyvsp[(1) - (2)].lex).line, "continue statement only allowed in loops", "", "");
4358 context->recover();
4359 }
4360 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpContinue, (yyvsp[(1) - (2)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004361 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004362 break;
4363
kbr@chromium.org205fef32011-11-22 20:50:02 +00004364 case 188:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004365
4366 {
4367 if (context->loopNestingLevel <= 0) {
4368 context->error((yyvsp[(1) - (2)].lex).line, "break statement only allowed in loops", "", "");
4369 context->recover();
4370 }
4371 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpBreak, (yyvsp[(1) - (2)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004372 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004373 break;
4374
kbr@chromium.org205fef32011-11-22 20:50:02 +00004375 case 189:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004376
4377 {
4378 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(1) - (2)].lex).line);
4379 if (context->currentFunctionType->getBasicType() != EbtVoid) {
4380 context->error((yyvsp[(1) - (2)].lex).line, "non-void function must return a value", "return", "");
4381 context->recover();
4382 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004383 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004384 break;
4385
kbr@chromium.org205fef32011-11-22 20:50:02 +00004386 case 190:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004387
4388 {
4389 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(2) - (3)].interm.intermTypedNode), (yyvsp[(1) - (3)].lex).line);
4390 context->functionReturnsValue = true;
4391 if (context->currentFunctionType->getBasicType() == EbtVoid) {
4392 context->error((yyvsp[(1) - (3)].lex).line, "void function cannot return a value", "return", "");
4393 context->recover();
4394 } else if (*(context->currentFunctionType) != (yyvsp[(2) - (3)].interm.intermTypedNode)->getType()) {
4395 context->error((yyvsp[(1) - (3)].lex).line, "function return is not matching type:", "return", "");
4396 context->recover();
4397 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004398 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004399 break;
4400
kbr@chromium.org476541f2011-10-27 21:14:51 +00004401 case 191:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004402
4403 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004404 FRAG_ONLY("discard", (yyvsp[(1) - (2)].lex).line);
4405 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpKill, (yyvsp[(1) - (2)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004406 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004407 break;
4408
kbr@chromium.org476541f2011-10-27 21:14:51 +00004409 case 192:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004410
4411 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004412 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
zmo@google.com09c323a2011-08-12 18:22:25 +00004413 context->treeRoot = (yyval.interm.intermNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004414 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004415 break;
4416
zmo@google.com09c323a2011-08-12 18:22:25 +00004417 case 193:
4418
4419 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004420 (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermNode), (yyvsp[(2) - (2)].interm.intermNode), 0);
4421 context->treeRoot = (yyval.interm.intermNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004422 ;}
kbr@chromium.org476541f2011-10-27 21:14:51 +00004423 break;
4424
4425 case 194:
4426
4427 {
4428 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004429 ;}
kbr@chromium.org476541f2011-10-27 21:14:51 +00004430 break;
4431
4432 case 195:
4433
4434 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004435 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004436 ;}
kbr@chromium.org205fef32011-11-22 20:50:02 +00004437 break;
4438
4439 case 196:
4440
4441 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004442 TFunction* function = (yyvsp[(1) - (1)].interm).function;
4443 TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find(function->getMangledName()));
4444 //
4445 // Note: 'prevDec' could be 'function' if this is the first time we've seen function
4446 // as it would have just been put in the symbol table. Otherwise, we're looking up
4447 // an earlier occurance.
4448 //
4449 if (prevDec->isDefined()) {
4450 //
4451 // Then this function already has a body.
4452 //
4453 context->error((yyvsp[(1) - (1)].interm).line, "function already has a body", function->getName().c_str(), "");
4454 context->recover();
4455 }
4456 prevDec->setDefined();
4457
4458 //
4459 // Raise error message if main function takes any parameters or return anything other than void
4460 //
4461 if (function->getName() == "main") {
4462 if (function->getParamCount() > 0) {
4463 context->error((yyvsp[(1) - (1)].interm).line, "function cannot take any parameter(s)", function->getName().c_str(), "");
4464 context->recover();
4465 }
4466 if (function->getReturnType().getBasicType() != EbtVoid) {
4467 context->error((yyvsp[(1) - (1)].interm).line, "", function->getReturnType().getBasicString(), "main function cannot return a value");
4468 context->recover();
4469 }
4470 }
4471
4472 //
4473 // New symbol table scope for body of function plus its arguments
4474 //
4475 context->symbolTable.push();
4476
4477 //
4478 // Remember the return type for later checking for RETURN statements.
4479 //
4480 context->currentFunctionType = &(prevDec->getReturnType());
4481 context->functionReturnsValue = false;
4482
4483 //
4484 // Insert parameters into the symbol table.
4485 // If the parameter has no name, it's not an error, just don't insert it
4486 // (could be used for unused args).
4487 //
4488 // Also, accumulate the list of parameters into the HIL, so lower level code
4489 // knows where to find parameters.
4490 //
4491 TIntermAggregate* paramNodes = new TIntermAggregate;
4492 for (int i = 0; i < function->getParamCount(); i++) {
4493 const TParameter& param = function->getParam(i);
4494 if (param.name != 0) {
4495 TVariable *variable = new TVariable(param.name, *param.type);
4496 //
4497 // Insert the parameters with name in the symbol table.
4498 //
4499 if (! context->symbolTable.insert(*variable)) {
4500 context->error((yyvsp[(1) - (1)].interm).line, "redefinition", variable->getName().c_str(), "");
4501 context->recover();
4502 delete variable;
4503 }
4504
4505 //
4506 // Add the parameter to the HIL
4507 //
4508 paramNodes = context->intermediate.growAggregate(
4509 paramNodes,
4510 context->intermediate.addSymbol(variable->getUniqueId(),
4511 variable->getName(),
4512 variable->getType(), (yyvsp[(1) - (1)].interm).line),
4513 (yyvsp[(1) - (1)].interm).line);
4514 } else {
4515 paramNodes = context->intermediate.growAggregate(paramNodes, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (1)].interm).line), (yyvsp[(1) - (1)].interm).line);
4516 }
4517 }
4518 context->intermediate.setAggregateOperator(paramNodes, EOpParameters, (yyvsp[(1) - (1)].interm).line);
4519 (yyvsp[(1) - (1)].interm).intermAggregate = paramNodes;
4520 context->loopNestingLevel = 0;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004521 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004522 break;
4523
kbr@chromium.org205fef32011-11-22 20:50:02 +00004524 case 197:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004525
4526 {
4527 //?? Check that all paths return a value if return type != void ?
4528 // May be best done as post process phase on intermediate code
4529 if (context->currentFunctionType->getBasicType() != EbtVoid && ! context->functionReturnsValue) {
4530 context->error((yyvsp[(1) - (3)].interm).line, "function does not return a value:", "", (yyvsp[(1) - (3)].interm).function->getName().c_str());
4531 context->recover();
4532 }
4533 context->symbolTable.pop();
4534 (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermAggregate, (yyvsp[(3) - (3)].interm.intermNode), 0);
4535 context->intermediate.setAggregateOperator((yyval.interm.intermNode), EOpFunction, (yyvsp[(1) - (3)].interm).line);
4536 (yyval.interm.intermNode)->getAsAggregate()->setName((yyvsp[(1) - (3)].interm).function->getMangledName().c_str());
4537 (yyval.interm.intermNode)->getAsAggregate()->setType((yyvsp[(1) - (3)].interm).function->getReturnType());
4538
4539 // store the pragma information for debug and optimize and other vendor specific
4540 // information. This information can be queried from the parse tree
4541 (yyval.interm.intermNode)->getAsAggregate()->setOptimize(context->contextPragma.optimize);
4542 (yyval.interm.intermNode)->getAsAggregate()->setDebug(context->contextPragma.debug);
4543 (yyval.interm.intermNode)->getAsAggregate()->addToPragmaTable(context->contextPragma.pragmaTable);
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004544
4545 if ((yyvsp[(3) - (3)].interm.intermNode) && (yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate())
4546 (yyval.interm.intermNode)->getAsAggregate()->setEndLine((yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate()->getEndLine());
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004547 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004548 break;
4549
4550
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004551/* Line 1267 of yacc.c. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004552
4553 default: break;
4554 }
4555 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
4556
4557 YYPOPSTACK (yylen);
4558 yylen = 0;
4559 YY_STACK_PRINT (yyss, yyssp);
4560
4561 *++yyvsp = yyval;
4562
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004563
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004564 /* Now `shift' the result of the reduction. Determine what state
4565 that goes to, based on the state we popped back to and the rule
4566 number reduced by. */
4567
4568 yyn = yyr1[yyn];
4569
4570 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
4571 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
4572 yystate = yytable[yystate];
4573 else
4574 yystate = yydefgoto[yyn - YYNTOKENS];
4575
4576 goto yynewstate;
4577
4578
4579/*------------------------------------.
4580| yyerrlab -- here on detecting error |
4581`------------------------------------*/
4582yyerrlab:
4583 /* If not already recovering from an error, report this error. */
4584 if (!yyerrstatus)
4585 {
4586 ++yynerrs;
4587#if ! YYERROR_VERBOSE
4588 yyerror (context, YY_("syntax error"));
4589#else
4590 {
4591 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
4592 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
4593 {
4594 YYSIZE_T yyalloc = 2 * yysize;
4595 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
4596 yyalloc = YYSTACK_ALLOC_MAXIMUM;
4597 if (yymsg != yymsgbuf)
4598 YYSTACK_FREE (yymsg);
4599 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
4600 if (yymsg)
4601 yymsg_alloc = yyalloc;
4602 else
4603 {
4604 yymsg = yymsgbuf;
4605 yymsg_alloc = sizeof yymsgbuf;
4606 }
4607 }
4608
4609 if (0 < yysize && yysize <= yymsg_alloc)
4610 {
4611 (void) yysyntax_error (yymsg, yystate, yychar);
4612 yyerror (context, yymsg);
4613 }
4614 else
4615 {
4616 yyerror (context, YY_("syntax error"));
4617 if (yysize != 0)
4618 goto yyexhaustedlab;
4619 }
4620 }
4621#endif
4622 }
4623
4624
4625
4626 if (yyerrstatus == 3)
4627 {
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004628 /* If just tried and failed to reuse look-ahead token after an
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004629 error, discard it. */
4630
4631 if (yychar <= YYEOF)
4632 {
4633 /* Return failure if at end of input. */
4634 if (yychar == YYEOF)
4635 YYABORT;
4636 }
4637 else
4638 {
4639 yydestruct ("Error: discarding",
4640 yytoken, &yylval, context);
4641 yychar = YYEMPTY;
4642 }
4643 }
4644
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004645 /* Else will try to reuse look-ahead token after shifting the error
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004646 token. */
4647 goto yyerrlab1;
4648
4649
4650/*---------------------------------------------------.
4651| yyerrorlab -- error raised explicitly by YYERROR. |
4652`---------------------------------------------------*/
4653yyerrorlab:
4654
4655 /* Pacify compilers like GCC when the user code never invokes
4656 YYERROR and the label yyerrorlab therefore never appears in user
4657 code. */
4658 if (/*CONSTCOND*/ 0)
4659 goto yyerrorlab;
4660
4661 /* Do not reclaim the symbols of the rule which action triggered
4662 this YYERROR. */
4663 YYPOPSTACK (yylen);
4664 yylen = 0;
4665 YY_STACK_PRINT (yyss, yyssp);
4666 yystate = *yyssp;
4667 goto yyerrlab1;
4668
4669
4670/*-------------------------------------------------------------.
4671| yyerrlab1 -- common code for both syntax error and YYERROR. |
4672`-------------------------------------------------------------*/
4673yyerrlab1:
4674 yyerrstatus = 3; /* Each real token shifted decrements this. */
4675
4676 for (;;)
4677 {
4678 yyn = yypact[yystate];
4679 if (yyn != YYPACT_NINF)
4680 {
4681 yyn += YYTERROR;
4682 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
4683 {
4684 yyn = yytable[yyn];
4685 if (0 < yyn)
4686 break;
4687 }
4688 }
4689
4690 /* Pop the current state because it cannot handle the error token. */
4691 if (yyssp == yyss)
4692 YYABORT;
4693
4694
4695 yydestruct ("Error: popping",
4696 yystos[yystate], yyvsp, context);
4697 YYPOPSTACK (1);
4698 yystate = *yyssp;
4699 YY_STACK_PRINT (yyss, yyssp);
4700 }
4701
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004702 if (yyn == YYFINAL)
4703 YYACCEPT;
4704
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004705 *++yyvsp = yylval;
4706
4707
4708 /* Shift the error token. */
4709 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
4710
4711 yystate = yyn;
4712 goto yynewstate;
4713
4714
4715/*-------------------------------------.
4716| yyacceptlab -- YYACCEPT comes here. |
4717`-------------------------------------*/
4718yyacceptlab:
4719 yyresult = 0;
4720 goto yyreturn;
4721
4722/*-----------------------------------.
4723| yyabortlab -- YYABORT comes here. |
4724`-----------------------------------*/
4725yyabortlab:
4726 yyresult = 1;
4727 goto yyreturn;
4728
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004729#ifndef yyoverflow
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004730/*-------------------------------------------------.
4731| yyexhaustedlab -- memory exhaustion comes here. |
4732`-------------------------------------------------*/
4733yyexhaustedlab:
4734 yyerror (context, YY_("memory exhausted"));
4735 yyresult = 2;
4736 /* Fall through. */
4737#endif
4738
4739yyreturn:
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004740 if (yychar != YYEOF && yychar != YYEMPTY)
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004741 yydestruct ("Cleanup: discarding lookahead",
4742 yytoken, &yylval, context);
4743 /* Do not reclaim the symbols of the rule which action triggered
4744 this YYABORT or YYACCEPT. */
4745 YYPOPSTACK (yylen);
4746 YY_STACK_PRINT (yyss, yyssp);
4747 while (yyssp != yyss)
4748 {
4749 yydestruct ("Cleanup: popping",
4750 yystos[*yyssp], yyvsp, context);
4751 YYPOPSTACK (1);
4752 }
4753#ifndef yyoverflow
4754 if (yyss != yyssa)
4755 YYSTACK_FREE (yyss);
4756#endif
4757#if YYERROR_VERBOSE
4758 if (yymsg != yymsgbuf)
4759 YYSTACK_FREE (yymsg);
4760#endif
4761 /* Make sure YYID is used. */
4762 return YYID (yyresult);
4763}
4764
4765
4766
4767
4768
4769int glslang_parse(TParseContext* context) {
4770 return yyparse(context);
4771}
4772
4773