blob: e5670daddbd57e40f6b7aa65a058bc370219b04b [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"
apatrick@chromium.orge057c5d2012-01-26 19:18:24 +0000277#pragma GCC diagnostic ignored "-Wswitch-enum"
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000278#elif defined(_MSC_VER)
279#pragma warning(disable: 4065)
apatrick@chromium.orga1d80592012-01-25 21:52:10 +0000280#pragma warning(disable: 4189)
281#pragma warning(disable: 4505)
282#pragma warning(disable: 4701)
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000283#endif
284
285#include "compiler/SymbolTable.h"
286#include "compiler/ParseHelper.h"
287#include "GLSLANG/ShaderLang.h"
288
289#define YYLEX_PARAM context->scanner
290
291
292/* Enabling traces. */
293#ifndef YYDEBUG
294# define YYDEBUG 0
295#endif
296
297/* Enabling verbose error messages. */
298#ifdef YYERROR_VERBOSE
299# undef YYERROR_VERBOSE
300# define YYERROR_VERBOSE 1
301#else
302# define YYERROR_VERBOSE 0
303#endif
304
305/* Enabling the token table. */
306#ifndef YYTOKEN_TABLE
307# define YYTOKEN_TABLE 0
308#endif
309
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000310#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
311typedef union YYSTYPE
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000312
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000313{
314 struct {
315 TSourceLoc line;
316 union {
317 TString *string;
318 float f;
319 int i;
320 bool b;
321 };
322 TSymbol* symbol;
323 } lex;
324 struct {
325 TSourceLoc line;
326 TOperator op;
327 union {
328 TIntermNode* intermNode;
329 TIntermNodePair nodePair;
330 TIntermTyped* intermTypedNode;
331 TIntermAggregate* intermAggregate;
332 };
333 union {
334 TPublicType type;
335 TPrecision precision;
336 TQualifier qualifier;
337 TFunction* function;
338 TParameter param;
339 TTypeLine typeLine;
340 TTypeList* typeList;
341 };
342 } interm;
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000343}
344/* Line 187 of yacc.c. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000345
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000346 YYSTYPE;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000347# define yystype YYSTYPE /* obsolescent; will be withdrawn */
348# define YYSTYPE_IS_DECLARED 1
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000349# define YYSTYPE_IS_TRIVIAL 1
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000350#endif
351
352
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000353
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000354/* Copy the second part of user declarations. */
355
356
357extern int yylex(YYSTYPE* yylval_param, void* yyscanner);
358extern void yyerror(TParseContext* context, const char* reason);
359
360#define FRAG_VERT_ONLY(S, L) { \
361 if (context->shaderType != SH_FRAGMENT_SHADER && \
362 context->shaderType != SH_VERTEX_SHADER) { \
363 context->error(L, " supported in vertex/fragment shaders only ", S, "", ""); \
364 context->recover(); \
365 } \
366}
367
368#define VERTEX_ONLY(S, L) { \
369 if (context->shaderType != SH_VERTEX_SHADER) { \
370 context->error(L, " supported in vertex shaders only ", S, "", ""); \
371 context->recover(); \
372 } \
373}
374
375#define FRAG_ONLY(S, L) { \
376 if (context->shaderType != SH_FRAGMENT_SHADER) { \
377 context->error(L, " supported in fragment shaders only ", S, "", ""); \
378 context->recover(); \
379 } \
380}
381
382
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000383/* Line 216 of yacc.c. */
384
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000385
386#ifdef short
387# undef short
388#endif
389
390#ifdef YYTYPE_UINT8
391typedef YYTYPE_UINT8 yytype_uint8;
392#else
393typedef unsigned char yytype_uint8;
394#endif
395
396#ifdef YYTYPE_INT8
397typedef YYTYPE_INT8 yytype_int8;
398#elif (defined __STDC__ || defined __C99__FUNC__ \
399 || defined __cplusplus || defined _MSC_VER)
400typedef signed char yytype_int8;
401#else
402typedef short int yytype_int8;
403#endif
404
405#ifdef YYTYPE_UINT16
406typedef YYTYPE_UINT16 yytype_uint16;
407#else
408typedef unsigned short int yytype_uint16;
409#endif
410
411#ifdef YYTYPE_INT16
412typedef YYTYPE_INT16 yytype_int16;
413#else
414typedef short int yytype_int16;
415#endif
416
417#ifndef YYSIZE_T
418# ifdef __SIZE_TYPE__
419# define YYSIZE_T __SIZE_TYPE__
420# elif defined size_t
421# define YYSIZE_T size_t
422# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
423 || defined __cplusplus || defined _MSC_VER)
424# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
425# define YYSIZE_T size_t
426# else
427# define YYSIZE_T unsigned int
428# endif
429#endif
430
431#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
432
433#ifndef YY_
kbr@chromium.org205fef32011-11-22 20:50:02 +0000434# if YYENABLE_NLS
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000435# if ENABLE_NLS
436# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
437# define YY_(msgid) dgettext ("bison-runtime", msgid)
438# endif
439# endif
440# ifndef YY_
441# define YY_(msgid) msgid
442# endif
443#endif
444
445/* Suppress unused-variable warnings by "using" E. */
446#if ! defined lint || defined __GNUC__
447# define YYUSE(e) ((void) (e))
448#else
449# define YYUSE(e) /* empty */
450#endif
451
452/* Identity function, used to suppress warnings about constant conditions. */
453#ifndef lint
454# define YYID(n) (n)
455#else
456#if (defined __STDC__ || defined __C99__FUNC__ \
457 || defined __cplusplus || defined _MSC_VER)
458static int
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000459YYID (int i)
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000460#else
461static int
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000462YYID (i)
463 int i;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000464#endif
465{
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000466 return i;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000467}
468#endif
469
470#if ! defined yyoverflow || YYERROR_VERBOSE
471
472/* The parser invokes alloca or malloc; define the necessary symbols. */
473
474# ifdef YYSTACK_USE_ALLOCA
475# if YYSTACK_USE_ALLOCA
476# ifdef __GNUC__
477# define YYSTACK_ALLOC __builtin_alloca
478# elif defined __BUILTIN_VA_ARG_INCR
479# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
480# elif defined _AIX
481# define YYSTACK_ALLOC __alloca
482# elif defined _MSC_VER
483# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
484# define alloca _alloca
485# else
486# define YYSTACK_ALLOC alloca
487# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
488 || defined __cplusplus || defined _MSC_VER)
489# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
490# ifndef _STDLIB_H
491# define _STDLIB_H 1
492# endif
493# endif
494# endif
495# endif
496# endif
497
498# ifdef YYSTACK_ALLOC
499 /* Pacify GCC's `empty if-body' warning. */
500# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
501# ifndef YYSTACK_ALLOC_MAXIMUM
502 /* The OS might guarantee only one guard page at the bottom of the stack,
503 and a page size can be as small as 4096 bytes. So we cannot safely
504 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
505 to allow for a few compiler-allocated temporary stack slots. */
506# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
507# endif
508# else
509# define YYSTACK_ALLOC YYMALLOC
510# define YYSTACK_FREE YYFREE
511# ifndef YYSTACK_ALLOC_MAXIMUM
512# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
513# endif
514# if (defined __cplusplus && ! defined _STDLIB_H \
515 && ! ((defined YYMALLOC || defined malloc) \
516 && (defined YYFREE || defined free)))
517# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
518# ifndef _STDLIB_H
519# define _STDLIB_H 1
520# endif
521# endif
522# ifndef YYMALLOC
523# define YYMALLOC malloc
524# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
525 || defined __cplusplus || defined _MSC_VER)
526void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
527# endif
528# endif
529# ifndef YYFREE
530# define YYFREE free
531# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
532 || defined __cplusplus || defined _MSC_VER)
533void free (void *); /* INFRINGES ON USER NAME SPACE */
534# endif
535# endif
536# endif
537#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
538
539
540#if (! defined yyoverflow \
541 && (! defined __cplusplus \
542 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
543
544/* A type that is properly aligned for any stack member. */
545union yyalloc
546{
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000547 yytype_int16 yyss;
548 YYSTYPE yyvs;
549 };
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000550
551/* The size of the maximum gap between one aligned stack and the next. */
552# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
553
554/* The size of an array large to enough to hold all stacks, each with
555 N elements. */
556# define YYSTACK_BYTES(N) \
557 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
558 + YYSTACK_GAP_MAXIMUM)
559
560/* Copy COUNT objects from FROM to TO. The source and destination do
561 not overlap. */
562# ifndef YYCOPY
563# if defined __GNUC__ && 1 < __GNUC__
564# define YYCOPY(To, From, Count) \
565 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
566# else
567# define YYCOPY(To, From, Count) \
568 do \
569 { \
570 YYSIZE_T yyi; \
571 for (yyi = 0; yyi < (Count); yyi++) \
572 (To)[yyi] = (From)[yyi]; \
573 } \
574 while (YYID (0))
575# endif
576# endif
577
578/* Relocate STACK from its old location to the new one. The
579 local variables YYSIZE and YYSTACKSIZE give the old and new number of
580 elements in the stack, and YYPTR gives the new location of the
581 stack. Advance YYPTR to a properly aligned location for the next
582 stack. */
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000583# define YYSTACK_RELOCATE(Stack) \
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000584 do \
585 { \
586 YYSIZE_T yynewbytes; \
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000587 YYCOPY (&yyptr->Stack, Stack, yysize); \
588 Stack = &yyptr->Stack; \
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000589 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
590 yyptr += yynewbytes / sizeof (*yyptr); \
591 } \
592 while (YYID (0))
593
594#endif
595
596/* YYFINAL -- State number of the termination state. */
kbr@chromium.org205fef32011-11-22 20:50:02 +0000597#define YYFINAL 71
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000598/* YYLAST -- Last index in YYTABLE. */
kbr@chromium.org205fef32011-11-22 20:50:02 +0000599#define YYLAST 1370
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000600
601/* YYNTOKENS -- Number of terminals. */
kbr@chromium.org205fef32011-11-22 20:50:02 +0000602#define YYNTOKENS 96
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000603/* YYNNTS -- Number of nonterminals. */
kbr@chromium.org476541f2011-10-27 21:14:51 +0000604#define YYNNTS 80
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000605/* YYNRULES -- Number of rules. */
kbr@chromium.org205fef32011-11-22 20:50:02 +0000606#define YYNRULES 197
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000607/* YYNRULES -- Number of states. */
kbr@chromium.org205fef32011-11-22 20:50:02 +0000608#define YYNSTATES 300
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000609
610/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
611#define YYUNDEFTOK 2
kbr@chromium.org205fef32011-11-22 20:50:02 +0000612#define YYMAXUTOK 350
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000613
614#define YYTRANSLATE(YYX) \
615 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
616
617/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
618static const yytype_uint8 yytranslate[] =
619{
620 0, 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, 2, 2, 2, 2,
645 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
646 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
647 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
648 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
649 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
650 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
651 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
652 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
653 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000654 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
655 95
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000656};
657
658#if YYDEBUG
659/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
660 YYRHS. */
661static const yytype_uint16 yyprhs[] =
662{
663 0, 0, 3, 5, 7, 9, 11, 13, 17, 19,
664 24, 26, 30, 33, 36, 38, 40, 42, 46, 49,
665 52, 55, 57, 60, 64, 67, 69, 71, 73, 75,
666 78, 81, 84, 86, 88, 90, 92, 96, 100, 102,
667 106, 110, 112, 114, 118, 122, 126, 130, 132, 136,
668 140, 142, 144, 146, 148, 152, 154, 158, 160, 164,
669 166, 172, 174, 178, 180, 182, 184, 186, 188, 190,
670 194, 196, 199, 202, 207, 210, 212, 214, 217, 221,
671 225, 228, 234, 238, 241, 245, 248, 249, 251, 253,
672 255, 257, 259, 263, 269, 276, 282, 284, 287, 292,
673 298, 303, 306, 308, 311, 313, 315, 317, 320, 322,
674 324, 327, 329, 331, 333, 335, 340, 342, 344, 346,
675 348, 350, 352, 354, 356, 358, 360, 362, 364, 366,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000676 368, 370, 372, 374, 376, 378, 380, 382, 384, 385,
677 392, 393, 399, 401, 404, 408, 410, 414, 416, 421,
678 423, 425, 427, 429, 431, 433, 435, 437, 439, 442,
679 443, 444, 450, 452, 454, 457, 461, 463, 466, 468,
680 471, 477, 481, 483, 485, 490, 491, 498, 499, 508,
681 509, 517, 519, 521, 523, 524, 527, 531, 534, 537,
682 540, 544, 547, 549, 552, 554, 556, 557
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000683};
684
685/* YYRHS -- A `-1'-separated list of the rules' RHS. */
686static const yytype_int16 yyrhs[] =
687{
kbr@chromium.org205fef32011-11-22 20:50:02 +0000688 172, 0, -1, 45, -1, 97, -1, 48, -1, 47,
689 -1, 49, -1, 72, 124, 73, -1, 98, -1, 99,
690 74, 100, 75, -1, 101, -1, 99, 78, 50, -1,
691 99, 53, -1, 99, 54, -1, 124, -1, 102, -1,
692 103, -1, 99, 78, 103, -1, 105, 73, -1, 104,
693 73, -1, 106, 39, -1, 106, -1, 106, 122, -1,
694 105, 79, 122, -1, 107, 72, -1, 142, -1, 45,
695 -1, 50, -1, 99, -1, 53, 108, -1, 54, 108,
696 -1, 109, 108, -1, 86, -1, 84, -1, 83, -1,
697 108, -1, 110, 87, 108, -1, 110, 88, 108, -1,
698 110, -1, 111, 86, 110, -1, 111, 84, 110, -1,
699 111, -1, 112, -1, 113, 90, 112, -1, 113, 91,
700 112, -1, 113, 55, 112, -1, 113, 56, 112, -1,
701 113, -1, 114, 57, 113, -1, 114, 58, 113, -1,
702 114, -1, 115, -1, 116, -1, 117, -1, 118, 59,
703 117, -1, 118, -1, 119, 61, 118, -1, 119, -1,
704 120, 60, 119, -1, 120, -1, 120, 95, 124, 80,
705 122, -1, 121, -1, 108, 123, 122, -1, 81, -1,
706 62, -1, 63, -1, 64, -1, 71, -1, 122, -1,
707 124, 79, 122, -1, 121, -1, 127, 82, -1, 135,
708 82, -1, 7, 140, 141, 82, -1, 128, 73, -1,
709 130, -1, 129, -1, 130, 132, -1, 129, 79, 132,
710 -1, 137, 45, 72, -1, 139, 45, -1, 139, 45,
711 74, 125, 75, -1, 138, 133, 131, -1, 133, 131,
712 -1, 138, 133, 134, -1, 133, 134, -1, -1, 33,
713 -1, 34, -1, 35, -1, 139, -1, 136, -1, 135,
714 79, 45, -1, 135, 79, 45, 74, 75, -1, 135,
715 79, 45, 74, 125, 75, -1, 135, 79, 45, 81,
716 150, -1, 137, -1, 137, 45, -1, 137, 45, 74,
717 75, -1, 137, 45, 74, 125, 75, -1, 137, 45,
718 81, 150, -1, 3, 45, -1, 139, -1, 138, 139,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000719 -1, 9, -1, 8, -1, 37, -1, 3, 37, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000720 36, -1, 141, -1, 140, 141, -1, 4, -1, 5,
721 -1, 6, -1, 142, -1, 142, 74, 125, 75, -1,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000722 39, -1, 11, -1, 12, -1, 10, -1, 27, -1,
723 28, -1, 29, -1, 21, -1, 22, -1, 23, -1,
724 24, -1, 25, -1, 26, -1, 30, -1, 31, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000725 32, -1, 41, -1, 42, -1, 43, -1, 44, -1,
726 143, -1, 46, -1, -1, 38, 45, 76, 144, 146,
727 77, -1, -1, 38, 76, 145, 146, 77, -1, 147,
728 -1, 146, 147, -1, 139, 148, 82, -1, 149, -1,
729 148, 79, 149, -1, 45, -1, 45, 74, 125, 75,
730 -1, 122, -1, 126, -1, 154, -1, 153, -1, 151,
731 -1, 160, -1, 161, -1, 164, -1, 171, -1, 76,
732 77, -1, -1, -1, 76, 155, 159, 156, 77, -1,
733 158, -1, 153, -1, 76, 77, -1, 76, 159, 77,
734 -1, 152, -1, 159, 152, -1, 82, -1, 124, 82,
735 -1, 18, 72, 124, 73, 162, -1, 152, 16, 152,
736 -1, 152, -1, 124, -1, 137, 45, 81, 150, -1,
737 -1, 40, 72, 165, 163, 73, 157, -1, -1, 15,
738 166, 152, 40, 72, 124, 73, 82, -1, -1, 17,
739 72, 167, 168, 170, 73, 157, -1, 160, -1, 151,
740 -1, 163, -1, -1, 169, 82, -1, 169, 82, 124,
741 -1, 14, 82, -1, 13, 82, -1, 20, 82, -1,
742 20, 124, 82, -1, 19, 82, -1, 173, -1, 172,
743 173, -1, 174, -1, 126, -1, -1, 127, 175, 158,
744 -1
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000745};
746
747/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
748static const yytype_uint16 yyrline[] =
749{
apatrick@chromium.orge057c5d2012-01-26 19:18:24 +0000750 0, 165, 165, 200, 203, 216, 221, 226, 232, 235,
751 308, 311, 420, 430, 443, 451, 550, 553, 561, 565,
752 572, 576, 583, 589, 598, 606, 661, 668, 678, 681,
753 691, 701, 722, 723, 724, 729, 730, 739, 751, 752,
754 760, 771, 775, 776, 786, 796, 806, 819, 820, 830,
755 843, 847, 851, 855, 856, 869, 870, 883, 884, 897,
756 898, 915, 916, 929, 930, 931, 932, 933, 937, 940,
757 951, 959, 984, 989, 996, 1032, 1035, 1042, 1050, 1071,
758 1090, 1101, 1130, 1135, 1145, 1150, 1160, 1163, 1166, 1169,
759 1175, 1182, 1185, 1201, 1219, 1243, 1266, 1270, 1288, 1296,
760 1328, 1348, 1424, 1433, 1456, 1459, 1465, 1473, 1481, 1489,
761 1499, 1506, 1509, 1512, 1518, 1521, 1536, 1540, 1544, 1548,
762 1557, 1562, 1567, 1572, 1577, 1582, 1587, 1592, 1597, 1602,
763 1608, 1614, 1620, 1625, 1630, 1639, 1648, 1653, 1666, 1666,
764 1680, 1680, 1689, 1692, 1707, 1743, 1747, 1753, 1761, 1777,
765 1781, 1785, 1786, 1792, 1793, 1794, 1795, 1796, 1800, 1801,
766 1801, 1801, 1811, 1812, 1817, 1820, 1830, 1833, 1839, 1840,
767 1844, 1852, 1856, 1866, 1871, 1888, 1888, 1893, 1893, 1900,
768 1900, 1908, 1911, 1917, 1920, 1926, 1930, 1937, 1944, 1951,
769 1958, 1969, 1978, 1982, 1989, 1992, 1998, 1998
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000770};
771#endif
772
773#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
774/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
775 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
776static const char *const yytname[] =
777{
778 "$end", "error", "$undefined", "INVARIANT", "HIGH_PRECISION",
779 "MEDIUM_PRECISION", "LOW_PRECISION", "PRECISION", "ATTRIBUTE",
780 "CONST_QUAL", "BOOL_TYPE", "FLOAT_TYPE", "INT_TYPE", "BREAK", "CONTINUE",
781 "DO", "ELSE", "FOR", "IF", "DISCARD", "RETURN", "BVEC2", "BVEC3",
782 "BVEC4", "IVEC2", "IVEC3", "IVEC4", "VEC2", "VEC3", "VEC4", "MATRIX2",
783 "MATRIX3", "MATRIX4", "IN_QUAL", "OUT_QUAL", "INOUT_QUAL", "UNIFORM",
784 "VARYING", "STRUCT", "VOID_TYPE", "WHILE", "SAMPLER2D", "SAMPLERCUBE",
kbr@chromium.org205fef32011-11-22 20:50:02 +0000785 "SAMPLER_EXTERNAL_OES", "SAMPLER2DRECT", "IDENTIFIER", "TYPE_NAME",
786 "FLOATCONSTANT", "INTCONSTANT", "BOOLCONSTANT", "FIELD_SELECTION",
787 "LEFT_OP", "RIGHT_OP", "INC_OP", "DEC_OP", "LE_OP", "GE_OP", "EQ_OP",
788 "NE_OP", "AND_OP", "OR_OP", "XOR_OP", "MUL_ASSIGN", "DIV_ASSIGN",
789 "ADD_ASSIGN", "MOD_ASSIGN", "LEFT_ASSIGN", "RIGHT_ASSIGN", "AND_ASSIGN",
790 "XOR_ASSIGN", "OR_ASSIGN", "SUB_ASSIGN", "LEFT_PAREN", "RIGHT_PAREN",
791 "LEFT_BRACKET", "RIGHT_BRACKET", "LEFT_BRACE", "RIGHT_BRACE", "DOT",
792 "COMMA", "COLON", "EQUAL", "SEMICOLON", "BANG", "DASH", "TILDE", "PLUS",
793 "STAR", "SLASH", "PERCENT", "LEFT_ANGLE", "RIGHT_ANGLE", "VERTICAL_BAR",
794 "CARET", "AMPERSAND", "QUESTION", "$accept", "variable_identifier",
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000795 "primary_expression", "postfix_expression", "integer_expression",
796 "function_call", "function_call_or_method", "function_call_generic",
797 "function_call_header_no_parameters",
798 "function_call_header_with_parameters", "function_call_header",
799 "function_identifier", "unary_expression", "unary_operator",
800 "multiplicative_expression", "additive_expression", "shift_expression",
801 "relational_expression", "equality_expression", "and_expression",
802 "exclusive_or_expression", "inclusive_or_expression",
803 "logical_and_expression", "logical_xor_expression",
804 "logical_or_expression", "conditional_expression",
805 "assignment_expression", "assignment_operator", "expression",
806 "constant_expression", "declaration", "function_prototype",
807 "function_declarator", "function_header_with_parameters",
808 "function_header", "parameter_declarator", "parameter_declaration",
809 "parameter_qualifier", "parameter_type_specifier",
810 "init_declarator_list", "single_declaration", "fully_specified_type",
811 "type_qualifier", "type_specifier", "precision_qualifier",
812 "type_specifier_no_prec", "type_specifier_nonarray", "struct_specifier",
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000813 "@1", "@2", "struct_declaration_list", "struct_declaration",
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000814 "struct_declarator_list", "struct_declarator", "initializer",
815 "declaration_statement", "statement", "simple_statement",
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000816 "compound_statement", "@3", "@4", "statement_no_new_scope",
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000817 "compound_statement_no_new_scope", "statement_list",
818 "expression_statement", "selection_statement",
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000819 "selection_rest_statement", "condition", "iteration_statement", "@5",
820 "@6", "@7", "for_init_statement", "conditionopt", "for_rest_statement",
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000821 "jump_statement", "translation_unit", "external_declaration",
apatrick@chromium.org536888b2012-01-25 02:10:25 +0000822 "function_definition", "@8", 0
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000823};
824#endif
825
826# ifdef YYPRINT
827/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
828 token YYLEX-NUM. */
829static const yytype_uint16 yytoknum[] =
830{
831 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
832 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
833 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
834 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
835 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
836 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
837 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
838 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
839 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000840 345, 346, 347, 348, 349, 350
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000841};
842# endif
843
844/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
845static const yytype_uint8 yyr1[] =
846{
kbr@chromium.org205fef32011-11-22 20:50:02 +0000847 0, 96, 97, 98, 98, 98, 98, 98, 99, 99,
848 99, 99, 99, 99, 100, 101, 102, 102, 103, 103,
849 104, 104, 105, 105, 106, 107, 107, 107, 108, 108,
850 108, 108, 109, 109, 109, 110, 110, 110, 111, 111,
851 111, 112, 113, 113, 113, 113, 113, 114, 114, 114,
852 115, 116, 117, 118, 118, 119, 119, 120, 120, 121,
853 121, 122, 122, 123, 123, 123, 123, 123, 124, 124,
854 125, 126, 126, 126, 127, 128, 128, 129, 129, 130,
855 131, 131, 132, 132, 132, 132, 133, 133, 133, 133,
856 134, 135, 135, 135, 135, 135, 136, 136, 136, 136,
857 136, 136, 137, 137, 138, 138, 138, 138, 138, 139,
858 139, 140, 140, 140, 141, 141, 142, 142, 142, 142,
859 142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
860 142, 142, 142, 142, 142, 142, 142, 142, 144, 143,
861 145, 143, 146, 146, 147, 148, 148, 149, 149, 150,
862 151, 152, 152, 153, 153, 153, 153, 153, 154, 155,
863 156, 154, 157, 157, 158, 158, 159, 159, 160, 160,
864 161, 162, 162, 163, 163, 165, 164, 166, 164, 167,
865 164, 168, 168, 169, 169, 170, 170, 171, 171, 171,
866 171, 171, 172, 172, 173, 173, 175, 174
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000867};
868
869/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
870static const yytype_uint8 yyr2[] =
871{
872 0, 2, 1, 1, 1, 1, 1, 3, 1, 4,
873 1, 3, 2, 2, 1, 1, 1, 3, 2, 2,
874 2, 1, 2, 3, 2, 1, 1, 1, 1, 2,
875 2, 2, 1, 1, 1, 1, 3, 3, 1, 3,
876 3, 1, 1, 3, 3, 3, 3, 1, 3, 3,
877 1, 1, 1, 1, 3, 1, 3, 1, 3, 1,
878 5, 1, 3, 1, 1, 1, 1, 1, 1, 3,
879 1, 2, 2, 4, 2, 1, 1, 2, 3, 3,
880 2, 5, 3, 2, 3, 2, 0, 1, 1, 1,
881 1, 1, 3, 5, 6, 5, 1, 2, 4, 5,
882 4, 2, 1, 2, 1, 1, 1, 2, 1, 1,
883 2, 1, 1, 1, 1, 4, 1, 1, 1, 1,
884 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000885 1, 1, 1, 1, 1, 1, 1, 1, 0, 6,
886 0, 5, 1, 2, 3, 1, 3, 1, 4, 1,
887 1, 1, 1, 1, 1, 1, 1, 1, 2, 0,
888 0, 5, 1, 1, 2, 3, 1, 2, 1, 2,
889 5, 3, 1, 1, 4, 0, 6, 0, 8, 0,
890 7, 1, 1, 1, 0, 2, 3, 2, 2, 2,
891 3, 2, 1, 2, 1, 1, 0, 3
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000892};
893
894/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
895 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
896 means the default is an error. */
897static const yytype_uint8 yydefact[] =
898{
899 0, 0, 111, 112, 113, 0, 105, 104, 119, 117,
900 118, 123, 124, 125, 126, 127, 128, 120, 121, 122,
zmo@google.com09c323a2011-08-12 18:22:25 +0000901 129, 130, 131, 108, 106, 0, 116, 132, 133, 134,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000902 135, 137, 195, 196, 0, 76, 86, 0, 91, 96,
903 0, 102, 0, 109, 114, 136, 0, 192, 194, 107,
904 101, 0, 0, 140, 71, 0, 74, 86, 0, 87,
905 88, 89, 77, 0, 86, 0, 72, 97, 103, 110,
906 0, 1, 193, 0, 138, 0, 0, 197, 78, 83,
907 85, 90, 0, 92, 79, 0, 0, 2, 5, 4,
908 6, 27, 0, 0, 0, 34, 33, 32, 3, 8,
909 28, 10, 15, 16, 0, 0, 21, 0, 35, 0,
910 38, 41, 42, 47, 50, 51, 52, 53, 55, 57,
911 59, 70, 0, 25, 73, 0, 0, 0, 142, 0,
912 0, 177, 0, 0, 0, 0, 0, 159, 164, 168,
913 35, 61, 68, 0, 150, 0, 114, 153, 166, 152,
914 151, 0, 154, 155, 156, 157, 80, 82, 84, 0,
915 0, 98, 0, 149, 100, 29, 30, 0, 12, 13,
916 0, 0, 19, 18, 0, 20, 22, 24, 31, 0,
kbr@chromium.org476541f2011-10-27 21:14:51 +0000917 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
kbr@chromium.org205fef32011-11-22 20:50:02 +0000918 0, 0, 0, 115, 0, 147, 0, 145, 141, 143,
919 188, 187, 0, 179, 0, 191, 189, 0, 175, 158,
920 0, 64, 65, 66, 67, 63, 0, 0, 169, 165,
921 167, 0, 93, 0, 95, 99, 7, 0, 14, 26,
922 11, 17, 23, 36, 37, 40, 39, 45, 46, 43,
923 44, 48, 49, 54, 56, 58, 0, 139, 0, 0,
924 144, 0, 0, 0, 190, 0, 160, 62, 69, 0,
925 94, 9, 0, 0, 146, 0, 182, 181, 184, 0,
926 173, 0, 0, 0, 81, 60, 148, 0, 183, 0,
927 0, 172, 170, 0, 0, 161, 0, 185, 0, 0,
928 0, 163, 176, 162, 0, 186, 180, 171, 174, 178
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000929};
930
931/* YYDEFGOTO[NTERM-NUM]. */
932static const yytype_int16 yydefgoto[] =
933{
kbr@chromium.org205fef32011-11-22 20:50:02 +0000934 -1, 98, 99, 100, 227, 101, 102, 103, 104, 105,
935 106, 107, 140, 109, 110, 111, 112, 113, 114, 115,
936 116, 117, 118, 119, 120, 141, 142, 216, 143, 122,
937 144, 145, 34, 35, 36, 79, 62, 63, 80, 37,
938 38, 39, 40, 41, 42, 43, 123, 45, 125, 75,
939 127, 128, 196, 197, 164, 147, 148, 149, 150, 210,
940 273, 292, 293, 151, 152, 153, 282, 272, 154, 255,
941 202, 252, 268, 279, 280, 155, 46, 47, 48, 55
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000942};
943
944/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
945 STATE-NUM. */
kbr@chromium.org205fef32011-11-22 20:50:02 +0000946#define YYPACT_NINF -251
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000947static const yytype_int16 yypact[] =
948{
kbr@chromium.org205fef32011-11-22 20:50:02 +0000949 1250, -17, -251, -251, -251, 113, -251, -251, -251, -251,
950 -251, -251, -251, -251, -251, -251, -251, -251, -251, -251,
951 -251, -251, -251, -251, -251, -39, -251, -251, -251, -251,
952 -251, -251, -251, -65, -34, -10, 21, -32, -251, 28,
953 207, -251, 1324, -251, 56, -251, 1206, -251, -251, -251,
954 -251, 1324, 74, -251, -251, 86, -251, 71, 95, -251,
955 -251, -251, -251, 207, 119, 120, -251, -56, -251, -251,
956 971, -251, -251, 84, -251, 207, 287, -251, -251, -251,
957 -251, 124, 207, -59, -251, 773, 971, 98, -251, -251,
958 -251, -251, 971, 971, 971, -251, -251, -251, -251, -251,
959 35, -251, -251, -251, 100, -9, 1037, 102, -251, 971,
960 -27, -1, -251, -24, 99, -251, -251, -251, 112, 111,
961 -51, -251, 103, -251, -251, 207, 135, 1106, -251, 101,
962 104, -251, 109, 115, 106, 839, 117, 107, -251, -251,
963 39, -251, -251, -11, -251, -65, 54, -251, -251, -251,
964 -251, 371, -251, -251, -251, -251, 116, -251, -251, 905,
965 971, -251, 118, -251, -251, -251, -251, 8, -251, -251,
966 971, 1287, -251, -251, 971, 125, -251, -251, -251, 971,
967 971, 971, 971, 971, 971, 971, 971, 971, 971, 971,
968 971, 971, 971, -251, 1149, 122, 17, -251, -251, -251,
969 -251, -251, 455, -251, 971, -251, -251, 32, -251, -251,
970 455, -251, -251, -251, -251, -251, 971, 971, -251, -251,
971 -251, 971, -251, 123, -251, -251, -251, 126, 121, -251,
972 127, -251, -251, -251, -251, -27, -27, -251, -251, -251,
973 -251, -24, -24, -251, 112, 111, 79, -251, 971, 135,
974 -251, 151, 623, 11, -251, 707, 455, -251, -251, 128,
975 -251, -251, 971, 130, -251, 134, -251, -251, 707, 455,
976 121, 147, 136, 131, -251, -251, -251, 971, -251, 132,
977 142, 200, -251, 139, 539, -251, 19, 971, 539, 455,
978 971, -251, -251, -251, 140, 121, -251, -251, -251, -251
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000979};
980
981/* YYPGOTO[NTERM-NUM]. */
982static const yytype_int16 yypgoto[] =
983{
kbr@chromium.org205fef32011-11-22 20:50:02 +0000984 -251, -251, -251, -251, -251, -251, -251, 50, -251, -251,
985 -251, -251, -44, -251, -21, -251, -62, -20, -251, -251,
986 -251, 34, 36, 33, -251, -66, -83, -251, -92, -73,
987 7, 13, -251, -251, -251, 143, 170, 176, 159, -251,
988 -251, -247, -22, -30, 237, -15, 0, -251, -251, -251,
989 129, -122, -251, -6, -159, -8, -140, -250, -251, -251,
990 -251, -41, 202, 48, 9, -251, -251, -5, -251, -251,
991 -251, -251, -251, -251, -251, -251, -251, 213, -251, -251
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000992};
993
994/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
995 positive, shift that token. If negative, reduce the rule which
996 number is the opposite. If zero, do what YYDEFACT says.
997 If YYTABLE_NINF, syntax error. */
zmo@google.comdc4b4f82011-06-17 00:42:53 +0000998#define YYTABLE_NINF -117
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000999static const yytype_int16 yytable[] =
1000{
kbr@chromium.org205fef32011-11-22 20:50:02 +00001001 44, 224, 167, 163, 121, 199, 52, 32, 271, 191,
1002 68, 220, 162, 33, 64, 159, 84, 54, 85, 121,
1003 49, 271, 160, 176, 58, 86, 108, 69, 50, 6,
1004 7, 183, 184, 81, 291, 64, 73, 53, 291, 56,
1005 44, 108, 44, 207, 192, 126, 44, 65, 165, 166,
1006 66, 44, 81, 32, 59, 60, 61, 23, 24, 33,
1007 179, 180, 251, 44, 173, 178, 185, 186, 217, 57,
1008 174, 218, 199, 67, 58, 44, 146, 163, 228, 6,
1009 7, 226, 44, 181, 269, 182, 223, 217, 168, 169,
1010 217, 232, 294, 121, -75, 126, 249, 126, 217, 250,
1011 246, 211, 212, 213, 59, 60, 61, 23, 24, 170,
1012 214, 217, 253, 171, 254, 108, 220, 2, 3, 4,
1013 215, 237, 238, 239, 240, 44, -25, 44, 70, 281,
1014 70, 298, 49, 257, 258, 233, 234, 108, 108, 108,
1015 108, 108, 108, 108, 108, 108, 108, 108, 259, 297,
1016 74, 146, 59, 60, 61, 121, 187, 188, 217, 262,
1017 235, 236, 76, 270, 126, 83, 124, 241, 242, 156,
1018 -26, 189, 190, 172, 177, 263, 270, 108, 193, 275,
1019 195, 203, 121, 200, 209, 286, 201, 204, 205, 208,
1020 221, 265, 283, 225, 44, 295, 248, -116, 260, -27,
1021 217, 261, 146, 274, 108, 276, 277, 163, 285, 284,
1022 146, 2, 3, 4, 287, 288, 289, 8, 9, 10,
1023 290, 231, 299, 243, 245, 157, 244, 78, 11, 12,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001024 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001025 82, 158, 51, 264, 266, 25, 26, 296, 27, 28,
1026 29, 30, 146, 31, 194, 146, 146, 77, 256, 72,
1027 0, 267, 0, 278, 0, 0, 0, 0, 146, 146,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001028 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001029 0, 0, 0, 0, 146, 0, 0, 0, 146, 146,
1030 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
1031 129, 130, 131, 0, 132, 133, 134, 135, 11, 12,
1032 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
1033 0, 0, 0, 23, 24, 25, 26, 136, 27, 28,
1034 29, 30, 87, 31, 88, 89, 90, 91, 0, 0,
1035 92, 93, 0, 0, 0, 0, 0, 0, 0, 0,
1036 0, 0, 0, 0, 0, 0, 0, 0, 0, 94,
1037 0, 0, 0, 137, 138, 0, 0, 0, 0, 139,
1038 95, 96, 0, 97, 1, 2, 3, 4, 5, 6,
1039 7, 8, 9, 10, 129, 130, 131, 0, 132, 133,
1040 134, 135, 11, 12, 13, 14, 15, 16, 17, 18,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001041 19, 20, 21, 22, 0, 0, 0, 23, 24, 25,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001042 26, 136, 27, 28, 29, 30, 87, 31, 88, 89,
1043 90, 91, 0, 0, 92, 93, 0, 0, 0, 0,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001044 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001045 0, 0, 0, 94, 0, 0, 0, 137, 219, 0,
1046 0, 0, 0, 139, 95, 96, 0, 97, 1, 2,
1047 3, 4, 5, 6, 7, 8, 9, 10, 129, 130,
1048 131, 0, 132, 133, 134, 135, 11, 12, 13, 14,
1049 15, 16, 17, 18, 19, 20, 21, 22, 0, 0,
1050 0, 23, 24, 25, 26, 136, 27, 28, 29, 30,
1051 87, 31, 88, 89, 90, 91, 0, 0, 92, 93,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001052 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001053 0, 0, 0, 0, 0, 0, 0, 94, 0, 0,
1054 0, 137, 0, 0, 0, 0, 0, 139, 95, 96,
1055 0, 97, 1, 2, 3, 4, 5, 6, 7, 8,
1056 9, 10, 129, 130, 131, 0, 132, 133, 134, 135,
1057 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
1058 21, 22, 0, 0, 0, 23, 24, 25, 26, 136,
1059 27, 28, 29, 30, 87, 31, 88, 89, 90, 91,
1060 0, 0, 92, 93, 0, 0, 0, 0, 0, 0,
1061 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1062 0, 94, 0, 0, 0, 76, 0, 0, 0, 0,
1063 0, 139, 95, 96, 0, 97, 1, 2, 3, 4,
1064 5, 6, 7, 8, 9, 10, 0, 0, 0, 0,
1065 0, 0, 0, 0, 11, 12, 13, 14, 15, 16,
1066 17, 18, 19, 20, 21, 22, 0, 0, 0, 23,
1067 24, 25, 26, 0, 27, 28, 29, 30, 87, 31,
1068 88, 89, 90, 91, 0, 0, 92, 93, 0, 0,
1069 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1070 0, 0, 0, 0, 0, 94, 0, 0, 0, 0,
1071 0, 0, 0, 0, 0, 139, 95, 96, 0, 97,
1072 58, 2, 3, 4, 0, 6, 7, 8, 9, 10,
1073 0, 0, 0, 0, 0, 0, 0, 0, 11, 12,
1074 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
1075 0, 0, 0, 23, 24, 25, 26, 0, 27, 28,
1076 29, 30, 87, 31, 88, 89, 90, 91, 0, 0,
1077 92, 93, 0, 0, 0, 0, 0, 0, 0, 0,
1078 0, 0, 0, 0, 0, 0, 0, 0, 0, 94,
1079 0, 0, 0, 8, 9, 10, 0, 0, 0, 0,
1080 95, 96, 0, 97, 11, 12, 13, 14, 15, 16,
1081 17, 18, 19, 20, 21, 22, 0, 0, 0, 0,
1082 0, 25, 26, 0, 27, 28, 29, 30, 87, 31,
1083 88, 89, 90, 91, 0, 0, 92, 93, 0, 0,
1084 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1085 0, 0, 0, 0, 0, 94, 0, 0, 161, 8,
1086 9, 10, 0, 0, 0, 0, 95, 96, 0, 97,
1087 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
1088 21, 22, 0, 0, 0, 0, 0, 25, 26, 0,
1089 27, 28, 29, 30, 87, 31, 88, 89, 90, 91,
1090 0, 0, 92, 93, 0, 0, 0, 0, 0, 0,
1091 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1092 0, 94, 0, 0, 0, 8, 9, 10, 0, 0,
1093 0, 206, 95, 96, 0, 97, 11, 12, 13, 14,
1094 15, 16, 17, 18, 19, 20, 21, 22, 0, 0,
1095 0, 0, 0, 25, 26, 0, 27, 28, 29, 30,
1096 87, 31, 88, 89, 90, 91, 0, 0, 92, 93,
1097 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1098 0, 0, 0, 0, 0, 0, 0, 94, 0, 0,
1099 222, 8, 9, 10, 0, 0, 0, 0, 95, 96,
1100 0, 97, 11, 12, 13, 14, 15, 16, 17, 18,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001101 19, 20, 21, 22, 0, 0, 0, 0, 0, 25,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001102 26, 0, 27, 28, 29, 30, 87, 31, 88, 89,
1103 90, 91, 0, 0, 92, 93, 0, 0, 0, 0,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001104 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001105 0, 0, 0, 94, 0, 0, 0, 8, 9, 10,
1106 0, 0, 0, 0, 95, 96, 0, 97, 11, 12,
1107 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
1108 0, 0, 0, 0, 0, 25, 175, 0, 27, 28,
1109 29, 30, 87, 31, 88, 89, 90, 91, 0, 0,
1110 92, 93, 0, 0, 0, 0, 0, 0, 0, 0,
1111 0, 0, 0, 0, 0, 0, 0, 0, 0, 94,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001112 2, 3, 4, 0, 0, 0, 8, 9, 10, 0,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001113 95, 96, 0, 97, 0, 0, 0, 11, 12, 13,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001114 14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001115 0, 0, 0, 0, 25, 26, 0, 27, 28, 29,
1116 30, 0, 31, 2, 3, 4, 0, 0, 0, 8,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001117 9, 10, 0, 0, 0, 0, 0, 0, 0, 0,
1118 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001119 21, 22, 0, 198, 0, 0, 0, 25, 26, 0,
1120 27, 28, 29, 30, 0, 31, 0, 0, 0, 0,
1121 0, 0, 0, 0, 0, 0, 71, 0, 0, 1,
1122 2, 3, 4, 5, 6, 7, 8, 9, 10, 0,
1123 0, 0, 0, 0, 0, 0, 247, 11, 12, 13,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001124 14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001125 0, 0, 23, 24, 25, 26, 0, 27, 28, 29,
1126 30, 0, 31, 1, 2, 3, 4, 5, 6, 7,
1127 8, 9, 10, 0, 0, 0, 0, 0, 0, 0,
1128 0, 11, 12, 13, 14, 15, 16, 17, 18, 19,
1129 20, 21, 22, 0, 0, 0, 23, 24, 25, 26,
1130 0, 27, 28, 29, 30, 0, 31, 8, 9, 10,
1131 0, 0, 0, 0, 0, 0, 0, 0, 11, 12,
1132 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
1133 0, 0, 0, 0, 0, 25, 26, 0, 27, 28,
1134 29, 30, 229, 31, 8, 9, 10, 230, 0, 0,
1135 0, 0, 0, 0, 0, 11, 12, 13, 14, 15,
1136 16, 17, 18, 19, 20, 21, 22, 0, 0, 0,
1137 0, 0, 25, 26, 0, 27, 28, 29, 30, 0,
1138 31
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001139};
1140
1141static const yytype_int16 yycheck[] =
1142{
kbr@chromium.org205fef32011-11-22 20:50:02 +00001143 0, 160, 94, 86, 70, 127, 45, 0, 255, 60,
1144 40, 151, 85, 0, 36, 74, 72, 82, 74, 85,
1145 37, 268, 81, 106, 3, 81, 70, 42, 45, 8,
1146 9, 55, 56, 63, 284, 57, 51, 76, 288, 73,
1147 40, 85, 42, 135, 95, 75, 46, 79, 92, 93,
1148 82, 51, 82, 46, 33, 34, 35, 36, 37, 46,
1149 87, 88, 202, 63, 73, 109, 90, 91, 79, 79,
1150 79, 82, 194, 45, 3, 75, 76, 160, 170, 8,
1151 9, 73, 82, 84, 73, 86, 159, 79, 53, 54,
1152 79, 174, 73, 159, 73, 125, 79, 127, 79, 82,
1153 192, 62, 63, 64, 33, 34, 35, 36, 37, 74,
1154 71, 79, 204, 78, 82, 159, 256, 4, 5, 6,
1155 81, 183, 184, 185, 186, 125, 72, 127, 74, 269,
1156 74, 290, 37, 216, 217, 179, 180, 181, 182, 183,
1157 184, 185, 186, 187, 188, 189, 190, 191, 221, 289,
1158 76, 151, 33, 34, 35, 221, 57, 58, 79, 80,
1159 181, 182, 76, 255, 194, 45, 82, 187, 188, 45,
1160 72, 59, 61, 73, 72, 248, 268, 221, 75, 262,
1161 45, 72, 248, 82, 77, 277, 82, 72, 82, 72,
1162 74, 40, 45, 75, 194, 287, 74, 72, 75, 72,
1163 79, 75, 202, 75, 248, 75, 72, 290, 77, 73,
1164 210, 4, 5, 6, 82, 73, 16, 10, 11, 12,
1165 81, 171, 82, 189, 191, 82, 190, 57, 21, 22,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001166 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001167 64, 82, 5, 249, 252, 38, 39, 288, 41, 42,
1168 43, 44, 252, 46, 125, 255, 256, 55, 210, 46,
1169 -1, 252, -1, 268, -1, -1, -1, -1, 268, 269,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001170 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001171 -1, -1, -1, -1, 284, -1, -1, -1, 288, 289,
1172 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
1173 13, 14, 15, -1, 17, 18, 19, 20, 21, 22,
1174 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
1175 -1, -1, -1, 36, 37, 38, 39, 40, 41, 42,
1176 43, 44, 45, 46, 47, 48, 49, 50, -1, -1,
1177 53, 54, -1, -1, -1, -1, -1, -1, -1, -1,
1178 -1, -1, -1, -1, -1, -1, -1, -1, -1, 72,
1179 -1, -1, -1, 76, 77, -1, -1, -1, -1, 82,
1180 83, 84, -1, 86, 3, 4, 5, 6, 7, 8,
1181 9, 10, 11, 12, 13, 14, 15, -1, 17, 18,
1182 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
1183 29, 30, 31, 32, -1, -1, -1, 36, 37, 38,
1184 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
1185 49, 50, -1, -1, 53, 54, -1, -1, -1, -1,
zmo@google.com09c323a2011-08-12 18:22:25 +00001186 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001187 -1, -1, -1, 72, -1, -1, -1, 76, 77, -1,
1188 -1, -1, -1, 82, 83, 84, -1, 86, 3, 4,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001189 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1190 15, -1, 17, 18, 19, 20, 21, 22, 23, 24,
zmo@google.com09c323a2011-08-12 18:22:25 +00001191 25, 26, 27, 28, 29, 30, 31, 32, -1, -1,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001192 -1, 36, 37, 38, 39, 40, 41, 42, 43, 44,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001193 45, 46, 47, 48, 49, 50, -1, -1, 53, 54,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001194 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001195 -1, -1, -1, -1, -1, -1, -1, 72, -1, -1,
1196 -1, 76, -1, -1, -1, -1, -1, 82, 83, 84,
1197 -1, 86, 3, 4, 5, 6, 7, 8, 9, 10,
1198 11, 12, 13, 14, 15, -1, 17, 18, 19, 20,
1199 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
1200 31, 32, -1, -1, -1, 36, 37, 38, 39, 40,
1201 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
1202 -1, -1, 53, 54, -1, -1, -1, -1, -1, -1,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001203 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001204 -1, 72, -1, -1, -1, 76, -1, -1, -1, -1,
1205 -1, 82, 83, 84, -1, 86, 3, 4, 5, 6,
1206 7, 8, 9, 10, 11, 12, -1, -1, -1, -1,
1207 -1, -1, -1, -1, 21, 22, 23, 24, 25, 26,
1208 27, 28, 29, 30, 31, 32, -1, -1, -1, 36,
1209 37, 38, 39, -1, 41, 42, 43, 44, 45, 46,
1210 47, 48, 49, 50, -1, -1, 53, 54, -1, -1,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001211 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001212 -1, -1, -1, -1, -1, 72, -1, -1, -1, -1,
1213 -1, -1, -1, -1, -1, 82, 83, 84, -1, 86,
1214 3, 4, 5, 6, -1, 8, 9, 10, 11, 12,
1215 -1, -1, -1, -1, -1, -1, -1, -1, 21, 22,
1216 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
1217 -1, -1, -1, 36, 37, 38, 39, -1, 41, 42,
1218 43, 44, 45, 46, 47, 48, 49, 50, -1, -1,
1219 53, 54, -1, -1, -1, -1, -1, -1, -1, -1,
1220 -1, -1, -1, -1, -1, -1, -1, -1, -1, 72,
1221 -1, -1, -1, 10, 11, 12, -1, -1, -1, -1,
1222 83, 84, -1, 86, 21, 22, 23, 24, 25, 26,
1223 27, 28, 29, 30, 31, 32, -1, -1, -1, -1,
1224 -1, 38, 39, -1, 41, 42, 43, 44, 45, 46,
1225 47, 48, 49, 50, -1, -1, 53, 54, -1, -1,
1226 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1227 -1, -1, -1, -1, -1, 72, -1, -1, 75, 10,
1228 11, 12, -1, -1, -1, -1, 83, 84, -1, 86,
1229 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
1230 31, 32, -1, -1, -1, -1, -1, 38, 39, -1,
1231 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
1232 -1, -1, 53, 54, -1, -1, -1, -1, -1, -1,
1233 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1234 -1, 72, -1, -1, -1, 10, 11, 12, -1, -1,
1235 -1, 82, 83, 84, -1, 86, 21, 22, 23, 24,
1236 25, 26, 27, 28, 29, 30, 31, 32, -1, -1,
1237 -1, -1, -1, 38, 39, -1, 41, 42, 43, 44,
1238 45, 46, 47, 48, 49, 50, -1, -1, 53, 54,
1239 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1240 -1, -1, -1, -1, -1, -1, -1, 72, -1, -1,
1241 75, 10, 11, 12, -1, -1, -1, -1, 83, 84,
1242 -1, 86, 21, 22, 23, 24, 25, 26, 27, 28,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001243 29, 30, 31, 32, -1, -1, -1, -1, -1, 38,
1244 39, -1, 41, 42, 43, 44, 45, 46, 47, 48,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001245 49, 50, -1, -1, 53, 54, -1, -1, -1, -1,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001246 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001247 -1, -1, -1, 72, -1, -1, -1, 10, 11, 12,
1248 -1, -1, -1, -1, 83, 84, -1, 86, 21, 22,
1249 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
1250 -1, -1, -1, -1, -1, 38, 39, -1, 41, 42,
1251 43, 44, 45, 46, 47, 48, 49, 50, -1, -1,
1252 53, 54, -1, -1, -1, -1, -1, -1, -1, -1,
1253 -1, -1, -1, -1, -1, -1, -1, -1, -1, 72,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001254 4, 5, 6, -1, -1, -1, 10, 11, 12, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001255 83, 84, -1, 86, -1, -1, -1, 21, 22, 23,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001256 24, 25, 26, 27, 28, 29, 30, 31, 32, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001257 -1, -1, -1, -1, 38, 39, -1, 41, 42, 43,
1258 44, -1, 46, 4, 5, 6, -1, -1, -1, 10,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001259 11, 12, -1, -1, -1, -1, -1, -1, -1, -1,
1260 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001261 31, 32, -1, 77, -1, -1, -1, 38, 39, -1,
1262 41, 42, 43, 44, -1, 46, -1, -1, -1, -1,
1263 -1, -1, -1, -1, -1, -1, 0, -1, -1, 3,
1264 4, 5, 6, 7, 8, 9, 10, 11, 12, -1,
1265 -1, -1, -1, -1, -1, -1, 77, 21, 22, 23,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001266 24, 25, 26, 27, 28, 29, 30, 31, 32, -1,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001267 -1, -1, 36, 37, 38, 39, -1, 41, 42, 43,
1268 44, -1, 46, 3, 4, 5, 6, 7, 8, 9,
1269 10, 11, 12, -1, -1, -1, -1, -1, -1, -1,
1270 -1, 21, 22, 23, 24, 25, 26, 27, 28, 29,
1271 30, 31, 32, -1, -1, -1, 36, 37, 38, 39,
1272 -1, 41, 42, 43, 44, -1, 46, 10, 11, 12,
1273 -1, -1, -1, -1, -1, -1, -1, -1, 21, 22,
1274 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
1275 -1, -1, -1, -1, -1, 38, 39, -1, 41, 42,
1276 43, 44, 45, 46, 10, 11, 12, 50, -1, -1,
1277 -1, -1, -1, -1, -1, 21, 22, 23, 24, 25,
1278 26, 27, 28, 29, 30, 31, 32, -1, -1, -1,
1279 -1, -1, 38, 39, -1, 41, 42, 43, 44, -1,
1280 46
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001281};
1282
1283/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
1284 symbol of state STATE-NUM. */
1285static const yytype_uint8 yystos[] =
1286{
1287 0, 3, 4, 5, 6, 7, 8, 9, 10, 11,
1288 12, 21, 22, 23, 24, 25, 26, 27, 28, 29,
zmo@google.com09c323a2011-08-12 18:22:25 +00001289 30, 31, 32, 36, 37, 38, 39, 41, 42, 43,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001290 44, 46, 126, 127, 128, 129, 130, 135, 136, 137,
1291 138, 139, 140, 141, 142, 143, 172, 173, 174, 37,
1292 45, 140, 45, 76, 82, 175, 73, 79, 3, 33,
1293 34, 35, 132, 133, 138, 79, 82, 45, 139, 141,
1294 74, 0, 173, 141, 76, 145, 76, 158, 132, 131,
1295 134, 139, 133, 45, 72, 74, 81, 45, 47, 48,
1296 49, 50, 53, 54, 72, 83, 84, 86, 97, 98,
1297 99, 101, 102, 103, 104, 105, 106, 107, 108, 109,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001298 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
kbr@chromium.org205fef32011-11-22 20:50:02 +00001299 120, 121, 125, 142, 82, 144, 139, 146, 147, 13,
1300 14, 15, 17, 18, 19, 20, 40, 76, 77, 82,
1301 108, 121, 122, 124, 126, 127, 142, 151, 152, 153,
1302 154, 159, 160, 161, 164, 171, 45, 131, 134, 74,
1303 81, 75, 125, 122, 150, 108, 108, 124, 53, 54,
1304 74, 78, 73, 73, 79, 39, 122, 72, 108, 87,
1305 88, 84, 86, 55, 56, 90, 91, 57, 58, 59,
1306 61, 60, 95, 75, 146, 45, 148, 149, 77, 147,
1307 82, 82, 166, 72, 72, 82, 82, 124, 72, 77,
1308 155, 62, 63, 64, 71, 81, 123, 79, 82, 77,
1309 152, 74, 75, 125, 150, 75, 73, 100, 124, 45,
1310 50, 103, 122, 108, 108, 110, 110, 112, 112, 112,
1311 112, 113, 113, 117, 118, 119, 124, 77, 74, 79,
1312 82, 152, 167, 124, 82, 165, 159, 122, 122, 125,
1313 75, 75, 80, 125, 149, 40, 151, 160, 168, 73,
1314 124, 137, 163, 156, 75, 122, 75, 72, 163, 169,
1315 170, 152, 162, 45, 73, 77, 124, 82, 73, 16,
1316 81, 153, 157, 158, 73, 124, 157, 152, 150, 82
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001317};
1318
1319#define yyerrok (yyerrstatus = 0)
1320#define yyclearin (yychar = YYEMPTY)
1321#define YYEMPTY (-2)
1322#define YYEOF 0
1323
1324#define YYACCEPT goto yyacceptlab
1325#define YYABORT goto yyabortlab
1326#define YYERROR goto yyerrorlab
1327
1328
1329/* Like YYERROR except do call yyerror. This remains here temporarily
1330 to ease the transition to the new meaning of YYERROR, for GCC.
1331 Once GCC version 2 has supplanted version 1, this can go. */
1332
1333#define YYFAIL goto yyerrlab
1334
1335#define YYRECOVERING() (!!yyerrstatus)
1336
1337#define YYBACKUP(Token, Value) \
1338do \
1339 if (yychar == YYEMPTY && yylen == 1) \
1340 { \
1341 yychar = (Token); \
1342 yylval = (Value); \
1343 yytoken = YYTRANSLATE (yychar); \
1344 YYPOPSTACK (1); \
1345 goto yybackup; \
1346 } \
1347 else \
1348 { \
1349 yyerror (context, YY_("syntax error: cannot back up")); \
1350 YYERROR; \
1351 } \
1352while (YYID (0))
1353
1354
1355#define YYTERROR 1
1356#define YYERRCODE 256
1357
1358
1359/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
1360 If N is 0, then set CURRENT to the empty location which ends
1361 the previous symbol: RHS[0] (always defined). */
1362
1363#define YYRHSLOC(Rhs, K) ((Rhs)[K])
1364#ifndef YYLLOC_DEFAULT
1365# define YYLLOC_DEFAULT(Current, Rhs, N) \
1366 do \
1367 if (YYID (N)) \
1368 { \
1369 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
1370 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
1371 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
1372 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
1373 } \
1374 else \
1375 { \
1376 (Current).first_line = (Current).last_line = \
1377 YYRHSLOC (Rhs, 0).last_line; \
1378 (Current).first_column = (Current).last_column = \
1379 YYRHSLOC (Rhs, 0).last_column; \
1380 } \
1381 while (YYID (0))
1382#endif
1383
1384
1385/* YY_LOCATION_PRINT -- Print the location on the stream.
1386 This macro was not mandated originally: define only if we know
1387 we won't break user code: when these are the locations we know. */
1388
1389#ifndef YY_LOCATION_PRINT
kbr@chromium.org205fef32011-11-22 20:50:02 +00001390# if YYLTYPE_IS_TRIVIAL
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001391# define YY_LOCATION_PRINT(File, Loc) \
1392 fprintf (File, "%d.%d-%d.%d", \
1393 (Loc).first_line, (Loc).first_column, \
1394 (Loc).last_line, (Loc).last_column)
1395# else
1396# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1397# endif
1398#endif
1399
1400
1401/* YYLEX -- calling `yylex' with the right arguments. */
1402
1403#ifdef YYLEX_PARAM
1404# define YYLEX yylex (&yylval, YYLEX_PARAM)
1405#else
1406# define YYLEX yylex (&yylval)
1407#endif
1408
1409/* Enable debugging if requested. */
1410#if YYDEBUG
1411
1412# ifndef YYFPRINTF
1413# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1414# define YYFPRINTF fprintf
1415# endif
1416
1417# define YYDPRINTF(Args) \
1418do { \
1419 if (yydebug) \
1420 YYFPRINTF Args; \
1421} while (YYID (0))
1422
1423# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
1424do { \
1425 if (yydebug) \
1426 { \
1427 YYFPRINTF (stderr, "%s ", Title); \
1428 yy_symbol_print (stderr, \
1429 Type, Value, context); \
1430 YYFPRINTF (stderr, "\n"); \
1431 } \
1432} while (YYID (0))
1433
1434
1435/*--------------------------------.
1436| Print this symbol on YYOUTPUT. |
1437`--------------------------------*/
1438
1439/*ARGSUSED*/
1440#if (defined __STDC__ || defined __C99__FUNC__ \
1441 || defined __cplusplus || defined _MSC_VER)
1442static void
1443yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, TParseContext* context)
1444#else
1445static void
1446yy_symbol_value_print (yyoutput, yytype, yyvaluep, context)
1447 FILE *yyoutput;
1448 int yytype;
1449 YYSTYPE const * const yyvaluep;
1450 TParseContext* context;
1451#endif
1452{
1453 if (!yyvaluep)
1454 return;
1455 YYUSE (context);
1456# ifdef YYPRINT
1457 if (yytype < YYNTOKENS)
1458 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1459# else
1460 YYUSE (yyoutput);
1461# endif
1462 switch (yytype)
1463 {
1464 default:
1465 break;
1466 }
1467}
1468
1469
1470/*--------------------------------.
1471| Print this symbol on YYOUTPUT. |
1472`--------------------------------*/
1473
1474#if (defined __STDC__ || defined __C99__FUNC__ \
1475 || defined __cplusplus || defined _MSC_VER)
1476static void
1477yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, TParseContext* context)
1478#else
1479static void
1480yy_symbol_print (yyoutput, yytype, yyvaluep, context)
1481 FILE *yyoutput;
1482 int yytype;
1483 YYSTYPE const * const yyvaluep;
1484 TParseContext* context;
1485#endif
1486{
1487 if (yytype < YYNTOKENS)
1488 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1489 else
1490 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1491
1492 yy_symbol_value_print (yyoutput, yytype, yyvaluep, context);
1493 YYFPRINTF (yyoutput, ")");
1494}
1495
1496/*------------------------------------------------------------------.
1497| yy_stack_print -- Print the state stack from its BOTTOM up to its |
1498| TOP (included). |
1499`------------------------------------------------------------------*/
1500
1501#if (defined __STDC__ || defined __C99__FUNC__ \
1502 || defined __cplusplus || defined _MSC_VER)
1503static void
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001504yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001505#else
1506static void
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001507yy_stack_print (bottom, top)
1508 yytype_int16 *bottom;
1509 yytype_int16 *top;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001510#endif
1511{
1512 YYFPRINTF (stderr, "Stack now");
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001513 for (; bottom <= top; ++bottom)
1514 YYFPRINTF (stderr, " %d", *bottom);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001515 YYFPRINTF (stderr, "\n");
1516}
1517
1518# define YY_STACK_PRINT(Bottom, Top) \
1519do { \
1520 if (yydebug) \
1521 yy_stack_print ((Bottom), (Top)); \
1522} while (YYID (0))
1523
1524
1525/*------------------------------------------------.
1526| Report that the YYRULE is going to be reduced. |
1527`------------------------------------------------*/
1528
1529#if (defined __STDC__ || defined __C99__FUNC__ \
1530 || defined __cplusplus || defined _MSC_VER)
1531static void
1532yy_reduce_print (YYSTYPE *yyvsp, int yyrule, TParseContext* context)
1533#else
1534static void
1535yy_reduce_print (yyvsp, yyrule, context)
1536 YYSTYPE *yyvsp;
1537 int yyrule;
1538 TParseContext* context;
1539#endif
1540{
1541 int yynrhs = yyr2[yyrule];
1542 int yyi;
1543 unsigned long int yylno = yyrline[yyrule];
1544 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1545 yyrule - 1, yylno);
1546 /* The symbols being reduced. */
1547 for (yyi = 0; yyi < yynrhs; yyi++)
1548 {
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001549 fprintf (stderr, " $%d = ", yyi + 1);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001550 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1551 &(yyvsp[(yyi + 1) - (yynrhs)])
1552 , context);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001553 fprintf (stderr, "\n");
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001554 }
1555}
1556
1557# define YY_REDUCE_PRINT(Rule) \
1558do { \
1559 if (yydebug) \
1560 yy_reduce_print (yyvsp, Rule, context); \
1561} while (YYID (0))
1562
1563/* Nonzero means print parse trace. It is left uninitialized so that
1564 multiple parsers can coexist. */
1565int yydebug;
1566#else /* !YYDEBUG */
1567# define YYDPRINTF(Args)
1568# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1569# define YY_STACK_PRINT(Bottom, Top)
1570# define YY_REDUCE_PRINT(Rule)
1571#endif /* !YYDEBUG */
1572
1573
1574/* YYINITDEPTH -- initial size of the parser's stacks. */
1575#ifndef YYINITDEPTH
1576# define YYINITDEPTH 200
1577#endif
1578
1579/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1580 if the built-in stack extension method is used).
1581
1582 Do not make this value too large; the results are undefined if
1583 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1584 evaluated with infinite-precision integer arithmetic. */
1585
1586#ifndef YYMAXDEPTH
1587# define YYMAXDEPTH 10000
1588#endif
1589
1590
1591
1592#if YYERROR_VERBOSE
1593
1594# ifndef yystrlen
1595# if defined __GLIBC__ && defined _STRING_H
1596# define yystrlen strlen
1597# else
1598/* Return the length of YYSTR. */
1599#if (defined __STDC__ || defined __C99__FUNC__ \
1600 || defined __cplusplus || defined _MSC_VER)
1601static YYSIZE_T
1602yystrlen (const char *yystr)
1603#else
1604static YYSIZE_T
1605yystrlen (yystr)
1606 const char *yystr;
1607#endif
1608{
1609 YYSIZE_T yylen;
1610 for (yylen = 0; yystr[yylen]; yylen++)
1611 continue;
1612 return yylen;
1613}
1614# endif
1615# endif
1616
1617# ifndef yystpcpy
1618# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1619# define yystpcpy stpcpy
1620# else
1621/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1622 YYDEST. */
1623#if (defined __STDC__ || defined __C99__FUNC__ \
1624 || defined __cplusplus || defined _MSC_VER)
1625static char *
1626yystpcpy (char *yydest, const char *yysrc)
1627#else
1628static char *
1629yystpcpy (yydest, yysrc)
1630 char *yydest;
1631 const char *yysrc;
1632#endif
1633{
1634 char *yyd = yydest;
1635 const char *yys = yysrc;
1636
1637 while ((*yyd++ = *yys++) != '\0')
1638 continue;
1639
1640 return yyd - 1;
1641}
1642# endif
1643# endif
1644
1645# ifndef yytnamerr
1646/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1647 quotes and backslashes, so that it's suitable for yyerror. The
1648 heuristic is that double-quoting is unnecessary unless the string
1649 contains an apostrophe, a comma, or backslash (other than
1650 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1651 null, do not copy; instead, return the length of what the result
1652 would have been. */
1653static YYSIZE_T
1654yytnamerr (char *yyres, const char *yystr)
1655{
1656 if (*yystr == '"')
1657 {
1658 YYSIZE_T yyn = 0;
1659 char const *yyp = yystr;
1660
1661 for (;;)
1662 switch (*++yyp)
1663 {
1664 case '\'':
1665 case ',':
1666 goto do_not_strip_quotes;
1667
1668 case '\\':
1669 if (*++yyp != '\\')
1670 goto do_not_strip_quotes;
1671 /* Fall through. */
1672 default:
1673 if (yyres)
1674 yyres[yyn] = *yyp;
1675 yyn++;
1676 break;
1677
1678 case '"':
1679 if (yyres)
1680 yyres[yyn] = '\0';
1681 return yyn;
1682 }
1683 do_not_strip_quotes: ;
1684 }
1685
1686 if (! yyres)
1687 return yystrlen (yystr);
1688
1689 return yystpcpy (yyres, yystr) - yyres;
1690}
1691# endif
1692
1693/* Copy into YYRESULT an error message about the unexpected token
1694 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1695 including the terminating null byte. If YYRESULT is null, do not
1696 copy anything; just return the number of bytes that would be
1697 copied. As a special case, return 0 if an ordinary "syntax error"
1698 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1699 size calculation. */
1700static YYSIZE_T
1701yysyntax_error (char *yyresult, int yystate, int yychar)
1702{
1703 int yyn = yypact[yystate];
1704
1705 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1706 return 0;
1707 else
1708 {
1709 int yytype = YYTRANSLATE (yychar);
1710 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1711 YYSIZE_T yysize = yysize0;
1712 YYSIZE_T yysize1;
1713 int yysize_overflow = 0;
1714 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1715 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1716 int yyx;
1717
1718# if 0
1719 /* This is so xgettext sees the translatable formats that are
1720 constructed on the fly. */
1721 YY_("syntax error, unexpected %s");
1722 YY_("syntax error, unexpected %s, expecting %s");
1723 YY_("syntax error, unexpected %s, expecting %s or %s");
1724 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1725 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1726# endif
1727 char *yyfmt;
1728 char const *yyf;
1729 static char const yyunexpected[] = "syntax error, unexpected %s";
1730 static char const yyexpecting[] = ", expecting %s";
1731 static char const yyor[] = " or %s";
1732 char yyformat[sizeof yyunexpected
1733 + sizeof yyexpecting - 1
1734 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1735 * (sizeof yyor - 1))];
1736 char const *yyprefix = yyexpecting;
1737
1738 /* Start YYX at -YYN if negative to avoid negative indexes in
1739 YYCHECK. */
1740 int yyxbegin = yyn < 0 ? -yyn : 0;
1741
1742 /* Stay within bounds of both yycheck and yytname. */
1743 int yychecklim = YYLAST - yyn + 1;
1744 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1745 int yycount = 1;
1746
1747 yyarg[0] = yytname[yytype];
1748 yyfmt = yystpcpy (yyformat, yyunexpected);
1749
1750 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1751 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1752 {
1753 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1754 {
1755 yycount = 1;
1756 yysize = yysize0;
1757 yyformat[sizeof yyunexpected - 1] = '\0';
1758 break;
1759 }
1760 yyarg[yycount++] = yytname[yyx];
1761 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1762 yysize_overflow |= (yysize1 < yysize);
1763 yysize = yysize1;
1764 yyfmt = yystpcpy (yyfmt, yyprefix);
1765 yyprefix = yyor;
1766 }
1767
1768 yyf = YY_(yyformat);
1769 yysize1 = yysize + yystrlen (yyf);
1770 yysize_overflow |= (yysize1 < yysize);
1771 yysize = yysize1;
1772
1773 if (yysize_overflow)
1774 return YYSIZE_MAXIMUM;
1775
1776 if (yyresult)
1777 {
1778 /* Avoid sprintf, as that infringes on the user's name space.
1779 Don't have undefined behavior even if the translation
1780 produced a string with the wrong number of "%s"s. */
1781 char *yyp = yyresult;
1782 int yyi = 0;
1783 while ((*yyp = *yyf) != '\0')
1784 {
1785 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1786 {
1787 yyp += yytnamerr (yyp, yyarg[yyi++]);
1788 yyf += 2;
1789 }
1790 else
1791 {
1792 yyp++;
1793 yyf++;
1794 }
1795 }
1796 }
1797 return yysize;
1798 }
1799}
1800#endif /* YYERROR_VERBOSE */
1801
1802
1803/*-----------------------------------------------.
1804| Release the memory associated to this symbol. |
1805`-----------------------------------------------*/
1806
1807/*ARGSUSED*/
1808#if (defined __STDC__ || defined __C99__FUNC__ \
1809 || defined __cplusplus || defined _MSC_VER)
1810static void
1811yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, TParseContext* context)
1812#else
1813static void
1814yydestruct (yymsg, yytype, yyvaluep, context)
1815 const char *yymsg;
1816 int yytype;
1817 YYSTYPE *yyvaluep;
1818 TParseContext* context;
1819#endif
1820{
1821 YYUSE (yyvaluep);
1822 YYUSE (context);
1823
1824 if (!yymsg)
1825 yymsg = "Deleting";
1826 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1827
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001828 switch (yytype)
1829 {
1830
1831 default:
1832 break;
1833 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001834}
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001835
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001836
1837/* Prevent warnings from -Wmissing-prototypes. */
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001838
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001839#ifdef YYPARSE_PARAM
1840#if defined __STDC__ || defined __cplusplus
1841int yyparse (void *YYPARSE_PARAM);
1842#else
1843int yyparse ();
1844#endif
1845#else /* ! YYPARSE_PARAM */
1846#if defined __STDC__ || defined __cplusplus
1847int yyparse (TParseContext* context);
1848#else
1849int yyparse ();
1850#endif
1851#endif /* ! YYPARSE_PARAM */
1852
1853
1854
1855
1856
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001857
1858/*----------.
1859| yyparse. |
1860`----------*/
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001861
1862#ifdef YYPARSE_PARAM
1863#if (defined __STDC__ || defined __C99__FUNC__ \
1864 || defined __cplusplus || defined _MSC_VER)
1865int
1866yyparse (void *YYPARSE_PARAM)
1867#else
1868int
1869yyparse (YYPARSE_PARAM)
1870 void *YYPARSE_PARAM;
1871#endif
1872#else /* ! YYPARSE_PARAM */
1873#if (defined __STDC__ || defined __C99__FUNC__ \
1874 || defined __cplusplus || defined _MSC_VER)
1875int
1876yyparse (TParseContext* context)
1877#else
1878int
1879yyparse (context)
1880 TParseContext* context;
1881#endif
1882#endif
1883{
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001884 /* The look-ahead symbol. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001885int yychar;
1886
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001887/* The semantic value of the look-ahead symbol. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001888YYSTYPE yylval;
1889
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001890/* Number of syntax errors so far. */
1891int yynerrs;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001892
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001893 int yystate;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001894 int yyn;
1895 int yyresult;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001896 /* Number of tokens to shift before error messages enabled. */
1897 int yyerrstatus;
1898 /* Look-ahead token as an internal (translated) token number. */
1899 int yytoken = 0;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001900#if YYERROR_VERBOSE
1901 /* Buffer for error messages, and its allocated size. */
1902 char yymsgbuf[128];
1903 char *yymsg = yymsgbuf;
1904 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1905#endif
1906
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001907 /* Three stacks and their tools:
1908 `yyss': related to states,
1909 `yyvs': related to semantic values,
1910 `yyls': related to locations.
1911
1912 Refer to the stacks thru separate pointers, to allow yyoverflow
1913 to reallocate them elsewhere. */
1914
1915 /* The state stack. */
1916 yytype_int16 yyssa[YYINITDEPTH];
1917 yytype_int16 *yyss = yyssa;
1918 yytype_int16 *yyssp;
1919
1920 /* The semantic value stack. */
1921 YYSTYPE yyvsa[YYINITDEPTH];
1922 YYSTYPE *yyvs = yyvsa;
1923 YYSTYPE *yyvsp;
1924
1925
1926
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001927#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1928
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001929 YYSIZE_T yystacksize = YYINITDEPTH;
1930
1931 /* The variables used to return semantic value and location from the
1932 action routines. */
1933 YYSTYPE yyval;
1934
1935
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001936 /* The number of symbols on the RHS of the reduced rule.
1937 Keep to zero when no symbol should be popped. */
1938 int yylen = 0;
1939
1940 YYDPRINTF ((stderr, "Starting parse\n"));
1941
1942 yystate = 0;
1943 yyerrstatus = 0;
1944 yynerrs = 0;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001945 yychar = YYEMPTY; /* Cause a token to be read. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001946
1947 /* Initialize stack pointers.
1948 Waste one element of value and location stack
1949 so that they stay on the same level as the state stack.
1950 The wasted elements are never initialized. */
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001951
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001952 yyssp = yyss;
1953 yyvsp = yyvs;
1954
1955 goto yysetstate;
1956
1957/*------------------------------------------------------------.
1958| yynewstate -- Push a new state, which is found in yystate. |
1959`------------------------------------------------------------*/
1960 yynewstate:
1961 /* In all cases, when you get here, the value and location stacks
1962 have just been pushed. So pushing a state here evens the stacks. */
1963 yyssp++;
1964
1965 yysetstate:
1966 *yyssp = yystate;
1967
1968 if (yyss + yystacksize - 1 <= yyssp)
1969 {
1970 /* Get the current used size of the three stacks, in elements. */
1971 YYSIZE_T yysize = yyssp - yyss + 1;
1972
1973#ifdef yyoverflow
1974 {
1975 /* Give user a chance to reallocate the stack. Use copies of
1976 these so that the &'s don't force the real ones into
1977 memory. */
1978 YYSTYPE *yyvs1 = yyvs;
1979 yytype_int16 *yyss1 = yyss;
1980
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001981
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001982 /* Each stack pointer address is followed by the size of the
1983 data in use in that stack, in bytes. This used to be a
1984 conditional around just the two extra args, but that might
1985 be undefined if yyoverflow is a macro. */
1986 yyoverflow (YY_("memory exhausted"),
1987 &yyss1, yysize * sizeof (*yyssp),
1988 &yyvs1, yysize * sizeof (*yyvsp),
apatrick@chromium.org536888b2012-01-25 02:10:25 +00001989
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001990 &yystacksize);
1991
1992 yyss = yyss1;
1993 yyvs = yyvs1;
1994 }
1995#else /* no yyoverflow */
1996# ifndef YYSTACK_RELOCATE
1997 goto yyexhaustedlab;
1998# else
1999 /* Extend the stack our own way. */
2000 if (YYMAXDEPTH <= yystacksize)
2001 goto yyexhaustedlab;
2002 yystacksize *= 2;
2003 if (YYMAXDEPTH < yystacksize)
2004 yystacksize = YYMAXDEPTH;
2005
2006 {
2007 yytype_int16 *yyss1 = yyss;
2008 union yyalloc *yyptr =
2009 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
2010 if (! yyptr)
2011 goto yyexhaustedlab;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002012 YYSTACK_RELOCATE (yyss);
2013 YYSTACK_RELOCATE (yyvs);
2014
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002015# undef YYSTACK_RELOCATE
2016 if (yyss1 != yyssa)
2017 YYSTACK_FREE (yyss1);
2018 }
2019# endif
2020#endif /* no yyoverflow */
2021
2022 yyssp = yyss + yysize - 1;
2023 yyvsp = yyvs + yysize - 1;
2024
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002025
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002026 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
2027 (unsigned long int) yystacksize));
2028
2029 if (yyss + yystacksize - 1 <= yyssp)
2030 YYABORT;
2031 }
2032
2033 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
2034
2035 goto yybackup;
2036
2037/*-----------.
2038| yybackup. |
2039`-----------*/
2040yybackup:
2041
2042 /* Do appropriate processing given the current state. Read a
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002043 look-ahead token if we need one and don't already have one. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002044
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002045 /* First try to decide what to do without reference to look-ahead token. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002046 yyn = yypact[yystate];
2047 if (yyn == YYPACT_NINF)
2048 goto yydefault;
2049
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002050 /* Not known => get a look-ahead token if don't already have one. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002051
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002052 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002053 if (yychar == YYEMPTY)
2054 {
2055 YYDPRINTF ((stderr, "Reading a token: "));
2056 yychar = YYLEX;
2057 }
2058
2059 if (yychar <= YYEOF)
2060 {
2061 yychar = yytoken = YYEOF;
2062 YYDPRINTF ((stderr, "Now at end of input.\n"));
2063 }
2064 else
2065 {
2066 yytoken = YYTRANSLATE (yychar);
2067 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
2068 }
2069
2070 /* If the proper action on seeing token YYTOKEN is to reduce or to
2071 detect an error, take that action. */
2072 yyn += yytoken;
2073 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
2074 goto yydefault;
2075 yyn = yytable[yyn];
2076 if (yyn <= 0)
2077 {
2078 if (yyn == 0 || yyn == YYTABLE_NINF)
2079 goto yyerrlab;
2080 yyn = -yyn;
2081 goto yyreduce;
2082 }
2083
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002084 if (yyn == YYFINAL)
2085 YYACCEPT;
2086
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002087 /* Count tokens shifted since error; after three, turn off error
2088 status. */
2089 if (yyerrstatus)
2090 yyerrstatus--;
2091
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002092 /* Shift the look-ahead token. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002093 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
2094
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002095 /* Discard the shifted token unless it is eof. */
2096 if (yychar != YYEOF)
2097 yychar = YYEMPTY;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002098
2099 yystate = yyn;
2100 *++yyvsp = yylval;
2101
2102 goto yynewstate;
2103
2104
2105/*-----------------------------------------------------------.
2106| yydefault -- do the default action for the current state. |
2107`-----------------------------------------------------------*/
2108yydefault:
2109 yyn = yydefact[yystate];
2110 if (yyn == 0)
2111 goto yyerrlab;
2112 goto yyreduce;
2113
2114
2115/*-----------------------------.
2116| yyreduce -- Do a reduction. |
2117`-----------------------------*/
2118yyreduce:
2119 /* yyn is the number of a rule to reduce with. */
2120 yylen = yyr2[yyn];
2121
2122 /* If YYLEN is nonzero, implement the default value of the action:
2123 `$$ = $1'.
2124
2125 Otherwise, the following line sets YYVAL to garbage.
2126 This behavior is undocumented and Bison
2127 users should not rely upon it. Assigning to YYVAL
2128 unconditionally makes the parser a bit smaller, and it avoids a
2129 GCC warning that YYVAL may be used uninitialized. */
2130 yyval = yyvsp[1-yylen];
2131
2132
2133 YY_REDUCE_PRINT (yyn);
2134 switch (yyn)
2135 {
2136 case 2:
2137
2138 {
2139 // The symbol table search was done in the lexical phase
2140 const TSymbol* symbol = (yyvsp[(1) - (1)].lex).symbol;
2141 const TVariable* variable;
2142 if (symbol == 0) {
2143 context->error((yyvsp[(1) - (1)].lex).line, "undeclared identifier", (yyvsp[(1) - (1)].lex).string->c_str(), "");
2144 context->recover();
2145 TType type(EbtFloat, EbpUndefined);
2146 TVariable* fakeVariable = new TVariable((yyvsp[(1) - (1)].lex).string, type);
2147 context->symbolTable.insert(*fakeVariable);
2148 variable = fakeVariable;
2149 } else {
2150 // This identifier can only be a variable type symbol
2151 if (! symbol->isVariable()) {
2152 context->error((yyvsp[(1) - (1)].lex).line, "variable expected", (yyvsp[(1) - (1)].lex).string->c_str(), "");
2153 context->recover();
2154 }
2155 variable = static_cast<const TVariable*>(symbol);
2156 }
2157
2158 // don't delete $1.string, it's used by error recovery, and the pool
2159 // pop will reclaim the memory
2160
2161 if (variable->getType().getQualifier() == EvqConst ) {
2162 ConstantUnion* constArray = variable->getConstPointer();
2163 TType t(variable->getType());
2164 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(constArray, t, (yyvsp[(1) - (1)].lex).line);
2165 } else
2166 (yyval.interm.intermTypedNode) = context->intermediate.addSymbol(variable->getUniqueId(),
2167 variable->getName(),
2168 variable->getType(), (yyvsp[(1) - (1)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002169 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002170 break;
2171
2172 case 3:
2173
2174 {
2175 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002176 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002177 break;
2178
2179 case 4:
2180
2181 {
2182 //
2183 // INT_TYPE is only 16-bit plus sign bit for vertex/fragment shaders,
2184 // check for overflow for constants
2185 //
2186 if (abs((yyvsp[(1) - (1)].lex).i) >= (1 << 16)) {
2187 context->error((yyvsp[(1) - (1)].lex).line, " integer constant overflow", "", "");
2188 context->recover();
2189 }
2190 ConstantUnion *unionArray = new ConstantUnion[1];
2191 unionArray->setIConst((yyvsp[(1) - (1)].lex).i);
2192 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002193 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002194 break;
2195
2196 case 5:
2197
2198 {
2199 ConstantUnion *unionArray = new ConstantUnion[1];
2200 unionArray->setFConst((yyvsp[(1) - (1)].lex).f);
2201 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002202 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002203 break;
2204
2205 case 6:
2206
2207 {
2208 ConstantUnion *unionArray = new ConstantUnion[1];
2209 unionArray->setBConst((yyvsp[(1) - (1)].lex).b);
2210 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002211 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002212 break;
2213
2214 case 7:
2215
2216 {
2217 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (3)].interm.intermTypedNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002218 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002219 break;
2220
2221 case 8:
2222
2223 {
2224 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002225 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002226 break;
2227
2228 case 9:
2229
2230 {
2231 if (!(yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isVector()) {
2232 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode())
2233 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(), "");
2234 else
2235 context->error((yyvsp[(2) - (4)].lex).line, " left of '[' is not of type array, matrix, or vector ", "expression", "");
2236 context->recover();
2237 }
2238 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst && (yyvsp[(3) - (4)].interm.intermTypedNode)->getQualifier() == EvqConst) {
2239 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) { // constant folding for arrays
2240 (yyval.interm.intermTypedNode) = context->addConstArrayNode((yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2241 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector()) { // constant folding for vectors
2242 TVectorFields fields;
2243 fields.num = 1;
2244 fields.offsets[0] = (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(); // need to do it this way because v.xy sends fields integer array
2245 (yyval.interm.intermTypedNode) = context->addConstVectorNode(fields, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2246 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix()) { // constant folding for matrices
2247 (yyval.interm.intermTypedNode) = context->addConstMatrixNode((yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2248 }
2249 } else {
2250 if ((yyvsp[(3) - (4)].interm.intermTypedNode)->getQualifier() == EvqConst) {
2251 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() ) {
2252 context->error((yyvsp[(2) - (4)].lex).line, "", "[", "field selection out of range '%d'", (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst());
2253 context->recover();
2254 } else {
2255 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) {
2256 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize() == 0) {
2257 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getMaxArraySize() <= (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst()) {
2258 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))
2259 context->recover();
2260 } else {
2261 if (context->arraySetMaxSize((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getTypePointer(), 0, false, (yyvsp[(2) - (4)].lex).line))
2262 context->recover();
2263 }
2264 } else if ( (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst() >= (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize()) {
2265 context->error((yyvsp[(2) - (4)].lex).line, "", "[", "array index out of range '%d'", (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst());
2266 context->recover();
2267 }
2268 }
2269 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(3) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2270 }
2271 } else {
2272 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize() == 0) {
2273 context->error((yyvsp[(2) - (4)].lex).line, "", "[", "array must be redeclared with a size before being indexed with a variable");
2274 context->recover();
2275 }
2276
2277 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexIndirect, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(3) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2278 }
2279 }
2280 if ((yyval.interm.intermTypedNode) == 0) {
2281 ConstantUnion *unionArray = new ConstantUnion[1];
2282 unionArray->setFConst(0.0f);
2283 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpHigh, EvqConst), (yyvsp[(2) - (4)].lex).line);
2284 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) {
2285 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getStruct())
2286 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getStruct(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getTypeName()));
2287 else
2288 (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()));
2289
2290 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst)
2291 (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConst);
2292 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst)
2293 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqConst, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize()));
2294 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix())
2295 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize()));
2296 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst)
2297 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqConst));
2298 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector())
2299 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary));
2300 else
2301 (yyval.interm.intermTypedNode)->setType((yyvsp[(1) - (4)].interm.intermTypedNode)->getType());
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002302 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002303 break;
2304
2305 case 10:
2306
2307 {
2308 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002309 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002310 break;
2311
2312 case 11:
2313
2314 {
2315 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isArray()) {
2316 context->error((yyvsp[(3) - (3)].lex).line, "cannot apply dot operator to an array", ".", "");
2317 context->recover();
2318 }
2319
2320 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isVector()) {
2321 TVectorFields fields;
2322 if (! context->parseVectorFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yyvsp[(3) - (3)].lex).line)) {
2323 fields.num = 1;
2324 fields.offsets[0] = 0;
2325 context->recover();
2326 }
2327
2328 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) { // constant folding for vector fields
2329 (yyval.interm.intermTypedNode) = context->addConstVectorNode(fields, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].lex).line);
2330 if ((yyval.interm.intermTypedNode) == 0) {
2331 context->recover();
2332 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2333 }
2334 else
2335 (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()));
2336 } else {
2337 if (fields.num == 1) {
2338 ConstantUnion *unionArray = new ConstantUnion[1];
2339 unionArray->setIConst(fields.offsets[0]);
2340 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line);
2341 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2342 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision()));
2343 } else {
2344 TString vectorString = *(yyvsp[(3) - (3)].lex).string;
2345 TIntermTyped* index = context->intermediate.addSwizzle(fields, (yyvsp[(3) - (3)].lex).line);
2346 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpVectorSwizzle, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2347 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (int) vectorString.size()));
2348 }
2349 }
2350 } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isMatrix()) {
2351 TMatrixFields fields;
2352 if (! context->parseMatrixFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yyvsp[(3) - (3)].lex).line)) {
2353 fields.wholeRow = false;
2354 fields.wholeCol = false;
2355 fields.row = 0;
2356 fields.col = 0;
2357 context->recover();
2358 }
2359
2360 if (fields.wholeRow || fields.wholeCol) {
2361 context->error((yyvsp[(2) - (3)].lex).line, " non-scalar fields not implemented yet", ".", "");
2362 context->recover();
2363 ConstantUnion *unionArray = new ConstantUnion[1];
2364 unionArray->setIConst(0);
2365 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line);
2366 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2367 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(),EvqTemporary, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize()));
2368 } else {
2369 ConstantUnion *unionArray = new ConstantUnion[1];
2370 unionArray->setIConst(fields.col * (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize() + fields.row);
2371 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line);
2372 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2373 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision()));
2374 }
2375 } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType() == EbtStruct) {
2376 bool fieldFound = false;
2377 const TTypeList* fields = (yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getStruct();
2378 if (fields == 0) {
2379 context->error((yyvsp[(2) - (3)].lex).line, "structure has no fields", "Internal Error", "");
2380 context->recover();
2381 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2382 } else {
2383 unsigned int i;
2384 for (i = 0; i < fields->size(); ++i) {
2385 if ((*fields)[i].type->getFieldName() == *(yyvsp[(3) - (3)].lex).string) {
2386 fieldFound = true;
2387 break;
2388 }
2389 }
2390 if (fieldFound) {
2391 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) {
2392 (yyval.interm.intermTypedNode) = context->addConstStruct(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
2393 if ((yyval.interm.intermTypedNode) == 0) {
2394 context->recover();
2395 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2396 }
2397 else {
2398 (yyval.interm.intermTypedNode)->setType(*(*fields)[i].type);
2399 // change the qualifier of the return type, not of the structure field
2400 // as the structure definition is shared between various structures.
2401 (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConst);
2402 }
2403 } else {
2404 ConstantUnion *unionArray = new ConstantUnion[1];
2405 unionArray->setIConst(i);
2406 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, *(*fields)[i].type, (yyvsp[(3) - (3)].lex).line);
2407 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirectStruct, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2408 (yyval.interm.intermTypedNode)->setType(*(*fields)[i].type);
2409 }
2410 } else {
2411 context->error((yyvsp[(2) - (3)].lex).line, " no such field in structure", (yyvsp[(3) - (3)].lex).string->c_str(), "");
2412 context->recover();
2413 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2414 }
2415 }
2416 } else {
2417 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(), "");
2418 context->recover();
2419 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2420 }
2421 // don't delete $3.string, it's from the pool
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002422 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002423 break;
2424
2425 case 12:
2426
2427 {
2428 if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode)))
2429 context->recover();
2430 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostIncrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line, context->symbolTable);
2431 if ((yyval.interm.intermTypedNode) == 0) {
2432 context->unaryOpError((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
2433 context->recover();
2434 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode);
2435 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002436 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002437 break;
2438
2439 case 13:
2440
2441 {
2442 if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode)))
2443 context->recover();
2444 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostDecrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line, context->symbolTable);
2445 if ((yyval.interm.intermTypedNode) == 0) {
2446 context->unaryOpError((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
2447 context->recover();
2448 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode);
2449 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002450 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002451 break;
2452
2453 case 14:
2454
2455 {
2456 if (context->integerErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode), "[]"))
2457 context->recover();
2458 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002459 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002460 break;
2461
2462 case 15:
2463
2464 {
2465 TFunction* fnCall = (yyvsp[(1) - (1)].interm).function;
2466 TOperator op = fnCall->getBuiltInOp();
2467
2468 if (op != EOpNull)
2469 {
2470 //
2471 // Then this should be a constructor.
2472 // Don't go through the symbol table for constructors.
2473 // Their parameters will be verified algorithmically.
2474 //
2475 TType type(EbtVoid, EbpUndefined); // use this to get the type back
2476 if (context->constructorErrorCheck((yyvsp[(1) - (1)].interm).line, (yyvsp[(1) - (1)].interm).intermNode, *fnCall, op, &type)) {
2477 (yyval.interm.intermTypedNode) = 0;
2478 } else {
2479 //
2480 // It's a constructor, of type 'type'.
2481 //
2482 (yyval.interm.intermTypedNode) = context->addConstructor((yyvsp[(1) - (1)].interm).intermNode, &type, op, fnCall, (yyvsp[(1) - (1)].interm).line);
2483 }
2484
2485 if ((yyval.interm.intermTypedNode) == 0) {
2486 context->recover();
2487 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator(0, op, (yyvsp[(1) - (1)].interm).line);
2488 }
2489 (yyval.interm.intermTypedNode)->setType(type);
2490 } else {
2491 //
2492 // Not a constructor. Find it in the symbol table.
2493 //
2494 const TFunction* fnCandidate;
2495 bool builtIn;
2496 fnCandidate = context->findFunction((yyvsp[(1) - (1)].interm).line, fnCall, &builtIn);
2497 if (fnCandidate) {
2498 //
2499 // A declared function.
2500 //
2501 if (builtIn && !fnCandidate->getExtension().empty() &&
2502 context->extensionErrorCheck((yyvsp[(1) - (1)].interm).line, fnCandidate->getExtension())) {
2503 context->recover();
2504 }
2505 op = fnCandidate->getBuiltInOp();
2506 if (builtIn && op != EOpNull) {
2507 //
2508 // A function call mapped to a built-in operation.
2509 //
2510 if (fnCandidate->getParamCount() == 1) {
2511 //
2512 // Treat it like a built-in unary operator.
2513 //
2514 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(op, (yyvsp[(1) - (1)].interm).intermNode, 0, context->symbolTable);
2515 if ((yyval.interm.intermTypedNode) == 0) {
2516 context->error((yyvsp[(1) - (1)].interm).intermNode->getLine(), " wrong operand type", "Internal Error",
2517 "built in unary operator function. Type: %s",
2518 static_cast<TIntermTyped*>((yyvsp[(1) - (1)].interm).intermNode)->getCompleteString().c_str());
2519 YYERROR;
2520 }
2521 } else {
2522 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, op, (yyvsp[(1) - (1)].interm).line);
2523 }
2524 } else {
2525 // This is a real function call
2526
2527 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, EOpFunctionCall, (yyvsp[(1) - (1)].interm).line);
2528 (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType());
2529
2530 // this is how we know whether the given function is a builtIn function or a user defined function
2531 // if builtIn == false, it's a userDefined -> could be an overloaded builtIn function also
2532 // if builtIn == true, it's definitely a builtIn function with EOpNull
2533 if (!builtIn)
2534 (yyval.interm.intermTypedNode)->getAsAggregate()->setUserDefined();
2535 (yyval.interm.intermTypedNode)->getAsAggregate()->setName(fnCandidate->getMangledName());
2536
2537 TQualifier qual;
2538 for (int i = 0; i < fnCandidate->getParamCount(); ++i) {
2539 qual = fnCandidate->getParam(i).type->getQualifier();
2540 if (qual == EvqOut || qual == EvqInOut) {
2541 if (context->lValueErrorCheck((yyval.interm.intermTypedNode)->getLine(), "assign", (yyval.interm.intermTypedNode)->getAsAggregate()->getSequence()[i]->getAsTyped())) {
2542 context->error((yyvsp[(1) - (1)].interm).intermNode->getLine(), "Constant value cannot be passed for 'out' or 'inout' parameters.", "Error", "");
2543 context->recover();
2544 }
2545 }
2546 }
2547 }
2548 (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType());
2549 } else {
2550 // error message was put out by PaFindFunction()
2551 // Put on a dummy node for error recovery
2552 ConstantUnion *unionArray = new ConstantUnion[1];
2553 unionArray->setFConst(0.0f);
2554 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].interm).line);
2555 context->recover();
2556 }
2557 }
2558 delete fnCall;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002559 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002560 break;
2561
2562 case 16:
2563
2564 {
2565 (yyval.interm) = (yyvsp[(1) - (1)].interm);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002566 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002567 break;
2568
2569 case 17:
2570
2571 {
2572 context->error((yyvsp[(3) - (3)].interm).line, "methods are not supported", "", "");
2573 context->recover();
2574 (yyval.interm) = (yyvsp[(3) - (3)].interm);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002575 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002576 break;
2577
2578 case 18:
2579
2580 {
2581 (yyval.interm) = (yyvsp[(1) - (2)].interm);
2582 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002583 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002584 break;
2585
2586 case 19:
2587
2588 {
2589 (yyval.interm) = (yyvsp[(1) - (2)].interm);
2590 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002591 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002592 break;
2593
2594 case 20:
2595
2596 {
2597 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
2598 (yyval.interm).intermNode = 0;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002599 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002600 break;
2601
2602 case 21:
2603
2604 {
2605 (yyval.interm).function = (yyvsp[(1) - (1)].interm.function);
2606 (yyval.interm).intermNode = 0;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002607 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002608 break;
2609
2610 case 22:
2611
2612 {
2613 TParameter param = { 0, new TType((yyvsp[(2) - (2)].interm.intermTypedNode)->getType()) };
2614 (yyvsp[(1) - (2)].interm.function)->addParameter(param);
2615 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
2616 (yyval.interm).intermNode = (yyvsp[(2) - (2)].interm.intermTypedNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002617 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002618 break;
2619
2620 case 23:
2621
2622 {
2623 TParameter param = { 0, new TType((yyvsp[(3) - (3)].interm.intermTypedNode)->getType()) };
2624 (yyvsp[(1) - (3)].interm).function->addParameter(param);
2625 (yyval.interm).function = (yyvsp[(1) - (3)].interm).function;
2626 (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 +00002627 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002628 break;
2629
2630 case 24:
2631
2632 {
2633 (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002634 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002635 break;
2636
2637 case 25:
2638
2639 {
2640 //
2641 // Constructor
2642 //
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002643 TOperator op = EOpNull;
2644 if ((yyvsp[(1) - (1)].interm.type).userDef) {
2645 op = EOpConstructStruct;
2646 } else {
2647 switch ((yyvsp[(1) - (1)].interm.type).type) {
2648 case EbtFloat:
2649 if ((yyvsp[(1) - (1)].interm.type).matrix) {
2650 switch((yyvsp[(1) - (1)].interm.type).size) {
2651 case 2: op = EOpConstructMat2; break;
2652 case 3: op = EOpConstructMat3; break;
2653 case 4: op = EOpConstructMat4; break;
2654 }
2655 } else {
2656 switch((yyvsp[(1) - (1)].interm.type).size) {
2657 case 1: op = EOpConstructFloat; break;
2658 case 2: op = EOpConstructVec2; break;
2659 case 3: op = EOpConstructVec3; break;
2660 case 4: op = EOpConstructVec4; break;
2661 }
2662 }
2663 break;
2664 case EbtInt:
2665 switch((yyvsp[(1) - (1)].interm.type).size) {
2666 case 1: op = EOpConstructInt; break;
2667 case 2: FRAG_VERT_ONLY("ivec2", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec2; break;
2668 case 3: FRAG_VERT_ONLY("ivec3", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec3; break;
2669 case 4: FRAG_VERT_ONLY("ivec4", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec4; break;
2670 }
2671 break;
2672 case EbtBool:
2673 switch((yyvsp[(1) - (1)].interm.type).size) {
2674 case 1: op = EOpConstructBool; break;
2675 case 2: FRAG_VERT_ONLY("bvec2", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec2; break;
2676 case 3: FRAG_VERT_ONLY("bvec3", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec3; break;
2677 case 4: FRAG_VERT_ONLY("bvec4", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec4; break;
2678 }
2679 break;
2680 default: break;
2681 }
2682 if (op == EOpNull) {
2683 context->error((yyvsp[(1) - (1)].interm.type).line, "cannot construct this type", getBasicString((yyvsp[(1) - (1)].interm.type).type), "");
2684 context->recover();
2685 (yyvsp[(1) - (1)].interm.type).type = EbtFloat;
2686 op = EOpConstructFloat;
2687 }
2688 }
2689 TString tempString;
2690 TType type((yyvsp[(1) - (1)].interm.type));
2691 TFunction *function = new TFunction(&tempString, type, op);
2692 (yyval.interm.function) = function;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002693 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002694 break;
2695
2696 case 26:
2697
2698 {
2699 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
2700 context->recover();
2701 TType type(EbtVoid, EbpUndefined);
2702 TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type);
2703 (yyval.interm.function) = function;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002704 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002705 break;
2706
2707 case 27:
2708
2709 {
2710 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
2711 context->recover();
2712 TType type(EbtVoid, EbpUndefined);
2713 TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type);
2714 (yyval.interm.function) = function;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002715 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002716 break;
2717
2718 case 28:
2719
2720 {
2721 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002722 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002723 break;
2724
2725 case 29:
2726
2727 {
2728 if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)))
2729 context->recover();
2730 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreIncrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line, context->symbolTable);
2731 if ((yyval.interm.intermTypedNode) == 0) {
2732 context->unaryOpError((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2733 context->recover();
2734 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2735 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002736 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002737 break;
2738
2739 case 30:
2740
2741 {
2742 if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)))
2743 context->recover();
2744 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreDecrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line, context->symbolTable);
2745 if ((yyval.interm.intermTypedNode) == 0) {
2746 context->unaryOpError((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2747 context->recover();
2748 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2749 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002750 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002751 break;
2752
2753 case 31:
2754
2755 {
2756 if ((yyvsp[(1) - (2)].interm).op != EOpNull) {
2757 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath((yyvsp[(1) - (2)].interm).op, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].interm).line, context->symbolTable);
2758 if ((yyval.interm.intermTypedNode) == 0) {
2759 const char* errorOp = "";
2760 switch((yyvsp[(1) - (2)].interm).op) {
2761 case EOpNegative: errorOp = "-"; break;
2762 case EOpLogicalNot: errorOp = "!"; break;
2763 default: break;
2764 }
2765 context->unaryOpError((yyvsp[(1) - (2)].interm).line, errorOp, (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2766 context->recover();
2767 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2768 }
2769 } else
2770 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002771 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002772 break;
2773
2774 case 32:
2775
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002776 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNull; ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002777 break;
2778
2779 case 33:
2780
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002781 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNegative; ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002782 break;
2783
2784 case 34:
2785
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002786 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpLogicalNot; ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002787 break;
2788
2789 case 35:
2790
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002791 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002792 break;
2793
2794 case 36:
2795
2796 {
2797 FRAG_VERT_ONLY("*", (yyvsp[(2) - (3)].lex).line);
2798 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpMul, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2799 if ((yyval.interm.intermTypedNode) == 0) {
2800 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "*", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2801 context->recover();
2802 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2803 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002804 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002805 break;
2806
2807 case 37:
2808
2809 {
2810 FRAG_VERT_ONLY("/", (yyvsp[(2) - (3)].lex).line);
2811 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpDiv, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2812 if ((yyval.interm.intermTypedNode) == 0) {
2813 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "/", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2814 context->recover();
2815 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2816 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002817 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002818 break;
2819
2820 case 38:
2821
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002822 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002823 break;
2824
2825 case 39:
2826
2827 {
2828 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpAdd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2829 if ((yyval.interm.intermTypedNode) == 0) {
2830 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "+", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2831 context->recover();
2832 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2833 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002834 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002835 break;
2836
2837 case 40:
2838
2839 {
2840 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpSub, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2841 if ((yyval.interm.intermTypedNode) == 0) {
2842 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "-", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2843 context->recover();
2844 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2845 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002846 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002847 break;
2848
2849 case 41:
2850
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002851 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002852 break;
2853
2854 case 42:
2855
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002856 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002857 break;
2858
2859 case 43:
2860
2861 {
2862 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2863 if ((yyval.interm.intermTypedNode) == 0) {
2864 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2865 context->recover();
2866 ConstantUnion *unionArray = new ConstantUnion[1];
2867 unionArray->setBConst(false);
2868 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2869 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002870 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002871 break;
2872
2873 case 44:
2874
2875 {
2876 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2877 if ((yyval.interm.intermTypedNode) == 0) {
2878 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2879 context->recover();
2880 ConstantUnion *unionArray = new ConstantUnion[1];
2881 unionArray->setBConst(false);
2882 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2883 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002884 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002885 break;
2886
2887 case 45:
2888
2889 {
2890 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2891 if ((yyval.interm.intermTypedNode) == 0) {
2892 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2893 context->recover();
2894 ConstantUnion *unionArray = new ConstantUnion[1];
2895 unionArray->setBConst(false);
2896 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2897 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002898 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002899 break;
2900
2901 case 46:
2902
2903 {
2904 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2905 if ((yyval.interm.intermTypedNode) == 0) {
2906 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2907 context->recover();
2908 ConstantUnion *unionArray = new ConstantUnion[1];
2909 unionArray->setBConst(false);
2910 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2911 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002912 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002913 break;
2914
2915 case 47:
2916
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002917 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002918 break;
2919
2920 case 48:
2921
2922 {
2923 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2924 if ((yyval.interm.intermTypedNode) == 0) {
2925 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "==", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2926 context->recover();
2927 ConstantUnion *unionArray = new ConstantUnion[1];
2928 unionArray->setBConst(false);
2929 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2930 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002931 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002932 break;
2933
2934 case 49:
2935
2936 {
2937 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpNotEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2938 if ((yyval.interm.intermTypedNode) == 0) {
2939 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "!=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2940 context->recover();
2941 ConstantUnion *unionArray = new ConstantUnion[1];
2942 unionArray->setBConst(false);
2943 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2944 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002945 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002946 break;
2947
2948 case 50:
2949
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002950 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002951 break;
2952
2953 case 51:
2954
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002955 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002956 break;
2957
2958 case 52:
2959
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002960 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002961 break;
2962
2963 case 53:
2964
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002965 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002966 break;
2967
2968 case 54:
2969
2970 {
2971 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalAnd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2972 if ((yyval.interm.intermTypedNode) == 0) {
2973 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "&&", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2974 context->recover();
2975 ConstantUnion *unionArray = new ConstantUnion[1];
2976 unionArray->setBConst(false);
2977 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2978 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002979 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002980 break;
2981
2982 case 55:
2983
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002984 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002985 break;
2986
2987 case 56:
2988
2989 {
2990 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalXor, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2991 if ((yyval.interm.intermTypedNode) == 0) {
2992 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "^^", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2993 context->recover();
2994 ConstantUnion *unionArray = new ConstantUnion[1];
2995 unionArray->setBConst(false);
2996 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2997 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00002998 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002999 break;
3000
3001 case 57:
3002
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003003 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003004 break;
3005
3006 case 58:
3007
3008 {
3009 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalOr, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
3010 if ((yyval.interm.intermTypedNode) == 0) {
3011 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "||", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3012 context->recover();
3013 ConstantUnion *unionArray = new ConstantUnion[1];
3014 unionArray->setBConst(false);
3015 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
3016 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003017 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003018 break;
3019
3020 case 59:
3021
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003022 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003023 break;
3024
3025 case 60:
3026
3027 {
3028 if (context->boolErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.intermTypedNode)))
3029 context->recover();
3030
3031 (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);
3032 if ((yyvsp[(3) - (5)].interm.intermTypedNode)->getType() != (yyvsp[(5) - (5)].interm.intermTypedNode)->getType())
3033 (yyval.interm.intermTypedNode) = 0;
3034
3035 if ((yyval.interm.intermTypedNode) == 0) {
3036 context->binaryOpError((yyvsp[(2) - (5)].lex).line, ":", (yyvsp[(3) - (5)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(5) - (5)].interm.intermTypedNode)->getCompleteString());
3037 context->recover();
3038 (yyval.interm.intermTypedNode) = (yyvsp[(5) - (5)].interm.intermTypedNode);
3039 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003040 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003041 break;
3042
3043 case 61:
3044
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003045 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003046 break;
3047
3048 case 62:
3049
3050 {
3051 if (context->lValueErrorCheck((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)))
3052 context->recover();
3053 (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);
3054 if ((yyval.interm.intermTypedNode) == 0) {
3055 context->assignError((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3056 context->recover();
3057 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
3058 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003059 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003060 break;
3061
3062 case 63:
3063
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003064 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAssign; ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003065 break;
3066
3067 case 64:
3068
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003069 { FRAG_VERT_ONLY("*=", (yyvsp[(1) - (1)].lex).line); (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpMulAssign; ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003070 break;
3071
3072 case 65:
3073
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003074 { 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 +00003075 break;
3076
3077 case 66:
3078
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003079 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAddAssign; ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003080 break;
3081
3082 case 67:
3083
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003084 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpSubAssign; ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003085 break;
3086
3087 case 68:
3088
3089 {
3090 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003091 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003092 break;
3093
3094 case 69:
3095
3096 {
3097 (yyval.interm.intermTypedNode) = context->intermediate.addComma((yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
3098 if ((yyval.interm.intermTypedNode) == 0) {
3099 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ",", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3100 context->recover();
3101 (yyval.interm.intermTypedNode) = (yyvsp[(3) - (3)].interm.intermTypedNode);
3102 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003103 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003104 break;
3105
3106 case 70:
3107
3108 {
3109 if (context->constErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)))
3110 context->recover();
3111 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003112 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003113 break;
3114
3115 case 71:
3116
3117 {
3118 TFunction &function = *((yyvsp[(1) - (2)].interm).function);
3119
3120 TIntermAggregate *prototype = new TIntermAggregate;
3121 prototype->setType(function.getReturnType());
3122 prototype->setName(function.getName());
3123
3124 for (int i = 0; i < function.getParamCount(); i++)
3125 {
3126 const TParameter &param = function.getParam(i);
3127 if (param.name != 0)
3128 {
3129 TVariable *variable = new TVariable(param.name, *param.type);
3130
3131 prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(variable->getUniqueId(), variable->getName(), variable->getType(), (yyvsp[(1) - (2)].interm).line), (yyvsp[(1) - (2)].interm).line);
3132 }
3133 else
3134 {
3135 prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (2)].interm).line), (yyvsp[(1) - (2)].interm).line);
3136 }
3137 }
3138
3139 prototype->setOp(EOpPrototype);
3140 (yyval.interm.intermNode) = prototype;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003141 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003142 break;
3143
3144 case 72:
3145
3146 {
3147 if ((yyvsp[(1) - (2)].interm).intermAggregate)
3148 (yyvsp[(1) - (2)].interm).intermAggregate->setOp(EOpDeclaration);
3149 (yyval.interm.intermNode) = (yyvsp[(1) - (2)].interm).intermAggregate;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003150 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003151 break;
3152
3153 case 73:
3154
3155 {
3156 context->symbolTable.setDefaultPrecision( (yyvsp[(3) - (4)].interm.type).type, (yyvsp[(2) - (4)].interm.precision) );
3157 (yyval.interm.intermNode) = 0;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003158 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003159 break;
3160
3161 case 74:
3162
3163 {
3164 //
3165 // Multiple declarations of the same function are allowed.
3166 //
3167 // If this is a definition, the definition production code will check for redefinitions
3168 // (we don't know at this point if it's a definition or not).
3169 //
3170 // Redeclarations are allowed. But, return types and parameter qualifiers must match.
3171 //
3172 TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find((yyvsp[(1) - (2)].interm.function)->getMangledName()));
3173 if (prevDec) {
3174 if (prevDec->getReturnType() != (yyvsp[(1) - (2)].interm.function)->getReturnType()) {
3175 context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same return type", (yyvsp[(1) - (2)].interm.function)->getReturnType().getBasicString(), "");
3176 context->recover();
3177 }
3178 for (int i = 0; i < prevDec->getParamCount(); ++i) {
3179 if (prevDec->getParam(i).type->getQualifier() != (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifier()) {
3180 context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same parameter qualifiers", (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifierString(), "");
3181 context->recover();
3182 }
3183 }
3184 }
3185
3186 //
3187 // If this is a redeclaration, it could also be a definition,
3188 // in which case, we want to use the variable names from this one, and not the one that's
3189 // being redeclared. So, pass back up this declaration, not the one in the symbol table.
3190 //
3191 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
3192 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
3193
3194 context->symbolTable.insert(*(yyval.interm).function);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003195 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003196 break;
3197
3198 case 75:
3199
3200 {
3201 (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003202 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003203 break;
3204
3205 case 76:
3206
3207 {
3208 (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003209 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003210 break;
3211
3212 case 77:
3213
3214 {
3215 // Add the parameter
3216 (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
3217 if ((yyvsp[(2) - (2)].interm).param.type->getBasicType() != EbtVoid)
3218 (yyvsp[(1) - (2)].interm.function)->addParameter((yyvsp[(2) - (2)].interm).param);
3219 else
3220 delete (yyvsp[(2) - (2)].interm).param.type;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003221 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003222 break;
3223
3224 case 78:
3225
3226 {
3227 //
3228 // Only first parameter of one-parameter functions can be void
3229 // The check for named parameters not being void is done in parameter_declarator
3230 //
3231 if ((yyvsp[(3) - (3)].interm).param.type->getBasicType() == EbtVoid) {
3232 //
3233 // This parameter > first is void
3234 //
3235 context->error((yyvsp[(2) - (3)].lex).line, "cannot be an argument type except for '(void)'", "void", "");
3236 context->recover();
3237 delete (yyvsp[(3) - (3)].interm).param.type;
3238 } else {
3239 // Add the parameter
3240 (yyval.interm.function) = (yyvsp[(1) - (3)].interm.function);
3241 (yyvsp[(1) - (3)].interm.function)->addParameter((yyvsp[(3) - (3)].interm).param);
3242 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003243 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003244 break;
3245
3246 case 79:
3247
3248 {
3249 if ((yyvsp[(1) - (3)].interm.type).qualifier != EvqGlobal && (yyvsp[(1) - (3)].interm.type).qualifier != EvqTemporary) {
3250 context->error((yyvsp[(2) - (3)].lex).line, "no qualifiers allowed for function return", getQualifierString((yyvsp[(1) - (3)].interm.type).qualifier), "");
3251 context->recover();
3252 }
3253 // make sure a sampler is not involved as well...
3254 if (context->structQualifierErrorCheck((yyvsp[(2) - (3)].lex).line, (yyvsp[(1) - (3)].interm.type)))
3255 context->recover();
3256
3257 // Add the function as a prototype after parsing it (we do not support recursion)
3258 TFunction *function;
3259 TType type((yyvsp[(1) - (3)].interm.type));
3260 function = new TFunction((yyvsp[(2) - (3)].lex).string, type);
3261 (yyval.interm.function) = function;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003262 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003263 break;
3264
3265 case 80:
3266
3267 {
3268 if ((yyvsp[(1) - (2)].interm.type).type == EbtVoid) {
3269 context->error((yyvsp[(2) - (2)].lex).line, "illegal use of type 'void'", (yyvsp[(2) - (2)].lex).string->c_str(), "");
3270 context->recover();
3271 }
3272 if (context->reservedErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string))
3273 context->recover();
3274 TParameter param = {(yyvsp[(2) - (2)].lex).string, new TType((yyvsp[(1) - (2)].interm.type))};
3275 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
3276 (yyval.interm).param = param;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003277 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003278 break;
3279
3280 case 81:
3281
3282 {
3283 // Check that we can make an array out of this type
3284 if (context->arrayTypeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
3285 context->recover();
3286
3287 if (context->reservedErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string))
3288 context->recover();
3289
3290 int size;
3291 if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3292 context->recover();
3293 (yyvsp[(1) - (5)].interm.type).setArray(true, size);
3294
3295 TType* type = new TType((yyvsp[(1) - (5)].interm.type));
3296 TParameter param = { (yyvsp[(2) - (5)].lex).string, type };
3297 (yyval.interm).line = (yyvsp[(2) - (5)].lex).line;
3298 (yyval.interm).param = param;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003299 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003300 break;
3301
3302 case 82:
3303
3304 {
3305 (yyval.interm) = (yyvsp[(3) - (3)].interm);
3306 if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
3307 context->recover();
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003308 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003309 break;
3310
3311 case 83:
3312
3313 {
3314 (yyval.interm) = (yyvsp[(2) - (2)].interm);
3315 if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
3316 context->recover();
3317 if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
3318 context->recover();
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003319 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003320 break;
3321
3322 case 84:
3323
3324 {
3325 (yyval.interm) = (yyvsp[(3) - (3)].interm);
3326 if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
3327 context->recover();
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003328 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003329 break;
3330
3331 case 85:
3332
3333 {
3334 (yyval.interm) = (yyvsp[(2) - (2)].interm);
3335 if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
3336 context->recover();
3337 if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
3338 context->recover();
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003339 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003340 break;
3341
3342 case 86:
3343
3344 {
3345 (yyval.interm.qualifier) = EvqIn;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003346 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003347 break;
3348
3349 case 87:
3350
3351 {
3352 (yyval.interm.qualifier) = EvqIn;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003353 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003354 break;
3355
3356 case 88:
3357
3358 {
3359 (yyval.interm.qualifier) = EvqOut;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003360 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003361 break;
3362
3363 case 89:
3364
3365 {
3366 (yyval.interm.qualifier) = EvqInOut;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003367 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003368 break;
3369
3370 case 90:
3371
3372 {
3373 TParameter param = { 0, new TType((yyvsp[(1) - (1)].interm.type)) };
3374 (yyval.interm).param = param;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003375 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003376 break;
3377
3378 case 91:
3379
3380 {
3381 (yyval.interm) = (yyvsp[(1) - (1)].interm);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003382 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003383 break;
3384
3385 case 92:
3386
3387 {
zmo@google.comfd747b82011-04-23 01:30:07 +00003388 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(3) - (3)].lex).string, TType((yyvsp[(1) - (3)].interm).type), (yyvsp[(3) - (3)].lex).line);
3389 (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 +00003390
3391 if (context->structQualifierErrorCheck((yyvsp[(3) - (3)].lex).line, (yyval.interm).type))
3392 context->recover();
3393
3394 if (context->nonInitConstErrorCheck((yyvsp[(3) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyval.interm).type))
3395 context->recover();
3396
zmo@google.comfd747b82011-04-23 01:30:07 +00003397 TVariable* variable = 0;
3398 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 +00003399 context->recover();
zmo@google.comfd747b82011-04-23 01:30:07 +00003400 if (symbol && variable)
3401 symbol->setId(variable->getUniqueId());
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003402 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003403 break;
3404
3405 case 93:
3406
3407 {
3408 if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
3409 context->recover();
3410
3411 if (context->nonInitConstErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type))
3412 context->recover();
3413
3414 (yyval.interm) = (yyvsp[(1) - (5)].interm);
3415
3416 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))
3417 context->recover();
3418 else {
3419 (yyvsp[(1) - (5)].interm).type.setArray(true);
3420 TVariable* variable;
3421 if (context->arrayErrorCheck((yyvsp[(4) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, variable))
3422 context->recover();
3423 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003424 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003425 break;
3426
3427 case 94:
3428
3429 {
3430 if (context->structQualifierErrorCheck((yyvsp[(3) - (6)].lex).line, (yyvsp[(1) - (6)].interm).type))
3431 context->recover();
3432
3433 if (context->nonInitConstErrorCheck((yyvsp[(3) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type))
3434 context->recover();
3435
3436 (yyval.interm) = (yyvsp[(1) - (6)].interm);
3437
3438 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))
3439 context->recover();
3440 else {
3441 int size;
3442 if (context->arraySizeErrorCheck((yyvsp[(4) - (6)].lex).line, (yyvsp[(5) - (6)].interm.intermTypedNode), size))
3443 context->recover();
3444 (yyvsp[(1) - (6)].interm).type.setArray(true, size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003445 TVariable* variable = 0;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003446 if (context->arrayErrorCheck((yyvsp[(4) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type, variable))
3447 context->recover();
3448 TType type = TType((yyvsp[(1) - (6)].interm).type);
3449 type.setArraySize(size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003450 (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 +00003451 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003452 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003453 break;
3454
3455 case 95:
3456
3457 {
3458 if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
3459 context->recover();
3460
3461 (yyval.interm) = (yyvsp[(1) - (5)].interm);
3462
3463 TIntermNode* intermNode;
3464 if (!context->executeInitializer((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, (yyvsp[(5) - (5)].interm.intermTypedNode), intermNode)) {
3465 //
3466 // build the intermediate representation
3467 //
3468 if (intermNode)
3469 (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (5)].interm).intermNode, intermNode, (yyvsp[(4) - (5)].lex).line);
3470 else
3471 (yyval.interm).intermAggregate = (yyvsp[(1) - (5)].interm).intermAggregate;
3472 } else {
3473 context->recover();
3474 (yyval.interm).intermAggregate = 0;
3475 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003476 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003477 break;
3478
3479 case 96:
3480
3481 {
3482 (yyval.interm).type = (yyvsp[(1) - (1)].interm.type);
3483 (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 +00003484 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003485 break;
3486
3487 case 97:
3488
3489 {
zmo@google.comfd747b82011-04-23 01:30:07 +00003490 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyvsp[(1) - (2)].interm.type)), (yyvsp[(2) - (2)].lex).line);
3491 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (2)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003492
3493 if (context->structQualifierErrorCheck((yyvsp[(2) - (2)].lex).line, (yyval.interm).type))
3494 context->recover();
3495
3496 if (context->nonInitConstErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string, (yyval.interm).type))
3497 context->recover();
3498
3499 (yyval.interm).type = (yyvsp[(1) - (2)].interm.type);
3500
zmo@google.comfd747b82011-04-23 01:30:07 +00003501 TVariable* variable = 0;
3502 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 +00003503 context->recover();
zmo@google.comfd747b82011-04-23 01:30:07 +00003504 if (variable && symbol)
3505 symbol->setId(variable->getUniqueId());
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003506 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003507 break;
3508
3509 case 98:
3510
3511 {
kbr@chromium.org04277b82011-06-02 18:41:26 +00003512 context->error((yyvsp[(2) - (4)].lex).line, "unsized array declarations not supported", (yyvsp[(2) - (4)].lex).string->c_str(), "");
3513 context->recover();
3514
zmo@google.comfd747b82011-04-23 01:30:07 +00003515 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (4)].lex).string, TType((yyvsp[(1) - (4)].interm.type)), (yyvsp[(2) - (4)].lex).line);
3516 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (4)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003517 (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003518 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003519 break;
3520
3521 case 99:
3522
3523 {
3524 TType type = TType((yyvsp[(1) - (5)].interm.type));
3525 int size;
3526 if (context->arraySizeErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3527 context->recover();
3528 type.setArraySize(size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003529 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (5)].lex).string, type, (yyvsp[(2) - (5)].lex).line);
3530 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (5)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003531
3532 if (context->structQualifierErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
3533 context->recover();
3534
3535 if (context->nonInitConstErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type)))
3536 context->recover();
3537
3538 (yyval.interm).type = (yyvsp[(1) - (5)].interm.type);
3539
3540 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)))
3541 context->recover();
3542 else {
3543 int size;
3544 if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3545 context->recover();
3546
3547 (yyvsp[(1) - (5)].interm.type).setArray(true, size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003548 TVariable* variable = 0;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003549 if (context->arrayErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type), variable))
3550 context->recover();
zmo@google.comfd747b82011-04-23 01:30:07 +00003551 if (variable && symbol)
3552 symbol->setId(variable->getUniqueId());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003553 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003554 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003555 break;
3556
3557 case 100:
3558
3559 {
3560 if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
3561 context->recover();
3562
3563 (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
3564
3565 TIntermNode* intermNode;
3566 if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode)) {
3567 //
3568 // Build intermediate representation
3569 //
3570 if(intermNode)
3571 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(intermNode, (yyvsp[(3) - (4)].lex).line);
3572 else
3573 (yyval.interm).intermAggregate = 0;
3574 } else {
3575 context->recover();
3576 (yyval.interm).intermAggregate = 0;
3577 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003578 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003579 break;
3580
3581 case 101:
3582
3583 {
3584 VERTEX_ONLY("invariant declaration", (yyvsp[(1) - (2)].lex).line);
3585 (yyval.interm).qualifier = EvqInvariantVaryingOut;
3586 (yyval.interm).intermAggregate = 0;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003587 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003588 break;
3589
3590 case 102:
3591
3592 {
3593 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3594
3595 if ((yyvsp[(1) - (1)].interm.type).array) {
3596 context->error((yyvsp[(1) - (1)].interm.type).line, "not supported", "first-class array", "");
3597 context->recover();
3598 (yyvsp[(1) - (1)].interm.type).setArray(false);
3599 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003600 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003601 break;
3602
3603 case 103:
3604
3605 {
3606 if ((yyvsp[(2) - (2)].interm.type).array) {
3607 context->error((yyvsp[(2) - (2)].interm.type).line, "not supported", "first-class array", "");
3608 context->recover();
3609 (yyvsp[(2) - (2)].interm.type).setArray(false);
3610 }
3611
3612 if ((yyvsp[(1) - (2)].interm.type).qualifier == EvqAttribute &&
3613 ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
3614 context->error((yyvsp[(2) - (2)].interm.type).line, "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier), "");
3615 context->recover();
3616 }
3617 if (((yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingIn || (yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingOut) &&
3618 ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
3619 context->error((yyvsp[(2) - (2)].interm.type).line, "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier), "");
3620 context->recover();
3621 }
3622 (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
3623 (yyval.interm.type).qualifier = (yyvsp[(1) - (2)].interm.type).qualifier;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003624 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003625 break;
3626
3627 case 104:
3628
3629 {
3630 (yyval.interm.type).setBasic(EbtVoid, EvqConst, (yyvsp[(1) - (1)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003631 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003632 break;
3633
3634 case 105:
3635
3636 {
3637 VERTEX_ONLY("attribute", (yyvsp[(1) - (1)].lex).line);
3638 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "attribute"))
3639 context->recover();
3640 (yyval.interm.type).setBasic(EbtVoid, EvqAttribute, (yyvsp[(1) - (1)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003641 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003642 break;
3643
3644 case 106:
3645
3646 {
3647 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "varying"))
3648 context->recover();
3649 if (context->shaderType == SH_VERTEX_SHADER)
3650 (yyval.interm.type).setBasic(EbtVoid, EvqVaryingOut, (yyvsp[(1) - (1)].lex).line);
3651 else
3652 (yyval.interm.type).setBasic(EbtVoid, EvqVaryingIn, (yyvsp[(1) - (1)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003653 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003654 break;
3655
3656 case 107:
3657
3658 {
3659 if (context->globalErrorCheck((yyvsp[(1) - (2)].lex).line, context->symbolTable.atGlobalLevel(), "invariant varying"))
3660 context->recover();
3661 if (context->shaderType == SH_VERTEX_SHADER)
3662 (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingOut, (yyvsp[(1) - (2)].lex).line);
3663 else
3664 (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingIn, (yyvsp[(1) - (2)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003665 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003666 break;
3667
3668 case 108:
3669
3670 {
3671 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "uniform"))
3672 context->recover();
3673 (yyval.interm.type).setBasic(EbtVoid, EvqUniform, (yyvsp[(1) - (1)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003674 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003675 break;
3676
3677 case 109:
3678
3679 {
3680 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
zmo@google.comdc4b4f82011-06-17 00:42:53 +00003681
3682 if ((yyval.interm.type).precision == EbpUndefined) {
3683 (yyval.interm.type).precision = context->symbolTable.getDefaultPrecision((yyvsp[(1) - (1)].interm.type).type);
3684 if (context->precisionErrorCheck((yyvsp[(1) - (1)].interm.type).line, (yyval.interm.type).precision, (yyvsp[(1) - (1)].interm.type).type)) {
3685 context->recover();
3686 }
3687 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003688 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003689 break;
3690
3691 case 110:
3692
3693 {
3694 (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
3695 (yyval.interm.type).precision = (yyvsp[(1) - (2)].interm.precision);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003696 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003697 break;
3698
3699 case 111:
3700
3701 {
3702 (yyval.interm.precision) = EbpHigh;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003703 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003704 break;
3705
3706 case 112:
3707
3708 {
3709 (yyval.interm.precision) = EbpMedium;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003710 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003711 break;
3712
3713 case 113:
3714
3715 {
3716 (yyval.interm.precision) = EbpLow;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003717 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003718 break;
3719
3720 case 114:
3721
3722 {
3723 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003724 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003725 break;
3726
3727 case 115:
3728
3729 {
3730 (yyval.interm.type) = (yyvsp[(1) - (4)].interm.type);
3731
3732 if (context->arrayTypeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
3733 context->recover();
3734 else {
3735 int size;
3736 if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
3737 context->recover();
3738 (yyval.interm.type).setArray(true, size);
3739 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003740 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003741 break;
3742
3743 case 116:
3744
3745 {
3746 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3747 (yyval.interm.type).setBasic(EbtVoid, qual, (yyvsp[(1) - (1)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003748 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003749 break;
3750
3751 case 117:
3752
3753 {
3754 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3755 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003756 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003757 break;
3758
3759 case 118:
3760
3761 {
3762 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3763 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003764 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003765 break;
3766
3767 case 119:
3768
3769 {
3770 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3771 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003772 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003773 break;
3774
3775 case 120:
3776
3777 {
3778 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3779 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3780 (yyval.interm.type).setAggregate(2);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003781 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003782 break;
3783
3784 case 121:
3785
3786 {
3787 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3788 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3789 (yyval.interm.type).setAggregate(3);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003790 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003791 break;
3792
3793 case 122:
3794
3795 {
3796 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3797 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3798 (yyval.interm.type).setAggregate(4);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003799 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003800 break;
3801
3802 case 123:
3803
3804 {
3805 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3806 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3807 (yyval.interm.type).setAggregate(2);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003808 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003809 break;
3810
3811 case 124:
3812
3813 {
3814 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3815 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3816 (yyval.interm.type).setAggregate(3);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003817 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003818 break;
3819
3820 case 125:
3821
3822 {
3823 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3824 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3825 (yyval.interm.type).setAggregate(4);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003826 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003827 break;
3828
3829 case 126:
3830
3831 {
3832 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3833 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3834 (yyval.interm.type).setAggregate(2);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003835 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003836 break;
3837
3838 case 127:
3839
3840 {
3841 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3842 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3843 (yyval.interm.type).setAggregate(3);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003844 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003845 break;
3846
3847 case 128:
3848
3849 {
3850 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3851 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3852 (yyval.interm.type).setAggregate(4);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003853 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003854 break;
3855
3856 case 129:
3857
3858 {
3859 FRAG_VERT_ONLY("mat2", (yyvsp[(1) - (1)].lex).line);
3860 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3861 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3862 (yyval.interm.type).setAggregate(2, true);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003863 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003864 break;
3865
3866 case 130:
3867
3868 {
3869 FRAG_VERT_ONLY("mat3", (yyvsp[(1) - (1)].lex).line);
3870 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3871 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3872 (yyval.interm.type).setAggregate(3, true);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003873 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003874 break;
3875
3876 case 131:
3877
3878 {
3879 FRAG_VERT_ONLY("mat4", (yyvsp[(1) - (1)].lex).line);
3880 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3881 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3882 (yyval.interm.type).setAggregate(4, true);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003883 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003884 break;
3885
3886 case 132:
3887
3888 {
3889 FRAG_VERT_ONLY("sampler2D", (yyvsp[(1) - (1)].lex).line);
3890 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3891 (yyval.interm.type).setBasic(EbtSampler2D, qual, (yyvsp[(1) - (1)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003892 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003893 break;
3894
3895 case 133:
3896
3897 {
3898 FRAG_VERT_ONLY("samplerCube", (yyvsp[(1) - (1)].lex).line);
3899 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3900 (yyval.interm.type).setBasic(EbtSamplerCube, qual, (yyvsp[(1) - (1)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003901 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003902 break;
3903
3904 case 134:
3905
3906 {
zmo@google.com09c323a2011-08-12 18:22:25 +00003907 if (!context->supportsExtension("GL_OES_EGL_image_external")) {
3908 context->error((yyvsp[(1) - (1)].lex).line, "unsupported type", "samplerExternalOES", "");
3909 context->recover();
3910 }
3911 FRAG_VERT_ONLY("samplerExternalOES", (yyvsp[(1) - (1)].lex).line);
3912 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3913 (yyval.interm.type).setBasic(EbtSamplerExternalOES, qual, (yyvsp[(1) - (1)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003914 ;}
zmo@google.com09c323a2011-08-12 18:22:25 +00003915 break;
3916
3917 case 135:
3918
3919 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00003920 if (!context->supportsExtension("GL_ARB_texture_rectangle")) {
3921 context->error((yyvsp[(1) - (1)].lex).line, "unsupported type", "sampler2DRect", "");
3922 context->recover();
3923 }
3924 FRAG_VERT_ONLY("sampler2DRect", (yyvsp[(1) - (1)].lex).line);
3925 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3926 (yyval.interm.type).setBasic(EbtSampler2DRect, qual, (yyvsp[(1) - (1)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003927 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003928 break;
3929
zmo@google.com09c323a2011-08-12 18:22:25 +00003930 case 136:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003931
3932 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00003933 FRAG_VERT_ONLY("struct", (yyvsp[(1) - (1)].interm.type).line);
3934 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3935 (yyval.interm.type).qualifier = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003936 ;}
kbr@chromium.org205fef32011-11-22 20:50:02 +00003937 break;
3938
3939 case 137:
3940
3941 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003942 //
3943 // This is for user defined type names. The lexical phase looked up the
3944 // type.
3945 //
3946 TType& structure = static_cast<TVariable*>((yyvsp[(1) - (1)].lex).symbol)->getType();
3947 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3948 (yyval.interm.type).setBasic(EbtStruct, qual, (yyvsp[(1) - (1)].lex).line);
3949 (yyval.interm.type).userDef = &structure;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003950 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003951 break;
3952
zmo@google.com09c323a2011-08-12 18:22:25 +00003953 case 138:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003954
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003955 { if (context->enterStructDeclaration((yyvsp[(2) - (3)].lex).line, *(yyvsp[(2) - (3)].lex).string)) context->recover(); ;}
kbr@chromium.org205fef32011-11-22 20:50:02 +00003956 break;
3957
3958 case 139:
3959
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003960 {
kbr@chromium.org476541f2011-10-27 21:14:51 +00003961 if (context->reservedErrorCheck((yyvsp[(2) - (6)].lex).line, *(yyvsp[(2) - (6)].lex).string))
3962 context->recover();
3963
3964 TType* structure = new TType((yyvsp[(5) - (6)].interm.typeList), *(yyvsp[(2) - (6)].lex).string);
3965 TVariable* userTypeDef = new TVariable((yyvsp[(2) - (6)].lex).string, *structure, true);
3966 if (! context->symbolTable.insert(*userTypeDef)) {
3967 context->error((yyvsp[(2) - (6)].lex).line, "redefinition", (yyvsp[(2) - (6)].lex).string->c_str(), "struct");
3968 context->recover();
3969 }
3970 (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (6)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003971 (yyval.interm.type).userDef = structure;
kbr@chromium.org476541f2011-10-27 21:14:51 +00003972 context->exitStructDeclaration();
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003973 ;}
kbr@chromium.org476541f2011-10-27 21:14:51 +00003974 break;
3975
3976 case 140:
3977
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003978 { if (context->enterStructDeclaration((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string)) context->recover(); ;}
kbr@chromium.org205fef32011-11-22 20:50:02 +00003979 break;
3980
3981 case 141:
3982
kbr@chromium.org476541f2011-10-27 21:14:51 +00003983 {
3984 TType* structure = new TType((yyvsp[(4) - (5)].interm.typeList), TString(""));
3985 (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (5)].lex).line);
3986 (yyval.interm.type).userDef = structure;
3987 context->exitStructDeclaration();
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003988 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003989 break;
3990
kbr@chromium.org476541f2011-10-27 21:14:51 +00003991 case 142:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003992
3993 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00003994 (yyval.interm.typeList) = (yyvsp[(1) - (1)].interm.typeList);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00003995 ;}
kbr@chromium.org205fef32011-11-22 20:50:02 +00003996 break;
3997
3998 case 143:
3999
4000 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004001 (yyval.interm.typeList) = (yyvsp[(1) - (2)].interm.typeList);
4002 for (unsigned int i = 0; i < (yyvsp[(2) - (2)].interm.typeList)->size(); ++i) {
4003 for (unsigned int j = 0; j < (yyval.interm.typeList)->size(); ++j) {
4004 if ((*(yyval.interm.typeList))[j].type->getFieldName() == (*(yyvsp[(2) - (2)].interm.typeList))[i].type->getFieldName()) {
4005 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());
4006 context->recover();
4007 }
4008 }
4009 (yyval.interm.typeList)->push_back((*(yyvsp[(2) - (2)].interm.typeList))[i]);
4010 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004011 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004012 break;
4013
kbr@chromium.org205fef32011-11-22 20:50:02 +00004014 case 144:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004015
4016 {
4017 (yyval.interm.typeList) = (yyvsp[(2) - (3)].interm.typeList);
4018
4019 if (context->voidErrorCheck((yyvsp[(1) - (3)].interm.type).line, (*(yyvsp[(2) - (3)].interm.typeList))[0].type->getFieldName(), (yyvsp[(1) - (3)].interm.type))) {
4020 context->recover();
4021 }
4022 for (unsigned int i = 0; i < (yyval.interm.typeList)->size(); ++i) {
4023 //
4024 // Careful not to replace already known aspects of type, like array-ness
4025 //
4026 TType* type = (*(yyval.interm.typeList))[i].type;
4027 type->setBasicType((yyvsp[(1) - (3)].interm.type).type);
4028 type->setNominalSize((yyvsp[(1) - (3)].interm.type).size);
4029 type->setMatrix((yyvsp[(1) - (3)].interm.type).matrix);
zmo@google.comdc4b4f82011-06-17 00:42:53 +00004030 type->setPrecision((yyvsp[(1) - (3)].interm.type).precision);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004031
4032 // don't allow arrays of arrays
4033 if (type->isArray()) {
4034 if (context->arrayTypeErrorCheck((yyvsp[(1) - (3)].interm.type).line, (yyvsp[(1) - (3)].interm.type)))
4035 context->recover();
4036 }
4037 if ((yyvsp[(1) - (3)].interm.type).array)
4038 type->setArraySize((yyvsp[(1) - (3)].interm.type).arraySize);
4039 if ((yyvsp[(1) - (3)].interm.type).userDef) {
4040 type->setStruct((yyvsp[(1) - (3)].interm.type).userDef->getStruct());
4041 type->setTypeName((yyvsp[(1) - (3)].interm.type).userDef->getTypeName());
4042 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004043
4044 if (context->structNestingErrorCheck((yyvsp[(1) - (3)].interm.type).line, *type)) {
4045 context->recover();
4046 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004047 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004048 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004049 break;
4050
kbr@chromium.org476541f2011-10-27 21:14:51 +00004051 case 145:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004052
4053 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004054 (yyval.interm.typeList) = NewPoolTTypeList();
4055 (yyval.interm.typeList)->push_back((yyvsp[(1) - (1)].interm.typeLine));
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004056 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004057 break;
4058
kbr@chromium.org476541f2011-10-27 21:14:51 +00004059 case 146:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004060
4061 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004062 (yyval.interm.typeList)->push_back((yyvsp[(3) - (3)].interm.typeLine));
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004063 ;}
kbr@chromium.org205fef32011-11-22 20:50:02 +00004064 break;
4065
4066 case 147:
4067
4068 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004069 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
4070 context->recover();
4071
4072 (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
4073 (yyval.interm.typeLine).line = (yyvsp[(1) - (1)].lex).line;
4074 (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (1)].lex).string);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004075 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004076 break;
4077
kbr@chromium.org205fef32011-11-22 20:50:02 +00004078 case 148:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004079
4080 {
4081 if (context->reservedErrorCheck((yyvsp[(1) - (4)].lex).line, *(yyvsp[(1) - (4)].lex).string))
4082 context->recover();
4083
4084 (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
4085 (yyval.interm.typeLine).line = (yyvsp[(1) - (4)].lex).line;
4086 (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (4)].lex).string);
4087
4088 int size;
4089 if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
4090 context->recover();
4091 (yyval.interm.typeLine).type->setArraySize(size);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004092 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004093 break;
4094
4095 case 149:
4096
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004097 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004098 break;
4099
4100 case 150:
4101
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004102 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004103 break;
4104
4105 case 151:
4106
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004107 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermAggregate); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004108 break;
4109
4110 case 152:
4111
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004112 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004113 break;
4114
4115 case 153:
4116
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004117 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004118 break;
4119
4120 case 154:
4121
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004122 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004123 break;
4124
4125 case 155:
4126
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004127 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004128 break;
4129
4130 case 156:
4131
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004132 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004133 break;
4134
4135 case 157:
4136
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004137 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
zmo@google.com09c323a2011-08-12 18:22:25 +00004138 break;
4139
4140 case 158:
4141
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004142 { (yyval.interm.intermAggregate) = 0; ;}
kbr@chromium.org476541f2011-10-27 21:14:51 +00004143 break;
4144
4145 case 159:
4146
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004147 { context->symbolTable.push(); ;}
kbr@chromium.org476541f2011-10-27 21:14:51 +00004148 break;
4149
4150 case 160:
4151
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004152 { context->symbolTable.pop(); ;}
kbr@chromium.org205fef32011-11-22 20:50:02 +00004153 break;
4154
4155 case 161:
4156
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004157 {
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004158 if ((yyvsp[(3) - (5)].interm.intermAggregate) != 0) {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004159 (yyvsp[(3) - (5)].interm.intermAggregate)->setOp(EOpSequence);
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004160 (yyvsp[(3) - (5)].interm.intermAggregate)->setEndLine((yyvsp[(5) - (5)].lex).line);
4161 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004162 (yyval.interm.intermAggregate) = (yyvsp[(3) - (5)].interm.intermAggregate);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004163 ;}
kbr@chromium.org476541f2011-10-27 21:14:51 +00004164 break;
4165
4166 case 162:
4167
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004168 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
kbr@chromium.org476541f2011-10-27 21:14:51 +00004169 break;
4170
4171 case 163:
4172
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004173 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004174 break;
4175
kbr@chromium.org476541f2011-10-27 21:14:51 +00004176 case 164:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004177
4178 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004179 (yyval.interm.intermNode) = 0;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004180 ;}
kbr@chromium.org205fef32011-11-22 20:50:02 +00004181 break;
4182
4183 case 165:
4184
4185 {
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004186 if ((yyvsp[(2) - (3)].interm.intermAggregate)) {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004187 (yyvsp[(2) - (3)].interm.intermAggregate)->setOp(EOpSequence);
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004188 (yyvsp[(2) - (3)].interm.intermAggregate)->setEndLine((yyvsp[(3) - (3)].lex).line);
4189 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004190 (yyval.interm.intermNode) = (yyvsp[(2) - (3)].interm.intermAggregate);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004191 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004192 break;
4193
kbr@chromium.org476541f2011-10-27 21:14:51 +00004194 case 166:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004195
4196 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004197 (yyval.interm.intermAggregate) = context->intermediate.makeAggregate((yyvsp[(1) - (1)].interm.intermNode), 0);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004198 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004199 break;
4200
kbr@chromium.org476541f2011-10-27 21:14:51 +00004201 case 167:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004202
kbr@chromium.org205fef32011-11-22 20:50:02 +00004203 {
4204 (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 +00004205 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004206 break;
4207
kbr@chromium.org476541f2011-10-27 21:14:51 +00004208 case 168:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004209
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004210 { (yyval.interm.intermNode) = 0; ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004211 break;
4212
kbr@chromium.org476541f2011-10-27 21:14:51 +00004213 case 169:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004214
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004215 { (yyval.interm.intermNode) = static_cast<TIntermNode*>((yyvsp[(1) - (2)].interm.intermTypedNode)); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004216 break;
4217
kbr@chromium.org476541f2011-10-27 21:14:51 +00004218 case 170:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004219
4220 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004221 if (context->boolErrorCheck((yyvsp[(1) - (5)].lex).line, (yyvsp[(3) - (5)].interm.intermTypedNode)))
4222 context->recover();
4223 (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 +00004224 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004225 break;
4226
kbr@chromium.org476541f2011-10-27 21:14:51 +00004227 case 171:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004228
4229 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004230 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermNode);
4231 (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004232 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004233 break;
4234
kbr@chromium.org476541f2011-10-27 21:14:51 +00004235 case 172:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004236
4237 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004238 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (1)].interm.intermNode);
4239 (yyval.interm.nodePair).node2 = 0;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004240 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004241 break;
4242
kbr@chromium.org476541f2011-10-27 21:14:51 +00004243 case 173:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004244
4245 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004246 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
4247 if (context->boolErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)->getLine(), (yyvsp[(1) - (1)].interm.intermTypedNode)))
4248 context->recover();
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004249 ;}
kbr@chromium.org205fef32011-11-22 20:50:02 +00004250 break;
4251
4252 case 174:
4253
4254 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004255 TIntermNode* intermNode;
4256 if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
4257 context->recover();
4258 if (context->boolErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
4259 context->recover();
4260
4261 if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode))
4262 (yyval.interm.intermTypedNode) = (yyvsp[(4) - (4)].interm.intermTypedNode);
4263 else {
4264 context->recover();
4265 (yyval.interm.intermTypedNode) = 0;
4266 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004267 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004268 break;
4269
kbr@chromium.org476541f2011-10-27 21:14:51 +00004270 case 175:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004271
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004272 { context->symbolTable.push(); ++context->loopNestingLevel; ;}
kbr@chromium.org205fef32011-11-22 20:50:02 +00004273 break;
4274
4275 case 176:
4276
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004277 {
4278 context->symbolTable.pop();
alokp@chromium.org52813552010-11-16 18:36:09 +00004279 (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 +00004280 --context->loopNestingLevel;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004281 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004282 break;
4283
kbr@chromium.org476541f2011-10-27 21:14:51 +00004284 case 177:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004285
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004286 { ++context->loopNestingLevel; ;}
kbr@chromium.org205fef32011-11-22 20:50:02 +00004287 break;
4288
4289 case 178:
4290
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004291 {
4292 if (context->boolErrorCheck((yyvsp[(8) - (8)].lex).line, (yyvsp[(6) - (8)].interm.intermTypedNode)))
4293 context->recover();
4294
alokp@chromium.org52813552010-11-16 18:36:09 +00004295 (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 +00004296 --context->loopNestingLevel;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004297 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004298 break;
4299
kbr@chromium.org476541f2011-10-27 21:14:51 +00004300 case 179:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004301
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004302 { context->symbolTable.push(); ++context->loopNestingLevel; ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004303 break;
4304
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004305 case 180:
4306
4307 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004308 context->symbolTable.pop();
4309 (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);
4310 --context->loopNestingLevel;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004311 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004312 break;
4313
4314 case 181:
4315
4316 {
kbr@chromium.org476541f2011-10-27 21:14:51 +00004317 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004318 ;}
zmo@google.com09c323a2011-08-12 18:22:25 +00004319 break;
4320
4321 case 182:
4322
4323 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004324 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004325 ;}
kbr@chromium.org476541f2011-10-27 21:14:51 +00004326 break;
4327
4328 case 183:
4329
4330 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004331 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004332 ;}
kbr@chromium.org476541f2011-10-27 21:14:51 +00004333 break;
4334
4335 case 184:
4336
4337 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004338 (yyval.interm.intermTypedNode) = 0;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004339 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004340 break;
4341
kbr@chromium.org476541f2011-10-27 21:14:51 +00004342 case 185:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004343
4344 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004345 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (2)].interm.intermTypedNode);
4346 (yyval.interm.nodePair).node2 = 0;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004347 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004348 break;
4349
kbr@chromium.org476541f2011-10-27 21:14:51 +00004350 case 186:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004351
4352 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004353 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermTypedNode);
4354 (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermTypedNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004355 ;}
kbr@chromium.org205fef32011-11-22 20:50:02 +00004356 break;
4357
4358 case 187:
4359
4360 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004361 if (context->loopNestingLevel <= 0) {
4362 context->error((yyvsp[(1) - (2)].lex).line, "continue statement only allowed in loops", "", "");
4363 context->recover();
4364 }
4365 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpContinue, (yyvsp[(1) - (2)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004366 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004367 break;
4368
kbr@chromium.org205fef32011-11-22 20:50:02 +00004369 case 188:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004370
4371 {
4372 if (context->loopNestingLevel <= 0) {
4373 context->error((yyvsp[(1) - (2)].lex).line, "break statement only allowed in loops", "", "");
4374 context->recover();
4375 }
4376 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpBreak, (yyvsp[(1) - (2)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004377 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004378 break;
4379
kbr@chromium.org205fef32011-11-22 20:50:02 +00004380 case 189:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004381
4382 {
4383 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(1) - (2)].lex).line);
4384 if (context->currentFunctionType->getBasicType() != EbtVoid) {
4385 context->error((yyvsp[(1) - (2)].lex).line, "non-void function must return a value", "return", "");
4386 context->recover();
4387 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004388 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004389 break;
4390
kbr@chromium.org205fef32011-11-22 20:50:02 +00004391 case 190:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004392
4393 {
4394 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(2) - (3)].interm.intermTypedNode), (yyvsp[(1) - (3)].lex).line);
4395 context->functionReturnsValue = true;
4396 if (context->currentFunctionType->getBasicType() == EbtVoid) {
4397 context->error((yyvsp[(1) - (3)].lex).line, "void function cannot return a value", "return", "");
4398 context->recover();
4399 } else if (*(context->currentFunctionType) != (yyvsp[(2) - (3)].interm.intermTypedNode)->getType()) {
4400 context->error((yyvsp[(1) - (3)].lex).line, "function return is not matching type:", "return", "");
4401 context->recover();
4402 }
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004403 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004404 break;
4405
kbr@chromium.org476541f2011-10-27 21:14:51 +00004406 case 191:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004407
4408 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004409 FRAG_ONLY("discard", (yyvsp[(1) - (2)].lex).line);
4410 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpKill, (yyvsp[(1) - (2)].lex).line);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004411 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004412 break;
4413
kbr@chromium.org476541f2011-10-27 21:14:51 +00004414 case 192:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004415
4416 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004417 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
zmo@google.com09c323a2011-08-12 18:22:25 +00004418 context->treeRoot = (yyval.interm.intermNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004419 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004420 break;
4421
zmo@google.com09c323a2011-08-12 18:22:25 +00004422 case 193:
4423
4424 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004425 (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermNode), (yyvsp[(2) - (2)].interm.intermNode), 0);
4426 context->treeRoot = (yyval.interm.intermNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004427 ;}
kbr@chromium.org476541f2011-10-27 21:14:51 +00004428 break;
4429
4430 case 194:
4431
4432 {
4433 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004434 ;}
kbr@chromium.org476541f2011-10-27 21:14:51 +00004435 break;
4436
4437 case 195:
4438
4439 {
kbr@chromium.org205fef32011-11-22 20:50:02 +00004440 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004441 ;}
kbr@chromium.org205fef32011-11-22 20:50:02 +00004442 break;
4443
4444 case 196:
4445
4446 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004447 TFunction* function = (yyvsp[(1) - (1)].interm).function;
4448 TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find(function->getMangledName()));
4449 //
4450 // Note: 'prevDec' could be 'function' if this is the first time we've seen function
4451 // as it would have just been put in the symbol table. Otherwise, we're looking up
4452 // an earlier occurance.
4453 //
4454 if (prevDec->isDefined()) {
4455 //
4456 // Then this function already has a body.
4457 //
4458 context->error((yyvsp[(1) - (1)].interm).line, "function already has a body", function->getName().c_str(), "");
4459 context->recover();
4460 }
4461 prevDec->setDefined();
4462
4463 //
4464 // Raise error message if main function takes any parameters or return anything other than void
4465 //
4466 if (function->getName() == "main") {
4467 if (function->getParamCount() > 0) {
4468 context->error((yyvsp[(1) - (1)].interm).line, "function cannot take any parameter(s)", function->getName().c_str(), "");
4469 context->recover();
4470 }
4471 if (function->getReturnType().getBasicType() != EbtVoid) {
4472 context->error((yyvsp[(1) - (1)].interm).line, "", function->getReturnType().getBasicString(), "main function cannot return a value");
4473 context->recover();
4474 }
4475 }
4476
4477 //
4478 // New symbol table scope for body of function plus its arguments
4479 //
4480 context->symbolTable.push();
4481
4482 //
4483 // Remember the return type for later checking for RETURN statements.
4484 //
4485 context->currentFunctionType = &(prevDec->getReturnType());
4486 context->functionReturnsValue = false;
4487
4488 //
4489 // Insert parameters into the symbol table.
4490 // If the parameter has no name, it's not an error, just don't insert it
4491 // (could be used for unused args).
4492 //
4493 // Also, accumulate the list of parameters into the HIL, so lower level code
4494 // knows where to find parameters.
4495 //
4496 TIntermAggregate* paramNodes = new TIntermAggregate;
4497 for (int i = 0; i < function->getParamCount(); i++) {
4498 const TParameter& param = function->getParam(i);
4499 if (param.name != 0) {
4500 TVariable *variable = new TVariable(param.name, *param.type);
4501 //
4502 // Insert the parameters with name in the symbol table.
4503 //
4504 if (! context->symbolTable.insert(*variable)) {
4505 context->error((yyvsp[(1) - (1)].interm).line, "redefinition", variable->getName().c_str(), "");
4506 context->recover();
4507 delete variable;
4508 }
4509
4510 //
4511 // Add the parameter to the HIL
4512 //
4513 paramNodes = context->intermediate.growAggregate(
4514 paramNodes,
4515 context->intermediate.addSymbol(variable->getUniqueId(),
4516 variable->getName(),
4517 variable->getType(), (yyvsp[(1) - (1)].interm).line),
4518 (yyvsp[(1) - (1)].interm).line);
4519 } else {
4520 paramNodes = context->intermediate.growAggregate(paramNodes, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (1)].interm).line), (yyvsp[(1) - (1)].interm).line);
4521 }
4522 }
4523 context->intermediate.setAggregateOperator(paramNodes, EOpParameters, (yyvsp[(1) - (1)].interm).line);
4524 (yyvsp[(1) - (1)].interm).intermAggregate = paramNodes;
4525 context->loopNestingLevel = 0;
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004526 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004527 break;
4528
kbr@chromium.org205fef32011-11-22 20:50:02 +00004529 case 197:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004530
4531 {
4532 //?? Check that all paths return a value if return type != void ?
4533 // May be best done as post process phase on intermediate code
4534 if (context->currentFunctionType->getBasicType() != EbtVoid && ! context->functionReturnsValue) {
4535 context->error((yyvsp[(1) - (3)].interm).line, "function does not return a value:", "", (yyvsp[(1) - (3)].interm).function->getName().c_str());
4536 context->recover();
4537 }
4538 context->symbolTable.pop();
4539 (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermAggregate, (yyvsp[(3) - (3)].interm.intermNode), 0);
4540 context->intermediate.setAggregateOperator((yyval.interm.intermNode), EOpFunction, (yyvsp[(1) - (3)].interm).line);
4541 (yyval.interm.intermNode)->getAsAggregate()->setName((yyvsp[(1) - (3)].interm).function->getMangledName().c_str());
4542 (yyval.interm.intermNode)->getAsAggregate()->setType((yyvsp[(1) - (3)].interm).function->getReturnType());
4543
4544 // store the pragma information for debug and optimize and other vendor specific
4545 // information. This information can be queried from the parse tree
4546 (yyval.interm.intermNode)->getAsAggregate()->setOptimize(context->contextPragma.optimize);
4547 (yyval.interm.intermNode)->getAsAggregate()->setDebug(context->contextPragma.debug);
4548 (yyval.interm.intermNode)->getAsAggregate()->addToPragmaTable(context->contextPragma.pragmaTable);
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004549
4550 if ((yyvsp[(3) - (3)].interm.intermNode) && (yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate())
4551 (yyval.interm.intermNode)->getAsAggregate()->setEndLine((yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate()->getEndLine());
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004552 ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004553 break;
4554
4555
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004556/* Line 1267 of yacc.c. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004557
4558 default: break;
4559 }
4560 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
4561
4562 YYPOPSTACK (yylen);
4563 yylen = 0;
4564 YY_STACK_PRINT (yyss, yyssp);
4565
4566 *++yyvsp = yyval;
4567
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004568
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004569 /* Now `shift' the result of the reduction. Determine what state
4570 that goes to, based on the state we popped back to and the rule
4571 number reduced by. */
4572
4573 yyn = yyr1[yyn];
4574
4575 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
4576 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
4577 yystate = yytable[yystate];
4578 else
4579 yystate = yydefgoto[yyn - YYNTOKENS];
4580
4581 goto yynewstate;
4582
4583
4584/*------------------------------------.
4585| yyerrlab -- here on detecting error |
4586`------------------------------------*/
4587yyerrlab:
4588 /* If not already recovering from an error, report this error. */
4589 if (!yyerrstatus)
4590 {
4591 ++yynerrs;
4592#if ! YYERROR_VERBOSE
4593 yyerror (context, YY_("syntax error"));
4594#else
4595 {
4596 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
4597 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
4598 {
4599 YYSIZE_T yyalloc = 2 * yysize;
4600 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
4601 yyalloc = YYSTACK_ALLOC_MAXIMUM;
4602 if (yymsg != yymsgbuf)
4603 YYSTACK_FREE (yymsg);
4604 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
4605 if (yymsg)
4606 yymsg_alloc = yyalloc;
4607 else
4608 {
4609 yymsg = yymsgbuf;
4610 yymsg_alloc = sizeof yymsgbuf;
4611 }
4612 }
4613
4614 if (0 < yysize && yysize <= yymsg_alloc)
4615 {
4616 (void) yysyntax_error (yymsg, yystate, yychar);
4617 yyerror (context, yymsg);
4618 }
4619 else
4620 {
4621 yyerror (context, YY_("syntax error"));
4622 if (yysize != 0)
4623 goto yyexhaustedlab;
4624 }
4625 }
4626#endif
4627 }
4628
4629
4630
4631 if (yyerrstatus == 3)
4632 {
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004633 /* If just tried and failed to reuse look-ahead token after an
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004634 error, discard it. */
4635
4636 if (yychar <= YYEOF)
4637 {
4638 /* Return failure if at end of input. */
4639 if (yychar == YYEOF)
4640 YYABORT;
4641 }
4642 else
4643 {
4644 yydestruct ("Error: discarding",
4645 yytoken, &yylval, context);
4646 yychar = YYEMPTY;
4647 }
4648 }
4649
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004650 /* Else will try to reuse look-ahead token after shifting the error
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004651 token. */
4652 goto yyerrlab1;
4653
4654
4655/*---------------------------------------------------.
4656| yyerrorlab -- error raised explicitly by YYERROR. |
4657`---------------------------------------------------*/
4658yyerrorlab:
4659
4660 /* Pacify compilers like GCC when the user code never invokes
4661 YYERROR and the label yyerrorlab therefore never appears in user
4662 code. */
4663 if (/*CONSTCOND*/ 0)
4664 goto yyerrorlab;
4665
4666 /* Do not reclaim the symbols of the rule which action triggered
4667 this YYERROR. */
4668 YYPOPSTACK (yylen);
4669 yylen = 0;
4670 YY_STACK_PRINT (yyss, yyssp);
4671 yystate = *yyssp;
4672 goto yyerrlab1;
4673
4674
4675/*-------------------------------------------------------------.
4676| yyerrlab1 -- common code for both syntax error and YYERROR. |
4677`-------------------------------------------------------------*/
4678yyerrlab1:
4679 yyerrstatus = 3; /* Each real token shifted decrements this. */
4680
4681 for (;;)
4682 {
4683 yyn = yypact[yystate];
4684 if (yyn != YYPACT_NINF)
4685 {
4686 yyn += YYTERROR;
4687 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
4688 {
4689 yyn = yytable[yyn];
4690 if (0 < yyn)
4691 break;
4692 }
4693 }
4694
4695 /* Pop the current state because it cannot handle the error token. */
4696 if (yyssp == yyss)
4697 YYABORT;
4698
4699
4700 yydestruct ("Error: popping",
4701 yystos[yystate], yyvsp, context);
4702 YYPOPSTACK (1);
4703 yystate = *yyssp;
4704 YY_STACK_PRINT (yyss, yyssp);
4705 }
4706
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004707 if (yyn == YYFINAL)
4708 YYACCEPT;
4709
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004710 *++yyvsp = yylval;
4711
4712
4713 /* Shift the error token. */
4714 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
4715
4716 yystate = yyn;
4717 goto yynewstate;
4718
4719
4720/*-------------------------------------.
4721| yyacceptlab -- YYACCEPT comes here. |
4722`-------------------------------------*/
4723yyacceptlab:
4724 yyresult = 0;
4725 goto yyreturn;
4726
4727/*-----------------------------------.
4728| yyabortlab -- YYABORT comes here. |
4729`-----------------------------------*/
4730yyabortlab:
4731 yyresult = 1;
4732 goto yyreturn;
4733
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004734#ifndef yyoverflow
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004735/*-------------------------------------------------.
4736| yyexhaustedlab -- memory exhaustion comes here. |
4737`-------------------------------------------------*/
4738yyexhaustedlab:
4739 yyerror (context, YY_("memory exhausted"));
4740 yyresult = 2;
4741 /* Fall through. */
4742#endif
4743
4744yyreturn:
apatrick@chromium.org536888b2012-01-25 02:10:25 +00004745 if (yychar != YYEOF && yychar != YYEMPTY)
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004746 yydestruct ("Cleanup: discarding lookahead",
4747 yytoken, &yylval, context);
4748 /* Do not reclaim the symbols of the rule which action triggered
4749 this YYABORT or YYACCEPT. */
4750 YYPOPSTACK (yylen);
4751 YY_STACK_PRINT (yyss, yyssp);
4752 while (yyssp != yyss)
4753 {
4754 yydestruct ("Cleanup: popping",
4755 yystos[*yyssp], yyvsp, context);
4756 YYPOPSTACK (1);
4757 }
4758#ifndef yyoverflow
4759 if (yyss != yyssa)
4760 YYSTACK_FREE (yyss);
4761#endif
4762#if YYERROR_VERBOSE
4763 if (yymsg != yymsgbuf)
4764 YYSTACK_FREE (yymsg);
4765#endif
4766 /* Make sure YYID is used. */
4767 return YYID (yyresult);
4768}
4769
4770
4771
4772
4773
4774int glslang_parse(TParseContext* context) {
4775 return yyparse(context);
4776}
4777
4778