blob: b46e982371e2b15c251f31d5996279a97d49471c [file] [log] [blame]
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001/* A Bison parser, made by GNU Bison 2.3. */
2
3/* Skeleton implementation for Bison's Yacc-like parsers in C
4
5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6 Free Software Foundation, Inc.
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
12
13 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.
17
18 You should have received a copy of the GNU General Public License
19 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. */
22
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.
32
33 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. */
50#define YYBISON_VERSION "2.3"
51
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,
110 IDENTIFIER = 299,
111 TYPE_NAME = 300,
112 FLOATCONSTANT = 301,
113 INTCONSTANT = 302,
114 BOOLCONSTANT = 303,
115 FIELD_SELECTION = 304,
116 LEFT_OP = 305,
117 RIGHT_OP = 306,
118 INC_OP = 307,
119 DEC_OP = 308,
120 LE_OP = 309,
121 GE_OP = 310,
122 EQ_OP = 311,
123 NE_OP = 312,
124 AND_OP = 313,
125 OR_OP = 314,
126 XOR_OP = 315,
127 MUL_ASSIGN = 316,
128 DIV_ASSIGN = 317,
129 ADD_ASSIGN = 318,
130 MOD_ASSIGN = 319,
131 LEFT_ASSIGN = 320,
132 RIGHT_ASSIGN = 321,
133 AND_ASSIGN = 322,
134 XOR_ASSIGN = 323,
135 OR_ASSIGN = 324,
136 SUB_ASSIGN = 325,
137 LEFT_PAREN = 326,
138 RIGHT_PAREN = 327,
139 LEFT_BRACKET = 328,
140 RIGHT_BRACKET = 329,
141 LEFT_BRACE = 330,
142 RIGHT_BRACE = 331,
143 DOT = 332,
144 COMMA = 333,
145 COLON = 334,
146 EQUAL = 335,
147 SEMICOLON = 336,
148 BANG = 337,
149 DASH = 338,
150 TILDE = 339,
151 PLUS = 340,
152 STAR = 341,
153 SLASH = 342,
154 PERCENT = 343,
155 LEFT_ANGLE = 344,
156 RIGHT_ANGLE = 345,
157 VERTICAL_BAR = 346,
158 CARET = 347,
159 AMPERSAND = 348,
160 QUESTION = 349
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000161 };
162#endif
163/* Tokens. */
164#define INVARIANT 258
165#define HIGH_PRECISION 259
166#define MEDIUM_PRECISION 260
167#define LOW_PRECISION 261
168#define PRECISION 262
169#define ATTRIBUTE 263
170#define CONST_QUAL 264
171#define BOOL_TYPE 265
172#define FLOAT_TYPE 266
173#define INT_TYPE 267
174#define BREAK 268
175#define CONTINUE 269
176#define DO 270
177#define ELSE 271
178#define FOR 272
179#define IF 273
180#define DISCARD 274
181#define RETURN 275
182#define BVEC2 276
183#define BVEC3 277
184#define BVEC4 278
185#define IVEC2 279
186#define IVEC3 280
187#define IVEC4 281
188#define VEC2 282
189#define VEC3 283
190#define VEC4 284
191#define MATRIX2 285
192#define MATRIX3 286
193#define MATRIX4 287
194#define IN_QUAL 288
195#define OUT_QUAL 289
196#define INOUT_QUAL 290
197#define UNIFORM 291
198#define VARYING 292
199#define STRUCT 293
200#define VOID_TYPE 294
201#define WHILE 295
202#define SAMPLER2D 296
203#define SAMPLERCUBE 297
zmo@google.com09c323a2011-08-12 18:22:25 +0000204#define SAMPLER_EXTERNAL_OES 298
205#define IDENTIFIER 299
206#define TYPE_NAME 300
207#define FLOATCONSTANT 301
208#define INTCONSTANT 302
209#define BOOLCONSTANT 303
210#define FIELD_SELECTION 304
211#define LEFT_OP 305
212#define RIGHT_OP 306
213#define INC_OP 307
214#define DEC_OP 308
215#define LE_OP 309
216#define GE_OP 310
217#define EQ_OP 311
218#define NE_OP 312
219#define AND_OP 313
220#define OR_OP 314
221#define XOR_OP 315
222#define MUL_ASSIGN 316
223#define DIV_ASSIGN 317
224#define ADD_ASSIGN 318
225#define MOD_ASSIGN 319
226#define LEFT_ASSIGN 320
227#define RIGHT_ASSIGN 321
228#define AND_ASSIGN 322
229#define XOR_ASSIGN 323
230#define OR_ASSIGN 324
231#define SUB_ASSIGN 325
232#define LEFT_PAREN 326
233#define RIGHT_PAREN 327
234#define LEFT_BRACKET 328
235#define RIGHT_BRACKET 329
236#define LEFT_BRACE 330
237#define RIGHT_BRACE 331
238#define DOT 332
239#define COMMA 333
240#define COLON 334
241#define EQUAL 335
242#define SEMICOLON 336
243#define BANG 337
244#define DASH 338
245#define TILDE 339
246#define PLUS 340
247#define STAR 341
248#define SLASH 342
249#define PERCENT 343
250#define LEFT_ANGLE 344
251#define RIGHT_ANGLE 345
252#define VERTICAL_BAR 346
253#define CARET 347
254#define AMPERSAND 348
255#define QUESTION 349
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000256
257
258
259
260/* Copy the first part of user declarations. */
261
262
263//
264// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
265// Use of this source code is governed by a BSD-style license that can be
266// found in the LICENSE file.
267//
268
alokp@chromium.org75fe6b72011-08-14 05:31:22 +0000269// This file is auto-generated by generate_parser.sh. DO NOT EDIT!
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000270
271#include "compiler/SymbolTable.h"
272#include "compiler/ParseHelper.h"
273#include "GLSLANG/ShaderLang.h"
274
275#define YYLEX_PARAM context->scanner
276
277
278/* Enabling traces. */
279#ifndef YYDEBUG
280# define YYDEBUG 0
281#endif
282
283/* Enabling verbose error messages. */
284#ifdef YYERROR_VERBOSE
285# undef YYERROR_VERBOSE
286# define YYERROR_VERBOSE 1
287#else
288# define YYERROR_VERBOSE 0
289#endif
290
291/* Enabling the token table. */
292#ifndef YYTOKEN_TABLE
293# define YYTOKEN_TABLE 0
294#endif
295
296#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
297typedef union YYSTYPE
298
299{
300 struct {
301 TSourceLoc line;
302 union {
303 TString *string;
304 float f;
305 int i;
306 bool b;
307 };
308 TSymbol* symbol;
309 } lex;
310 struct {
311 TSourceLoc line;
312 TOperator op;
313 union {
314 TIntermNode* intermNode;
315 TIntermNodePair nodePair;
316 TIntermTyped* intermTypedNode;
317 TIntermAggregate* intermAggregate;
318 };
319 union {
320 TPublicType type;
321 TPrecision precision;
322 TQualifier qualifier;
323 TFunction* function;
324 TParameter param;
325 TTypeLine typeLine;
326 TTypeList* typeList;
327 };
328 } interm;
329}
kbr@chromium.org476541f2011-10-27 21:14:51 +0000330/* Line 193 of yacc.c. */
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000331
332 YYSTYPE;
333# define yystype YYSTYPE /* obsolescent; will be withdrawn */
334# define YYSTYPE_IS_DECLARED 1
335# define YYSTYPE_IS_TRIVIAL 1
336#endif
337
338
339
340/* Copy the second part of user declarations. */
341
342
343extern int yylex(YYSTYPE* yylval_param, void* yyscanner);
344extern void yyerror(TParseContext* context, const char* reason);
345
346#define FRAG_VERT_ONLY(S, L) { \
347 if (context->shaderType != SH_FRAGMENT_SHADER && \
348 context->shaderType != SH_VERTEX_SHADER) { \
349 context->error(L, " supported in vertex/fragment shaders only ", S, "", ""); \
350 context->recover(); \
351 } \
352}
353
354#define VERTEX_ONLY(S, L) { \
355 if (context->shaderType != SH_VERTEX_SHADER) { \
356 context->error(L, " supported in vertex shaders only ", S, "", ""); \
357 context->recover(); \
358 } \
359}
360
361#define FRAG_ONLY(S, L) { \
362 if (context->shaderType != SH_FRAGMENT_SHADER) { \
363 context->error(L, " supported in fragment shaders only ", S, "", ""); \
364 context->recover(); \
365 } \
366}
367
368
369/* Line 216 of yacc.c. */
370
371
372#ifdef short
373# undef short
374#endif
375
376#ifdef YYTYPE_UINT8
377typedef YYTYPE_UINT8 yytype_uint8;
378#else
379typedef unsigned char yytype_uint8;
380#endif
381
382#ifdef YYTYPE_INT8
383typedef YYTYPE_INT8 yytype_int8;
384#elif (defined __STDC__ || defined __C99__FUNC__ \
385 || defined __cplusplus || defined _MSC_VER)
386typedef signed char yytype_int8;
387#else
388typedef short int yytype_int8;
389#endif
390
391#ifdef YYTYPE_UINT16
392typedef YYTYPE_UINT16 yytype_uint16;
393#else
394typedef unsigned short int yytype_uint16;
395#endif
396
397#ifdef YYTYPE_INT16
398typedef YYTYPE_INT16 yytype_int16;
399#else
400typedef short int yytype_int16;
401#endif
402
403#ifndef YYSIZE_T
404# ifdef __SIZE_TYPE__
405# define YYSIZE_T __SIZE_TYPE__
406# elif defined size_t
407# define YYSIZE_T size_t
408# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
409 || defined __cplusplus || defined _MSC_VER)
410# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
411# define YYSIZE_T size_t
412# else
413# define YYSIZE_T unsigned int
414# endif
415#endif
416
417#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
418
419#ifndef YY_
kbr@chromium.org476541f2011-10-27 21:14:51 +0000420# if defined YYENABLE_NLS && YYENABLE_NLS
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000421# if ENABLE_NLS
422# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
423# define YY_(msgid) dgettext ("bison-runtime", msgid)
424# endif
425# endif
426# ifndef YY_
427# define YY_(msgid) msgid
428# endif
429#endif
430
431/* Suppress unused-variable warnings by "using" E. */
432#if ! defined lint || defined __GNUC__
433# define YYUSE(e) ((void) (e))
434#else
435# define YYUSE(e) /* empty */
436#endif
437
438/* Identity function, used to suppress warnings about constant conditions. */
439#ifndef lint
440# define YYID(n) (n)
441#else
442#if (defined __STDC__ || defined __C99__FUNC__ \
443 || defined __cplusplus || defined _MSC_VER)
444static int
445YYID (int i)
446#else
447static int
448YYID (i)
449 int i;
450#endif
451{
452 return i;
453}
454#endif
455
456#if ! defined yyoverflow || YYERROR_VERBOSE
457
458/* The parser invokes alloca or malloc; define the necessary symbols. */
459
460# ifdef YYSTACK_USE_ALLOCA
461# if YYSTACK_USE_ALLOCA
462# ifdef __GNUC__
463# define YYSTACK_ALLOC __builtin_alloca
464# elif defined __BUILTIN_VA_ARG_INCR
465# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
466# elif defined _AIX
467# define YYSTACK_ALLOC __alloca
468# elif defined _MSC_VER
469# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
470# define alloca _alloca
471# else
472# define YYSTACK_ALLOC alloca
473# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
474 || defined __cplusplus || defined _MSC_VER)
475# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
476# ifndef _STDLIB_H
477# define _STDLIB_H 1
478# endif
479# endif
480# endif
481# endif
482# endif
483
484# ifdef YYSTACK_ALLOC
485 /* Pacify GCC's `empty if-body' warning. */
486# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
487# ifndef YYSTACK_ALLOC_MAXIMUM
488 /* The OS might guarantee only one guard page at the bottom of the stack,
489 and a page size can be as small as 4096 bytes. So we cannot safely
490 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
491 to allow for a few compiler-allocated temporary stack slots. */
492# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
493# endif
494# else
495# define YYSTACK_ALLOC YYMALLOC
496# define YYSTACK_FREE YYFREE
497# ifndef YYSTACK_ALLOC_MAXIMUM
498# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
499# endif
500# if (defined __cplusplus && ! defined _STDLIB_H \
501 && ! ((defined YYMALLOC || defined malloc) \
502 && (defined YYFREE || defined free)))
503# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
504# ifndef _STDLIB_H
505# define _STDLIB_H 1
506# endif
507# endif
508# ifndef YYMALLOC
509# define YYMALLOC malloc
510# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
511 || defined __cplusplus || defined _MSC_VER)
512void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
513# endif
514# endif
515# ifndef YYFREE
516# define YYFREE free
517# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
518 || defined __cplusplus || defined _MSC_VER)
519void free (void *); /* INFRINGES ON USER NAME SPACE */
520# endif
521# endif
522# endif
523#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
524
525
526#if (! defined yyoverflow \
527 && (! defined __cplusplus \
528 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
529
530/* A type that is properly aligned for any stack member. */
531union yyalloc
532{
533 yytype_int16 yyss;
534 YYSTYPE yyvs;
535 };
536
537/* The size of the maximum gap between one aligned stack and the next. */
538# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
539
540/* The size of an array large to enough to hold all stacks, each with
541 N elements. */
542# define YYSTACK_BYTES(N) \
543 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
544 + YYSTACK_GAP_MAXIMUM)
545
546/* Copy COUNT objects from FROM to TO. The source and destination do
547 not overlap. */
548# ifndef YYCOPY
549# if defined __GNUC__ && 1 < __GNUC__
550# define YYCOPY(To, From, Count) \
551 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
552# else
553# define YYCOPY(To, From, Count) \
554 do \
555 { \
556 YYSIZE_T yyi; \
557 for (yyi = 0; yyi < (Count); yyi++) \
558 (To)[yyi] = (From)[yyi]; \
559 } \
560 while (YYID (0))
561# endif
562# endif
563
564/* Relocate STACK from its old location to the new one. The
565 local variables YYSIZE and YYSTACKSIZE give the old and new number of
566 elements in the stack, and YYPTR gives the new location of the
567 stack. Advance YYPTR to a properly aligned location for the next
568 stack. */
569# define YYSTACK_RELOCATE(Stack) \
570 do \
571 { \
572 YYSIZE_T yynewbytes; \
573 YYCOPY (&yyptr->Stack, Stack, yysize); \
574 Stack = &yyptr->Stack; \
575 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
576 yyptr += yynewbytes / sizeof (*yyptr); \
577 } \
578 while (YYID (0))
579
580#endif
581
582/* YYFINAL -- State number of the termination state. */
zmo@google.com09c323a2011-08-12 18:22:25 +0000583#define YYFINAL 70
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000584/* YYLAST -- Last index in YYTABLE. */
kbr@chromium.org476541f2011-10-27 21:14:51 +0000585#define YYLAST 1327
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000586
587/* YYNTOKENS -- Number of terminals. */
zmo@google.com09c323a2011-08-12 18:22:25 +0000588#define YYNTOKENS 95
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000589/* YYNNTS -- Number of nonterminals. */
kbr@chromium.org476541f2011-10-27 21:14:51 +0000590#define YYNNTS 80
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000591/* YYNRULES -- Number of rules. */
kbr@chromium.org476541f2011-10-27 21:14:51 +0000592#define YYNRULES 196
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000593/* YYNRULES -- Number of states. */
kbr@chromium.org476541f2011-10-27 21:14:51 +0000594#define YYNSTATES 299
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000595
596/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
597#define YYUNDEFTOK 2
zmo@google.com09c323a2011-08-12 18:22:25 +0000598#define YYMAXUTOK 349
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000599
600#define YYTRANSLATE(YYX) \
601 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
602
603/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
604static const yytype_uint8 yytranslate[] =
605{
606 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
607 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
608 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
609 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
610 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
611 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
612 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
613 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
614 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
615 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
616 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
617 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
618 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
619 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
620 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
621 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
622 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
623 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
624 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
625 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
626 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
627 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
628 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
629 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
630 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
631 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
632 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
633 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
634 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
635 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
636 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
637 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
638 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
639 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
zmo@google.com09c323a2011-08-12 18:22:25 +0000640 85, 86, 87, 88, 89, 90, 91, 92, 93, 94
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000641};
642
643#if YYDEBUG
644/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
645 YYRHS. */
646static const yytype_uint16 yyprhs[] =
647{
648 0, 0, 3, 5, 7, 9, 11, 13, 17, 19,
649 24, 26, 30, 33, 36, 38, 40, 42, 46, 49,
650 52, 55, 57, 60, 64, 67, 69, 71, 73, 75,
651 78, 81, 84, 86, 88, 90, 92, 96, 100, 102,
652 106, 110, 112, 114, 118, 122, 126, 130, 132, 136,
653 140, 142, 144, 146, 148, 152, 154, 158, 160, 164,
654 166, 172, 174, 178, 180, 182, 184, 186, 188, 190,
655 194, 196, 199, 202, 207, 210, 212, 214, 217, 221,
656 225, 228, 234, 238, 241, 245, 248, 249, 251, 253,
657 255, 257, 259, 263, 269, 276, 282, 284, 287, 292,
658 298, 303, 306, 308, 311, 313, 315, 317, 320, 322,
659 324, 327, 329, 331, 333, 335, 340, 342, 344, 346,
660 348, 350, 352, 354, 356, 358, 360, 362, 364, 366,
kbr@chromium.org476541f2011-10-27 21:14:51 +0000661 368, 370, 372, 374, 376, 378, 380, 382, 383, 390,
662 391, 397, 399, 402, 406, 408, 412, 414, 419, 421,
663 423, 425, 427, 429, 431, 433, 435, 437, 440, 441,
664 442, 448, 450, 452, 455, 459, 461, 464, 466, 469,
665 475, 479, 481, 483, 488, 489, 496, 497, 506, 507,
666 515, 517, 519, 521, 522, 525, 529, 532, 535, 538,
667 542, 545, 547, 550, 552, 554, 555
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000668};
669
670/* YYRHS -- A `-1'-separated list of the rules' RHS. */
671static const yytype_int16 yyrhs[] =
672{
kbr@chromium.org476541f2011-10-27 21:14:51 +0000673 171, 0, -1, 44, -1, 96, -1, 47, -1, 46,
zmo@google.com09c323a2011-08-12 18:22:25 +0000674 -1, 48, -1, 71, 123, 72, -1, 97, -1, 98,
675 73, 99, 74, -1, 100, -1, 98, 77, 49, -1,
676 98, 52, -1, 98, 53, -1, 123, -1, 101, -1,
677 102, -1, 98, 77, 102, -1, 104, 72, -1, 103,
678 72, -1, 105, 39, -1, 105, -1, 105, 121, -1,
679 104, 78, 121, -1, 106, 71, -1, 141, -1, 44,
680 -1, 49, -1, 98, -1, 52, 107, -1, 53, 107,
681 -1, 108, 107, -1, 85, -1, 83, -1, 82, -1,
682 107, -1, 109, 86, 107, -1, 109, 87, 107, -1,
683 109, -1, 110, 85, 109, -1, 110, 83, 109, -1,
684 110, -1, 111, -1, 112, 89, 111, -1, 112, 90,
685 111, -1, 112, 54, 111, -1, 112, 55, 111, -1,
686 112, -1, 113, 56, 112, -1, 113, 57, 112, -1,
687 113, -1, 114, -1, 115, -1, 116, -1, 117, 58,
688 116, -1, 117, -1, 118, 60, 117, -1, 118, -1,
689 119, 59, 118, -1, 119, -1, 119, 94, 123, 79,
690 121, -1, 120, -1, 107, 122, 121, -1, 80, -1,
691 61, -1, 62, -1, 63, -1, 70, -1, 121, -1,
692 123, 78, 121, -1, 120, -1, 126, 81, -1, 134,
693 81, -1, 7, 139, 140, 81, -1, 127, 72, -1,
694 129, -1, 128, -1, 129, 131, -1, 128, 78, 131,
695 -1, 136, 44, 71, -1, 138, 44, -1, 138, 44,
696 73, 124, 74, -1, 137, 132, 130, -1, 132, 130,
697 -1, 137, 132, 133, -1, 132, 133, -1, -1, 33,
698 -1, 34, -1, 35, -1, 138, -1, 135, -1, 134,
699 78, 44, -1, 134, 78, 44, 73, 74, -1, 134,
700 78, 44, 73, 124, 74, -1, 134, 78, 44, 80,
kbr@chromium.org476541f2011-10-27 21:14:51 +0000701 149, -1, 136, -1, 136, 44, -1, 136, 44, 73,
zmo@google.com09c323a2011-08-12 18:22:25 +0000702 74, -1, 136, 44, 73, 124, 74, -1, 136, 44,
kbr@chromium.org476541f2011-10-27 21:14:51 +0000703 80, 149, -1, 3, 44, -1, 138, -1, 137, 138,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000704 -1, 9, -1, 8, -1, 37, -1, 3, 37, -1,
zmo@google.com09c323a2011-08-12 18:22:25 +0000705 36, -1, 140, -1, 139, 140, -1, 4, -1, 5,
706 -1, 6, -1, 141, -1, 141, 73, 124, 74, -1,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000707 39, -1, 11, -1, 12, -1, 10, -1, 27, -1,
708 28, -1, 29, -1, 21, -1, 22, -1, 23, -1,
709 24, -1, 25, -1, 26, -1, 30, -1, 31, -1,
zmo@google.com09c323a2011-08-12 18:22:25 +0000710 32, -1, 41, -1, 42, -1, 43, -1, 142, -1,
kbr@chromium.org476541f2011-10-27 21:14:51 +0000711 45, -1, -1, 38, 44, 75, 143, 145, 76, -1,
712 -1, 38, 75, 144, 145, 76, -1, 146, -1, 145,
713 146, -1, 138, 147, 81, -1, 148, -1, 147, 78,
714 148, -1, 44, -1, 44, 73, 124, 74, -1, 121,
715 -1, 125, -1, 153, -1, 152, -1, 150, -1, 159,
716 -1, 160, -1, 163, -1, 170, -1, 75, 76, -1,
717 -1, -1, 75, 154, 158, 155, 76, -1, 157, -1,
718 152, -1, 75, 76, -1, 75, 158, 76, -1, 151,
719 -1, 158, 151, -1, 81, -1, 123, 81, -1, 18,
720 71, 123, 72, 161, -1, 151, 16, 151, -1, 151,
721 -1, 123, -1, 136, 44, 80, 149, -1, -1, 40,
722 71, 164, 162, 72, 156, -1, -1, 15, 165, 151,
723 40, 71, 123, 72, 81, -1, -1, 17, 71, 166,
724 167, 169, 72, 156, -1, 159, -1, 150, -1, 162,
725 -1, -1, 168, 81, -1, 168, 81, 123, -1, 14,
726 81, -1, 13, 81, -1, 20, 81, -1, 20, 123,
727 81, -1, 19, 81, -1, 172, -1, 171, 172, -1,
728 173, -1, 125, -1, -1, 126, 174, 157, -1
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000729};
730
731/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
732static const yytype_uint16 yyrline[] =
733{
734 0, 153, 153, 188, 191, 204, 209, 214, 220, 223,
735 296, 299, 408, 418, 431, 439, 538, 541, 549, 553,
zmo@google.comdc4b4f82011-06-17 00:42:53 +0000736 560, 564, 571, 577, 586, 594, 649, 656, 666, 669,
737 679, 689, 710, 711, 712, 717, 718, 727, 739, 740,
738 748, 759, 763, 764, 774, 784, 794, 807, 808, 818,
739 831, 835, 839, 843, 844, 857, 858, 871, 872, 885,
740 886, 903, 904, 917, 918, 919, 920, 921, 925, 928,
741 939, 947, 972, 977, 984, 1020, 1023, 1030, 1038, 1059,
742 1078, 1089, 1118, 1123, 1133, 1138, 1148, 1151, 1154, 1157,
743 1163, 1170, 1173, 1189, 1207, 1231, 1254, 1258, 1276, 1284,
744 1316, 1336, 1412, 1421, 1444, 1447, 1453, 1461, 1469, 1477,
745 1487, 1494, 1497, 1500, 1506, 1509, 1524, 1528, 1532, 1536,
746 1545, 1550, 1555, 1560, 1565, 1570, 1575, 1580, 1585, 1590,
kbr@chromium.org476541f2011-10-27 21:14:51 +0000747 1596, 1602, 1608, 1613, 1618, 1627, 1632, 1645, 1645, 1659,
748 1659, 1668, 1671, 1686, 1722, 1726, 1732, 1740, 1756, 1760,
749 1764, 1765, 1771, 1772, 1773, 1774, 1775, 1779, 1780, 1780,
750 1780, 1790, 1791, 1796, 1799, 1809, 1812, 1818, 1819, 1823,
751 1831, 1835, 1845, 1850, 1867, 1867, 1872, 1872, 1879, 1879,
752 1887, 1890, 1896, 1899, 1905, 1909, 1916, 1923, 1930, 1937,
753 1948, 1957, 1961, 1968, 1971, 1977, 1977
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000754};
755#endif
756
757#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
758/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
759 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
760static const char *const yytname[] =
761{
762 "$end", "error", "$undefined", "INVARIANT", "HIGH_PRECISION",
763 "MEDIUM_PRECISION", "LOW_PRECISION", "PRECISION", "ATTRIBUTE",
764 "CONST_QUAL", "BOOL_TYPE", "FLOAT_TYPE", "INT_TYPE", "BREAK", "CONTINUE",
765 "DO", "ELSE", "FOR", "IF", "DISCARD", "RETURN", "BVEC2", "BVEC3",
766 "BVEC4", "IVEC2", "IVEC3", "IVEC4", "VEC2", "VEC3", "VEC4", "MATRIX2",
767 "MATRIX3", "MATRIX4", "IN_QUAL", "OUT_QUAL", "INOUT_QUAL", "UNIFORM",
768 "VARYING", "STRUCT", "VOID_TYPE", "WHILE", "SAMPLER2D", "SAMPLERCUBE",
zmo@google.com09c323a2011-08-12 18:22:25 +0000769 "SAMPLER_EXTERNAL_OES", "IDENTIFIER", "TYPE_NAME", "FLOATCONSTANT",
770 "INTCONSTANT", "BOOLCONSTANT", "FIELD_SELECTION", "LEFT_OP", "RIGHT_OP",
771 "INC_OP", "DEC_OP", "LE_OP", "GE_OP", "EQ_OP", "NE_OP", "AND_OP",
772 "OR_OP", "XOR_OP", "MUL_ASSIGN", "DIV_ASSIGN", "ADD_ASSIGN",
773 "MOD_ASSIGN", "LEFT_ASSIGN", "RIGHT_ASSIGN", "AND_ASSIGN", "XOR_ASSIGN",
774 "OR_ASSIGN", "SUB_ASSIGN", "LEFT_PAREN", "RIGHT_PAREN", "LEFT_BRACKET",
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000775 "RIGHT_BRACKET", "LEFT_BRACE", "RIGHT_BRACE", "DOT", "COMMA", "COLON",
776 "EQUAL", "SEMICOLON", "BANG", "DASH", "TILDE", "PLUS", "STAR", "SLASH",
777 "PERCENT", "LEFT_ANGLE", "RIGHT_ANGLE", "VERTICAL_BAR", "CARET",
778 "AMPERSAND", "QUESTION", "$accept", "variable_identifier",
779 "primary_expression", "postfix_expression", "integer_expression",
780 "function_call", "function_call_or_method", "function_call_generic",
781 "function_call_header_no_parameters",
782 "function_call_header_with_parameters", "function_call_header",
783 "function_identifier", "unary_expression", "unary_operator",
784 "multiplicative_expression", "additive_expression", "shift_expression",
785 "relational_expression", "equality_expression", "and_expression",
786 "exclusive_or_expression", "inclusive_or_expression",
787 "logical_and_expression", "logical_xor_expression",
788 "logical_or_expression", "conditional_expression",
789 "assignment_expression", "assignment_operator", "expression",
790 "constant_expression", "declaration", "function_prototype",
791 "function_declarator", "function_header_with_parameters",
792 "function_header", "parameter_declarator", "parameter_declaration",
793 "parameter_qualifier", "parameter_type_specifier",
794 "init_declarator_list", "single_declaration", "fully_specified_type",
795 "type_qualifier", "type_specifier", "precision_qualifier",
796 "type_specifier_no_prec", "type_specifier_nonarray", "struct_specifier",
kbr@chromium.org476541f2011-10-27 21:14:51 +0000797 "@1", "@2", "struct_declaration_list", "struct_declaration",
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000798 "struct_declarator_list", "struct_declarator", "initializer",
799 "declaration_statement", "statement", "simple_statement",
kbr@chromium.org476541f2011-10-27 21:14:51 +0000800 "compound_statement", "@3", "@4", "statement_no_new_scope",
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000801 "compound_statement_no_new_scope", "statement_list",
802 "expression_statement", "selection_statement",
kbr@chromium.org476541f2011-10-27 21:14:51 +0000803 "selection_rest_statement", "condition", "iteration_statement", "@5",
804 "@6", "@7", "for_init_statement", "conditionopt", "for_rest_statement",
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000805 "jump_statement", "translation_unit", "external_declaration",
kbr@chromium.org476541f2011-10-27 21:14:51 +0000806 "function_definition", "@8", 0
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000807};
808#endif
809
810# ifdef YYPRINT
811/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
812 token YYLEX-NUM. */
813static const yytype_uint16 yytoknum[] =
814{
815 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
816 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
817 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
818 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
819 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
820 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
821 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
822 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
823 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
zmo@google.com09c323a2011-08-12 18:22:25 +0000824 345, 346, 347, 348, 349
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000825};
826# endif
827
828/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
829static const yytype_uint8 yyr1[] =
830{
zmo@google.com09c323a2011-08-12 18:22:25 +0000831 0, 95, 96, 97, 97, 97, 97, 97, 98, 98,
832 98, 98, 98, 98, 99, 100, 101, 101, 102, 102,
833 103, 103, 104, 104, 105, 106, 106, 106, 107, 107,
834 107, 107, 108, 108, 108, 109, 109, 109, 110, 110,
835 110, 111, 112, 112, 112, 112, 112, 113, 113, 113,
836 114, 115, 116, 117, 117, 118, 118, 119, 119, 120,
837 120, 121, 121, 122, 122, 122, 122, 122, 123, 123,
838 124, 125, 125, 125, 126, 127, 127, 128, 128, 129,
839 130, 130, 131, 131, 131, 131, 132, 132, 132, 132,
840 133, 134, 134, 134, 134, 134, 135, 135, 135, 135,
841 135, 135, 136, 136, 137, 137, 137, 137, 137, 138,
842 138, 139, 139, 139, 140, 140, 141, 141, 141, 141,
843 141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
kbr@chromium.org476541f2011-10-27 21:14:51 +0000844 141, 141, 141, 141, 141, 141, 141, 143, 142, 144,
845 142, 145, 145, 146, 147, 147, 148, 148, 149, 150,
846 151, 151, 152, 152, 152, 152, 152, 153, 154, 155,
847 153, 156, 156, 157, 157, 158, 158, 159, 159, 160,
848 161, 161, 162, 162, 164, 163, 165, 163, 166, 163,
849 167, 167, 168, 168, 169, 169, 170, 170, 170, 170,
850 170, 171, 171, 172, 172, 174, 173
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000851};
852
853/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
854static const yytype_uint8 yyr2[] =
855{
856 0, 2, 1, 1, 1, 1, 1, 3, 1, 4,
857 1, 3, 2, 2, 1, 1, 1, 3, 2, 2,
858 2, 1, 2, 3, 2, 1, 1, 1, 1, 2,
859 2, 2, 1, 1, 1, 1, 3, 3, 1, 3,
860 3, 1, 1, 3, 3, 3, 3, 1, 3, 3,
861 1, 1, 1, 1, 3, 1, 3, 1, 3, 1,
862 5, 1, 3, 1, 1, 1, 1, 1, 1, 3,
863 1, 2, 2, 4, 2, 1, 1, 2, 3, 3,
864 2, 5, 3, 2, 3, 2, 0, 1, 1, 1,
865 1, 1, 3, 5, 6, 5, 1, 2, 4, 5,
866 4, 2, 1, 2, 1, 1, 1, 2, 1, 1,
867 2, 1, 1, 1, 1, 4, 1, 1, 1, 1,
868 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
kbr@chromium.org476541f2011-10-27 21:14:51 +0000869 1, 1, 1, 1, 1, 1, 1, 0, 6, 0,
870 5, 1, 2, 3, 1, 3, 1, 4, 1, 1,
871 1, 1, 1, 1, 1, 1, 1, 2, 0, 0,
872 5, 1, 1, 2, 3, 1, 2, 1, 2, 5,
873 3, 1, 1, 4, 0, 6, 0, 8, 0, 7,
874 1, 1, 1, 0, 2, 3, 2, 2, 2, 3,
875 2, 1, 2, 1, 1, 0, 3
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000876};
877
878/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
879 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
880 means the default is an error. */
881static const yytype_uint8 yydefact[] =
882{
883 0, 0, 111, 112, 113, 0, 105, 104, 119, 117,
884 118, 123, 124, 125, 126, 127, 128, 120, 121, 122,
zmo@google.com09c323a2011-08-12 18:22:25 +0000885 129, 130, 131, 108, 106, 0, 116, 132, 133, 134,
kbr@chromium.org476541f2011-10-27 21:14:51 +0000886 136, 194, 195, 0, 76, 86, 0, 91, 96, 0,
887 102, 0, 109, 114, 135, 0, 191, 193, 107, 101,
888 0, 0, 139, 71, 0, 74, 86, 0, 87, 88,
zmo@google.com09c323a2011-08-12 18:22:25 +0000889 89, 77, 0, 86, 0, 72, 97, 103, 110, 0,
kbr@chromium.org476541f2011-10-27 21:14:51 +0000890 1, 192, 0, 137, 0, 0, 196, 78, 83, 85,
891 90, 0, 92, 79, 0, 0, 2, 5, 4, 6,
892 27, 0, 0, 0, 34, 33, 32, 3, 8, 28,
893 10, 15, 16, 0, 0, 21, 0, 35, 0, 38,
894 41, 42, 47, 50, 51, 52, 53, 55, 57, 59,
895 70, 0, 25, 73, 0, 0, 0, 141, 0, 0,
896 176, 0, 0, 0, 0, 0, 158, 163, 167, 35,
897 61, 68, 0, 149, 0, 114, 152, 165, 151, 150,
898 0, 153, 154, 155, 156, 80, 82, 84, 0, 0,
899 98, 0, 148, 100, 29, 30, 0, 12, 13, 0,
900 0, 19, 18, 0, 20, 22, 24, 31, 0, 0,
901 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
902 0, 0, 115, 0, 146, 0, 144, 140, 142, 187,
903 186, 0, 178, 0, 190, 188, 0, 174, 157, 0,
904 64, 65, 66, 67, 63, 0, 0, 168, 164, 166,
905 0, 93, 0, 95, 99, 7, 0, 14, 26, 11,
906 17, 23, 36, 37, 40, 39, 45, 46, 43, 44,
907 48, 49, 54, 56, 58, 0, 138, 0, 0, 143,
908 0, 0, 0, 189, 0, 159, 62, 69, 0, 94,
909 9, 0, 0, 145, 0, 181, 180, 183, 0, 172,
910 0, 0, 0, 81, 60, 147, 0, 182, 0, 0,
911 171, 169, 0, 0, 160, 0, 184, 0, 0, 0,
912 162, 175, 161, 0, 185, 179, 170, 173, 177
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000913};
914
915/* YYDEFGOTO[NTERM-NUM]. */
916static const yytype_int16 yydefgoto[] =
917{
kbr@chromium.org476541f2011-10-27 21:14:51 +0000918 -1, 97, 98, 99, 226, 100, 101, 102, 103, 104,
919 105, 106, 139, 108, 109, 110, 111, 112, 113, 114,
920 115, 116, 117, 118, 119, 140, 141, 215, 142, 121,
921 143, 144, 33, 34, 35, 78, 61, 62, 79, 36,
922 37, 38, 39, 40, 41, 42, 122, 44, 124, 74,
923 126, 127, 195, 196, 163, 146, 147, 148, 149, 209,
924 272, 291, 292, 150, 151, 152, 281, 271, 153, 254,
925 201, 251, 267, 278, 279, 154, 45, 46, 47, 54
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000926};
927
928/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
929 STATE-NUM. */
kbr@chromium.org476541f2011-10-27 21:14:51 +0000930#define YYPACT_NINF -242
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000931static const yytype_int16 yypact[] =
932{
kbr@chromium.org476541f2011-10-27 21:14:51 +0000933 1179, -6, -242, -242, -242, 151, -242, -242, -242, -242,
934 -242, -242, -242, -242, -242, -242, -242, -242, -242, -242,
935 -242, -242, -242, -242, -242, -39, -242, -242, -242, -242,
936 -242, -242, -69, -37, -32, 21, -61, -242, 26, 1221,
937 -242, 1282, -242, -58, -242, 207, -242, -242, -242, -242,
938 1282, 22, -242, -242, 33, -242, 70, 88, -242, -242,
939 -242, -242, 1221, 125, 42, -242, -8, -242, -242, 961,
940 -242, -242, 72, -242, 1221, 286, -242, -242, -242, -242,
941 117, 1221, -57, -242, 766, 961, 94, -242, -242, -242,
942 -242, 961, 961, 961, -242, -242, -242, -242, -242, 14,
943 -242, -242, -242, 99, -35, 1026, 101, -242, 961, -27,
944 46, -242, -21, 56, -242, -242, -242, 115, 119, -45,
945 -242, 103, -242, -242, 1221, 136, 1094, -242, 102, 104,
946 -242, 111, 116, 105, 831, 118, 112, -242, -242, 39,
947 -242, -242, 17, -242, -69, 93, -242, -242, -242, -242,
948 369, -242, -242, -242, -242, 122, -242, -242, 896, 961,
949 -242, 123, -242, -242, -242, -242, 10, -242, -242, 961,
950 1246, -242, -242, 961, 120, -242, -242, -242, 961, 961,
951 961, 961, 961, 961, 961, 961, 961, 961, 961, 961,
952 961, 961, -242, 1136, 126, 49, -242, -242, -242, -242,
953 -242, 452, -242, 961, -242, -242, 71, -242, -242, 452,
954 -242, -242, -242, -242, -242, 961, 961, -242, -242, -242,
955 961, -242, 124, -242, -242, -242, 128, 114, -242, 129,
956 -242, -242, -242, -242, -27, -27, -242, -242, -242, -242,
957 -21, -21, -242, 115, 119, 89, -242, 961, 136, -242,
958 150, 618, 11, -242, 701, 452, -242, -242, 130, -242,
959 -242, 961, 131, -242, 137, -242, -242, 701, 452, 114,
960 152, 148, 145, -242, -242, -242, 961, -242, 141, 153,
961 208, -242, 143, 535, -242, 38, 961, 535, 452, 961,
962 -242, -242, -242, 146, 114, -242, -242, -242, -242
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000963};
964
965/* YYPGOTO[NTERM-NUM]. */
966static const yytype_int16 yypgoto[] =
967{
kbr@chromium.org476541f2011-10-27 21:14:51 +0000968 -242, -242, -242, -242, -242, -242, -242, 77, -242, -242,
969 -242, -242, -44, -242, -63, -242, -62, -17, -242, -242,
970 -242, 52, 37, 51, -242, -66, -83, -242, -92, -73,
971 7, 8, -242, -242, -242, 161, 197, 193, 176, -242,
972 -242, -241, -29, -30, 253, -22, 0, -242, -242, -242,
973 135, -122, -242, 12, -138, 13, -140, -203, -242, -242,
974 -242, -26, 209, 53, 15, -242, -242, -2, -242, -242,
975 -242, -242, -242, -242, -242, -242, -242, 224, -242, -242
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000976};
977
978/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
979 positive, shift that token. If negative, reduce the rule which
980 number is the opposite. If zero, do what YYDEFACT says.
981 If YYTABLE_NINF, syntax error. */
zmo@google.comdc4b4f82011-06-17 00:42:53 +0000982#define YYTABLE_NINF -117
alokp@chromium.org044a5cf2010-11-12 15:42:16 +0000983static const yytype_int16 yytable[] =
984{
kbr@chromium.org476541f2011-10-27 21:14:51 +0000985 43, 166, 162, 120, 198, 51, 63, 31, 32, 67,
986 219, 161, 53, 270, 190, 69, 158, 64, 120, 68,
987 65, 223, 175, 159, 57, 107, 270, 63, 72, 6,
988 7, 48, 80, 182, 183, 55, 52, 172, 49, 43,
989 107, 43, 206, 173, 125, 43, 56, 164, 165, 191,
990 43, 80, 31, 32, 58, 59, 60, 23, 24, 178,
991 179, 250, 43, 83, 177, 84, 167, 168, 184, 185,
992 66, 198, 85, 57, 43, 145, 162, 227, 6, 7,
993 290, 43, 225, 268, 290, 222, 82, 169, 216, 216,
994 231, 170, 120, -75, 125, 216, 125, 73, 217, 245,
995 210, 211, 212, 58, 59, 60, 23, 24, 75, 213,
996 293, 252, 186, 187, 107, 219, 216, 234, 235, 214,
997 236, 237, 238, 239, 43, 48, 43, 248, 280, 180,
998 249, 181, 256, 257, 232, 233, 107, 107, 107, 107,
999 107, 107, 107, 107, 107, 107, 107, 258, 296, 216,
1000 145, 297, 253, 123, 120, 2, 3, 4, 58, 59,
1001 60, 155, 269, 125, -25, -26, 69, 216, 261, 240,
1002 241, 171, 176, 188, 262, 269, 107, 192, 274, 189,
1003 194, 120, 202, 199, 285, 200, 204, 203, 208, 207,
1004 264, -116, 216, 43, 294, 220, 282, 224, 259, 247,
1005 -27, 145, 260, 107, 273, 275, 162, 70, 276, 145,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001006 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001007 283, 284, 286, 289, 288, 287, 243, 298, 11, 12,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001008 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001009 242, 244, 156, 23, 24, 25, 26, 230, 27, 28,
1010 29, 145, 30, 77, 145, 145, 81, 157, 50, 193,
1011 263, 295, 255, 76, 265, 277, 266, 145, 145, 71,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001012 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001013 0, 0, 0, 145, 0, 0, 0, 145, 145, 1,
1014 2, 3, 4, 5, 6, 7, 8, 9, 10, 128,
1015 129, 130, 0, 131, 132, 133, 134, 11, 12, 13,
zmo@google.comdc4b4f82011-06-17 00:42:53 +00001016 14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001017 0, 0, 23, 24, 25, 26, 135, 27, 28, 29,
1018 86, 30, 87, 88, 89, 90, 0, 0, 91, 92,
zmo@google.com09c323a2011-08-12 18:22:25 +00001019 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001020 0, 0, 0, 0, 0, 0, 0, 93, 0, 0,
1021 0, 136, 137, 0, 0, 0, 0, 138, 94, 95,
1022 0, 96, 1, 2, 3, 4, 5, 6, 7, 8,
1023 9, 10, 128, 129, 130, 0, 131, 132, 133, 134,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001024 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001025 21, 22, 0, 0, 0, 23, 24, 25, 26, 135,
1026 27, 28, 29, 86, 30, 87, 88, 89, 90, 0,
1027 0, 91, 92, 0, 0, 0, 0, 0, 0, 0,
zmo@google.com09c323a2011-08-12 18:22:25 +00001028 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001029 93, 0, 0, 0, 136, 218, 0, 0, 0, 0,
1030 138, 94, 95, 0, 96, 1, 2, 3, 4, 5,
1031 6, 7, 8, 9, 10, 128, 129, 130, 0, 131,
1032 132, 133, 134, 11, 12, 13, 14, 15, 16, 17,
1033 18, 19, 20, 21, 22, 0, 0, 0, 23, 24,
1034 25, 26, 135, 27, 28, 29, 86, 30, 87, 88,
1035 89, 90, 0, 0, 91, 92, 0, 0, 0, 0,
zmo@google.com09c323a2011-08-12 18:22:25 +00001036 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001037 0, 0, 0, 93, 0, 0, 0, 136, 0, 0,
1038 0, 0, 0, 138, 94, 95, 0, 96, 1, 2,
1039 3, 4, 5, 6, 7, 8, 9, 10, 128, 129,
1040 130, 0, 131, 132, 133, 134, 11, 12, 13, 14,
zmo@google.com09c323a2011-08-12 18:22:25 +00001041 15, 16, 17, 18, 19, 20, 21, 22, 0, 0,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001042 0, 23, 24, 25, 26, 135, 27, 28, 29, 86,
1043 30, 87, 88, 89, 90, 0, 0, 91, 92, 0,
1044 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1045 0, 0, 0, 0, 0, 0, 93, 0, 0, 0,
1046 75, 0, 0, 0, 0, 0, 138, 94, 95, 0,
1047 96, 1, 2, 3, 4, 5, 6, 7, 8, 9,
1048 10, 0, 0, 0, 0, 0, 0, 0, 0, 11,
1049 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
1050 22, 0, 0, 0, 23, 24, 25, 26, 0, 27,
1051 28, 29, 86, 30, 87, 88, 89, 90, 0, 0,
1052 91, 92, 0, 0, 0, 0, 0, 0, 0, 0,
1053 0, 0, 0, 0, 0, 0, 0, 0, 0, 93,
1054 0, 0, 0, 0, 0, 0, 0, 0, 0, 138,
1055 94, 95, 0, 96, 57, 2, 3, 4, 0, 6,
1056 7, 8, 9, 10, 0, 0, 0, 0, 0, 0,
1057 0, 0, 11, 12, 13, 14, 15, 16, 17, 18,
1058 19, 20, 21, 22, 0, 0, 0, 23, 24, 25,
1059 26, 0, 27, 28, 29, 86, 30, 87, 88, 89,
1060 90, 0, 0, 91, 92, 0, 0, 0, 0, 0,
1061 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1062 0, 0, 93, 0, 0, 0, 8, 9, 10, 0,
1063 0, 0, 0, 94, 95, 0, 96, 11, 12, 13,
zmo@google.com09c323a2011-08-12 18:22:25 +00001064 14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
1065 0, 0, 0, 0, 25, 26, 0, 27, 28, 29,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001066 86, 30, 87, 88, 89, 90, 0, 0, 91, 92,
1067 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1068 0, 0, 0, 0, 0, 0, 0, 93, 0, 0,
1069 160, 8, 9, 10, 0, 0, 0, 0, 94, 95,
1070 0, 96, 11, 12, 13, 14, 15, 16, 17, 18,
1071 19, 20, 21, 22, 0, 0, 0, 0, 0, 25,
1072 26, 0, 27, 28, 29, 86, 30, 87, 88, 89,
1073 90, 0, 0, 91, 92, 0, 0, 0, 0, 0,
1074 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1075 0, 0, 93, 0, 0, 0, 8, 9, 10, 0,
1076 0, 0, 205, 94, 95, 0, 96, 11, 12, 13,
1077 14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
1078 0, 0, 0, 0, 25, 26, 0, 27, 28, 29,
1079 86, 30, 87, 88, 89, 90, 0, 0, 91, 92,
1080 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1081 0, 0, 0, 0, 0, 0, 0, 93, 0, 0,
1082 221, 8, 9, 10, 0, 0, 0, 0, 94, 95,
1083 0, 96, 11, 12, 13, 14, 15, 16, 17, 18,
1084 19, 20, 21, 22, 0, 0, 0, 0, 0, 25,
1085 26, 0, 27, 28, 29, 86, 30, 87, 88, 89,
1086 90, 0, 0, 91, 92, 0, 0, 0, 0, 0,
1087 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1088 0, 0, 93, 0, 0, 0, 8, 9, 10, 0,
1089 0, 0, 0, 94, 95, 0, 96, 11, 12, 13,
1090 14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
1091 0, 0, 0, 0, 25, 174, 0, 27, 28, 29,
1092 86, 30, 87, 88, 89, 90, 0, 0, 91, 92,
1093 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1094 0, 0, 0, 0, 0, 0, 0, 93, 2, 3,
1095 4, 0, 0, 0, 8, 9, 10, 0, 94, 95,
1096 0, 96, 0, 0, 0, 11, 12, 13, 14, 15,
1097 16, 17, 18, 19, 20, 21, 22, 0, 0, 0,
1098 0, 0, 25, 26, 0, 27, 28, 29, 0, 30,
1099 2, 3, 4, 0, 0, 0, 8, 9, 10, 0,
1100 0, 0, 0, 0, 0, 0, 0, 11, 12, 13,
1101 14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
1102 197, 0, 0, 0, 25, 26, 0, 27, 28, 29,
1103 0, 30, 1, 2, 3, 4, 5, 6, 7, 8,
1104 9, 10, 0, 0, 0, 0, 0, 0, 0, 0,
1105 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
1106 21, 22, 246, 0, 0, 23, 24, 25, 26, 0,
1107 27, 28, 29, 0, 30, 2, 3, 4, 0, 0,
1108 0, 8, 9, 10, 0, 0, 0, 0, 0, 0,
1109 0, 0, 11, 12, 13, 14, 15, 16, 17, 18,
1110 19, 20, 21, 22, 0, 0, 8, 9, 10, 25,
1111 26, 0, 27, 28, 29, 0, 30, 11, 12, 13,
1112 14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
1113 0, 0, 0, 0, 25, 26, 0, 27, 28, 29,
1114 228, 30, 8, 9, 10, 229, 0, 0, 0, 0,
1115 0, 0, 0, 11, 12, 13, 14, 15, 16, 17,
1116 18, 19, 20, 21, 22, 0, 0, 0, 0, 0,
1117 25, 26, 0, 27, 28, 29, 0, 30
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001118};
1119
1120static const yytype_int16 yycheck[] =
1121{
kbr@chromium.org476541f2011-10-27 21:14:51 +00001122 0, 93, 85, 69, 126, 44, 35, 0, 0, 39,
1123 150, 84, 81, 254, 59, 73, 73, 78, 84, 41,
1124 81, 159, 105, 80, 3, 69, 267, 56, 50, 8,
1125 9, 37, 62, 54, 55, 72, 75, 72, 44, 39,
1126 84, 41, 134, 78, 74, 45, 78, 91, 92, 94,
1127 50, 81, 45, 45, 33, 34, 35, 36, 37, 86,
1128 87, 201, 62, 71, 108, 73, 52, 53, 89, 90,
1129 44, 193, 80, 3, 74, 75, 159, 169, 8, 9,
1130 283, 81, 72, 72, 287, 158, 44, 73, 78, 78,
1131 173, 77, 158, 72, 124, 78, 126, 75, 81, 191,
1132 61, 62, 63, 33, 34, 35, 36, 37, 75, 70,
1133 72, 203, 56, 57, 158, 255, 78, 180, 181, 80,
1134 182, 183, 184, 185, 124, 37, 126, 78, 268, 83,
1135 81, 85, 215, 216, 178, 179, 180, 181, 182, 183,
1136 184, 185, 186, 187, 188, 189, 190, 220, 288, 78,
1137 150, 289, 81, 81, 220, 4, 5, 6, 33, 34,
1138 35, 44, 254, 193, 71, 71, 73, 78, 79, 186,
1139 187, 72, 71, 58, 247, 267, 220, 74, 261, 60,
1140 44, 247, 71, 81, 276, 81, 81, 71, 76, 71,
1141 40, 71, 78, 193, 286, 73, 44, 74, 74, 73,
1142 71, 201, 74, 247, 74, 74, 289, 0, 71, 209,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001143 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001144 72, 76, 81, 80, 16, 72, 189, 81, 21, 22,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001145 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001146 188, 190, 81, 36, 37, 38, 39, 170, 41, 42,
1147 43, 251, 45, 56, 254, 255, 63, 81, 5, 124,
1148 248, 287, 209, 54, 251, 267, 251, 267, 268, 45,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001149 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001150 -1, -1, -1, 283, -1, -1, -1, 287, 288, 3,
1151 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
1152 14, 15, -1, 17, 18, 19, 20, 21, 22, 23,
zmo@google.comdc4b4f82011-06-17 00:42:53 +00001153 24, 25, 26, 27, 28, 29, 30, 31, 32, -1,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001154 -1, -1, 36, 37, 38, 39, 40, 41, 42, 43,
zmo@google.com09c323a2011-08-12 18:22:25 +00001155 44, 45, 46, 47, 48, 49, -1, -1, 52, 53,
1156 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1157 -1, -1, -1, -1, -1, -1, -1, 71, -1, -1,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001158 -1, 75, 76, -1, -1, -1, -1, 81, 82, 83,
1159 -1, 85, 3, 4, 5, 6, 7, 8, 9, 10,
1160 11, 12, 13, 14, 15, -1, 17, 18, 19, 20,
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001161 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001162 31, 32, -1, -1, -1, 36, 37, 38, 39, 40,
zmo@google.com09c323a2011-08-12 18:22:25 +00001163 41, 42, 43, 44, 45, 46, 47, 48, 49, -1,
1164 -1, 52, 53, -1, -1, -1, -1, -1, -1, -1,
1165 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001166 71, -1, -1, -1, 75, 76, -1, -1, -1, -1,
1167 81, 82, 83, -1, 85, 3, 4, 5, 6, 7,
1168 8, 9, 10, 11, 12, 13, 14, 15, -1, 17,
1169 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
1170 28, 29, 30, 31, 32, -1, -1, -1, 36, 37,
1171 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
1172 48, 49, -1, -1, 52, 53, -1, -1, -1, -1,
zmo@google.com09c323a2011-08-12 18:22:25 +00001173 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001174 -1, -1, -1, 71, -1, -1, -1, 75, -1, -1,
1175 -1, -1, -1, 81, 82, 83, -1, 85, 3, 4,
1176 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1177 15, -1, 17, 18, 19, 20, 21, 22, 23, 24,
zmo@google.com09c323a2011-08-12 18:22:25 +00001178 25, 26, 27, 28, 29, 30, 31, 32, -1, -1,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001179 -1, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1180 45, 46, 47, 48, 49, -1, -1, 52, 53, -1,
1181 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1182 -1, -1, -1, -1, -1, -1, 71, -1, -1, -1,
1183 75, -1, -1, -1, -1, -1, 81, 82, 83, -1,
1184 85, 3, 4, 5, 6, 7, 8, 9, 10, 11,
1185 12, -1, -1, -1, -1, -1, -1, -1, -1, 21,
1186 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
1187 32, -1, -1, -1, 36, 37, 38, 39, -1, 41,
1188 42, 43, 44, 45, 46, 47, 48, 49, -1, -1,
1189 52, 53, -1, -1, -1, -1, -1, -1, -1, -1,
1190 -1, -1, -1, -1, -1, -1, -1, -1, -1, 71,
1191 -1, -1, -1, -1, -1, -1, -1, -1, -1, 81,
1192 82, 83, -1, 85, 3, 4, 5, 6, -1, 8,
1193 9, 10, 11, 12, -1, -1, -1, -1, -1, -1,
1194 -1, -1, 21, 22, 23, 24, 25, 26, 27, 28,
1195 29, 30, 31, 32, -1, -1, -1, 36, 37, 38,
1196 39, -1, 41, 42, 43, 44, 45, 46, 47, 48,
1197 49, -1, -1, 52, 53, -1, -1, -1, -1, -1,
1198 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1199 -1, -1, 71, -1, -1, -1, 10, 11, 12, -1,
1200 -1, -1, -1, 82, 83, -1, 85, 21, 22, 23,
zmo@google.com09c323a2011-08-12 18:22:25 +00001201 24, 25, 26, 27, 28, 29, 30, 31, 32, -1,
1202 -1, -1, -1, -1, 38, 39, -1, 41, 42, 43,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001203 44, 45, 46, 47, 48, 49, -1, -1, 52, 53,
1204 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1205 -1, -1, -1, -1, -1, -1, -1, 71, -1, -1,
1206 74, 10, 11, 12, -1, -1, -1, -1, 82, 83,
1207 -1, 85, 21, 22, 23, 24, 25, 26, 27, 28,
1208 29, 30, 31, 32, -1, -1, -1, -1, -1, 38,
1209 39, -1, 41, 42, 43, 44, 45, 46, 47, 48,
1210 49, -1, -1, 52, 53, -1, -1, -1, -1, -1,
1211 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1212 -1, -1, 71, -1, -1, -1, 10, 11, 12, -1,
1213 -1, -1, 81, 82, 83, -1, 85, 21, 22, 23,
1214 24, 25, 26, 27, 28, 29, 30, 31, 32, -1,
1215 -1, -1, -1, -1, 38, 39, -1, 41, 42, 43,
1216 44, 45, 46, 47, 48, 49, -1, -1, 52, 53,
1217 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1218 -1, -1, -1, -1, -1, -1, -1, 71, -1, -1,
1219 74, 10, 11, 12, -1, -1, -1, -1, 82, 83,
1220 -1, 85, 21, 22, 23, 24, 25, 26, 27, 28,
1221 29, 30, 31, 32, -1, -1, -1, -1, -1, 38,
1222 39, -1, 41, 42, 43, 44, 45, 46, 47, 48,
1223 49, -1, -1, 52, 53, -1, -1, -1, -1, -1,
1224 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1225 -1, -1, 71, -1, -1, -1, 10, 11, 12, -1,
1226 -1, -1, -1, 82, 83, -1, 85, 21, 22, 23,
1227 24, 25, 26, 27, 28, 29, 30, 31, 32, -1,
1228 -1, -1, -1, -1, 38, 39, -1, 41, 42, 43,
1229 44, 45, 46, 47, 48, 49, -1, -1, 52, 53,
1230 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1231 -1, -1, -1, -1, -1, -1, -1, 71, 4, 5,
1232 6, -1, -1, -1, 10, 11, 12, -1, 82, 83,
1233 -1, 85, -1, -1, -1, 21, 22, 23, 24, 25,
1234 26, 27, 28, 29, 30, 31, 32, -1, -1, -1,
1235 -1, -1, 38, 39, -1, 41, 42, 43, -1, 45,
1236 4, 5, 6, -1, -1, -1, 10, 11, 12, -1,
1237 -1, -1, -1, -1, -1, -1, -1, 21, 22, 23,
1238 24, 25, 26, 27, 28, 29, 30, 31, 32, -1,
1239 76, -1, -1, -1, 38, 39, -1, 41, 42, 43,
1240 -1, 45, 3, 4, 5, 6, 7, 8, 9, 10,
1241 11, 12, -1, -1, -1, -1, -1, -1, -1, -1,
1242 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
1243 31, 32, 76, -1, -1, 36, 37, 38, 39, -1,
1244 41, 42, 43, -1, 45, 4, 5, 6, -1, -1,
1245 -1, 10, 11, 12, -1, -1, -1, -1, -1, -1,
1246 -1, -1, 21, 22, 23, 24, 25, 26, 27, 28,
1247 29, 30, 31, 32, -1, -1, 10, 11, 12, 38,
1248 39, -1, 41, 42, 43, -1, 45, 21, 22, 23,
1249 24, 25, 26, 27, 28, 29, 30, 31, 32, -1,
1250 -1, -1, -1, -1, 38, 39, -1, 41, 42, 43,
1251 44, 45, 10, 11, 12, 49, -1, -1, -1, -1,
1252 -1, -1, -1, 21, 22, 23, 24, 25, 26, 27,
1253 28, 29, 30, 31, 32, -1, -1, -1, -1, -1,
1254 38, 39, -1, 41, 42, 43, -1, 45
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001255};
1256
1257/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
1258 symbol of state STATE-NUM. */
1259static const yytype_uint8 yystos[] =
1260{
1261 0, 3, 4, 5, 6, 7, 8, 9, 10, 11,
1262 12, 21, 22, 23, 24, 25, 26, 27, 28, 29,
zmo@google.com09c323a2011-08-12 18:22:25 +00001263 30, 31, 32, 36, 37, 38, 39, 41, 42, 43,
1264 45, 125, 126, 127, 128, 129, 134, 135, 136, 137,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001265 138, 139, 140, 141, 142, 171, 172, 173, 37, 44,
1266 139, 44, 75, 81, 174, 72, 78, 3, 33, 34,
zmo@google.com09c323a2011-08-12 18:22:25 +00001267 35, 131, 132, 137, 78, 81, 44, 138, 140, 73,
kbr@chromium.org476541f2011-10-27 21:14:51 +00001268 0, 172, 140, 75, 144, 75, 157, 131, 130, 133,
1269 138, 132, 44, 71, 73, 80, 44, 46, 47, 48,
1270 49, 52, 53, 71, 82, 83, 85, 96, 97, 98,
1271 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
1272 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
1273 120, 124, 141, 81, 143, 138, 145, 146, 13, 14,
1274 15, 17, 18, 19, 20, 40, 75, 76, 81, 107,
1275 120, 121, 123, 125, 126, 141, 150, 151, 152, 153,
1276 158, 159, 160, 163, 170, 44, 130, 133, 73, 80,
1277 74, 124, 121, 149, 107, 107, 123, 52, 53, 73,
1278 77, 72, 72, 78, 39, 121, 71, 107, 86, 87,
1279 83, 85, 54, 55, 89, 90, 56, 57, 58, 60,
1280 59, 94, 74, 145, 44, 147, 148, 76, 146, 81,
1281 81, 165, 71, 71, 81, 81, 123, 71, 76, 154,
1282 61, 62, 63, 70, 80, 122, 78, 81, 76, 151,
1283 73, 74, 124, 149, 74, 72, 99, 123, 44, 49,
1284 102, 121, 107, 107, 109, 109, 111, 111, 111, 111,
1285 112, 112, 116, 117, 118, 123, 76, 73, 78, 81,
1286 151, 166, 123, 81, 164, 158, 121, 121, 124, 74,
1287 74, 79, 124, 148, 40, 150, 159, 167, 72, 123,
1288 136, 162, 155, 74, 121, 74, 71, 162, 168, 169,
1289 151, 161, 44, 72, 76, 123, 81, 72, 16, 80,
1290 152, 156, 157, 72, 123, 156, 151, 149, 81
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001291};
1292
1293#define yyerrok (yyerrstatus = 0)
1294#define yyclearin (yychar = YYEMPTY)
1295#define YYEMPTY (-2)
1296#define YYEOF 0
1297
1298#define YYACCEPT goto yyacceptlab
1299#define YYABORT goto yyabortlab
1300#define YYERROR goto yyerrorlab
1301
1302
1303/* Like YYERROR except do call yyerror. This remains here temporarily
1304 to ease the transition to the new meaning of YYERROR, for GCC.
1305 Once GCC version 2 has supplanted version 1, this can go. */
1306
1307#define YYFAIL goto yyerrlab
1308
1309#define YYRECOVERING() (!!yyerrstatus)
1310
1311#define YYBACKUP(Token, Value) \
1312do \
1313 if (yychar == YYEMPTY && yylen == 1) \
1314 { \
1315 yychar = (Token); \
1316 yylval = (Value); \
1317 yytoken = YYTRANSLATE (yychar); \
1318 YYPOPSTACK (1); \
1319 goto yybackup; \
1320 } \
1321 else \
1322 { \
1323 yyerror (context, YY_("syntax error: cannot back up")); \
1324 YYERROR; \
1325 } \
1326while (YYID (0))
1327
1328
1329#define YYTERROR 1
1330#define YYERRCODE 256
1331
1332
1333/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
1334 If N is 0, then set CURRENT to the empty location which ends
1335 the previous symbol: RHS[0] (always defined). */
1336
1337#define YYRHSLOC(Rhs, K) ((Rhs)[K])
1338#ifndef YYLLOC_DEFAULT
1339# define YYLLOC_DEFAULT(Current, Rhs, N) \
1340 do \
1341 if (YYID (N)) \
1342 { \
1343 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
1344 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
1345 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
1346 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
1347 } \
1348 else \
1349 { \
1350 (Current).first_line = (Current).last_line = \
1351 YYRHSLOC (Rhs, 0).last_line; \
1352 (Current).first_column = (Current).last_column = \
1353 YYRHSLOC (Rhs, 0).last_column; \
1354 } \
1355 while (YYID (0))
1356#endif
1357
1358
1359/* YY_LOCATION_PRINT -- Print the location on the stream.
1360 This macro was not mandated originally: define only if we know
1361 we won't break user code: when these are the locations we know. */
1362
1363#ifndef YY_LOCATION_PRINT
kbr@chromium.org476541f2011-10-27 21:14:51 +00001364# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00001365# define YY_LOCATION_PRINT(File, Loc) \
1366 fprintf (File, "%d.%d-%d.%d", \
1367 (Loc).first_line, (Loc).first_column, \
1368 (Loc).last_line, (Loc).last_column)
1369# else
1370# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1371# endif
1372#endif
1373
1374
1375/* YYLEX -- calling `yylex' with the right arguments. */
1376
1377#ifdef YYLEX_PARAM
1378# define YYLEX yylex (&yylval, YYLEX_PARAM)
1379#else
1380# define YYLEX yylex (&yylval)
1381#endif
1382
1383/* Enable debugging if requested. */
1384#if YYDEBUG
1385
1386# ifndef YYFPRINTF
1387# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1388# define YYFPRINTF fprintf
1389# endif
1390
1391# define YYDPRINTF(Args) \
1392do { \
1393 if (yydebug) \
1394 YYFPRINTF Args; \
1395} while (YYID (0))
1396
1397# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
1398do { \
1399 if (yydebug) \
1400 { \
1401 YYFPRINTF (stderr, "%s ", Title); \
1402 yy_symbol_print (stderr, \
1403 Type, Value, context); \
1404 YYFPRINTF (stderr, "\n"); \
1405 } \
1406} while (YYID (0))
1407
1408
1409/*--------------------------------.
1410| Print this symbol on YYOUTPUT. |
1411`--------------------------------*/
1412
1413/*ARGSUSED*/
1414#if (defined __STDC__ || defined __C99__FUNC__ \
1415 || defined __cplusplus || defined _MSC_VER)
1416static void
1417yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, TParseContext* context)
1418#else
1419static void
1420yy_symbol_value_print (yyoutput, yytype, yyvaluep, context)
1421 FILE *yyoutput;
1422 int yytype;
1423 YYSTYPE const * const yyvaluep;
1424 TParseContext* context;
1425#endif
1426{
1427 if (!yyvaluep)
1428 return;
1429 YYUSE (context);
1430# ifdef YYPRINT
1431 if (yytype < YYNTOKENS)
1432 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1433# else
1434 YYUSE (yyoutput);
1435# endif
1436 switch (yytype)
1437 {
1438 default:
1439 break;
1440 }
1441}
1442
1443
1444/*--------------------------------.
1445| Print this symbol on YYOUTPUT. |
1446`--------------------------------*/
1447
1448#if (defined __STDC__ || defined __C99__FUNC__ \
1449 || defined __cplusplus || defined _MSC_VER)
1450static void
1451yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, TParseContext* context)
1452#else
1453static void
1454yy_symbol_print (yyoutput, yytype, yyvaluep, context)
1455 FILE *yyoutput;
1456 int yytype;
1457 YYSTYPE const * const yyvaluep;
1458 TParseContext* context;
1459#endif
1460{
1461 if (yytype < YYNTOKENS)
1462 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1463 else
1464 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1465
1466 yy_symbol_value_print (yyoutput, yytype, yyvaluep, context);
1467 YYFPRINTF (yyoutput, ")");
1468}
1469
1470/*------------------------------------------------------------------.
1471| yy_stack_print -- Print the state stack from its BOTTOM up to its |
1472| TOP (included). |
1473`------------------------------------------------------------------*/
1474
1475#if (defined __STDC__ || defined __C99__FUNC__ \
1476 || defined __cplusplus || defined _MSC_VER)
1477static void
1478yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
1479#else
1480static void
1481yy_stack_print (bottom, top)
1482 yytype_int16 *bottom;
1483 yytype_int16 *top;
1484#endif
1485{
1486 YYFPRINTF (stderr, "Stack now");
1487 for (; bottom <= top; ++bottom)
1488 YYFPRINTF (stderr, " %d", *bottom);
1489 YYFPRINTF (stderr, "\n");
1490}
1491
1492# define YY_STACK_PRINT(Bottom, Top) \
1493do { \
1494 if (yydebug) \
1495 yy_stack_print ((Bottom), (Top)); \
1496} while (YYID (0))
1497
1498
1499/*------------------------------------------------.
1500| Report that the YYRULE is going to be reduced. |
1501`------------------------------------------------*/
1502
1503#if (defined __STDC__ || defined __C99__FUNC__ \
1504 || defined __cplusplus || defined _MSC_VER)
1505static void
1506yy_reduce_print (YYSTYPE *yyvsp, int yyrule, TParseContext* context)
1507#else
1508static void
1509yy_reduce_print (yyvsp, yyrule, context)
1510 YYSTYPE *yyvsp;
1511 int yyrule;
1512 TParseContext* context;
1513#endif
1514{
1515 int yynrhs = yyr2[yyrule];
1516 int yyi;
1517 unsigned long int yylno = yyrline[yyrule];
1518 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1519 yyrule - 1, yylno);
1520 /* The symbols being reduced. */
1521 for (yyi = 0; yyi < yynrhs; yyi++)
1522 {
1523 fprintf (stderr, " $%d = ", yyi + 1);
1524 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1525 &(yyvsp[(yyi + 1) - (yynrhs)])
1526 , context);
1527 fprintf (stderr, "\n");
1528 }
1529}
1530
1531# define YY_REDUCE_PRINT(Rule) \
1532do { \
1533 if (yydebug) \
1534 yy_reduce_print (yyvsp, Rule, context); \
1535} while (YYID (0))
1536
1537/* Nonzero means print parse trace. It is left uninitialized so that
1538 multiple parsers can coexist. */
1539int yydebug;
1540#else /* !YYDEBUG */
1541# define YYDPRINTF(Args)
1542# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1543# define YY_STACK_PRINT(Bottom, Top)
1544# define YY_REDUCE_PRINT(Rule)
1545#endif /* !YYDEBUG */
1546
1547
1548/* YYINITDEPTH -- initial size of the parser's stacks. */
1549#ifndef YYINITDEPTH
1550# define YYINITDEPTH 200
1551#endif
1552
1553/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1554 if the built-in stack extension method is used).
1555
1556 Do not make this value too large; the results are undefined if
1557 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1558 evaluated with infinite-precision integer arithmetic. */
1559
1560#ifndef YYMAXDEPTH
1561# define YYMAXDEPTH 10000
1562#endif
1563
1564
1565
1566#if YYERROR_VERBOSE
1567
1568# ifndef yystrlen
1569# if defined __GLIBC__ && defined _STRING_H
1570# define yystrlen strlen
1571# else
1572/* Return the length of YYSTR. */
1573#if (defined __STDC__ || defined __C99__FUNC__ \
1574 || defined __cplusplus || defined _MSC_VER)
1575static YYSIZE_T
1576yystrlen (const char *yystr)
1577#else
1578static YYSIZE_T
1579yystrlen (yystr)
1580 const char *yystr;
1581#endif
1582{
1583 YYSIZE_T yylen;
1584 for (yylen = 0; yystr[yylen]; yylen++)
1585 continue;
1586 return yylen;
1587}
1588# endif
1589# endif
1590
1591# ifndef yystpcpy
1592# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1593# define yystpcpy stpcpy
1594# else
1595/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1596 YYDEST. */
1597#if (defined __STDC__ || defined __C99__FUNC__ \
1598 || defined __cplusplus || defined _MSC_VER)
1599static char *
1600yystpcpy (char *yydest, const char *yysrc)
1601#else
1602static char *
1603yystpcpy (yydest, yysrc)
1604 char *yydest;
1605 const char *yysrc;
1606#endif
1607{
1608 char *yyd = yydest;
1609 const char *yys = yysrc;
1610
1611 while ((*yyd++ = *yys++) != '\0')
1612 continue;
1613
1614 return yyd - 1;
1615}
1616# endif
1617# endif
1618
1619# ifndef yytnamerr
1620/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1621 quotes and backslashes, so that it's suitable for yyerror. The
1622 heuristic is that double-quoting is unnecessary unless the string
1623 contains an apostrophe, a comma, or backslash (other than
1624 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1625 null, do not copy; instead, return the length of what the result
1626 would have been. */
1627static YYSIZE_T
1628yytnamerr (char *yyres, const char *yystr)
1629{
1630 if (*yystr == '"')
1631 {
1632 YYSIZE_T yyn = 0;
1633 char const *yyp = yystr;
1634
1635 for (;;)
1636 switch (*++yyp)
1637 {
1638 case '\'':
1639 case ',':
1640 goto do_not_strip_quotes;
1641
1642 case '\\':
1643 if (*++yyp != '\\')
1644 goto do_not_strip_quotes;
1645 /* Fall through. */
1646 default:
1647 if (yyres)
1648 yyres[yyn] = *yyp;
1649 yyn++;
1650 break;
1651
1652 case '"':
1653 if (yyres)
1654 yyres[yyn] = '\0';
1655 return yyn;
1656 }
1657 do_not_strip_quotes: ;
1658 }
1659
1660 if (! yyres)
1661 return yystrlen (yystr);
1662
1663 return yystpcpy (yyres, yystr) - yyres;
1664}
1665# endif
1666
1667/* Copy into YYRESULT an error message about the unexpected token
1668 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1669 including the terminating null byte. If YYRESULT is null, do not
1670 copy anything; just return the number of bytes that would be
1671 copied. As a special case, return 0 if an ordinary "syntax error"
1672 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1673 size calculation. */
1674static YYSIZE_T
1675yysyntax_error (char *yyresult, int yystate, int yychar)
1676{
1677 int yyn = yypact[yystate];
1678
1679 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1680 return 0;
1681 else
1682 {
1683 int yytype = YYTRANSLATE (yychar);
1684 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1685 YYSIZE_T yysize = yysize0;
1686 YYSIZE_T yysize1;
1687 int yysize_overflow = 0;
1688 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1689 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1690 int yyx;
1691
1692# if 0
1693 /* This is so xgettext sees the translatable formats that are
1694 constructed on the fly. */
1695 YY_("syntax error, unexpected %s");
1696 YY_("syntax error, unexpected %s, expecting %s");
1697 YY_("syntax error, unexpected %s, expecting %s or %s");
1698 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1699 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1700# endif
1701 char *yyfmt;
1702 char const *yyf;
1703 static char const yyunexpected[] = "syntax error, unexpected %s";
1704 static char const yyexpecting[] = ", expecting %s";
1705 static char const yyor[] = " or %s";
1706 char yyformat[sizeof yyunexpected
1707 + sizeof yyexpecting - 1
1708 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1709 * (sizeof yyor - 1))];
1710 char const *yyprefix = yyexpecting;
1711
1712 /* Start YYX at -YYN if negative to avoid negative indexes in
1713 YYCHECK. */
1714 int yyxbegin = yyn < 0 ? -yyn : 0;
1715
1716 /* Stay within bounds of both yycheck and yytname. */
1717 int yychecklim = YYLAST - yyn + 1;
1718 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1719 int yycount = 1;
1720
1721 yyarg[0] = yytname[yytype];
1722 yyfmt = yystpcpy (yyformat, yyunexpected);
1723
1724 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1725 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1726 {
1727 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1728 {
1729 yycount = 1;
1730 yysize = yysize0;
1731 yyformat[sizeof yyunexpected - 1] = '\0';
1732 break;
1733 }
1734 yyarg[yycount++] = yytname[yyx];
1735 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1736 yysize_overflow |= (yysize1 < yysize);
1737 yysize = yysize1;
1738 yyfmt = yystpcpy (yyfmt, yyprefix);
1739 yyprefix = yyor;
1740 }
1741
1742 yyf = YY_(yyformat);
1743 yysize1 = yysize + yystrlen (yyf);
1744 yysize_overflow |= (yysize1 < yysize);
1745 yysize = yysize1;
1746
1747 if (yysize_overflow)
1748 return YYSIZE_MAXIMUM;
1749
1750 if (yyresult)
1751 {
1752 /* Avoid sprintf, as that infringes on the user's name space.
1753 Don't have undefined behavior even if the translation
1754 produced a string with the wrong number of "%s"s. */
1755 char *yyp = yyresult;
1756 int yyi = 0;
1757 while ((*yyp = *yyf) != '\0')
1758 {
1759 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1760 {
1761 yyp += yytnamerr (yyp, yyarg[yyi++]);
1762 yyf += 2;
1763 }
1764 else
1765 {
1766 yyp++;
1767 yyf++;
1768 }
1769 }
1770 }
1771 return yysize;
1772 }
1773}
1774#endif /* YYERROR_VERBOSE */
1775
1776
1777/*-----------------------------------------------.
1778| Release the memory associated to this symbol. |
1779`-----------------------------------------------*/
1780
1781/*ARGSUSED*/
1782#if (defined __STDC__ || defined __C99__FUNC__ \
1783 || defined __cplusplus || defined _MSC_VER)
1784static void
1785yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, TParseContext* context)
1786#else
1787static void
1788yydestruct (yymsg, yytype, yyvaluep, context)
1789 const char *yymsg;
1790 int yytype;
1791 YYSTYPE *yyvaluep;
1792 TParseContext* context;
1793#endif
1794{
1795 YYUSE (yyvaluep);
1796 YYUSE (context);
1797
1798 if (!yymsg)
1799 yymsg = "Deleting";
1800 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1801
1802 switch (yytype)
1803 {
1804
1805 default:
1806 break;
1807 }
1808}
1809
1810
1811/* Prevent warnings from -Wmissing-prototypes. */
1812
1813#ifdef YYPARSE_PARAM
1814#if defined __STDC__ || defined __cplusplus
1815int yyparse (void *YYPARSE_PARAM);
1816#else
1817int yyparse ();
1818#endif
1819#else /* ! YYPARSE_PARAM */
1820#if defined __STDC__ || defined __cplusplus
1821int yyparse (TParseContext* context);
1822#else
1823int yyparse ();
1824#endif
1825#endif /* ! YYPARSE_PARAM */
1826
1827
1828
1829
1830
1831
1832/*----------.
1833| yyparse. |
1834`----------*/
1835
1836#ifdef YYPARSE_PARAM
1837#if (defined __STDC__ || defined __C99__FUNC__ \
1838 || defined __cplusplus || defined _MSC_VER)
1839int
1840yyparse (void *YYPARSE_PARAM)
1841#else
1842int
1843yyparse (YYPARSE_PARAM)
1844 void *YYPARSE_PARAM;
1845#endif
1846#else /* ! YYPARSE_PARAM */
1847#if (defined __STDC__ || defined __C99__FUNC__ \
1848 || defined __cplusplus || defined _MSC_VER)
1849int
1850yyparse (TParseContext* context)
1851#else
1852int
1853yyparse (context)
1854 TParseContext* context;
1855#endif
1856#endif
1857{
1858 /* The look-ahead symbol. */
1859int yychar;
1860
1861/* The semantic value of the look-ahead symbol. */
1862YYSTYPE yylval;
1863
1864/* Number of syntax errors so far. */
1865int yynerrs;
1866
1867 int yystate;
1868 int yyn;
1869 int yyresult;
1870 /* Number of tokens to shift before error messages enabled. */
1871 int yyerrstatus;
1872 /* Look-ahead token as an internal (translated) token number. */
1873 int yytoken = 0;
1874#if YYERROR_VERBOSE
1875 /* Buffer for error messages, and its allocated size. */
1876 char yymsgbuf[128];
1877 char *yymsg = yymsgbuf;
1878 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1879#endif
1880
1881 /* Three stacks and their tools:
1882 `yyss': related to states,
1883 `yyvs': related to semantic values,
1884 `yyls': related to locations.
1885
1886 Refer to the stacks thru separate pointers, to allow yyoverflow
1887 to reallocate them elsewhere. */
1888
1889 /* The state stack. */
1890 yytype_int16 yyssa[YYINITDEPTH];
1891 yytype_int16 *yyss = yyssa;
1892 yytype_int16 *yyssp;
1893
1894 /* The semantic value stack. */
1895 YYSTYPE yyvsa[YYINITDEPTH];
1896 YYSTYPE *yyvs = yyvsa;
1897 YYSTYPE *yyvsp;
1898
1899
1900
1901#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1902
1903 YYSIZE_T yystacksize = YYINITDEPTH;
1904
1905 /* The variables used to return semantic value and location from the
1906 action routines. */
1907 YYSTYPE yyval;
1908
1909
1910 /* The number of symbols on the RHS of the reduced rule.
1911 Keep to zero when no symbol should be popped. */
1912 int yylen = 0;
1913
1914 YYDPRINTF ((stderr, "Starting parse\n"));
1915
1916 yystate = 0;
1917 yyerrstatus = 0;
1918 yynerrs = 0;
1919 yychar = YYEMPTY; /* Cause a token to be read. */
1920
1921 /* Initialize stack pointers.
1922 Waste one element of value and location stack
1923 so that they stay on the same level as the state stack.
1924 The wasted elements are never initialized. */
1925
1926 yyssp = yyss;
1927 yyvsp = yyvs;
1928
1929 goto yysetstate;
1930
1931/*------------------------------------------------------------.
1932| yynewstate -- Push a new state, which is found in yystate. |
1933`------------------------------------------------------------*/
1934 yynewstate:
1935 /* In all cases, when you get here, the value and location stacks
1936 have just been pushed. So pushing a state here evens the stacks. */
1937 yyssp++;
1938
1939 yysetstate:
1940 *yyssp = yystate;
1941
1942 if (yyss + yystacksize - 1 <= yyssp)
1943 {
1944 /* Get the current used size of the three stacks, in elements. */
1945 YYSIZE_T yysize = yyssp - yyss + 1;
1946
1947#ifdef yyoverflow
1948 {
1949 /* Give user a chance to reallocate the stack. Use copies of
1950 these so that the &'s don't force the real ones into
1951 memory. */
1952 YYSTYPE *yyvs1 = yyvs;
1953 yytype_int16 *yyss1 = yyss;
1954
1955
1956 /* Each stack pointer address is followed by the size of the
1957 data in use in that stack, in bytes. This used to be a
1958 conditional around just the two extra args, but that might
1959 be undefined if yyoverflow is a macro. */
1960 yyoverflow (YY_("memory exhausted"),
1961 &yyss1, yysize * sizeof (*yyssp),
1962 &yyvs1, yysize * sizeof (*yyvsp),
1963
1964 &yystacksize);
1965
1966 yyss = yyss1;
1967 yyvs = yyvs1;
1968 }
1969#else /* no yyoverflow */
1970# ifndef YYSTACK_RELOCATE
1971 goto yyexhaustedlab;
1972# else
1973 /* Extend the stack our own way. */
1974 if (YYMAXDEPTH <= yystacksize)
1975 goto yyexhaustedlab;
1976 yystacksize *= 2;
1977 if (YYMAXDEPTH < yystacksize)
1978 yystacksize = YYMAXDEPTH;
1979
1980 {
1981 yytype_int16 *yyss1 = yyss;
1982 union yyalloc *yyptr =
1983 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1984 if (! yyptr)
1985 goto yyexhaustedlab;
1986 YYSTACK_RELOCATE (yyss);
1987 YYSTACK_RELOCATE (yyvs);
1988
1989# undef YYSTACK_RELOCATE
1990 if (yyss1 != yyssa)
1991 YYSTACK_FREE (yyss1);
1992 }
1993# endif
1994#endif /* no yyoverflow */
1995
1996 yyssp = yyss + yysize - 1;
1997 yyvsp = yyvs + yysize - 1;
1998
1999
2000 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
2001 (unsigned long int) yystacksize));
2002
2003 if (yyss + yystacksize - 1 <= yyssp)
2004 YYABORT;
2005 }
2006
2007 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
2008
2009 goto yybackup;
2010
2011/*-----------.
2012| yybackup. |
2013`-----------*/
2014yybackup:
2015
2016 /* Do appropriate processing given the current state. Read a
2017 look-ahead token if we need one and don't already have one. */
2018
2019 /* First try to decide what to do without reference to look-ahead token. */
2020 yyn = yypact[yystate];
2021 if (yyn == YYPACT_NINF)
2022 goto yydefault;
2023
2024 /* Not known => get a look-ahead token if don't already have one. */
2025
2026 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
2027 if (yychar == YYEMPTY)
2028 {
2029 YYDPRINTF ((stderr, "Reading a token: "));
2030 yychar = YYLEX;
2031 }
2032
2033 if (yychar <= YYEOF)
2034 {
2035 yychar = yytoken = YYEOF;
2036 YYDPRINTF ((stderr, "Now at end of input.\n"));
2037 }
2038 else
2039 {
2040 yytoken = YYTRANSLATE (yychar);
2041 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
2042 }
2043
2044 /* If the proper action on seeing token YYTOKEN is to reduce or to
2045 detect an error, take that action. */
2046 yyn += yytoken;
2047 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
2048 goto yydefault;
2049 yyn = yytable[yyn];
2050 if (yyn <= 0)
2051 {
2052 if (yyn == 0 || yyn == YYTABLE_NINF)
2053 goto yyerrlab;
2054 yyn = -yyn;
2055 goto yyreduce;
2056 }
2057
2058 if (yyn == YYFINAL)
2059 YYACCEPT;
2060
2061 /* Count tokens shifted since error; after three, turn off error
2062 status. */
2063 if (yyerrstatus)
2064 yyerrstatus--;
2065
2066 /* Shift the look-ahead token. */
2067 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
2068
2069 /* Discard the shifted token unless it is eof. */
2070 if (yychar != YYEOF)
2071 yychar = YYEMPTY;
2072
2073 yystate = yyn;
2074 *++yyvsp = yylval;
2075
2076 goto yynewstate;
2077
2078
2079/*-----------------------------------------------------------.
2080| yydefault -- do the default action for the current state. |
2081`-----------------------------------------------------------*/
2082yydefault:
2083 yyn = yydefact[yystate];
2084 if (yyn == 0)
2085 goto yyerrlab;
2086 goto yyreduce;
2087
2088
2089/*-----------------------------.
2090| yyreduce -- Do a reduction. |
2091`-----------------------------*/
2092yyreduce:
2093 /* yyn is the number of a rule to reduce with. */
2094 yylen = yyr2[yyn];
2095
2096 /* If YYLEN is nonzero, implement the default value of the action:
2097 `$$ = $1'.
2098
2099 Otherwise, the following line sets YYVAL to garbage.
2100 This behavior is undocumented and Bison
2101 users should not rely upon it. Assigning to YYVAL
2102 unconditionally makes the parser a bit smaller, and it avoids a
2103 GCC warning that YYVAL may be used uninitialized. */
2104 yyval = yyvsp[1-yylen];
2105
2106
2107 YY_REDUCE_PRINT (yyn);
2108 switch (yyn)
2109 {
2110 case 2:
2111
2112 {
2113 // The symbol table search was done in the lexical phase
2114 const TSymbol* symbol = (yyvsp[(1) - (1)].lex).symbol;
2115 const TVariable* variable;
2116 if (symbol == 0) {
2117 context->error((yyvsp[(1) - (1)].lex).line, "undeclared identifier", (yyvsp[(1) - (1)].lex).string->c_str(), "");
2118 context->recover();
2119 TType type(EbtFloat, EbpUndefined);
2120 TVariable* fakeVariable = new TVariable((yyvsp[(1) - (1)].lex).string, type);
2121 context->symbolTable.insert(*fakeVariable);
2122 variable = fakeVariable;
2123 } else {
2124 // This identifier can only be a variable type symbol
2125 if (! symbol->isVariable()) {
2126 context->error((yyvsp[(1) - (1)].lex).line, "variable expected", (yyvsp[(1) - (1)].lex).string->c_str(), "");
2127 context->recover();
2128 }
2129 variable = static_cast<const TVariable*>(symbol);
2130 }
2131
2132 // don't delete $1.string, it's used by error recovery, and the pool
2133 // pop will reclaim the memory
2134
2135 if (variable->getType().getQualifier() == EvqConst ) {
2136 ConstantUnion* constArray = variable->getConstPointer();
2137 TType t(variable->getType());
2138 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(constArray, t, (yyvsp[(1) - (1)].lex).line);
2139 } else
2140 (yyval.interm.intermTypedNode) = context->intermediate.addSymbol(variable->getUniqueId(),
2141 variable->getName(),
2142 variable->getType(), (yyvsp[(1) - (1)].lex).line);
2143 ;}
2144 break;
2145
2146 case 3:
2147
2148 {
2149 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
2150 ;}
2151 break;
2152
2153 case 4:
2154
2155 {
2156 //
2157 // INT_TYPE is only 16-bit plus sign bit for vertex/fragment shaders,
2158 // check for overflow for constants
2159 //
2160 if (abs((yyvsp[(1) - (1)].lex).i) >= (1 << 16)) {
2161 context->error((yyvsp[(1) - (1)].lex).line, " integer constant overflow", "", "");
2162 context->recover();
2163 }
2164 ConstantUnion *unionArray = new ConstantUnion[1];
2165 unionArray->setIConst((yyvsp[(1) - (1)].lex).i);
2166 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
2167 ;}
2168 break;
2169
2170 case 5:
2171
2172 {
2173 ConstantUnion *unionArray = new ConstantUnion[1];
2174 unionArray->setFConst((yyvsp[(1) - (1)].lex).f);
2175 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
2176 ;}
2177 break;
2178
2179 case 6:
2180
2181 {
2182 ConstantUnion *unionArray = new ConstantUnion[1];
2183 unionArray->setBConst((yyvsp[(1) - (1)].lex).b);
2184 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].lex).line);
2185 ;}
2186 break;
2187
2188 case 7:
2189
2190 {
2191 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (3)].interm.intermTypedNode);
2192 ;}
2193 break;
2194
2195 case 8:
2196
2197 {
2198 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
2199 ;}
2200 break;
2201
2202 case 9:
2203
2204 {
2205 if (!(yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix() && !(yyvsp[(1) - (4)].interm.intermTypedNode)->isVector()) {
2206 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode())
2207 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(), "");
2208 else
2209 context->error((yyvsp[(2) - (4)].lex).line, " left of '[' is not of type array, matrix, or vector ", "expression", "");
2210 context->recover();
2211 }
2212 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst && (yyvsp[(3) - (4)].interm.intermTypedNode)->getQualifier() == EvqConst) {
2213 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) { // constant folding for arrays
2214 (yyval.interm.intermTypedNode) = context->addConstArrayNode((yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2215 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector()) { // constant folding for vectors
2216 TVectorFields fields;
2217 fields.num = 1;
2218 fields.offsets[0] = (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(); // need to do it this way because v.xy sends fields integer array
2219 (yyval.interm.intermTypedNode) = context->addConstVectorNode(fields, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2220 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix()) { // constant folding for matrices
2221 (yyval.interm.intermTypedNode) = context->addConstMatrixNode((yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2222 }
2223 } else {
2224 if ((yyvsp[(3) - (4)].interm.intermTypedNode)->getQualifier() == EvqConst) {
2225 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() ) {
2226 context->error((yyvsp[(2) - (4)].lex).line, "", "[", "field selection out of range '%d'", (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst());
2227 context->recover();
2228 } else {
2229 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) {
2230 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize() == 0) {
2231 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getMaxArraySize() <= (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst()) {
2232 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))
2233 context->recover();
2234 } else {
2235 if (context->arraySetMaxSize((yyvsp[(1) - (4)].interm.intermTypedNode)->getAsSymbolNode(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getTypePointer(), 0, false, (yyvsp[(2) - (4)].lex).line))
2236 context->recover();
2237 }
2238 } else if ( (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst() >= (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize()) {
2239 context->error((yyvsp[(2) - (4)].lex).line, "", "[", "array index out of range '%d'", (yyvsp[(3) - (4)].interm.intermTypedNode)->getAsConstantUnion()->getUnionArrayPointer()->getIConst());
2240 context->recover();
2241 }
2242 }
2243 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(3) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2244 }
2245 } else {
2246 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getArraySize() == 0) {
2247 context->error((yyvsp[(2) - (4)].lex).line, "", "[", "array must be redeclared with a size before being indexed with a variable");
2248 context->recover();
2249 }
2250
2251 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexIndirect, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(3) - (4)].interm.intermTypedNode), (yyvsp[(2) - (4)].lex).line);
2252 }
2253 }
2254 if ((yyval.interm.intermTypedNode) == 0) {
2255 ConstantUnion *unionArray = new ConstantUnion[1];
2256 unionArray->setFConst(0.0f);
2257 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpHigh, EvqConst), (yyvsp[(2) - (4)].lex).line);
2258 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) {
2259 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getStruct())
2260 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getStruct(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getTypeName()));
2261 else
2262 (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()));
2263
2264 if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst)
2265 (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConst);
2266 } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst)
2267 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqConst, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize()));
2268 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix())
2269 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize()));
2270 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector() && (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getQualifier() == EvqConst)
2271 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqConst));
2272 else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isVector())
2273 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary));
2274 else
2275 (yyval.interm.intermTypedNode)->setType((yyvsp[(1) - (4)].interm.intermTypedNode)->getType());
2276 ;}
2277 break;
2278
2279 case 10:
2280
2281 {
2282 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
2283 ;}
2284 break;
2285
2286 case 11:
2287
2288 {
2289 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isArray()) {
2290 context->error((yyvsp[(3) - (3)].lex).line, "cannot apply dot operator to an array", ".", "");
2291 context->recover();
2292 }
2293
2294 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isVector()) {
2295 TVectorFields fields;
2296 if (! context->parseVectorFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yyvsp[(3) - (3)].lex).line)) {
2297 fields.num = 1;
2298 fields.offsets[0] = 0;
2299 context->recover();
2300 }
2301
2302 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) { // constant folding for vector fields
2303 (yyval.interm.intermTypedNode) = context->addConstVectorNode(fields, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].lex).line);
2304 if ((yyval.interm.intermTypedNode) == 0) {
2305 context->recover();
2306 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2307 }
2308 else
2309 (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()));
2310 } else {
2311 if (fields.num == 1) {
2312 ConstantUnion *unionArray = new ConstantUnion[1];
2313 unionArray->setIConst(fields.offsets[0]);
2314 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line);
2315 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2316 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision()));
2317 } else {
2318 TString vectorString = *(yyvsp[(3) - (3)].lex).string;
2319 TIntermTyped* index = context->intermediate.addSwizzle(fields, (yyvsp[(3) - (3)].lex).line);
2320 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpVectorSwizzle, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2321 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (int) vectorString.size()));
2322 }
2323 }
2324 } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isMatrix()) {
2325 TMatrixFields fields;
2326 if (! context->parseMatrixFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yyvsp[(3) - (3)].lex).line)) {
2327 fields.wholeRow = false;
2328 fields.wholeCol = false;
2329 fields.row = 0;
2330 fields.col = 0;
2331 context->recover();
2332 }
2333
2334 if (fields.wholeRow || fields.wholeCol) {
2335 context->error((yyvsp[(2) - (3)].lex).line, " non-scalar fields not implemented yet", ".", "");
2336 context->recover();
2337 ConstantUnion *unionArray = new ConstantUnion[1];
2338 unionArray->setIConst(0);
2339 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line);
2340 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2341 (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(),EvqTemporary, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize()));
2342 } else {
2343 ConstantUnion *unionArray = new ConstantUnion[1];
2344 unionArray->setIConst(fields.col * (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize() + fields.row);
2345 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yyvsp[(3) - (3)].lex).line);
2346 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (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()));
2348 }
2349 } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType() == EbtStruct) {
2350 bool fieldFound = false;
2351 const TTypeList* fields = (yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getStruct();
2352 if (fields == 0) {
2353 context->error((yyvsp[(2) - (3)].lex).line, "structure has no fields", "Internal Error", "");
2354 context->recover();
2355 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2356 } else {
2357 unsigned int i;
2358 for (i = 0; i < fields->size(); ++i) {
2359 if ((*fields)[i].type->getFieldName() == *(yyvsp[(3) - (3)].lex).string) {
2360 fieldFound = true;
2361 break;
2362 }
2363 }
2364 if (fieldFound) {
2365 if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) {
2366 (yyval.interm.intermTypedNode) = context->addConstStruct(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
2367 if ((yyval.interm.intermTypedNode) == 0) {
2368 context->recover();
2369 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2370 }
2371 else {
2372 (yyval.interm.intermTypedNode)->setType(*(*fields)[i].type);
2373 // change the qualifier of the return type, not of the structure field
2374 // as the structure definition is shared between various structures.
2375 (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConst);
2376 }
2377 } else {
2378 ConstantUnion *unionArray = new ConstantUnion[1];
2379 unionArray->setIConst(i);
2380 TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, *(*fields)[i].type, (yyvsp[(3) - (3)].lex).line);
2381 (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirectStruct, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
2382 (yyval.interm.intermTypedNode)->setType(*(*fields)[i].type);
2383 }
2384 } else {
2385 context->error((yyvsp[(2) - (3)].lex).line, " no such field in structure", (yyvsp[(3) - (3)].lex).string->c_str(), "");
2386 context->recover();
2387 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2388 }
2389 }
2390 } else {
2391 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(), "");
2392 context->recover();
2393 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2394 }
2395 // don't delete $3.string, it's from the pool
2396 ;}
2397 break;
2398
2399 case 12:
2400
2401 {
2402 if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode)))
2403 context->recover();
2404 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostIncrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line, context->symbolTable);
2405 if ((yyval.interm.intermTypedNode) == 0) {
2406 context->unaryOpError((yyvsp[(2) - (2)].lex).line, "++", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
2407 context->recover();
2408 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode);
2409 }
2410 ;}
2411 break;
2412
2413 case 13:
2414
2415 {
2416 if (context->lValueErrorCheck((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode)))
2417 context->recover();
2418 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostDecrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yyvsp[(2) - (2)].lex).line, context->symbolTable);
2419 if ((yyval.interm.intermTypedNode) == 0) {
2420 context->unaryOpError((yyvsp[(2) - (2)].lex).line, "--", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
2421 context->recover();
2422 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode);
2423 }
2424 ;}
2425 break;
2426
2427 case 14:
2428
2429 {
2430 if (context->integerErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode), "[]"))
2431 context->recover();
2432 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
2433 ;}
2434 break;
2435
2436 case 15:
2437
2438 {
2439 TFunction* fnCall = (yyvsp[(1) - (1)].interm).function;
2440 TOperator op = fnCall->getBuiltInOp();
2441
2442 if (op != EOpNull)
2443 {
2444 //
2445 // Then this should be a constructor.
2446 // Don't go through the symbol table for constructors.
2447 // Their parameters will be verified algorithmically.
2448 //
2449 TType type(EbtVoid, EbpUndefined); // use this to get the type back
2450 if (context->constructorErrorCheck((yyvsp[(1) - (1)].interm).line, (yyvsp[(1) - (1)].interm).intermNode, *fnCall, op, &type)) {
2451 (yyval.interm.intermTypedNode) = 0;
2452 } else {
2453 //
2454 // It's a constructor, of type 'type'.
2455 //
2456 (yyval.interm.intermTypedNode) = context->addConstructor((yyvsp[(1) - (1)].interm).intermNode, &type, op, fnCall, (yyvsp[(1) - (1)].interm).line);
2457 }
2458
2459 if ((yyval.interm.intermTypedNode) == 0) {
2460 context->recover();
2461 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator(0, op, (yyvsp[(1) - (1)].interm).line);
2462 }
2463 (yyval.interm.intermTypedNode)->setType(type);
2464 } else {
2465 //
2466 // Not a constructor. Find it in the symbol table.
2467 //
2468 const TFunction* fnCandidate;
2469 bool builtIn;
2470 fnCandidate = context->findFunction((yyvsp[(1) - (1)].interm).line, fnCall, &builtIn);
2471 if (fnCandidate) {
2472 //
2473 // A declared function.
2474 //
2475 if (builtIn && !fnCandidate->getExtension().empty() &&
2476 context->extensionErrorCheck((yyvsp[(1) - (1)].interm).line, fnCandidate->getExtension())) {
2477 context->recover();
2478 }
2479 op = fnCandidate->getBuiltInOp();
2480 if (builtIn && op != EOpNull) {
2481 //
2482 // A function call mapped to a built-in operation.
2483 //
2484 if (fnCandidate->getParamCount() == 1) {
2485 //
2486 // Treat it like a built-in unary operator.
2487 //
2488 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(op, (yyvsp[(1) - (1)].interm).intermNode, 0, context->symbolTable);
2489 if ((yyval.interm.intermTypedNode) == 0) {
2490 context->error((yyvsp[(1) - (1)].interm).intermNode->getLine(), " wrong operand type", "Internal Error",
2491 "built in unary operator function. Type: %s",
2492 static_cast<TIntermTyped*>((yyvsp[(1) - (1)].interm).intermNode)->getCompleteString().c_str());
2493 YYERROR;
2494 }
2495 } else {
2496 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, op, (yyvsp[(1) - (1)].interm).line);
2497 }
2498 } else {
2499 // This is a real function call
2500
2501 (yyval.interm.intermTypedNode) = context->intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, EOpFunctionCall, (yyvsp[(1) - (1)].interm).line);
2502 (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType());
2503
2504 // this is how we know whether the given function is a builtIn function or a user defined function
2505 // if builtIn == false, it's a userDefined -> could be an overloaded builtIn function also
2506 // if builtIn == true, it's definitely a builtIn function with EOpNull
2507 if (!builtIn)
2508 (yyval.interm.intermTypedNode)->getAsAggregate()->setUserDefined();
2509 (yyval.interm.intermTypedNode)->getAsAggregate()->setName(fnCandidate->getMangledName());
2510
2511 TQualifier qual;
2512 for (int i = 0; i < fnCandidate->getParamCount(); ++i) {
2513 qual = fnCandidate->getParam(i).type->getQualifier();
2514 if (qual == EvqOut || qual == EvqInOut) {
2515 if (context->lValueErrorCheck((yyval.interm.intermTypedNode)->getLine(), "assign", (yyval.interm.intermTypedNode)->getAsAggregate()->getSequence()[i]->getAsTyped())) {
2516 context->error((yyvsp[(1) - (1)].interm).intermNode->getLine(), "Constant value cannot be passed for 'out' or 'inout' parameters.", "Error", "");
2517 context->recover();
2518 }
2519 }
2520 }
2521 }
2522 (yyval.interm.intermTypedNode)->setType(fnCandidate->getReturnType());
2523 } else {
2524 // error message was put out by PaFindFunction()
2525 // Put on a dummy node for error recovery
2526 ConstantUnion *unionArray = new ConstantUnion[1];
2527 unionArray->setFConst(0.0f);
2528 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yyvsp[(1) - (1)].interm).line);
2529 context->recover();
2530 }
2531 }
2532 delete fnCall;
2533 ;}
2534 break;
2535
2536 case 16:
2537
2538 {
2539 (yyval.interm) = (yyvsp[(1) - (1)].interm);
2540 ;}
2541 break;
2542
2543 case 17:
2544
2545 {
2546 context->error((yyvsp[(3) - (3)].interm).line, "methods are not supported", "", "");
2547 context->recover();
2548 (yyval.interm) = (yyvsp[(3) - (3)].interm);
2549 ;}
2550 break;
2551
2552 case 18:
2553
2554 {
2555 (yyval.interm) = (yyvsp[(1) - (2)].interm);
2556 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
2557 ;}
2558 break;
2559
2560 case 19:
2561
2562 {
2563 (yyval.interm) = (yyvsp[(1) - (2)].interm);
2564 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
2565 ;}
2566 break;
2567
2568 case 20:
2569
2570 {
2571 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
2572 (yyval.interm).intermNode = 0;
2573 ;}
2574 break;
2575
2576 case 21:
2577
2578 {
2579 (yyval.interm).function = (yyvsp[(1) - (1)].interm.function);
2580 (yyval.interm).intermNode = 0;
2581 ;}
2582 break;
2583
2584 case 22:
2585
2586 {
2587 TParameter param = { 0, new TType((yyvsp[(2) - (2)].interm.intermTypedNode)->getType()) };
2588 (yyvsp[(1) - (2)].interm.function)->addParameter(param);
2589 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
2590 (yyval.interm).intermNode = (yyvsp[(2) - (2)].interm.intermTypedNode);
2591 ;}
2592 break;
2593
2594 case 23:
2595
2596 {
2597 TParameter param = { 0, new TType((yyvsp[(3) - (3)].interm.intermTypedNode)->getType()) };
2598 (yyvsp[(1) - (3)].interm).function->addParameter(param);
2599 (yyval.interm).function = (yyvsp[(1) - (3)].interm).function;
2600 (yyval.interm).intermNode = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermNode, (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
2601 ;}
2602 break;
2603
2604 case 24:
2605
2606 {
2607 (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
2608 ;}
2609 break;
2610
2611 case 25:
2612
2613 {
2614 //
2615 // Constructor
2616 //
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00002617 TOperator op = EOpNull;
2618 if ((yyvsp[(1) - (1)].interm.type).userDef) {
2619 op = EOpConstructStruct;
2620 } else {
2621 switch ((yyvsp[(1) - (1)].interm.type).type) {
2622 case EbtFloat:
2623 if ((yyvsp[(1) - (1)].interm.type).matrix) {
2624 switch((yyvsp[(1) - (1)].interm.type).size) {
2625 case 2: op = EOpConstructMat2; break;
2626 case 3: op = EOpConstructMat3; break;
2627 case 4: op = EOpConstructMat4; break;
2628 }
2629 } else {
2630 switch((yyvsp[(1) - (1)].interm.type).size) {
2631 case 1: op = EOpConstructFloat; break;
2632 case 2: op = EOpConstructVec2; break;
2633 case 3: op = EOpConstructVec3; break;
2634 case 4: op = EOpConstructVec4; break;
2635 }
2636 }
2637 break;
2638 case EbtInt:
2639 switch((yyvsp[(1) - (1)].interm.type).size) {
2640 case 1: op = EOpConstructInt; break;
2641 case 2: FRAG_VERT_ONLY("ivec2", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec2; break;
2642 case 3: FRAG_VERT_ONLY("ivec3", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec3; break;
2643 case 4: FRAG_VERT_ONLY("ivec4", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructIVec4; break;
2644 }
2645 break;
2646 case EbtBool:
2647 switch((yyvsp[(1) - (1)].interm.type).size) {
2648 case 1: op = EOpConstructBool; break;
2649 case 2: FRAG_VERT_ONLY("bvec2", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec2; break;
2650 case 3: FRAG_VERT_ONLY("bvec3", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec3; break;
2651 case 4: FRAG_VERT_ONLY("bvec4", (yyvsp[(1) - (1)].interm.type).line); op = EOpConstructBVec4; break;
2652 }
2653 break;
2654 default: break;
2655 }
2656 if (op == EOpNull) {
2657 context->error((yyvsp[(1) - (1)].interm.type).line, "cannot construct this type", getBasicString((yyvsp[(1) - (1)].interm.type).type), "");
2658 context->recover();
2659 (yyvsp[(1) - (1)].interm.type).type = EbtFloat;
2660 op = EOpConstructFloat;
2661 }
2662 }
2663 TString tempString;
2664 TType type((yyvsp[(1) - (1)].interm.type));
2665 TFunction *function = new TFunction(&tempString, type, op);
2666 (yyval.interm.function) = function;
2667 ;}
2668 break;
2669
2670 case 26:
2671
2672 {
2673 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
2674 context->recover();
2675 TType type(EbtVoid, EbpUndefined);
2676 TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type);
2677 (yyval.interm.function) = function;
2678 ;}
2679 break;
2680
2681 case 27:
2682
2683 {
2684 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
2685 context->recover();
2686 TType type(EbtVoid, EbpUndefined);
2687 TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type);
2688 (yyval.interm.function) = function;
2689 ;}
2690 break;
2691
2692 case 28:
2693
2694 {
2695 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
2696 ;}
2697 break;
2698
2699 case 29:
2700
2701 {
2702 if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)))
2703 context->recover();
2704 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreIncrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line, context->symbolTable);
2705 if ((yyval.interm.intermTypedNode) == 0) {
2706 context->unaryOpError((yyvsp[(1) - (2)].lex).line, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2707 context->recover();
2708 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2709 }
2710 ;}
2711 break;
2712
2713 case 30:
2714
2715 {
2716 if (context->lValueErrorCheck((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)))
2717 context->recover();
2718 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreDecrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].lex).line, context->symbolTable);
2719 if ((yyval.interm.intermTypedNode) == 0) {
2720 context->unaryOpError((yyvsp[(1) - (2)].lex).line, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2721 context->recover();
2722 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2723 }
2724 ;}
2725 break;
2726
2727 case 31:
2728
2729 {
2730 if ((yyvsp[(1) - (2)].interm).op != EOpNull) {
2731 (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath((yyvsp[(1) - (2)].interm).op, (yyvsp[(2) - (2)].interm.intermTypedNode), (yyvsp[(1) - (2)].interm).line, context->symbolTable);
2732 if ((yyval.interm.intermTypedNode) == 0) {
2733 const char* errorOp = "";
2734 switch((yyvsp[(1) - (2)].interm).op) {
2735 case EOpNegative: errorOp = "-"; break;
2736 case EOpLogicalNot: errorOp = "!"; break;
2737 default: break;
2738 }
2739 context->unaryOpError((yyvsp[(1) - (2)].interm).line, errorOp, (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
2740 context->recover();
2741 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2742 }
2743 } else
2744 (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
2745 ;}
2746 break;
2747
2748 case 32:
2749
2750 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNull; ;}
2751 break;
2752
2753 case 33:
2754
2755 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpNegative; ;}
2756 break;
2757
2758 case 34:
2759
2760 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpLogicalNot; ;}
2761 break;
2762
2763 case 35:
2764
2765 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
2766 break;
2767
2768 case 36:
2769
2770 {
2771 FRAG_VERT_ONLY("*", (yyvsp[(2) - (3)].lex).line);
2772 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpMul, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2773 if ((yyval.interm.intermTypedNode) == 0) {
2774 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "*", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2775 context->recover();
2776 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2777 }
2778 ;}
2779 break;
2780
2781 case 37:
2782
2783 {
2784 FRAG_VERT_ONLY("/", (yyvsp[(2) - (3)].lex).line);
2785 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpDiv, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2786 if ((yyval.interm.intermTypedNode) == 0) {
2787 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "/", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2788 context->recover();
2789 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2790 }
2791 ;}
2792 break;
2793
2794 case 38:
2795
2796 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
2797 break;
2798
2799 case 39:
2800
2801 {
2802 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpAdd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2803 if ((yyval.interm.intermTypedNode) == 0) {
2804 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "+", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2805 context->recover();
2806 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2807 }
2808 ;}
2809 break;
2810
2811 case 40:
2812
2813 {
2814 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpSub, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2815 if ((yyval.interm.intermTypedNode) == 0) {
2816 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "-", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2817 context->recover();
2818 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
2819 }
2820 ;}
2821 break;
2822
2823 case 41:
2824
2825 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
2826 break;
2827
2828 case 42:
2829
2830 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
2831 break;
2832
2833 case 43:
2834
2835 {
2836 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2837 if ((yyval.interm.intermTypedNode) == 0) {
2838 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2839 context->recover();
2840 ConstantUnion *unionArray = new ConstantUnion[1];
2841 unionArray->setBConst(false);
2842 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2843 }
2844 ;}
2845 break;
2846
2847 case 44:
2848
2849 {
2850 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2851 if ((yyval.interm.intermTypedNode) == 0) {
2852 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2853 context->recover();
2854 ConstantUnion *unionArray = new ConstantUnion[1];
2855 unionArray->setBConst(false);
2856 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2857 }
2858 ;}
2859 break;
2860
2861 case 45:
2862
2863 {
2864 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2865 if ((yyval.interm.intermTypedNode) == 0) {
2866 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "<=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2867 context->recover();
2868 ConstantUnion *unionArray = new ConstantUnion[1];
2869 unionArray->setBConst(false);
2870 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2871 }
2872 ;}
2873 break;
2874
2875 case 46:
2876
2877 {
2878 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2879 if ((yyval.interm.intermTypedNode) == 0) {
2880 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ">=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2881 context->recover();
2882 ConstantUnion *unionArray = new ConstantUnion[1];
2883 unionArray->setBConst(false);
2884 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2885 }
2886 ;}
2887 break;
2888
2889 case 47:
2890
2891 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
2892 break;
2893
2894 case 48:
2895
2896 {
2897 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2898 if ((yyval.interm.intermTypedNode) == 0) {
2899 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "==", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2900 context->recover();
2901 ConstantUnion *unionArray = new ConstantUnion[1];
2902 unionArray->setBConst(false);
2903 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2904 }
2905 ;}
2906 break;
2907
2908 case 49:
2909
2910 {
2911 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpNotEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2912 if ((yyval.interm.intermTypedNode) == 0) {
2913 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "!=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2914 context->recover();
2915 ConstantUnion *unionArray = new ConstantUnion[1];
2916 unionArray->setBConst(false);
2917 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2918 }
2919 ;}
2920 break;
2921
2922 case 50:
2923
2924 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
2925 break;
2926
2927 case 51:
2928
2929 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
2930 break;
2931
2932 case 52:
2933
2934 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
2935 break;
2936
2937 case 53:
2938
2939 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
2940 break;
2941
2942 case 54:
2943
2944 {
2945 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalAnd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2946 if ((yyval.interm.intermTypedNode) == 0) {
2947 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "&&", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2948 context->recover();
2949 ConstantUnion *unionArray = new ConstantUnion[1];
2950 unionArray->setBConst(false);
2951 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2952 }
2953 ;}
2954 break;
2955
2956 case 55:
2957
2958 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
2959 break;
2960
2961 case 56:
2962
2963 {
2964 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalXor, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2965 if ((yyval.interm.intermTypedNode) == 0) {
2966 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "^^", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2967 context->recover();
2968 ConstantUnion *unionArray = new ConstantUnion[1];
2969 unionArray->setBConst(false);
2970 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2971 }
2972 ;}
2973 break;
2974
2975 case 57:
2976
2977 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
2978 break;
2979
2980 case 58:
2981
2982 {
2983 (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalOr, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line, context->symbolTable);
2984 if ((yyval.interm.intermTypedNode) == 0) {
2985 context->binaryOpError((yyvsp[(2) - (3)].lex).line, "||", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
2986 context->recover();
2987 ConstantUnion *unionArray = new ConstantUnion[1];
2988 unionArray->setBConst(false);
2989 (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yyvsp[(2) - (3)].lex).line);
2990 }
2991 ;}
2992 break;
2993
2994 case 59:
2995
2996 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
2997 break;
2998
2999 case 60:
3000
3001 {
3002 if (context->boolErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.intermTypedNode)))
3003 context->recover();
3004
3005 (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);
3006 if ((yyvsp[(3) - (5)].interm.intermTypedNode)->getType() != (yyvsp[(5) - (5)].interm.intermTypedNode)->getType())
3007 (yyval.interm.intermTypedNode) = 0;
3008
3009 if ((yyval.interm.intermTypedNode) == 0) {
3010 context->binaryOpError((yyvsp[(2) - (5)].lex).line, ":", (yyvsp[(3) - (5)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(5) - (5)].interm.intermTypedNode)->getCompleteString());
3011 context->recover();
3012 (yyval.interm.intermTypedNode) = (yyvsp[(5) - (5)].interm.intermTypedNode);
3013 }
3014 ;}
3015 break;
3016
3017 case 61:
3018
3019 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
3020 break;
3021
3022 case 62:
3023
3024 {
3025 if (context->lValueErrorCheck((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)))
3026 context->recover();
3027 (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);
3028 if ((yyval.interm.intermTypedNode) == 0) {
3029 context->assignError((yyvsp[(2) - (3)].interm).line, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3030 context->recover();
3031 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
3032 }
3033 ;}
3034 break;
3035
3036 case 63:
3037
3038 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAssign; ;}
3039 break;
3040
3041 case 64:
3042
3043 { FRAG_VERT_ONLY("*=", (yyvsp[(1) - (1)].lex).line); (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpMulAssign; ;}
3044 break;
3045
3046 case 65:
3047
3048 { FRAG_VERT_ONLY("/=", (yyvsp[(1) - (1)].lex).line); (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpDivAssign; ;}
3049 break;
3050
3051 case 66:
3052
3053 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpAddAssign; ;}
3054 break;
3055
3056 case 67:
3057
3058 { (yyval.interm).line = (yyvsp[(1) - (1)].lex).line; (yyval.interm).op = EOpSubAssign; ;}
3059 break;
3060
3061 case 68:
3062
3063 {
3064 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
3065 ;}
3066 break;
3067
3068 case 69:
3069
3070 {
3071 (yyval.interm.intermTypedNode) = context->intermediate.addComma((yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).line);
3072 if ((yyval.interm.intermTypedNode) == 0) {
3073 context->binaryOpError((yyvsp[(2) - (3)].lex).line, ",", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
3074 context->recover();
3075 (yyval.interm.intermTypedNode) = (yyvsp[(3) - (3)].interm.intermTypedNode);
3076 }
3077 ;}
3078 break;
3079
3080 case 70:
3081
3082 {
3083 if (context->constErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)))
3084 context->recover();
3085 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
3086 ;}
3087 break;
3088
3089 case 71:
3090
3091 {
3092 TFunction &function = *((yyvsp[(1) - (2)].interm).function);
3093
3094 TIntermAggregate *prototype = new TIntermAggregate;
3095 prototype->setType(function.getReturnType());
3096 prototype->setName(function.getName());
3097
3098 for (int i = 0; i < function.getParamCount(); i++)
3099 {
3100 const TParameter &param = function.getParam(i);
3101 if (param.name != 0)
3102 {
3103 TVariable *variable = new TVariable(param.name, *param.type);
3104
3105 prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(variable->getUniqueId(), variable->getName(), variable->getType(), (yyvsp[(1) - (2)].interm).line), (yyvsp[(1) - (2)].interm).line);
3106 }
3107 else
3108 {
3109 prototype = context->intermediate.growAggregate(prototype, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (2)].interm).line), (yyvsp[(1) - (2)].interm).line);
3110 }
3111 }
3112
3113 prototype->setOp(EOpPrototype);
3114 (yyval.interm.intermNode) = prototype;
3115 ;}
3116 break;
3117
3118 case 72:
3119
3120 {
3121 if ((yyvsp[(1) - (2)].interm).intermAggregate)
3122 (yyvsp[(1) - (2)].interm).intermAggregate->setOp(EOpDeclaration);
3123 (yyval.interm.intermNode) = (yyvsp[(1) - (2)].interm).intermAggregate;
3124 ;}
3125 break;
3126
3127 case 73:
3128
3129 {
3130 context->symbolTable.setDefaultPrecision( (yyvsp[(3) - (4)].interm.type).type, (yyvsp[(2) - (4)].interm.precision) );
3131 (yyval.interm.intermNode) = 0;
3132 ;}
3133 break;
3134
3135 case 74:
3136
3137 {
3138 //
3139 // Multiple declarations of the same function are allowed.
3140 //
3141 // If this is a definition, the definition production code will check for redefinitions
3142 // (we don't know at this point if it's a definition or not).
3143 //
3144 // Redeclarations are allowed. But, return types and parameter qualifiers must match.
3145 //
3146 TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find((yyvsp[(1) - (2)].interm.function)->getMangledName()));
3147 if (prevDec) {
3148 if (prevDec->getReturnType() != (yyvsp[(1) - (2)].interm.function)->getReturnType()) {
3149 context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same return type", (yyvsp[(1) - (2)].interm.function)->getReturnType().getBasicString(), "");
3150 context->recover();
3151 }
3152 for (int i = 0; i < prevDec->getParamCount(); ++i) {
3153 if (prevDec->getParam(i).type->getQualifier() != (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifier()) {
3154 context->error((yyvsp[(2) - (2)].lex).line, "overloaded functions must have the same parameter qualifiers", (yyvsp[(1) - (2)].interm.function)->getParam(i).type->getQualifierString(), "");
3155 context->recover();
3156 }
3157 }
3158 }
3159
3160 //
3161 // If this is a redeclaration, it could also be a definition,
3162 // in which case, we want to use the variable names from this one, and not the one that's
3163 // being redeclared. So, pass back up this declaration, not the one in the symbol table.
3164 //
3165 (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
3166 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
3167
3168 context->symbolTable.insert(*(yyval.interm).function);
3169 ;}
3170 break;
3171
3172 case 75:
3173
3174 {
3175 (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
3176 ;}
3177 break;
3178
3179 case 76:
3180
3181 {
3182 (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
3183 ;}
3184 break;
3185
3186 case 77:
3187
3188 {
3189 // Add the parameter
3190 (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
3191 if ((yyvsp[(2) - (2)].interm).param.type->getBasicType() != EbtVoid)
3192 (yyvsp[(1) - (2)].interm.function)->addParameter((yyvsp[(2) - (2)].interm).param);
3193 else
3194 delete (yyvsp[(2) - (2)].interm).param.type;
3195 ;}
3196 break;
3197
3198 case 78:
3199
3200 {
3201 //
3202 // Only first parameter of one-parameter functions can be void
3203 // The check for named parameters not being void is done in parameter_declarator
3204 //
3205 if ((yyvsp[(3) - (3)].interm).param.type->getBasicType() == EbtVoid) {
3206 //
3207 // This parameter > first is void
3208 //
3209 context->error((yyvsp[(2) - (3)].lex).line, "cannot be an argument type except for '(void)'", "void", "");
3210 context->recover();
3211 delete (yyvsp[(3) - (3)].interm).param.type;
3212 } else {
3213 // Add the parameter
3214 (yyval.interm.function) = (yyvsp[(1) - (3)].interm.function);
3215 (yyvsp[(1) - (3)].interm.function)->addParameter((yyvsp[(3) - (3)].interm).param);
3216 }
3217 ;}
3218 break;
3219
3220 case 79:
3221
3222 {
3223 if ((yyvsp[(1) - (3)].interm.type).qualifier != EvqGlobal && (yyvsp[(1) - (3)].interm.type).qualifier != EvqTemporary) {
3224 context->error((yyvsp[(2) - (3)].lex).line, "no qualifiers allowed for function return", getQualifierString((yyvsp[(1) - (3)].interm.type).qualifier), "");
3225 context->recover();
3226 }
3227 // make sure a sampler is not involved as well...
3228 if (context->structQualifierErrorCheck((yyvsp[(2) - (3)].lex).line, (yyvsp[(1) - (3)].interm.type)))
3229 context->recover();
3230
3231 // Add the function as a prototype after parsing it (we do not support recursion)
3232 TFunction *function;
3233 TType type((yyvsp[(1) - (3)].interm.type));
3234 function = new TFunction((yyvsp[(2) - (3)].lex).string, type);
3235 (yyval.interm.function) = function;
3236 ;}
3237 break;
3238
3239 case 80:
3240
3241 {
3242 if ((yyvsp[(1) - (2)].interm.type).type == EbtVoid) {
3243 context->error((yyvsp[(2) - (2)].lex).line, "illegal use of type 'void'", (yyvsp[(2) - (2)].lex).string->c_str(), "");
3244 context->recover();
3245 }
3246 if (context->reservedErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string))
3247 context->recover();
3248 TParameter param = {(yyvsp[(2) - (2)].lex).string, new TType((yyvsp[(1) - (2)].interm.type))};
3249 (yyval.interm).line = (yyvsp[(2) - (2)].lex).line;
3250 (yyval.interm).param = param;
3251 ;}
3252 break;
3253
3254 case 81:
3255
3256 {
3257 // Check that we can make an array out of this type
3258 if (context->arrayTypeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
3259 context->recover();
3260
3261 if (context->reservedErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string))
3262 context->recover();
3263
3264 int size;
3265 if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3266 context->recover();
3267 (yyvsp[(1) - (5)].interm.type).setArray(true, size);
3268
3269 TType* type = new TType((yyvsp[(1) - (5)].interm.type));
3270 TParameter param = { (yyvsp[(2) - (5)].lex).string, type };
3271 (yyval.interm).line = (yyvsp[(2) - (5)].lex).line;
3272 (yyval.interm).param = param;
3273 ;}
3274 break;
3275
3276 case 82:
3277
3278 {
3279 (yyval.interm) = (yyvsp[(3) - (3)].interm);
3280 if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
3281 context->recover();
3282 ;}
3283 break;
3284
3285 case 83:
3286
3287 {
3288 (yyval.interm) = (yyvsp[(2) - (2)].interm);
3289 if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
3290 context->recover();
3291 if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
3292 context->recover();
3293 ;}
3294 break;
3295
3296 case 84:
3297
3298 {
3299 (yyval.interm) = (yyvsp[(3) - (3)].interm);
3300 if (context->paramErrorCheck((yyvsp[(3) - (3)].interm).line, (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
3301 context->recover();
3302 ;}
3303 break;
3304
3305 case 85:
3306
3307 {
3308 (yyval.interm) = (yyvsp[(2) - (2)].interm);
3309 if (context->parameterSamplerErrorCheck((yyvsp[(2) - (2)].interm).line, (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
3310 context->recover();
3311 if (context->paramErrorCheck((yyvsp[(2) - (2)].interm).line, EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
3312 context->recover();
3313 ;}
3314 break;
3315
3316 case 86:
3317
3318 {
3319 (yyval.interm.qualifier) = EvqIn;
3320 ;}
3321 break;
3322
3323 case 87:
3324
3325 {
3326 (yyval.interm.qualifier) = EvqIn;
3327 ;}
3328 break;
3329
3330 case 88:
3331
3332 {
3333 (yyval.interm.qualifier) = EvqOut;
3334 ;}
3335 break;
3336
3337 case 89:
3338
3339 {
3340 (yyval.interm.qualifier) = EvqInOut;
3341 ;}
3342 break;
3343
3344 case 90:
3345
3346 {
3347 TParameter param = { 0, new TType((yyvsp[(1) - (1)].interm.type)) };
3348 (yyval.interm).param = param;
3349 ;}
3350 break;
3351
3352 case 91:
3353
3354 {
3355 (yyval.interm) = (yyvsp[(1) - (1)].interm);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003356 ;}
3357 break;
3358
3359 case 92:
3360
3361 {
zmo@google.comfd747b82011-04-23 01:30:07 +00003362 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(3) - (3)].lex).string, TType((yyvsp[(1) - (3)].interm).type), (yyvsp[(3) - (3)].lex).line);
3363 (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 +00003364
3365 if (context->structQualifierErrorCheck((yyvsp[(3) - (3)].lex).line, (yyval.interm).type))
3366 context->recover();
3367
3368 if (context->nonInitConstErrorCheck((yyvsp[(3) - (3)].lex).line, *(yyvsp[(3) - (3)].lex).string, (yyval.interm).type))
3369 context->recover();
3370
zmo@google.comfd747b82011-04-23 01:30:07 +00003371 TVariable* variable = 0;
3372 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 +00003373 context->recover();
zmo@google.comfd747b82011-04-23 01:30:07 +00003374 if (symbol && variable)
3375 symbol->setId(variable->getUniqueId());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003376 ;}
3377 break;
3378
3379 case 93:
3380
3381 {
3382 if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
3383 context->recover();
3384
3385 if (context->nonInitConstErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type))
3386 context->recover();
3387
3388 (yyval.interm) = (yyvsp[(1) - (5)].interm);
3389
3390 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))
3391 context->recover();
3392 else {
3393 (yyvsp[(1) - (5)].interm).type.setArray(true);
3394 TVariable* variable;
3395 if (context->arrayErrorCheck((yyvsp[(4) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, variable))
3396 context->recover();
3397 }
3398 ;}
3399 break;
3400
3401 case 94:
3402
3403 {
3404 if (context->structQualifierErrorCheck((yyvsp[(3) - (6)].lex).line, (yyvsp[(1) - (6)].interm).type))
3405 context->recover();
3406
3407 if (context->nonInitConstErrorCheck((yyvsp[(3) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type))
3408 context->recover();
3409
3410 (yyval.interm) = (yyvsp[(1) - (6)].interm);
3411
3412 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))
3413 context->recover();
3414 else {
3415 int size;
3416 if (context->arraySizeErrorCheck((yyvsp[(4) - (6)].lex).line, (yyvsp[(5) - (6)].interm.intermTypedNode), size))
3417 context->recover();
3418 (yyvsp[(1) - (6)].interm).type.setArray(true, size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003419 TVariable* variable = 0;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003420 if (context->arrayErrorCheck((yyvsp[(4) - (6)].lex).line, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type, variable))
3421 context->recover();
3422 TType type = TType((yyvsp[(1) - (6)].interm).type);
3423 type.setArraySize(size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003424 (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 +00003425 }
3426 ;}
3427 break;
3428
3429 case 95:
3430
3431 {
3432 if (context->structQualifierErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(1) - (5)].interm).type))
3433 context->recover();
3434
3435 (yyval.interm) = (yyvsp[(1) - (5)].interm);
3436
3437 TIntermNode* intermNode;
3438 if (!context->executeInitializer((yyvsp[(3) - (5)].lex).line, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, (yyvsp[(5) - (5)].interm.intermTypedNode), intermNode)) {
3439 //
3440 // build the intermediate representation
3441 //
3442 if (intermNode)
3443 (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (5)].interm).intermNode, intermNode, (yyvsp[(4) - (5)].lex).line);
3444 else
3445 (yyval.interm).intermAggregate = (yyvsp[(1) - (5)].interm).intermAggregate;
3446 } else {
3447 context->recover();
3448 (yyval.interm).intermAggregate = 0;
3449 }
3450 ;}
3451 break;
3452
3453 case 96:
3454
3455 {
3456 (yyval.interm).type = (yyvsp[(1) - (1)].interm.type);
3457 (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);
3458 ;}
3459 break;
3460
3461 case 97:
3462
3463 {
zmo@google.comfd747b82011-04-23 01:30:07 +00003464 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyvsp[(1) - (2)].interm.type)), (yyvsp[(2) - (2)].lex).line);
3465 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (2)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003466
3467 if (context->structQualifierErrorCheck((yyvsp[(2) - (2)].lex).line, (yyval.interm).type))
3468 context->recover();
3469
3470 if (context->nonInitConstErrorCheck((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string, (yyval.interm).type))
3471 context->recover();
3472
3473 (yyval.interm).type = (yyvsp[(1) - (2)].interm.type);
3474
zmo@google.comfd747b82011-04-23 01:30:07 +00003475 TVariable* variable = 0;
3476 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 +00003477 context->recover();
zmo@google.comfd747b82011-04-23 01:30:07 +00003478 if (variable && symbol)
3479 symbol->setId(variable->getUniqueId());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003480 ;}
3481 break;
3482
3483 case 98:
3484
3485 {
kbr@chromium.org04277b82011-06-02 18:41:26 +00003486 context->error((yyvsp[(2) - (4)].lex).line, "unsized array declarations not supported", (yyvsp[(2) - (4)].lex).string->c_str(), "");
3487 context->recover();
3488
zmo@google.comfd747b82011-04-23 01:30:07 +00003489 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (4)].lex).string, TType((yyvsp[(1) - (4)].interm.type)), (yyvsp[(2) - (4)].lex).line);
3490 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (4)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003491 (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003492 ;}
3493 break;
3494
3495 case 99:
3496
3497 {
3498 TType type = TType((yyvsp[(1) - (5)].interm.type));
3499 int size;
3500 if (context->arraySizeErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3501 context->recover();
3502 type.setArraySize(size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003503 TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (5)].lex).string, type, (yyvsp[(2) - (5)].lex).line);
3504 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yyvsp[(2) - (5)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003505
3506 if (context->structQualifierErrorCheck((yyvsp[(2) - (5)].lex).line, (yyvsp[(1) - (5)].interm.type)))
3507 context->recover();
3508
3509 if (context->nonInitConstErrorCheck((yyvsp[(2) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type)))
3510 context->recover();
3511
3512 (yyval.interm).type = (yyvsp[(1) - (5)].interm.type);
3513
3514 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)))
3515 context->recover();
3516 else {
3517 int size;
3518 if (context->arraySizeErrorCheck((yyvsp[(3) - (5)].lex).line, (yyvsp[(4) - (5)].interm.intermTypedNode), size))
3519 context->recover();
3520
3521 (yyvsp[(1) - (5)].interm.type).setArray(true, size);
zmo@google.comfd747b82011-04-23 01:30:07 +00003522 TVariable* variable = 0;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003523 if (context->arrayErrorCheck((yyvsp[(3) - (5)].lex).line, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type), variable))
3524 context->recover();
zmo@google.comfd747b82011-04-23 01:30:07 +00003525 if (variable && symbol)
3526 symbol->setId(variable->getUniqueId());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003527 }
3528 ;}
3529 break;
3530
3531 case 100:
3532
3533 {
3534 if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
3535 context->recover();
3536
3537 (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
3538
3539 TIntermNode* intermNode;
3540 if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode)) {
3541 //
3542 // Build intermediate representation
3543 //
3544 if(intermNode)
3545 (yyval.interm).intermAggregate = context->intermediate.makeAggregate(intermNode, (yyvsp[(3) - (4)].lex).line);
3546 else
3547 (yyval.interm).intermAggregate = 0;
3548 } else {
3549 context->recover();
3550 (yyval.interm).intermAggregate = 0;
3551 }
3552 ;}
3553 break;
3554
3555 case 101:
3556
3557 {
3558 VERTEX_ONLY("invariant declaration", (yyvsp[(1) - (2)].lex).line);
3559 (yyval.interm).qualifier = EvqInvariantVaryingOut;
3560 (yyval.interm).intermAggregate = 0;
3561 ;}
3562 break;
3563
3564 case 102:
3565
3566 {
3567 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3568
3569 if ((yyvsp[(1) - (1)].interm.type).array) {
3570 context->error((yyvsp[(1) - (1)].interm.type).line, "not supported", "first-class array", "");
3571 context->recover();
3572 (yyvsp[(1) - (1)].interm.type).setArray(false);
3573 }
3574 ;}
3575 break;
3576
3577 case 103:
3578
3579 {
3580 if ((yyvsp[(2) - (2)].interm.type).array) {
3581 context->error((yyvsp[(2) - (2)].interm.type).line, "not supported", "first-class array", "");
3582 context->recover();
3583 (yyvsp[(2) - (2)].interm.type).setArray(false);
3584 }
3585
3586 if ((yyvsp[(1) - (2)].interm.type).qualifier == EvqAttribute &&
3587 ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
3588 context->error((yyvsp[(2) - (2)].interm.type).line, "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier), "");
3589 context->recover();
3590 }
3591 if (((yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingIn || (yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingOut) &&
3592 ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
3593 context->error((yyvsp[(2) - (2)].interm.type).line, "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier), "");
3594 context->recover();
3595 }
3596 (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
3597 (yyval.interm.type).qualifier = (yyvsp[(1) - (2)].interm.type).qualifier;
3598 ;}
3599 break;
3600
3601 case 104:
3602
3603 {
3604 (yyval.interm.type).setBasic(EbtVoid, EvqConst, (yyvsp[(1) - (1)].lex).line);
3605 ;}
3606 break;
3607
3608 case 105:
3609
3610 {
3611 VERTEX_ONLY("attribute", (yyvsp[(1) - (1)].lex).line);
3612 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "attribute"))
3613 context->recover();
3614 (yyval.interm.type).setBasic(EbtVoid, EvqAttribute, (yyvsp[(1) - (1)].lex).line);
3615 ;}
3616 break;
3617
3618 case 106:
3619
3620 {
3621 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "varying"))
3622 context->recover();
3623 if (context->shaderType == SH_VERTEX_SHADER)
3624 (yyval.interm.type).setBasic(EbtVoid, EvqVaryingOut, (yyvsp[(1) - (1)].lex).line);
3625 else
3626 (yyval.interm.type).setBasic(EbtVoid, EvqVaryingIn, (yyvsp[(1) - (1)].lex).line);
3627 ;}
3628 break;
3629
3630 case 107:
3631
3632 {
3633 if (context->globalErrorCheck((yyvsp[(1) - (2)].lex).line, context->symbolTable.atGlobalLevel(), "invariant varying"))
3634 context->recover();
3635 if (context->shaderType == SH_VERTEX_SHADER)
3636 (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingOut, (yyvsp[(1) - (2)].lex).line);
3637 else
3638 (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingIn, (yyvsp[(1) - (2)].lex).line);
3639 ;}
3640 break;
3641
3642 case 108:
3643
3644 {
3645 if (context->globalErrorCheck((yyvsp[(1) - (1)].lex).line, context->symbolTable.atGlobalLevel(), "uniform"))
3646 context->recover();
3647 (yyval.interm.type).setBasic(EbtVoid, EvqUniform, (yyvsp[(1) - (1)].lex).line);
3648 ;}
3649 break;
3650
3651 case 109:
3652
3653 {
3654 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
zmo@google.comdc4b4f82011-06-17 00:42:53 +00003655
3656 if ((yyval.interm.type).precision == EbpUndefined) {
3657 (yyval.interm.type).precision = context->symbolTable.getDefaultPrecision((yyvsp[(1) - (1)].interm.type).type);
3658 if (context->precisionErrorCheck((yyvsp[(1) - (1)].interm.type).line, (yyval.interm.type).precision, (yyvsp[(1) - (1)].interm.type).type)) {
3659 context->recover();
3660 }
3661 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003662 ;}
3663 break;
3664
3665 case 110:
3666
3667 {
3668 (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
3669 (yyval.interm.type).precision = (yyvsp[(1) - (2)].interm.precision);
3670 ;}
3671 break;
3672
3673 case 111:
3674
3675 {
3676 (yyval.interm.precision) = EbpHigh;
3677 ;}
3678 break;
3679
3680 case 112:
3681
3682 {
3683 (yyval.interm.precision) = EbpMedium;
3684 ;}
3685 break;
3686
3687 case 113:
3688
3689 {
3690 (yyval.interm.precision) = EbpLow;
3691 ;}
3692 break;
3693
3694 case 114:
3695
3696 {
3697 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3698 ;}
3699 break;
3700
3701 case 115:
3702
3703 {
3704 (yyval.interm.type) = (yyvsp[(1) - (4)].interm.type);
3705
3706 if (context->arrayTypeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
3707 context->recover();
3708 else {
3709 int size;
3710 if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
3711 context->recover();
3712 (yyval.interm.type).setArray(true, size);
3713 }
3714 ;}
3715 break;
3716
3717 case 116:
3718
3719 {
3720 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3721 (yyval.interm.type).setBasic(EbtVoid, qual, (yyvsp[(1) - (1)].lex).line);
3722 ;}
3723 break;
3724
3725 case 117:
3726
3727 {
3728 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3729 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3730 ;}
3731 break;
3732
3733 case 118:
3734
3735 {
3736 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3737 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3738 ;}
3739 break;
3740
3741 case 119:
3742
3743 {
3744 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3745 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3746 ;}
3747 break;
3748
3749 case 120:
3750
3751 {
3752 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3753 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3754 (yyval.interm.type).setAggregate(2);
3755 ;}
3756 break;
3757
3758 case 121:
3759
3760 {
3761 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3762 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3763 (yyval.interm.type).setAggregate(3);
3764 ;}
3765 break;
3766
3767 case 122:
3768
3769 {
3770 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3771 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3772 (yyval.interm.type).setAggregate(4);
3773 ;}
3774 break;
3775
3776 case 123:
3777
3778 {
3779 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3780 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3781 (yyval.interm.type).setAggregate(2);
3782 ;}
3783 break;
3784
3785 case 124:
3786
3787 {
3788 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3789 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3790 (yyval.interm.type).setAggregate(3);
3791 ;}
3792 break;
3793
3794 case 125:
3795
3796 {
3797 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3798 (yyval.interm.type).setBasic(EbtBool, qual, (yyvsp[(1) - (1)].lex).line);
3799 (yyval.interm.type).setAggregate(4);
3800 ;}
3801 break;
3802
3803 case 126:
3804
3805 {
3806 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3807 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3808 (yyval.interm.type).setAggregate(2);
3809 ;}
3810 break;
3811
3812 case 127:
3813
3814 {
3815 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3816 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3817 (yyval.interm.type).setAggregate(3);
3818 ;}
3819 break;
3820
3821 case 128:
3822
3823 {
3824 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3825 (yyval.interm.type).setBasic(EbtInt, qual, (yyvsp[(1) - (1)].lex).line);
3826 (yyval.interm.type).setAggregate(4);
3827 ;}
3828 break;
3829
3830 case 129:
3831
3832 {
3833 FRAG_VERT_ONLY("mat2", (yyvsp[(1) - (1)].lex).line);
3834 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3835 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3836 (yyval.interm.type).setAggregate(2, true);
3837 ;}
3838 break;
3839
3840 case 130:
3841
3842 {
3843 FRAG_VERT_ONLY("mat3", (yyvsp[(1) - (1)].lex).line);
3844 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3845 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3846 (yyval.interm.type).setAggregate(3, true);
3847 ;}
3848 break;
3849
3850 case 131:
3851
3852 {
3853 FRAG_VERT_ONLY("mat4", (yyvsp[(1) - (1)].lex).line);
3854 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3855 (yyval.interm.type).setBasic(EbtFloat, qual, (yyvsp[(1) - (1)].lex).line);
3856 (yyval.interm.type).setAggregate(4, true);
3857 ;}
3858 break;
3859
3860 case 132:
3861
3862 {
3863 FRAG_VERT_ONLY("sampler2D", (yyvsp[(1) - (1)].lex).line);
3864 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3865 (yyval.interm.type).setBasic(EbtSampler2D, qual, (yyvsp[(1) - (1)].lex).line);
3866 ;}
3867 break;
3868
3869 case 133:
3870
3871 {
3872 FRAG_VERT_ONLY("samplerCube", (yyvsp[(1) - (1)].lex).line);
3873 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3874 (yyval.interm.type).setBasic(EbtSamplerCube, qual, (yyvsp[(1) - (1)].lex).line);
3875 ;}
3876 break;
3877
3878 case 134:
3879
3880 {
zmo@google.com09c323a2011-08-12 18:22:25 +00003881 if (!context->supportsExtension("GL_OES_EGL_image_external")) {
3882 context->error((yyvsp[(1) - (1)].lex).line, "unsupported type", "samplerExternalOES", "");
3883 context->recover();
3884 }
3885 FRAG_VERT_ONLY("samplerExternalOES", (yyvsp[(1) - (1)].lex).line);
3886 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3887 (yyval.interm.type).setBasic(EbtSamplerExternalOES, qual, (yyvsp[(1) - (1)].lex).line);
3888 ;}
3889 break;
3890
3891 case 135:
3892
3893 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003894 FRAG_VERT_ONLY("struct", (yyvsp[(1) - (1)].interm.type).line);
3895 (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
3896 (yyval.interm.type).qualifier = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3897 ;}
3898 break;
3899
zmo@google.com09c323a2011-08-12 18:22:25 +00003900 case 136:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003901
3902 {
3903 //
3904 // This is for user defined type names. The lexical phase looked up the
3905 // type.
3906 //
3907 TType& structure = static_cast<TVariable*>((yyvsp[(1) - (1)].lex).symbol)->getType();
3908 TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3909 (yyval.interm.type).setBasic(EbtStruct, qual, (yyvsp[(1) - (1)].lex).line);
3910 (yyval.interm.type).userDef = &structure;
3911 ;}
3912 break;
3913
zmo@google.com09c323a2011-08-12 18:22:25 +00003914 case 137:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003915
kbr@chromium.org476541f2011-10-27 21:14:51 +00003916 { if (context->enterStructDeclaration((yyvsp[(2) - (3)].lex).line, *(yyvsp[(2) - (3)].lex).string)) context->recover(); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003917 break;
3918
zmo@google.com09c323a2011-08-12 18:22:25 +00003919 case 138:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003920
3921 {
kbr@chromium.org476541f2011-10-27 21:14:51 +00003922 if (context->reservedErrorCheck((yyvsp[(2) - (6)].lex).line, *(yyvsp[(2) - (6)].lex).string))
3923 context->recover();
3924
3925 TType* structure = new TType((yyvsp[(5) - (6)].interm.typeList), *(yyvsp[(2) - (6)].lex).string);
3926 TVariable* userTypeDef = new TVariable((yyvsp[(2) - (6)].lex).string, *structure, true);
3927 if (! context->symbolTable.insert(*userTypeDef)) {
3928 context->error((yyvsp[(2) - (6)].lex).line, "redefinition", (yyvsp[(2) - (6)].lex).string->c_str(), "struct");
3929 context->recover();
3930 }
3931 (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (6)].lex).line);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003932 (yyval.interm.type).userDef = structure;
kbr@chromium.org476541f2011-10-27 21:14:51 +00003933 context->exitStructDeclaration();
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003934 ;}
3935 break;
3936
zmo@google.com09c323a2011-08-12 18:22:25 +00003937 case 139:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003938
kbr@chromium.org476541f2011-10-27 21:14:51 +00003939 { if (context->enterStructDeclaration((yyvsp[(2) - (2)].lex).line, *(yyvsp[(2) - (2)].lex).string)) context->recover(); ;}
3940 break;
3941
3942 case 140:
3943
3944 {
3945 TType* structure = new TType((yyvsp[(4) - (5)].interm.typeList), TString(""));
3946 (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (5)].lex).line);
3947 (yyval.interm.type).userDef = structure;
3948 context->exitStructDeclaration();
3949 ;}
3950 break;
3951
3952 case 141:
3953
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003954 {
3955 (yyval.interm.typeList) = (yyvsp[(1) - (1)].interm.typeList);
3956 ;}
3957 break;
3958
kbr@chromium.org476541f2011-10-27 21:14:51 +00003959 case 142:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003960
3961 {
3962 (yyval.interm.typeList) = (yyvsp[(1) - (2)].interm.typeList);
3963 for (unsigned int i = 0; i < (yyvsp[(2) - (2)].interm.typeList)->size(); ++i) {
3964 for (unsigned int j = 0; j < (yyval.interm.typeList)->size(); ++j) {
3965 if ((*(yyval.interm.typeList))[j].type->getFieldName() == (*(yyvsp[(2) - (2)].interm.typeList))[i].type->getFieldName()) {
3966 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());
3967 context->recover();
3968 }
3969 }
3970 (yyval.interm.typeList)->push_back((*(yyvsp[(2) - (2)].interm.typeList))[i]);
3971 }
3972 ;}
3973 break;
3974
kbr@chromium.org476541f2011-10-27 21:14:51 +00003975 case 143:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003976
3977 {
3978 (yyval.interm.typeList) = (yyvsp[(2) - (3)].interm.typeList);
3979
3980 if (context->voidErrorCheck((yyvsp[(1) - (3)].interm.type).line, (*(yyvsp[(2) - (3)].interm.typeList))[0].type->getFieldName(), (yyvsp[(1) - (3)].interm.type))) {
3981 context->recover();
3982 }
3983 for (unsigned int i = 0; i < (yyval.interm.typeList)->size(); ++i) {
3984 //
3985 // Careful not to replace already known aspects of type, like array-ness
3986 //
3987 TType* type = (*(yyval.interm.typeList))[i].type;
3988 type->setBasicType((yyvsp[(1) - (3)].interm.type).type);
3989 type->setNominalSize((yyvsp[(1) - (3)].interm.type).size);
3990 type->setMatrix((yyvsp[(1) - (3)].interm.type).matrix);
zmo@google.comdc4b4f82011-06-17 00:42:53 +00003991 type->setPrecision((yyvsp[(1) - (3)].interm.type).precision);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00003992
3993 // don't allow arrays of arrays
3994 if (type->isArray()) {
3995 if (context->arrayTypeErrorCheck((yyvsp[(1) - (3)].interm.type).line, (yyvsp[(1) - (3)].interm.type)))
3996 context->recover();
3997 }
3998 if ((yyvsp[(1) - (3)].interm.type).array)
3999 type->setArraySize((yyvsp[(1) - (3)].interm.type).arraySize);
4000 if ((yyvsp[(1) - (3)].interm.type).userDef) {
4001 type->setStruct((yyvsp[(1) - (3)].interm.type).userDef->getStruct());
4002 type->setTypeName((yyvsp[(1) - (3)].interm.type).userDef->getTypeName());
4003 }
kbr@chromium.org476541f2011-10-27 21:14:51 +00004004
4005 if (context->structNestingErrorCheck((yyvsp[(1) - (3)].interm.type).line, *type)) {
4006 context->recover();
4007 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004008 }
4009 ;}
4010 break;
4011
kbr@chromium.org476541f2011-10-27 21:14:51 +00004012 case 144:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004013
4014 {
4015 (yyval.interm.typeList) = NewPoolTTypeList();
4016 (yyval.interm.typeList)->push_back((yyvsp[(1) - (1)].interm.typeLine));
4017 ;}
4018 break;
4019
kbr@chromium.org476541f2011-10-27 21:14:51 +00004020 case 145:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004021
4022 {
4023 (yyval.interm.typeList)->push_back((yyvsp[(3) - (3)].interm.typeLine));
4024 ;}
4025 break;
4026
kbr@chromium.org476541f2011-10-27 21:14:51 +00004027 case 146:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004028
4029 {
4030 if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
4031 context->recover();
4032
4033 (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
4034 (yyval.interm.typeLine).line = (yyvsp[(1) - (1)].lex).line;
4035 (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (1)].lex).string);
4036 ;}
4037 break;
4038
kbr@chromium.org476541f2011-10-27 21:14:51 +00004039 case 147:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004040
4041 {
4042 if (context->reservedErrorCheck((yyvsp[(1) - (4)].lex).line, *(yyvsp[(1) - (4)].lex).string))
4043 context->recover();
4044
4045 (yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
4046 (yyval.interm.typeLine).line = (yyvsp[(1) - (4)].lex).line;
4047 (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (4)].lex).string);
4048
4049 int size;
4050 if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
4051 context->recover();
4052 (yyval.interm.typeLine).type->setArraySize(size);
4053 ;}
4054 break;
4055
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004056 case 148:
4057
kbr@chromium.org476541f2011-10-27 21:14:51 +00004058 { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004059 break;
4060
4061 case 149:
4062
4063 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
4064 break;
4065
4066 case 150:
4067
kbr@chromium.org476541f2011-10-27 21:14:51 +00004068 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermAggregate); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004069 break;
4070
4071 case 151:
4072
4073 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
4074 break;
4075
4076 case 152:
4077
4078 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
4079 break;
4080
4081 case 153:
4082
4083 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
4084 break;
4085
4086 case 154:
4087
zmo@google.com09c323a2011-08-12 18:22:25 +00004088 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004089 break;
4090
4091 case 155:
4092
kbr@chromium.org476541f2011-10-27 21:14:51 +00004093 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004094 break;
4095
4096 case 156:
4097
kbr@chromium.org476541f2011-10-27 21:14:51 +00004098 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004099 break;
4100
4101 case 157:
4102
kbr@chromium.org476541f2011-10-27 21:14:51 +00004103 { (yyval.interm.intermAggregate) = 0; ;}
zmo@google.com09c323a2011-08-12 18:22:25 +00004104 break;
4105
4106 case 158:
4107
kbr@chromium.org476541f2011-10-27 21:14:51 +00004108 { context->symbolTable.push(); ;}
4109 break;
4110
4111 case 159:
4112
4113 { context->symbolTable.pop(); ;}
4114 break;
4115
4116 case 160:
4117
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004118 {
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004119 if ((yyvsp[(3) - (5)].interm.intermAggregate) != 0) {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004120 (yyvsp[(3) - (5)].interm.intermAggregate)->setOp(EOpSequence);
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004121 (yyvsp[(3) - (5)].interm.intermAggregate)->setEndLine((yyvsp[(5) - (5)].lex).line);
4122 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004123 (yyval.interm.intermAggregate) = (yyvsp[(3) - (5)].interm.intermAggregate);
4124 ;}
4125 break;
4126
zmo@google.com09c323a2011-08-12 18:22:25 +00004127 case 161:
4128
kbr@chromium.org476541f2011-10-27 21:14:51 +00004129 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
4130 break;
4131
4132 case 162:
4133
4134 { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); ;}
4135 break;
4136
4137 case 163:
4138
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004139 {
4140 (yyval.interm.intermNode) = 0;
4141 ;}
4142 break;
4143
kbr@chromium.org476541f2011-10-27 21:14:51 +00004144 case 164:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004145
4146 {
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004147 if ((yyvsp[(2) - (3)].interm.intermAggregate)) {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004148 (yyvsp[(2) - (3)].interm.intermAggregate)->setOp(EOpSequence);
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004149 (yyvsp[(2) - (3)].interm.intermAggregate)->setEndLine((yyvsp[(3) - (3)].lex).line);
4150 }
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004151 (yyval.interm.intermNode) = (yyvsp[(2) - (3)].interm.intermAggregate);
4152 ;}
4153 break;
4154
kbr@chromium.org476541f2011-10-27 21:14:51 +00004155 case 165:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004156
4157 {
4158 (yyval.interm.intermAggregate) = context->intermediate.makeAggregate((yyvsp[(1) - (1)].interm.intermNode), 0);
4159 ;}
4160 break;
4161
kbr@chromium.org476541f2011-10-27 21:14:51 +00004162 case 166:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004163
4164 {
4165 (yyval.interm.intermAggregate) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermAggregate), (yyvsp[(2) - (2)].interm.intermNode), 0);
4166 ;}
4167 break;
4168
kbr@chromium.org476541f2011-10-27 21:14:51 +00004169 case 167:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004170
4171 { (yyval.interm.intermNode) = 0; ;}
4172 break;
4173
kbr@chromium.org476541f2011-10-27 21:14:51 +00004174 case 168:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004175
4176 { (yyval.interm.intermNode) = static_cast<TIntermNode*>((yyvsp[(1) - (2)].interm.intermTypedNode)); ;}
4177 break;
4178
kbr@chromium.org476541f2011-10-27 21:14:51 +00004179 case 169:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004180
4181 {
4182 if (context->boolErrorCheck((yyvsp[(1) - (5)].lex).line, (yyvsp[(3) - (5)].interm.intermTypedNode)))
4183 context->recover();
4184 (yyval.interm.intermNode) = context->intermediate.addSelection((yyvsp[(3) - (5)].interm.intermTypedNode), (yyvsp[(5) - (5)].interm.nodePair), (yyvsp[(1) - (5)].lex).line);
4185 ;}
4186 break;
4187
kbr@chromium.org476541f2011-10-27 21:14:51 +00004188 case 170:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004189
4190 {
4191 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermNode);
4192 (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermNode);
4193 ;}
4194 break;
4195
kbr@chromium.org476541f2011-10-27 21:14:51 +00004196 case 171:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004197
4198 {
4199 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (1)].interm.intermNode);
4200 (yyval.interm.nodePair).node2 = 0;
4201 ;}
4202 break;
4203
kbr@chromium.org476541f2011-10-27 21:14:51 +00004204 case 172:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004205
4206 {
4207 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
4208 if (context->boolErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)->getLine(), (yyvsp[(1) - (1)].interm.intermTypedNode)))
4209 context->recover();
4210 ;}
4211 break;
4212
kbr@chromium.org476541f2011-10-27 21:14:51 +00004213 case 173:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004214
4215 {
4216 TIntermNode* intermNode;
4217 if (context->structQualifierErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
4218 context->recover();
4219 if (context->boolErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(1) - (4)].interm.type)))
4220 context->recover();
4221
4222 if (!context->executeInitializer((yyvsp[(2) - (4)].lex).line, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode))
4223 (yyval.interm.intermTypedNode) = (yyvsp[(4) - (4)].interm.intermTypedNode);
4224 else {
4225 context->recover();
4226 (yyval.interm.intermTypedNode) = 0;
4227 }
4228 ;}
4229 break;
4230
kbr@chromium.org476541f2011-10-27 21:14:51 +00004231 case 174:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004232
4233 { context->symbolTable.push(); ++context->loopNestingLevel; ;}
4234 break;
4235
kbr@chromium.org476541f2011-10-27 21:14:51 +00004236 case 175:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004237
4238 {
4239 context->symbolTable.pop();
alokp@chromium.org52813552010-11-16 18:36:09 +00004240 (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 +00004241 --context->loopNestingLevel;
4242 ;}
4243 break;
4244
kbr@chromium.org476541f2011-10-27 21:14:51 +00004245 case 176:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004246
4247 { ++context->loopNestingLevel; ;}
4248 break;
4249
kbr@chromium.org476541f2011-10-27 21:14:51 +00004250 case 177:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004251
4252 {
4253 if (context->boolErrorCheck((yyvsp[(8) - (8)].lex).line, (yyvsp[(6) - (8)].interm.intermTypedNode)))
4254 context->recover();
4255
alokp@chromium.org52813552010-11-16 18:36:09 +00004256 (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 +00004257 --context->loopNestingLevel;
4258 ;}
4259 break;
4260
kbr@chromium.org476541f2011-10-27 21:14:51 +00004261 case 178:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004262
zmo@google.com09c323a2011-08-12 18:22:25 +00004263 { context->symbolTable.push(); ++context->loopNestingLevel; ;}
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004264 break;
4265
kbr@chromium.org476541f2011-10-27 21:14:51 +00004266 case 179:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004267
4268 {
zmo@google.com09c323a2011-08-12 18:22:25 +00004269 context->symbolTable.pop();
4270 (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);
4271 --context->loopNestingLevel;
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004272 ;}
4273 break;
4274
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004275 case 180:
4276
4277 {
kbr@chromium.org476541f2011-10-27 21:14:51 +00004278 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004279 ;}
4280 break;
4281
4282 case 181:
4283
4284 {
kbr@chromium.org476541f2011-10-27 21:14:51 +00004285 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
zmo@google.com09c323a2011-08-12 18:22:25 +00004286 ;}
4287 break;
4288
4289 case 182:
4290
4291 {
kbr@chromium.org476541f2011-10-27 21:14:51 +00004292 (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
4293 ;}
4294 break;
4295
4296 case 183:
4297
4298 {
4299 (yyval.interm.intermTypedNode) = 0;
4300 ;}
4301 break;
4302
4303 case 184:
4304
4305 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004306 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (2)].interm.intermTypedNode);
4307 (yyval.interm.nodePair).node2 = 0;
4308 ;}
4309 break;
4310
kbr@chromium.org476541f2011-10-27 21:14:51 +00004311 case 185:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004312
4313 {
4314 (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermTypedNode);
4315 (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermTypedNode);
4316 ;}
4317 break;
4318
kbr@chromium.org476541f2011-10-27 21:14:51 +00004319 case 186:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004320
4321 {
4322 if (context->loopNestingLevel <= 0) {
4323 context->error((yyvsp[(1) - (2)].lex).line, "continue statement only allowed in loops", "", "");
4324 context->recover();
4325 }
4326 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpContinue, (yyvsp[(1) - (2)].lex).line);
4327 ;}
4328 break;
4329
kbr@chromium.org476541f2011-10-27 21:14:51 +00004330 case 187:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004331
4332 {
4333 if (context->loopNestingLevel <= 0) {
4334 context->error((yyvsp[(1) - (2)].lex).line, "break statement only allowed in loops", "", "");
4335 context->recover();
4336 }
4337 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpBreak, (yyvsp[(1) - (2)].lex).line);
4338 ;}
4339 break;
4340
kbr@chromium.org476541f2011-10-27 21:14:51 +00004341 case 188:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004342
4343 {
4344 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(1) - (2)].lex).line);
4345 if (context->currentFunctionType->getBasicType() != EbtVoid) {
4346 context->error((yyvsp[(1) - (2)].lex).line, "non-void function must return a value", "return", "");
4347 context->recover();
4348 }
4349 ;}
4350 break;
4351
kbr@chromium.org476541f2011-10-27 21:14:51 +00004352 case 189:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004353
4354 {
4355 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(2) - (3)].interm.intermTypedNode), (yyvsp[(1) - (3)].lex).line);
4356 context->functionReturnsValue = true;
4357 if (context->currentFunctionType->getBasicType() == EbtVoid) {
4358 context->error((yyvsp[(1) - (3)].lex).line, "void function cannot return a value", "return", "");
4359 context->recover();
4360 } else if (*(context->currentFunctionType) != (yyvsp[(2) - (3)].interm.intermTypedNode)->getType()) {
4361 context->error((yyvsp[(1) - (3)].lex).line, "function return is not matching type:", "return", "");
4362 context->recover();
4363 }
4364 ;}
4365 break;
4366
kbr@chromium.org476541f2011-10-27 21:14:51 +00004367 case 190:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004368
4369 {
4370 FRAG_ONLY("discard", (yyvsp[(1) - (2)].lex).line);
4371 (yyval.interm.intermNode) = context->intermediate.addBranch(EOpKill, (yyvsp[(1) - (2)].lex).line);
4372 ;}
4373 break;
4374
kbr@chromium.org476541f2011-10-27 21:14:51 +00004375 case 191:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004376
4377 {
zmo@google.com09c323a2011-08-12 18:22:25 +00004378 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004379 context->treeRoot = (yyval.interm.intermNode);
4380 ;}
4381 break;
4382
kbr@chromium.org476541f2011-10-27 21:14:51 +00004383 case 192:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004384
4385 {
zmo@google.com09c323a2011-08-12 18:22:25 +00004386 (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermNode), (yyvsp[(2) - (2)].interm.intermNode), 0);
4387 context->treeRoot = (yyval.interm.intermNode);
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004388 ;}
4389 break;
4390
zmo@google.com09c323a2011-08-12 18:22:25 +00004391 case 193:
4392
4393 {
kbr@chromium.org476541f2011-10-27 21:14:51 +00004394 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
4395 ;}
4396 break;
4397
4398 case 194:
4399
4400 {
4401 (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
4402 ;}
4403 break;
4404
4405 case 195:
4406
4407 {
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004408 TFunction* function = (yyvsp[(1) - (1)].interm).function;
4409 TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find(function->getMangledName()));
4410 //
4411 // Note: 'prevDec' could be 'function' if this is the first time we've seen function
4412 // as it would have just been put in the symbol table. Otherwise, we're looking up
4413 // an earlier occurance.
4414 //
4415 if (prevDec->isDefined()) {
4416 //
4417 // Then this function already has a body.
4418 //
4419 context->error((yyvsp[(1) - (1)].interm).line, "function already has a body", function->getName().c_str(), "");
4420 context->recover();
4421 }
4422 prevDec->setDefined();
4423
4424 //
4425 // Raise error message if main function takes any parameters or return anything other than void
4426 //
4427 if (function->getName() == "main") {
4428 if (function->getParamCount() > 0) {
4429 context->error((yyvsp[(1) - (1)].interm).line, "function cannot take any parameter(s)", function->getName().c_str(), "");
4430 context->recover();
4431 }
4432 if (function->getReturnType().getBasicType() != EbtVoid) {
4433 context->error((yyvsp[(1) - (1)].interm).line, "", function->getReturnType().getBasicString(), "main function cannot return a value");
4434 context->recover();
4435 }
4436 }
4437
4438 //
4439 // New symbol table scope for body of function plus its arguments
4440 //
4441 context->symbolTable.push();
4442
4443 //
4444 // Remember the return type for later checking for RETURN statements.
4445 //
4446 context->currentFunctionType = &(prevDec->getReturnType());
4447 context->functionReturnsValue = false;
4448
4449 //
4450 // Insert parameters into the symbol table.
4451 // If the parameter has no name, it's not an error, just don't insert it
4452 // (could be used for unused args).
4453 //
4454 // Also, accumulate the list of parameters into the HIL, so lower level code
4455 // knows where to find parameters.
4456 //
4457 TIntermAggregate* paramNodes = new TIntermAggregate;
4458 for (int i = 0; i < function->getParamCount(); i++) {
4459 const TParameter& param = function->getParam(i);
4460 if (param.name != 0) {
4461 TVariable *variable = new TVariable(param.name, *param.type);
4462 //
4463 // Insert the parameters with name in the symbol table.
4464 //
4465 if (! context->symbolTable.insert(*variable)) {
4466 context->error((yyvsp[(1) - (1)].interm).line, "redefinition", variable->getName().c_str(), "");
4467 context->recover();
4468 delete variable;
4469 }
4470
4471 //
4472 // Add the parameter to the HIL
4473 //
4474 paramNodes = context->intermediate.growAggregate(
4475 paramNodes,
4476 context->intermediate.addSymbol(variable->getUniqueId(),
4477 variable->getName(),
4478 variable->getType(), (yyvsp[(1) - (1)].interm).line),
4479 (yyvsp[(1) - (1)].interm).line);
4480 } else {
4481 paramNodes = context->intermediate.growAggregate(paramNodes, context->intermediate.addSymbol(0, "", *param.type, (yyvsp[(1) - (1)].interm).line), (yyvsp[(1) - (1)].interm).line);
4482 }
4483 }
4484 context->intermediate.setAggregateOperator(paramNodes, EOpParameters, (yyvsp[(1) - (1)].interm).line);
4485 (yyvsp[(1) - (1)].interm).intermAggregate = paramNodes;
4486 context->loopNestingLevel = 0;
4487 ;}
4488 break;
4489
kbr@chromium.org476541f2011-10-27 21:14:51 +00004490 case 196:
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004491
4492 {
4493 //?? Check that all paths return a value if return type != void ?
4494 // May be best done as post process phase on intermediate code
4495 if (context->currentFunctionType->getBasicType() != EbtVoid && ! context->functionReturnsValue) {
4496 context->error((yyvsp[(1) - (3)].interm).line, "function does not return a value:", "", (yyvsp[(1) - (3)].interm).function->getName().c_str());
4497 context->recover();
4498 }
4499 context->symbolTable.pop();
4500 (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermAggregate, (yyvsp[(3) - (3)].interm.intermNode), 0);
4501 context->intermediate.setAggregateOperator((yyval.interm.intermNode), EOpFunction, (yyvsp[(1) - (3)].interm).line);
4502 (yyval.interm.intermNode)->getAsAggregate()->setName((yyvsp[(1) - (3)].interm).function->getMangledName().c_str());
4503 (yyval.interm.intermNode)->getAsAggregate()->setType((yyvsp[(1) - (3)].interm).function->getReturnType());
4504
4505 // store the pragma information for debug and optimize and other vendor specific
4506 // information. This information can be queried from the parse tree
4507 (yyval.interm.intermNode)->getAsAggregate()->setOptimize(context->contextPragma.optimize);
4508 (yyval.interm.intermNode)->getAsAggregate()->setDebug(context->contextPragma.debug);
4509 (yyval.interm.intermNode)->getAsAggregate()->addToPragmaTable(context->contextPragma.pragmaTable);
apatrick@chromium.org0f4cefe2011-01-26 19:30:57 +00004510
4511 if ((yyvsp[(3) - (3)].interm.intermNode) && (yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate())
4512 (yyval.interm.intermNode)->getAsAggregate()->setEndLine((yyvsp[(3) - (3)].interm.intermNode)->getAsAggregate()->getEndLine());
alokp@chromium.org044a5cf2010-11-12 15:42:16 +00004513 ;}
4514 break;
4515
4516
4517/* Line 1267 of yacc.c. */
4518
4519 default: break;
4520 }
4521 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
4522
4523 YYPOPSTACK (yylen);
4524 yylen = 0;
4525 YY_STACK_PRINT (yyss, yyssp);
4526
4527 *++yyvsp = yyval;
4528
4529
4530 /* Now `shift' the result of the reduction. Determine what state
4531 that goes to, based on the state we popped back to and the rule
4532 number reduced by. */
4533
4534 yyn = yyr1[yyn];
4535
4536 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
4537 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
4538 yystate = yytable[yystate];
4539 else
4540 yystate = yydefgoto[yyn - YYNTOKENS];
4541
4542 goto yynewstate;
4543
4544
4545/*------------------------------------.
4546| yyerrlab -- here on detecting error |
4547`------------------------------------*/
4548yyerrlab:
4549 /* If not already recovering from an error, report this error. */
4550 if (!yyerrstatus)
4551 {
4552 ++yynerrs;
4553#if ! YYERROR_VERBOSE
4554 yyerror (context, YY_("syntax error"));
4555#else
4556 {
4557 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
4558 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
4559 {
4560 YYSIZE_T yyalloc = 2 * yysize;
4561 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
4562 yyalloc = YYSTACK_ALLOC_MAXIMUM;
4563 if (yymsg != yymsgbuf)
4564 YYSTACK_FREE (yymsg);
4565 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
4566 if (yymsg)
4567 yymsg_alloc = yyalloc;
4568 else
4569 {
4570 yymsg = yymsgbuf;
4571 yymsg_alloc = sizeof yymsgbuf;
4572 }
4573 }
4574
4575 if (0 < yysize && yysize <= yymsg_alloc)
4576 {
4577 (void) yysyntax_error (yymsg, yystate, yychar);
4578 yyerror (context, yymsg);
4579 }
4580 else
4581 {
4582 yyerror (context, YY_("syntax error"));
4583 if (yysize != 0)
4584 goto yyexhaustedlab;
4585 }
4586 }
4587#endif
4588 }
4589
4590
4591
4592 if (yyerrstatus == 3)
4593 {
4594 /* If just tried and failed to reuse look-ahead token after an
4595 error, discard it. */
4596
4597 if (yychar <= YYEOF)
4598 {
4599 /* Return failure if at end of input. */
4600 if (yychar == YYEOF)
4601 YYABORT;
4602 }
4603 else
4604 {
4605 yydestruct ("Error: discarding",
4606 yytoken, &yylval, context);
4607 yychar = YYEMPTY;
4608 }
4609 }
4610
4611 /* Else will try to reuse look-ahead token after shifting the error
4612 token. */
4613 goto yyerrlab1;
4614
4615
4616/*---------------------------------------------------.
4617| yyerrorlab -- error raised explicitly by YYERROR. |
4618`---------------------------------------------------*/
4619yyerrorlab:
4620
4621 /* Pacify compilers like GCC when the user code never invokes
4622 YYERROR and the label yyerrorlab therefore never appears in user
4623 code. */
4624 if (/*CONSTCOND*/ 0)
4625 goto yyerrorlab;
4626
4627 /* Do not reclaim the symbols of the rule which action triggered
4628 this YYERROR. */
4629 YYPOPSTACK (yylen);
4630 yylen = 0;
4631 YY_STACK_PRINT (yyss, yyssp);
4632 yystate = *yyssp;
4633 goto yyerrlab1;
4634
4635
4636/*-------------------------------------------------------------.
4637| yyerrlab1 -- common code for both syntax error and YYERROR. |
4638`-------------------------------------------------------------*/
4639yyerrlab1:
4640 yyerrstatus = 3; /* Each real token shifted decrements this. */
4641
4642 for (;;)
4643 {
4644 yyn = yypact[yystate];
4645 if (yyn != YYPACT_NINF)
4646 {
4647 yyn += YYTERROR;
4648 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
4649 {
4650 yyn = yytable[yyn];
4651 if (0 < yyn)
4652 break;
4653 }
4654 }
4655
4656 /* Pop the current state because it cannot handle the error token. */
4657 if (yyssp == yyss)
4658 YYABORT;
4659
4660
4661 yydestruct ("Error: popping",
4662 yystos[yystate], yyvsp, context);
4663 YYPOPSTACK (1);
4664 yystate = *yyssp;
4665 YY_STACK_PRINT (yyss, yyssp);
4666 }
4667
4668 if (yyn == YYFINAL)
4669 YYACCEPT;
4670
4671 *++yyvsp = yylval;
4672
4673
4674 /* Shift the error token. */
4675 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
4676
4677 yystate = yyn;
4678 goto yynewstate;
4679
4680
4681/*-------------------------------------.
4682| yyacceptlab -- YYACCEPT comes here. |
4683`-------------------------------------*/
4684yyacceptlab:
4685 yyresult = 0;
4686 goto yyreturn;
4687
4688/*-----------------------------------.
4689| yyabortlab -- YYABORT comes here. |
4690`-----------------------------------*/
4691yyabortlab:
4692 yyresult = 1;
4693 goto yyreturn;
4694
4695#ifndef yyoverflow
4696/*-------------------------------------------------.
4697| yyexhaustedlab -- memory exhaustion comes here. |
4698`-------------------------------------------------*/
4699yyexhaustedlab:
4700 yyerror (context, YY_("memory exhausted"));
4701 yyresult = 2;
4702 /* Fall through. */
4703#endif
4704
4705yyreturn:
4706 if (yychar != YYEOF && yychar != YYEMPTY)
4707 yydestruct ("Cleanup: discarding lookahead",
4708 yytoken, &yylval, context);
4709 /* Do not reclaim the symbols of the rule which action triggered
4710 this YYABORT or YYACCEPT. */
4711 YYPOPSTACK (yylen);
4712 YY_STACK_PRINT (yyss, yyssp);
4713 while (yyssp != yyss)
4714 {
4715 yydestruct ("Cleanup: popping",
4716 yystos[*yyssp], yyvsp, context);
4717 YYPOPSTACK (1);
4718 }
4719#ifndef yyoverflow
4720 if (yyss != yyssa)
4721 YYSTACK_FREE (yyss);
4722#endif
4723#if YYERROR_VERBOSE
4724 if (yymsg != yymsgbuf)
4725 YYSTACK_FREE (yymsg);
4726#endif
4727 /* Make sure YYID is used. */
4728 return YYID (yyresult);
4729}
4730
4731
4732
4733
4734
4735int glslang_parse(TParseContext* context) {
4736 return yyparse(context);
4737}
4738
4739