blob: 9847bd78fb3e61dfd4afe5f1514d828ae6191b5b [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__)
apatrick@chromium.orga1d80592012-01-25 21:52:10 +0000275#pragma GCC diagnostic ignored "-Wunused-function"
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000276#pragma GCC diagnostic ignored "-Wunused-variable"
277#elif defined(_MSC_VER)
278#pragma warning(disable: 4065)
apatrick@chromium.orga1d80592012-01-25 21:52:10 +0000279#pragma warning(disable: 4189)
280#pragma warning(disable: 4505)
281#pragma warning(disable: 4701)
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000282#endif
283
284#include "compiler/SymbolTable.h"
285#include "compiler/ParseHelper.h"
286#include "GLSLANG/ShaderLang.h"
287
288#define YYLEX_PARAM context->scanner
289
290
291/* Enabling traces. */
292#ifndef YYDEBUG
293# define YYDEBUG 0
294#endif
295
296/* Enabling verbose error messages. */
297#ifdef YYERROR_VERBOSE
298# undef YYERROR_VERBOSE
299# define YYERROR_VERBOSE 1
300#else
301# define YYERROR_VERBOSE 0
302#endif
303
304/* Enabling the token table. */
305#ifndef YYTOKEN_TABLE
306# define YYTOKEN_TABLE 0
307#endif
308
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000309#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
310typedef union YYSTYPE
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000311
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000312{
313 struct {
314 TSourceLoc line;
315 union {
316 TString *string;
317 float f;
318 int i;
319 bool b;
320 };
321 TSymbol* symbol;
322 } lex;
323 struct {
324 TSourceLoc line;
325 TOperator op;
326 union {
327 TIntermNode* intermNode;
328 TIntermNodePair nodePair;
329 TIntermTyped* intermTypedNode;
330 TIntermAggregate* intermAggregate;
331 };
332 union {
333 TPublicType type;
334 TPrecision precision;
335 TQualifier qualifier;
336 TFunction* function;
337 TParameter param;
338 TTypeLine typeLine;
339 TTypeList* typeList;
340 };
341 } interm;
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000342}
343/* Line 187 of yacc.c. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000344
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000345 YYSTYPE;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000346# define yystype YYSTYPE /* obsolescent; will be withdrawn */
347# define YYSTYPE_IS_DECLARED 1
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000348# define YYSTYPE_IS_TRIVIAL 1
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000349#endif
350
351
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000352
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000353/* Copy the second part of user declarations. */
354
355
356extern int yylex(YYSTYPE* yylval_param, void* yyscanner);
357extern void yyerror(TParseContext* context, const char* reason);
358
359#define FRAG_VERT_ONLY(S, L) { \
360 if (context->shaderType != SH_FRAGMENT_SHADER && \
361 context->shaderType != SH_VERTEX_SHADER) { \
362 context->error(L, " supported in vertex/fragment shaders only ", S, "", ""); \
363 context->recover(); \
364 } \
365}
366
367#define VERTEX_ONLY(S, L) { \
368 if (context->shaderType != SH_VERTEX_SHADER) { \
369 context->error(L, " supported in vertex shaders only ", S, "", ""); \
370 context->recover(); \
371 } \
372}
373
374#define FRAG_ONLY(S, L) { \
375 if (context->shaderType != SH_FRAGMENT_SHADER) { \
376 context->error(L, " supported in fragment shaders only ", S, "", ""); \
377 context->recover(); \
378 } \
379}
380
381
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000382/* Line 216 of yacc.c. */
383
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000384
385#ifdef short
386# undef short
387#endif
388
389#ifdef YYTYPE_UINT8
390typedef YYTYPE_UINT8 yytype_uint8;
391#else
392typedef unsigned char yytype_uint8;
393#endif
394
395#ifdef YYTYPE_INT8
396typedef YYTYPE_INT8 yytype_int8;
397#elif (defined __STDC__ || defined __C99__FUNC__ \
398 || defined __cplusplus || defined _MSC_VER)
399typedef signed char yytype_int8;
400#else
401typedef short int yytype_int8;
402#endif
403
404#ifdef YYTYPE_UINT16
405typedef YYTYPE_UINT16 yytype_uint16;
406#else
407typedef unsigned short int yytype_uint16;
408#endif
409
410#ifdef YYTYPE_INT16
411typedef YYTYPE_INT16 yytype_int16;
412#else
413typedef short int yytype_int16;
414#endif
415
416#ifndef YYSIZE_T
417# ifdef __SIZE_TYPE__
418# define YYSIZE_T __SIZE_TYPE__
419# elif defined size_t
420# define YYSIZE_T size_t
421# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
422 || defined __cplusplus || defined _MSC_VER)
423# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
424# define YYSIZE_T size_t
425# else
426# define YYSIZE_T unsigned int
427# endif
428#endif
429
430#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
431
432#ifndef YY_
kbr@chromium.org205fef32011-11-22 20:50:02 +0000433# if YYENABLE_NLS
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000434# if ENABLE_NLS
435# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
436# define YY_(msgid) dgettext ("bison-runtime", msgid)
437# endif
438# endif
439# ifndef YY_
440# define YY_(msgid) msgid
441# endif
442#endif
443
444/* Suppress unused-variable warnings by "using" E. */
445#if ! defined lint || defined __GNUC__
446# define YYUSE(e) ((void) (e))
447#else
448# define YYUSE(e) /* empty */
449#endif
450
451/* Identity function, used to suppress warnings about constant conditions. */
452#ifndef lint
453# define YYID(n) (n)
454#else
455#if (defined __STDC__ || defined __C99__FUNC__ \
456 || defined __cplusplus || defined _MSC_VER)
457static int
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000458YYID (int i)
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000459#else
460static int
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000461YYID (i)
462 int i;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000463#endif
464{
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000465 return i;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000466}
467#endif
468
469#if ! defined yyoverflow || YYERROR_VERBOSE
470
471/* The parser invokes alloca or malloc; define the necessary symbols. */
472
473# ifdef YYSTACK_USE_ALLOCA
474# if YYSTACK_USE_ALLOCA
475# ifdef __GNUC__
476# define YYSTACK_ALLOC __builtin_alloca
477# elif defined __BUILTIN_VA_ARG_INCR
478# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
479# elif defined _AIX
480# define YYSTACK_ALLOC __alloca
481# elif defined _MSC_VER
482# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
483# define alloca _alloca
484# else
485# define YYSTACK_ALLOC alloca
486# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
487 || defined __cplusplus || defined _MSC_VER)
488# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
489# ifndef _STDLIB_H
490# define _STDLIB_H 1
491# endif
492# endif
493# endif
494# endif
495# endif
496
497# ifdef YYSTACK_ALLOC
498 /* Pacify GCC's `empty if-body' warning. */
499# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
500# ifndef YYSTACK_ALLOC_MAXIMUM
501 /* The OS might guarantee only one guard page at the bottom of the stack,
502 and a page size can be as small as 4096 bytes. So we cannot safely
503 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
504 to allow for a few compiler-allocated temporary stack slots. */
505# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
506# endif
507# else
508# define YYSTACK_ALLOC YYMALLOC
509# define YYSTACK_FREE YYFREE
510# ifndef YYSTACK_ALLOC_MAXIMUM
511# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
512# endif
513# if (defined __cplusplus && ! defined _STDLIB_H \
514 && ! ((defined YYMALLOC || defined malloc) \
515 && (defined YYFREE || defined free)))
516# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
517# ifndef _STDLIB_H
518# define _STDLIB_H 1
519# endif
520# endif
521# ifndef YYMALLOC
522# define YYMALLOC malloc
523# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
524 || defined __cplusplus || defined _MSC_VER)
525void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
526# endif
527# endif
528# ifndef YYFREE
529# define YYFREE free
530# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
531 || defined __cplusplus || defined _MSC_VER)
532void free (void *); /* INFRINGES ON USER NAME SPACE */
533# endif
534# endif
535# endif
536#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
537
538
539#if (! defined yyoverflow \
540 && (! defined __cplusplus \
541 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
542
543/* A type that is properly aligned for any stack member. */
544union yyalloc
545{
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000546 yytype_int16 yyss;
547 YYSTYPE yyvs;
548 };
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000549
550/* The size of the maximum gap between one aligned stack and the next. */
551# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
552
553/* The size of an array large to enough to hold all stacks, each with
554 N elements. */
555# define YYSTACK_BYTES(N) \
556 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
557 + YYSTACK_GAP_MAXIMUM)
558
559/* Copy COUNT objects from FROM to TO. The source and destination do
560 not overlap. */
561# ifndef YYCOPY
562# if defined __GNUC__ && 1 < __GNUC__
563# define YYCOPY(To, From, Count) \
564 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
565# else
566# define YYCOPY(To, From, Count) \
567 do \
568 { \
569 YYSIZE_T yyi; \
570 for (yyi = 0; yyi < (Count); yyi++) \
571 (To)[yyi] = (From)[yyi]; \
572 } \
573 while (YYID (0))
574# endif
575# endif
576
577/* Relocate STACK from its old location to the new one. The
578 local variables YYSIZE and YYSTACKSIZE give the old and new number of
579 elements in the stack, and YYPTR gives the new location of the
580 stack. Advance YYPTR to a properly aligned location for the next
581 stack. */
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000582# define YYSTACK_RELOCATE(Stack) \
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000583 do \
584 { \
585 YYSIZE_T yynewbytes; \
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000586 YYCOPY (&yyptr->Stack, Stack, yysize); \
587 Stack = &yyptr->Stack; \
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000588 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
589 yyptr += yynewbytes / sizeof (*yyptr); \
590 } \
591 while (YYID (0))
592
593#endif
594
595/* YYFINAL -- State number of the termination state. */
kbr@chromium.org205fef32011-11-22 20:50:02 +0000596#define YYFINAL 71
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000597/* YYLAST -- Last index in YYTABLE. */
kbr@chromium.org205fef32011-11-22 20:50:02 +0000598#define YYLAST 1370
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000599
600/* YYNTOKENS -- Number of terminals. */
kbr@chromium.org205fef32011-11-22 20:50:02 +0000601#define YYNTOKENS 96
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000602/* YYNNTS -- Number of nonterminals. */
kbr@chromium.org476541f2011-10-27 21:14:51 +0000603#define YYNNTS 80
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000604/* YYNRULES -- Number of rules. */
kbr@chromium.org205fef32011-11-22 20:50:02 +0000605#define YYNRULES 197
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000606/* YYNRULES -- Number of states. */
kbr@chromium.org205fef32011-11-22 20:50:02 +0000607#define YYNSTATES 300
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000608
609/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
610#define YYUNDEFTOK 2
kbr@chromium.org205fef32011-11-22 20:50:02 +0000611#define YYMAXUTOK 350
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000612
613#define YYTRANSLATE(YYX) \
614 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
615
616/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
617static const yytype_uint8 yytranslate[] =
618{
619 0, 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, 2, 2, 2, 2,
641 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
642 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
643 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
644 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
645 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
646 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
647 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
648 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
649 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
650 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
651 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
652 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000653 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
654 95
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000655};
656
657#if YYDEBUG
658/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
659 YYRHS. */
660static const yytype_uint16 yyprhs[] =
661{
662 0, 0, 3, 5, 7, 9, 11, 13, 17, 19,
663 24, 26, 30, 33, 36, 38, 40, 42, 46, 49,
664 52, 55, 57, 60, 64, 67, 69, 71, 73, 75,
665 78, 81, 84, 86, 88, 90, 92, 96, 100, 102,
666 106, 110, 112, 114, 118, 122, 126, 130, 132, 136,
667 140, 142, 144, 146, 148, 152, 154, 158, 160, 164,
668 166, 172, 174, 178, 180, 182, 184, 186, 188, 190,
669 194, 196, 199, 202, 207, 210, 212, 214, 217, 221,
670 225, 228, 234, 238, 241, 245, 248, 249, 251, 253,
671 255, 257, 259, 263, 269, 276, 282, 284, 287, 292,
672 298, 303, 306, 308, 311, 313, 315, 317, 320, 322,
673 324, 327, 329, 331, 333, 335, 340, 342, 344, 346,
674 348, 350, 352, 354, 356, 358, 360, 362, 364, 366,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000675 368, 370, 372, 374, 376, 378, 380, 382, 384, 385,
676 392, 393, 399, 401, 404, 408, 410, 414, 416, 421,
677 423, 425, 427, 429, 431, 433, 435, 437, 439, 442,
678 443, 444, 450, 452, 454, 457, 461, 463, 466, 468,
679 471, 477, 481, 483, 485, 490, 491, 498, 499, 508,
680 509, 517, 519, 521, 523, 524, 527, 531, 534, 537,
681 540, 544, 547, 549, 552, 554, 556, 557
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000682};
683
684/* YYRHS -- A `-1'-separated list of the rules' RHS. */
685static const yytype_int16 yyrhs[] =
686{
kbr@chromium.org205fef32011-11-22 20:50:02 +0000687 172, 0, -1, 45, -1, 97, -1, 48, -1, 47,
688 -1, 49, -1, 72, 124, 73, -1, 98, -1, 99,
689 74, 100, 75, -1, 101, -1, 99, 78, 50, -1,
690 99, 53, -1, 99, 54, -1, 124, -1, 102, -1,
691 103, -1, 99, 78, 103, -1, 105, 73, -1, 104,
692 73, -1, 106, 39, -1, 106, -1, 106, 122, -1,
693 105, 79, 122, -1, 107, 72, -1, 142, -1, 45,
694 -1, 50, -1, 99, -1, 53, 108, -1, 54, 108,
695 -1, 109, 108, -1, 86, -1, 84, -1, 83, -1,
696 108, -1, 110, 87, 108, -1, 110, 88, 108, -1,
697 110, -1, 111, 86, 110, -1, 111, 84, 110, -1,
698 111, -1, 112, -1, 113, 90, 112, -1, 113, 91,
699 112, -1, 113, 55, 112, -1, 113, 56, 112, -1,
700 113, -1, 114, 57, 113, -1, 114, 58, 113, -1,
701 114, -1, 115, -1, 116, -1, 117, -1, 118, 59,
702 117, -1, 118, -1, 119, 61, 118, -1, 119, -1,
703 120, 60, 119, -1, 120, -1, 120, 95, 124, 80,
704 122, -1, 121, -1, 108, 123, 122, -1, 81, -1,
705 62, -1, 63, -1, 64, -1, 71, -1, 122, -1,
706 124, 79, 122, -1, 121, -1, 127, 82, -1, 135,
707 82, -1, 7, 140, 141, 82, -1, 128, 73, -1,
708 130, -1, 129, -1, 130, 132, -1, 129, 79, 132,
709 -1, 137, 45, 72, -1, 139, 45, -1, 139, 45,
710 74, 125, 75, -1, 138, 133, 131, -1, 133, 131,
711 -1, 138, 133, 134, -1, 133, 134, -1, -1, 33,
712 -1, 34, -1, 35, -1, 139, -1, 136, -1, 135,
713 79, 45, -1, 135, 79, 45, 74, 75, -1, 135,
714 79, 45, 74, 125, 75, -1, 135, 79, 45, 81,
715 150, -1, 137, -1, 137, 45, -1, 137, 45, 74,
716 75, -1, 137, 45, 74, 125, 75, -1, 137, 45,
717 81, 150, -1, 3, 45, -1, 139, -1, 138, 139,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000718 -1, 9, -1, 8, -1, 37, -1, 3, 37, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000719 36, -1, 141, -1, 140, 141, -1, 4, -1, 5,
720 -1, 6, -1, 142, -1, 142, 74, 125, 75, -1,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000721 39, -1, 11, -1, 12, -1, 10, -1, 27, -1,
722 28, -1, 29, -1, 21, -1, 22, -1, 23, -1,
723 24, -1, 25, -1, 26, -1, 30, -1, 31, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000724 32, -1, 41, -1, 42, -1, 43, -1, 44, -1,
725 143, -1, 46, -1, -1, 38, 45, 76, 144, 146,
726 77, -1, -1, 38, 76, 145, 146, 77, -1, 147,
727 -1, 146, 147, -1, 139, 148, 82, -1, 149, -1,
728 148, 79, 149, -1, 45, -1, 45, 74, 125, 75,
729 -1, 122, -1, 126, -1, 154, -1, 153, -1, 151,
730 -1, 160, -1, 161, -1, 164, -1, 171, -1, 76,
731 77, -1, -1, -1, 76, 155, 159, 156, 77, -1,
732 158, -1, 153, -1, 76, 77, -1, 76, 159, 77,
733 -1, 152, -1, 159, 152, -1, 82, -1, 124, 82,
734 -1, 18, 72, 124, 73, 162, -1, 152, 16, 152,
735 -1, 152, -1, 124, -1, 137, 45, 81, 150, -1,
736 -1, 40, 72, 165, 163, 73, 157, -1, -1, 15,
737 166, 152, 40, 72, 124, 73, 82, -1, -1, 17,
738 72, 167, 168, 170, 73, 157, -1, 160, -1, 151,
739 -1, 163, -1, -1, 169, 82, -1, 169, 82, 124,
740 -1, 14, 82, -1, 13, 82, -1, 20, 82, -1,
741 20, 124, 82, -1, 19, 82, -1, 173, -1, 172,
742 173, -1, 174, -1, 126, -1, -1, 127, 175, 158,
743 -1
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000744};
745
746/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
747static const yytype_uint16 yyrline[] =
748{
apatrick@chromium.orga1d80592012-01-25 21:52:10 +0000749 0, 164, 164, 199, 202, 215, 220, 225, 231, 234,
750 307, 310, 419, 429, 442, 450, 549, 552, 560, 564,
751 571, 575, 582, 588, 597, 605, 660, 667, 677, 680,
752 690, 700, 721, 722, 723, 728, 729, 738, 750, 751,
753 759, 770, 774, 775, 785, 795, 805, 818, 819, 829,
754 842, 846, 850, 854, 855, 868, 869, 882, 883, 896,
755 897, 914, 915, 928, 929, 930, 931, 932, 936, 939,
756 950, 958, 983, 988, 995, 1031, 1034, 1041, 1049, 1070,
757 1089, 1100, 1129, 1134, 1144, 1149, 1159, 1162, 1165, 1168,
758 1174, 1181, 1184, 1200, 1218, 1242, 1265, 1269, 1287, 1295,
759 1327, 1347, 1423, 1432, 1455, 1458, 1464, 1472, 1480, 1488,
760 1498, 1505, 1508, 1511, 1517, 1520, 1535, 1539, 1543, 1547,
761 1556, 1561, 1566, 1571, 1576, 1581, 1586, 1591, 1596, 1601,
762 1607, 1613, 1619, 1624, 1629, 1638, 1647, 1652, 1665, 1665,
763 1679, 1679, 1688, 1691, 1706, 1742, 1746, 1752, 1760, 1776,
764 1780, 1784, 1785, 1791, 1792, 1793, 1794, 1795, 1799, 1800,
765 1800, 1800, 1810, 1811, 1816, 1819, 1829, 1832, 1838, 1839,
766 1843, 1851, 1855, 1865, 1870, 1887, 1887, 1892, 1892, 1899,
767 1899, 1907, 1910, 1916, 1919, 1925, 1929, 1936, 1943, 1950,
768 1957, 1968, 1977, 1981, 1988, 1991, 1997, 1997
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000769};
770#endif
771
772#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
773/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
774 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
775static const char *const yytname[] =
776{
777 "$end", "error", "$undefined", "INVARIANT", "HIGH_PRECISION",
778 "MEDIUM_PRECISION", "LOW_PRECISION", "PRECISION", "ATTRIBUTE",
779 "CONST_QUAL", "BOOL_TYPE", "FLOAT_TYPE", "INT_TYPE", "BREAK", "CONTINUE",
780 "DO", "ELSE", "FOR", "IF", "DISCARD", "RETURN", "BVEC2", "BVEC3",
781 "BVEC4", "IVEC2", "IVEC3", "IVEC4", "VEC2", "VEC3", "VEC4", "MATRIX2",
782 "MATRIX3", "MATRIX4", "IN_QUAL", "OUT_QUAL", "INOUT_QUAL", "UNIFORM",
783 "VARYING", "STRUCT", "VOID_TYPE", "WHILE", "SAMPLER2D", "SAMPLERCUBE",
kbr@chromium.org205fef32011-11-22 20:50:02 +0000784 "SAMPLER_EXTERNAL_OES", "SAMPLER2DRECT", "IDENTIFIER", "TYPE_NAME",
785 "FLOATCONSTANT", "INTCONSTANT", "BOOLCONSTANT", "FIELD_SELECTION",
786 "LEFT_OP", "RIGHT_OP", "INC_OP", "DEC_OP", "LE_OP", "GE_OP", "EQ_OP",
787 "NE_OP", "AND_OP", "OR_OP", "XOR_OP", "MUL_ASSIGN", "DIV_ASSIGN",
788 "ADD_ASSIGN", "MOD_ASSIGN", "LEFT_ASSIGN", "RIGHT_ASSIGN", "AND_ASSIGN",
789 "XOR_ASSIGN", "OR_ASSIGN", "SUB_ASSIGN", "LEFT_PAREN", "RIGHT_PAREN",
790 "LEFT_BRACKET", "RIGHT_BRACKET", "LEFT_BRACE", "RIGHT_BRACE", "DOT",
791 "COMMA", "COLON", "EQUAL", "SEMICOLON", "BANG", "DASH", "TILDE", "PLUS",
792 "STAR", "SLASH", "PERCENT", "LEFT_ANGLE", "RIGHT_ANGLE", "VERTICAL_BAR",
793 "CARET", "AMPERSAND", "QUESTION", "$accept", "variable_identifier",
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000794 "primary_expression", "postfix_expression", "integer_expression",
795 "function_call", "function_call_or_method", "function_call_generic",
796 "function_call_header_no_parameters",
797 "function_call_header_with_parameters", "function_call_header",
798 "function_identifier", "unary_expression", "unary_operator",
799 "multiplicative_expression", "additive_expression", "shift_expression",
800 "relational_expression", "equality_expression", "and_expression",
801 "exclusive_or_expression", "inclusive_or_expression",
802 "logical_and_expression", "logical_xor_expression",
803 "logical_or_expression", "conditional_expression",
804 "assignment_expression", "assignment_operator", "expression",
805 "constant_expression", "declaration", "function_prototype",
806 "function_declarator", "function_header_with_parameters",
807 "function_header", "parameter_declarator", "parameter_declaration",
808 "parameter_qualifier", "parameter_type_specifier",
809 "init_declarator_list", "single_declaration", "fully_specified_type",
810 "type_qualifier", "type_specifier", "precision_qualifier",
811 "type_specifier_no_prec", "type_specifier_nonarray", "struct_specifier",
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000812 "@1", "@2", "struct_declaration_list", "struct_declaration",
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000813 "struct_declarator_list", "struct_declarator", "initializer",
814 "declaration_statement", "statement", "simple_statement",
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000815 "compound_statement", "@3", "@4", "statement_no_new_scope",
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000816 "compound_statement_no_new_scope", "statement_list",
817 "expression_statement", "selection_statement",
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000818 "selection_rest_statement", "condition", "iteration_statement", "@5",
819 "@6", "@7", "for_init_statement", "conditionopt", "for_rest_statement",
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000820 "jump_statement", "translation_unit", "external_declaration",
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000821 "function_definition", "@8", 0
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000822};
823#endif
824
825# ifdef YYPRINT
826/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
827 token YYLEX-NUM. */
828static const yytype_uint16 yytoknum[] =
829{
830 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
831 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
832 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
833 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
834 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
835 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
836 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
837 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
838 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000839 345, 346, 347, 348, 349, 350
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000840};
841# endif
842
843/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
844static const yytype_uint8 yyr1[] =
845{
kbr@chromium.org205fef32011-11-22 20:50:02 +0000846 0, 96, 97, 98, 98, 98, 98, 98, 99, 99,
847 99, 99, 99, 99, 100, 101, 102, 102, 103, 103,
848 104, 104, 105, 105, 106, 107, 107, 107, 108, 108,
849 108, 108, 109, 109, 109, 110, 110, 110, 111, 111,
850 111, 112, 113, 113, 113, 113, 113, 114, 114, 114,
851 115, 116, 117, 118, 118, 119, 119, 120, 120, 121,
852 121, 122, 122, 123, 123, 123, 123, 123, 124, 124,
853 125, 126, 126, 126, 127, 128, 128, 129, 129, 130,
854 131, 131, 132, 132, 132, 132, 133, 133, 133, 133,
855 134, 135, 135, 135, 135, 135, 136, 136, 136, 136,
856 136, 136, 137, 137, 138, 138, 138, 138, 138, 139,
857 139, 140, 140, 140, 141, 141, 142, 142, 142, 142,
858 142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
859 142, 142, 142, 142, 142, 142, 142, 142, 144, 143,
860 145, 143, 146, 146, 147, 148, 148, 149, 149, 150,
861 151, 152, 152, 153, 153, 153, 153, 153, 154, 155,
862 156, 154, 157, 157, 158, 158, 159, 159, 160, 160,
863 161, 162, 162, 163, 163, 165, 164, 166, 164, 167,
864 164, 168, 168, 169, 169, 170, 170, 171, 171, 171,
865 171, 171, 172, 172, 173, 173, 175, 174
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000866};
867
868/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
869static const yytype_uint8 yyr2[] =
870{
871 0, 2, 1, 1, 1, 1, 1, 3, 1, 4,
872 1, 3, 2, 2, 1, 1, 1, 3, 2, 2,
873 2, 1, 2, 3, 2, 1, 1, 1, 1, 2,
874 2, 2, 1, 1, 1, 1, 3, 3, 1, 3,
875 3, 1, 1, 3, 3, 3, 3, 1, 3, 3,
876 1, 1, 1, 1, 3, 1, 3, 1, 3, 1,
877 5, 1, 3, 1, 1, 1, 1, 1, 1, 3,
878 1, 2, 2, 4, 2, 1, 1, 2, 3, 3,
879 2, 5, 3, 2, 3, 2, 0, 1, 1, 1,
880 1, 1, 3, 5, 6, 5, 1, 2, 4, 5,
881 4, 2, 1, 2, 1, 1, 1, 2, 1, 1,
882 2, 1, 1, 1, 1, 4, 1, 1, 1, 1,
883 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000884 1, 1, 1, 1, 1, 1, 1, 1, 0, 6,
885 0, 5, 1, 2, 3, 1, 3, 1, 4, 1,
886 1, 1, 1, 1, 1, 1, 1, 1, 2, 0,
887 0, 5, 1, 1, 2, 3, 1, 2, 1, 2,
888 5, 3, 1, 1, 4, 0, 6, 0, 8, 0,
889 7, 1, 1, 1, 0, 2, 3, 2, 2, 2,
890 3, 2, 1, 2, 1, 1, 0, 3
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000891};
892
893/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
894 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
895 means the default is an error. */
896static const yytype_uint8 yydefact[] =
897{
898 0, 0, 111, 112, 113, 0, 105, 104, 119, 117,
899 118, 123, 124, 125, 126, 127, 128, 120, 121, 122,
zmo@google.com09c323a2011-08-12 18:22:25 +0000900 129, 130, 131, 108, 106, 0, 116, 132, 133, 134,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000901 135, 137, 195, 196, 0, 76, 86, 0, 91, 96,
902 0, 102, 0, 109, 114, 136, 0, 192, 194, 107,
903 101, 0, 0, 140, 71, 0, 74, 86, 0, 87,
904 88, 89, 77, 0, 86, 0, 72, 97, 103, 110,
905 0, 1, 193, 0, 138, 0, 0, 197, 78, 83,
906 85, 90, 0, 92, 79, 0, 0, 2, 5, 4,
907 6, 27, 0, 0, 0, 34, 33, 32, 3, 8,
908 28, 10, 15, 16, 0, 0, 21, 0, 35, 0,
909 38, 41, 42, 47, 50, 51, 52, 53, 55, 57,
910 59, 70, 0, 25, 73, 0, 0, 0, 142, 0,
911 0, 177, 0, 0, 0, 0, 0, 159, 164, 168,
912 35, 61, 68, 0, 150, 0, 114, 153, 166, 152,
913 151, 0, 154, 155, 156, 157, 80, 82, 84, 0,
914 0, 98, 0, 149, 100, 29, 30, 0, 12, 13,
915 0, 0, 19, 18, 0, 20, 22, 24, 31, 0,
kbr@chromium.org476541f2011-10-27 21:14:51 +0000916 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000917 0, 0, 0, 115, 0, 147, 0, 145, 141, 143,
918 188, 187, 0, 179, 0, 191, 189, 0, 175, 158,
919 0, 64, 65, 66, 67, 63, 0, 0, 169, 165,
920 167, 0, 93, 0, 95, 99, 7, 0, 14, 26,
921 11, 17, 23, 36, 37, 40, 39, 45, 46, 43,
922 44, 48, 49, 54, 56, 58, 0, 139, 0, 0,
923 144, 0, 0, 0, 190, 0, 160, 62, 69, 0,
924 94, 9, 0, 0, 146, 0, 182, 181, 184, 0,
925 173, 0, 0, 0, 81, 60, 148, 0, 183, 0,
926 0, 172, 170, 0, 0, 161, 0, 185, 0, 0,
927 0, 163, 176, 162, 0, 186, 180, 171, 174, 178
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000928};
929
930/* YYDEFGOTO[NTERM-NUM]. */
931static const yytype_int16 yydefgoto[] =
932{
kbr@chromium.org205fef32011-11-22 20:50:02 +0000933 -1, 98, 99, 100, 227, 101, 102, 103, 104, 105,
934 106, 107, 140, 109, 110, 111, 112, 113, 114, 115,
935 116, 117, 118, 119, 120, 141, 142, 216, 143, 122,
936 144, 145, 34, 35, 36, 79, 62, 63, 80, 37,
937 38, 39, 40, 41, 42, 43, 123, 45, 125, 75,
938 127, 128, 196, 197, 164, 147, 148, 149, 150, 210,
939 273, 292, 293, 151, 152, 153, 282, 272, 154, 255,
940 202, 252, 268, 279, 280, 155, 46, 47, 48, 55
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000941};
942
943/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
944 STATE-NUM. */
kbr@chromium.org205fef32011-11-22 20:50:02 +0000945#define YYPACT_NINF -251
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000946static const yytype_int16 yypact[] =
947{
kbr@chromium.org205fef32011-11-22 20:50:02 +0000948 1250, -17, -251, -251, -251, 113, -251, -251, -251, -251,
949 -251, -251, -251, -251, -251, -251, -251, -251, -251, -251,
950 -251, -251, -251, -251, -251, -39, -251, -251, -251, -251,
951 -251, -251, -251, -65, -34, -10, 21, -32, -251, 28,
952 207, -251, 1324, -251, 56, -251, 1206, -251, -251, -251,
953 -251, 1324, 74, -251, -251, 86, -251, 71, 95, -251,
954 -251, -251, -251, 207, 119, 120, -251, -56, -251, -251,
955 971, -251, -251, 84, -251, 207, 287, -251, -251, -251,
956 -251, 124, 207, -59, -251, 773, 971, 98, -251, -251,
957 -251, -251, 971, 971, 971, -251, -251, -251, -251, -251,
958 35, -251, -251, -251, 100, -9, 1037, 102, -251, 971,
959 -27, -1, -251, -24, 99, -251, -251, -251, 112, 111,
960 -51, -251, 103, -251, -251, 207, 135, 1106, -251, 101,
961 104, -251, 109, 115, 106, 839, 117, 107, -251, -251,
962 39, -251, -251, -11, -251, -65, 54, -251, -251, -251,
963 -251, 371, -251, -251, -251, -251, 116, -251, -251, 905,
964 971, -251, 118, -251, -251, -251, -251, 8, -251, -251,
965 971, 1287, -251, -251, 971, 125, -251, -251, -251, 971,
966 971, 971, 971, 971, 971, 971, 971, 971, 971, 971,
967 971, 971, 971, -251, 1149, 122, 17, -251, -251, -251,
968 -251, -251, 455, -251, 971, -251, -251, 32, -251, -251,
969 455, -251, -251, -251, -251, -251, 971, 971, -251, -251,
970 -251, 971, -251, 123, -251, -251, -251, 126, 121, -251,
971 127, -251, -251, -251, -251, -27, -27, -251, -251, -251,
972 -251, -24, -24, -251, 112, 111, 79, -251, 971, 135,
973 -251, 151, 623, 11, -251, 707, 455, -251, -251, 128,
974 -251, -251, 971, 130, -251, 134, -251, -251, 707, 455,
975 121, 147, 136, 131, -251, -251, -251, 971, -251, 132,
976 142, 200, -251, 139, 539, -251, 19, 971, 539, 455,
977 971, -251, -251, -251, 140, 121, -251, -251, -251, -251
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000978};
979
980/* YYPGOTO[NTERM-NUM]. */
981static const yytype_int16 yypgoto[] =
982{
kbr@chromium.org205fef32011-11-22 20:50:02 +0000983 -251, -251, -251, -251, -251, -251, -251, 50, -251, -251,
984 -251, -251, -44, -251, -21, -251, -62, -20, -251, -251,
985 -251, 34, 36, 33, -251, -66, -83, -251, -92, -73,
986 7, 13, -251, -251, -251, 143, 170, 176, 159, -251,
987 -251, -247, -22, -30, 237, -15, 0, -251, -251, -251,
988 129, -122, -251, -6, -159, -8, -140, -250, -251, -251,
989 -251, -41, 202, 48, 9, -251, -251, -5, -251, -251,
990 -251, -251, -251, -251, -251, -251, -251, 213, -251, -251
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000991};
992
993/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
994 positive, shift that token. If negative, reduce the rule which
995 number is the opposite. If zero, do what YYDEFACT says.
996 If YYTABLE_NINF, syntax error. */
zmo@google.comdc4b4f82011-06-17 00:42:53 +0000997#define YYTABLE_NINF -117
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000998static const yytype_int16 yytable[] =
999{
kbr@chromium.org205fef32011-11-22 20:50:02 +00001000 44, 224, 167, 163, 121, 199, 52, 32, 271, 191,
1001 68, 220, 162, 33, 64, 159, 84, 54, 85, 121,
1002 49, 271, 160, 176, 58, 86, 108, 69, 50, 6,
1003 7, 183, 184, 81, 291, 64, 73, 53, 291, 56,
1004 44, 108, 44, 207, 192, 126, 44, 65, 165, 166,
1005 66, 44, 81, 32, 59, 60, 61, 23, 24, 33,
1006 179, 180, 251, 44, 173, 178, 185, 186, 217, 57,
1007 174, 218, 199, 67, 58, 44, 146, 163, 228, 6,
1008 7, 226, 44, 181, 269, 182, 223, 217, 168, 169,
1009 217, 232, 294, 121, -75, 126, 249, 126, 217, 250,
1010 246, 211, 212, 213, 59, 60, 61, 23, 24, 170,
1011 214, 217, 253, 171, 254, 108, 220, 2, 3, 4,
1012 215, 237, 238, 239, 240, 44, -25, 44, 70, 281,
1013 70, 298, 49, 257, 258, 233, 234, 108, 108, 108,
1014 108, 108, 108, 108, 108, 108, 108, 108, 259, 297,
1015 74, 146, 59, 60, 61, 121, 187, 188, 217, 262,
1016 235, 236, 76, 270, 126, 83, 124, 241, 242, 156,
1017 -26, 189, 190, 172, 177, 263, 270, 108, 193, 275,
1018 195, 203, 121, 200, 209, 286, 201, 204, 205, 208,
1019 221, 265, 283, 225, 44, 295, 248, -116, 260, -27,
1020 217, 261, 146, 274, 108, 276, 277, 163, 285, 284,
1021 146, 2, 3, 4, 287, 288, 289, 8, 9, 10,
1022 290, 231, 299, 243, 245, 157, 244, 78, 11, 12,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001023 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001024 82, 158, 51, 264, 266, 25, 26, 296, 27, 28,
1025 29, 30, 146, 31, 194, 146, 146, 77, 256, 72,
1026 0, 267, 0, 278, 0, 0, 0, 0, 146, 146,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001027 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001028 0, 0, 0, 0, 146, 0, 0, 0, 146, 146,
1029 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
1030 129, 130, 131, 0, 132, 133, 134, 135, 11, 12,
1031 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
1032 0, 0, 0, 23, 24, 25, 26, 136, 27, 28,
1033 29, 30, 87, 31, 88, 89, 90, 91, 0, 0,
1034 92, 93, 0, 0, 0, 0, 0, 0, 0, 0,
1035 0, 0, 0, 0, 0, 0, 0, 0, 0, 94,
1036 0, 0, 0, 137, 138, 0, 0, 0, 0, 139,
1037 95, 96, 0, 97, 1, 2, 3, 4, 5, 6,
1038 7, 8, 9, 10, 129, 130, 131, 0, 132, 133,
1039 134, 135, 11, 12, 13, 14, 15, 16, 17, 18,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001040 19, 20, 21, 22, 0, 0, 0, 23, 24, 25,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001041 26, 136, 27, 28, 29, 30, 87, 31, 88, 89,
1042 90, 91, 0, 0, 92, 93, 0, 0, 0, 0,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001043 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001044 0, 0, 0, 94, 0, 0, 0, 137, 219, 0,
1045 0, 0, 0, 139, 95, 96, 0, 97, 1, 2,
1046 3, 4, 5, 6, 7, 8, 9, 10, 129, 130,
1047 131, 0, 132, 133, 134, 135, 11, 12, 13, 14,
1048 15, 16, 17, 18, 19, 20, 21, 22, 0, 0,
1049 0, 23, 24, 25, 26, 136, 27, 28, 29, 30,
1050 87, 31, 88, 89, 90, 91, 0, 0, 92, 93,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001051 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001052 0, 0, 0, 0, 0, 0, 0, 94, 0, 0,
1053 0, 137, 0, 0, 0, 0, 0, 139, 95, 96,
1054 0, 97, 1, 2, 3, 4, 5, 6, 7, 8,
1055 9, 10, 129, 130, 131, 0, 132, 133, 134, 135,
1056 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
1057 21, 22, 0, 0, 0, 23, 24, 25, 26, 136,
1058 27, 28, 29, 30, 87, 31, 88, 89, 90, 91,
1059 0, 0, 92, 93, 0, 0, 0, 0, 0, 0,
1060 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1061 0, 94, 0, 0, 0, 76, 0, 0, 0, 0,
1062 0, 139, 95, 96, 0, 97, 1, 2, 3, 4,
1063 5, 6, 7, 8, 9, 10, 0, 0, 0, 0,
1064 0, 0, 0, 0, 11, 12, 13, 14, 15, 16,
1065 17, 18, 19, 20, 21, 22, 0, 0, 0, 23,
1066 24, 25, 26, 0, 27, 28, 29, 30, 87, 31,
1067 88, 89, 90, 91, 0, 0, 92, 93, 0, 0,
1068 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1069 0, 0, 0, 0, 0, 94, 0, 0, 0, 0,
1070 0, 0, 0, 0, 0, 139, 95, 96, 0, 97,
1071 58, 2, 3, 4, 0, 6, 7, 8, 9, 10,
1072 0, 0, 0, 0, 0, 0, 0, 0, 11, 12,
1073 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
1074 0, 0, 0, 23, 24, 25, 26, 0, 27, 28,
1075 29, 30, 87, 31, 88, 89, 90, 91, 0, 0,
1076 92, 93, 0, 0, 0, 0, 0, 0, 0, 0,
1077 0, 0, 0, 0, 0, 0, 0, 0, 0, 94,
1078 0, 0, 0, 8, 9, 10, 0, 0, 0, 0,
1079 95, 96, 0, 97, 11, 12, 13, 14, 15, 16,
1080 17, 18, 19, 20, 21, 22, 0, 0, 0, 0,
1081 0, 25, 26, 0, 27, 28, 29, 30, 87, 31,
1082 88, 89, 90, 91, 0, 0, 92, 93, 0, 0,
1083 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1084 0, 0, 0, 0, 0, 94, 0, 0, 161, 8,
1085 9, 10, 0, 0, 0, 0, 95, 96, 0, 97,
1086 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
1087 21, 22, 0, 0, 0, 0, 0, 25, 26, 0,
1088 27, 28, 29, 30, 87, 31, 88, 89, 90, 91,
1089 0, 0, 92, 93, 0, 0, 0, 0, 0, 0,
1090 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1091 0, 94, 0, 0, 0, 8, 9, 10, 0, 0,
1092 0, 206, 95, 96, 0, 97, 11, 12, 13, 14,
1093 15, 16, 17, 18, 19, 20, 21, 22, 0, 0,
1094 0, 0, 0, 25, 26, 0, 27, 28, 29, 30,
1095 87, 31, 88, 89, 90, 91, 0, 0, 92, 93,
1096 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1097 0, 0, 0, 0, 0, 0, 0, 94, 0, 0,
1098 222, 8, 9, 10, 0, 0, 0, 0, 95, 96,
1099 0, 97, 11, 12, 13, 14, 15, 16, 17, 18,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001100 19, 20, 21, 22, 0, 0, 0, 0, 0, 25,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001101 26, 0, 27, 28, 29, 30, 87, 31, 88, 89,
1102 90, 91, 0, 0, 92, 93, 0, 0, 0, 0,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001103 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001104 0, 0, 0, 94, 0, 0, 0, 8, 9, 10,
1105 0, 0, 0, 0, 95, 96, 0, 97, 11, 12,
1106 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
1107 0, 0, 0, 0, 0, 25, 175, 0, 27, 28,
1108 29, 30, 87, 31, 88, 89, 90, 91, 0, 0,
1109 92, 93, 0, 0, 0, 0, 0, 0, 0, 0,
1110 0, 0, 0, 0, 0, 0, 0, 0, 0, 94,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001111 2, 3, 4, 0, 0, 0, 8, 9, 10, 0,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001112 95, 96, 0, 97, 0, 0, 0, 11, 12, 13,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001113 14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001114 0, 0, 0, 0, 25, 26, 0, 27, 28, 29,
1115 30, 0, 31, 2, 3, 4, 0, 0, 0, 8,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001116 9, 10, 0, 0, 0, 0, 0, 0, 0, 0,
1117 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001118 21, 22, 0, 198, 0, 0, 0, 25, 26, 0,
1119 27, 28, 29, 30, 0, 31, 0, 0, 0, 0,
1120 0, 0, 0, 0, 0, 0, 71, 0, 0, 1,
1121 2, 3, 4, 5, 6, 7, 8, 9, 10, 0,
1122 0, 0, 0, 0, 0, 0, 247, 11, 12, 13,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001123 14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001124 0, 0, 23, 24, 25, 26, 0, 27, 28, 29,
1125 30, 0, 31, 1, 2, 3, 4, 5, 6, 7,
1126 8, 9, 10, 0, 0, 0, 0, 0, 0, 0,
1127 0, 11, 12, 13, 14, 15, 16, 17, 18, 19,
1128 20, 21, 22, 0, 0, 0, 23, 24, 25, 26,
1129 0, 27, 28, 29, 30, 0, 31, 8, 9, 10,
1130 0, 0, 0, 0, 0, 0, 0, 0, 11, 12,
1131 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
1132 0, 0, 0, 0, 0, 25, 26, 0, 27, 28,
1133 29, 30, 229, 31, 8, 9, 10, 230, 0, 0,
1134 0, 0, 0, 0, 0, 11, 12, 13, 14, 15,
1135 16, 17, 18, 19, 20, 21, 22, 0, 0, 0,
1136 0, 0, 25, 26, 0, 27, 28, 29, 30, 0,
1137 31
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001138};
1139
1140static const yytype_int16 yycheck[] =
1141{
kbr@chromium.org205fef32011-11-22 20:50:02 +00001142 0, 160, 94, 86, 70, 127, 45, 0, 255, 60,
1143 40, 151, 85, 0, 36, 74, 72, 82, 74, 85,
1144 37, 268, 81, 106, 3, 81, 70, 42, 45, 8,
1145 9, 55, 56, 63, 284, 57, 51, 76, 288, 73,
1146 40, 85, 42, 135, 95, 75, 46, 79, 92, 93,
1147 82, 51, 82, 46, 33, 34, 35, 36, 37, 46,
1148 87, 88, 202, 63, 73, 109, 90, 91, 79, 79,
1149 79, 82, 194, 45, 3, 75, 76, 160, 170, 8,
1150 9, 73, 82, 84, 73, 86, 159, 79, 53, 54,
1151 79, 174, 73, 159, 73, 125, 79, 127, 79, 82,
1152 192, 62, 63, 64, 33, 34, 35, 36, 37, 74,
1153 71, 79, 204, 78, 82, 159, 256, 4, 5, 6,
1154 81, 183, 184, 185, 186, 125, 72, 127, 74, 269,
1155 74, 290, 37, 216, 217, 179, 180, 181, 182, 183,
1156 184, 185, 186, 187, 188, 189, 190, 191, 221, 289,
1157 76, 151, 33, 34, 35, 221, 57, 58, 79, 80,
1158 181, 182, 76, 255, 194, 45, 82, 187, 188, 45,
1159 72, 59, 61, 73, 72, 248, 268, 221, 75, 262,
1160 45, 72, 248, 82, 77, 277, 82, 72, 82, 72,
1161 74, 40, 45, 75, 194, 287, 74, 72, 75, 72,
1162 79, 75, 202, 75, 248, 75, 72, 290, 77, 73,
1163 210, 4, 5, 6, 82, 73, 16, 10, 11, 12,
1164 81, 171, 82, 189, 191, 82, 190, 57, 21, 22,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001165 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001166 64, 82, 5, 249, 252, 38, 39, 288, 41, 42,
1167 43, 44, 252, 46, 125, 255, 256, 55, 210, 46,
1168 -1, 252, -1, 268, -1, -1, -1, -1, 268, 269,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001169 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001170 -1, -1, -1, -1, 284, -1, -1, -1, 288, 289,
1171 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
1172 13, 14, 15, -1, 17, 18, 19, 20, 21, 22,
1173 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
1174 -1, -1, -1, 36, 37, 38, 39, 40, 41, 42,
1175 43, 44, 45, 46, 47, 48, 49, 50, -1, -1,
1176 53, 54, -1, -1, -1, -1, -1, -1, -1, -1,
1177 -1, -1, -1, -1, -1, -1, -1, -1, -1, 72,
1178 -1, -1, -1, 76, 77, -1, -1, -1, -1, 82,
1179 83, 84, -1, 86, 3, 4, 5, 6, 7, 8,
1180 9, 10, 11, 12, 13, 14, 15, -1, 17, 18,
1181 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
1182 29, 30, 31, 32, -1, -1, -1, 36, 37, 38,
1183 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
1184 49, 50, -1, -1, 53, 54, -1, -1, -1, -1,
zmo@google.com09c323a2011-08-12 18:22:25 +00001185 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001186 -1, -1, -1, 72, -1, -1, -1, 76, 77, -1,
1187 -1, -1, -1, 82, 83, 84, -1, 86, 3, 4,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001188 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1189 15, -1, 17, 18, 19, 20, 21, 22, 23, 24,
zmo@google.com09c323a2011-08-12 18:22:25 +00001190 25, 26, 27, 28, 29, 30, 31, 32, -1, -1,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001191 -1, 36, 37, 38, 39, 40, 41, 42, 43, 44,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001192 45, 46, 47, 48, 49, 50, -1, -1, 53, 54,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001193 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001194 -1, -1, -1, -1, -1, -1, -1, 72, -1, -1,
1195 -1, 76, -1, -1, -1, -1, -1, 82, 83, 84,
1196 -1, 86, 3, 4, 5, 6, 7, 8, 9, 10,
1197 11, 12, 13, 14, 15, -1, 17, 18, 19, 20,
1198 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
1199 31, 32, -1, -1, -1, 36, 37, 38, 39, 40,
1200 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
1201 -1, -1, 53, 54, -1, -1, -1, -1, -1, -1,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001202 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001203 -1, 72, -1, -1, -1, 76, -1, -1, -1, -1,
1204 -1, 82, 83, 84, -1, 86, 3, 4, 5, 6,
1205 7, 8, 9, 10, 11, 12, -1, -1, -1, -1,
1206 -1, -1, -1, -1, 21, 22, 23, 24, 25, 26,
1207 27, 28, 29, 30, 31, 32, -1, -1, -1, 36,
1208 37, 38, 39, -1, 41, 42, 43, 44, 45, 46,
1209 47, 48, 49, 50, -1, -1, 53, 54, -1, -1,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001210 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001211 -1, -1, -1, -1, -1, 72, -1, -1, -1, -1,
1212 -1, -1, -1, -1, -1, 82, 83, 84, -1, 86,
1213 3, 4, 5, 6, -1, 8, 9, 10, 11, 12,
1214 -1, -1, -1, -1, -1, -1, -1, -1, 21, 22,
1215 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
1216 -1, -1, -1, 36, 37, 38, 39, -1, 41, 42,
1217 43, 44, 45, 46, 47, 48, 49, 50, -1, -1,
1218 53, 54, -1, -1, -1, -1, -1, -1, -1, -1,
1219 -1, -1, -1, -1, -1, -1, -1, -1, -1, 72,
1220 -1, -1, -1, 10, 11, 12, -1, -1, -1, -1,
1221 83, 84, -1, 86, 21, 22, 23, 24, 25, 26,
1222 27, 28, 29, 30, 31, 32, -1, -1, -1, -1,
1223 -1, 38, 39, -1, 41, 42, 43, 44, 45, 46,
1224 47, 48, 49, 50, -1, -1, 53, 54, -1, -1,
1225 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1226 -1, -1, -1, -1, -1, 72, -1, -1, 75, 10,
1227 11, 12, -1, -1, -1, -1, 83, 84, -1, 86,
1228 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
1229 31, 32, -1, -1, -1, -1, -1, 38, 39, -1,
1230 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
1231 -1, -1, 53, 54, -1, -1, -1, -1, -1, -1,
1232 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1233 -1, 72, -1, -1, -1, 10, 11, 12, -1, -1,
1234 -1, 82, 83, 84, -1, 86, 21, 22, 23, 24,
1235 25, 26, 27, 28, 29, 30, 31, 32, -1, -1,
1236 -1, -1, -1, 38, 39, -1, 41, 42, 43, 44,
1237 45, 46, 47, 48, 49, 50, -1, -1, 53, 54,
1238 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1239 -1, -1, -1, -1, -1, -1, -1, 72, -1, -1,
1240 75, 10, 11, 12, -1, -1, -1, -1, 83, 84,
1241 -1, 86, 21, 22, 23, 24, 25, 26, 27, 28,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001242 29, 30, 31, 32, -1, -1, -1, -1, -1, 38,
1243 39, -1, 41, 42, 43, 44, 45, 46, 47, 48,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001244 49, 50, -1, -1, 53, 54, -1, -1, -1, -1,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001245 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001246 -1, -1, -1, 72, -1, -1, -1, 10, 11, 12,
1247 -1, -1, -1, -1, 83, 84, -1, 86, 21, 22,
1248 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
1249 -1, -1, -1, -1, -1, 38, 39, -1, 41, 42,
1250 43, 44, 45, 46, 47, 48, 49, 50, -1, -1,
1251 53, 54, -1, -1, -1, -1, -1, -1, -1, -1,
1252 -1, -1, -1, -1, -1, -1, -1, -1, -1, 72,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001253 4, 5, 6, -1, -1, -1, 10, 11, 12, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001254 83, 84, -1, 86, -1, -1, -1, 21, 22, 23,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001255 24, 25, 26, 27, 28, 29, 30, 31, 32, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001256 -1, -1, -1, -1, 38, 39, -1, 41, 42, 43,
1257 44, -1, 46, 4, 5, 6, -1, -1, -1, 10,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001258 11, 12, -1, -1, -1, -1, -1, -1, -1, -1,
1259 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001260 31, 32, -1, 77, -1, -1, -1, 38, 39, -1,
1261 41, 42, 43, 44, -1, 46, -1, -1, -1, -1,
1262 -1, -1, -1, -1, -1, -1, 0, -1, -1, 3,
1263 4, 5, 6, 7, 8, 9, 10, 11, 12, -1,
1264 -1, -1, -1, -1, -1, -1, 77, 21, 22, 23,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001265 24, 25, 26, 27, 28, 29, 30, 31, 32, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001266 -1, -1, 36, 37, 38, 39, -1, 41, 42, 43,
1267 44, -1, 46, 3, 4, 5, 6, 7, 8, 9,
1268 10, 11, 12, -1, -1, -1, -1, -1, -1, -1,
1269 -1, 21, 22, 23, 24, 25, 26, 27, 28, 29,
1270 30, 31, 32, -1, -1, -1, 36, 37, 38, 39,
1271 -1, 41, 42, 43, 44, -1, 46, 10, 11, 12,
1272 -1, -1, -1, -1, -1, -1, -1, -1, 21, 22,
1273 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
1274 -1, -1, -1, -1, -1, 38, 39, -1, 41, 42,
1275 43, 44, 45, 46, 10, 11, 12, 50, -1, -1,
1276 -1, -1, -1, -1, -1, 21, 22, 23, 24, 25,
1277 26, 27, 28, 29, 30, 31, 32, -1, -1, -1,
1278 -1, -1, 38, 39, -1, 41, 42, 43, 44, -1,
1279 46
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001280};
1281
1282/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
1283 symbol of state STATE-NUM. */
1284static const yytype_uint8 yystos[] =
1285{
1286 0, 3, 4, 5, 6, 7, 8, 9, 10, 11,
1287 12, 21, 22, 23, 24, 25, 26, 27, 28, 29,
zmo@google.com09c323a2011-08-12 18:22:25 +00001288 30, 31, 32, 36, 37, 38, 39, 41, 42, 43,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001289 44, 46, 126, 127, 128, 129, 130, 135, 136, 137,
1290 138, 139, 140, 141, 142, 143, 172, 173, 174, 37,
1291 45, 140, 45, 76, 82, 175, 73, 79, 3, 33,
1292 34, 35, 132, 133, 138, 79, 82, 45, 139, 141,
1293 74, 0, 173, 141, 76, 145, 76, 158, 132, 131,
1294 134, 139, 133, 45, 72, 74, 81, 45, 47, 48,
1295 49, 50, 53, 54, 72, 83, 84, 86, 97, 98,
1296 99, 101, 102, 103, 104, 105, 106, 107, 108, 109,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001297 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001298 120, 121, 125, 142, 82, 144, 139, 146, 147, 13,
1299 14, 15, 17, 18, 19, 20, 40, 76, 77, 82,
1300 108, 121, 122, 124, 126, 127, 142, 151, 152, 153,
1301 154, 159, 160, 161, 164, 171, 45, 131, 134, 74,
1302 81, 75, 125, 122, 150, 108, 108, 124, 53, 54,
1303 74, 78, 73, 73, 79, 39, 122, 72, 108, 87,
1304 88, 84, 86, 55, 56, 90, 91, 57, 58, 59,
1305 61, 60, 95, 75, 146, 45, 148, 149, 77, 147,
1306 82, 82, 166, 72, 72, 82, 82, 124, 72, 77,
1307 155, 62, 63, 64, 71, 81, 123, 79, 82, 77,
1308 152, 74, 75, 125, 150, 75, 73, 100, 124, 45,
1309 50, 103, 122, 108, 108, 110, 110, 112, 112, 112,
1310 112, 113, 113, 117, 118, 119, 124, 77, 74, 79,
1311 82, 152, 167, 124, 82, 165, 159, 122, 122, 125,
1312 75, 75, 80, 125, 149, 40, 151, 160, 168, 73,
1313 124, 137, 163, 156, 75, 122, 75, 72, 163, 169,
1314 170, 152, 162, 45, 73, 77, 124, 82, 73, 16,
1315 81, 153, 157, 158, 73, 124, 157, 152, 150, 82
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001316};
1317
1318#define yyerrok (yyerrstatus = 0)
1319#define yyclearin (yychar = YYEMPTY)
1320#define YYEMPTY (-2)
1321#define YYEOF 0
1322
1323#define YYACCEPT goto yyacceptlab
1324#define YYABORT goto yyabortlab
1325#define YYERROR goto yyerrorlab
1326
1327
1328/* Like YYERROR except do call yyerror. This remains here temporarily
1329 to ease the transition to the new meaning of YYERROR, for GCC.
1330 Once GCC version 2 has supplanted version 1, this can go. */
1331
1332#define YYFAIL goto yyerrlab
1333
1334#define YYRECOVERING() (!!yyerrstatus)
1335
1336#define YYBACKUP(Token, Value) \
1337do \
1338 if (yychar == YYEMPTY && yylen == 1) \
1339 { \
1340 yychar = (Token); \
1341 yylval = (Value); \
1342 yytoken = YYTRANSLATE (yychar); \
1343 YYPOPSTACK (1); \
1344 goto yybackup; \
1345 } \
1346 else \
1347 { \
1348 yyerror (context, YY_("syntax error: cannot back up")); \
1349 YYERROR; \
1350 } \
1351while (YYID (0))
1352
1353
1354#define YYTERROR 1
1355#define YYERRCODE 256
1356
1357
1358/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
1359 If N is 0, then set CURRENT to the empty location which ends
1360 the previous symbol: RHS[0] (always defined). */
1361
1362#define YYRHSLOC(Rhs, K) ((Rhs)[K])
1363#ifndef YYLLOC_DEFAULT
1364# define YYLLOC_DEFAULT(Current, Rhs, N) \
1365 do \
1366 if (YYID (N)) \
1367 { \
1368 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
1369 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
1370 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
1371 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
1372 } \
1373 else \
1374 { \
1375 (Current).first_line = (Current).last_line = \
1376 YYRHSLOC (Rhs, 0).last_line; \
1377 (Current).first_column = (Current).last_column = \
1378 YYRHSLOC (Rhs, 0).last_column; \
1379 } \
1380 while (YYID (0))
1381#endif
1382
1383
1384/* YY_LOCATION_PRINT -- Print the location on the stream.
1385 This macro was not mandated originally: define only if we know
1386 we won't break user code: when these are the locations we know. */
1387
1388#ifndef YY_LOCATION_PRINT
kbr@chromium.org205fef32011-11-22 20:50:02 +00001389# if YYLTYPE_IS_TRIVIAL
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001390# define YY_LOCATION_PRINT(File, Loc) \
1391 fprintf (File, "%d.%d-%d.%d", \
1392 (Loc).first_line, (Loc).first_column, \
1393 (Loc).last_line, (Loc).last_column)
1394# else
1395# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1396# endif
1397#endif
1398
1399
1400/* YYLEX -- calling `yylex' with the right arguments. */
1401
1402#ifdef YYLEX_PARAM
1403# define YYLEX yylex (&yylval, YYLEX_PARAM)
1404#else
1405# define YYLEX yylex (&yylval)
1406#endif
1407
1408/* Enable debugging if requested. */
1409#if YYDEBUG
1410
1411# ifndef YYFPRINTF
1412# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1413# define YYFPRINTF fprintf
1414# endif
1415
1416# define YYDPRINTF(Args) \
1417do { \
1418 if (yydebug) \
1419 YYFPRINTF Args; \
1420} while (YYID (0))
1421
1422# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
1423do { \
1424 if (yydebug) \
1425 { \
1426 YYFPRINTF (stderr, "%s ", Title); \
1427 yy_symbol_print (stderr, \
1428 Type, Value, context); \
1429 YYFPRINTF (stderr, "\n"); \
1430 } \
1431} while (YYID (0))
1432
1433
1434/*--------------------------------.
1435| Print this symbol on YYOUTPUT. |
1436`--------------------------------*/
1437
1438/*ARGSUSED*/
1439#if (defined __STDC__ || defined __C99__FUNC__ \
1440 || defined __cplusplus || defined _MSC_VER)
1441static void
1442yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, TParseContext* context)
1443#else
1444static void
1445yy_symbol_value_print (yyoutput, yytype, yyvaluep, context)
1446 FILE *yyoutput;
1447 int yytype;
1448 YYSTYPE const * const yyvaluep;
1449 TParseContext* context;
1450#endif
1451{
1452 if (!yyvaluep)
1453 return;
1454 YYUSE (context);
1455# ifdef YYPRINT
1456 if (yytype < YYNTOKENS)
1457 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1458# else
1459 YYUSE (yyoutput);
1460# endif
1461 switch (yytype)
1462 {
1463 default:
1464 break;
1465 }
1466}
1467
1468
1469/*--------------------------------.
1470| Print this symbol on YYOUTPUT. |
1471`--------------------------------*/
1472
1473#if (defined __STDC__ || defined __C99__FUNC__ \
1474 || defined __cplusplus || defined _MSC_VER)
1475static void
1476yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, TParseContext* context)
1477#else
1478static void
1479yy_symbol_print (yyoutput, yytype, yyvaluep, context)
1480 FILE *yyoutput;
1481 int yytype;
1482 YYSTYPE const * const yyvaluep;
1483 TParseContext* context;
1484#endif
1485{
1486 if (yytype < YYNTOKENS)
1487 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1488 else
1489 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1490
1491 yy_symbol_value_print (yyoutput, yytype, yyvaluep, context);
1492 YYFPRINTF (yyoutput, ")");
1493}
1494
1495/*------------------------------------------------------------------.
1496| yy_stack_print -- Print the state stack from its BOTTOM up to its |
1497| TOP (included). |
1498`------------------------------------------------------------------*/
1499
1500#if (defined __STDC__ || defined __C99__FUNC__ \
1501 || defined __cplusplus || defined _MSC_VER)
1502static void
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001503yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001504#else
1505static void
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001506yy_stack_print (bottom, top)
1507 yytype_int16 *bottom;
1508 yytype_int16 *top;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001509#endif
1510{
1511 YYFPRINTF (stderr, "Stack now");
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001512 for (; bottom <= top; ++bottom)
1513 YYFPRINTF (stderr, " %d", *bottom);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001514 YYFPRINTF (stderr, "\n");
1515}
1516
1517# define YY_STACK_PRINT(Bottom, Top) \
1518do { \
1519 if (yydebug) \
1520 yy_stack_print ((Bottom), (Top)); \
1521} while (YYID (0))
1522
1523
1524/*------------------------------------------------.
1525| Report that the YYRULE is going to be reduced. |
1526`------------------------------------------------*/
1527
1528#if (defined __STDC__ || defined __C99__FUNC__ \
1529 || defined __cplusplus || defined _MSC_VER)
1530static void
1531yy_reduce_print (YYSTYPE *yyvsp, int yyrule, TParseContext* context)
1532#else
1533static void
1534yy_reduce_print (yyvsp, yyrule, context)
1535 YYSTYPE *yyvsp;
1536 int yyrule;
1537 TParseContext* context;
1538#endif
1539{
1540 int yynrhs = yyr2[yyrule];
1541 int yyi;
1542 unsigned long int yylno = yyrline[yyrule];
1543 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1544 yyrule - 1, yylno);
1545 /* The symbols being reduced. */
1546 for (yyi = 0; yyi < yynrhs; yyi++)
1547 {
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001548 fprintf (stderr, " $%d = ", yyi + 1);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001549 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1550 &(yyvsp[(yyi + 1) - (yynrhs)])
1551 , context);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001552 fprintf (stderr, "\n");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001553 }
1554}
1555
1556# define YY_REDUCE_PRINT(Rule) \
1557do { \
1558 if (yydebug) \
1559 yy_reduce_print (yyvsp, Rule, context); \
1560} while (YYID (0))
1561
1562/* Nonzero means print parse trace. It is left uninitialized so that
1563 multiple parsers can coexist. */
1564int yydebug;
1565#else /* !YYDEBUG */
1566# define YYDPRINTF(Args)
1567# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1568# define YY_STACK_PRINT(Bottom, Top)
1569# define YY_REDUCE_PRINT(Rule)
1570#endif /* !YYDEBUG */
1571
1572
1573/* YYINITDEPTH -- initial size of the parser's stacks. */
1574#ifndef YYINITDEPTH
1575# define YYINITDEPTH 200
1576#endif
1577
1578/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1579 if the built-in stack extension method is used).
1580
1581 Do not make this value too large; the results are undefined if
1582 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1583 evaluated with infinite-precision integer arithmetic. */
1584
1585#ifndef YYMAXDEPTH
1586# define YYMAXDEPTH 10000
1587#endif
1588
1589
1590
1591#if YYERROR_VERBOSE
1592
1593# ifndef yystrlen
1594# if defined __GLIBC__ && defined _STRING_H
1595# define yystrlen strlen
1596# else
1597/* Return the length of YYSTR. */
1598#if (defined __STDC__ || defined __C99__FUNC__ \
1599 || defined __cplusplus || defined _MSC_VER)
1600static YYSIZE_T
1601yystrlen (const char *yystr)
1602#else
1603static YYSIZE_T
1604yystrlen (yystr)
1605 const char *yystr;
1606#endif
1607{
1608 YYSIZE_T yylen;
1609 for (yylen = 0; yystr[yylen]; yylen++)
1610 continue;
1611 return yylen;
1612}
1613# endif
1614# endif
1615
1616# ifndef yystpcpy
1617# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1618# define yystpcpy stpcpy
1619# else
1620/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1621 YYDEST. */
1622#if (defined __STDC__ || defined __C99__FUNC__ \
1623 || defined __cplusplus || defined _MSC_VER)
1624static char *
1625yystpcpy (char *yydest, const char *yysrc)
1626#else
1627static char *
1628yystpcpy (yydest, yysrc)
1629 char *yydest;
1630 const char *yysrc;
1631#endif
1632{
1633 char *yyd = yydest;
1634 const char *yys = yysrc;
1635
1636 while ((*yyd++ = *yys++) != '\0')
1637 continue;
1638
1639 return yyd - 1;
1640}
1641# endif
1642# endif
1643
1644# ifndef yytnamerr
1645/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1646 quotes and backslashes, so that it's suitable for yyerror. The
1647 heuristic is that double-quoting is unnecessary unless the string
1648 contains an apostrophe, a comma, or backslash (other than
1649 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1650 null, do not copy; instead, return the length of what the result
1651 would have been. */
1652static YYSIZE_T
1653yytnamerr (char *yyres, const char *yystr)
1654{
1655 if (*yystr == '"')
1656 {
1657 YYSIZE_T yyn = 0;
1658 char const *yyp = yystr;
1659
1660 for (;;)
1661 switch (*++yyp)
1662 {
1663 case '\'':
1664 case ',':
1665 goto do_not_strip_quotes;
1666
1667 case '\\':
1668 if (*++yyp != '\\')
1669 goto do_not_strip_quotes;
1670 /* Fall through. */
1671 default:
1672 if (yyres)
1673 yyres[yyn] = *yyp;
1674 yyn++;
1675 break;
1676
1677 case '"':
1678 if (yyres)
1679 yyres[yyn] = '\0';
1680 return yyn;
1681 }
1682 do_not_strip_quotes: ;
1683 }
1684
1685 if (! yyres)
1686 return yystrlen (yystr);
1687
1688 return yystpcpy (yyres, yystr) - yyres;
1689}
1690# endif
1691
1692/* Copy into YYRESULT an error message about the unexpected token
1693 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1694 including the terminating null byte. If YYRESULT is null, do not
1695 copy anything; just return the number of bytes that would be
1696 copied. As a special case, return 0 if an ordinary "syntax error"
1697 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1698 size calculation. */
1699static YYSIZE_T
1700yysyntax_error (char *yyresult, int yystate, int yychar)
1701{
1702 int yyn = yypact[yystate];
1703
1704 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1705 return 0;
1706 else
1707 {
1708 int yytype = YYTRANSLATE (yychar);
1709 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1710 YYSIZE_T yysize = yysize0;
1711 YYSIZE_T yysize1;
1712 int yysize_overflow = 0;
1713 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1714 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1715 int yyx;
1716
1717# if 0
1718 /* This is so xgettext sees the translatable formats that are
1719 constructed on the fly. */
1720 YY_("syntax error, unexpected %s");
1721 YY_("syntax error, unexpected %s, expecting %s");
1722 YY_("syntax error, unexpected %s, expecting %s or %s");
1723 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1724 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1725# endif
1726 char *yyfmt;
1727 char const *yyf;
1728 static char const yyunexpected[] = "syntax error, unexpected %s";
1729 static char const yyexpecting[] = ", expecting %s";
1730 static char const yyor[] = " or %s";
1731 char yyformat[sizeof yyunexpected
1732 + sizeof yyexpecting - 1
1733 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1734 * (sizeof yyor - 1))];
1735 char const *yyprefix = yyexpecting;
1736
1737 /* Start YYX at -YYN if negative to avoid negative indexes in
1738 YYCHECK. */
1739 int yyxbegin = yyn < 0 ? -yyn : 0;
1740
1741 /* Stay within bounds of both yycheck and yytname. */
1742 int yychecklim = YYLAST - yyn + 1;
1743 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1744 int yycount = 1;
1745
1746 yyarg[0] = yytname[yytype];
1747 yyfmt = yystpcpy (yyformat, yyunexpected);
1748
1749 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1750 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1751 {
1752 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1753 {
1754 yycount = 1;
1755 yysize = yysize0;
1756 yyformat[sizeof yyunexpected - 1] = '\0';
1757 break;
1758 }
1759 yyarg[yycount++] = yytname[yyx];
1760 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1761 yysize_overflow |= (yysize1 < yysize);
1762 yysize = yysize1;
1763 yyfmt = yystpcpy (yyfmt, yyprefix);
1764 yyprefix = yyor;
1765 }
1766
1767 yyf = YY_(yyformat);
1768 yysize1 = yysize + yystrlen (yyf);
1769 yysize_overflow |= (yysize1 < yysize);
1770 yysize = yysize1;
1771
1772 if (yysize_overflow)
1773 return YYSIZE_MAXIMUM;
1774
1775 if (yyresult)
1776 {
1777 /* Avoid sprintf, as that infringes on the user's name space.
1778 Don't have undefined behavior even if the translation
1779 produced a string with the wrong number of "%s"s. */
1780 char *yyp = yyresult;
1781 int yyi = 0;
1782 while ((*yyp = *yyf) != '\0')
1783 {
1784 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1785 {
1786 yyp += yytnamerr (yyp, yyarg[yyi++]);
1787 yyf += 2;
1788 }
1789 else
1790 {
1791 yyp++;
1792 yyf++;
1793 }
1794 }
1795 }
1796 return yysize;
1797 }
1798}
1799#endif /* YYERROR_VERBOSE */
1800
1801
1802/*-----------------------------------------------.
1803| Release the memory associated to this symbol. |
1804`-----------------------------------------------*/
1805
1806/*ARGSUSED*/
1807#if (defined __STDC__ || defined __C99__FUNC__ \
1808 || defined __cplusplus || defined _MSC_VER)
1809static void
1810yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, TParseContext* context)
1811#else
1812static void
1813yydestruct (yymsg, yytype, yyvaluep, context)
1814 const char *yymsg;
1815 int yytype;
1816 YYSTYPE *yyvaluep;
1817 TParseContext* context;
1818#endif
1819{
1820 YYUSE (yyvaluep);
1821 YYUSE (context);
1822
1823 if (!yymsg)
1824 yymsg = "Deleting";
1825 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1826
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001827 switch (yytype)
1828 {
1829
1830 default:
1831 break;
1832 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001833}
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001834
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001835
1836/* Prevent warnings from -Wmissing-prototypes. */
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001837
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001838#ifdef YYPARSE_PARAM
1839#if defined __STDC__ || defined __cplusplus
1840int yyparse (void *YYPARSE_PARAM);
1841#else
1842int yyparse ();
1843#endif
1844#else /* ! YYPARSE_PARAM */
1845#if defined __STDC__ || defined __cplusplus
1846int yyparse (TParseContext* context);
1847#else
1848int yyparse ();
1849#endif
1850#endif /* ! YYPARSE_PARAM */
1851
1852
1853
1854
1855
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001856
1857/*----------.
1858| yyparse. |
1859`----------*/
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001860
1861#ifdef YYPARSE_PARAM
1862#if (defined __STDC__ || defined __C99__FUNC__ \
1863 || defined __cplusplus || defined _MSC_VER)
1864int
1865yyparse (void *YYPARSE_PARAM)
1866#else
1867int
1868yyparse (YYPARSE_PARAM)
1869 void *YYPARSE_PARAM;
1870#endif
1871#else /* ! YYPARSE_PARAM */
1872#if (defined __STDC__ || defined __C99__FUNC__ \
1873 || defined __cplusplus || defined _MSC_VER)
1874int
1875yyparse (TParseContext* context)
1876#else
1877int
1878yyparse (context)
1879 TParseContext* context;
1880#endif
1881#endif
1882{
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001883 /* The look-ahead symbol. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001884int yychar;
1885
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001886/* The semantic value of the look-ahead symbol. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001887YYSTYPE yylval;
1888
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001889/* Number of syntax errors so far. */
1890int yynerrs;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001891
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001892 int yystate;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001893 int yyn;
1894 int yyresult;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001895 /* Number of tokens to shift before error messages enabled. */
1896 int yyerrstatus;
1897 /* Look-ahead token as an internal (translated) token number. */
1898 int yytoken = 0;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001899#if YYERROR_VERBOSE
1900 /* Buffer for error messages, and its allocated size. */
1901 char yymsgbuf[128];
1902 char *yymsg = yymsgbuf;
1903 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1904#endif
1905
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001906 /* Three stacks and their tools:
1907 `yyss': related to states,
1908 `yyvs': related to semantic values,
1909 `yyls': related to locations.
1910
1911 Refer to the stacks thru separate pointers, to allow yyoverflow
1912 to reallocate them elsewhere. */
1913
1914 /* The state stack. */
1915 yytype_int16 yyssa[YYINITDEPTH];
1916 yytype_int16 *yyss = yyssa;
1917 yytype_int16 *yyssp;
1918
1919 /* The semantic value stack. */
1920 YYSTYPE yyvsa[YYINITDEPTH];
1921 YYSTYPE *yyvs = yyvsa;
1922 YYSTYPE *yyvsp;
1923
1924
1925
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001926#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1927
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001928 YYSIZE_T yystacksize = YYINITDEPTH;
1929
1930 /* The variables used to return semantic value and location from the
1931 action routines. */
1932 YYSTYPE yyval;
1933
1934
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001935 /* The number of symbols on the RHS of the reduced rule.
1936 Keep to zero when no symbol should be popped. */
1937 int yylen = 0;
1938
1939 YYDPRINTF ((stderr, "Starting parse\n"));
1940
1941 yystate = 0;
1942 yyerrstatus = 0;
1943 yynerrs = 0;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001944 yychar = YYEMPTY; /* Cause a token to be read. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001945
1946 /* Initialize stack pointers.
1947 Waste one element of value and location stack
1948 so that they stay on the same level as the state stack.
1949 The wasted elements are never initialized. */
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001950
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001951 yyssp = yyss;
1952 yyvsp = yyvs;
1953
1954 goto yysetstate;
1955
1956/*------------------------------------------------------------.
1957| yynewstate -- Push a new state, which is found in yystate. |
1958`------------------------------------------------------------*/
1959 yynewstate:
1960 /* In all cases, when you get here, the value and location stacks
1961 have just been pushed. So pushing a state here evens the stacks. */
1962 yyssp++;
1963
1964 yysetstate:
1965 *yyssp = yystate;
1966
1967 if (yyss + yystacksize - 1 <= yyssp)
1968 {
1969 /* Get the current used size of the three stacks, in elements. */
1970 YYSIZE_T yysize = yyssp - yyss + 1;
1971
1972#ifdef yyoverflow
1973 {
1974 /* Give user a chance to reallocate the stack. Use copies of
1975 these so that the &'s don't force the real ones into
1976 memory. */
1977 YYSTYPE *yyvs1 = yyvs;
1978 yytype_int16 *yyss1 = yyss;
1979
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001980
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001981 /* Each stack pointer address is followed by the size of the
1982 data in use in that stack, in bytes. This used to be a
1983 conditional around just the two extra args, but that might
1984 be undefined if yyoverflow is a macro. */
1985 yyoverflow (YY_("memory exhausted"),
1986 &yyss1, yysize * sizeof (*yyssp),
1987 &yyvs1, yysize * sizeof (*yyvsp),
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001988
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001989 &yystacksize);
1990
1991 yyss = yyss1;
1992 yyvs = yyvs1;
1993 }
1994#else /* no yyoverflow */
1995# ifndef YYSTACK_RELOCATE
1996 goto yyexhaustedlab;
1997# else
1998 /* Extend the stack our own way. */
1999 if (YYMAXDEPTH <= yystacksize)
2000 goto yyexhaustedlab;
2001 yystacksize *= 2;
2002 if (YYMAXDEPTH < yystacksize)
2003 yystacksize = YYMAXDEPTH;
2004
2005 {
2006 yytype_int16 *yyss1 = yyss;
2007 union yyalloc *yyptr =
2008 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
2009 if (! yyptr)
2010 goto yyexhaustedlab;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002011 YYSTACK_RELOCATE (yyss);
2012 YYSTACK_RELOCATE (yyvs);
2013
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002014# undef YYSTACK_RELOCATE
2015 if (yyss1 != yyssa)
2016 YYSTACK_FREE (yyss1);
2017 }
2018# endif
2019#endif /* no yyoverflow */
2020
2021 yyssp = yyss + yysize - 1;
2022 yyvsp = yyvs + yysize - 1;
2023
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002024
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002025 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
2026 (unsigned long int) yystacksize));
2027
2028 if (yyss + yystacksize - 1 <= yyssp)
2029 YYABORT;
2030 }
2031
2032 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
2033
2034 goto yybackup;
2035
2036/*-----------.
2037| yybackup. |
2038`-----------*/
2039yybackup:
2040
2041 /* Do appropriate processing given the current state. Read a
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002042 look-ahead token if we need one and don't already have one. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002043
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002044 /* First try to decide what to do without reference to look-ahead token. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002045 yyn = yypact[yystate];
2046 if (yyn == YYPACT_NINF)
2047 goto yydefault;
2048
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002049 /* Not known => get a look-ahead token if don't already have one. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002050
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002051 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002052 if (yychar == YYEMPTY)
2053 {
2054 YYDPRINTF ((stderr, "Reading a token: "));
2055 yychar = YYLEX;
2056 }
2057
2058 if (yychar <= YYEOF)
2059 {
2060 yychar = yytoken = YYEOF;
2061 YYDPRINTF ((stderr, "Now at end of input.\n"));
2062 }
2063 else
2064 {
2065 yytoken = YYTRANSLATE (yychar);
2066 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
2067 }
2068
2069 /* If the proper action on seeing token YYTOKEN is to reduce or to
2070 detect an error, take that action. */
2071 yyn += yytoken;
2072 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
2073 goto yydefault;
2074 yyn = yytable[yyn];
2075 if (yyn <= 0)
2076 {
2077 if (yyn == 0 || yyn == YYTABLE_NINF)
2078 goto yyerrlab;
2079 yyn = -yyn;
2080 goto yyreduce;
2081 }
2082
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002083 if (yyn == YYFINAL)
2084 YYACCEPT;
2085
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002086 /* Count tokens shifted since error; after three, turn off error
2087 status. */
2088 if (yyerrstatus)
2089 yyerrstatus--;
2090
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002091 /* Shift the look-ahead token. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002092 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
2093
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002094 /* Discard the shifted token unless it is eof. */
2095 if (yychar != YYEOF)
2096 yychar = YYEMPTY;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002097
2098 yystate = yyn;
2099 *++yyvsp = yylval;
2100
2101 goto yynewstate;
2102
2103
2104/*-----------------------------------------------------------.
2105| yydefault -- do the default action for the current state. |
2106`-----------------------------------------------------------*/
2107yydefault:
2108 yyn = yydefact[yystate];
2109 if (yyn == 0)
2110 goto yyerrlab;
2111 goto yyreduce;
2112
2113
2114/*-----------------------------.
2115| yyreduce -- Do a reduction. |
2116`-----------------------------*/
2117yyreduce:
2118 /* yyn is the number of a rule to reduce with. */
2119 yylen = yyr2[yyn];
2120
2121 /* If YYLEN is nonzero, implement the default value of the action:
2122 `$$ = $1'.
2123
2124 Otherwise, the following line sets YYVAL to garbage.
2125 This behavior is undocumented and Bison
2126 users should not rely upon it. Assigning to YYVAL
2127 unconditionally makes the parser a bit smaller, and it avoids a
2128 GCC warning that YYVAL may be used uninitialized. */
2129 yyval = yyvsp[1-yylen];
2130
2131
2132 YY_REDUCE_PRINT (yyn);
2133 switch (yyn)
2134 {
2135 case 2:
2136
2137 {
2138 // The symbol table search was done in the lexical phase
2139 const TSymbol* symbol = (yyvsp[(1) - (1)].lex).symbol;
2140 const TVariable* variable;
2141 if (symbol == 0) {
2142 context->error((yyvsp[(1) - (1)].lex).line, "undeclared identifier", (yyvsp[(1) - (1)].lex).string->c_str(), "");
2143 context->recover();
2144 TType type(EbtFloat, EbpUndefined);
2145 TVariable* fakeVariable = new TVariable((yyvsp[(1) - (1)].lex).string, type);
2146 context->symbolTable.insert(*fakeVariable);
2147 variable = fakeVariable;
2148 } else {
2149 // This identifier can only be a variable type symbol
2150 if (! symbol->isVariable()) {
2151 context->error((yyvsp[(1) - (1)].lex).line, "variable expected", (yyvsp[(1) - (1)].lex).string->c_str(), "");
2152 context->recover();
2153 }
2154 variable = static_cast<const TVariable*>(symbol);
2155 }
2156
2157 // don't delete $1.string, it's used by error recovery, and the pool
2158 // pop will reclaim the memory
2159
2160 if (variable->getType().getQualifier() == EvqConst ) {
2161 ConstantUnion* constArray = variable->getConstPointer();
2162 TType t(variable->getType());
2163 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(constArray, t, (yyvsp[(1) - (1)].lex).line);
2164 } else
2165 (yyval.interm.intermTypedNode) = context->intermediate.addSymbol(variable->getUniqueId(),
2166 variable->getName(),
2167 variable->getType(), (yyvsp[(1) - (1)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002168 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002169 break;
2170
2171 case 3:
2172
2173 {
2174 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002175 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002176 break;
2177
2178 case 4:
2179
2180 {
2181 //
2182 // INT_TYPE is only 16-bit plus sign bit for vertex/fragment shaders,
2183 // check for overflow for constants
2184 //
2185 if (abs((yyvsp[(1) - (1)].lex).i) >= (1 << 16)) {
2186 context->error((yyvsp[(1) - (1)].lex).line, " integer constant overflow", "", "");
2187 context->recover();
2188 }
2189 ConstantUnion *unionArray = new ConstantUnion[1];
2190 unionArray->setIConst((yyvsp[(1) - (1)].lex).i);
2191 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002192 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002193 break;
2194
2195 case 5:
2196
2197 {
2198 ConstantUnion *unionArray = new ConstantUnion[1];
2199 unionArray->setFConst((yyvsp[(1) - (1)].lex).f);
2200 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002201 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002202 break;
2203
2204 case 6:
2205
2206 {
2207 ConstantUnion *unionArray = new ConstantUnion[1];
2208 unionArray->setBConst((yyvsp[(1) - (1)].lex).b);
2209 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002210 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002211 break;
2212
2213 case 7:
2214
2215 {
2216 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (3)].interm.intermTypedNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002217 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002218 break;
2219
2220 case 8:
2221
2222 {
2223 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002224 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002225 break;
2226
2227 case 9:
2228
2229 {
2230 if (!(yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isVector()) {
2231 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode())
2232 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(), "");
2233 else
2234 context->error((yyvsp[(2) - (4)].lex).line, " left of '[' is not of type array, matrix, or vector ", "expression", "");
2235 context->recover();
2236 }
2237 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst && (yyvsp[(3) - (4)].interm.intermTypedNode)->getQualifier() == EvqConst) {
2238 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) { // constant folding for arrays
2239 (yyval.interm.intermTypedNode) = context->addConstArrayNode((yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2240 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector()) { // constant folding for vectors
2241 TVectorFields fields;
2242 fields.num = 1;
2243 fields.offsets[0] = (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(); // need to do it this way because v.xy sends fields integer array
2244 (yyval.interm.intermTypedNode) = context->addConstVectorNode(fields, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2245 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix()) { // constant folding for matrices
2246 (yyval.interm.intermTypedNode) = context->addConstMatrixNode((yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2247 }
2248 } else {
2249 if ((yyvsp[(3) - (4)].interm.intermTypedNode)->getQualifier() == EvqConst) {
2250 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() ) {
2251 context->error((yyvsp[(2) - (4)].lex).line, "", "[", "field selection out of range '%d'", (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst());
2252 context->recover();
2253 } else {
2254 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) {
2255 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize() == 0) {
2256 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getMaxArraySize() <= (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst()) {
2257 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))
2258 context->recover();
2259 } else {
2260 if (context->arraySetMaxSize((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getTypePointer(), 0, false, (yyvsp[(2) - (4)].lex).line))
2261 context->recover();
2262 }
2263 } else if ( (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst() >= (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize()) {
2264 context->error((yyvsp[(2) - (4)].lex).line, "", "[", "array index out of range '%d'", (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst());
2265 context->recover();
2266 }
2267 }
2268 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(3) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2269 }
2270 } else {
2271 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize() == 0) {
2272 context->error((yyvsp[(2) - (4)].lex).line, "", "[", "array must be redeclared with a size before being indexed with a variable");
2273 context->recover();
2274 }
2275
2276 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexIndirect, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(3) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2277 }
2278 }
2279 if ((yyval.interm.intermTypedNode) == 0) {
2280 ConstantUnion *unionArray = new ConstantUnion[1];
2281 unionArray->setFConst(0.0f);
2282 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpHigh, EvqConst), (yyvsp[(2) - (4)].lex).line);
2283 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) {
2284 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getStruct())
2285 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getStruct(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getTypeName()));
2286 else
2287 (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()));
2288
2289 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst)
2290 (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConst);
2291 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix() && (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, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize()));
2293 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix())
2294 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize()));
2295 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst)
2296 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqConst));
2297 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector())
2298 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary));
2299 else
2300 (yyval.interm.intermTypedNode)->setType((yyvsp[(1) - (4)].interm.intermTypedNode)->getType());
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002301 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002302 break;
2303
2304 case 10:
2305
2306 {
2307 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002308 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002309 break;
2310
2311 case 11:
2312
2313 {
2314 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isArray()) {
2315 context->error((yyvsp[(3) - (3)].lex).line, "cannot apply dot operator to an array", ".", "");
2316 context->recover();
2317 }
2318
2319 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isVector()) {
2320 TVectorFields fields;
2321 if (! context->parseVectorFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yyvsp[(3) - (3)].lex).line)) {
2322 fields.num = 1;
2323 fields.offsets[0] = 0;
2324 context->recover();
2325 }
2326
2327 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) { // constant folding for vector fields
2328 (yyval.interm.intermTypedNode) = context->addConstVectorNode(fields, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].lex).line);
2329 if ((yyval.interm.intermTypedNode) == 0) {
2330 context->recover();
2331 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2332 }
2333 else
2334 (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()));
2335 } else {
2336 if (fields.num == 1) {
2337 ConstantUnion *unionArray = new ConstantUnion[1];
2338 unionArray->setIConst(fields.offsets[0]);
2339 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line);
2340 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2341 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision()));
2342 } else {
2343 TString vectorString = *(yyvsp[(3) - (3)].lex).string;
2344 TIntermTyped* index = context->intermediate.addSwizzle(fields, (yyvsp[(3) - (3)].lex).line);
2345 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpVectorSwizzle, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2346 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (int) vectorString.size()));
2347 }
2348 }
2349 } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isMatrix()) {
2350 TMatrixFields fields;
2351 if (! context->parseMatrixFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yyvsp[(3) - (3)].lex).line)) {
2352 fields.wholeRow = false;
2353 fields.wholeCol = false;
2354 fields.row = 0;
2355 fields.col = 0;
2356 context->recover();
2357 }
2358
2359 if (fields.wholeRow || fields.wholeCol) {
2360 context->error((yyvsp[(2) - (3)].lex).line, " non-scalar fields not implemented yet", ".", "");
2361 context->recover();
2362 ConstantUnion *unionArray = new ConstantUnion[1];
2363 unionArray->setIConst(0);
2364 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line);
2365 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2366 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(),EvqTemporary, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize()));
2367 } else {
2368 ConstantUnion *unionArray = new ConstantUnion[1];
2369 unionArray->setIConst(fields.col * (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize() + fields.row);
2370 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line);
2371 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2372 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision()));
2373 }
2374 } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType() == EbtStruct) {
2375 bool fieldFound = false;
2376 const TTypeList* fields = (yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getStruct();
2377 if (fields == 0) {
2378 context->error((yyvsp[(2) - (3)].lex).line, "structure has no fields", "Internal Error", "");
2379 context->recover();
2380 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2381 } else {
2382 unsigned int i;
2383 for (i = 0; i < fields->size(); ++i) {
2384 if ((*fields)[i].type->getFieldName() == *(yyvsp[(3) - (3)].lex).string) {
2385 fieldFound = true;
2386 break;
2387 }
2388 }
2389 if (fieldFound) {
2390 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) {
2391 (yyval.interm.intermTypedNode) = context->addConstStruct(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
2392 if ((yyval.interm.intermTypedNode) == 0) {
2393 context->recover();
2394 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2395 }
2396 else {
2397 (yyval.interm.intermTypedNode)->setType(*(*fields)[i].type);
2398 // change the qualifier of the return type, not of the structure field
2399 // as the structure definition is shared between various structures.
2400 (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConst);
2401 }
2402 } else {
2403 ConstantUnion *unionArray = new ConstantUnion[1];
2404 unionArray->setIConst(i);
2405 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, *(*fields)[i].type, (yyvsp[(3) - (3)].lex).line);
2406 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirectStruct, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2407 (yyval.interm.intermTypedNode)->setType(*(*fields)[i].type);
2408 }
2409 } else {
2410 context->error((yyvsp[(2) - (3)].lex).line, " no such field in structure", (yyvsp[(3) - (3)].lex).string->c_str(), "");
2411 context->recover();
2412 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2413 }
2414 }
2415 } else {
2416 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(), "");
2417 context->recover();
2418 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2419 }
2420 // don't delete $3.string, it's from the pool
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002421 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002422 break;
2423
2424 case 12:
2425
2426 {
2427 if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode)))
2428 context->recover();
2429 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostIncrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line, context->symbolTable);
2430 if ((yyval.interm.intermTypedNode) == 0) {
2431 context->unaryOpError((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
2432 context->recover();
2433 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode);
2434 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002435 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002436 break;
2437
2438 case 13:
2439
2440 {
2441 if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode)))
2442 context->recover();
2443 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostDecrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line, context->symbolTable);
2444 if ((yyval.interm.intermTypedNode) == 0) {
2445 context->unaryOpError((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
2446 context->recover();
2447 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode);
2448 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002449 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002450 break;
2451
2452 case 14:
2453
2454 {
2455 if (context->integerErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode), "[]"))
2456 context->recover();
2457 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002458 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002459 break;
2460
2461 case 15:
2462
2463 {
2464 TFunction* fnCall = (yyvsp[(1) - (1)].interm).function;
2465 TOperator op = fnCall->getBuiltInOp();
2466
2467 if (op != EOpNull)
2468 {
2469 //
2470 // Then this should be a constructor.
2471 // Don't go through the symbol table for constructors.
2472 // Their parameters will be verified algorithmically.
2473 //
2474 TType type(EbtVoid, EbpUndefined); // use this to get the type back
2475 if (context->constructorErrorCheck((yyvsp[(1) - (1)].interm).line, (yyvsp[(1) - (1)].interm).intermNode, *fnCall, op, &type)) {
2476 (yyval.interm.intermTypedNode) = 0;
2477 } else {
2478 //
2479 // It's a constructor, of type 'type'.
2480 //
2481 (yyval.interm.intermTypedNode) = context->addConstructor((yyvsp[(1) - (1)].interm).intermNode, &type, op, fnCall, (yyvsp[(1) - (1)].interm).line);
2482 }
2483
2484 if ((yyval.interm.intermTypedNode) == 0) {
2485 context->recover();
2486 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator(0, op, (yyvsp[(1) - (1)].interm).line);
2487 }
2488 (yyval.interm.intermTypedNode)->setType(type);
2489 } else {
2490 //
2491 // Not a constructor. Find it in the symbol table.
2492 //
2493 const TFunction* fnCandidate;
2494 bool builtIn;
2495 fnCandidate = context->findFunction((yyvsp[(1) - (1)].interm).line, fnCall, &builtIn);
2496 if (fnCandidate) {
2497 //
2498 // A declared function.
2499 //
2500 if (builtIn && !fnCandidate->getExtension().empty() &&
2501 context->extensionErrorCheck((yyvsp[(1) - (1)].interm).line, fnCandidate->getExtension())) {
2502 context->recover();
2503 }
2504 op = fnCandidate->getBuiltInOp();
2505 if (builtIn && op != EOpNull) {
2506 //
2507 // A function call mapped to a built-in operation.
2508 //
2509 if (fnCandidate->getParamCount() == 1) {
2510 //
2511 // Treat it like a built-in unary operator.
2512 //
2513 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(op, (yyvsp[(1) - (1)].interm).intermNode, 0, context->symbolTable);
2514 if ((yyval.interm.intermTypedNode) == 0) {
2515 context->error((yyvsp[(1) - (1)].interm).intermNode->getLine(), " wrong operand type", "Internal Error",
2516 "built in unary operator function. Type: %s",
2517 static_cast<TIntermTyped*>((yyvsp[(1) - (1)].interm).intermNode)->getCompleteString().c_str());
2518 YYERROR;
2519 }
2520 } else {
2521 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, op, (yyvsp[(1) - (1)].interm).line);
2522 }
2523 } else {
2524 // This is a real function call
2525
2526 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, EOpFunctionCall, (yyvsp[(1) - (1)].interm).line);
2527 (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType());
2528
2529 // this is how we know whether the given function is a builtIn function or a user defined function
2530 // if builtIn == false, it's a userDefined -> could be an overloaded builtIn function also
2531 // if builtIn == true, it's definitely a builtIn function with EOpNull
2532 if (!builtIn)
2533 (yyval.interm.intermTypedNode)->getAsAggregate()->setUserDefined();
2534 (yyval.interm.intermTypedNode)->getAsAggregate()->setName(fnCandidate->getMangledName());
2535
2536 TQualifier qual;
2537 for (int i = 0; i < fnCandidate->getParamCount(); ++i) {
2538 qual = fnCandidate->getParam(i).type->getQualifier();
2539 if (qual == EvqOut || qual == EvqInOut) {
2540 if (context->lValueErrorCheck((yyval.interm.intermTypedNode)->getLine(), "assign", (yyval.interm.intermTypedNode)->getAsAggregate()->getSequence()[i]->getAsTyped())) {
2541 context->error((yyvsp[(1) - (1)].interm).intermNode->getLine(), "Constant value cannot be passed for 'out' or 'inout' parameters.", "Error", "");
2542 context->recover();
2543 }
2544 }
2545 }
2546 }
2547 (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType());
2548 } else {
2549 // error message was put out by PaFindFunction()
2550 // Put on a dummy node for error recovery
2551 ConstantUnion *unionArray = new ConstantUnion[1];
2552 unionArray->setFConst(0.0f);
2553 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].interm).line);
2554 context->recover();
2555 }
2556 }
2557 delete fnCall;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002558 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002559 break;
2560
2561 case 16:
2562
2563 {
2564 (yyval.interm) = (yyvsp[(1) - (1)].interm);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002565 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002566 break;
2567
2568 case 17:
2569
2570 {
2571 context->error((yyvsp[(3) - (3)].interm).line, "methods are not supported", "", "");
2572 context->recover();
2573 (yyval.interm) = (yyvsp[(3) - (3)].interm);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002574 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002575 break;
2576
2577 case 18:
2578
2579 {
2580 (yyval.interm) = (yyvsp[(1) - (2)].interm);
2581 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002582 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002583 break;
2584
2585 case 19:
2586
2587 {
2588 (yyval.interm) = (yyvsp[(1) - (2)].interm);
2589 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002590 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002591 break;
2592
2593 case 20:
2594
2595 {
2596 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
2597 (yyval.interm).intermNode = 0;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002598 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002599 break;
2600
2601 case 21:
2602
2603 {
2604 (yyval.interm).function = (yyvsp[(1) - (1)].interm.function);
2605 (yyval.interm).intermNode = 0;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002606 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002607 break;
2608
2609 case 22:
2610
2611 {
2612 TParameter param = { 0, new TType((yyvsp[(2) - (2)].interm.intermTypedNode)->getType()) };
2613 (yyvsp[(1) - (2)].interm.function)->addParameter(param);
2614 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
2615 (yyval.interm).intermNode = (yyvsp[(2) - (2)].interm.intermTypedNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002616 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002617 break;
2618
2619 case 23:
2620
2621 {
2622 TParameter param = { 0, new TType((yyvsp[(3) - (3)].interm.intermTypedNode)->getType()) };
2623 (yyvsp[(1) - (3)].interm).function->addParameter(param);
2624 (yyval.interm).function = (yyvsp[(1) - (3)].interm).function;
2625 (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 +00002626 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002627 break;
2628
2629 case 24:
2630
2631 {
2632 (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002633 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002634 break;
2635
2636 case 25:
2637
2638 {
2639 //
2640 // Constructor
2641 //
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002642 TOperator op = EOpNull;
2643 if ((yyvsp[(1) - (1)].interm.type).userDef) {
2644 op = EOpConstructStruct;
2645 } else {
2646 switch ((yyvsp[(1) - (1)].interm.type).type) {
2647 case EbtFloat:
2648 if ((yyvsp[(1) - (1)].interm.type).matrix) {
2649 switch((yyvsp[(1) - (1)].interm.type).size) {
2650 case 2: op = EOpConstructMat2; break;
2651 case 3: op = EOpConstructMat3; break;
2652 case 4: op = EOpConstructMat4; break;
2653 }
2654 } else {
2655 switch((yyvsp[(1) - (1)].interm.type).size) {
2656 case 1: op = EOpConstructFloat; break;
2657 case 2: op = EOpConstructVec2; break;
2658 case 3: op = EOpConstructVec3; break;
2659 case 4: op = EOpConstructVec4; break;
2660 }
2661 }
2662 break;
2663 case EbtInt:
2664 switch((yyvsp[(1) - (1)].interm.type).size) {
2665 case 1: op = EOpConstructInt; break;
2666 case 2: FRAG_VERT_ONLY("ivec2", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec2; break;
2667 case 3: FRAG_VERT_ONLY("ivec3", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec3; break;
2668 case 4: FRAG_VERT_ONLY("ivec4", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec4; break;
2669 }
2670 break;
2671 case EbtBool:
2672 switch((yyvsp[(1) - (1)].interm.type).size) {
2673 case 1: op = EOpConstructBool; break;
2674 case 2: FRAG_VERT_ONLY("bvec2", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec2; break;
2675 case 3: FRAG_VERT_ONLY("bvec3", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec3; break;
2676 case 4: FRAG_VERT_ONLY("bvec4", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec4; break;
2677 }
2678 break;
2679 default: break;
2680 }
2681 if (op == EOpNull) {
2682 context->error((yyvsp[(1) - (1)].interm.type).line, "cannot construct this type", getBasicString((yyvsp[(1) - (1)].interm.type).type), "");
2683 context->recover();
2684 (yyvsp[(1) - (1)].interm.type).type = EbtFloat;
2685 op = EOpConstructFloat;
2686 }
2687 }
2688 TString tempString;
2689 TType type((yyvsp[(1) - (1)].interm.type));
2690 TFunction *function = new TFunction(&tempString, type, op);
2691 (yyval.interm.function) = function;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002692 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002693 break;
2694
2695 case 26:
2696
2697 {
2698 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
2699 context->recover();
2700 TType type(EbtVoid, EbpUndefined);
2701 TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type);
2702 (yyval.interm.function) = function;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002703 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002704 break;
2705
2706 case 27:
2707
2708 {
2709 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
2710 context->recover();
2711 TType type(EbtVoid, EbpUndefined);
2712 TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type);
2713 (yyval.interm.function) = function;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002714 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002715 break;
2716
2717 case 28:
2718
2719 {
2720 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002721 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002722 break;
2723
2724 case 29:
2725
2726 {
2727 if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)))
2728 context->recover();
2729 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreIncrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line, context->symbolTable);
2730 if ((yyval.interm.intermTypedNode) == 0) {
2731 context->unaryOpError((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2732 context->recover();
2733 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2734 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002735 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002736 break;
2737
2738 case 30:
2739
2740 {
2741 if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)))
2742 context->recover();
2743 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreDecrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line, context->symbolTable);
2744 if ((yyval.interm.intermTypedNode) == 0) {
2745 context->unaryOpError((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2746 context->recover();
2747 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2748 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002749 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002750 break;
2751
2752 case 31:
2753
2754 {
2755 if ((yyvsp[(1) - (2)].interm).op != EOpNull) {
2756 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath((yyvsp[(1) - (2)].interm).op, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].interm).line, context->symbolTable);
2757 if ((yyval.interm.intermTypedNode) == 0) {
2758 const char* errorOp = "";
2759 switch((yyvsp[(1) - (2)].interm).op) {
2760 case EOpNegative: errorOp = "-"; break;
2761 case EOpLogicalNot: errorOp = "!"; break;
2762 default: break;
2763 }
2764 context->unaryOpError((yyvsp[(1) - (2)].interm).line, errorOp, (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2765 context->recover();
2766 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2767 }
2768 } else
2769 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002770 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002771 break;
2772
2773 case 32:
2774
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002775 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNull; ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002776 break;
2777
2778 case 33:
2779
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002780 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNegative; ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002781 break;
2782
2783 case 34:
2784
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002785 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpLogicalNot; ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002786 break;
2787
2788 case 35:
2789
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002790 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002791 break;
2792
2793 case 36:
2794
2795 {
2796 FRAG_VERT_ONLY("*", (yyvsp[(2) - (3)].lex).line);
2797 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpMul, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2798 if ((yyval.interm.intermTypedNode) == 0) {
2799 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "*", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2800 context->recover();
2801 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2802 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002803 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002804 break;
2805
2806 case 37:
2807
2808 {
2809 FRAG_VERT_ONLY("/", (yyvsp[(2) - (3)].lex).line);
2810 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpDiv, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2811 if ((yyval.interm.intermTypedNode) == 0) {
2812 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "/", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2813 context->recover();
2814 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2815 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002816 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002817 break;
2818
2819 case 38:
2820
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002821 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002822 break;
2823
2824 case 39:
2825
2826 {
2827 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpAdd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2828 if ((yyval.interm.intermTypedNode) == 0) {
2829 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "+", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2830 context->recover();
2831 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2832 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002833 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002834 break;
2835
2836 case 40:
2837
2838 {
2839 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpSub, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2840 if ((yyval.interm.intermTypedNode) == 0) {
2841 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "-", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2842 context->recover();
2843 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2844 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002845 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002846 break;
2847
2848 case 41:
2849
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002850 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002851 break;
2852
2853 case 42:
2854
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002855 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002856 break;
2857
2858 case 43:
2859
2860 {
2861 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2862 if ((yyval.interm.intermTypedNode) == 0) {
2863 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2864 context->recover();
2865 ConstantUnion *unionArray = new ConstantUnion[1];
2866 unionArray->setBConst(false);
2867 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2868 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002869 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002870 break;
2871
2872 case 44:
2873
2874 {
2875 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2876 if ((yyval.interm.intermTypedNode) == 0) {
2877 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2878 context->recover();
2879 ConstantUnion *unionArray = new ConstantUnion[1];
2880 unionArray->setBConst(false);
2881 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2882 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002883 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002884 break;
2885
2886 case 45:
2887
2888 {
2889 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2890 if ((yyval.interm.intermTypedNode) == 0) {
2891 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2892 context->recover();
2893 ConstantUnion *unionArray = new ConstantUnion[1];
2894 unionArray->setBConst(false);
2895 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2896 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002897 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002898 break;
2899
2900 case 46:
2901
2902 {
2903 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2904 if ((yyval.interm.intermTypedNode) == 0) {
2905 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2906 context->recover();
2907 ConstantUnion *unionArray = new ConstantUnion[1];
2908 unionArray->setBConst(false);
2909 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2910 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002911 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002912 break;
2913
2914 case 47:
2915
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002916 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002917 break;
2918
2919 case 48:
2920
2921 {
2922 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2923 if ((yyval.interm.intermTypedNode) == 0) {
2924 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "==", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2925 context->recover();
2926 ConstantUnion *unionArray = new ConstantUnion[1];
2927 unionArray->setBConst(false);
2928 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2929 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002930 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002931 break;
2932
2933 case 49:
2934
2935 {
2936 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpNotEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2937 if ((yyval.interm.intermTypedNode) == 0) {
2938 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "!=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2939 context->recover();
2940 ConstantUnion *unionArray = new ConstantUnion[1];
2941 unionArray->setBConst(false);
2942 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2943 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002944 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002945 break;
2946
2947 case 50:
2948
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002949 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002950 break;
2951
2952 case 51:
2953
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002954 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002955 break;
2956
2957 case 52:
2958
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002959 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002960 break;
2961
2962 case 53:
2963
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002964 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002965 break;
2966
2967 case 54:
2968
2969 {
2970 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalAnd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2971 if ((yyval.interm.intermTypedNode) == 0) {
2972 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "&&", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2973 context->recover();
2974 ConstantUnion *unionArray = new ConstantUnion[1];
2975 unionArray->setBConst(false);
2976 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2977 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002978 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002979 break;
2980
2981 case 55:
2982
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002983 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002984 break;
2985
2986 case 56:
2987
2988 {
2989 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalXor, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2990 if ((yyval.interm.intermTypedNode) == 0) {
2991 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "^^", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2992 context->recover();
2993 ConstantUnion *unionArray = new ConstantUnion[1];
2994 unionArray->setBConst(false);
2995 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2996 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002997 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002998 break;
2999
3000 case 57:
3001
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003002 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003003 break;
3004
3005 case 58:
3006
3007 {
3008 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalOr, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
3009 if ((yyval.interm.intermTypedNode) == 0) {
3010 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "||", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3011 context->recover();
3012 ConstantUnion *unionArray = new ConstantUnion[1];
3013 unionArray->setBConst(false);
3014 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
3015 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003016 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003017 break;
3018
3019 case 59:
3020
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003021 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003022 break;
3023
3024 case 60:
3025
3026 {
3027 if (context->boolErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.intermTypedNode)))
3028 context->recover();
3029
3030 (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);
3031 if ((yyvsp[(3) - (5)].interm.intermTypedNode)->getType() != (yyvsp[(5) - (5)].interm.intermTypedNode)->getType())
3032 (yyval.interm.intermTypedNode) = 0;
3033
3034 if ((yyval.interm.intermTypedNode) == 0) {
3035 context->binaryOpError((yyvsp[(2) - (5)].lex).line, ":", (yyvsp[(3) - (5)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(5) - (5)].interm.intermTypedNode)->getCompleteString());
3036 context->recover();
3037 (yyval.interm.intermTypedNode) = (yyvsp[(5) - (5)].interm.intermTypedNode);
3038 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003039 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003040 break;
3041
3042 case 61:
3043
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003044 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003045 break;
3046
3047 case 62:
3048
3049 {
3050 if (context->lValueErrorCheck((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)))
3051 context->recover();
3052 (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);
3053 if ((yyval.interm.intermTypedNode) == 0) {
3054 context->assignError((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3055 context->recover();
3056 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
3057 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003058 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003059 break;
3060
3061 case 63:
3062
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003063 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAssign; ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003064 break;
3065
3066 case 64:
3067
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003068 { 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 +00003069 break;
3070
3071 case 65:
3072
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003073 { 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 +00003074 break;
3075
3076 case 66:
3077
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003078 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAddAssign; ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003079 break;
3080
3081 case 67:
3082
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003083 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpSubAssign; ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003084 break;
3085
3086 case 68:
3087
3088 {
3089 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003090 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003091 break;
3092
3093 case 69:
3094
3095 {
3096 (yyval.interm.intermTypedNode) = context->intermediate.addComma((yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
3097 if ((yyval.interm.intermTypedNode) == 0) {
3098 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ",", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3099 context->recover();
3100 (yyval.interm.intermTypedNode) = (yyvsp[(3) - (3)].interm.intermTypedNode);
3101 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003102 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003103 break;
3104
3105 case 70:
3106
3107 {
3108 if (context->constErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)))
3109 context->recover();
3110 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003111 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003112 break;
3113
3114 case 71:
3115
3116 {
3117 TFunction &function = *((yyvsp[(1) - (2)].interm).function);
3118
3119 TIntermAggregate *prototype = new TIntermAggregate;
3120 prototype->setType(function.getReturnType());
3121 prototype->setName(function.getName());
3122
3123 for (int i = 0; i < function.getParamCount(); i++)
3124 {
3125 const TParameter &param = function.getParam(i);
3126 if (param.name != 0)
3127 {
3128 TVariable *variable = new TVariable(param.name, *param.type);
3129
3130 prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(variable->getUniqueId(), variable->getName(), variable->getType(), (yyvsp[(1) - (2)].interm).line), (yyvsp[(1) - (2)].interm).line);
3131 }
3132 else
3133 {
3134 prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (2)].interm).line), (yyvsp[(1) - (2)].interm).line);
3135 }
3136 }
3137
3138 prototype->setOp(EOpPrototype);
3139 (yyval.interm.intermNode) = prototype;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003140 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003141 break;
3142
3143 case 72:
3144
3145 {
3146 if ((yyvsp[(1) - (2)].interm).intermAggregate)
3147 (yyvsp[(1) - (2)].interm).intermAggregate->setOp(EOpDeclaration);
3148 (yyval.interm.intermNode) = (yyvsp[(1) - (2)].interm).intermAggregate;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003149 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003150 break;
3151
3152 case 73:
3153
3154 {
3155 context->symbolTable.setDefaultPrecision( (yyvsp[(3) - (4)].interm.type).type, (yyvsp[(2) - (4)].interm.precision) );
3156 (yyval.interm.intermNode) = 0;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003157 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003158 break;
3159
3160 case 74:
3161
3162 {
3163 //
3164 // Multiple declarations of the same function are allowed.
3165 //
3166 // If this is a definition, the definition production code will check for redefinitions
3167 // (we don't know at this point if it's a definition or not).
3168 //
3169 // Redeclarations are allowed. But, return types and parameter qualifiers must match.
3170 //
3171 TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find((yyvsp[(1) - (2)].interm.function)->getMangledName()));
3172 if (prevDec) {
3173 if (prevDec->getReturnType() != (yyvsp[(1) - (2)].interm.function)->getReturnType()) {
3174 context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same return type", (yyvsp[(1) - (2)].interm.function)->getReturnType().getBasicString(), "");
3175 context->recover();
3176 }
3177 for (int i = 0; i < prevDec->getParamCount(); ++i) {
3178 if (prevDec->getParam(i).type->getQualifier() != (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifier()) {
3179 context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same parameter qualifiers", (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifierString(), "");
3180 context->recover();
3181 }
3182 }
3183 }
3184
3185 //
3186 // If this is a redeclaration, it could also be a definition,
3187 // in which case, we want to use the variable names from this one, and not the one that's
3188 // being redeclared. So, pass back up this declaration, not the one in the symbol table.
3189 //
3190 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
3191 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
3192
3193 context->symbolTable.insert(*(yyval.interm).function);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003194 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003195 break;
3196
3197 case 75:
3198
3199 {
3200 (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003201 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003202 break;
3203
3204 case 76:
3205
3206 {
3207 (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003208 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003209 break;
3210
3211 case 77:
3212
3213 {
3214 // Add the parameter
3215 (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
3216 if ((yyvsp[(2) - (2)].interm).param.type->getBasicType() != EbtVoid)
3217 (yyvsp[(1) - (2)].interm.function)->addParameter((yyvsp[(2) - (2)].interm).param);
3218 else
3219 delete (yyvsp[(2) - (2)].interm).param.type;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003220 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003221 break;
3222
3223 case 78:
3224
3225 {
3226 //
3227 // Only first parameter of one-parameter functions can be void
3228 // The check for named parameters not being void is done in parameter_declarator
3229 //
3230 if ((yyvsp[(3) - (3)].interm).param.type->getBasicType() == EbtVoid) {
3231 //
3232 // This parameter > first is void
3233 //
3234 context->error((yyvsp[(2) - (3)].lex).line, "cannot be an argument type except for '(void)'", "void", "");
3235 context->recover();
3236 delete (yyvsp[(3) - (3)].interm).param.type;
3237 } else {
3238 // Add the parameter
3239 (yyval.interm.function) = (yyvsp[(1) - (3)].interm.function);
3240 (yyvsp[(1) - (3)].interm.function)->addParameter((yyvsp[(3) - (3)].interm).param);
3241 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003242 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003243 break;
3244
3245 case 79:
3246
3247 {
3248 if ((yyvsp[(1) - (3)].interm.type).qualifier != EvqGlobal && (yyvsp[(1) - (3)].interm.type).qualifier != EvqTemporary) {
3249 context->error((yyvsp[(2) - (3)].lex).line, "no qualifiers allowed for function return", getQualifierString((yyvsp[(1) - (3)].interm.type).qualifier), "");
3250 context->recover();
3251 }
3252 // make sure a sampler is not involved as well...
3253 if (context->structQualifierErrorCheck((yyvsp[(2) - (3)].lex).line, (yyvsp[(1) - (3)].interm.type)))
3254 context->recover();
3255
3256 // Add the function as a prototype after parsing it (we do not support recursion)
3257 TFunction *function;
3258 TType type((yyvsp[(1) - (3)].interm.type));
3259 function = new TFunction((yyvsp[(2) - (3)].lex).string, type);
3260 (yyval.interm.function) = function;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003261 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003262 break;
3263
3264 case 80:
3265
3266 {
3267 if ((yyvsp[(1) - (2)].interm.type).type == EbtVoid) {
3268 context->error((yyvsp[(2) - (2)].lex).line, "illegal use of type 'void'", (yyvsp[(2) - (2)].lex).string->c_str(), "");
3269 context->recover();
3270 }
3271 if (context->reservedErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string))
3272 context->recover();
3273 TParameter param = {(yyvsp[(2) - (2)].lex).string, new TType((yyvsp[(1) - (2)].interm.type))};
3274 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
3275 (yyval.interm).param = param;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003276 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003277 break;
3278
3279 case 81:
3280
3281 {
3282 // Check that we can make an array out of this type
3283 if (context->arrayTypeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
3284 context->recover();
3285
3286 if (context->reservedErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string))
3287 context->recover();
3288
3289 int size;
3290 if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3291 context->recover();
3292 (yyvsp[(1) - (5)].interm.type).setArray(true, size);
3293
3294 TType* type = new TType((yyvsp[(1) - (5)].interm.type));
3295 TParameter param = { (yyvsp[(2) - (5)].lex).string, type };
3296 (yyval.interm).line = (yyvsp[(2) - (5)].lex).line;
3297 (yyval.interm).param = param;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003298 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003299 break;
3300
3301 case 82:
3302
3303 {
3304 (yyval.interm) = (yyvsp[(3) - (3)].interm);
3305 if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
3306 context->recover();
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003307 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003308 break;
3309
3310 case 83:
3311
3312 {
3313 (yyval.interm) = (yyvsp[(2) - (2)].interm);
3314 if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
3315 context->recover();
3316 if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
3317 context->recover();
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003318 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003319 break;
3320
3321 case 84:
3322
3323 {
3324 (yyval.interm) = (yyvsp[(3) - (3)].interm);
3325 if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
3326 context->recover();
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003327 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003328 break;
3329
3330 case 85:
3331
3332 {
3333 (yyval.interm) = (yyvsp[(2) - (2)].interm);
3334 if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
3335 context->recover();
3336 if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
3337 context->recover();
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003338 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003339 break;
3340
3341 case 86:
3342
3343 {
3344 (yyval.interm.qualifier) = EvqIn;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003345 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003346 break;
3347
3348 case 87:
3349
3350 {
3351 (yyval.interm.qualifier) = EvqIn;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003352 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003353 break;
3354
3355 case 88:
3356
3357 {
3358 (yyval.interm.qualifier) = EvqOut;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003359 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003360 break;
3361
3362 case 89:
3363
3364 {
3365 (yyval.interm.qualifier) = EvqInOut;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003366 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003367 break;
3368
3369 case 90:
3370
3371 {
3372 TParameter param = { 0, new TType((yyvsp[(1) - (1)].interm.type)) };
3373 (yyval.interm).param = param;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003374 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003375 break;
3376
3377 case 91:
3378
3379 {
3380 (yyval.interm) = (yyvsp[(1) - (1)].interm);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003381 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003382 break;
3383
3384 case 92:
3385
3386 {
zmo@google.comfd747b82011-04-23 01:30:07 +00003387 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(3) - (3)].lex).string, TType((yyvsp[(1) - (3)].interm).type), (yyvsp[(3) - (3)].lex).line);
3388 (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 +00003389
3390 if (context->structQualifierErrorCheck((yyvsp[(3) - (3)].lex).line, (yyval.interm).type))
3391 context->recover();
3392
3393 if (context->nonInitConstErrorCheck((yyvsp[(3) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyval.interm).type))
3394 context->recover();
3395
zmo@google.comfd747b82011-04-23 01:30:07 +00003396 TVariable* variable = 0;
3397 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 +00003398 context->recover();
zmo@google.comfd747b82011-04-23 01:30:07 +00003399 if (symbol && variable)
3400 symbol->setId(variable->getUniqueId());
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003401 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003402 break;
3403
3404 case 93:
3405
3406 {
3407 if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
3408 context->recover();
3409
3410 if (context->nonInitConstErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type))
3411 context->recover();
3412
3413 (yyval.interm) = (yyvsp[(1) - (5)].interm);
3414
3415 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))
3416 context->recover();
3417 else {
3418 (yyvsp[(1) - (5)].interm).type.setArray(true);
3419 TVariable* variable;
3420 if (context->arrayErrorCheck((yyvsp[(4) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, variable))
3421 context->recover();
3422 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003423 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003424 break;
3425
3426 case 94:
3427
3428 {
3429 if (context->structQualifierErrorCheck((yyvsp[(3) - (6)].lex).line, (yyvsp[(1) - (6)].interm).type))
3430 context->recover();
3431
3432 if (context->nonInitConstErrorCheck((yyvsp[(3) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type))
3433 context->recover();
3434
3435 (yyval.interm) = (yyvsp[(1) - (6)].interm);
3436
3437 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))
3438 context->recover();
3439 else {
3440 int size;
3441 if (context->arraySizeErrorCheck((yyvsp[(4) - (6)].lex).line, (yyvsp[(5) - (6)].interm.intermTypedNode), size))
3442 context->recover();
3443 (yyvsp[(1) - (6)].interm).type.setArray(true, size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003444 TVariable* variable = 0;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003445 if (context->arrayErrorCheck((yyvsp[(4) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type, variable))
3446 context->recover();
3447 TType type = TType((yyvsp[(1) - (6)].interm).type);
3448 type.setArraySize(size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003449 (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 +00003450 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003451 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003452 break;
3453
3454 case 95:
3455
3456 {
3457 if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
3458 context->recover();
3459
3460 (yyval.interm) = (yyvsp[(1) - (5)].interm);
3461
3462 TIntermNode* intermNode;
3463 if (!context->executeInitializer((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, (yyvsp[(5) - (5)].interm.intermTypedNode), intermNode)) {
3464 //
3465 // build the intermediate representation
3466 //
3467 if (intermNode)
3468 (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (5)].interm).intermNode, intermNode, (yyvsp[(4) - (5)].lex).line);
3469 else
3470 (yyval.interm).intermAggregate = (yyvsp[(1) - (5)].interm).intermAggregate;
3471 } else {
3472 context->recover();
3473 (yyval.interm).intermAggregate = 0;
3474 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003475 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003476 break;
3477
3478 case 96:
3479
3480 {
3481 (yyval.interm).type = (yyvsp[(1) - (1)].interm.type);
3482 (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 +00003483 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003484 break;
3485
3486 case 97:
3487
3488 {
zmo@google.comfd747b82011-04-23 01:30:07 +00003489 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyvsp[(1) - (2)].interm.type)), (yyvsp[(2) - (2)].lex).line);
3490 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (2)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003491
3492 if (context->structQualifierErrorCheck((yyvsp[(2) - (2)].lex).line, (yyval.interm).type))
3493 context->recover();
3494
3495 if (context->nonInitConstErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string, (yyval.interm).type))
3496 context->recover();
3497
3498 (yyval.interm).type = (yyvsp[(1) - (2)].interm.type);
3499
zmo@google.comfd747b82011-04-23 01:30:07 +00003500 TVariable* variable = 0;
3501 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 +00003502 context->recover();
zmo@google.comfd747b82011-04-23 01:30:07 +00003503 if (variable && symbol)
3504 symbol->setId(variable->getUniqueId());
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003505 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003506 break;
3507
3508 case 98:
3509
3510 {
kbr@chromium.org04277b82011-06-02 18:41:26 +00003511 context->error((yyvsp[(2) - (4)].lex).line, "unsized array declarations not supported", (yyvsp[(2) - (4)].lex).string->c_str(), "");
3512 context->recover();
3513
zmo@google.comfd747b82011-04-23 01:30:07 +00003514 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (4)].lex).string, TType((yyvsp[(1) - (4)].interm.type)), (yyvsp[(2) - (4)].lex).line);
3515 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (4)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003516 (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003517 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003518 break;
3519
3520 case 99:
3521
3522 {
3523 TType type = TType((yyvsp[(1) - (5)].interm.type));
3524 int size;
3525 if (context->arraySizeErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3526 context->recover();
3527 type.setArraySize(size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003528 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (5)].lex).string, type, (yyvsp[(2) - (5)].lex).line);
3529 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (5)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003530
3531 if (context->structQualifierErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
3532 context->recover();
3533
3534 if (context->nonInitConstErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type)))
3535 context->recover();
3536
3537 (yyval.interm).type = (yyvsp[(1) - (5)].interm.type);
3538
3539 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)))
3540 context->recover();
3541 else {
3542 int size;
3543 if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3544 context->recover();
3545
3546 (yyvsp[(1) - (5)].interm.type).setArray(true, size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003547 TVariable* variable = 0;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003548 if (context->arrayErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type), variable))
3549 context->recover();
zmo@google.comfd747b82011-04-23 01:30:07 +00003550 if (variable && symbol)
3551 symbol->setId(variable->getUniqueId());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003552 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003553 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003554 break;
3555
3556 case 100:
3557
3558 {
3559 if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
3560 context->recover();
3561
3562 (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
3563
3564 TIntermNode* intermNode;
3565 if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode)) {
3566 //
3567 // Build intermediate representation
3568 //
3569 if(intermNode)
3570 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(intermNode, (yyvsp[(3) - (4)].lex).line);
3571 else
3572 (yyval.interm).intermAggregate = 0;
3573 } else {
3574 context->recover();
3575 (yyval.interm).intermAggregate = 0;
3576 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003577 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003578 break;
3579
3580 case 101:
3581
3582 {
3583 VERTEX_ONLY("invariant declaration", (yyvsp[(1) - (2)].lex).line);
3584 (yyval.interm).qualifier = EvqInvariantVaryingOut;
3585 (yyval.interm).intermAggregate = 0;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003586 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003587 break;
3588
3589 case 102:
3590
3591 {
3592 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3593
3594 if ((yyvsp[(1) - (1)].interm.type).array) {
3595 context->error((yyvsp[(1) - (1)].interm.type).line, "not supported", "first-class array", "");
3596 context->recover();
3597 (yyvsp[(1) - (1)].interm.type).setArray(false);
3598 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003599 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003600 break;
3601
3602 case 103:
3603
3604 {
3605 if ((yyvsp[(2) - (2)].interm.type).array) {
3606 context->error((yyvsp[(2) - (2)].interm.type).line, "not supported", "first-class array", "");
3607 context->recover();
3608 (yyvsp[(2) - (2)].interm.type).setArray(false);
3609 }
3610
3611 if ((yyvsp[(1) - (2)].interm.type).qualifier == EvqAttribute &&
3612 ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
3613 context->error((yyvsp[(2) - (2)].interm.type).line, "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier), "");
3614 context->recover();
3615 }
3616 if (((yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingIn || (yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingOut) &&
3617 ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
3618 context->error((yyvsp[(2) - (2)].interm.type).line, "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier), "");
3619 context->recover();
3620 }
3621 (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
3622 (yyval.interm.type).qualifier = (yyvsp[(1) - (2)].interm.type).qualifier;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003623 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003624 break;
3625
3626 case 104:
3627
3628 {
3629 (yyval.interm.type).setBasic(EbtVoid, EvqConst, (yyvsp[(1) - (1)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003630 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003631 break;
3632
3633 case 105:
3634
3635 {
3636 VERTEX_ONLY("attribute", (yyvsp[(1) - (1)].lex).line);
3637 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "attribute"))
3638 context->recover();
3639 (yyval.interm.type).setBasic(EbtVoid, EvqAttribute, (yyvsp[(1) - (1)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003640 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003641 break;
3642
3643 case 106:
3644
3645 {
3646 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "varying"))
3647 context->recover();
3648 if (context->shaderType == SH_VERTEX_SHADER)
3649 (yyval.interm.type).setBasic(EbtVoid, EvqVaryingOut, (yyvsp[(1) - (1)].lex).line);
3650 else
3651 (yyval.interm.type).setBasic(EbtVoid, EvqVaryingIn, (yyvsp[(1) - (1)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003652 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003653 break;
3654
3655 case 107:
3656
3657 {
3658 if (context->globalErrorCheck((yyvsp[(1) - (2)].lex).line, context->symbolTable.atGlobalLevel(), "invariant varying"))
3659 context->recover();
3660 if (context->shaderType == SH_VERTEX_SHADER)
3661 (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingOut, (yyvsp[(1) - (2)].lex).line);
3662 else
3663 (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingIn, (yyvsp[(1) - (2)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003664 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003665 break;
3666
3667 case 108:
3668
3669 {
3670 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "uniform"))
3671 context->recover();
3672 (yyval.interm.type).setBasic(EbtVoid, EvqUniform, (yyvsp[(1) - (1)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003673 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003674 break;
3675
3676 case 109:
3677
3678 {
3679 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
zmo@google.comdc4b4f82011-06-17 00:42:53 +00003680
3681 if ((yyval.interm.type).precision == EbpUndefined) {
3682 (yyval.interm.type).precision = context->symbolTable.getDefaultPrecision((yyvsp[(1) - (1)].interm.type).type);
3683 if (context->precisionErrorCheck((yyvsp[(1) - (1)].interm.type).line, (yyval.interm.type).precision, (yyvsp[(1) - (1)].interm.type).type)) {
3684 context->recover();
3685 }
3686 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003687 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003688 break;
3689
3690 case 110:
3691
3692 {
3693 (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
3694 (yyval.interm.type).precision = (yyvsp[(1) - (2)].interm.precision);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003695 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003696 break;
3697
3698 case 111:
3699
3700 {
3701 (yyval.interm.precision) = EbpHigh;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003702 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003703 break;
3704
3705 case 112:
3706
3707 {
3708 (yyval.interm.precision) = EbpMedium;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003709 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003710 break;
3711
3712 case 113:
3713
3714 {
3715 (yyval.interm.precision) = EbpLow;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003716 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003717 break;
3718
3719 case 114:
3720
3721 {
3722 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003723 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003724 break;
3725
3726 case 115:
3727
3728 {
3729 (yyval.interm.type) = (yyvsp[(1) - (4)].interm.type);
3730
3731 if (context->arrayTypeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
3732 context->recover();
3733 else {
3734 int size;
3735 if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
3736 context->recover();
3737 (yyval.interm.type).setArray(true, size);
3738 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003739 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003740 break;
3741
3742 case 116:
3743
3744 {
3745 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3746 (yyval.interm.type).setBasic(EbtVoid, qual, (yyvsp[(1) - (1)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003747 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003748 break;
3749
3750 case 117:
3751
3752 {
3753 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3754 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003755 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003756 break;
3757
3758 case 118:
3759
3760 {
3761 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3762 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003763 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003764 break;
3765
3766 case 119:
3767
3768 {
3769 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3770 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003771 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003772 break;
3773
3774 case 120:
3775
3776 {
3777 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3778 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3779 (yyval.interm.type).setAggregate(2);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003780 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003781 break;
3782
3783 case 121:
3784
3785 {
3786 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3787 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3788 (yyval.interm.type).setAggregate(3);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003789 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003790 break;
3791
3792 case 122:
3793
3794 {
3795 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3796 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3797 (yyval.interm.type).setAggregate(4);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003798 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003799 break;
3800
3801 case 123:
3802
3803 {
3804 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3805 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3806 (yyval.interm.type).setAggregate(2);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003807 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003808 break;
3809
3810 case 124:
3811
3812 {
3813 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3814 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3815 (yyval.interm.type).setAggregate(3);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003816 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003817 break;
3818
3819 case 125:
3820
3821 {
3822 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3823 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3824 (yyval.interm.type).setAggregate(4);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003825 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003826 break;
3827
3828 case 126:
3829
3830 {
3831 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3832 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3833 (yyval.interm.type).setAggregate(2);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003834 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003835 break;
3836
3837 case 127:
3838
3839 {
3840 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3841 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3842 (yyval.interm.type).setAggregate(3);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003843 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003844 break;
3845
3846 case 128:
3847
3848 {
3849 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3850 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3851 (yyval.interm.type).setAggregate(4);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003852 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003853 break;
3854
3855 case 129:
3856
3857 {
3858 FRAG_VERT_ONLY("mat2", (yyvsp[(1) - (1)].lex).line);
3859 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3860 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3861 (yyval.interm.type).setAggregate(2, true);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003862 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003863 break;
3864
3865 case 130:
3866
3867 {
3868 FRAG_VERT_ONLY("mat3", (yyvsp[(1) - (1)].lex).line);
3869 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3870 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3871 (yyval.interm.type).setAggregate(3, true);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003872 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003873 break;
3874
3875 case 131:
3876
3877 {
3878 FRAG_VERT_ONLY("mat4", (yyvsp[(1) - (1)].lex).line);
3879 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3880 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3881 (yyval.interm.type).setAggregate(4, true);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003882 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003883 break;
3884
3885 case 132:
3886
3887 {
3888 FRAG_VERT_ONLY("sampler2D", (yyvsp[(1) - (1)].lex).line);
3889 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3890 (yyval.interm.type).setBasic(EbtSampler2D, qual, (yyvsp[(1) - (1)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003891 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003892 break;
3893
3894 case 133:
3895
3896 {
3897 FRAG_VERT_ONLY("samplerCube", (yyvsp[(1) - (1)].lex).line);
3898 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3899 (yyval.interm.type).setBasic(EbtSamplerCube, qual, (yyvsp[(1) - (1)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003900 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003901 break;
3902
3903 case 134:
3904
3905 {
zmo@google.com09c323a2011-08-12 18:22:25 +00003906 if (!context->supportsExtension("GL_OES_EGL_image_external")) {
3907 context->error((yyvsp[(1) - (1)].lex).line, "unsupported type", "samplerExternalOES", "");
3908 context->recover();
3909 }
3910 FRAG_VERT_ONLY("samplerExternalOES", (yyvsp[(1) - (1)].lex).line);
3911 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3912 (yyval.interm.type).setBasic(EbtSamplerExternalOES, qual, (yyvsp[(1) - (1)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003913 ;}
zmo@google.com09c323a2011-08-12 18:22:25 +00003914 break;
3915
3916 case 135:
3917
3918 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00003919 if (!context->supportsExtension("GL_ARB_texture_rectangle")) {
3920 context->error((yyvsp[(1) - (1)].lex).line, "unsupported type", "sampler2DRect", "");
3921 context->recover();
3922 }
3923 FRAG_VERT_ONLY("sampler2DRect", (yyvsp[(1) - (1)].lex).line);
3924 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3925 (yyval.interm.type).setBasic(EbtSampler2DRect, qual, (yyvsp[(1) - (1)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003926 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003927 break;
3928
zmo@google.com09c323a2011-08-12 18:22:25 +00003929 case 136:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003930
3931 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00003932 FRAG_VERT_ONLY("struct", (yyvsp[(1) - (1)].interm.type).line);
3933 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3934 (yyval.interm.type).qualifier = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003935 ;}
kbr@chromium.org205fef32011-11-22 20:50:02 +00003936 break;
3937
3938 case 137:
3939
3940 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003941 //
3942 // This is for user defined type names. The lexical phase looked up the
3943 // type.
3944 //
3945 TType& structure = static_cast<TVariable*>((yyvsp[(1) - (1)].lex).symbol)->getType();
3946 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3947 (yyval.interm.type).setBasic(EbtStruct, qual, (yyvsp[(1) - (1)].lex).line);
3948 (yyval.interm.type).userDef = &structure;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003949 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003950 break;
3951
zmo@google.com09c323a2011-08-12 18:22:25 +00003952 case 138:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003953
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003954 { if (context->enterStructDeclaration((yyvsp[(2) - (3)].lex).line, *(yyvsp[(2) - (3)].lex).string)) context->recover(); ;}
kbr@chromium.org205fef32011-11-22 20:50:02 +00003955 break;
3956
3957 case 139:
3958
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003959 {
kbr@chromium.org476541f2011-10-27 21:14:51 +00003960 if (context->reservedErrorCheck((yyvsp[(2) - (6)].lex).line, *(yyvsp[(2) - (6)].lex).string))
3961 context->recover();
3962
3963 TType* structure = new TType((yyvsp[(5) - (6)].interm.typeList), *(yyvsp[(2) - (6)].lex).string);
3964 TVariable* userTypeDef = new TVariable((yyvsp[(2) - (6)].lex).string, *structure, true);
3965 if (! context->symbolTable.insert(*userTypeDef)) {
3966 context->error((yyvsp[(2) - (6)].lex).line, "redefinition", (yyvsp[(2) - (6)].lex).string->c_str(), "struct");
3967 context->recover();
3968 }
3969 (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (6)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003970 (yyval.interm.type).userDef = structure;
kbr@chromium.org476541f2011-10-27 21:14:51 +00003971 context->exitStructDeclaration();
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003972 ;}
kbr@chromium.org476541f2011-10-27 21:14:51 +00003973 break;
3974
3975 case 140:
3976
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003977 { if (context->enterStructDeclaration((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string)) context->recover(); ;}
kbr@chromium.org205fef32011-11-22 20:50:02 +00003978 break;
3979
3980 case 141:
3981
kbr@chromium.org476541f2011-10-27 21:14:51 +00003982 {
3983 TType* structure = new TType((yyvsp[(4) - (5)].interm.typeList), TString(""));
3984 (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (5)].lex).line);
3985 (yyval.interm.type).userDef = structure;
3986 context->exitStructDeclaration();
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003987 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003988 break;
3989
kbr@chromium.org476541f2011-10-27 21:14:51 +00003990 case 142:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003991
3992 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00003993 (yyval.interm.typeList) = (yyvsp[(1) - (1)].interm.typeList);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003994 ;}
kbr@chromium.org205fef32011-11-22 20:50:02 +00003995 break;
3996
3997 case 143:
3998
3999 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004000 (yyval.interm.typeList) = (yyvsp[(1) - (2)].interm.typeList);
4001 for (unsigned int i = 0; i < (yyvsp[(2) - (2)].interm.typeList)->size(); ++i) {
4002 for (unsigned int j = 0; j < (yyval.interm.typeList)->size(); ++j) {
4003 if ((*(yyval.interm.typeList))[j].type->getFieldName() == (*(yyvsp[(2) - (2)].interm.typeList))[i].type->getFieldName()) {
4004 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());
4005 context->recover();
4006 }
4007 }
4008 (yyval.interm.typeList)->push_back((*(yyvsp[(2) - (2)].interm.typeList))[i]);
4009 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004010 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004011 break;
4012
kbr@chromium.org205fef32011-11-22 20:50:02 +00004013 case 144:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004014
4015 {
4016 (yyval.interm.typeList) = (yyvsp[(2) - (3)].interm.typeList);
4017
4018 if (context->voidErrorCheck((yyvsp[(1) - (3)].interm.type).line, (*(yyvsp[(2) - (3)].interm.typeList))[0].type->getFieldName(), (yyvsp[(1) - (3)].interm.type))) {
4019 context->recover();
4020 }
4021 for (unsigned int i = 0; i < (yyval.interm.typeList)->size(); ++i) {
4022 //
4023 // Careful not to replace already known aspects of type, like array-ness
4024 //
4025 TType* type = (*(yyval.interm.typeList))[i].type;
4026 type->setBasicType((yyvsp[(1) - (3)].interm.type).type);
4027 type->setNominalSize((yyvsp[(1) - (3)].interm.type).size);
4028 type->setMatrix((yyvsp[(1) - (3)].interm.type).matrix);
zmo@google.comdc4b4f82011-06-17 00:42:53 +00004029 type->setPrecision((yyvsp[(1) - (3)].interm.type).precision);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004030
4031 // don't allow arrays of arrays
4032 if (type->isArray()) {
4033 if (context->arrayTypeErrorCheck((yyvsp[(1) - (3)].interm.type).line, (yyvsp[(1) - (3)].interm.type)))
4034 context->recover();
4035 }
4036 if ((yyvsp[(1) - (3)].interm.type).array)
4037 type->setArraySize((yyvsp[(1) - (3)].interm.type).arraySize);
4038 if ((yyvsp[(1) - (3)].interm.type).userDef) {
4039 type->setStruct((yyvsp[(1) - (3)].interm.type).userDef->getStruct());
4040 type->setTypeName((yyvsp[(1) - (3)].interm.type).userDef->getTypeName());
4041 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004042
4043 if (context->structNestingErrorCheck((yyvsp[(1) - (3)].interm.type).line, *type)) {
4044 context->recover();
4045 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004046 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004047 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004048 break;
4049
kbr@chromium.org476541f2011-10-27 21:14:51 +00004050 case 145:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004051
4052 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004053 (yyval.interm.typeList) = NewPoolTTypeList();
4054 (yyval.interm.typeList)->push_back((yyvsp[(1) - (1)].interm.typeLine));
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004055 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004056 break;
4057
kbr@chromium.org476541f2011-10-27 21:14:51 +00004058 case 146:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004059
4060 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004061 (yyval.interm.typeList)->push_back((yyvsp[(3) - (3)].interm.typeLine));
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004062 ;}
kbr@chromium.org205fef32011-11-22 20:50:02 +00004063 break;
4064
4065 case 147:
4066
4067 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004068 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
4069 context->recover();
4070
4071 (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
4072 (yyval.interm.typeLine).line = (yyvsp[(1) - (1)].lex).line;
4073 (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (1)].lex).string);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004074 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004075 break;
4076
kbr@chromium.org205fef32011-11-22 20:50:02 +00004077 case 148:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004078
4079 {
4080 if (context->reservedErrorCheck((yyvsp[(1) - (4)].lex).line, *(yyvsp[(1) - (4)].lex).string))
4081 context->recover();
4082
4083 (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
4084 (yyval.interm.typeLine).line = (yyvsp[(1) - (4)].lex).line;
4085 (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (4)].lex).string);
4086
4087 int size;
4088 if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
4089 context->recover();
4090 (yyval.interm.typeLine).type->setArraySize(size);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004091 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004092 break;
4093
4094 case 149:
4095
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004096 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004097 break;
4098
4099 case 150:
4100
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004101 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004102 break;
4103
4104 case 151:
4105
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004106 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermAggregate); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004107 break;
4108
4109 case 152:
4110
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004111 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004112 break;
4113
4114 case 153:
4115
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004116 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004117 break;
4118
4119 case 154:
4120
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004121 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004122 break;
4123
4124 case 155:
4125
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004126 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004127 break;
4128
4129 case 156:
4130
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004131 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004132 break;
4133
4134 case 157:
4135
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004136 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
zmo@google.com09c323a2011-08-12 18:22:25 +00004137 break;
4138
4139 case 158:
4140
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004141 { (yyval.interm.intermAggregate) = 0; ;}
kbr@chromium.org476541f2011-10-27 21:14:51 +00004142 break;
4143
4144 case 159:
4145
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004146 { context->symbolTable.push(); ;}
kbr@chromium.org476541f2011-10-27 21:14:51 +00004147 break;
4148
4149 case 160:
4150
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004151 { context->symbolTable.pop(); ;}
kbr@chromium.org205fef32011-11-22 20:50:02 +00004152 break;
4153
4154 case 161:
4155
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004156 {
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004157 if ((yyvsp[(3) - (5)].interm.intermAggregate) != 0) {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004158 (yyvsp[(3) - (5)].interm.intermAggregate)->setOp(EOpSequence);
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004159 (yyvsp[(3) - (5)].interm.intermAggregate)->setEndLine((yyvsp[(5) - (5)].lex).line);
4160 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004161 (yyval.interm.intermAggregate) = (yyvsp[(3) - (5)].interm.intermAggregate);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004162 ;}
kbr@chromium.org476541f2011-10-27 21:14:51 +00004163 break;
4164
4165 case 162:
4166
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004167 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
kbr@chromium.org476541f2011-10-27 21:14:51 +00004168 break;
4169
4170 case 163:
4171
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004172 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004173 break;
4174
kbr@chromium.org476541f2011-10-27 21:14:51 +00004175 case 164:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004176
4177 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004178 (yyval.interm.intermNode) = 0;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004179 ;}
kbr@chromium.org205fef32011-11-22 20:50:02 +00004180 break;
4181
4182 case 165:
4183
4184 {
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004185 if ((yyvsp[(2) - (3)].interm.intermAggregate)) {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004186 (yyvsp[(2) - (3)].interm.intermAggregate)->setOp(EOpSequence);
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004187 (yyvsp[(2) - (3)].interm.intermAggregate)->setEndLine((yyvsp[(3) - (3)].lex).line);
4188 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004189 (yyval.interm.intermNode) = (yyvsp[(2) - (3)].interm.intermAggregate);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004190 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004191 break;
4192
kbr@chromium.org476541f2011-10-27 21:14:51 +00004193 case 166:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004194
4195 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004196 (yyval.interm.intermAggregate) = context->intermediate.makeAggregate((yyvsp[(1) - (1)].interm.intermNode), 0);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004197 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004198 break;
4199
kbr@chromium.org476541f2011-10-27 21:14:51 +00004200 case 167:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004201
kbr@chromium.org205fef32011-11-22 20:50:02 +00004202 {
4203 (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 +00004204 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004205 break;
4206
kbr@chromium.org476541f2011-10-27 21:14:51 +00004207 case 168:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004208
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004209 { (yyval.interm.intermNode) = 0; ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004210 break;
4211
kbr@chromium.org476541f2011-10-27 21:14:51 +00004212 case 169:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004213
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004214 { (yyval.interm.intermNode) = static_cast<TIntermNode*>((yyvsp[(1) - (2)].interm.intermTypedNode)); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004215 break;
4216
kbr@chromium.org476541f2011-10-27 21:14:51 +00004217 case 170:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004218
4219 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004220 if (context->boolErrorCheck((yyvsp[(1) - (5)].lex).line, (yyvsp[(3) - (5)].interm.intermTypedNode)))
4221 context->recover();
4222 (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 +00004223 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004224 break;
4225
kbr@chromium.org476541f2011-10-27 21:14:51 +00004226 case 171:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004227
4228 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004229 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermNode);
4230 (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004231 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004232 break;
4233
kbr@chromium.org476541f2011-10-27 21:14:51 +00004234 case 172:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004235
4236 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004237 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (1)].interm.intermNode);
4238 (yyval.interm.nodePair).node2 = 0;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004239 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004240 break;
4241
kbr@chromium.org476541f2011-10-27 21:14:51 +00004242 case 173:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004243
4244 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004245 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
4246 if (context->boolErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)->getLine(), (yyvsp[(1) - (1)].interm.intermTypedNode)))
4247 context->recover();
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004248 ;}
kbr@chromium.org205fef32011-11-22 20:50:02 +00004249 break;
4250
4251 case 174:
4252
4253 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004254 TIntermNode* intermNode;
4255 if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
4256 context->recover();
4257 if (context->boolErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
4258 context->recover();
4259
4260 if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode))
4261 (yyval.interm.intermTypedNode) = (yyvsp[(4) - (4)].interm.intermTypedNode);
4262 else {
4263 context->recover();
4264 (yyval.interm.intermTypedNode) = 0;
4265 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004266 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004267 break;
4268
kbr@chromium.org476541f2011-10-27 21:14:51 +00004269 case 175:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004270
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004271 { context->symbolTable.push(); ++context->loopNestingLevel; ;}
kbr@chromium.org205fef32011-11-22 20:50:02 +00004272 break;
4273
4274 case 176:
4275
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004276 {
4277 context->symbolTable.pop();
alokp@chromium.org52813552010-11-16 18:36:09 +00004278 (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 +00004279 --context->loopNestingLevel;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004280 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004281 break;
4282
kbr@chromium.org476541f2011-10-27 21:14:51 +00004283 case 177:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004284
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004285 { ++context->loopNestingLevel; ;}
kbr@chromium.org205fef32011-11-22 20:50:02 +00004286 break;
4287
4288 case 178:
4289
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004290 {
4291 if (context->boolErrorCheck((yyvsp[(8) - (8)].lex).line, (yyvsp[(6) - (8)].interm.intermTypedNode)))
4292 context->recover();
4293
alokp@chromium.org52813552010-11-16 18:36:09 +00004294 (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 +00004295 --context->loopNestingLevel;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004296 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004297 break;
4298
kbr@chromium.org476541f2011-10-27 21:14:51 +00004299 case 179:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004300
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004301 { context->symbolTable.push(); ++context->loopNestingLevel; ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004302 break;
4303
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004304 case 180:
4305
4306 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004307 context->symbolTable.pop();
4308 (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);
4309 --context->loopNestingLevel;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004310 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004311 break;
4312
4313 case 181:
4314
4315 {
kbr@chromium.org476541f2011-10-27 21:14:51 +00004316 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004317 ;}
zmo@google.com09c323a2011-08-12 18:22:25 +00004318 break;
4319
4320 case 182:
4321
4322 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004323 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004324 ;}
kbr@chromium.org476541f2011-10-27 21:14:51 +00004325 break;
4326
4327 case 183:
4328
4329 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004330 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004331 ;}
kbr@chromium.org476541f2011-10-27 21:14:51 +00004332 break;
4333
4334 case 184:
4335
4336 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004337 (yyval.interm.intermTypedNode) = 0;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004338 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004339 break;
4340
kbr@chromium.org476541f2011-10-27 21:14:51 +00004341 case 185:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004342
4343 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004344 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (2)].interm.intermTypedNode);
4345 (yyval.interm.nodePair).node2 = 0;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004346 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004347 break;
4348
kbr@chromium.org476541f2011-10-27 21:14:51 +00004349 case 186:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004350
4351 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004352 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermTypedNode);
4353 (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermTypedNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004354 ;}
kbr@chromium.org205fef32011-11-22 20:50:02 +00004355 break;
4356
4357 case 187:
4358
4359 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004360 if (context->loopNestingLevel <= 0) {
4361 context->error((yyvsp[(1) - (2)].lex).line, "continue statement only allowed in loops", "", "");
4362 context->recover();
4363 }
4364 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpContinue, (yyvsp[(1) - (2)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004365 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004366 break;
4367
kbr@chromium.org205fef32011-11-22 20:50:02 +00004368 case 188:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004369
4370 {
4371 if (context->loopNestingLevel <= 0) {
4372 context->error((yyvsp[(1) - (2)].lex).line, "break statement only allowed in loops", "", "");
4373 context->recover();
4374 }
4375 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpBreak, (yyvsp[(1) - (2)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004376 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004377 break;
4378
kbr@chromium.org205fef32011-11-22 20:50:02 +00004379 case 189:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004380
4381 {
4382 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(1) - (2)].lex).line);
4383 if (context->currentFunctionType->getBasicType() != EbtVoid) {
4384 context->error((yyvsp[(1) - (2)].lex).line, "non-void function must return a value", "return", "");
4385 context->recover();
4386 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004387 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004388 break;
4389
kbr@chromium.org205fef32011-11-22 20:50:02 +00004390 case 190:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004391
4392 {
4393 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(2) - (3)].interm.intermTypedNode), (yyvsp[(1) - (3)].lex).line);
4394 context->functionReturnsValue = true;
4395 if (context->currentFunctionType->getBasicType() == EbtVoid) {
4396 context->error((yyvsp[(1) - (3)].lex).line, "void function cannot return a value", "return", "");
4397 context->recover();
4398 } else if (*(context->currentFunctionType) != (yyvsp[(2) - (3)].interm.intermTypedNode)->getType()) {
4399 context->error((yyvsp[(1) - (3)].lex).line, "function return is not matching type:", "return", "");
4400 context->recover();
4401 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004402 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004403 break;
4404
kbr@chromium.org476541f2011-10-27 21:14:51 +00004405 case 191:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004406
4407 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004408 FRAG_ONLY("discard", (yyvsp[(1) - (2)].lex).line);
4409 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpKill, (yyvsp[(1) - (2)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004410 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004411 break;
4412
kbr@chromium.org476541f2011-10-27 21:14:51 +00004413 case 192:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004414
4415 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004416 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
zmo@google.com09c323a2011-08-12 18:22:25 +00004417 context->treeRoot = (yyval.interm.intermNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004418 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004419 break;
4420
zmo@google.com09c323a2011-08-12 18:22:25 +00004421 case 193:
4422
4423 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004424 (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermNode), (yyvsp[(2) - (2)].interm.intermNode), 0);
4425 context->treeRoot = (yyval.interm.intermNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004426 ;}
kbr@chromium.org476541f2011-10-27 21:14:51 +00004427 break;
4428
4429 case 194:
4430
4431 {
4432 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004433 ;}
kbr@chromium.org476541f2011-10-27 21:14:51 +00004434 break;
4435
4436 case 195:
4437
4438 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004439 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004440 ;}
kbr@chromium.org205fef32011-11-22 20:50:02 +00004441 break;
4442
4443 case 196:
4444
4445 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004446 TFunction* function = (yyvsp[(1) - (1)].interm).function;
4447 TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find(function->getMangledName()));
4448 //
4449 // Note: 'prevDec' could be 'function' if this is the first time we've seen function
4450 // as it would have just been put in the symbol table. Otherwise, we're looking up
4451 // an earlier occurance.
4452 //
4453 if (prevDec->isDefined()) {
4454 //
4455 // Then this function already has a body.
4456 //
4457 context->error((yyvsp[(1) - (1)].interm).line, "function already has a body", function->getName().c_str(), "");
4458 context->recover();
4459 }
4460 prevDec->setDefined();
4461
4462 //
4463 // Raise error message if main function takes any parameters or return anything other than void
4464 //
4465 if (function->getName() == "main") {
4466 if (function->getParamCount() > 0) {
4467 context->error((yyvsp[(1) - (1)].interm).line, "function cannot take any parameter(s)", function->getName().c_str(), "");
4468 context->recover();
4469 }
4470 if (function->getReturnType().getBasicType() != EbtVoid) {
4471 context->error((yyvsp[(1) - (1)].interm).line, "", function->getReturnType().getBasicString(), "main function cannot return a value");
4472 context->recover();
4473 }
4474 }
4475
4476 //
4477 // New symbol table scope for body of function plus its arguments
4478 //
4479 context->symbolTable.push();
4480
4481 //
4482 // Remember the return type for later checking for RETURN statements.
4483 //
4484 context->currentFunctionType = &(prevDec->getReturnType());
4485 context->functionReturnsValue = false;
4486
4487 //
4488 // Insert parameters into the symbol table.
4489 // If the parameter has no name, it's not an error, just don't insert it
4490 // (could be used for unused args).
4491 //
4492 // Also, accumulate the list of parameters into the HIL, so lower level code
4493 // knows where to find parameters.
4494 //
4495 TIntermAggregate* paramNodes = new TIntermAggregate;
4496 for (int i = 0; i < function->getParamCount(); i++) {
4497 const TParameter& param = function->getParam(i);
4498 if (param.name != 0) {
4499 TVariable *variable = new TVariable(param.name, *param.type);
4500 //
4501 // Insert the parameters with name in the symbol table.
4502 //
4503 if (! context->symbolTable.insert(*variable)) {
4504 context->error((yyvsp[(1) - (1)].interm).line, "redefinition", variable->getName().c_str(), "");
4505 context->recover();
4506 delete variable;
4507 }
4508
4509 //
4510 // Add the parameter to the HIL
4511 //
4512 paramNodes = context->intermediate.growAggregate(
4513 paramNodes,
4514 context->intermediate.addSymbol(variable->getUniqueId(),
4515 variable->getName(),
4516 variable->getType(), (yyvsp[(1) - (1)].interm).line),
4517 (yyvsp[(1) - (1)].interm).line);
4518 } else {
4519 paramNodes = context->intermediate.growAggregate(paramNodes, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (1)].interm).line), (yyvsp[(1) - (1)].interm).line);
4520 }
4521 }
4522 context->intermediate.setAggregateOperator(paramNodes, EOpParameters, (yyvsp[(1) - (1)].interm).line);
4523 (yyvsp[(1) - (1)].interm).intermAggregate = paramNodes;
4524 context->loopNestingLevel = 0;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004525 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004526 break;
4527
kbr@chromium.org205fef32011-11-22 20:50:02 +00004528 case 197:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004529
4530 {
4531 //?? Check that all paths return a value if return type != void ?
4532 // May be best done as post process phase on intermediate code
4533 if (context->currentFunctionType->getBasicType() != EbtVoid && ! context->functionReturnsValue) {
4534 context->error((yyvsp[(1) - (3)].interm).line, "function does not return a value:", "", (yyvsp[(1) - (3)].interm).function->getName().c_str());
4535 context->recover();
4536 }
4537 context->symbolTable.pop();
4538 (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermAggregate, (yyvsp[(3) - (3)].interm.intermNode), 0);
4539 context->intermediate.setAggregateOperator((yyval.interm.intermNode), EOpFunction, (yyvsp[(1) - (3)].interm).line);
4540 (yyval.interm.intermNode)->getAsAggregate()->setName((yyvsp[(1) - (3)].interm).function->getMangledName().c_str());
4541 (yyval.interm.intermNode)->getAsAggregate()->setType((yyvsp[(1) - (3)].interm).function->getReturnType());
4542
4543 // store the pragma information for debug and optimize and other vendor specific
4544 // information. This information can be queried from the parse tree
4545 (yyval.interm.intermNode)->getAsAggregate()->setOptimize(context->contextPragma.optimize);
4546 (yyval.interm.intermNode)->getAsAggregate()->setDebug(context->contextPragma.debug);
4547 (yyval.interm.intermNode)->getAsAggregate()->addToPragmaTable(context->contextPragma.pragmaTable);
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004548
4549 if ((yyvsp[(3) - (3)].interm.intermNode) && (yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate())
4550 (yyval.interm.intermNode)->getAsAggregate()->setEndLine((yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate()->getEndLine());
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004551 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004552 break;
4553
4554
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004555/* Line 1267 of yacc.c. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004556
4557 default: break;
4558 }
4559 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
4560
4561 YYPOPSTACK (yylen);
4562 yylen = 0;
4563 YY_STACK_PRINT (yyss, yyssp);
4564
4565 *++yyvsp = yyval;
4566
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004567
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004568 /* Now `shift' the result of the reduction. Determine what state
4569 that goes to, based on the state we popped back to and the rule
4570 number reduced by. */
4571
4572 yyn = yyr1[yyn];
4573
4574 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
4575 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
4576 yystate = yytable[yystate];
4577 else
4578 yystate = yydefgoto[yyn - YYNTOKENS];
4579
4580 goto yynewstate;
4581
4582
4583/*------------------------------------.
4584| yyerrlab -- here on detecting error |
4585`------------------------------------*/
4586yyerrlab:
4587 /* If not already recovering from an error, report this error. */
4588 if (!yyerrstatus)
4589 {
4590 ++yynerrs;
4591#if ! YYERROR_VERBOSE
4592 yyerror (context, YY_("syntax error"));
4593#else
4594 {
4595 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
4596 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
4597 {
4598 YYSIZE_T yyalloc = 2 * yysize;
4599 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
4600 yyalloc = YYSTACK_ALLOC_MAXIMUM;
4601 if (yymsg != yymsgbuf)
4602 YYSTACK_FREE (yymsg);
4603 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
4604 if (yymsg)
4605 yymsg_alloc = yyalloc;
4606 else
4607 {
4608 yymsg = yymsgbuf;
4609 yymsg_alloc = sizeof yymsgbuf;
4610 }
4611 }
4612
4613 if (0 < yysize && yysize <= yymsg_alloc)
4614 {
4615 (void) yysyntax_error (yymsg, yystate, yychar);
4616 yyerror (context, yymsg);
4617 }
4618 else
4619 {
4620 yyerror (context, YY_("syntax error"));
4621 if (yysize != 0)
4622 goto yyexhaustedlab;
4623 }
4624 }
4625#endif
4626 }
4627
4628
4629
4630 if (yyerrstatus == 3)
4631 {
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004632 /* If just tried and failed to reuse look-ahead token after an
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004633 error, discard it. */
4634
4635 if (yychar <= YYEOF)
4636 {
4637 /* Return failure if at end of input. */
4638 if (yychar == YYEOF)
4639 YYABORT;
4640 }
4641 else
4642 {
4643 yydestruct ("Error: discarding",
4644 yytoken, &yylval, context);
4645 yychar = YYEMPTY;
4646 }
4647 }
4648
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004649 /* Else will try to reuse look-ahead token after shifting the error
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004650 token. */
4651 goto yyerrlab1;
4652
4653
4654/*---------------------------------------------------.
4655| yyerrorlab -- error raised explicitly by YYERROR. |
4656`---------------------------------------------------*/
4657yyerrorlab:
4658
4659 /* Pacify compilers like GCC when the user code never invokes
4660 YYERROR and the label yyerrorlab therefore never appears in user
4661 code. */
4662 if (/*CONSTCOND*/ 0)
4663 goto yyerrorlab;
4664
4665 /* Do not reclaim the symbols of the rule which action triggered
4666 this YYERROR. */
4667 YYPOPSTACK (yylen);
4668 yylen = 0;
4669 YY_STACK_PRINT (yyss, yyssp);
4670 yystate = *yyssp;
4671 goto yyerrlab1;
4672
4673
4674/*-------------------------------------------------------------.
4675| yyerrlab1 -- common code for both syntax error and YYERROR. |
4676`-------------------------------------------------------------*/
4677yyerrlab1:
4678 yyerrstatus = 3; /* Each real token shifted decrements this. */
4679
4680 for (;;)
4681 {
4682 yyn = yypact[yystate];
4683 if (yyn != YYPACT_NINF)
4684 {
4685 yyn += YYTERROR;
4686 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
4687 {
4688 yyn = yytable[yyn];
4689 if (0 < yyn)
4690 break;
4691 }
4692 }
4693
4694 /* Pop the current state because it cannot handle the error token. */
4695 if (yyssp == yyss)
4696 YYABORT;
4697
4698
4699 yydestruct ("Error: popping",
4700 yystos[yystate], yyvsp, context);
4701 YYPOPSTACK (1);
4702 yystate = *yyssp;
4703 YY_STACK_PRINT (yyss, yyssp);
4704 }
4705
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004706 if (yyn == YYFINAL)
4707 YYACCEPT;
4708
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004709 *++yyvsp = yylval;
4710
4711
4712 /* Shift the error token. */
4713 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
4714
4715 yystate = yyn;
4716 goto yynewstate;
4717
4718
4719/*-------------------------------------.
4720| yyacceptlab -- YYACCEPT comes here. |
4721`-------------------------------------*/
4722yyacceptlab:
4723 yyresult = 0;
4724 goto yyreturn;
4725
4726/*-----------------------------------.
4727| yyabortlab -- YYABORT comes here. |
4728`-----------------------------------*/
4729yyabortlab:
4730 yyresult = 1;
4731 goto yyreturn;
4732
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004733#ifndef yyoverflow
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004734/*-------------------------------------------------.
4735| yyexhaustedlab -- memory exhaustion comes here. |
4736`-------------------------------------------------*/
4737yyexhaustedlab:
4738 yyerror (context, YY_("memory exhausted"));
4739 yyresult = 2;
4740 /* Fall through. */
4741#endif
4742
4743yyreturn:
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004744 if (yychar != YYEOF && yychar != YYEMPTY)
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004745 yydestruct ("Cleanup: discarding lookahead",
4746 yytoken, &yylval, context);
4747 /* Do not reclaim the symbols of the rule which action triggered
4748 this YYABORT or YYACCEPT. */
4749 YYPOPSTACK (yylen);
4750 YY_STACK_PRINT (yyss, yyssp);
4751 while (yyssp != yyss)
4752 {
4753 yydestruct ("Cleanup: popping",
4754 yystos[*yyssp], yyvsp, context);
4755 YYPOPSTACK (1);
4756 }
4757#ifndef yyoverflow
4758 if (yyss != yyssa)
4759 YYSTACK_FREE (yyss);
4760#endif
4761#if YYERROR_VERBOSE
4762 if (yymsg != yymsgbuf)
4763 YYSTACK_FREE (yymsg);
4764#endif
4765 /* Make sure YYID is used. */
4766 return YYID (yyresult);
4767}
4768
4769
4770
4771
4772
4773int glslang_parse(TParseContext* context) {
4774 return yyparse(context);
4775}
4776
4777